diff --git a/src/rendermode-normal.c b/src/rendermode-normal.c index d975ed9..b112192 100644 --- a/src/rendermode-normal.c +++ b/src/rendermode-normal.c @@ -125,12 +125,18 @@ rendermode_normal_occluded(void *data, RenderState *state) { static void rendermode_normal_draw(void *data, RenderState *state, PyObject *src, PyObject *mask, PyObject *mask_light) { RenderModeNormal *self = (RenderModeNormal *)data; + int randx = 0,randy = 0; /* first, check to see if we should use biome-compatible src, mask */ if (self->biome_data) { if (state->block == 18) { src = mask = self->leaf_texture; } else if (state->block == 31) { + /* add a random offset to the postion of the tall grass to make it more wild */ + randx = rand() % 6 + 1 - 3; + randy = rand() % 6 + 1 - 3; + state->imgx = state->imgx + randx; + state->imgy = state->imgy + randy; unsigned char data = getArrayByte3D(state->blockdata_expanded, state->x, state->y, state->z); if (data == 1) { src = mask = self->tall_grass_texture; diff --git a/textures.py b/textures.py index 101b933..be81977 100644 --- a/textures.py +++ b/textures.py @@ -236,7 +236,8 @@ def _build_block(top, side, blockID=None): """ img = Image.new("RGBA", (24,24), (38,92,255,0)) - + + original_texture = top.copy() top = transform_image(top, blockID) if not side: @@ -256,8 +257,15 @@ def _build_block(top, side, blockID=None): otherside = ImageEnhance.Brightness(otherside).enhance(0.8) otherside.putalpha(othersidealpha) + ## special case for tall-grass, fern and dead shrub, they are the only sprite-blocks + ## that have the sprites in the diagonal of the block + if blockID in (31,32): + front = original_texture.resize((14,11), Image.ANTIALIAS) + composite.alpha_over(img, front, (5,9)) + return img + ## special case for non-block things - if blockID in (31,32,37,38,6,39,40,83,30): ## tall grass, dead shrubs, flowers, sapling, mushrooms, reeds, web + if blockID in (37,38,6,39,40,83,30): ## flowers, sapling, mushrooms, reeds, web # # instead of pasting these blocks at the cube edges, place them in the middle: # and omit the top @@ -265,7 +273,6 @@ def _build_block(top, side, blockID=None): composite.alpha_over(img, otherside, (6,3), otherside) return img - if blockID in (81,): # cacti! composite.alpha_over(img, side, (1,6), side) composite.alpha_over(img, otherside, (11,6), otherside)