fixed lighting bug introduced by tall grass fix
This commit is contained in:
@@ -430,6 +430,7 @@ chunk_render(PyObject *self, PyObject *args) {
|
|||||||
if (t != NULL && t != Py_None)
|
if (t != NULL && t != Py_None)
|
||||||
{
|
{
|
||||||
PyObject *src, *mask, *mask_light;
|
PyObject *src, *mask, *mask_light;
|
||||||
|
int randx = 0, randy = 0;
|
||||||
src = PyTuple_GetItem(t, 0);
|
src = PyTuple_GetItem(t, 0);
|
||||||
mask = PyTuple_GetItem(t, 1);
|
mask = PyTuple_GetItem(t, 1);
|
||||||
mask_light = PyTuple_GetItem(t, 2);
|
mask_light = PyTuple_GetItem(t, 2);
|
||||||
@@ -437,7 +438,21 @@ chunk_render(PyObject *self, PyObject *args) {
|
|||||||
if (mask == Py_None)
|
if (mask == Py_None)
|
||||||
mask = src;
|
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);
|
rendermode->draw(rm_data, &state, src, mask, mask_light);
|
||||||
|
|
||||||
|
if (state.block == 31) {
|
||||||
|
/* undo the random offsets */
|
||||||
|
state.imgx -= randx;
|
||||||
|
state.imgy -= randy;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -125,7 +125,6 @@ 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 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 */
|
||||||
@@ -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! */
|
/* 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) {
|
if (self->biome_data) {
|
||||||
/* do the biome stuff! */
|
/* do the biome stuff! */
|
||||||
@@ -167,7 +160,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 + offx, state->imgy + offy, 0, 0);
|
alpha_over(state->img, self->grass_texture, self->grass_texture, state->imgx, state->imgy, 0, 0);
|
||||||
break;
|
break;
|
||||||
case 18:
|
case 18:
|
||||||
/* leaves */
|
/* leaves */
|
||||||
@@ -196,7 +189,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 + offx, state->imgy + offy, 0, 0);
|
tint_with_mask(state->img, r, g, b, 255, facemask, state->imgx, state->imgy, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user