diff --git a/source/build/include/polymost.h b/source/build/include/polymost.h index e32c0d24e..9132d9bbb 100644 --- a/source/build/include/polymost.h +++ b/source/build/include/polymost.h @@ -35,7 +35,7 @@ void polymost_outputGLDebugMessage(uint8_t severity, const char* format, ...); //void phex(char v, char *s); void uploadtexture(FHardwareTexture *tex, int32_t doalloc, vec2_t siz, int32_t texfmt, coltype *pic, vec2_t tsiz, int32_t dameth); void uploadbasepalette(int32_t basepalnum, bool transient = false); -void uploadpalswap(int32_t palookupnum); +void uploadpalswaps(int count, int32_t *palookupnum); void polymost_drawsprite(int32_t snum); void polymost_drawmaskwall(int32_t damaskwallcnt); void polymost_dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum, diff --git a/source/build/src/polymost.cpp b/source/build/src/polymost.cpp index 9039dfd58..08a68d16c 100644 --- a/source/build/src/polymost.cpp +++ b/source/build/src/polymost.cpp @@ -366,6 +366,7 @@ static void polymost_bindPth(pthtyp const* const pPth, int sampler) FileReader GetBaseResource(const char* fn); +void uploadpalswap(int32_t palookupnum); // one-time initialization of OpenGL for polymost void polymost_glinit() @@ -714,6 +715,15 @@ void uploadbasepalette(int32_t basepalnum, bool transient) // transient palettes paletteTextureIDs[basepalnum]->LoadTexture(basepalWFullBrightInfo); // RGBA } +// Used by RRRA fog hackery - the only place changing the palswaps at run time. +void uploadpalswaps(int count, int32_t* swaps) +{ + for (int i = 0; i < count; i++) + { + uploadpalswap(i); + } +} + void uploadpalswap(int32_t palookupnum) { if (!palookup[palookupnum]) diff --git a/source/rr/src/premap.cpp b/source/rr/src/premap.cpp index 1884ef7e7..347087e96 100644 --- a/source/rr/src/premap.cpp +++ b/source/rr/src/premap.cpp @@ -2688,12 +2688,9 @@ void G_SetFog(int fogtype) fogtable[i].b = palookupfog[i].b * (1.f/255.f); fogtable[i].a = 0; } - gltexinvalidatetype(INVALIDATE_ALL_NON_INDEXED); - uploadpalswap(0); - uploadpalswap(30); - uploadpalswap(33); - uploadpalswap(23); - uploadpalswap(8); + //gltexinvalidatetype(INVALIDATE_ALL_NON_INDEXED); + static int swaps[] = { 0, 30, 33, 23, 8 }; + uploadpalswaps(5, swaps); } #endif }