0

Implement style fixes

This commit is contained in:
Wunkolo
2019-03-18 12:59:08 -07:00
parent 62dcfab7a0
commit 4b0b50f215
9 changed files with 50 additions and 55 deletions

View File

@@ -26,42 +26,35 @@ bool block_class_is_subset(
mc_block_t block, mc_block_t block,
const mc_block_t block_class[], const mc_block_t block_class[],
size_t block_class_len size_t block_class_len
) ) {
{
size_t i = 0; size_t i = 0;
#ifdef __SSE2__ #ifdef __SSE2__
for( ; i / 8 < block_class_len / 8; i += 8 ) for (; i / 8 < block_class_len / 8; i += 8) {
{
const __m128i block_class_vec = _mm_loadu_si128( const __m128i block_class_vec = _mm_loadu_si128(
(__m128i*)&block_class[i] (__m128i*)&block_class[i]
); );
const __m128i block_vec = _mm_set1_epi16(block); const __m128i block_vec = _mm_set1_epi16(block);
const __m128i block_cmp = _mm_cmpeq_epi16(block_vec,block_class_vec); const __m128i block_cmp = _mm_cmpeq_epi16(block_vec,block_class_vec);
if( _mm_movemask_epi8(block_cmp) ) if (_mm_movemask_epi8(block_cmp)) {
{
return true; return true;
} }
} }
#endif #endif
#ifdef __MMX__ #ifdef __MMX__
for( ; i / 4 < block_class_len / 4; i += 4 ) for (; i / 4 < block_class_len / 4; i += 4) {
{
const __m64 block_class_vec = _mm_cvtsi64_m64( const __m64 block_class_vec = _mm_cvtsi64_m64(
*(uint64_t*)&block_class[i] *(uint64_t*)&block_class[i]
); );
const __m64 block_vec = _mm_set1_pi16(block); const __m64 block_vec = _mm_set1_pi16(block);
const __m64 block_cmp = _mm_cmpeq_pi16(block_vec,block_class_vec); const __m64 block_cmp = _mm_cmpeq_pi16(block_vec,block_class_vec);
if( _mm_cvtm64_si64(block_cmp) ) if (_mm_cvtm64_si64(block_cmp)) {
{
return true; return true;
} }
} }
#endif #endif
for( ; i < block_class_len; ++i ) for (; i < block_class_len; ++i) {
{ if (block == block_class[i]) {
if( block == block_class[i] )
{
return true; return true;
} }
} }
@@ -85,7 +78,7 @@ const mc_block_t block_class_stair[] = {
block_red_sandstone_stairs, block_red_sandstone_stairs,
block_purpur_stairs block_purpur_stairs
}; };
const size_t block_class_stair_len = count_of(block_class_stair); const size_t block_class_stair_len = COUNT_OF(block_class_stair);
const mc_block_t block_class_door[] = { const mc_block_t block_class_door[] = {
block_wooden_door, block_wooden_door,
@@ -96,7 +89,7 @@ const mc_block_t block_class_door[] = {
block_acacia_door, block_acacia_door,
block_dark_oak_door block_dark_oak_door
}; };
const size_t block_class_door_len = count_of(block_class_door); const size_t block_class_door_len = COUNT_OF(block_class_door);
const mc_block_t block_class_fence[] = { const mc_block_t block_class_fence[] = {
block_fence, block_fence,
@@ -107,7 +100,7 @@ const mc_block_t block_class_fence[] = {
block_dark_oak_fence, block_dark_oak_fence,
block_acacia_fence block_acacia_fence
}; };
const size_t block_class_fence_len = count_of(block_class_fence); const size_t block_class_fence_len = COUNT_OF(block_class_fence);
const mc_block_t block_class_fence_gate[] = { const mc_block_t block_class_fence_gate[] = {
block_fence_gate, block_fence_gate,
@@ -117,7 +110,7 @@ const mc_block_t block_class_fence_gate[] = {
block_dark_oak_fence_gate, block_dark_oak_fence_gate,
block_acacia_fence_gate block_acacia_fence_gate
}; };
const size_t block_class_fence_gate_len = count_of(block_class_fence_gate); const size_t block_class_fence_gate_len = COUNT_OF(block_class_fence_gate);
const mc_block_t block_class_ancil[] = { const mc_block_t block_class_ancil[] = {
block_wooden_door, block_wooden_door,
@@ -165,7 +158,7 @@ const mc_block_t block_class_ancil[] = {
block_dark_oak_fence, block_dark_oak_fence,
block_acacia_fence block_acacia_fence
}; };
const size_t block_class_ancil_len = count_of(block_class_ancil); const size_t block_class_ancil_len = COUNT_OF(block_class_ancil);
const mc_block_t block_class_alt_height[] = { const mc_block_t block_class_alt_height[] = {
block_stone_slab, block_stone_slab,
@@ -187,4 +180,5 @@ const mc_block_t block_class_alt_height[] = {
block_purpur_slab, block_purpur_slab,
block_wooden_slab block_wooden_slab
}; };
const size_t block_class_alt_height_len = count_of(block_class_alt_height); const size_t block_class_alt_height_len = COUNT_OF(block_class_alt_height);

View File

@@ -47,4 +47,5 @@ extern const size_t block_class_ancil_len;
extern const mc_block_t block_class_alt_height[]; extern const mc_block_t block_class_alt_height[];
extern const size_t block_class_alt_height_len; extern const size_t block_class_alt_height_len;
#endif #endif

View File

@@ -259,13 +259,13 @@ generate_pseudo_data(RenderState *state, unsigned short ancilData) {
if (get_data(state, BLOCKS, x, y+1, z) == 78) if (get_data(state, BLOCKS, x, y+1, z) == 78)
return 0x10; return 0x10;
return ancilData; return ancilData;
} else if (block_class_is_subset(state->block,(mc_block_t[]){block_flowing_water,block_water},2)) { /* water */ } else if (block_class_is_subset(state->block, (mc_block_t[]){block_flowing_water,block_water}, 2)) { /* water */
data = check_adjacent_blocks(state, x, y, z, state->block) ^ 0x0f; data = check_adjacent_blocks(state, x, y, z, state->block) ^ 0x0f;
/* an aditional bit for top is added to the 4 bits of check_adjacent_blocks */ /* an aditional bit for top is added to the 4 bits of check_adjacent_blocks */
if (get_data(state, BLOCKS, x, y+1, z) != state->block) if (get_data(state, BLOCKS, x, y+1, z) != state->block)
data |= 0x10; data |= 0x10;
return data; return data;
} else if (block_class_is_subset(state->block,(mc_block_t[]){block_glass,block_ice,block_stained_glass},3)) { /* glass and ice and stained glass*/ } else if (block_class_is_subset(state->block, (mc_block_t[]){block_glass,block_ice,block_stained_glass}, 3)) { /* glass and ice and stained glass*/
/* an aditional bit for top is added to the 4 bits of check_adjacent_blocks /* an aditional bit for top is added to the 4 bits of check_adjacent_blocks
* Note that stained glass encodes 16 colors using 4 bits. this pushes us over the 8-bits of an unsigned char, * Note that stained glass encodes 16 colors using 4 bits. this pushes us over the 8-bits of an unsigned char,
* forcing us to use an unsigned short to hold 16 bits of pseudo ancil data * forcing us to use an unsigned short to hold 16 bits of pseudo ancil data
@@ -277,7 +277,7 @@ generate_pseudo_data(RenderState *state, unsigned short ancilData) {
} }
data = (check_adjacent_blocks(state, x, y, z, state->block) ^ 0x0f) | data; data = (check_adjacent_blocks(state, x, y, z, state->block) ^ 0x0f) | data;
return (data << 4) | (ancilData & 0x0f); return (data << 4) | (ancilData & 0x0f);
} else if (block_class_is_subset(state->block,block_class_fence,block_class_fence_len)) { /* fences */ } else if (block_class_is_subset(state->block, block_class_fence, block_class_fence_len)) { /* fences */
/* check for fences AND fence gates */ /* check for fences AND fence gates */
return check_adjacent_blocks(state, x, y, z, state->block) | check_adjacent_blocks(state, x, y, z, block_fence_gate) | return check_adjacent_blocks(state, x, y, z, state->block) | check_adjacent_blocks(state, x, y, z, block_fence_gate) |
check_adjacent_blocks(state, x, y, z, block_fence_gate) | check_adjacent_blocks(state, x, y, z, block_birch_fence_gate) | check_adjacent_blocks(state, x, y, z, block_jungle_fence_gate) | check_adjacent_blocks(state, x, y, z, block_fence_gate) | check_adjacent_blocks(state, x, y, z, block_birch_fence_gate) | check_adjacent_blocks(state, x, y, z, block_jungle_fence_gate) |
@@ -317,7 +317,7 @@ generate_pseudo_data(RenderState *state, unsigned short ancilData) {
} }
return final_data; return final_data;
} else if (block_class_is_subset(state->block,(mc_block_t[]){block_chest,block_trapped_chest},2)) { } else if (block_class_is_subset(state->block, (mc_block_t[]){block_chest,block_trapped_chest}, 2)) {
/* Orientation is given by ancilData, pseudo data needed to /* Orientation is given by ancilData, pseudo data needed to
* choose from single or double chest and the correct half of * choose from single or double chest and the correct half of
* the chest. */ * the chest. */
@@ -354,7 +354,7 @@ generate_pseudo_data(RenderState *state, unsigned short ancilData) {
} }
return final_data; return final_data;
} else if (block_class_is_subset(state->block,(mc_block_t[]){block_iron_bars,block_glass_pane,block_stained_glass_pane},3)) { } else if (block_class_is_subset(state->block, (mc_block_t[]){block_iron_bars,block_glass_pane, block_stained_glass_pane},3)) {
/* iron bars and glass panes: /* iron bars and glass panes:
* they seem to stick to almost everything but air, * they seem to stick to almost everything but air,
* not sure yet! Still a TODO! */ * not sure yet! Still a TODO! */
@@ -363,11 +363,11 @@ generate_pseudo_data(RenderState *state, unsigned short ancilData) {
data = (check_adjacent_blocks(state, x, y, z, 0) ^ 0x0f); data = (check_adjacent_blocks(state, x, y, z, 0) ^ 0x0f);
return (data << 4) | (ancilData & 0xf); return (data << 4) | (ancilData & 0xf);
} else if (block_class_is_subset(state->block,(mc_block_t[]){block_portal,block_nether_brick_fence},2)) { } else if (block_class_is_subset(state->block, (mc_block_t[]){block_portal,block_nether_brick_fence}, 2)) {
/* portal and nether brick fences */ /* portal and nether brick fences */
return check_adjacent_blocks(state, x, y, z, state->block); return check_adjacent_blocks(state, x, y, z, state->block);
} else if (block_class_is_subset(state->block,block_class_door,block_class_door_len)) { } else if (block_class_is_subset(state->block, block_class_door, block_class_door_len)) {
/* use bottom block data format plus one bit for top/down /* use bottom block data format plus one bit for top/down
* block (0x8) and one bit for hinge position (0x10) * block (0x8) and one bit for hinge position (0x10)
*/ */
@@ -414,7 +414,7 @@ generate_pseudo_data(RenderState *state, unsigned short ancilData) {
pr = pr * pr * 42317861 + pr * 11; pr = pr * pr * 42317861 + pr * 11;
rotation = 3 & (pr >> 16); rotation = 3 & (pr >> 16);
return rotation; return rotation;
} else if (block_class_is_subset(state->block,block_class_stair,block_class_stair_len)) { /* stairs */ } else if (block_class_is_subset(state->block, block_class_stair, block_class_stair_len)) { /* stairs */
/* 4 ancillary bits will be added to indicate which quarters of the block contain the /* 4 ancillary bits will be added to indicate which quarters of the block contain the
* upper step. Regular stairs will have 2 bits set & corner stairs will have 1 or 3. * upper step. Regular stairs will have 2 bits set & corner stairs will have 1 or 3.
* Southwest quarter is part of the upper step - 0x40 * Southwest quarter is part of the upper step - 0x40
@@ -471,10 +471,10 @@ generate_pseudo_data(RenderState *state, unsigned short ancilData) {
/* get block & data for neighbors in this order: east, north, west, south */ /* get block & data for neighbors in this order: east, north, west, south */
/* so we can rotate things easily */ /* so we can rotate things easily */
stairs[0] = stairs[4] = block_class_is_subset(get_data(state, BLOCKS, x+1, y, z),block_class_stair,block_class_stair_len); stairs[0] = stairs[4] = block_class_is_subset(get_data(state, BLOCKS, x+1, y, z), block_class_stair, block_class_stair_len);
stairs[1] = stairs[5] = block_class_is_subset(get_data(state, BLOCKS, x, y, z-1),block_class_stair,block_class_stair_len); stairs[1] = stairs[5] = block_class_is_subset(get_data(state, BLOCKS, x, y, z-1), block_class_stair, block_class_stair_len);
stairs[2] = stairs[6] = block_class_is_subset(get_data(state, BLOCKS, x-1, y, z),block_class_stair,block_class_stair_len); stairs[2] = stairs[6] = block_class_is_subset(get_data(state, BLOCKS, x-1, y, z), block_class_stair, block_class_stair_len);
stairs[3] = stairs[7] = block_class_is_subset(get_data(state, BLOCKS, x, y, z+1),block_class_stair,block_class_stair_len); stairs[3] = stairs[7] = block_class_is_subset(get_data(state, BLOCKS, x, y, z+1), block_class_stair, block_class_stair_len);
neigh[0] = neigh[4] = FIX_ROT(get_data(state, DATA, x+1, y, z)); neigh[0] = neigh[4] = FIX_ROT(get_data(state, DATA, x+1, y, z));
neigh[1] = neigh[5] = FIX_ROT(get_data(state, DATA, x, y, z-1)); neigh[1] = neigh[5] = FIX_ROT(get_data(state, DATA, x, y, z-1));
neigh[2] = neigh[6] = FIX_ROT(get_data(state, DATA, x-1, y, z)); neigh[2] = neigh[6] = FIX_ROT(get_data(state, DATA, x-1, y, z));
@@ -670,7 +670,7 @@ chunk_render(PyObject *self, PyObject *args) {
* grass, water, glass, chest, restone wire, * grass, water, glass, chest, restone wire,
* ice, fence, portal, iron bars, glass panes, * ice, fence, portal, iron bars, glass panes,
* trapped chests, stairs */ * trapped chests, stairs */
if (block_class_is_subset(state.block,block_class_ancil,block_class_ancil_len)) { if (block_class_is_subset(state.block, block_class_ancil, block_class_ancil_len)) {
ancilData = generate_pseudo_data(&state, ancilData); ancilData = generate_pseudo_data(&state, ancilData);
state.block_pdata = ancilData; state.block_pdata = ancilData;
} else { } else {

View File

@@ -96,7 +96,7 @@ base_draw(void *data, RenderState *state, PyObject *src, PyObject *mask, PyObjec
*/ */
if (/* grass, but not snowgrass */ if (/* grass, but not snowgrass */
(state->block == block_grass && get_data(state, BLOCKS, state->x, state->y+1, state->z) != 78) || (state->block == block_grass && get_data(state, BLOCKS, state->x, state->y+1, state->z) != 78) ||
block_class_is_subset(state->block,(mc_block_t[]){ block_class_is_subset(state->block, (mc_block_t[]){
block_vine, block_vine,
block_waterlily, block_waterlily,
block_flowing_water, block_flowing_water,
@@ -125,7 +125,7 @@ base_draw(void *data, RenderState *state, PyObject *src, PyObject *mask, PyObjec
/* grass needs a special facemask */ /* grass needs a special facemask */
facemask = self->grass_texture; facemask = self->grass_texture;
} }
if(block_class_is_subset(state->block,(mc_block_t[]){ if(block_class_is_subset(state->block, (mc_block_t[]){
block_grass, block_grass,
block_tallgrass, block_tallgrass,
block_pumpkin_stem, block_pumpkin_stem,
@@ -136,12 +136,12 @@ base_draw(void *data, RenderState *state, PyObject *src, PyObject *mask, PyObjec
},7)) { },7)) {
color_table = self->grasscolor; color_table = self->grasscolor;
} }
else if(block_class_is_subset(state->block,(mc_block_t[]){ else if(block_class_is_subset(state->block, (mc_block_t[]){
block_flowing_water,block_water block_flowing_water,block_water
},2)) { },2)) {
color_table = self->watercolor; color_table = self->watercolor;
} }
else if(block_class_is_subset(state->block,(mc_block_t[]){ else if(block_class_is_subset(state->block, (mc_block_t[]){
block_leaves,block_leaves2 block_leaves,block_leaves2
},2)) { },2)) {
color_table = self->foliagecolor; color_table = self->foliagecolor;

View File

@@ -36,7 +36,7 @@ edge_lines_draw(void *data, RenderState *state, PyObject *src, PyObject *mask, P
PrimitiveEdgeLines *self = (PrimitiveEdgeLines *)data; PrimitiveEdgeLines *self = (PrimitiveEdgeLines *)data;
/* Draw some edge lines! */ /* Draw some edge lines! */
if (block_class_is_subset(state->block,(mc_block_t[]){block_stone_slab,block_snow_layer},2) if (block_class_is_subset(state->block, (mc_block_t[]){block_stone_slab,block_snow_layer}, 2)
|| !is_transparent(state->block)) { || !is_transparent(state->block)) {
Imaging img_i = imaging_python_to_c(state->img); Imaging img_i = imaging_python_to_c(state->img);
unsigned char ink[] = {0, 0, 0, 255 * self->opacity}; unsigned char ink[] = {0, 0, 0, 255 * self->opacity};
@@ -44,9 +44,9 @@ edge_lines_draw(void *data, RenderState *state, PyObject *src, PyObject *mask, P
int x = state->x, y = state->y, z = state->z; int x = state->x, y = state->y, z = state->z;
int increment=0; int 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 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; 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) 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)
increment=9; increment=9;
/* +X side */ /* +X side */
@@ -54,8 +54,8 @@ edge_lines_draw(void *data, RenderState *state, PyObject *src, PyObject *mask, P
if (side_block != state->block && (is_transparent(side_block) || render_mode_hidden(state->rendermode, x+1, y, z)) && if (side_block != state->block && (is_transparent(side_block) || render_mode_hidden(state->rendermode, x+1, y, z)) &&
/* WARNING: ugly special case approaching */ /* WARNING: ugly special case approaching */
/* if the block is a slab and the side block is a stair don't draw anything, it can give very ugly results */ /* if the block is a slab and the side block is a stair don't draw anything, it can give very ugly results */
!(block_class_is_subset(state->block,(mc_block_t[]){block_wooden_slab,block_stone_slab},2) !(block_class_is_subset(state->block, (mc_block_t[]){block_wooden_slab, block_stone_slab}, 2)
&& (block_class_is_subset(side_block,block_class_stair,block_class_stair_len)) && (block_class_is_subset(side_block, block_class_stair, block_class_stair_len))
)) { )) {
ImagingDrawLine(img_i, state->imgx+12, state->imgy+1+increment, state->imgx+22+1, state->imgy+5+1+increment, &ink, 1); ImagingDrawLine(img_i, state->imgx+12, state->imgy+1+increment, state->imgx+22+1, state->imgy+5+1+increment, &ink, 1);
ImagingDrawLine(img_i, state->imgx+12, state->imgy+increment, state->imgx+22+1, state->imgy+5+increment, &ink, 1); ImagingDrawLine(img_i, state->imgx+12, state->imgy+increment, state->imgx+22+1, state->imgy+5+increment, &ink, 1);
@@ -67,8 +67,8 @@ edge_lines_draw(void *data, RenderState *state, PyObject *src, PyObject *mask, P
/* WARNING: ugly special case approaching */ /* WARNING: ugly special case approaching */
/* if the block is a slab and the side block is a stair don't draw anything, it can give very ugly results */ /* if the block is a slab and the side block is a stair don't draw anything, it can give very ugly results */
!( !(
block_class_is_subset(state->block,(mc_block_t[]){block_stone_slab,block_wooden_slab},2) block_class_is_subset(state->block, (mc_block_t[]){block_stone_slab,block_wooden_slab}, 2)
&& (block_class_is_subset(side_block,block_class_stair,block_class_stair_len)) && (block_class_is_subset(side_block, block_class_stair, block_class_stair_len))
)) { )) {
ImagingDrawLine(img_i, state->imgx, state->imgy+6+1+increment, state->imgx+12+1, state->imgy+1+increment, &ink, 1); ImagingDrawLine(img_i, state->imgx, state->imgy+6+1+increment, state->imgx+12+1, state->imgy+1+increment, &ink, 1);
ImagingDrawLine(img_i, state->imgx, state->imgy+6+increment, state->imgx+12+1, state->imgy+increment, &ink, 1); ImagingDrawLine(img_i, state->imgx, state->imgy+6+increment, state->imgx+12+1, state->imgy+increment, &ink, 1);

View File

@@ -140,7 +140,7 @@ estimate_blocklevel(RenderPrimitiveLighting *self, RenderState *state,
blocklevel = get_data(state, BLOCKLIGHT, x, y, z); blocklevel = get_data(state, BLOCKLIGHT, x, y, z);
/* no longer a guess */ /* no longer a guess */
if (!block_class_is_subset(block,block_class_alt_height,block_class_alt_height_len) && authoratative) { if (!block_class_is_subset(block, block_class_alt_height, block_class_alt_height_len) && authoratative) {
*authoratative = 1; *authoratative = 1;
} }
@@ -161,7 +161,7 @@ get_lighting_color(RenderPrimitiveLighting *self, RenderState *state,
/* special half-step handling, stairs handling */ /* special half-step handling, stairs handling */
/* Anvil also needs to be here, blockid 145 */ /* 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) { if ( block_class_is_subset(block, block_class_alt_height, block_class_alt_height_len) || block == block_anvil) {
unsigned int upper_block; unsigned int upper_block;
/* stairs and half-blocks take the skylevel from the upper block if it's transparent */ /* stairs and half-blocks take the skylevel from the upper block if it's transparent */
@@ -170,7 +170,7 @@ get_lighting_color(RenderPrimitiveLighting *self, RenderState *state,
do { do {
upper_counter++; upper_counter++;
upper_block = get_data(state, BLOCKS, x, y + upper_counter, z); upper_block = get_data(state, BLOCKS, x, y + upper_counter, z);
} while (block_class_is_subset(upper_block,block_class_alt_height,block_class_alt_height_len)); } while (block_class_is_subset(upper_block, block_class_alt_height, block_class_alt_height_len));
if (is_transparent(upper_block)) { if (is_transparent(upper_block)) {
skylevel = get_data(state, SKYLIGHT, x, y + upper_counter, z); skylevel = get_data(state, SKYLIGHT, x, y + upper_counter, z);
} else { } else {
@@ -183,7 +183,7 @@ get_lighting_color(RenderPrimitiveLighting *self, RenderState *state,
} }
if (block_class_is_subset(block,(mc_block_t[]){block_flowing_lava,block_lava},2)) { if (block_class_is_subset(block, (mc_block_t[]){block_flowing_lava,block_lava}, 2)) {
/* lava blocks should always be lit! */ /* lava blocks should always be lit! */
*r = 255; *r = 255;
*g = 255; *g = 255;
@@ -302,7 +302,7 @@ lighting_draw(void *data, RenderState *state, PyObject *src, PyObject *mask, PyO
self = (RenderPrimitiveLighting *)data; self = (RenderPrimitiveLighting *)data;
x = state->x, y = state->y, z = state->z; x = state->x, y = state->y, z = state->z;
if (block_class_is_subset(state->block,(mc_block_t[]){block_flowing_water,block_water},2)) { /* special case for water */ if (block_class_is_subset(state->block, (mc_block_t[]){block_flowing_water,block_water}, 2)) { /* special case for water */
/* looks like we need a new case for lighting, there are /* looks like we need a new case for lighting, there are
* blocks that are transparent for occlusion calculations and * blocks that are transparent for occlusion calculations and
* need per-face shading if the face is drawn. */ * need per-face shading if the face is drawn. */

View File

@@ -37,7 +37,7 @@ walk_chunk(RenderState *state, RenderPrimitiveNether *data) {
for (y = NETHER_ROOF-1; y>=0; y--) { for (y = NETHER_ROOF-1; y>=0; y--) {
id = get_data(state, BLOCKS, x, y - (state->chunky * 16), z); id = get_data(state, BLOCKS, x, y - (state->chunky * 16), z);
if (block_class_is_subset(id,(mc_block_t[]){block_bedrock,block_netherrack,block_quartz_ore,block_lava},4)) if (block_class_is_subset(id, (mc_block_t[]){block_bedrock,block_netherrack,block_quartz_ore,block_lava}, 4))
data->remove_block[x+1][y][z+1] = 1; data->remove_block[x+1][y][z+1] = 1;
else else
break; break;

View File

@@ -220,9 +220,9 @@ smooth_lighting_draw(void *data, RenderState *state, PyObject *src, PyObject *ma
/* special case for leaves, water 8, water 9, ice 79 /* special case for leaves, water 8, water 9, ice 79
-- these are also smooth-lit! */ -- these are also smooth-lit! */
if (!block_class_is_subset(state->block,(mc_block_t[]){ if (!block_class_is_subset(state->block, (mc_block_t[]){
block_leaves,block_flowing_water,block_water,block_ice block_leaves,block_flowing_water,block_water,block_ice
},4) && is_transparent(state->block)) }, 4) && is_transparent(state->block))
{ {
/* transparent blocks are rendered as usual, with flat lighting */ /* transparent blocks are rendered as usual, with flat lighting */
primitive_lighting.draw(data, state, src, mask, mask_light); primitive_lighting.draw(data, state, src, mask, mask_light);

View File

@@ -14,7 +14,7 @@
#define OV_BLEND(mask, in1, in2, tmp1, tmp2)\ #define OV_BLEND(mask, in1, in2, tmp1, tmp2)\
(OV_MULDIV255(in1, 255 - mask, tmp1) + OV_MULDIV255(in2, mask, tmp2)) (OV_MULDIV255(in1, 255 - mask, tmp1) + OV_MULDIV255(in2, mask, tmp2))
#define count_of(array) \ #define COUNT_OF(array) \
(sizeof(array) / sizeof(array[0])) (sizeof(array) / sizeof(array[0]))
#endif #endif