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

@@ -96,7 +96,7 @@ base_draw(void *data, RenderState *state, PyObject *src, PyObject *mask, PyObjec
*/
if (/* grass, but not snowgrass */
(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_waterlily,
block_flowing_water,
@@ -125,7 +125,7 @@ base_draw(void *data, RenderState *state, PyObject *src, PyObject *mask, PyObjec
/* grass needs a special facemask */
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_tallgrass,
block_pumpkin_stem,
@@ -136,12 +136,12 @@ base_draw(void *data, RenderState *state, PyObject *src, PyObject *mask, PyObjec
},7)) {
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
},2)) {
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
},2)) {
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;
/* 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)) {
Imaging img_i = imaging_python_to_c(state->img);
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 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;
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;
/* +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)) &&
/* 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 */
!(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(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))
)) {
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);
@@ -67,8 +67,8 @@ edge_lines_draw(void *data, RenderState *state, PyObject *src, PyObject *mask, P
/* 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 */
!(
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(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))
)) {
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);

View File

@@ -140,7 +140,7 @@ estimate_blocklevel(RenderPrimitiveLighting *self, RenderState *state,
blocklevel = get_data(state, BLOCKLIGHT, x, y, z);
/* 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;
}
@@ -161,7 +161,7 @@ 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) {
if ( block_class_is_subset(block, block_class_alt_height, block_class_alt_height_len) || block == block_anvil) {
unsigned int upper_block;
/* 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 {
upper_counter++;
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)) {
skylevel = get_data(state, SKYLIGHT, x, y + upper_counter, z);
} 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! */
*r = 255;
*g = 255;
@@ -302,7 +302,7 @@ lighting_draw(void *data, RenderState *state, PyObject *src, PyObject *mask, PyO
self = (RenderPrimitiveLighting *)data;
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
* blocks that are transparent for occlusion calculations and
* 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--) {
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;
else
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
-- 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
},4) && is_transparent(state->block))
}, 4) && is_transparent(state->block))
{
/* transparent blocks are rendered as usual, with flat lighting */
primitive_lighting.draw(data, state, src, mask, mask_light);