diff --git a/overviewer_core/src/iterate.c b/overviewer_core/src/iterate.c index 6a77ccf..fbc3849 100644 --- a/overviewer_core/src/iterate.c +++ b/overviewer_core/src/iterate.c @@ -372,7 +372,7 @@ chunk_render(PyObject *self, PyObject *args) { for (state.z = 0; state.z < 128; state.z++) { state.imgy -= 12; - /* get blockid */ + /* get blockid */ state.block = getArrayByte3D(blocks_py, state.x, state.y, state.z); if (state.block == 0) { continue; @@ -430,14 +430,29 @@ chunk_render(PyObject *self, PyObject *args) { if (t != NULL && t != Py_None) { PyObject *src, *mask, *mask_light; + int randx = 0, randy = 0; src = PyTuple_GetItem(t, 0); mask = PyTuple_GetItem(t, 1); mask_light = PyTuple_GetItem(t, 2); if (mask == Py_None) mask = src; + + 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 += randx; + state.imgy += randy; + } rendermode->draw(rm_data, &state, src, mask, mask_light); + + if (state.block == 31) { + /* undo the random offsets */ + state.imgx -= randx; + state.imgy -= randy; + } } } diff --git a/overviewer_core/src/rendermode-normal.c b/overviewer_core/src/rendermode-normal.c index c9f037a..cbc2d49 100644 --- a/overviewer_core/src/rendermode-normal.c +++ b/overviewer_core/src/rendermode-normal.c @@ -125,7 +125,6 @@ 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 offx = 0, offy = 0; unsigned char data_byte; /* first, check to see if we should use biome-compatible src, mask */ @@ -142,14 +141,8 @@ rendermode_normal_draw(void *data, RenderState *state, PyObject *src, PyObject * } } - if (state->block == 31) { - /* add a random offset to the postion of the tall grass to make it more wild */ - offx = rand() % 6 + 1 - 3; - offy = rand() % 6 + 1 - 3; - } - /* draw the block! */ - alpha_over(state->img, src, mask, state->imgx + offx, state->imgy + offy, 0, 0); + alpha_over(state->img, src, mask, state->imgx, state->imgy, 0, 0); if (self->biome_data) { /* do the biome stuff! */ @@ -167,7 +160,7 @@ rendermode_normal_draw(void *data, RenderState *state, PyObject *src, PyObject * break; color = PySequence_GetItem(self->grasscolor, index); facemask = self->grass_texture; - alpha_over(state->img, self->grass_texture, self->grass_texture, state->imgx + offx, state->imgy + offy, 0, 0); + alpha_over(state->img, self->grass_texture, self->grass_texture, state->imgx, state->imgy, 0, 0); break; case 18: /* leaves */ @@ -196,7 +189,7 @@ rendermode_normal_draw(void *data, RenderState *state, PyObject *src, PyObject * b = PyInt_AsLong(PyTuple_GET_ITEM(color, 2)); Py_DECREF(color); - tint_with_mask(state->img, r, g, b, 255, facemask, state->imgx + offx, state->imgy + offy, 0, 0); + tint_with_mask(state->img, r, g, b, 255, facemask, state->imgx, state->imgy, 0, 0); } }