From 50f12827f56e9be155962cdaa36d8c28a30ddd87 Mon Sep 17 00:00:00 2001 From: Wunkolo Date: Sat, 16 Mar 2019 22:42:08 -0700 Subject: [PATCH] Block ID enum pass --- overviewer_core/src/primitives/hide.c | 2 +- overviewer_core/src/primitives/nether.c | 7 ++++--- .../src/primitives/overlay-mineral.c | 19 ++++++++++--------- .../src/primitives/smooth-lighting.c | 2 +- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/overviewer_core/src/primitives/hide.c b/overviewer_core/src/primitives/hide.c index bc39c2e..c3dff6c 100644 --- a/overviewer_core/src/primitives/hide.c +++ b/overviewer_core/src/primitives/hide.c @@ -91,7 +91,7 @@ hide_hidden(void *data, RenderState *state, int x, int y, int z) { return 0; block = get_data(state, BLOCKS, x, y, z); - for (i = 0; self->rules[i].blockid != 0; i++) { + for (i = 0; self->rules[i].blockid != block_air; i++) { if (block == self->rules[i].blockid) { unsigned char data; diff --git a/overviewer_core/src/primitives/nether.c b/overviewer_core/src/primitives/nether.c index c086dd8..407be7c 100644 --- a/overviewer_core/src/primitives/nether.c +++ b/overviewer_core/src/primitives/nether.c @@ -16,6 +16,7 @@ */ #include "../overviewer.h" +#include "../mc_id.h" #include "nether.h" static void @@ -26,16 +27,16 @@ walk_chunk(RenderState *state, RenderPrimitiveNether *data) { for (x = -1; x < WIDTH + 1; x++) { for (z = -1; z < DEPTH + 1; z++) { id = get_data(state, BLOCKS, x, NETHER_ROOF - (state->chunky * 16), z); - if (id == 7) { + if (id == block_bedrock) { data->remove_block[x+1][NETHER_ROOF][z+1] = 1; id = get_data(state, BLOCKS, x, (NETHER_ROOF + 1) - (state->chunky * 16), z); - if (id == 39 || id == 40) + if (id == block_brown_mushroom || id == block_red_mushroom) data->remove_block[x+1][NETHER_ROOF + 1][z+1] = 1; } for (y = NETHER_ROOF-1; y>=0; y--) { id = get_data(state, BLOCKS, x, y - (state->chunky * 16), z); - if (id == 7 || id == 87 || id == 153 || id == 11) + if (id == block_bedrock || id == block_netherrack || id == block_quartz_ore || id == block_lava) data->remove_block[x+1][y][z+1] = 1; else break; diff --git a/overviewer_core/src/primitives/overlay-mineral.c b/overviewer_core/src/primitives/overlay-mineral.c index d831419..e7cd203 100644 --- a/overviewer_core/src/primitives/overlay-mineral.c +++ b/overviewer_core/src/primitives/overlay-mineral.c @@ -16,6 +16,7 @@ */ #include "overlay.h" +#include "../mc_id.h" typedef struct { /* inherits from overlay */ @@ -31,17 +32,17 @@ struct MineralColor { /* put more valuable ores first -- they take precedence */ static struct MineralColor default_minerals[] = { - {48 /* Mossy Stone */, 31, 153, 9}, + {block_mossy_cobblestone, 31, 153, 9}, - {56 /* Diamond Ore */, 32, 230, 220}, + {block_diamond_ore, 32, 230, 220}, - {21 /* Lapis Lazuli */, 0, 23, 176}, - {14 /* Gold Ore */, 255, 234, 0}, + {block_lapis_ore, 0, 23, 176}, + {block_gold_ore, 255, 234, 0}, - {15 /* Iron Ore */, 204, 204, 204}, - {73 /* Redstone */, 186, 0, 0}, - {74 /* Lit Redstone */, 186, 0, 0}, - {16 /* Coal Ore */, 54, 54, 54}, + {block_iron_ore, 204, 204, 204}, + {block_redstone_ore, 186, 0, 0}, + {block_lit_redstone_ore, 186, 0, 0}, + {block_coal_ore, 54, 54, 54}, /* end of list marker */ {0, 0, 0, 0} @@ -61,7 +62,7 @@ static void get_color(void *data, RenderState *state, int i, tmp; unsigned short blockid = get_data(state, BLOCKS, x, y, z); - for (i = 0; (max_i == -1 || i < max_i) && minerals[i].blockid != 0; i++) { + for (i = 0; (max_i == -1 || i < max_i) && minerals[i].blockid != block_air; i++) { if (minerals[i].blockid == blockid) { *r = minerals[i].r; *g = minerals[i].g; diff --git a/overviewer_core/src/primitives/smooth-lighting.c b/overviewer_core/src/primitives/smooth-lighting.c index 05e9351..fb28be6 100644 --- a/overviewer_core/src/primitives/smooth-lighting.c +++ b/overviewer_core/src/primitives/smooth-lighting.c @@ -219,7 +219,7 @@ 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 (state->block != 18 && state->block != 8 && state->block != 9 && state->block != 79 && is_transparent(state->block)) + if (state->block != block_leaves && state->block != block_flowing_water && state->block != block_water && state->block != block_ice && is_transparent(state->block)) { /* transparent blocks are rendered as usual, with flat lighting */ primitive_lighting.draw(data, state, src, mask, mask_light);