0

fixed biomes to use z/x instead of x/z indexing

reference: Issue #644
This commit is contained in:
Aaron Griffith
2012-03-15 05:10:03 -04:00
parent 9be414e540
commit 9ba3cbabc8
2 changed files with 7 additions and 7 deletions

View File

@@ -26,7 +26,7 @@
// increment this value if you've made a change to the c extesion
// and want to force users to rebuild
#define OVERVIEWER_EXTENSION_VERSION 29
#define OVERVIEWER_EXTENSION_VERSION 30
/* Python PIL, and numpy headers */
#include <Python.h>
@@ -35,11 +35,11 @@
/* macro for getting a value out of various numpy arrays the 3D arrays have
interesting, swizzled coordinates because minecraft (anvil) stores blocks
in y/z/x order */
in y/z/x order for 3D, z/x order for 2D */
#define getArrayByte3D(array, x,y,z) (*(unsigned char *)(PyArray_GETPTR3((array), (y), (z), (x))))
#define getArrayShort3D(array, x,y,z) (*(unsigned short *)(PyArray_GETPTR3((array), (y), (z), (x))))
#define getArrayByte2D(array, x,y) (*(unsigned char *)(PyArray_GETPTR2((array), (x), (y))))
#define getArrayShort2D(array, x,y) (*(unsigned short *)(PyArray_GETPTR2((array), (x), (y))))
#define getArrayByte2D(array, x,y) (*(unsigned char *)(PyArray_GETPTR2((array), (y), (x))))
/* generally useful MAX / MIN macros */
#define MAX(a, b) ((a) > (b) ? (a) : (b))

View File

@@ -214,7 +214,7 @@ base_draw(void *data, RenderState *state, PyObject *src, PyObject *mask, PyObjec
if (self->use_biomes) {
/* average over all neighbors */
for (dx = -1; dx <= 1; dx++) {
for (dz = -1; dz <= 1; dz += (dx == 0 ? 2 : 1)) {
for (dz = -1; dz <= 1; dz++) {
unsigned char biome = get_data(state, BIOMES, state->x + dx, state->y, state->z + dz);
if (biome >= NUM_BIOMES) {
/* note -- biome 255 shows up on map borders.
@@ -227,8 +227,8 @@ base_draw(void *data, RenderState *state, PyObject *src, PyObject *mask, PyObjec
rain += biome_table[biome].rainfall;
}
}
temp /= 8.0;
rain /= 8.0;
temp /= 9.0;
rain /= 9.0;
} else {
/* don't use biomes, just use the default */
temp = biome_table[DEFAULT_BIOME].temperature;