diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index e20967cba..316531f63 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -90,6 +90,9 @@ uint8_t globalr = 255, globalg = 255, globalb = 255; int16_t pskybits_override = -1; +// This was on the cache but is permanently allocated, so put it into something static. This needs some rethinking anyway +static TArray> voxelmemory; + void (*loadvoxel_replace)(int32_t voxindex) = NULL; int16_t tiletovox[MAXTILES]; int32_t usevoxels = 1; @@ -110,7 +113,7 @@ int32_t novoxmips = 1; #else # define DISTRECIPSIZ 131072 #endif -static uint8_t voxlock[MAXVOXELS][MAXVOXMIPS]; + int32_t voxscale[MAXVOXELS]; static int32_t ggxinc[MAXXSIZ+1], ggyinc[MAXXSIZ+1]; @@ -8173,12 +8176,8 @@ int32_t engineInit(void) for (i=1; i<1024; i++) lowrecip[i] = ((1<<24)-1)/i; - for (i=0; i>2, 65536); @@ -10568,33 +10567,31 @@ void videoNextPage(void) // // qloadkvx // + + + int32_t qloadkvx(int32_t voxindex, const char *filename) { - const buildvfs_kfd fil = kopen4load(filename, 0); - if (fil == buildvfs_kfd_invalid) + autofil = kopenFileReader(filename, 0); + if (!fil.isOpen()) return -1; int32_t lengcnt = 0; - const int32_t lengtot = kfilelength(fil); + const int32_t lengtot = fil.GetLength(); for (bssize_t i=0; i= lengtot-768) break; } - kclose(fil); #ifdef USE_OPENGL if (voxmodels[voxindex]) @@ -10630,7 +10627,6 @@ void vox_undefine(int32_t const tile) for (ssize_t j = 0; j < MAXVOXMIPS; ++j) { // CACHE1D_FREE - voxlock[voxindex][j] = 1; voxoff[voxindex][j] = 0; } voxscale[voxindex] = 65536;