0

grass now has snowy sides when covered in snow

This commit is contained in:
Aaron Griffith
2011-05-01 19:42:27 -04:00
parent e110fe735d
commit c1e71f0fda
3 changed files with 23 additions and 10 deletions

View File

@@ -155,7 +155,12 @@ generate_pseudo_data(RenderState *state, unsigned char ancilData) {
int x = state->x, y = state->y, z = state->z; int x = state->x, y = state->y, z = state->z;
unsigned char data = 0; unsigned char data = 0;
if (state->block == 9) { /* water */ if (state->block == 2) { /* grass */
/* return 0x10 if grass is covered in snow */
if (z < 127 && getArrayByte3D(state->blocks, x, y, z+1) == 78)
return 0x10;
return ancilData;
} else if (state->block == 9) { /* water */
/* 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 ((ancilData == 0) || (ancilData >= 10)) { /* static water, only top, and unkown ancildata values */ if ((ancilData == 0) || (ancilData >= 10)) { /* static water, only top, and unkown ancildata values */
data = 16; data = 16;
@@ -393,7 +398,7 @@ chunk_render(PyObject *self, PyObject *args) {
PyObject *tmp; PyObject *tmp;
unsigned char ancilData = getArrayByte3D(blockdata_expanded, state.x, state.y, state.z); unsigned char ancilData = getArrayByte3D(blockdata_expanded, state.x, state.y, state.z);
if ((state.block == 85) || (state.block == 9) || (state.block == 55) || (state.block == 54) ) { if ((state.block == 85) || (state.block == 9) || (state.block == 55) || (state.block == 54) || (state.block == 2)) {
ancilData = generate_pseudo_data(&state, ancilData); ancilData = generate_pseudo_data(&state, ancilData);
} }

View File

@@ -138,7 +138,9 @@ rendermode_normal_draw(void *data, RenderState *state, PyObject *src, PyObject *
switch (state->block) { switch (state->block) {
case 2: case 2:
/* grass */ /* grass -- skip for snowgrass */
if (state->z < 127 && getArrayByte3D(state->blocks, state->x, state->y, state->z+1) == 78)
break;
color = PySequence_GetItem(self->grasscolor, index); color = PySequence_GetItem(self->grasscolor, index);
facemask = self->grass_texture; facemask = self->grass_texture;
alpha_over(state->img, self->grass_texture, self->grass_texture, state->imgx, state->imgy, 0, 0); alpha_over(state->img, self->grass_texture, self->grass_texture, state->imgx, state->imgy, 0, 0);

View File

@@ -429,7 +429,12 @@ def generate_special_texture(blockID, data):
# all need to behandled here (and in chunkpy) # all need to behandled here (and in chunkpy)
if blockID == 2: # grass if blockID == 2: # grass
img = _build_block(terrain_images[0], terrain_images[3], 2) # data & 0x10 means SNOW sides
side_img = terrain_images[3]
if data & 0x10:
side_img = terrain_images[68]
img = _build_block(terrain_images[0], side_img, 2)
if not data & 0x10:
colored = tintTexture(biome_grass_texture, (115, 175, 71)) colored = tintTexture(biome_grass_texture, (115, 175, 71))
composite.alpha_over(img, colored, (0, 0), colored) composite.alpha_over(img, colored, (0, 0), colored)
return (img.convert("RGB"), img.split()[3]) return (img.convert("RGB"), img.split()[3])
@@ -1327,10 +1332,11 @@ special_map[92] = range(6) # cake!
# grass and leaves are graysacle in terrain.png # grass and leaves are graysacle in terrain.png
# we treat them as special so we can manually tint them # we treat them as special so we can manually tint them
# it is unknown how the specific tint (biomes) is calculated # it is unknown how the specific tint (biomes) is calculated
special_map[2] = range(11) # grass, grass has not ancildata but is used # also, 0x10 means SNOW sides
# in the mod WildGrass, and this small fix special_map[2] = range(11) + [0x10,] # grass, grass has not ancildata but is
# shows the map as expected, and is harmless # used in the mod WildGrass, and this
# for normal maps # small fix shows the map as expected,
# and is harmless for normal maps
special_map[18] = range(16) # leaves, birch, normal or pine leaves (not implemented) special_map[18] = range(16) # leaves, birch, normal or pine leaves (not implemented)