Propagate block, bool, standard integer types across codebase
Posix type integer pass Propagate block, bool, integer types across codebase Add standard integer types to prototypes
This commit is contained in:
@@ -21,14 +21,14 @@
|
||||
#include "biomes.h"
|
||||
|
||||
typedef struct {
|
||||
int use_biomes;
|
||||
int32_t use_biomes;
|
||||
/* grasscolor and foliagecolor lookup tables */
|
||||
PyObject *grasscolor, *foliagecolor, *watercolor;
|
||||
/* biome-compatible grass/leaf textures */
|
||||
PyObject* grass_texture;
|
||||
} PrimitiveBase;
|
||||
|
||||
static int
|
||||
static int32_t
|
||||
base_start(void* data, RenderState* state, PyObject* support) {
|
||||
PrimitiveBase* self = (PrimitiveBase*)data;
|
||||
|
||||
@@ -56,8 +56,8 @@ base_finish(void* data, RenderState* state) {
|
||||
Py_DECREF(self->grass_texture);
|
||||
}
|
||||
|
||||
static int
|
||||
base_occluded(void* data, RenderState* state, int x, int y, int z) {
|
||||
static int32_t
|
||||
base_occluded(void* data, RenderState* state, int32_t x, int32_t y, int32_t z) {
|
||||
if ((x != 0) && (y != 15) && (z != 15) &&
|
||||
!render_mode_hidden(state->rendermode, x - 1, y, z) &&
|
||||
!render_mode_hidden(state->rendermode, x, y, z + 1) &&
|
||||
@@ -76,8 +76,8 @@ base_draw(void* data, RenderState* state, PyObject* src, PyObject* mask, PyObjec
|
||||
PrimitiveBase* self = (PrimitiveBase*)data;
|
||||
|
||||
/* in order to detect top parts of doublePlant grass & ferns */
|
||||
unsigned short below_block = get_data(state, BLOCKS, state->x, state->y - 1, state->z);
|
||||
unsigned char below_data = get_data(state, DATA, state->x, state->y - 1, state->z);
|
||||
mc_block_t below_block = get_data(state, BLOCKS, state->x, state->y - 1, state->z);
|
||||
uint8_t below_data = get_data(state, DATA, state->x, state->y - 1, state->z);
|
||||
|
||||
/* draw the block! */
|
||||
alpha_over(state->img, src, mask, state->imgx, state->imgy, 0, 0);
|
||||
@@ -108,9 +108,9 @@ base_draw(void* data, RenderState* state, PyObject* src, PyObject* mask, PyObjec
|
||||
(state->block == block_double_plant && below_block == block_double_plant && (below_data == 2 || below_data == 3))) {
|
||||
/* do the biome stuff! */
|
||||
PyObject* facemask = mask;
|
||||
unsigned char r = 255, g = 255, b = 255;
|
||||
uint8_t r = 255, g = 255, b = 255;
|
||||
PyObject* color_table = NULL;
|
||||
unsigned char flip_xy = 0;
|
||||
uint8_t flip_xy = 0;
|
||||
|
||||
if (state->block == block_grass) {
|
||||
/* grass needs a special facemask */
|
||||
@@ -130,12 +130,12 @@ base_draw(void* data, RenderState* state, PyObject* src, PyObject* mask, PyObjec
|
||||
}
|
||||
|
||||
if (color_table) {
|
||||
unsigned char biome;
|
||||
int dx, dz;
|
||||
unsigned char tablex, tabley;
|
||||
uint8_t biome;
|
||||
int32_t dx, dz;
|
||||
uint8_t tablex, tabley;
|
||||
float temp = 0.0, rain = 0.0;
|
||||
unsigned int multr = 0, multg = 0, multb = 0;
|
||||
int tmp;
|
||||
uint32_t multr = 0, multg = 0, multb = 0;
|
||||
int32_t tmp;
|
||||
PyObject* color = NULL;
|
||||
|
||||
if (self->use_biomes) {
|
||||
@@ -184,7 +184,7 @@ base_draw(void* data, RenderState* state, PyObject* src, PyObject* mask, PyObjec
|
||||
tablex = 255 - (255 * temp);
|
||||
tabley = 255 - (255 * rain);
|
||||
if (flip_xy) {
|
||||
unsigned char tmp = 255 - tablex;
|
||||
uint8_t tmp = 255 - tablex;
|
||||
tablex = 255 - tabley;
|
||||
tabley = tmp;
|
||||
}
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
* with the Overviewer. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define DEFAULT_BIOME 4 /* forest, nice and green */
|
||||
|
||||
typedef struct {
|
||||
@@ -23,7 +25,7 @@ typedef struct {
|
||||
float temperature;
|
||||
float rainfall;
|
||||
|
||||
unsigned int r, g, b;
|
||||
uint32_t r, g, b;
|
||||
} Biome;
|
||||
|
||||
/* each entry in this table is yanked *directly* out of the minecraft source
|
||||
|
||||
@@ -19,11 +19,11 @@
|
||||
#include "../overviewer.h"
|
||||
|
||||
typedef struct {
|
||||
int only_lit;
|
||||
int32_t only_lit;
|
||||
} RenderPrimitiveCave;
|
||||
|
||||
static inline int
|
||||
touches_light(RenderState* state, DataType type, unsigned int x, unsigned int y, unsigned int z) {
|
||||
static inline int32_t
|
||||
touches_light(RenderState* state, DataType type, uint32_t x, uint32_t y, uint32_t z) {
|
||||
if (get_data(state, type, x, y + 1, z))
|
||||
return 1;
|
||||
|
||||
@@ -38,8 +38,8 @@ touches_light(RenderState* state, DataType type, unsigned int x, unsigned int y,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
cave_occluded(void* data, RenderState* state, int x, int y, int z) {
|
||||
static int32_t
|
||||
cave_occluded(void* data, RenderState* state, int32_t x, int32_t y, int32_t z) {
|
||||
/* check for normal occlusion */
|
||||
/* use ajacent chunks, if not you get blocks spreaded in chunk edges */
|
||||
|
||||
@@ -60,10 +60,10 @@ cave_occluded(void* data, RenderState* state, int x, int y, int z) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
cave_hidden(void* data, RenderState* state, int x, int y, int z) {
|
||||
static int32_t
|
||||
cave_hidden(void* data, RenderState* state, int32_t x, int32_t y, int32_t z) {
|
||||
RenderPrimitiveCave* self;
|
||||
int dy = 0;
|
||||
int32_t dy = 0;
|
||||
self = (RenderPrimitiveCave*)data;
|
||||
|
||||
/* check if the block is touching skylight */
|
||||
@@ -102,7 +102,7 @@ cave_hidden(void* data, RenderState* state, int x, int y, int z) {
|
||||
return cave_occluded(data, state, x, y, z);
|
||||
}
|
||||
|
||||
static int
|
||||
static int32_t
|
||||
cave_start(void* data, RenderState* state, PyObject* support) {
|
||||
RenderPrimitiveCave* self;
|
||||
self = (RenderPrimitiveCave*)data;
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
|
||||
#include "../overviewer.h"
|
||||
|
||||
static int
|
||||
clear_base_occluded(void* data, RenderState* state, int x, int y, int z) {
|
||||
static int32_t
|
||||
clear_base_occluded(void* data, RenderState* state, int32_t x, int32_t y, int32_t z) {
|
||||
if ((x != 0) && (y != 15) && (z != 127) &&
|
||||
!render_mode_hidden(state->rendermode, x - 1, y, z) &&
|
||||
!render_mode_hidden(state->rendermode, x, y, z + 1) &&
|
||||
|
||||
@@ -23,7 +23,7 @@ typedef struct {
|
||||
PyObject* depth_colors;
|
||||
} RenderPrimitiveDepthTinting;
|
||||
|
||||
static int
|
||||
static int32_t
|
||||
depth_tinting_start(void* data, RenderState* state, PyObject* support) {
|
||||
RenderPrimitiveDepthTinting* self;
|
||||
self = (RenderPrimitiveDepthTinting*)data;
|
||||
@@ -46,7 +46,7 @@ depth_tinting_finish(void* data, RenderState* state) {
|
||||
static void
|
||||
depth_tinting_draw(void* data, RenderState* state, PyObject* src, PyObject* mask, PyObject* mask_light) {
|
||||
RenderPrimitiveDepthTinting* self;
|
||||
int y, r, g, b;
|
||||
int32_t y, r, g, b;
|
||||
self = (RenderPrimitiveDepthTinting*)data;
|
||||
|
||||
y = state->chunky * 16 + state->y;
|
||||
|
||||
@@ -18,11 +18,11 @@
|
||||
#include "../overviewer.h"
|
||||
|
||||
typedef struct {
|
||||
unsigned int min;
|
||||
unsigned int max;
|
||||
uint32_t min;
|
||||
uint32_t max;
|
||||
} PrimitiveDepth;
|
||||
|
||||
static int
|
||||
static int32_t
|
||||
depth_start(void* data, RenderState* state, PyObject* support) {
|
||||
PrimitiveDepth* self = (PrimitiveDepth*)data;
|
||||
|
||||
@@ -34,8 +34,8 @@ depth_start(void* data, RenderState* state, PyObject* support) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
depth_hidden(void* data, RenderState* state, int x, int y, int z) {
|
||||
static int32_t
|
||||
depth_hidden(void* data, RenderState* state, int32_t x, int32_t y, int32_t z) {
|
||||
PrimitiveDepth* self = (PrimitiveDepth*)data;
|
||||
y += 16 * state->chunky;
|
||||
if (y > self->max || y < self->min) {
|
||||
|
||||
@@ -23,7 +23,7 @@ typedef struct {
|
||||
float opacity;
|
||||
} PrimitiveEdgeLines;
|
||||
|
||||
static int
|
||||
static int32_t
|
||||
edge_lines_start(void* data, RenderState* state, PyObject* support) {
|
||||
PrimitiveEdgeLines* self = (PrimitiveEdgeLines*)data;
|
||||
if (!render_mode_parse_option(support, "opacity", "f", &(self->opacity)))
|
||||
@@ -38,11 +38,11 @@ edge_lines_draw(void* data, RenderState* state, PyObject* src, PyObject* mask, P
|
||||
/* Draw some edge lines! */
|
||||
if (block_class_is_subset(state->block, (mc_block_t[]){block_stone_slab, block_snow_layer}, 2) || !is_transparent(state->block)) {
|
||||
Imaging img_i = imaging_python_to_c(state->img);
|
||||
unsigned char ink[] = {0, 0, 0, 255 * self->opacity};
|
||||
unsigned short side_block;
|
||||
int x = state->x, y = state->y, z = state->z;
|
||||
uint8_t ink[] = {0, 0, 0, 255 * self->opacity};
|
||||
mc_block_t side_block;
|
||||
int32_t x = state->x, y = state->y, z = state->z;
|
||||
|
||||
int increment = 0;
|
||||
int32_t increment = 0;
|
||||
if (block_class_is_subset(state->block, (mc_block_t[]){block_wooden_slab, block_stone_slab}, 2) && ((state->block_data & 0x8) == 0)) // half-steps BUT no upsidown half-steps
|
||||
increment = 6;
|
||||
else if (block_class_is_subset(state->block, (mc_block_t[]){block_snow_layer, block_unpowered_repeater, block_powered_repeater}, 3)) // snow, redstone repeaters (on and off)
|
||||
|
||||
@@ -18,10 +18,10 @@
|
||||
#include "../overviewer.h"
|
||||
|
||||
typedef struct {
|
||||
unsigned int mode; /* 0 = exposed only, 1 = unexposed only */
|
||||
uint32_t mode; /* 0 = exposed only, 1 = unexposed only */
|
||||
} PrimitiveExposed;
|
||||
|
||||
static int
|
||||
static int32_t
|
||||
exposed_start(void* data, RenderState* state, PyObject* support) {
|
||||
PrimitiveExposed* self = (PrimitiveExposed*)data;
|
||||
|
||||
@@ -31,19 +31,19 @@ exposed_start(void* data, RenderState* state, PyObject* support) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
exposed_hidden(void* data, RenderState* state, int x, int y, int z) {
|
||||
static int32_t
|
||||
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.
|
||||
*/
|
||||
int validMinusX = 1;
|
||||
int validPlusX = 1;
|
||||
int validMinusY = 1;
|
||||
int validPlusY = 1;
|
||||
int validMinusZ = 1;
|
||||
int validPlusZ = 1;
|
||||
int32_t validMinusX = 1;
|
||||
int32_t validPlusX = 1;
|
||||
int32_t validMinusY = 1;
|
||||
int32_t validPlusY = 1;
|
||||
int32_t validMinusZ = 1;
|
||||
int32_t validPlusZ = 1;
|
||||
|
||||
/* special handling for section boundaries */
|
||||
/* If the neighboring section has no block data, ignore exposure from that
|
||||
|
||||
@@ -20,10 +20,10 @@
|
||||
typedef struct {
|
||||
PyObject* black_color;
|
||||
PyObject* white_color;
|
||||
unsigned int sealevel;
|
||||
uint32_t sealevel;
|
||||
} PrimitiveHeightFading;
|
||||
|
||||
static int
|
||||
static int32_t
|
||||
height_fading_start(void* data, RenderState* state, PyObject* support) {
|
||||
PrimitiveHeightFading* self = (PrimitiveHeightFading*)data;
|
||||
|
||||
@@ -48,7 +48,7 @@ static void
|
||||
height_fading_draw(void* data, RenderState* state, PyObject* src, PyObject* mask, PyObject* mask_light) {
|
||||
float alpha;
|
||||
PrimitiveHeightFading* self = (PrimitiveHeightFading*)data;
|
||||
int y = 16 * state->chunky + state->y;
|
||||
int32_t y = 16 * state->chunky + state->y;
|
||||
|
||||
/* do some height fading */
|
||||
PyObject* height_color = self->white_color;
|
||||
|
||||
@@ -19,16 +19,16 @@
|
||||
#include "../overviewer.h"
|
||||
|
||||
struct HideRule {
|
||||
unsigned short blockid;
|
||||
unsigned char has_data;
|
||||
unsigned char data;
|
||||
mc_block_t blockid;
|
||||
bool has_data;
|
||||
uint8_t data;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
struct HideRule* rules;
|
||||
} RenderPrimitiveHide;
|
||||
|
||||
static int
|
||||
static int32_t
|
||||
hide_start(void* data, RenderState* state, PyObject* support) {
|
||||
PyObject* opt;
|
||||
RenderPrimitiveHide* self = (RenderPrimitiveHide*)data;
|
||||
@@ -56,10 +56,10 @@ hide_start(void* data, RenderState* state, PyObject* support) {
|
||||
if (PyLong_Check(block)) {
|
||||
/* format 1: just a block id */
|
||||
self->rules[i].blockid = PyLong_AsLong(block);
|
||||
self->rules[i].has_data = 0;
|
||||
self->rules[i].has_data = false;
|
||||
} else if (PyArg_ParseTuple(block, "Hb", &(self->rules[i].blockid), &(self->rules[i].data))) {
|
||||
/* format 2: (blockid, data) */
|
||||
self->rules[i].has_data = 1;
|
||||
self->rules[i].has_data = true;
|
||||
} else {
|
||||
/* format not recognized */
|
||||
free(self->rules);
|
||||
@@ -81,11 +81,11 @@ hide_finish(void* data, RenderState* state) {
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
hide_hidden(void* data, RenderState* state, int x, int y, int z) {
|
||||
static int32_t
|
||||
hide_hidden(void* data, RenderState* state, int32_t x, int32_t y, int32_t z) {
|
||||
RenderPrimitiveHide* self = (RenderPrimitiveHide*)data;
|
||||
unsigned int i;
|
||||
unsigned short block;
|
||||
uint32_t i;
|
||||
mc_block_t block;
|
||||
|
||||
if (self->rules == NULL)
|
||||
return 0;
|
||||
@@ -93,7 +93,7 @@ hide_hidden(void* data, RenderState* state, int x, int y, int z) {
|
||||
block = get_data(state, BLOCKS, x, y, z);
|
||||
for (i = 0; self->rules[i].blockid != block_air; i++) {
|
||||
if (block == self->rules[i].blockid) {
|
||||
unsigned char data;
|
||||
uint8_t data;
|
||||
|
||||
if (!(self->rules[i].has_data))
|
||||
return 1;
|
||||
|
||||
@@ -25,9 +25,9 @@
|
||||
used in lighting calculations */
|
||||
static void
|
||||
calculate_light_color(void* data,
|
||||
unsigned char skylight, unsigned char blocklight,
|
||||
unsigned char* r, unsigned char* g, unsigned char* b) {
|
||||
unsigned char v = 255 * powf(0.8f, 15.0 - OV_MAX(blocklight, skylight));
|
||||
uint8_t skylight, uint8_t blocklight,
|
||||
uint8_t* r, uint8_t* g, uint8_t* b) {
|
||||
uint8_t v = 255 * powf(0.8f, 15.0 - OV_MAX(blocklight, skylight));
|
||||
*r = v;
|
||||
*g = v;
|
||||
*b = v;
|
||||
@@ -36,10 +36,10 @@ calculate_light_color(void* data,
|
||||
/* fancy version that uses the colored light texture */
|
||||
static void
|
||||
calculate_light_color_fancy(void* data,
|
||||
unsigned char skylight, unsigned char blocklight,
|
||||
unsigned char* r, unsigned char* g, unsigned char* b) {
|
||||
uint8_t skylight, uint8_t blocklight,
|
||||
uint8_t* r, uint8_t* g, uint8_t* b) {
|
||||
RenderPrimitiveLighting* mode = (RenderPrimitiveLighting*)(data);
|
||||
unsigned int index;
|
||||
uint32_t index;
|
||||
PyObject* color;
|
||||
|
||||
blocklight = OV_MAX(blocklight, skylight);
|
||||
@@ -60,9 +60,9 @@ calculate_light_color_fancy(void* data,
|
||||
*/
|
||||
static void
|
||||
calculate_light_color_night(void* data,
|
||||
unsigned char skylight, unsigned char blocklight,
|
||||
unsigned char* r, unsigned char* g, unsigned char* b) {
|
||||
unsigned char v = 255 * powf(0.8f, 15.0 - OV_MAX(blocklight, skylight - 11));
|
||||
uint8_t skylight, uint8_t blocklight,
|
||||
uint8_t* r, uint8_t* g, uint8_t* b) {
|
||||
uint8_t v = 255 * powf(0.8f, 15.0 - OV_MAX(blocklight, skylight - 11));
|
||||
*r = v;
|
||||
*g = v;
|
||||
*b = v;
|
||||
@@ -71,10 +71,10 @@ calculate_light_color_night(void* data,
|
||||
/* fancy night version that uses the colored light texture */
|
||||
static void
|
||||
calculate_light_color_fancy_night(void* data,
|
||||
unsigned char skylight, unsigned char blocklight,
|
||||
unsigned char* r, unsigned char* g, unsigned char* b) {
|
||||
uint8_t skylight, uint8_t blocklight,
|
||||
uint8_t* r, uint8_t* g, uint8_t* b) {
|
||||
RenderPrimitiveLighting* mode = (RenderPrimitiveLighting*)(data);
|
||||
unsigned int index;
|
||||
uint32_t index;
|
||||
PyObject* color;
|
||||
|
||||
index = skylight + blocklight * 16;
|
||||
@@ -97,14 +97,14 @@ calculate_light_color_fancy_night(void* data,
|
||||
* may (and probably should) pass NULL.
|
||||
*/
|
||||
|
||||
unsigned char
|
||||
uint8_t
|
||||
estimate_blocklevel(RenderPrimitiveLighting* self, RenderState* state,
|
||||
int x, int y, int z, int* authoratative) {
|
||||
int32_t x, int32_t y, int32_t z, int* authoratative) {
|
||||
|
||||
/* placeholders for later data arrays, coordinates */
|
||||
unsigned short block;
|
||||
unsigned char blocklevel;
|
||||
unsigned int average_count = 0, average_gather = 0, coeff = 0;
|
||||
mc_block_t block;
|
||||
uint8_t blocklevel;
|
||||
uint32_t average_count = 0, average_gather = 0, coeff = 0;
|
||||
|
||||
/* defaults to "guess" until told otherwise */
|
||||
if (authoratative)
|
||||
@@ -113,10 +113,10 @@ estimate_blocklevel(RenderPrimitiveLighting* self, RenderState* state,
|
||||
block = get_data(state, BLOCKS, x, y, z);
|
||||
|
||||
if (authoratative == NULL) {
|
||||
int auth;
|
||||
int32_t auth;
|
||||
|
||||
/* iterate through all surrounding blocks to take an average */
|
||||
int dx, dy, dz, local_block;
|
||||
int32_t dx, dy, dz, local_block;
|
||||
for (dx = -1; dx <= 1; dx += 2) {
|
||||
for (dy = -1; dy <= 1; dy += 2) {
|
||||
for (dz = -1; dz <= 1; dz += 2) {
|
||||
@@ -150,12 +150,12 @@ estimate_blocklevel(RenderPrimitiveLighting* self, RenderState* state,
|
||||
|
||||
inline void
|
||||
get_lighting_color(RenderPrimitiveLighting* self, RenderState* state,
|
||||
int x, int y, int z,
|
||||
unsigned char* r, unsigned char* g, unsigned char* b) {
|
||||
int32_t x, int32_t y, int32_t z,
|
||||
uint8_t* r, uint8_t* g, uint8_t* b) {
|
||||
|
||||
/* placeholders for later data arrays, coordinates */
|
||||
unsigned short block;
|
||||
unsigned char skylevel, blocklevel;
|
||||
mc_block_t block;
|
||||
uint8_t skylevel, blocklevel;
|
||||
|
||||
block = get_data(state, BLOCKS, x, y, z);
|
||||
skylevel = get_data(state, SKYLIGHT, x, y, z);
|
||||
@@ -164,10 +164,10 @@ get_lighting_color(RenderPrimitiveLighting* self, RenderState* state,
|
||||
/* special half-step handling, stairs handling */
|
||||
/* Anvil also needs to be here, blockid 145 */
|
||||
if (block_class_is_subset(block, block_class_alt_height, block_class_alt_height_len) || block == block_anvil) {
|
||||
unsigned int upper_block;
|
||||
uint32_t upper_block;
|
||||
|
||||
/* stairs and half-blocks take the skylevel from the upper block if it's transparent */
|
||||
int upper_counter = 0;
|
||||
int32_t upper_counter = 0;
|
||||
/* but if the upper_block is one of these special half-steps, we need to look at *its* upper_block */
|
||||
do {
|
||||
upper_counter++;
|
||||
@@ -196,18 +196,18 @@ get_lighting_color(RenderPrimitiveLighting* self, RenderState* state,
|
||||
}
|
||||
|
||||
/* does per-face occlusion checking for do_shading_with_mask */
|
||||
inline int
|
||||
lighting_is_face_occluded(RenderState* state, int skip_sides, int x, int y, int z) {
|
||||
inline int32_t
|
||||
lighting_is_face_occluded(RenderState* state, int32_t skip_sides, int32_t x, int32_t y, int32_t z) {
|
||||
/* first, check for occlusion if the block is in the local chunk */
|
||||
if (x >= 0 && x < 16 && y >= 0 && y < 16 && z >= 0 && z < 16) {
|
||||
unsigned short block = getArrayShort3D(state->blocks, x, y, z);
|
||||
mc_block_t block = getArrayShort3D(state->blocks, x, y, z);
|
||||
|
||||
if (!is_transparent(block) && !render_mode_hidden(state->rendermode, x, y, z)) {
|
||||
/* this face isn't visible, so don't draw anything */
|
||||
return 1;
|
||||
}
|
||||
} else if (!skip_sides) {
|
||||
unsigned short block = get_data(state, BLOCKS, x, y, z);
|
||||
mc_block_t block = get_data(state, BLOCKS, x, y, z);
|
||||
if (!is_transparent(block)) {
|
||||
/* the same thing but for adjacent chunks, this solves an
|
||||
ugly black doted line between chunks in night rendermode.
|
||||
@@ -223,8 +223,8 @@ lighting_is_face_occluded(RenderState* state, int skip_sides, int x, int y, int
|
||||
lighting results from (x, y, z) */
|
||||
static inline void
|
||||
do_shading_with_mask(RenderPrimitiveLighting* self, RenderState* state,
|
||||
int x, int y, int z, PyObject* mask) {
|
||||
unsigned char r, g, b;
|
||||
int32_t x, int32_t y, int32_t z, PyObject* mask) {
|
||||
uint8_t r, g, b;
|
||||
float comp_strength;
|
||||
|
||||
/* check occlusion */
|
||||
@@ -241,7 +241,7 @@ do_shading_with_mask(RenderPrimitiveLighting* self, RenderState* state,
|
||||
tint_with_mask(state->img, r, g, b, 255, mask, state->imgx, state->imgy, 0, 0);
|
||||
}
|
||||
|
||||
static int
|
||||
static int32_t
|
||||
lighting_start(void* data, RenderState* state, PyObject* support) {
|
||||
RenderPrimitiveLighting* self;
|
||||
self = (RenderPrimitiveLighting*)data;
|
||||
@@ -298,7 +298,7 @@ lighting_finish(void* data, RenderState* state) {
|
||||
static void
|
||||
lighting_draw(void* data, RenderState* state, PyObject* src, PyObject* mask, PyObject* mask_light) {
|
||||
RenderPrimitiveLighting* self;
|
||||
int x, y, z;
|
||||
int32_t x, y, z;
|
||||
|
||||
self = (RenderPrimitiveLighting*)data;
|
||||
x = state->x, y = state->y, z = state->z;
|
||||
|
||||
@@ -26,21 +26,21 @@ typedef struct {
|
||||
|
||||
/* can be overridden in derived rendermodes to control lighting
|
||||
arguments are data, skylight, blocklight, return RGB */
|
||||
void (*calculate_light_color)(void*, unsigned char, unsigned char, unsigned char*, unsigned char*, unsigned char*);
|
||||
void (*calculate_light_color)(void*, uint8_t, uint8_t, uint8_t*, uint8_t*, uint8_t*);
|
||||
|
||||
/* can be set to 0 in derived modes to indicate that lighting the chunk
|
||||
* sides is actually important. Right now, this is used in cave mode
|
||||
*/
|
||||
int skip_sides;
|
||||
int32_t skip_sides;
|
||||
|
||||
float strength;
|
||||
int color;
|
||||
int night;
|
||||
int32_t color;
|
||||
int32_t night;
|
||||
} RenderPrimitiveLighting;
|
||||
|
||||
/* exposed so that smooth-lighting can use them */
|
||||
extern RenderPrimitiveInterface primitive_lighting;
|
||||
int lighting_is_face_occluded(RenderState* state, int skip_sides, int x, int y, int z);
|
||||
int32_t lighting_is_face_occluded(RenderState* state, int32_t skip_sides, int32_t x, int32_t y, int32_t z);
|
||||
void get_lighting_color(RenderPrimitiveLighting* self, RenderState* state,
|
||||
int x, int y, int z,
|
||||
unsigned char* r, unsigned char* g, unsigned char* b);
|
||||
int32_t x, int32_t y, int32_t z,
|
||||
uint8_t* r, uint8_t* g, uint8_t* b);
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
|
||||
static void
|
||||
walk_chunk(RenderState* state, RenderPrimitiveNether* data) {
|
||||
int x, y, z;
|
||||
int id;
|
||||
int32_t x, y, z;
|
||||
int32_t id;
|
||||
|
||||
for (x = -1; x < WIDTH + 1; x++) {
|
||||
for (z = -1; z < DEPTH + 1; z++) {
|
||||
@@ -47,10 +47,10 @@ walk_chunk(RenderState* state, RenderPrimitiveNether* data) {
|
||||
data->walked_chunk = 1;
|
||||
}
|
||||
|
||||
static int
|
||||
nether_hidden(void* data, RenderState* state, int x, int y, int z) {
|
||||
static int32_t
|
||||
nether_hidden(void* data, RenderState* state, int32_t x, int32_t y, int32_t z) {
|
||||
RenderPrimitiveNether* self;
|
||||
int real_y;
|
||||
int32_t real_y;
|
||||
|
||||
self = (RenderPrimitiveNether*)data;
|
||||
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
// add two to these because the primative functions should expect to
|
||||
// deal with x and z values of -1 and 16
|
||||
typedef struct {
|
||||
int walked_chunk;
|
||||
int32_t walked_chunk;
|
||||
|
||||
int remove_block[WIDTH + 2][HEIGHT][DEPTH + 2];
|
||||
int32_t remove_block[WIDTH + 2][HEIGHT][DEPTH + 2];
|
||||
|
||||
} RenderPrimitiveNether;
|
||||
|
||||
@@ -17,14 +17,14 @@
|
||||
|
||||
#include "../overviewer.h"
|
||||
|
||||
static int
|
||||
netherold_hidden(void* data, RenderState* state, int x, int y, int z) {
|
||||
static int32_t
|
||||
netherold_hidden(void* data, RenderState* state, int32_t x, int32_t y, int32_t z) {
|
||||
/* hide all blocks above all air blocks
|
||||
|
||||
due to how the nether is currently generated, this will also count
|
||||
empty sections as 'solid'
|
||||
*/
|
||||
unsigned char missing_section = 0;
|
||||
uint8_t missing_section = 0;
|
||||
while (y < (SECTIONS_PER_CHUNK - state->chunky) * 16) {
|
||||
if (state->chunks[1][1].sections[state->chunky + (y / 16)].blocks == NULL) {
|
||||
missing_section = 1;
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
|
||||
#include "../overviewer.h"
|
||||
|
||||
static int
|
||||
static int32_t
|
||||
no_fluids_start(void* data, RenderState* state, PyObject* support) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
no_fluids_hidden(void* data, RenderState* state, int x, int y, int z) {
|
||||
static int32_t
|
||||
no_fluids_hidden(void* data, RenderState* state, int32_t x, int32_t y, int32_t z) {
|
||||
return block_has_property(state->block, FLUID);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,8 +26,8 @@ typedef struct {
|
||||
} RenderPrimitiveBiomes;
|
||||
|
||||
struct BiomeColor {
|
||||
unsigned char biome;
|
||||
unsigned char r, g, b;
|
||||
uint8_t biome;
|
||||
uint8_t r, g, b;
|
||||
};
|
||||
|
||||
static struct BiomeColor default_biomes[] = {
|
||||
@@ -76,18 +76,18 @@ static struct BiomeColor default_biomes[] = {
|
||||
{255, 0, 0, 0}};
|
||||
|
||||
static void get_color(void* data, RenderState* state,
|
||||
unsigned char* r, unsigned char* g, unsigned char* b, unsigned char* a) {
|
||||
uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a) {
|
||||
|
||||
unsigned char biome;
|
||||
int x = state->x, z = state->z, y_max, y;
|
||||
int max_i = -1;
|
||||
uint8_t biome;
|
||||
int32_t x = state->x, z = state->z, y_max, y;
|
||||
int32_t max_i = -1;
|
||||
RenderPrimitiveBiomes* self = (RenderPrimitiveBiomes*)data;
|
||||
struct BiomeColor* biomes = (struct BiomeColor*)(self->biomes);
|
||||
*a = 0;
|
||||
|
||||
y_max = state->y + 1;
|
||||
for (y = state->chunky * -16; y <= y_max; y++) {
|
||||
int i, tmp;
|
||||
int32_t i, tmp;
|
||||
biome = get_data(state, BIOMES, x, y, z);
|
||||
|
||||
if (biome >= NUM_BIOMES) {
|
||||
@@ -110,14 +110,14 @@ static void get_color(void* data, RenderState* state,
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
static int32_t
|
||||
overlay_biomes_start(void* data, RenderState* state, PyObject* support) {
|
||||
PyObject* opt;
|
||||
RenderPrimitiveBiomes* self;
|
||||
unsigned char alpha_tmp = 0;
|
||||
uint8_t alpha_tmp = 0;
|
||||
|
||||
/* first, chain up */
|
||||
int ret = primitive_overlay.start(data, state, support);
|
||||
int32_t ret = primitive_overlay.start(data, state, support);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
@@ -146,7 +146,7 @@ overlay_biomes_start(void* data, RenderState* state, PyObject* support) {
|
||||
for (i = 0; i < biomes_size; i++) {
|
||||
PyObject* biome = PyList_GET_ITEM(opt, i);
|
||||
char* tmpname = NULL;
|
||||
int j = 0;
|
||||
int32_t j = 0;
|
||||
|
||||
if (!PyArg_ParseTuple(biome, "s(bbb)", &tmpname, &(biomes[i].r), &(biomes[i].g), &(biomes[i].b))) {
|
||||
free(biomes);
|
||||
|
||||
@@ -26,8 +26,8 @@ typedef struct {
|
||||
} RenderPrimitiveMineral;
|
||||
|
||||
struct MineralColor {
|
||||
unsigned char blockid;
|
||||
unsigned char r, g, b;
|
||||
uint8_t blockid;
|
||||
uint8_t r, g, b;
|
||||
};
|
||||
|
||||
/* put more valuable ores first -- they take precedence */
|
||||
@@ -48,18 +48,18 @@ static struct MineralColor default_minerals[] = {
|
||||
{0, 0, 0, 0}};
|
||||
|
||||
static void get_color(void* data, RenderState* state,
|
||||
unsigned char* r, unsigned char* g, unsigned char* b, unsigned char* a) {
|
||||
uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a) {
|
||||
|
||||
int x = state->x, z = state->z, y_max, y;
|
||||
int max_i = -1;
|
||||
int32_t x = state->x, z = state->z, y_max, y;
|
||||
int32_t max_i = -1;
|
||||
RenderPrimitiveMineral* self = (RenderPrimitiveMineral*)data;
|
||||
struct MineralColor* minerals = (struct MineralColor*)(self->minerals);
|
||||
*a = 0;
|
||||
|
||||
y_max = state->y + 1;
|
||||
for (y = state->chunky * -16; y <= y_max; y++) {
|
||||
int i, tmp;
|
||||
unsigned short blockid = get_data(state, BLOCKS, x, y, z);
|
||||
int32_t i, tmp;
|
||||
mc_block_t blockid = get_data(state, BLOCKS, x, y, z);
|
||||
|
||||
for (i = 0; (max_i == -1 || i < max_i) && minerals[i].blockid != block_air; i++) {
|
||||
if (minerals[i].blockid == blockid) {
|
||||
@@ -77,13 +77,13 @@ static void get_color(void* data, RenderState* state,
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
static int32_t
|
||||
overlay_mineral_start(void* data, RenderState* state, PyObject* support) {
|
||||
PyObject* opt;
|
||||
RenderPrimitiveMineral* self;
|
||||
|
||||
/* first, chain up */
|
||||
int ret = primitive_overlay.start(data, state, support);
|
||||
int32_t ret = primitive_overlay.start(data, state, support);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
|
||||
@@ -34,13 +34,13 @@ static void random_set_seed(long long* seed, long long new_seed) {
|
||||
*seed = (new_seed ^ 0x5deece66dLL) & ((1LL << 48) - 1);
|
||||
}
|
||||
|
||||
static int random_next(long long* seed, int bits) {
|
||||
static int32_t random_next(long long* seed, int32_t bits) {
|
||||
*seed = (*seed * 0x5deece66dLL + 0xbL) & ((1LL << 48) - 1);
|
||||
return (int)(*seed >> (48 - bits));
|
||||
}
|
||||
|
||||
static int random_next_int(long long* seed, int n) {
|
||||
int bits, val;
|
||||
static int32_t random_next_int(long long* seed, int32_t n) {
|
||||
int32_t bits, val;
|
||||
|
||||
if (n <= 0) {
|
||||
/* invalid */
|
||||
@@ -59,7 +59,7 @@ static int random_next_int(long long* seed, int n) {
|
||||
return val;
|
||||
}
|
||||
|
||||
static int is_slime(long long map_seed, int chunkx, int chunkz) {
|
||||
static int32_t is_slime(long long map_seed, int32_t chunkx, int32_t chunkz) {
|
||||
/* lots of magic numbers, but they're all correct! I swear! */
|
||||
long long seed;
|
||||
random_set_seed(&seed, (map_seed +
|
||||
@@ -72,7 +72,7 @@ static int is_slime(long long map_seed, int chunkx, int chunkz) {
|
||||
}
|
||||
|
||||
static void get_color(void* data, RenderState* state,
|
||||
unsigned char* r, unsigned char* g, unsigned char* b, unsigned char* a) {
|
||||
uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a) {
|
||||
RenderPrimitiveSlime* self = (RenderPrimitiveSlime*)data;
|
||||
|
||||
/* set a nice, pretty green color */
|
||||
@@ -89,13 +89,13 @@ static void get_color(void* data, RenderState* state,
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
static int32_t
|
||||
overlay_slime_start(void* data, RenderState* state, PyObject* support) {
|
||||
RenderPrimitiveSlime* self;
|
||||
PyObject* pyseed;
|
||||
|
||||
/* first, chain up */
|
||||
int ret = primitive_overlay.start(data, state, support);
|
||||
int32_t ret = primitive_overlay.start(data, state, support);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
|
||||
@@ -24,11 +24,11 @@ typedef struct {
|
||||
} RenderPrimitiveSpawn;
|
||||
|
||||
static void get_color(void* data, RenderState* state,
|
||||
unsigned char* r, unsigned char* g, unsigned char* b, unsigned char* a) {
|
||||
uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a) {
|
||||
RenderPrimitiveSpawn* self = (RenderPrimitiveSpawn*)data;
|
||||
int x = state->x, y = state->y, z = state->z;
|
||||
int y_light = y + 1;
|
||||
unsigned char blocklight, skylight;
|
||||
int32_t x = state->x, y = state->y, z = state->z;
|
||||
int32_t y_light = y + 1;
|
||||
uint8_t blocklight, skylight;
|
||||
|
||||
/* set a nice, pretty red color */
|
||||
*r = self->parent.color->r;
|
||||
@@ -55,12 +55,12 @@ static void get_color(void* data, RenderState* state,
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
static int32_t
|
||||
overlay_spawn_start(void* data, RenderState* state, PyObject* support) {
|
||||
RenderPrimitiveSpawn* self;
|
||||
|
||||
/* first, chain up */
|
||||
int ret = primitive_overlay.start(data, state, support);
|
||||
int32_t ret = primitive_overlay.start(data, state, support);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
|
||||
@@ -18,38 +18,35 @@
|
||||
#include "../mc_id.h"
|
||||
#include "overlay.h"
|
||||
|
||||
typedef enum { false,
|
||||
true } bool;
|
||||
|
||||
typedef struct {
|
||||
/* inherits from overlay */
|
||||
RenderPrimitiveOverlay parent;
|
||||
void* structures;
|
||||
int numcolors;
|
||||
int32_t numcolors;
|
||||
} RenderPrimitiveStructure;
|
||||
|
||||
struct Condition {
|
||||
int relx, rely, relz;
|
||||
unsigned short block;
|
||||
int32_t relx, rely, relz;
|
||||
mc_block_t block;
|
||||
};
|
||||
|
||||
struct Color {
|
||||
int numconds;
|
||||
int32_t numconds;
|
||||
struct Condition* conditions;
|
||||
unsigned char r, g, b, a;
|
||||
uint8_t r, g, b, a;
|
||||
};
|
||||
|
||||
static void get_color(void* data,
|
||||
RenderState* state,
|
||||
unsigned char* r,
|
||||
unsigned char* g,
|
||||
unsigned char* b,
|
||||
unsigned char* a) {
|
||||
uint8_t* r,
|
||||
uint8_t* g,
|
||||
uint8_t* b,
|
||||
uint8_t* a) {
|
||||
/**
|
||||
* Calculate the color at the current position and store the values to r,g,b,a.
|
||||
**/
|
||||
RenderPrimitiveStructure* self = (RenderPrimitiveStructure*)data;
|
||||
int x = state->x, z = state->z, y_max, y, col, cond;
|
||||
int32_t x = state->x, z = state->z, y_max, y, col, cond;
|
||||
struct Color* structures = (struct Color*)(self->structures);
|
||||
struct Condition* c = NULL;
|
||||
bool all = true;
|
||||
@@ -86,7 +83,7 @@ static void get_color(void* data,
|
||||
return;
|
||||
}
|
||||
|
||||
static int overlay_structure_start(void* data, RenderState* state, PyObject* support) {
|
||||
static int32_t overlay_structure_start(void* data, RenderState* state, PyObject* support) {
|
||||
/**
|
||||
* Initializing the search for structures by parsing the arguments and storing them into
|
||||
* appropriate structures. If no arguments are passed create and use default values.
|
||||
@@ -95,7 +92,7 @@ static int overlay_structure_start(void* data, RenderState* state, PyObject* sup
|
||||
RenderPrimitiveStructure* self;
|
||||
|
||||
/* first, chain up */
|
||||
int ret = primitive_overlay.start(data, state, support);
|
||||
int32_t ret = primitive_overlay.start(data, state, support);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
@@ -190,7 +187,7 @@ static int overlay_structure_start(void* data, RenderState* state, PyObject* sup
|
||||
&cond[n].rely,
|
||||
&cond[n].relz,
|
||||
&cond[n].block)) {
|
||||
int x = 0;
|
||||
int32_t x = 0;
|
||||
for (x = 0; x < structures_size; x++) {
|
||||
free(structures[x].conditions);
|
||||
}
|
||||
@@ -212,7 +209,7 @@ static int overlay_structure_start(void* data, RenderState* state, PyObject* sup
|
||||
static void overlay_structure_finish(void* data, RenderState* state) {
|
||||
/* first free all *our* stuff */
|
||||
RenderPrimitiveStructure* self = (RenderPrimitiveStructure*)data;
|
||||
int i = 0;
|
||||
int32_t i = 0;
|
||||
|
||||
if (self->structures) {
|
||||
// freeing the nested structure
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "../mc_id.h"
|
||||
|
||||
static void get_color(void* data, RenderState* state,
|
||||
unsigned char* r, unsigned char* g, unsigned char* b, unsigned char* a) {
|
||||
uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a) {
|
||||
RenderPrimitiveOverlay* self = (RenderPrimitiveOverlay*)data;
|
||||
|
||||
*r = self->color->r;
|
||||
@@ -28,7 +28,7 @@ static void get_color(void* data, RenderState* state,
|
||||
*a = self->color->a;
|
||||
}
|
||||
|
||||
static int
|
||||
static int32_t
|
||||
overlay_start(void* data, RenderState* state, PyObject* support) {
|
||||
PyObject* opt = NULL;
|
||||
OverlayColor* color = NULL;
|
||||
@@ -80,11 +80,11 @@ overlay_finish(void* data, RenderState* state) {
|
||||
|
||||
void overlay_draw(void* data, RenderState* state, PyObject* src, PyObject* mask, PyObject* mask_light) {
|
||||
RenderPrimitiveOverlay* self = (RenderPrimitiveOverlay*)data;
|
||||
unsigned char r, g, b, a;
|
||||
unsigned short top_block;
|
||||
uint8_t r, g, b, a;
|
||||
mc_block_t top_block;
|
||||
|
||||
// exactly analogous to edge-line code for these special blocks
|
||||
int increment = 0;
|
||||
int32_t increment = 0;
|
||||
if (state->block == block_stone_slab) // half-step
|
||||
increment = 6;
|
||||
else if (state->block == block_snow_layer) // snow
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include "../overviewer.h"
|
||||
|
||||
typedef struct {
|
||||
unsigned char r, g, b, a;
|
||||
uint8_t r, g, b, a;
|
||||
} OverlayColor;
|
||||
|
||||
typedef struct {
|
||||
@@ -33,7 +33,7 @@ typedef struct {
|
||||
overlay alpha and color
|
||||
last four vars are r, g, b, a out */
|
||||
void (*get_color)(void*, RenderState*,
|
||||
unsigned char*, unsigned char*, unsigned char*, unsigned char*);
|
||||
uint8_t*, uint8_t*, uint8_t*, uint8_t*);
|
||||
} RenderPrimitiveOverlay;
|
||||
extern RenderPrimitiveInterface primitive_overlay;
|
||||
|
||||
|
||||
@@ -29,29 +29,29 @@ typedef struct {
|
||||
/* structure representing one corner of a face (see below) */
|
||||
struct SmoothLightingCorner {
|
||||
/* where this corner shows up on each block texture */
|
||||
int imgx, imgy;
|
||||
int32_t imgx, imgy;
|
||||
|
||||
/* the two block offsets that (together) determine the 4 blocks to use */
|
||||
int dx1, dy1, dz1;
|
||||
int dx2, dy2, dz2;
|
||||
int32_t dx1, dy1, dz1;
|
||||
int32_t dx2, dy2, dz2;
|
||||
};
|
||||
|
||||
/* structure for rule table handling lighting */
|
||||
struct SmoothLightingFace {
|
||||
/* offset from current coordinate to the block this face points towards
|
||||
used for occlusion calculations, and as a base for later */
|
||||
int dx, dy, dz;
|
||||
int32_t dx, dy, dz;
|
||||
|
||||
/* the points that form the corners of this face */
|
||||
struct SmoothLightingCorner corners[4];
|
||||
|
||||
/* pairs of (x,y) in order, as touch-up points, or NULL for none */
|
||||
int* touch_up_points;
|
||||
unsigned int num_touch_up_points;
|
||||
uint32_t num_touch_up_points;
|
||||
};
|
||||
|
||||
/* top face touchups, pulled from textures.py (_build_block) */
|
||||
static int top_touchups[] = {1, 5, 3, 4, 5, 3, 7, 2, 9, 1, 11, 0};
|
||||
static int32_t top_touchups[] = {1, 5, 3, 4, 5, 3, 7, 2, 9, 1, 11, 0};
|
||||
|
||||
/* the lighting face rule list! */
|
||||
static struct SmoothLightingFace lighting_rules[] = {
|
||||
@@ -110,17 +110,17 @@ enum {
|
||||
|
||||
static void
|
||||
do_shading_with_rule(RenderPrimitiveSmoothLighting* self, RenderState* state, struct SmoothLightingFace face) {
|
||||
int i;
|
||||
int32_t i;
|
||||
RenderPrimitiveLighting* lighting = (RenderPrimitiveLighting*)self;
|
||||
int x = state->imgx, y = state->imgy;
|
||||
int32_t x = state->imgx, y = state->imgy;
|
||||
struct SmoothLightingCorner* pts = face.corners;
|
||||
float comp_shade_strength = 1.0 - lighting->strength;
|
||||
unsigned char pts_r[4] = {0, 0, 0, 0};
|
||||
unsigned char pts_g[4] = {0, 0, 0, 0};
|
||||
unsigned char pts_b[4] = {0, 0, 0, 0};
|
||||
int cx = state->x + face.dx;
|
||||
int cy = state->y + face.dy;
|
||||
int cz = state->z + face.dz;
|
||||
uint8_t pts_r[4] = {0, 0, 0, 0};
|
||||
uint8_t pts_g[4] = {0, 0, 0, 0};
|
||||
uint8_t pts_b[4] = {0, 0, 0, 0};
|
||||
int32_t cx = state->x + face.dx;
|
||||
int32_t cy = state->y + face.dy;
|
||||
int32_t cz = state->z + face.dz;
|
||||
|
||||
/* first, check for occlusion if the block is in the local chunk */
|
||||
if (lighting_is_face_occluded(state, 0, cx, cy, cz))
|
||||
@@ -128,8 +128,8 @@ do_shading_with_rule(RenderPrimitiveSmoothLighting* self, RenderState* state, st
|
||||
|
||||
/* calculate the lighting colors for each point */
|
||||
for (i = 0; i < 4; i++) {
|
||||
unsigned char r, g, b;
|
||||
unsigned int rgather = 0, ggather = 0, bgather = 0;
|
||||
uint8_t r, g, b;
|
||||
uint32_t rgather = 0, ggather = 0, bgather = 0;
|
||||
|
||||
get_lighting_color(lighting, state, cx, cy, cz,
|
||||
&r, &g, &b);
|
||||
@@ -181,10 +181,10 @@ do_shading_with_rule(RenderPrimitiveSmoothLighting* self, RenderState* state, st
|
||||
x, y, NULL, 0);
|
||||
}
|
||||
|
||||
static int
|
||||
static int32_t
|
||||
smooth_lighting_start(void* data, RenderState* state, PyObject* support) {
|
||||
/* first, chain up */
|
||||
int ret = primitive_lighting.start(data, state, support);
|
||||
int32_t ret = primitive_lighting.start(data, state, support);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
return 0;
|
||||
@@ -198,9 +198,9 @@ smooth_lighting_finish(void* data, RenderState* state) {
|
||||
|
||||
static void
|
||||
smooth_lighting_draw(void* data, RenderState* state, PyObject* src, PyObject* mask, PyObject* mask_light) {
|
||||
int light_top = 1;
|
||||
int light_left = 1;
|
||||
int light_right = 1;
|
||||
int32_t light_top = 1;
|
||||
int32_t light_left = 1;
|
||||
int32_t light_right = 1;
|
||||
RenderPrimitiveSmoothLighting* self = (RenderPrimitiveSmoothLighting*)data;
|
||||
|
||||
/* special case for leaves, water 8, water 9, ice 79
|
||||
|
||||
Reference in New Issue
Block a user