diff --git a/source/build/include/build.h b/source/build/include/build.h index 5b5e4b8a1..bcf95d8a9 100644 --- a/source/build/include/build.h +++ b/source/build/include/build.h @@ -1032,28 +1032,27 @@ int32_t clipmapinfo_load(void); #endif int32_t saveboard(const char *filename, const vec3_t *dapos, int16_t daang, int16_t dacursectnum); -void E_CreateDummyTile(int32_t const tile); -void E_CreateFakeTile(int32_t const tile, int32_t tsiz, char const * const buffer); -void E_UndefineTile(int32_t const tile); -void set_tilesiz(int32_t picnum, int16_t dasizx, int16_t dasizy); -int32_t tile_exists(int32_t picnum); -int32_t E_ReadArtFileHeader(int32_t const fil, char const * const fn, artheader_t * const local); -int32_t E_ReadArtFileHeaderFromBuffer(uint8_t const * const buf, artheader_t * const local); -int32_t E_CheckUnitArtFileHeader(uint8_t const * const buf, int32_t length); -void E_ConvertARTv1picanmToMemory(int32_t const picnum); -void E_ReadArtFileTileInfo(int32_t const fil, artheader_t const * const local); -void E_ReadArtFileIntoFakeData(int32_t const fil, artheader_t const * const local); -int32_t loadpics(const char *filename, int32_t askedsize); -void E_MapArt_Clear(void); -void E_MapArt_Setup(const char *filename); -void loadtile(int16_t tilenume); -void E_LoadTileIntoBuffer(int16_t tilenume, int32_t dasiz, char *buffer); -void E_RenderArtDataIntoBuffer(palette_t * pic, uint8_t const * buf, int32_t bufsizx, int32_t sizx, int32_t sizy); +void tileSetupDummy(int32_t const tile); +void tileSetData(int32_t const tile, int32_t tsiz, char const * const buffer); +void tileDelete(int32_t const tile); +void tileSetSize(int32_t picnum, int16_t dasizx, int16_t dasizy); +int32_t artReadHeader(int32_t const fil, char const * const fn, artheader_t * const local); +int32_t artReadHeaderFromBuffer(uint8_t const * const buf, artheader_t * const local); +int32_t artCheckUnitFileHeader(uint8_t const * const buf, int32_t length); +void tileConvertAnimFormat(int32_t const picnum); +void artReadManifest(int32_t const fil, artheader_t const * const local); +void artPreloadFile(int32_t const fil, artheader_t const * const local); +int32_t artLoadFiles(const char *filename, int32_t askedsize); +void artClearMapArt(void); +void artSetupMapArt(const char *filename); +bool tileLoad(int16_t tilenume); +void tileLoadData(int16_t tilenume, int32_t dasiz, char *buffer); +void artConvertRGB(palette_t * pic, uint8_t const * buf, int32_t bufsizx, int32_t sizx, int32_t sizy); int32_t qloadkvx(int32_t voxindex, const char *filename); void vox_undefine(int32_t const); -intptr_t allocatepermanenttile(int16_t tilenume, int32_t xsiz, int32_t ysiz); -void copytilepiece(int32_t tilenume1, int32_t sx1, int32_t sy1, int32_t xsiz, int32_t ysiz, int32_t tilenume2, int32_t sx2, int32_t sy2); +intptr_t tileCreate(int16_t tilenume, int32_t xsiz, int32_t ysiz); +void tileCopySection(int32_t tilenume1, int32_t sx1, int32_t sy1, int32_t xsiz, int32_t ysiz, int32_t tilenume2, int32_t sx2, int32_t sy2); void squarerotatetile(int16_t tilenume); int32_t videoSetGameMode(char davidoption, int32_t daxdim, int32_t daydim, int32_t dabpp); diff --git a/source/build/include/cache1d.h b/source/build/include/cache1d.h index d3995d8f0..f075d956c 100644 --- a/source/build/include/cache1d.h +++ b/source/build/include/cache1d.h @@ -18,9 +18,9 @@ extern int32_t kpzbufsiz; extern int32_t kpzbufloadfil(int32_t); extern int32_t kpzbufload(const char *); -void initcache(intptr_t dacachestart, int32_t dacachesize); -void allocache(intptr_t *newhandle, int32_t newbytes, char *newlockptr); -void agecache(void); +void cacheInitBuffer(intptr_t dacachestart, int32_t dacachesize); +void cacheAllocateBlock(intptr_t *newhandle, int32_t newbytes, char *newlockptr); +void cacheAgeEntries(void); extern int32_t pathsearchmode; // 0 = gamefs mode (default), 1 = localfs mode (editor's mode) char *listsearchpath(int32_t initp); diff --git a/source/build/src/2d.cpp b/source/build/src/2d.cpp index b0d14f2fa..294bca656 100644 --- a/source/build/src/2d.cpp +++ b/source/build/src/2d.cpp @@ -1044,7 +1044,7 @@ int32_t getspritecol(int32_t spr) if (tilecol) return palookup[pal][tilecol]; - if (!waloff[picnum]) loadtile(picnum); + if (!waloff[picnum]) tileLoad(picnum); if (!waloff[picnum]) return editorcolors[3]; // Calculate 2D mode tile color. diff --git a/source/build/src/baselayer.cpp b/source/build/src/baselayer.cpp index d5da2aa6f..115f232ca 100644 --- a/source/build/src/baselayer.cpp +++ b/source/build/src/baselayer.cpp @@ -466,7 +466,7 @@ int32_t baselayer_init(void) #endif }; - for (native_t i=0; i MAXCACHEOBJECTS)"); } -void allocache(intptr_t *newhandle, int32_t newbytes, char *newlockptr) +void cacheAllocateBlock(intptr_t *newhandle, int32_t newbytes, char *newlockptr) { if (EDUKE32_PREDICT_FALSE(*newlockptr == 0)) reportandexit("ALLOCACHE CALLED WITH LOCK OF 0!"); @@ -290,7 +290,7 @@ void allocache(intptr_t *newhandle, int32_t newbytes, char *newlockptr) } #endif -void agecache(void) +void cacheAgeEntries(void) { #ifndef DEBUG_ALLOCACHE_AS_MALLOC static int32_t agecount; diff --git a/source/build/src/defs.cpp b/source/build/src/defs.cpp index 91ce81316..04833d785 100644 --- a/source/build/src/defs.cpp +++ b/source/build/src/defs.cpp @@ -219,7 +219,7 @@ static void tile_from_truecolpic(int32_t tile, const palette_t *picptr, int32_t } } - E_CreateFakeTile(tile, tsiz, faketilebuffer); + tileSetData(tile, tsiz, faketilebuffer); } static int32_t Defs_LoadTileIntoBuffer(int32_t const tile) @@ -232,7 +232,7 @@ static int32_t Defs_LoadTileIntoBuffer(int32_t const tile) maybe_grow_buffer(&faketilebuffer, &faketilebuffersiz, tsiz); - E_LoadTileIntoBuffer(tile, tsiz, faketilebuffer); + tileLoadData(tile, tsiz, faketilebuffer); return tsiz; } @@ -258,32 +258,32 @@ static int32_t Defs_ImportTileFromTexture(char const * const fn, int32_t const t if (!picptr) { - int32_t const artstatus = E_CheckUnitArtFileHeader((uint8_t *)kpzbuf, length); + int32_t const artstatus = artCheckUnitFileHeader((uint8_t *)kpzbuf, length); if (artstatus < 0) return artstatus<<8; Bmemcpy(&picanm[tile], &kpzbuf[20], sizeof(picanm_t)); - E_ConvertARTv1picanmToMemory(tile); + tileConvertAnimFormat(tile); int32_t const xsiz = B_LITTLE16(B_UNBUF16(&kpzbuf[16])); int32_t const ysiz = B_LITTLE16(B_UNBUF16(&kpzbuf[18])); if (EDUKE32_PREDICT_FALSE(xsiz <= 0 || ysiz <= 0)) { - E_UndefineTile(tile); + tileDelete(tile); return 2; } - set_tilesiz(tile, xsiz, ysiz); + tileSetSize(tile, xsiz, ysiz); int32_t const dasiz = xsiz * ysiz; if (EDUKE32_PREDICT_FALSE(ARTv1_UNITOFFSET + dasiz > length)) { - E_CreateDummyTile(tile); + tileSetupDummy(tile); return 3; } - E_CreateFakeTile(tile, dasiz, &kpzbuf[ARTv1_UNITOFFSET]); + tileSetData(tile, dasiz, &kpzbuf[ARTv1_UNITOFFSET]); #ifdef USE_OPENGL if (istexture) @@ -299,7 +299,7 @@ static int32_t Defs_ImportTileFromTexture(char const * const fn, int32_t const t if (!(paletteloaded & PALETTE_MAIN)) return -3; - set_tilesiz(tile, xsiz, ysiz); + tileSetSize(tile, xsiz, ysiz); tile_from_truecolpic(tile, picptr, alphacut); @@ -679,7 +679,7 @@ static int32_t defsparser(scriptfile *script) break; artheader_t local; - int32_t headerval = E_ReadArtFileHeader(fil, fn, &local); + int32_t headerval = artReadHeader(fil, fn, &local); if (headerval != 0) { kclose(fil); @@ -695,8 +695,8 @@ static int32_t defsparser(scriptfile *script) } } - E_ReadArtFileTileInfo(fil, &local); - E_ReadArtFileIntoFakeData(fil, &local); + artReadManifest(fil, &local); + artPreloadFile(fil, &local); kclose(fil); } @@ -982,7 +982,7 @@ static int32_t defsparser(scriptfile *script) if (havetile) { - E_CreateFakeTile(tile, tsiz, faketilebuffer); + tileSetData(tile, tsiz, faketilebuffer); } else // if !havetile, we have never confirmed a valid source { @@ -992,11 +992,11 @@ static int32_t defsparser(scriptfile *script) if (tsiz <= 0) { - E_UndefineTile(tile); + tileDelete(tile); break; } - set_tilesiz(tile, tilesiz[source].x, tilesiz[source].y); + tileSetSize(tile, tilesiz[source].x, tilesiz[source].y); picanm[tile].xofs = havexoffset ? clamp(xoffset, -128, 127) : picanm[source].xofs; picanm[tile].yofs = haveyoffset ? clamp(yoffset, -128, 127) : picanm[source].yofs; picanm[tile].sf = (picanm[tile].sf & ~PICANM_MISC_MASK) | (picanm[source].sf & PICANM_MISC_MASK) | flags; @@ -1041,15 +1041,15 @@ static int32_t defsparser(scriptfile *script) if ((int16_t) xsiz == 0 || (int16_t) ysiz == 0) { - E_UndefineTile(tile); + tileDelete(tile); break; } if (xsiz > 0 && ysiz > 0) { - set_tilesiz(tile, xsiz, ysiz); + tileSetSize(tile, xsiz, ysiz); Bmemset(&picanm[tile], 0, sizeof(picanm_t)); - E_CreateDummyTile(tile); + tileSetupDummy(tile); } break; @@ -1072,15 +1072,15 @@ static int32_t defsparser(scriptfile *script) if ((int16_t) xsiz == 0 || (int16_t) ysiz == 0) { for (i=tile1; i<=tile2; i++) - E_UndefineTile(i); + tileDelete(i); break; } for (i=tile1; i<=tile2; i++) { - set_tilesiz(i, xsiz, ysiz); + tileSetSize(i, xsiz, ysiz); Bmemset(&picanm[i], 0, sizeof(picanm_t)); - E_CreateDummyTile(i); + tileSetupDummy(i); } break; @@ -1095,7 +1095,7 @@ static int32_t defsparser(scriptfile *script) if (check_tile("undefinetile", tile, script, cmdtokptr)) break; - E_UndefineTile(tile); + tileDelete(tile); break; } @@ -1110,7 +1110,7 @@ static int32_t defsparser(scriptfile *script) break; for (bssize_t i = tile1; i <= tile2; i++) - E_UndefineTile(i); + tileDelete(i); break; } @@ -2321,9 +2321,9 @@ static int32_t defsparser(scriptfile *script) if (xsiz > 0 && ysiz > 0) { - set_tilesiz(tile, xsiz, ysiz); + tileSetSize(tile, xsiz, ysiz); Bmemset(&picanm[tile], 0, sizeof(picanm_t)); - E_CreateDummyTile(tile); + tileSetupDummy(tile); } #ifdef USE_OPENGL xscale = 1.0f / xscale; diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index ce135cfac..d2933ac28 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -1911,7 +1911,7 @@ static void maskwallscan(int32_t x1, int32_t x2, int32_t saturatevplc) setgotpic(globalpicnum); - if (waloff[globalpicnum] == 0) loadtile(globalpicnum); + if (waloff[globalpicnum] == 0) tileLoad(globalpicnum); tweak_tsizes(&tsiz); @@ -2635,7 +2635,7 @@ static int32_t setup_globals_cf1(const usectortype *sec, int32_t pal, int32_t zd DO_TILE_ANIM(globalpicnum, 0); setgotpic(globalpicnum); if ((tilesiz[globalpicnum].x <= 0) || (tilesiz[globalpicnum].y <= 0)) return 1; - if (waloff[globalpicnum] == 0) loadtile(globalpicnum); + if (waloff[globalpicnum] == 0) tileLoad(globalpicnum); globalbufplc = waloff[globalpicnum]; @@ -2934,7 +2934,7 @@ static void wallscan(int32_t x1, int32_t x2, if ((uwal[x1] > ydimen) && (uwal[x2] > ydimen)) return; if ((dwal[x1] < 0) && (dwal[x2] < 0)) return; - if (waloff[globalpicnum] == 0) loadtile(globalpicnum); + if (waloff[globalpicnum] == 0) tileLoad(globalpicnum); tweak_tsizes(&tsiz); @@ -3155,7 +3155,7 @@ static void transmaskwallscan(int32_t x1, int32_t x2, int32_t saturatevplc) if ((tilesiz[globalpicnum].x <= 0) || (tilesiz[globalpicnum].y <= 0)) return; - if (waloff[globalpicnum] == 0) loadtile(globalpicnum); + if (waloff[globalpicnum] == 0) tileLoad(globalpicnum); setuptvlineasm(globalshiftval, saturatevplc); @@ -3429,7 +3429,7 @@ static void grouscan(int32_t dax1, int32_t dax2, int32_t sectnum, char dastat) DO_TILE_ANIM(globalpicnum, sectnum); setgotpic(globalpicnum); if ((tilesiz[globalpicnum].x <= 0) || (tilesiz[globalpicnum].y <= 0)) return; - if (waloff[globalpicnum] == 0) loadtile(globalpicnum); + if (waloff[globalpicnum] == 0) tileLoad(globalpicnum); wal = (uwalltype *)&wall[sec->wallptr]; wx = wall[wal->point2].x - wal->x; @@ -5584,7 +5584,7 @@ draw_as_face_sprite: globalpicnum = tilenum; if ((unsigned)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0; - if (waloff[globalpicnum] == 0) loadtile(globalpicnum); + if (waloff[globalpicnum] == 0) tileLoad(globalpicnum); setgotpic(globalpicnum); globalbufplc = waloff[globalpicnum]; @@ -6615,7 +6615,7 @@ static void dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t nextv = v; } - if (waloff[picnum] == 0) loadtile(picnum); + if (waloff[picnum] == 0) tileLoad(picnum); setgotpic(picnum); bufplc = waloff[picnum]; @@ -8768,7 +8768,7 @@ void drawmapview(int32_t dax, int32_t day, int32_t zoome, int16_t ang) DO_TILE_ANIM(globalpicnum, s); setgotpic(globalpicnum); if ((tilesiz[globalpicnum].x <= 0) || (tilesiz[globalpicnum].y <= 0)) continue; - if (waloff[globalpicnum] == 0) loadtile(globalpicnum); + if (waloff[globalpicnum] == 0) tileLoad(globalpicnum); globalbufplc = waloff[globalpicnum]; globalshade = max(min(sec->floorshade,numshades-1),0); globvis = globalhisibility; @@ -8893,7 +8893,7 @@ void drawmapview(int32_t dax, int32_t day, int32_t zoome, int16_t ang) DO_TILE_ANIM(globalpicnum, s); setgotpic(globalpicnum); if ((tilesiz[globalpicnum].x <= 0) || (tilesiz[globalpicnum].y <= 0)) continue; - if (waloff[globalpicnum] == 0) loadtile(globalpicnum); + if (waloff[globalpicnum] == 0) tileLoad(globalpicnum); globalbufplc = waloff[globalpicnum]; // 'loading' the tile doesn't actually guarantee that it's there afterwards. @@ -9337,7 +9337,7 @@ skip_reading_mapbin: system_getcvars(); // Per-map ART - E_MapArt_Setup(filename); + artSetupMapArt(filename); } // initprintf("Loaded map \"%s\" (md4sum: %08x%08x%08x%08x)\n", filename, B_BIG32(*((int32_t*)&md4out[0])), B_BIG32(*((int32_t*)&md4out[4])), B_BIG32(*((int32_t*)&md4out[8])), B_BIG32(*((int32_t*)&md4out[12]))); @@ -9982,7 +9982,7 @@ void videoNextPage(void) } faketimerhandler(); - agecache(); + cacheAgeEntries(); #ifdef USE_OPENGL omdtims = mdtims; @@ -10016,7 +10016,7 @@ int32_t qloadkvx(int32_t voxindex, const char *filename) //Must store filenames to use cacheing system :( voxlock[voxindex][i] = 200; - allocache(&voxoff[voxindex][i], dasiz, &voxlock[voxindex][i]); + cacheAllocateBlock(&voxoff[voxindex][i], dasiz, &voxlock[voxindex][i]); char *ptr = (char *) voxoff[voxindex][i]; kread(fil, ptr, dasiz); @@ -10903,7 +10903,7 @@ restart_grand: DO_TILE_ANIM(tilenum, 0); if (!waloff[tilenum]) - loadtile(tilenum); + tileLoad(tilenum); if (waloff[tilenum]) { diff --git a/source/build/src/mdsprite.cpp b/source/build/src/mdsprite.cpp index 46f697a77..4048f2668 100644 --- a/source/build/src/mdsprite.cpp +++ b/source/build/src/mdsprite.cpp @@ -740,7 +740,7 @@ int32_t mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t surf) if (tsiz.x == 0 || tsiz.y == 0) { - if (E_CheckUnitArtFileHeader((uint8_t *)kpzbuf, picfillen)) + if (artCheckUnitFileHeader((uint8_t *)kpzbuf, picfillen)) return mdloadskin_failed(skinfile, fn); tsiz.x = B_LITTLE16(B_UNBUF16(&kpzbuf[16])); @@ -782,7 +782,7 @@ int32_t mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t surf) { if (isart) { - E_RenderArtDataIntoBuffer((palette_t *)pic, (uint8_t *)&kpzbuf[ARTv1_UNITOFFSET], siz.x, tsiz.x, tsiz.y); + artConvertRGB((palette_t *)pic, (uint8_t *)&kpzbuf[ARTv1_UNITOFFSET], siz.x, tsiz.x, tsiz.y); } #ifdef WITHKPLIB else diff --git a/source/build/src/osd.cpp b/source/build/src/osd.cpp index 724be3903..1098cc171 100644 --- a/source/build/src/osd.cpp +++ b/source/build/src/osd.cpp @@ -1589,6 +1589,9 @@ static inline void OSD_LineFeed(void) void OSD_Puts(const char *tmpstr) { + if (!osd) + OSD_Init(); + if (tmpstr[0]==0) return; diff --git a/source/build/src/polymer.cpp b/source/build/src/polymer.cpp index f7f6a84e7..b70158fdb 100644 --- a/source/build/src/polymer.cpp +++ b/source/build/src/polymer.cpp @@ -1654,7 +1654,7 @@ int16_t polymer_addlight(_prlight* light) DO_TILE_ANIM(picnum, 0); if (!waloff[picnum]) - loadtile(picnum); + tileLoad(picnum); pth = NULL; pth = texcache_fetch(picnum, 0, 0, DAMETH_NOMASK); @@ -2690,7 +2690,7 @@ static int32_t polymer_updatesector(int16_t sectnum) } if (!waloff[curpicnum]) - loadtile(curpicnum); + tileLoad(curpicnum); if (((sec->floorstat & 64) || (sec->ceilingstat & 64)) && ((secangcos == 2) && (secangsin == 2))) @@ -4185,7 +4185,7 @@ static void polymer_drawartsky(int16_t tilenum, char palnum, int8_t shad DO_TILE_ANIM(picnum, 0); if (!waloff[picnum]) - loadtile(picnum); + tileLoad(picnum); pth = texcache_fetch(picnum, palnum, 0, DAMETH_NOMASK); glpics[i] = pth ? pth->glpic : 0; @@ -4929,7 +4929,7 @@ static _prbucket* polymer_getbuildmaterial(_prmaterial* material, int16_t tile polymer_getscratchmaterial(material); if (!waloff[tilenum]) - loadtile(tilenum); + tileLoad(tilenum); // PR_BIT_DIFFUSE_MAP pthtyp *pth = texcache_fetch(tilenum, pal, 0, cmeth); @@ -5773,7 +5773,7 @@ static void polymer_updatelights(void) DO_TILE_ANIM(picnum, 0); if (!waloff[picnum]) - loadtile(picnum); + tileLoad(picnum); pth = NULL; pth = texcache_fetch(picnum, 0, 0, DAMETH_NOMASK); diff --git a/source/build/src/polymost.cpp b/source/build/src/polymost.cpp index 3828ca4e9..512463cdf 100644 --- a/source/build/src/polymost.cpp +++ b/source/build/src/polymost.cpp @@ -2263,7 +2263,7 @@ int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp if (tsiz.x == 0 || tsiz.y == 0) { - if (E_CheckUnitArtFileHeader((uint8_t *)kpzbuf, picfillen)) + if (artCheckUnitFileHeader((uint8_t *)kpzbuf, picfillen)) return -1; tsiz.x = B_LITTLE16(B_UNBUF16(&kpzbuf[16])); @@ -2307,7 +2307,7 @@ int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp { if (isart) { - E_RenderArtDataIntoBuffer((palette_t *)pic, (uint8_t *)&kpzbuf[ARTv1_UNITOFFSET], siz.x, tsiz.x, tsiz.y); + artConvertRGB((palette_t *)pic, (uint8_t *)&kpzbuf[ARTv1_UNITOFFSET], siz.x, tsiz.x, tsiz.y); } #ifdef WITHKPLIB else @@ -2627,7 +2627,7 @@ static void polymost2_drawVBO(GLenum mode, setgotpic(globalpicnum); if (!waloff[globalpicnum]) { - loadtile(globalpicnum); + tileLoad(globalpicnum); } pthtyp *pth = our_texcache_fetch(dameth | (r_useindexedcolortextures ? PTH_INDEXED : 0)); @@ -2831,7 +2831,7 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32 if (!waloff[globalpicnum]) { - loadtile(globalpicnum); + tileLoad(globalpicnum); if (!waloff[globalpicnum]) { diff --git a/source/build/src/tiles.cpp b/source/build/src/tiles.cpp index 9b7afe797..aec3f09fb 100644 --- a/source/build/src/tiles.cpp +++ b/source/build/src/tiles.cpp @@ -37,20 +37,20 @@ static int32_t artfil = -1, artfilnum, artfilplc; ////////// Per-map ART file loading ////////// // Some forward declarations. -static void set_picsiz(int32_t picnum); -static const char *E_GetArtFileName(int32_t tilefilei); -static int32_t E_ReadArtFileOfID(int32_t tilefilei); +static void tileUpdatePicSiz(int32_t picnum); +static const char *artGetIndexedFileName(int32_t tilefilei); +static int32_t artReadIndexedFile(int32_t tilefilei); -static inline void clearmapartfilename(void) +static inline void artClearMapArtFilename(void) { Bmemset(mapartfilename, 0, sizeof(mapartfilename)); mapartfnXXofs = 0; } -static inline void E_RecalcPicSiz(void) +static inline void artUpdateManifest(void) { for (bssize_t i=0; i @@ -68,12 +68,12 @@ static inline void ALLOC_MAPART_ARRAY(origar_t & origar, bakar_t & bakar) Bmemcpy(bakar, origar, ARRAY_SIZE(origar) * sizeof(origar[0])); } -void E_MapArt_Clear(void) +void artClearMapArt(void) { if (g_bakTileFileNum == NULL) return; // per-map ART N/A - clearmapartfilename(); + artClearMapArtFilename(); if (artfilnum >= MAXARTFILES_BASE) { @@ -111,7 +111,7 @@ void E_MapArt_Clear(void) } DO_FREE_AND_NULL(g_bakFakeTileData); - E_RecalcPicSiz(); + artUpdateManifest(); #ifdef USE_OPENGL //POGOTODO: review this to ensure we're not invalidating more than we have to gltexinvalidatetype(INVALIDATE_ART); @@ -122,9 +122,9 @@ void E_MapArt_Clear(void) #endif } -void E_MapArt_Setup(const char *filename) +void artSetupMapArt(const char *filename) { - E_MapArt_Clear(); + artClearMapArt(); if (Bstrlen(filename) + 7 >= sizeof(mapartfilename)) return; @@ -134,11 +134,11 @@ void E_MapArt_Setup(const char *filename) mapartfnXXofs = Bstrlen(mapartfilename) - 6; // Check for first per-map ART file: if that one doesn't exist, don't load any. - int32_t fil = kopen4load(E_GetArtFileName(MAXARTFILES_BASE), 0); + int32_t fil = kopen4load(artGetIndexedFileName(MAXARTFILES_BASE), 0); if (fil == -1) { - clearmapartfilename(); + artClearMapArtFilename(); return; } @@ -154,7 +154,7 @@ void E_MapArt_Setup(const char *filename) for (bssize_t i=MAXARTFILES_BASE; i>3] |= pow2char[tile&7]; DO_FREE_AND_NULL(faketiledata[tile]); } -static void E_CreateFakeTileNonDestructive(int32_t const tile, int32_t tsiz, char const * const buffer) +static void tileSetDataSafe(int32_t const tile, int32_t tsiz, char const * const buffer) { int const compressed_tsiz = LZ4_compressBound(tsiz); char * newtile = (char *) Xmalloc(compressed_tsiz); @@ -206,7 +206,7 @@ static void E_CreateFakeTileNonDestructive(int32_t const tile, int32_t tsiz, cha } } -void E_CreateFakeTile(int32_t const tile, int32_t tsiz, char const * const buffer) +void tileSetData(int32_t const tile, int32_t tsiz, char const * const buffer) { int const compressed_tsiz = LZ4_compressBound(tsiz); faketiledata[tile] = (char *) Xrealloc(faketiledata[tile], compressed_tsiz); @@ -224,7 +224,7 @@ void E_CreateFakeTile(int32_t const tile, int32_t tsiz, char const * const buffe } } -static void E_UndefineTileNonDestructive(int32_t const tile) +static void tileSoftDelete(int32_t const tile) { tilesiz[tile].x = 0; tilesiz[tile].y = 0; @@ -239,9 +239,9 @@ static void E_UndefineTileNonDestructive(int32_t const tile) Bmemset(&picanm[tile], 0, sizeof(picanm_t)); } -void E_UndefineTile(int32_t const tile) +void tileDelete(int32_t const tile) { - E_UndefineTileNonDestructive(tile); + tileSoftDelete(tile); DO_FREE_AND_NULL(faketiledata[tile]); @@ -255,7 +255,7 @@ void E_UndefineTile(int32_t const tile) #endif } -static void set_picsiz(int32_t picnum) +static void tileUpdatePicSiz(int32_t picnum) { int j = 15; @@ -269,23 +269,15 @@ static void set_picsiz(int32_t picnum) picsiz[picnum] |= j<<4; } -void set_tilesiz(int32_t picnum, int16_t dasizx, int16_t dasizy) +void tileSetSize(int32_t picnum, int16_t dasizx, int16_t dasizy) { tilesiz[picnum].x = dasizx; tilesiz[picnum].y = dasizy; - set_picsiz(picnum); + tileUpdatePicSiz(picnum); } -int32_t tile_exists(int32_t picnum) -{ - if (waloff[picnum] == 0) - loadtile(picnum); - - return (waloff[picnum] != 0 && tilesiz[picnum].x > 0 && tilesiz[picnum].y > 0); -} - -int32_t E_ReadArtFileHeader(int32_t const fil, char const * const fn, artheader_t * const local) +int32_t artReadHeader(int32_t const fil, char const * const fn, artheader_t * const local) { int32_t artversion; kread(fil, &artversion, 4); artversion = B_LITTLE32(artversion); @@ -320,7 +312,7 @@ int32_t E_ReadArtFileHeader(int32_t const fil, char const * const fn, artheader_ return 0; } -int32_t E_ReadArtFileHeaderFromBuffer(uint8_t const * const buf, artheader_t * const local) +int32_t artReadHeaderFromBuffer(uint8_t const * const buf, artheader_t * const local) { int const artversion = B_LITTLE32(B_UNBUF32(&buf[0])); if (EDUKE32_PREDICT_FALSE(artversion != 1)) @@ -348,13 +340,13 @@ int32_t E_ReadArtFileHeaderFromBuffer(uint8_t const * const buf, artheader_t * c return 0; } -int32_t E_CheckUnitArtFileHeader(uint8_t const * const buf, int32_t length) +int32_t artCheckUnitFileHeader(uint8_t const * const buf, int32_t length) { if (EDUKE32_PREDICT_FALSE(length <= ARTv1_UNITOFFSET)) return -1; artheader_t local; - if (EDUKE32_PREDICT_FALSE(E_ReadArtFileHeaderFromBuffer(buf, &local) != 0)) + if (EDUKE32_PREDICT_FALSE(artReadHeaderFromBuffer(buf, &local) != 0)) return -2; if (EDUKE32_PREDICT_FALSE(local.numtiles != 1)) @@ -363,7 +355,7 @@ int32_t E_CheckUnitArtFileHeader(uint8_t const * const buf, int32_t length) return 0; } -void E_ConvertARTv1picanmToMemory(int32_t const picnum) +void tileConvertAnimFormat(int32_t const picnum) { EDUKE32_STATIC_ASSERT(sizeof(picanm_t) == 4); EDUKE32_STATIC_ASSERT(PICANM_ANIMTYPE_MASK == 192); @@ -379,7 +371,7 @@ void E_ConvertARTv1picanmToMemory(int32_t const picnum) thispicanm->sf &= ~PICANM_MISC_MASK; } -void E_ReadArtFileTileInfo(int32_t const fil, artheader_t const * const local) +void artReadManifest(int32_t const fil, artheader_t const * const local) { int16_t *tilesizx = (int16_t *) Xmalloc(local->numtiles * sizeof(int16_t)); int16_t *tilesizy = (int16_t *) Xmalloc(local->numtiles * sizeof(int16_t)); @@ -392,14 +384,14 @@ void E_ReadArtFileTileInfo(int32_t const fil, artheader_t const * const local) tilesiz[i].x = B_LITTLE16(tilesizx[i-local->tilestart]); tilesiz[i].y = B_LITTLE16(tilesizy[i-local->tilestart]); - E_ConvertARTv1picanmToMemory(i); + tileConvertAnimFormat(i); } DO_FREE_AND_NULL(tilesizx); DO_FREE_AND_NULL(tilesizy); } -void E_ReadArtFileIntoFakeData(int32_t const fil, artheader_t const * const local) +void artPreloadFile(int32_t const fil, artheader_t const * const local) { char *buffer = NULL; int32_t buffersize = 0; @@ -410,19 +402,19 @@ void E_ReadArtFileIntoFakeData(int32_t const fil, artheader_t const * const loca if (dasiz == 0) { - E_UndefineTile(i); + tileDelete(i); continue; } maybe_grow_buffer(&buffer, &buffersize, dasiz); kread(fil, buffer, dasiz); - E_CreateFakeTile(i, dasiz, buffer); + tileSetData(i, dasiz, buffer); } DO_FREE_AND_NULL(buffer); } -static void E_ReadArtFileIntoFakeDataNonDestructive(int32_t const fil, artheader_t const * const local) +static void artPreloadFileSafe(int32_t const fil, artheader_t const * const local) { char *buffer = NULL; int32_t buffersize = 0; @@ -433,19 +425,19 @@ static void E_ReadArtFileIntoFakeDataNonDestructive(int32_t const fil, artheader if (dasiz == 0) { - E_UndefineTileNonDestructive(i); + tileSoftDelete(i); continue; } maybe_grow_buffer(&buffer, &buffersize, dasiz); kread(fil, buffer, dasiz); - E_CreateFakeTileNonDestructive(i, dasiz, buffer); + tileSetDataSafe(i, dasiz, buffer); } DO_FREE_AND_NULL(buffer); } -static const char *E_GetArtFileName(int32_t tilefilei) +static const char *artGetIndexedFileName(int32_t tilefilei) { if (tilefilei >= MAXARTFILES_BASE) { @@ -472,16 +464,16 @@ static const char *E_GetArtFileName(int32_t tilefilei) // >0: error with the ART file // -1: ART file does not exist //<-1: per-map ART issue -static int32_t E_ReadArtFileOfID(int32_t tilefilei) +static int32_t artReadIndexedFile(int32_t tilefilei) { - const char *fn = E_GetArtFileName(tilefilei); + const char *fn = artGetIndexedFileName(tilefilei); const int32_t permap = (tilefilei >= MAXARTFILES_BASE); // is it a per-map ART file? int32_t fil; if ((fil = kopen4load(fn, 0)) != -1) { artheader_t local; - int const headerval = E_ReadArtFileHeader(fil, fn, &local); + int const headerval = artReadHeader(fil, fn, &local); if (headerval != 0) { kclose(fil); @@ -510,14 +502,14 @@ static int32_t E_ReadArtFileOfID(int32_t tilefilei) Bmemset(&walock[local.tilestart], 1, local.numtiles*sizeof(walock[0])); } - E_ReadArtFileTileInfo(fil, &local); + artReadManifest(fil, &local); if (cache1d_file_fromzip(fil)) { if (permap) - E_ReadArtFileIntoFakeDataNonDestructive(fil, &local); + artPreloadFileSafe(fil, &local); else - E_ReadArtFileIntoFakeData(fil, &local); + artPreloadFile(fil, &local); } else { @@ -549,7 +541,7 @@ static int32_t E_ReadArtFileOfID(int32_t tilefilei) // // loadpics // -int32_t loadpics(const char *filename, int32_t askedsize) +int32_t artLoadFiles(const char *filename, int32_t askedsize) { Bstrncpyz(artfilename, filename, sizeof(artfilename)); @@ -559,18 +551,16 @@ int32_t loadpics(const char *filename, int32_t askedsize) // artsize = 0; for (bssize_t tilefilei=0; tilefilei= (unsigned) MAXTILES) return; - int const dasiz = tilesiz[tilenume].x*tilesiz[tilenume].y; - if (dasiz <= 0) return; + if ((unsigned) tileNum >= (unsigned) MAXTILES) return 0; + int const dasiz = tilesiz[tileNum].x*tilesiz[tileNum].y; + if (dasiz <= 0) return 0; // Allocate storage if necessary. - if (waloff[tilenume] == 0) + if (waloff[tileNum] == 0) { - walock[tilenume] = 199; - allocache(&waloff[tilenume], dasiz, &walock[tilenume]); + walock[tileNum] = 199; + cacheAllocateBlock(&waloff[tileNum], dasiz, &walock[tileNum]); } - E_LoadTileIntoBuffer(tilenume, dasiz, (char *) waloff[tilenume]); + tileLoadData(tileNum, dasiz, (char *) waloff[tileNum]); #ifdef USE_OPENGL if (videoGetRenderMode() >= REND_POLYMOST) @@ -607,15 +597,17 @@ void loadtile(int16_t tilenume) int type; for (type = 0; type <= 1; ++type) { - texcache_fetch(tilenume, 0, 0, (type ? DAMETH_CLAMPED : DAMETH_MASK) | PTH_INDEXED); + texcache_fetch(tileNum, 0, 0, (type ? DAMETH_CLAMPED : DAMETH_MASK) | PTH_INDEXED); } } #endif - postloadtile(tilenume); + tilePostLoad(tileNum); + + return (waloff[tileNum] != 0 && tilesiz[tileNum].x > 0 && tilesiz[tileNum].y > 0); } -void E_LoadTileIntoBuffer(int16_t tilenume, int32_t dasiz, char *buffer) +void tileLoadData(int16_t tilenume, int32_t dasiz, char *buffer) { // dummy tiles for highres replacements and tilefromtexture definitions @@ -636,7 +628,7 @@ void E_LoadTileIntoBuffer(int16_t tilenume, int32_t dasiz, char *buffer) if (artfil != -1) kclose(artfil); - char const *fn = E_GetArtFileName(tfn); + char const *fn = artGetIndexedFileName(tfn); artfil = kopen4load(fn, 0); @@ -665,7 +657,7 @@ void E_LoadTileIntoBuffer(int16_t tilenume, int32_t dasiz, char *buffer) artfilplc = tilefileoffs[tilenume]+dasiz; } -static void postloadtile(int16_t tilenume) +static void tilePostLoad(int16_t tilenume) { #if !defined DEBUG_TILESIZY_512 && !defined DEBUG_TILEOFFSETS UNREFERENCED_PARAMETER(tilenume); @@ -700,7 +692,7 @@ static void postloadtile(int16_t tilenume) } // Assumes pic has been initialized to zero. -void E_RenderArtDataIntoBuffer(palette_t * const pic, uint8_t const * const buf, int32_t const bufsizx, int32_t const sizx, int32_t const sizy) +void artConvertRGB(palette_t * const pic, uint8_t const * const buf, int32_t const bufsizx, int32_t const sizx, int32_t const sizy) { for (bssize_t y = 0; y < sizy; ++y) { @@ -727,7 +719,7 @@ void E_RenderArtDataIntoBuffer(palette_t * const pic, uint8_t const * const buf, // // allocatepermanenttile // -intptr_t allocatepermanenttile(int16_t tilenume, int32_t xsiz, int32_t ysiz) +intptr_t tileCreate(int16_t tilenume, int32_t xsiz, int32_t ysiz) { if (xsiz <= 0 || ysiz <= 0 || (unsigned) tilenume >= MAXTILES) return 0; @@ -735,9 +727,9 @@ intptr_t allocatepermanenttile(int16_t tilenume, int32_t xsiz, int32_t ysiz) int const dasiz = xsiz*ysiz; walock[tilenume] = 255; - allocache(&waloff[tilenume], dasiz, &walock[tilenume]); + cacheAllocateBlock(&waloff[tilenume], dasiz, &walock[tilenume]); - set_tilesiz(tilenume, xsiz, ysiz); + tileSetSize(tilenume, xsiz, ysiz); Bmemset(&picanm[tilenume], 0, sizeof(picanm_t)); return waloff[tilenume]; @@ -746,7 +738,7 @@ intptr_t allocatepermanenttile(int16_t tilenume, int32_t xsiz, int32_t ysiz) // // copytilepiece // -void copytilepiece(int32_t tilenume1, int32_t sx1, int32_t sy1, int32_t xsiz, int32_t ysiz, +void tileCopySection(int32_t tilenume1, int32_t sx1, int32_t sy1, int32_t xsiz, int32_t ysiz, int32_t tilenume2, int32_t sx2, int32_t sy2) { char *ptr1, *ptr2, dat; @@ -756,8 +748,8 @@ void copytilepiece(int32_t tilenume1, int32_t sx1, int32_t sy1, int32_t xsiz, in xsiz2 = tilesiz[tilenume2].x; ysiz2 = tilesiz[tilenume2].y; if ((xsiz1 > 0) && (ysiz1 > 0) && (xsiz2 > 0) && (ysiz2 > 0)) { - if (waloff[tilenume1] == 0) loadtile(tilenume1); - if (waloff[tilenume2] == 0) loadtile(tilenume2); + if (waloff[tilenume1] == 0) tileLoad(tilenume1); + if (waloff[tilenume2] == 0) tileLoad(tilenume2); x1 = sx1; for (i=0; ianimlock = 1; if (!anim->animbuf) - allocache((intptr_t *)&anim->animbuf, length + 1, &anim->animlock); + cacheAllocateBlock((intptr_t *)&anim->animbuf, length + 1, &anim->animlock); tilesiz[TILE_ANIM].x = 200; tilesiz[TILE_ANIM].y = 320; diff --git a/source/duke3d/src/astub.cpp b/source/duke3d/src/astub.cpp index ca97167d4..ba3120604 100644 --- a/source/duke3d/src/astub.cpp +++ b/source/duke3d/src/astub.cpp @@ -3341,7 +3341,7 @@ static const char *GetTilePixels(int32_t idTile) if (idTile >= 0 && idTile < MAXTILES) { if (!waloff[idTile]) - loadtile(idTile); + tileLoad(idTile); if (IsValidTile(idTile)) pPixelData = (char *)waloff[idTile]; @@ -5775,7 +5775,7 @@ static void Keys3d(void) getnumberptr256(tempbuf, picnumptr, sizeof(int16_t), MAXTILES-1, 0+2, NULL); Bassert((unsigned)*picnumptr < MAXTILES); - if (!tile_exists(*picnumptr)) + if (!tileLoad(*picnumptr)) *picnumptr = opicnum; if (*picnumptr != opicnum) diff --git a/source/duke3d/src/game.cpp b/source/duke3d/src/game.cpp index 0bf71a7d3..d3a8ed84c 100644 --- a/source/duke3d/src/game.cpp +++ b/source/duke3d/src/game.cpp @@ -792,7 +792,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio) { walock[TILE_SAVESHOT] = 199; if (waloff[TILE_SAVESHOT] == 0) - allocache(&waloff[TILE_SAVESHOT],200*320,&walock[TILE_SAVESHOT]); + cacheAllocateBlock(&waloff[TILE_SAVESHOT],200*320,&walock[TILE_SAVESHOT]); if (videoGetRenderMode() == REND_CLASSIC) videoSetTarget(TILE_SAVESHOT, 200, 320); @@ -852,7 +852,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio) walock[TILE_TILT] = 255; if (waloff[TILE_TILT] == 0) - allocache(&waloff[TILE_TILT], maxTiltSize, &walock[TILE_TILT]); + cacheAllocateBlock(&waloff[TILE_TILT], maxTiltSize, &walock[TILE_TILT]); videoSetTarget(TILE_TILT, viewtilexsiz, viewtileysiz); @@ -5974,10 +5974,10 @@ static void G_Startup(void) if (g_modDir[0] != '/' && (cwd = getcwd(NULL, 0))) { Bchdir(g_modDir); - if (loadpics("tiles000.art",MAXCACHE1DSIZE) < 0) + if (artLoadFiles("tiles000.art",MAXCACHE1DSIZE) < 0) { Bchdir(cwd); - if (loadpics("tiles000.art",MAXCACHE1DSIZE) < 0) + if (artLoadFiles("tiles000.art",MAXCACHE1DSIZE) < 0) G_GameExit("Failed loading art."); } Bchdir(cwd); @@ -5986,7 +5986,7 @@ static void G_Startup(void) #endif } - else if (loadpics("tiles000.art",MAXCACHE1DSIZE) < 0) + else if (artLoadFiles("tiles000.art",MAXCACHE1DSIZE) < 0) G_GameExit("Failed loading art."); } @@ -6074,7 +6074,7 @@ static int G_EndOfLevel(void) } // Clear potentially loaded per-map ART only after the bonus screens. - E_MapArt_Clear(); + artClearMapArt(); if (ud.eog) { @@ -6459,7 +6459,7 @@ int app_main(int argc, char const * const * argv) G_PostLoadPalette(); - E_UndefineTile(MIRROR); + tileDelete(MIRROR); Gv_ResetSystemDefaults(); // called here to populate our fake tilesizx and tilesizy arrays presented to CON with sizes generated by dummytiles @@ -6591,8 +6591,9 @@ int app_main(int argc, char const * const * argv) // check if the minifont will support lowercase letters (3136-3161) // there is room for them in tiles012.art between "[\]^_." and "{|}~" minitext_lowercase = 1; + for (bssize_t i = MINIFONT + ('a'-'!'); minitext_lowercase && i < MINIFONT + ('z'-'!') + 1; ++i) - minitext_lowercase &= tile_exists(i); + minitext_lowercase &= tileLoad(i); if (g_networkMode != NET_DEDICATED_SERVER) { diff --git a/source/duke3d/src/menus.cpp b/source/duke3d/src/menus.cpp index 21267dd55..dc7dc71ec 100644 --- a/source/duke3d/src/menus.cpp +++ b/source/duke3d/src/menus.cpp @@ -3576,7 +3576,7 @@ static void Menu_Verify(int32_t input) g_player[myconnectindex].ps->gm = MODE_DEMO; if (ud.recstat == 1) G_CloseDemoWrite(); - E_MapArt_Clear(); + artClearMapArt(); } break; diff --git a/source/duke3d/src/premap.cpp b/source/duke3d/src/premap.cpp index eee4ea096..1ec4dd9ed 100644 --- a/source/duke3d/src/premap.cpp +++ b/source/duke3d/src/premap.cpp @@ -430,7 +430,7 @@ void G_CacheMapData(void) if (gotpic[i>>3] & pow2char[i&7]) { if (waloff[i] == 0) - loadtile((int16_t)i); + tileLoad((int16_t)i); #ifdef USE_OPENGL // PRECACHE diff --git a/source/duke3d/src/rts.cpp b/source/duke3d/src/rts.cpp index c05e80842..2c6c07d36 100644 --- a/source/duke3d/src/rts.cpp +++ b/source/duke3d/src/rts.cpp @@ -155,7 +155,7 @@ void *RTS_GetSound(int32_t lump) if (rts_lumpcache[lump] == NULL) { rts_lumplockbyte[lump] = 200; - allocache((intptr_t *)&rts_lumpcache[lump], RTS_SoundLength(lump-1), &rts_lumplockbyte[lump]); // JBF 20030910: char * => int32_t * + cacheAllocateBlock((intptr_t *)&rts_lumpcache[lump], RTS_SoundLength(lump-1), &rts_lumplockbyte[lump]); // JBF 20030910: char * => int32_t * RTS_ReadLump(lump, rts_lumpcache[lump]); } else diff --git a/source/duke3d/src/savegame.cpp b/source/duke3d/src/savegame.cpp index bbe88c8b3..28100cdba 100644 --- a/source/duke3d/src/savegame.cpp +++ b/source/duke3d/src/savegame.cpp @@ -294,7 +294,7 @@ int32_t G_LoadSaveHeaderNew(char const *fn, savehead_t *saveh) walock[TILE_LOADSHOT] = 255; if (waloff[TILE_LOADSHOT] == 0) - allocache(&waloff[TILE_LOADSHOT], 320*200, &walock[TILE_LOADSHOT]); + cacheAllocateBlock(&waloff[TILE_LOADSHOT], 320*200, &walock[TILE_LOADSHOT]); tilesiz[TILE_LOADSHOT].x = 200; tilesiz[TILE_LOADSHOT].y = 320; if (screenshotofs) @@ -390,7 +390,7 @@ int32_t G_LoadPlayer(savebrief_t & sv) if (currentboardfilename[0]) { - E_MapArt_Setup(currentboardfilename); + artSetupMapArt(currentboardfilename); append_ext_UNSAFE(currentboardfilename, ".mhk"); loadmaphack(currentboardfilename); } diff --git a/source/duke3d/src/screens.cpp b/source/duke3d/src/screens.cpp index 35840b2f7..094d725e7 100644 --- a/source/duke3d/src/screens.cpp +++ b/source/duke3d/src/screens.cpp @@ -106,7 +106,7 @@ void G_GetCrosshairColor(void) if (waloff[CROSSHAIR] == 0) { - loadtile(CROSSHAIR); + tileLoad(CROSSHAIR); ptr = (char const *) waloff[CROSSHAIR]; } @@ -150,7 +150,7 @@ void G_SetCrosshairColor(int32_t r, int32_t g, int32_t b) if (waloff[CROSSHAIR] == 0) { - loadtile(CROSSHAIR); + tileLoad(CROSSHAIR); ptr = (char *) waloff[CROSSHAIR]; } diff --git a/source/duke3d/src/sector.cpp b/source/duke3d/src/sector.cpp index 2121a8634..6bbfce2cd 100644 --- a/source/duke3d/src/sector.cpp +++ b/source/duke3d/src/sector.cpp @@ -420,7 +420,7 @@ void G_AnimateCamSprite(int smoothRatio) int const viewscrTile = TILE_VIEWSCR - viewscrShift; if (waloff[viewscrTile] == 0) - allocatepermanenttile(viewscrTile, tilesiz[PN(spriteNum)].x << viewscrShift, tilesiz[PN(spriteNum)].y << viewscrShift); + tileCreate(viewscrTile, tilesiz[PN(spriteNum)].x << viewscrShift, tilesiz[PN(spriteNum)].y << viewscrShift); else walock[viewscrTile] = 255; diff --git a/source/duke3d/src/sounds.cpp b/source/duke3d/src/sounds.cpp index 960960f62..7ec9e171d 100644 --- a/source/duke3d/src/sounds.cpp +++ b/source/duke3d/src/sounds.cpp @@ -465,7 +465,7 @@ int32_t S_LoadSound(uint32_t num) int32_t l = kfilelength(fp); g_soundlocks[num] = 200; g_sounds[num].soundsiz = l; - allocache((intptr_t *)&g_sounds[num].ptr, l, (char *)&g_soundlocks[num]); + cacheAllocateBlock((intptr_t *)&g_sounds[num].ptr, l, (char *)&g_soundlocks[num]); l = kread(fp, g_sounds[num].ptr, l); kclose(fp); diff --git a/source/duke3d/src/sounds_mapster32.cpp b/source/duke3d/src/sounds_mapster32.cpp index f2d7f192b..c412186a1 100644 --- a/source/duke3d/src/sounds_mapster32.cpp +++ b/source/duke3d/src/sounds_mapster32.cpp @@ -140,7 +140,7 @@ int32_t S_LoadSound(uint32_t num) g_sounds[num].lock = 200; - allocache((intptr_t *)&g_sounds[num].ptr,l,(char *)&g_sounds[num].lock); + cacheAllocateBlock((intptr_t *)&g_sounds[num].ptr,l,(char *)&g_sounds[num].lock); kread(fp, g_sounds[num].ptr , l); kclose(fp); return 1;