0

Block ID enum pass

This commit is contained in:
Wunkolo
2019-03-16 22:42:08 -07:00
parent 4d4df31ece
commit 50f12827f5
4 changed files with 16 additions and 14 deletions

View File

@@ -91,7 +91,7 @@ hide_hidden(void *data, RenderState *state, int x, int y, int z) {
return 0; return 0;
block = get_data(state, BLOCKS, x, y, z); 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) { if (block == self->rules[i].blockid) {
unsigned char data; unsigned char data;

View File

@@ -16,6 +16,7 @@
*/ */
#include "../overviewer.h" #include "../overviewer.h"
#include "../mc_id.h"
#include "nether.h" #include "nether.h"
static void static void
@@ -26,16 +27,16 @@ walk_chunk(RenderState *state, RenderPrimitiveNether *data) {
for (x = -1; x < WIDTH + 1; x++) { for (x = -1; x < WIDTH + 1; x++) {
for (z = -1; z < DEPTH + 1; z++) { for (z = -1; z < DEPTH + 1; z++) {
id = get_data(state, BLOCKS, x, NETHER_ROOF - (state->chunky * 16), 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; data->remove_block[x+1][NETHER_ROOF][z+1] = 1;
id = get_data(state, BLOCKS, x, (NETHER_ROOF + 1) - (state->chunky * 16), z); 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; data->remove_block[x+1][NETHER_ROOF + 1][z+1] = 1;
} }
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 (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; data->remove_block[x+1][y][z+1] = 1;
else else
break; break;

View File

@@ -16,6 +16,7 @@
*/ */
#include "overlay.h" #include "overlay.h"
#include "../mc_id.h"
typedef struct { typedef struct {
/* inherits from overlay */ /* inherits from overlay */
@@ -31,17 +32,17 @@ struct MineralColor {
/* put more valuable ores first -- they take precedence */ /* put more valuable ores first -- they take precedence */
static struct MineralColor default_minerals[] = { 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}, {block_lapis_ore, 0, 23, 176},
{14 /* Gold Ore */, 255, 234, 0}, {block_gold_ore, 255, 234, 0},
{15 /* Iron Ore */, 204, 204, 204}, {block_iron_ore, 204, 204, 204},
{73 /* Redstone */, 186, 0, 0}, {block_redstone_ore, 186, 0, 0},
{74 /* Lit Redstone */, 186, 0, 0}, {block_lit_redstone_ore, 186, 0, 0},
{16 /* Coal Ore */, 54, 54, 54}, {block_coal_ore, 54, 54, 54},
/* end of list marker */ /* end of list marker */
{0, 0, 0, 0} {0, 0, 0, 0}
@@ -61,7 +62,7 @@ static void get_color(void *data, RenderState *state,
int i, tmp; int i, tmp;
unsigned short blockid = get_data(state, BLOCKS, x, y, z); 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) { if (minerals[i].blockid == blockid) {
*r = minerals[i].r; *r = minerals[i].r;
*g = minerals[i].g; *g = minerals[i].g;

View File

@@ -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 /* special case for leaves, water 8, water 9, ice 79
-- these are also smooth-lit! */ -- 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 */ /* 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);