0

changed imgy calculation and moved "imgy -= 12" to start of loop

from discussion in
<https://github.com/agrif/Minecraft-Overviewer/commit/4e63e6#iterate.c-P282>
This commit is contained in:
Alejandro Aguilera
2011-03-11 17:43:18 -05:00
committed by Aaron Griffith
parent 6519d71eaa
commit c79b0b9b20

View File

@@ -93,23 +93,21 @@ chunk_render(PyObject *self, PyObject *args) {
for (x = 15; x > -1; x--) { for (x = 15; x > -1; x--) {
for (y = 0; y < 16; y++) { for (y = 0; y < 16; y++) {
imgx = xoff + x*12 + y*12; imgx = xoff + x*12 + y*12;
imgy = yoff - x*6 + y*6 + 1632; // 1632 == 128*12 + 16*12//2 /* 128*12 -- offset for z direction, 15*6 -- offset for x */
imgy = yoff - x*6 + y*6 + 128*12 + 15*6;
for (z = 0; z < 128; z++) { for (z = 0; z < 128; z++) {
//printf("c/imgx/%d\n", imgx); imgy -= 12;
//printf("c/imgy/%d\n", imgy);
if ((imgx >= imgsize0 + 24) || (imgx <= -24)) { if ((imgx >= imgsize0 + 24) || (imgx <= -24)) {
imgy -= 12; // NOTE: we need to do this at every continue
continue; continue;
} }
if ((imgy >= imgsize1 + 24) || (imgy <= -24)) { if ((imgy >= imgsize1 + 24) || (imgy <= -24)) {
imgy -= 12;
continue; continue;
} }
// get blockid // get blockid
unsigned char block = getBlock(blocks, x, z, y); // Note the order: x,z,y unsigned char block = getBlock(blocks, x, z, y); // Note the order: x,z,y
if (block == 0) { if (block == 0) {
imgy -= 12;
continue; continue;
} }
//printf("checking blockid %hhu\n", block); //printf("checking blockid %hhu\n", block);
@@ -120,7 +118,6 @@ chunk_render(PyObject *self, PyObject *args) {
!isTransparent(getBlock(blocks, x-1, z, y)) && !isTransparent(getBlock(blocks, x-1, z, y)) &&
!isTransparent(getBlock(blocks, x, z+1, y)) && !isTransparent(getBlock(blocks, x, z+1, y)) &&
!isTransparent(getBlock(blocks, x, z, y+1)) ) { !isTransparent(getBlock(blocks, x, z, y+1)) ) {
imgy -= 12;
continue; continue;
} }
@@ -131,7 +128,6 @@ chunk_render(PyObject *self, PyObject *args) {
// PyList_GetItem returns borrowed ref // PyList_GetItem returns borrowed ref
if (t == Py_None) { if (t == Py_None) {
printf("t == Py_None. blockid=%d\n", block); printf("t == Py_None. blockid=%d\n", block);
imgy -= 12;
continue; continue;
} }
@@ -145,7 +141,6 @@ chunk_render(PyObject *self, PyObject *args) {
void* ancilData_p = PyArray_GETPTR3(blockdata_expanded, x, y, z); void* ancilData_p = PyArray_GETPTR3(blockdata_expanded, x, y, z);
unsigned char ancilData = *((unsigned char*)ancilData_p); unsigned char ancilData = *((unsigned char*)ancilData_p);
if (block == 85) { // fence. skip the generate_pseudo_ancildata for now if (block == 85) { // fence. skip the generate_pseudo_ancildata for now
imgy -= 12;
continue; continue;
} }
PyObject *tmp = PyTuple_New(2); PyObject *tmp = PyTuple_New(2);
@@ -157,10 +152,8 @@ chunk_render(PyObject *self, PyObject *args) {
Py_DECREF(tmp); Py_DECREF(tmp);
if (t != NULL) if (t != NULL)
texture_alpha_over(img, t, imgx, imgy ); texture_alpha_over(img, t, imgx, imgy );
imgy -= 12;
continue; continue;
} }
imgy -= 12;
} }
} }
} }