add palette loading when a "palfile:" directive is found in a desc file

otherwise it wasn't actually doing anything with it. palette loading
was done as part of bitmap loading only, but this allows a specific
palette to be set which may make it easier to notice bitmap palette
mismatches in some scenarios
This commit is contained in:
Gered 2019-11-05 19:19:23 -05:00
parent 810f1244b8
commit 29efe17506

View file

@ -15,6 +15,7 @@
#include "ackeng.h"
#include "m1.h"
extern UCHAR colordat[];
extern UCHAR *Bitmaps[];
extern UCHAR *ObjBitmaps[];
extern UCHAR ObjbmNum[];
@ -38,6 +39,20 @@ e++;
return(e);
}
short LoadPalette(char *paletteName) {
FILE *fp;
GetCombinedPath(assetsPath, paletteName);
fp = fopen(tempFilename, "rb");
if (fp == NULL)
return -1;
fread(colordat, 768, 1, fp);
fclose(fp);
return 0;
}
/****************************************************************************
** **
****************************************************************************/
@ -275,6 +290,10 @@ while (1)
if (!strnicmp(LineBuf,"PALFILE:",8))
{
strcpy(PalName,SkipSpaces(&LineBuf[8]));
if (LoadPalette(PalName)) {
printf("Error loading palette \"%s\".\n",PalName);
result = -1;
}
continue;
}