fixed tallgrass offsets affecting blocks above
This commit is contained in:
@@ -125,7 +125,7 @@ rendermode_normal_occluded(void *data, RenderState *state) {
|
|||||||
static void
|
static void
|
||||||
rendermode_normal_draw(void *data, RenderState *state, PyObject *src, PyObject *mask, PyObject *mask_light) {
|
rendermode_normal_draw(void *data, RenderState *state, PyObject *src, PyObject *mask, PyObject *mask_light) {
|
||||||
RenderModeNormal *self = (RenderModeNormal *)data;
|
RenderModeNormal *self = (RenderModeNormal *)data;
|
||||||
int randx = 0,randy = 0;
|
int offx = 0, offy = 0;
|
||||||
unsigned char data_byte;
|
unsigned char data_byte;
|
||||||
|
|
||||||
/* first, check to see if we should use biome-compatible src, mask */
|
/* first, check to see if we should use biome-compatible src, mask */
|
||||||
@@ -133,11 +133,6 @@ rendermode_normal_draw(void *data, RenderState *state, PyObject *src, PyObject *
|
|||||||
if (state->block == 18) {
|
if (state->block == 18) {
|
||||||
src = mask = self->leaf_texture;
|
src = mask = self->leaf_texture;
|
||||||
} else if (state->block == 31) {
|
} 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;
|
|
||||||
data_byte = getArrayByte3D(state->blockdata_expanded, state->x, state->y, state->z);
|
data_byte = getArrayByte3D(state->blockdata_expanded, state->x, state->y, state->z);
|
||||||
if (data_byte == 1) {
|
if (data_byte == 1) {
|
||||||
src = mask = self->tall_grass_texture;
|
src = mask = self->tall_grass_texture;
|
||||||
@@ -147,8 +142,14 @@ 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! */
|
/* draw the block! */
|
||||||
alpha_over(state->img, src, mask, state->imgx, state->imgy, 0, 0);
|
alpha_over(state->img, src, mask, state->imgx + offx, state->imgy + offy, 0, 0);
|
||||||
|
|
||||||
if (self->biome_data) {
|
if (self->biome_data) {
|
||||||
/* do the biome stuff! */
|
/* do the biome stuff! */
|
||||||
@@ -166,7 +167,7 @@ rendermode_normal_draw(void *data, RenderState *state, PyObject *src, PyObject *
|
|||||||
break;
|
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 + offx, state->imgy + offy, 0, 0);
|
||||||
break;
|
break;
|
||||||
case 18:
|
case 18:
|
||||||
/* leaves */
|
/* leaves */
|
||||||
@@ -195,7 +196,7 @@ rendermode_normal_draw(void *data, RenderState *state, PyObject *src, PyObject *
|
|||||||
b = PyInt_AsLong(PyTuple_GET_ITEM(color, 2));
|
b = PyInt_AsLong(PyTuple_GET_ITEM(color, 2));
|
||||||
Py_DECREF(color);
|
Py_DECREF(color);
|
||||||
|
|
||||||
tint_with_mask(state->img, r, g, b, 255, facemask, state->imgx, state->imgy, 0, 0);
|
tint_with_mask(state->img, r, g, b, 255, facemask, state->imgx + offx, state->imgy + offy, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user