Implement standard C boolean type
This commit is contained in:
@@ -21,29 +21,29 @@ typedef struct {
|
||||
uint32_t mode; /* 0 = exposed only, 1 = unexposed only */
|
||||
} PrimitiveExposed;
|
||||
|
||||
static int32_t
|
||||
static bool
|
||||
exposed_start(void* data, RenderState* state, PyObject* support) {
|
||||
PrimitiveExposed* self = (PrimitiveExposed*)data;
|
||||
|
||||
if (!render_mode_parse_option(support, "mode", "I", &(self->mode)))
|
||||
return 1;
|
||||
return true;
|
||||
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
static int32_t
|
||||
static bool
|
||||
exposed_hidden(void* data, RenderState* state, int32_t x, int32_t y, int32_t z) {
|
||||
PrimitiveExposed* self = (PrimitiveExposed*)data;
|
||||
|
||||
/* Unset these flags if seeming exposure from any of these directions would
|
||||
* be due to not having data there.
|
||||
*/
|
||||
int32_t validMinusX = 1;
|
||||
int32_t validPlusX = 1;
|
||||
int32_t validMinusY = 1;
|
||||
int32_t validPlusY = 1;
|
||||
int32_t validMinusZ = 1;
|
||||
int32_t validPlusZ = 1;
|
||||
bool validMinusX = true;
|
||||
bool validPlusX = true;
|
||||
bool validMinusY = true;
|
||||
bool validPlusY = true;
|
||||
bool validMinusZ = true;
|
||||
bool validPlusZ = true;
|
||||
|
||||
/* special handling for section boundaries */
|
||||
/* If the neighboring section has no block data, ignore exposure from that
|
||||
@@ -51,32 +51,32 @@ exposed_hidden(void* data, RenderState* state, int32_t x, int32_t y, int32_t z)
|
||||
*/
|
||||
if (x == 0 && (!(state->chunks[0][1].loaded) || state->chunks[0][1].sections[state->chunky].blocks == NULL)) {
|
||||
/* No data in -x direction */
|
||||
validMinusX = 0;
|
||||
validMinusX = false;
|
||||
}
|
||||
|
||||
if (x == 15 && (!(state->chunks[2][1].loaded) || state->chunks[2][1].sections[state->chunky].blocks == NULL)) {
|
||||
/* No data in +x direction */
|
||||
validPlusX = 0;
|
||||
validPlusX = false;
|
||||
}
|
||||
|
||||
if (y == 0 && (state->chunky - 1 < 0 || state->chunks[1][1].sections[state->chunky - 1].blocks == NULL)) {
|
||||
/* No data in -y direction */
|
||||
validMinusY = 0;
|
||||
validMinusY = false;
|
||||
}
|
||||
|
||||
if (y == 15 && (state->chunky + 1 >= SECTIONS_PER_CHUNK || state->chunks[1][1].sections[state->chunky + 1].blocks == NULL)) {
|
||||
/* No data in +y direction */
|
||||
validPlusY = 0;
|
||||
validPlusY = false;
|
||||
}
|
||||
|
||||
if (z == 0 && (!(state->chunks[1][0].loaded) || state->chunks[1][0].sections[state->chunky].blocks == NULL)) {
|
||||
/* No data in -z direction */
|
||||
validMinusZ = 0;
|
||||
validMinusZ = false;
|
||||
}
|
||||
|
||||
if (z == 15 && (!(state->chunks[1][2].loaded) || state->chunks[1][2].sections[state->chunky].blocks == NULL)) {
|
||||
/* No data in +z direction */
|
||||
validPlusZ = 0;
|
||||
validPlusZ = false;
|
||||
}
|
||||
|
||||
/* If any of the 6 blocks adjacent to us are transparent, we're exposed */
|
||||
|
||||
Reference in New Issue
Block a user