From 156a225ff4c5392261aae8e8ea661ab92de4b842 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 12 Apr 2020 07:48:23 +0200 Subject: [PATCH] - renamed global palookup variable. Since the same word gets used in text messages and local variables in the game code it is easier this way to search for it and facilitate its transition to the translation table management in PaletteContainer. --- source/blood/src/screen.cpp | 4 +-- source/build/include/build.h | 2 +- source/build/src/defs.cpp | 4 +-- source/build/src/palette.cpp | 54 ++++++++++++++--------------- source/build/src/polymost.cpp | 8 ++--- source/core/textures/buildtiles.cpp | 6 ++-- source/exhumed/src/light.cpp | 4 +-- source/rr/src/common.cpp | 2 +- source/sw/src/game.cpp | 10 ------ 9 files changed, 42 insertions(+), 52 deletions(-) diff --git a/source/blood/src/screen.cpp b/source/blood/src/screen.cpp index 8e0b70238..427485cd9 100644 --- a/source/blood/src/screen.cpp +++ b/source/blood/src/screen.cpp @@ -80,7 +80,7 @@ void scrLoadPLUs(void) ThrowError("%s.PLU not found", PLU[i].name); if (pPlu->Size() / 256 != 64) ThrowError("Incorrect PLU size"); - palookup[PLU[i].id] = (char*)gSysRes.Lock(pPlu); + lookuptables[PLU[i].id] = (char*)gSysRes.Lock(pPlu); } // by NoOne: load user palookups @@ -88,7 +88,7 @@ void scrLoadPLUs(void) DICTNODE* pPlu = gSysRes.Lookup(i, "PLU"); if (!pPlu) continue; else if (pPlu->Size() / 256 != 64) { consoleSysMsg("Incorrect filesize of PLU#%d", i); } - else palookup[i] = (char*)gSysRes.Lock(pPlu); + else lookuptables[i] = (char*)gSysRes.Lock(pPlu); } #ifdef USE_OPENGL diff --git a/source/build/include/build.h b/source/build/include/build.h index 685ea0eb7..98b7059cf 100644 --- a/source/build/include/build.h +++ b/source/build/include/build.h @@ -541,7 +541,7 @@ EXTERN int16_t sintable[2048]; EXTERN uint8_t palette[768]; EXTERN int16_t numshades; -EXTERN char *palookup[MAXPALOOKUPS]; +EXTERN char *lookuptables[MAXPALOOKUPS]; extern uint8_t *basepaltable[MAXBASEPALS]; EXTERN uint8_t paletteloaded; EXTERN uint8_t whitecol, redcol, blackcol; diff --git a/source/build/src/defs.cpp b/source/build/src/defs.cpp index 4727657f6..316493de9 100644 --- a/source/build/src/defs.cpp +++ b/source/build/src/defs.cpp @@ -2039,7 +2039,7 @@ static int32_t defsparser(scriptfile *script) // NOTE: all palookups are initialized, i.e. non-NULL! // NOTE2: aliasing (pal==remappal) is OK - paletteMakeLookupTable(pal, palookup[remappal], red<<2, green<<2, blue<<2, + paletteMakeLookupTable(pal, lookuptables[remappal], red<<2, green<<2, blue<<2, remappal==0 ? 1 : (nofloorpal == -1 ? g_noFloorPal[remappal] : nofloorpal)); } break; @@ -2861,7 +2861,7 @@ static int32_t defsparser(scriptfile *script) break; } - uint8_t const * const sourcepal = (uint8_t *)palookup[source]; + uint8_t const * const sourcepal = (uint8_t *)lookuptables[source]; if (EDUKE32_PREDICT_FALSE(sourcepal == NULL)) { Printf("Error: palookup: Source palookup does not exist on line %s:%d\n", diff --git a/source/build/src/palette.cpp b/source/build/src/palette.cpp index 6e99b5fd8..0ec63cab9 100644 --- a/source/build/src/palette.cpp +++ b/source/build/src/palette.cpp @@ -71,10 +71,10 @@ void fullscreen_tint_gl(PalEntry pe); static void alloc_palookup(int32_t pal) { // The asm functions vlineasm1, mvlineasm1 (maybe others?) access the next - // palookup[...] shade entry for tilesizy==512 tiles. + // lookuptables[...] shade entry for tilesizy==512 tiles. // See DEBUG_TILESIZY_512 and the comment in a.nasm: vlineasm1. - palookup[pal] = (char *) Xaligned_alloc(16, (numshades + 1) * 256); - memset(palookup[pal], 0, (numshades + 1) * 256); + lookuptables[pal] = (char *) Xaligned_alloc(16, (numshades + 1) * 256); + memset(lookuptables[pal], 0, (numshades + 1) * 256); } static void maybe_alloc_palookup(int32_t palnum); @@ -165,9 +165,9 @@ void paletteLoadFromDisk(void) } } - // Read base shade table (palookup 0). + // Read base shade table (lookuptables 0). maybe_alloc_palookup(0); - if (read_and_test(fil, palookup[0], numshades<<8)) + if (read_and_test(fil, lookuptables[0], numshades<<8)) return; paletteloaded |= PALETTE_SHADE; @@ -227,7 +227,7 @@ void palettePostLoadTables(void) { globalpal = 0; - char const * const palookup0 = palookup[0]; + char const * const palookup0 = lookuptables[0]; #ifdef DEBUG_TILESIZY_512 // Bump shade 1 by 16. @@ -281,7 +281,7 @@ void palettePostLoadTables(void) void paletteFixTranslucencyMask(void) { - for (auto thispalookup : palookup) + for (auto thispalookup : lookuptables) { if (thispalookup == NULL) continue; @@ -334,7 +334,7 @@ void paletteSetupDefaultFog(void) // Find a gap of four consecutive unused pal numbers to generate fog shade // tables. for (bssize_t j=1; j<=255-3; j++) - if (!palookup[j] && !palookup[j+1] && !palookup[j+2] && !palookup[j+3]) + if (!lookuptables[j] && !lookuptables[j+1] && !lookuptables[j+2] && !lookuptables[j+3]) { paletteMakeLookupTable(j, NULL, 60, 60, 60, 1); paletteMakeLookupTable(j+1, NULL, 60, 0, 0, 1); @@ -351,17 +351,17 @@ void palettePostLoadLookups(void) for (bssize_t j=1; jGetWidth(), tex->GetHeight()); diff --git a/source/exhumed/src/light.cpp b/source/exhumed/src/light.cpp index c46584105..d3eac7b4d 100644 --- a/source/exhumed/src/light.cpp +++ b/source/exhumed/src/light.cpp @@ -94,8 +94,8 @@ int LoadPaletteLookups() hFile.Read(buffer, 256*64); // TODO: dumb hack - if (palookup[i]) - ALIGNED_FREE_AND_NULL(palookup[i]); + if (lookuptables[i]) + ALIGNED_FREE_AND_NULL(lookuptables[i]); paletteSetLookupTable(i, buffer); bGreenPal = 0; diff --git a/source/rr/src/common.cpp b/source/rr/src/common.cpp index 6f09e4ec3..4bf20057f 100644 --- a/source/rr/src/common.cpp +++ b/source/rr/src/common.cpp @@ -181,7 +181,7 @@ void G_LoadLookups(void) { paletteMakeLookupTable(50, NULL, 12 * 4, 12 * 4, 12 * 4, 0); paletteMakeLookupTable(51, NULL, 12 * 4, 12 * 4, 12 * 4, 0); - paletteMakeLookupTable(54, palookup[8], 32 * 4, 32 * 4, 32 * 4, 0); + paletteMakeLookupTable(54, lookuptables[8], 32 * 4, 32 * 4, 32 * 4, 0); } } } diff --git a/source/sw/src/game.cpp b/source/sw/src/game.cpp index e967fc92e..908b3dfb7 100644 --- a/source/sw/src/game.cpp +++ b/source/sw/src/game.cpp @@ -1559,14 +1559,6 @@ void SybexScreen(void) void TitleLevel(void) { - char tempbuf[256]; - char *palook_bak = palookup[0]; - int i; - - for (i = 0; i < 256; i++) - tempbuf[i] = i; - palookup[0] = tempbuf; - twod->ClearScreen(); videoNextPage(); @@ -1610,8 +1602,6 @@ TitleLevel(void) } } - palookup[0] = palook_bak; - // clearview(0); // nextpage(); //SetPaletteToVESA(backup_pal);