- moved palette.cpp out of Build folder.

This commit is contained in:
Christoph Oelckers 2020-06-07 13:06:18 +02:00
parent 3fe4dbed01
commit f2a637418d
3 changed files with 8 additions and 10 deletions

View file

@ -778,7 +778,6 @@ set (PCH_SOURCES
build/src/hash.cpp
build/src/mdsprite.cpp
build/src/mhk.cpp
build/src/palette.cpp
build/src/polymost.cpp
build/src/pragmas.cpp
build/src/scriptfile.cpp
@ -801,6 +800,7 @@ set (PCH_SOURCES
core/screenshot.cpp
core/raze_music.cpp
core/raze_sound.cpp
core/palette.cpp
core/2d/screentext.cpp

View file

@ -6,9 +6,7 @@
// by Jonathon Fowler (jf@jonof.id.au)
// by the EDuke32 team (development@voidpoint.com)
#include "compat.h"
#include "build.h"
#include "engine_priv.h"
#include "baselayer.h"
#include "imagehelpers.h"
@ -75,8 +73,8 @@ void paletteLoadFromDisk(void)
if (768 != fil.Read(palette, 768))
return;
for (unsigned char & k : palette)
k <<= 2;
for (auto & pe : palette)
pe <<= 2;
paletteSetColorTable(0, palette, false, false);
paletteloaded |= PALETTE_MAIN;
@ -176,7 +174,7 @@ void LookupTableInfo::postLoadTables(void)
int32_t LookupTableInfo::loadTable(FileReader &fp)
{
uint8_t remapbuf[256];
uint8_t buffer[256];
int numlookups = fp.ReadUInt8();
if (numlookups < 1)
return -1;
@ -185,15 +183,15 @@ int32_t LookupTableInfo::loadTable(FileReader &fp)
{
int palnum = fp.ReadUInt8();
if (256 != fp.Read(remapbuf, 256))
if (256 != fp.Read(buffer, 256))
return -1;
if (palnum >= 256 - RESERVEDPALS)
if (palnum < 0 || palnum >= 256 - RESERVEDPALS)
{
Printf("ERROR: attempt to load lookup at reserved pal %d\n", palnum);
Printf("ERROR: attempt to load lookup at invalid index %d\n", palnum);
}
else
makeTable(palnum, remapbuf, 0, 0, 0, 0);
makeTable(palnum, buffer, 0, 0, 0, 0);
}
return 0;