diff --git a/source/blood/src/gameutil.cpp b/source/blood/src/gameutil.cpp index 9d125fbfa..b80068090 100644 --- a/source/blood/src/gameutil.cpp +++ b/source/blood/src/gameutil.cpp @@ -497,7 +497,7 @@ int VectorScan(spritetype *pSprite, int nOffset, int nZOffset, int dx, int dy, i width2 += nOffset + tileWidth(nPicnum) / 2; if (width2 >= 0 && width2 < tileWidth(nPicnum)) { - auto pData = tileLoadTile(nPicnum); + auto pData = tilePtr(nPicnum); if (pData[width2*tileHeight(nPicnum)+height2] != TRANSPARENT_INDEX) return 3; } @@ -569,7 +569,7 @@ int VectorScan(spritetype *pSprite, int nOffset, int nZOffset, int dx, int dy, i nHOffset = pWall->xpanning + ((nHOffset*pWall->xrepeat) << 3) / nLength; nHOffset %= nSizX; nOffset %= nSizY; - auto pData = tileLoadTile(nPicnum); + auto pData = tilePtr(nPicnum); int nPixel; nPixel = nHOffset*nSizY + nOffset; diff --git a/source/blood/src/misc.h b/source/blood/src/misc.h index e0231ea72..222ff34bf 100644 --- a/source/blood/src/misc.h +++ b/source/blood/src/misc.h @@ -125,9 +125,8 @@ extern char precachehightile[2][(MAXTILES+7)>>3]; int tileInit(char a1, const char *a2); void tileProcessGLVoxels(void); -const uint8_t * tileLoadTile(int nTile); -uint8_t * tileAllocTile(int nTile, int x, int y); void tilePreloadTile(int nTile); + void tilePrecacheTile(int nTile, int nType = 1); char tileGetSurfType(int hit); diff --git a/source/blood/src/preload.cpp b/source/blood/src/preload.cpp index 9b71efb5b..216ab6e83 100644 --- a/source/blood/src/preload.cpp +++ b/source/blood/src/preload.cpp @@ -270,6 +270,7 @@ void PreloadTiles(void) void PreloadCache(void) { + if (!r_precache) return; PreloadTiles(); int cnt = 0; int percentDisplayed = -1; @@ -278,7 +279,7 @@ void PreloadCache(void) { if (TestBitString(gotpic, i)) { - if (r_precache) PrecacheHardwareTextures(i); + PrecacheHardwareTextures(i); if ((++cnt & 7) == 0) I_GetEvent(); diff --git a/source/blood/src/tile.cpp b/source/blood/src/tile.cpp index 6f7acb0e4..cd08a5324 100644 --- a/source/blood/src/tile.cpp +++ b/source/blood/src/tile.cpp @@ -112,22 +112,9 @@ void tileProcessGLVoxels(void) } #endif -const uint8_t * tileLoadTile(int nTile) -{ - tileLoad(nTile); - return (const uint8_t*)tilePtr(nTile); -} - -uint8_t * tileAllocTile(int nTile, int x, int y) -{ - dassert(nTile >= 0 && nTile < kMaxTiles); - uint8_t *p = TileFiles.tileCreate(nTile, x, y); - dassert(p != NULL); - return p; -} - void tilePreloadTile(int nTile) { + if (!r_precache) return; int n = 1; switch (picanm[nTile].extra&7) { @@ -152,6 +139,7 @@ void tilePreloadTile(int nTile) } break; } + while(n--) { if (picanm[nTile].sf&PICANM_ANIMTYPE_MASK) @@ -159,13 +147,13 @@ void tilePreloadTile(int nTile) for (int frame = picanm[nTile].num; frame >= 0; frame--) { if ((picanm[nTile].sf&PICANM_ANIMTYPE_MASK) == PICANM_ANIMTYPE_BACK) - tileLoadTile(nTile-frame); + PrecacheHardwareTextures(nTile-frame); else - tileLoadTile(nTile+frame); + PrecacheHardwareTextures(nTile+frame); } } else - tileLoadTile(nTile); + PrecacheHardwareTextures(nTile); nTile += 1+picanm[nTile].num; } } diff --git a/source/blood/src/view.cpp b/source/blood/src/view.cpp index 2d5127946..1c849d712 100644 --- a/source/blood/src/view.cpp +++ b/source/blood/src/view.cpp @@ -220,7 +220,7 @@ void viewDrawText(int nFont, const char *pString, int x, int y, int nShade, int void InitStatusBar(void) { - tileLoadTile(2200); + if (r_precache) PrecacheHardwareTextures(2200); } GameStats GameInterface::getStats() { @@ -290,7 +290,7 @@ void viewInit(void) lensTable[i] = LittleLong(lensTable[i]); } #endif - uint8_t *data = tileAllocTile(4077, kLensSize, kLensSize); + uint8_t *data = TileFiles.tileCreate(4077, kLensSize, kLensSize); memset(data, TRANSPARENT_INDEX, kLensSize*kLensSize); for (int i = 0; i < 16; i++) @@ -773,7 +773,7 @@ void viewDrawScreen(bool sceneonly) //othercameraclock = gGameClock; if (!tileData(4079)) { - tileAllocTile(4079, 128, 128); + TileFiles.tileCreate(4079, 128, 128); } r enderSetTarget(4079, 128, 128); renderSetAspect(65536, 78643); diff --git a/source/blood/src/weapon.cpp b/source/blood/src/weapon.cpp index 27320a306..2ae28ade0 100644 --- a/source/blood/src/weapon.cpp +++ b/source/blood/src/weapon.cpp @@ -1761,7 +1761,7 @@ char WeaponFindLoaded(PLAYER *pPlayer, int *a2) return v4; } -char sub_4F0E0(PLAYER *pPlayer) +int sub_4F0E0(PLAYER *pPlayer) { switch (pPlayer->weaponState) {