mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 23:32:09 +00:00
Don't crash if the palette entry is not first.
Instead, swap the palette entry and the first entry (only in memory).
This commit is contained in:
parent
78a816dbdf
commit
946a06b264
1 changed files with 14 additions and 2 deletions
|
@ -215,8 +215,20 @@ TEX_InitFromWad (const char *path)
|
|||
|
||||
lumpinfo = wad->lumps;
|
||||
|
||||
if (strcmp (lumpinfo->name, "PALETTE"))
|
||||
Sys_Error ("TEX_InitFromWad: %s doesn't have palette as 0", path);
|
||||
if (strcmp (lumpinfo->name, "PALETTE")) {
|
||||
lumpinfo_t tlump;
|
||||
|
||||
Sys_Printf ("TEX_InitFromWad: %s doesn't have palette as 0", path);
|
||||
lumpinfo = wad_find_lump (wad, "PALETTE");
|
||||
if (!lumpinfo)
|
||||
Sys_Printf ("TEX_InitFromWad: %s doesn't have a palette", path);
|
||||
|
||||
// move the palette lump to the first entry
|
||||
tlump = *lumpinfo;
|
||||
*lumpinfo = wad->lumps[0];
|
||||
wad->lumps[0] = tlump;
|
||||
lumpinfo = wad->lumps;
|
||||
}
|
||||
|
||||
TEX_InitPalette (wad, lumpinfo);
|
||||
|
||||
|
|
Loading…
Reference in a new issue