diff --git a/source/games/duke/src/premap_d.cpp b/source/games/duke/src/premap_d.cpp index 9cf927c1e..0373407c0 100644 --- a/source/games/duke/src/premap_d.cpp +++ b/source/games/duke/src/premap_d.cpp @@ -40,6 +40,7 @@ BEGIN_DUKE_NS inline void tloadtile(int tilenum, int palnum = 0) { + assert(tilenum < MAXTILES); markTileForPrecache(tilenum, palnum); } diff --git a/source/glbackend/glbackend.cpp b/source/glbackend/glbackend.cpp index f8a0534b1..9b5ad1254 100644 --- a/source/glbackend/glbackend.cpp +++ b/source/glbackend/glbackend.cpp @@ -482,7 +482,7 @@ void markTileForPrecache(int tilenum, int palnum) for (; i <= j; i++) { - int64_t val = i + (int64_t(palnum) << 16); + int64_t val = i + (int64_t(palnum) << 32); cachemap.Insert(val, true); } } @@ -495,7 +495,7 @@ void precacheMarkedTiles() decltype(cachemap)::Pair* pair; while (it.NextPair(pair)) { - int dapicnum = pair->Key; + int dapicnum = pair->Key & 0x7fffffff; int dapalnum = pair->Key >> 32; polymost_precache(dapicnum, dapalnum, 0); }