From 1993642ce82dd9bac45950b681ed9233e939efeb Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 22 Jun 2020 01:07:19 +0200 Subject: [PATCH] - fixed precacher. --- source/games/duke/src/premap_d.cpp | 1 + source/glbackend/glbackend.cpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) 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); }