Fix up some .wal palette issues when running q2 bsps in q1 gamedirs.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@6245 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
08aedd4b5b
commit
f996ff5fc8
2 changed files with 18 additions and 8 deletions
|
@ -1132,6 +1132,11 @@ static qboolean CL_CheckQ2BspWals(char *file)
|
|||
if (lump.filelen != count*sizeof(*tinf))
|
||||
return false;
|
||||
|
||||
//grab the appropriate palette, just in case... but only if this won't confuse anything.
|
||||
if (CL_CheckDLFile("gfx/palette.lmp"))
|
||||
if (!CL_CheckOrEnqueDownloadFile("pics/colormap.pcx", NULL, 0))
|
||||
gotone = true;
|
||||
|
||||
tinf = (q2texinfo_t*)(file + lump.fileofs);
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
|
@ -1141,13 +1146,16 @@ static qboolean CL_CheckQ2BspWals(char *file)
|
|||
break;
|
||||
|
||||
if (i == j)
|
||||
{
|
||||
{ //note: we do support formats other than .wal but we still need the .wal to figure out the correct scaling.
|
||||
//we make a special exception for .tga-without-.wal because other q2 engines already expect that, with pre-scaled textures (and thus lightmaps too).
|
||||
if (!CL_CheckDLFile(va("textures/%s.wal", tinf[i].texture)))
|
||||
if (!CL_CheckDLFile(va("textures/%s.tga", tinf[i].texture)))
|
||||
if (!CL_CheckOrEnqueDownloadFile(va("textures/%s.wal", tinf[i].texture), NULL, 0))
|
||||
gotone = true;
|
||||
}
|
||||
}
|
||||
|
||||
//FIXME: parse entity lump for sky name.
|
||||
#endif
|
||||
return gotone;
|
||||
}
|
||||
|
|
|
@ -220,7 +220,9 @@ extern qbyte *mod_base;
|
|||
dist = plane->dist - dist; \
|
||||
break;
|
||||
|
||||
unsigned char d_q28to24table[1024];
|
||||
#ifdef HAVE_CLIENT
|
||||
static unsigned char q2_palette[256*3];
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
|
@ -1359,7 +1361,7 @@ static texture_t *Mod_LoadWall(model_t *loadmodel, char *mapname, char *texname,
|
|||
|
||||
tex->srcdata = out = BZ_Malloc(size);
|
||||
tex->srcfmt = TF_MIP4_8PAL24_T255;
|
||||
tex->palette = host_basepal;
|
||||
tex->palette = q2_palette;
|
||||
memcpy(out, (qbyte *)wal + wal->offsets[0], (wal->width>>0)*(wal->height>>0));
|
||||
out += (wal->width>>0)*(wal->height>>0);
|
||||
memcpy(out, (qbyte *)wal + wal->offsets[1], (wal->width>>1)*(wal->height>>1));
|
||||
|
@ -4031,7 +4033,7 @@ static int CM_GetQ2Palette (void)
|
|||
Con_Printf (CON_WARNING "Couldn't find pics/colormap.pcx\n");
|
||||
return -1;
|
||||
}
|
||||
if (!ReadPCXPalette(f, sz, d_q28to24table))
|
||||
if (!ReadPCXPalette(f, sz, q2_palette))
|
||||
{
|
||||
Con_Printf (CON_WARNING "Couldn't read pics/colormap.pcx\n");
|
||||
FS_FreeFile(f);
|
||||
|
@ -4040,14 +4042,14 @@ static int CM_GetQ2Palette (void)
|
|||
FS_FreeFile(f);
|
||||
|
||||
|
||||
#if 1
|
||||
#if 0
|
||||
{
|
||||
float inf;
|
||||
qbyte palette[768];
|
||||
qbyte *pal;
|
||||
int i;
|
||||
|
||||
pal = d_q28to24table;
|
||||
pal = q2_palette;
|
||||
|
||||
for (i=0 ; i<768 ; i++)
|
||||
{
|
||||
|
@ -4059,7 +4061,7 @@ static int CM_GetQ2Palette (void)
|
|||
palette[i] = inf;
|
||||
}
|
||||
|
||||
memcpy (d_q28to24table, palette, sizeof(palette));
|
||||
memcpy (q2_palette, palette, sizeof(palette));
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
|
@ -4818,7 +4820,7 @@ static cmodel_t *CM_LoadMap (model_t *mod, qbyte *filein, size_t filelen, qboole
|
|||
|
||||
#ifdef HAVE_CLIENT
|
||||
if (CM_GetQ2Palette())
|
||||
memcpy(d_q28to24table, host_basepal, 768);
|
||||
memcpy(q2_palette, host_basepal, 768);
|
||||
#endif
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue