mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-27 20:41:46 +00:00
extracolormap_t refinement and netsyncing
* Store raw values per rgba in extracolormap_t (no maskcolor or fadecolor) * Crunched some UINT16/32 into UINT8 * Calculate mask values in R_CreateLightTable * ifdef out EXTRACOLORMAPLUMPS
This commit is contained in:
parent
78f984e362
commit
c1d1f08ea6
4 changed files with 228 additions and 75 deletions
116
src/p_saveg.c
116
src/p_saveg.c
|
|
@ -21,6 +21,7 @@
|
||||||
#include "p_local.h"
|
#include "p_local.h"
|
||||||
#include "p_setup.h"
|
#include "p_setup.h"
|
||||||
#include "p_saveg.h"
|
#include "p_saveg.h"
|
||||||
|
#include "r_data.h"
|
||||||
#include "r_things.h"
|
#include "r_things.h"
|
||||||
#include "r_state.h"
|
#include "r_state.h"
|
||||||
#include "w_wad.h"
|
#include "w_wad.h"
|
||||||
|
|
@ -494,7 +495,7 @@ static void P_NetUnArchivePlayers(void)
|
||||||
|
|
||||||
// diff3 flags
|
// diff3 flags
|
||||||
#define SD_TAGLIST 0x01
|
#define SD_TAGLIST 0x01
|
||||||
#define SD_MIDMAP 0x02
|
#define SD_COLORMAP 0x02
|
||||||
|
|
||||||
#define LD_FLAG 0x01
|
#define LD_FLAG 0x01
|
||||||
#define LD_SPECIAL 0x02
|
#define LD_SPECIAL 0x02
|
||||||
|
|
@ -589,8 +590,8 @@ static void P_NetArchiveWorld(void)
|
||||||
diff2 |= SD_TAG;
|
diff2 |= SD_TAG;
|
||||||
if (ss->nexttag != ss->spawn_nexttag || ss->firsttag != ss->spawn_firsttag)
|
if (ss->nexttag != ss->spawn_nexttag || ss->firsttag != ss->spawn_firsttag)
|
||||||
diff3 |= SD_TAGLIST;
|
diff3 |= SD_TAGLIST;
|
||||||
if (ss->midmap != ss->spawn_midmap)
|
if (ss->extra_colormap != ss->spawn_extra_colormap)
|
||||||
diff3 |= SD_MIDMAP;
|
diff3 |= SD_COLORMAP;
|
||||||
|
|
||||||
// Check if any of the sector's FOFs differ from how they spawned
|
// Check if any of the sector's FOFs differ from how they spawned
|
||||||
if (ss->ffloors)
|
if (ss->ffloors)
|
||||||
|
|
@ -654,8 +655,30 @@ static void P_NetArchiveWorld(void)
|
||||||
WRITEINT32(put, ss->firsttag);
|
WRITEINT32(put, ss->firsttag);
|
||||||
WRITEINT32(put, ss->nexttag);
|
WRITEINT32(put, ss->nexttag);
|
||||||
}
|
}
|
||||||
if (diff3 & SD_MIDMAP)
|
|
||||||
WRITEINT32(put, ss->midmap);
|
if (diff3 & SD_COLORMAP)
|
||||||
|
{
|
||||||
|
WRITEUINT8(put, ss->extra_colormap->fadestart);
|
||||||
|
WRITEUINT8(put, ss->extra_colormap->fadeend);
|
||||||
|
WRITEUINT8(put, ss->extra_colormap->fadedist);
|
||||||
|
WRITEUINT8(put, (UINT8)ss->extra_colormap->fog);
|
||||||
|
|
||||||
|
WRITEUINT8(put, ss->extra_colormap->cr);
|
||||||
|
WRITEUINT8(put, ss->extra_colormap->cg);
|
||||||
|
WRITEUINT8(put, ss->extra_colormap->cb);
|
||||||
|
WRITEUINT8(put, ss->extra_colormap->ca);
|
||||||
|
WRITEUINT8(put, ss->extra_colormap->cfr);
|
||||||
|
WRITEUINT8(put, ss->extra_colormap->cfg);
|
||||||
|
WRITEUINT8(put, ss->extra_colormap->cfb);
|
||||||
|
WRITEUINT8(put, ss->extra_colormap->cfa);
|
||||||
|
|
||||||
|
WRITEINT32(put, ss->extra_colormap->rgba);
|
||||||
|
WRITEINT32(put, ss->extra_colormap->fadergba);
|
||||||
|
|
||||||
|
#ifdef EXTRACOLORMAPLUMPS
|
||||||
|
WRITESTRINGN(put, ss->extra_colormap->lumpname, 9);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
// Special case: save the stats of all modified ffloors along with their ffloor "number"s
|
// Special case: save the stats of all modified ffloors along with their ffloor "number"s
|
||||||
// we don't bother with ffloors that haven't changed, that would just add to savegame even more than is really needed
|
// we don't bother with ffloors that haven't changed, that would just add to savegame even more than is really needed
|
||||||
|
|
@ -850,8 +873,87 @@ static void P_NetUnArchiveWorld(void)
|
||||||
sectors[i].firsttag = READINT32(get);
|
sectors[i].firsttag = READINT32(get);
|
||||||
sectors[i].nexttag = READINT32(get);
|
sectors[i].nexttag = READINT32(get);
|
||||||
}
|
}
|
||||||
if (diff3 & SD_MIDMAP)
|
|
||||||
sectors[i].midmap = READINT32(get);
|
if (diff3 & SD_COLORMAP)
|
||||||
|
{
|
||||||
|
extracolormap_t *exc;
|
||||||
|
|
||||||
|
UINT8 fadestart = READUINT8(get),
|
||||||
|
fadeend = READUINT8(get),
|
||||||
|
fadedist = READUINT8(get);
|
||||||
|
|
||||||
|
boolean fog = (boolean)READUINT8(get);
|
||||||
|
|
||||||
|
UINT8 cr = READUINT8(get),
|
||||||
|
cg = READUINT8(get),
|
||||||
|
cb = READUINT8(get),
|
||||||
|
ca = READUINT8(get),
|
||||||
|
cfr = READUINT8(get),
|
||||||
|
cfg = READUINT8(get),
|
||||||
|
cfb = READUINT8(get),
|
||||||
|
cfa = READUINT8(get);
|
||||||
|
|
||||||
|
INT32 rgba = READINT32(get),
|
||||||
|
fadergba = READINT32(get);
|
||||||
|
|
||||||
|
#ifdef EXTRACOLORMAPLUMPS
|
||||||
|
char lumpname[9];
|
||||||
|
READSTRINGN(get, lumpname, 9);
|
||||||
|
|
||||||
|
if (lumpname[0])
|
||||||
|
sectors[i].extra_colormap = R_ColormapForName(lumpname);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
for (exc = extra_colormaps; exc; exc = exc->next)
|
||||||
|
{
|
||||||
|
#ifdef EXTRACOLORMAPLUMPS
|
||||||
|
if (exc->lump != LUMPERROR)
|
||||||
|
continue;
|
||||||
|
#endif
|
||||||
|
if (cr == exc->cr && cg == exc->cg && cb == exc->cb && ca == exc->ca
|
||||||
|
&& cfr == exc->cfr && cfg == exc->cfg && cfb == exc->cfb && cfa == exc->cfa
|
||||||
|
&& fadestart == exc->fadestart
|
||||||
|
&& fadeend == exc->fadeend
|
||||||
|
&& fog == exc->fog)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!exc)
|
||||||
|
{
|
||||||
|
exc = Z_Calloc(sizeof (*exc), PU_LEVEL, NULL);
|
||||||
|
|
||||||
|
exc->fadestart = fadestart;
|
||||||
|
exc->fadeend = fadeend;
|
||||||
|
exc->fadedist = fadedist;
|
||||||
|
exc->fog = fog;
|
||||||
|
|
||||||
|
exc->cr = cr;
|
||||||
|
exc->cg = cg;
|
||||||
|
exc->cb = cb;
|
||||||
|
exc->ca = ca;
|
||||||
|
exc->cfr = cfr;
|
||||||
|
exc->cfg = cfg;
|
||||||
|
exc->cfb = cfb;
|
||||||
|
exc->cfa = cfa;
|
||||||
|
|
||||||
|
exc->rgba = rgba;
|
||||||
|
exc->fadergba = fadergba;
|
||||||
|
|
||||||
|
exc->colormap = R_CreateLightTable(exc);
|
||||||
|
|
||||||
|
R_AddColormapToList(exc);
|
||||||
|
|
||||||
|
sectors[i].extra_colormap = exc;
|
||||||
|
|
||||||
|
#ifdef EXTRACOLORMAPLUMPS
|
||||||
|
exc->lump = LUMPERROR;
|
||||||
|
exc->lumpname[0] = 0;
|
||||||
|
} // if (!exc) // if (!lumpname[0] || !R_ColormapForName(lumpname))
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (diff & SD_FFLOORS)
|
if (diff & SD_FFLOORS)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
160
src/r_data.c
160
src/r_data.c
|
|
@ -1160,6 +1160,7 @@ static inline lumpnum_t R_CheckNumForNameList(const char *name, lumplist_t *list
|
||||||
return LUMPERROR;
|
return LUMPERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef EXTRACOLORMAPLUMPS
|
||||||
static lumplist_t *colormaplumps = NULL; ///\todo free leak
|
static lumplist_t *colormaplumps = NULL; ///\todo free leak
|
||||||
static size_t numcolormaplumps = 0;
|
static size_t numcolormaplumps = 0;
|
||||||
|
|
||||||
|
|
@ -1195,6 +1196,7 @@ static void R_InitExtraColormaps(void)
|
||||||
}
|
}
|
||||||
CONS_Printf(M_GetText("Number of Extra Colormaps: %s\n"), sizeu1(numcolormaplumps));
|
CONS_Printf(M_GetText("Number of Extra Colormaps: %s\n"), sizeu1(numcolormaplumps));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Search for flat name through all
|
// Search for flat name through all
|
||||||
lumpnum_t R_GetFlatNumForName(const char *name)
|
lumpnum_t R_GetFlatNumForName(const char *name)
|
||||||
|
|
@ -1291,7 +1293,9 @@ static void R_InitColormaps(void)
|
||||||
|
|
||||||
// Init Boom colormaps.
|
// Init Boom colormaps.
|
||||||
R_ClearColormaps();
|
R_ClearColormaps();
|
||||||
|
#ifdef EXTRACOLORMAPLUMPS
|
||||||
R_InitExtraColormaps();
|
R_InitExtraColormaps();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void R_ReInitColormaps(UINT16 num)
|
void R_ReInitColormaps(UINT16 num)
|
||||||
|
|
@ -1354,6 +1358,7 @@ void R_AddColormapToList(extracolormap_t *extra_colormap)
|
||||||
extra_colormap->next = 0;
|
extra_colormap->next = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef EXTRACOLORMAPLUMPS
|
||||||
extracolormap_t *R_ColormapForName(char *name)
|
extracolormap_t *R_ColormapForName(char *name)
|
||||||
{
|
{
|
||||||
lumpnum_t lump;
|
lumpnum_t lump;
|
||||||
|
|
@ -1370,6 +1375,8 @@ extracolormap_t *R_ColormapForName(char *name)
|
||||||
exc = Z_Calloc(sizeof (*exc), PU_LEVEL, NULL);
|
exc = Z_Calloc(sizeof (*exc), PU_LEVEL, NULL);
|
||||||
|
|
||||||
exc->lump = lump;
|
exc->lump = lump;
|
||||||
|
strncpy(exc->lumpname, name, 9);
|
||||||
|
exc->lumpname[8] = 0;
|
||||||
|
|
||||||
// aligned on 8 bit for asm code
|
// aligned on 8 bit for asm code
|
||||||
exc->colormap = Z_MallocAlign(W_LumpLength(lump), PU_LEVEL, NULL, 16);
|
exc->colormap = Z_MallocAlign(W_LumpLength(lump), PU_LEVEL, NULL, 16);
|
||||||
|
|
@ -1377,15 +1384,21 @@ extracolormap_t *R_ColormapForName(char *name)
|
||||||
|
|
||||||
// We set all params of the colormap to normal because there
|
// We set all params of the colormap to normal because there
|
||||||
// is no real way to tell how GL should handle a colormap lump anyway..
|
// is no real way to tell how GL should handle a colormap lump anyway..
|
||||||
exc->maskcolor = 0xffff;
|
exc->cr = exc->cg = exc->cb = 0xff;
|
||||||
exc->fadecolor = 0x0;
|
exc->ca = 0;
|
||||||
exc->maskamt = 0x0;
|
exc->cfr = exc->cfg = exc->cfb = 0;
|
||||||
|
exc->cfa = 18;
|
||||||
exc->fadestart = 0;
|
exc->fadestart = 0;
|
||||||
exc->fadeend = 31;
|
exc->fadeend = 31;
|
||||||
exc->fog = 0;
|
exc->fog = 0;
|
||||||
|
exc->rgba = 0;
|
||||||
|
exc->fadergba = 0x19000000;
|
||||||
|
|
||||||
|
R_AddColormapToList(exc);
|
||||||
|
|
||||||
return exc;
|
return exc;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// R_CreateColormap
|
// R_CreateColormap
|
||||||
|
|
@ -1402,21 +1415,58 @@ static int RoundUp(double number);
|
||||||
|
|
||||||
lighttable_t *R_CreateLightTable(extracolormap_t *extra_colormap)
|
lighttable_t *R_CreateLightTable(extracolormap_t *extra_colormap)
|
||||||
{
|
{
|
||||||
|
double cmaskr, cmaskg, cmaskb, cdestr, cdestg, cdestb;
|
||||||
|
double maskamt = 0, othermask = 0;
|
||||||
|
|
||||||
|
UINT8 cr = extra_colormap->cr,
|
||||||
|
cg = extra_colormap->cg,
|
||||||
|
cb = extra_colormap->cb,
|
||||||
|
ca = extra_colormap->ca,
|
||||||
|
cfr = extra_colormap->cfr,
|
||||||
|
cfg = extra_colormap->cfg,
|
||||||
|
cfb = extra_colormap->cfb;
|
||||||
|
// cfa = extra_colormap->cfa; // unused in software
|
||||||
|
|
||||||
UINT32 fadestart = (UINT16)extra_colormap->fadestart,
|
UINT32 fadestart = (UINT16)extra_colormap->fadestart,
|
||||||
fadedist = extra_colormap->fadedist;
|
fadedist = extra_colormap->fadedist;
|
||||||
|
|
||||||
double othermask = extra_colormap->othermask,
|
|
||||||
cmaskr = extra_colormap->cmaskr,
|
|
||||||
cmaskg = extra_colormap->cmaskg,
|
|
||||||
cmaskb = extra_colormap->cmaskb,
|
|
||||||
cdestr = extra_colormap->cdestr,
|
|
||||||
cdestg = extra_colormap->cdestg,
|
|
||||||
cdestb = extra_colormap->cdestb;
|
|
||||||
|
|
||||||
lighttable_t *lighttable = NULL;
|
lighttable_t *lighttable = NULL;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
|
/////////////////////
|
||||||
|
// Calc the RGBA mask
|
||||||
|
/////////////////////
|
||||||
|
cmaskr = cr;
|
||||||
|
cmaskg = cg;
|
||||||
|
cmaskb = cb;
|
||||||
|
|
||||||
|
maskamt = (double)(ca/24.0l);
|
||||||
|
othermask = 1 - maskamt;
|
||||||
|
maskamt /= 0xff;
|
||||||
|
|
||||||
|
cmaskr *= maskamt;
|
||||||
|
cmaskg *= maskamt;
|
||||||
|
cmaskb *= maskamt;
|
||||||
|
|
||||||
|
/////////////////////
|
||||||
|
// Calc the RGBA fade mask
|
||||||
|
/////////////////////
|
||||||
|
cdestr = cfr;
|
||||||
|
cdestg = cfg;
|
||||||
|
cdestb = cfb;
|
||||||
|
|
||||||
|
// fade alpha unused in software
|
||||||
|
// maskamt = (double)(cfa/24.0l);
|
||||||
|
// othermask = 1 - maskamt;
|
||||||
|
// maskamt /= 0xff;
|
||||||
|
|
||||||
|
// cdestr *= maskamt;
|
||||||
|
// cdestg *= maskamt;
|
||||||
|
// cdestb *= maskamt;
|
||||||
|
|
||||||
|
/////////////////////
|
||||||
// This code creates the colormap array used by software renderer
|
// This code creates the colormap array used by software renderer
|
||||||
|
/////////////////////
|
||||||
if (rendermode == render_soft)
|
if (rendermode == render_soft)
|
||||||
{
|
{
|
||||||
double r, g, b, cbrightness;
|
double r, g, b, cbrightness;
|
||||||
|
|
@ -1494,12 +1544,10 @@ lighttable_t *R_CreateLightTable(extracolormap_t *extra_colormap)
|
||||||
|
|
||||||
extracolormap_t *R_CreateColormap(char *p1, char *p2, char *p3)
|
extracolormap_t *R_CreateColormap(char *p1, char *p2, char *p3)
|
||||||
{
|
{
|
||||||
double cmaskr, cmaskg, cmaskb, cdestr, cdestg, cdestb;
|
boolean fog = false;
|
||||||
double maskamt = 0, othermask = 0;
|
|
||||||
int mask, fog = 0;
|
|
||||||
extracolormap_t *extra_colormap, *exc;
|
extracolormap_t *extra_colormap, *exc;
|
||||||
|
|
||||||
UINT32 cr, cg, cb, maskcolor, fadecolor;
|
UINT8 cr, cg, cb, ca, cfr, cfg, cfb, cfa;
|
||||||
UINT32 fadestart = 0, fadeend = 31, fadedist = 31;
|
UINT32 fadestart = 0, fadeend = 31, fadedist = 31;
|
||||||
|
|
||||||
INT32 rgba, fadergba;
|
INT32 rgba, fadergba;
|
||||||
|
|
@ -1509,27 +1557,15 @@ extracolormap_t *R_CreateColormap(char *p1, char *p2, char *p3)
|
||||||
if (p1[0] == '#')
|
if (p1[0] == '#')
|
||||||
{
|
{
|
||||||
cr = ((HEX2INT(p1[1]) * 16) + HEX2INT(p1[2]));
|
cr = ((HEX2INT(p1[1]) * 16) + HEX2INT(p1[2]));
|
||||||
cmaskr = cr;
|
|
||||||
cg = ((HEX2INT(p1[3]) * 16) + HEX2INT(p1[4]));
|
cg = ((HEX2INT(p1[3]) * 16) + HEX2INT(p1[4]));
|
||||||
cmaskg = cg;
|
|
||||||
cb = ((HEX2INT(p1[5]) * 16) + HEX2INT(p1[6]));
|
cb = ((HEX2INT(p1[5]) * 16) + HEX2INT(p1[6]));
|
||||||
cmaskb = cb;
|
|
||||||
// Create a rough approximation of the color (a 16 bit color)
|
|
||||||
maskcolor = ((cb) >> 3) + (((cg) >> 2) << 5) + (((cr) >> 3) << 11);
|
|
||||||
if (p1[7] >= 'a' && p1[7] <= 'z')
|
if (p1[7] >= 'a' && p1[7] <= 'z')
|
||||||
mask = (p1[7] - 'a');
|
ca = (p1[7] - 'a');
|
||||||
else if (p1[7] >= 'A' && p1[7] <= 'Z')
|
else if (p1[7] >= 'A' && p1[7] <= 'Z')
|
||||||
mask = (p1[7] - 'A');
|
ca = (p1[7] - 'A');
|
||||||
else
|
else
|
||||||
mask = 24;
|
ca = 24;
|
||||||
|
|
||||||
maskamt = (double)(mask/24.0l);
|
|
||||||
|
|
||||||
othermask = 1 - maskamt;
|
|
||||||
maskamt /= 0xff;
|
|
||||||
cmaskr *= maskamt;
|
|
||||||
cmaskg *= maskamt;
|
|
||||||
cmaskb *= maskamt;
|
|
||||||
|
|
||||||
// for opengl; generate on software too for netsync
|
// for opengl; generate on software too for netsync
|
||||||
rgba = (HEX2INT(p1[1]) << 4) + (HEX2INT(p1[2]) << 0) +
|
rgba = (HEX2INT(p1[1]) << 4) + (HEX2INT(p1[2]) << 0) +
|
||||||
|
|
@ -1543,9 +1579,8 @@ extracolormap_t *R_CreateColormap(char *p1, char *p2, char *p3)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cmaskr = cmaskg = cmaskb = 0xff;
|
cr = cg = cb = 0xff;
|
||||||
maskamt = 0;
|
ca = 0;
|
||||||
maskcolor = ((0xff) >> 3) + (((0xff) >> 2) << 5) + (((0xff) >> 3) << 11);
|
|
||||||
rgba = 0;
|
rgba = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1560,16 +1595,22 @@ extracolormap_t *R_CreateColormap(char *p1, char *p2, char *p3)
|
||||||
if (fadeend > 31 || fadeend < 1)
|
if (fadeend > 31 || fadeend < 1)
|
||||||
fadeend = 31;
|
fadeend = 31;
|
||||||
fadedist = fadeend - fadestart;
|
fadedist = fadeend - fadestart;
|
||||||
fog = NUMFROMCHAR(p2[1]);
|
fog = (boolean)NUMFROMCHAR(p2[1]);
|
||||||
}
|
}
|
||||||
#undef NUMFROMCHAR
|
#undef NUMFROMCHAR
|
||||||
|
|
||||||
if (p3[0] == '#')
|
if (p3[0] == '#')
|
||||||
{
|
{
|
||||||
cdestr = cr = ((HEX2INT(p3[1]) * 16) + HEX2INT(p3[2]));
|
cfr = ((HEX2INT(p3[1]) * 16) + HEX2INT(p3[2]));
|
||||||
cdestg = cg = ((HEX2INT(p3[3]) * 16) + HEX2INT(p3[4]));
|
cfg = ((HEX2INT(p3[3]) * 16) + HEX2INT(p3[4]));
|
||||||
cdestb = cb = ((HEX2INT(p3[5]) * 16) + HEX2INT(p3[6]));
|
cfb = ((HEX2INT(p3[5]) * 16) + HEX2INT(p3[6]));
|
||||||
fadecolor = (((cb) >> 3) + (((cg) >> 2) << 5) + (((cr) >> 3) << 11));
|
|
||||||
|
if (p1[7] >= 'a' && p1[7] <= 'z')
|
||||||
|
cfa = (p1[7] - 'a');
|
||||||
|
else if (p1[7] >= 'A' && p1[7] <= 'Z')
|
||||||
|
cfa = (p1[7] - 'A');
|
||||||
|
else
|
||||||
|
cfa = 18;
|
||||||
|
|
||||||
// for opengl; generate on software too for netsync
|
// for opengl; generate on software too for netsync
|
||||||
fadergba = (HEX2INT(p3[1]) << 4) + (HEX2INT(p3[2]) << 0) +
|
fadergba = (HEX2INT(p3[1]) << 4) + (HEX2INT(p3[2]) << 0) +
|
||||||
|
|
@ -1583,7 +1624,8 @@ extracolormap_t *R_CreateColormap(char *p1, char *p2, char *p3)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cdestr = cdestg = cdestb = fadecolor = 0;
|
cfr = cfg = cfb = 0;
|
||||||
|
cfa = 18;
|
||||||
fadergba = 0x19000000; // default alpha for fade, (25 << 24)
|
fadergba = 0x19000000; // default alpha for fade, (25 << 24)
|
||||||
}
|
}
|
||||||
#undef ALPHA2INT
|
#undef ALPHA2INT
|
||||||
|
|
@ -1591,40 +1633,41 @@ extracolormap_t *R_CreateColormap(char *p1, char *p2, char *p3)
|
||||||
|
|
||||||
for (exc = extra_colormaps; exc; exc = exc->next)
|
for (exc = extra_colormaps; exc; exc = exc->next)
|
||||||
{
|
{
|
||||||
|
#ifdef EXTRACOLORMAPLUMPS
|
||||||
if (exc->lump != LUMPERROR)
|
if (exc->lump != LUMPERROR)
|
||||||
continue;
|
continue;
|
||||||
if (maskcolor == exc->maskcolor
|
#endif
|
||||||
&& fadecolor == exc->fadecolor
|
if (cr == exc->cr && cg == exc->cg && cb == exc->cb && ca == exc->ca
|
||||||
&& (float)maskamt == (float)exc->maskamt
|
&& cfr == exc->cfr && cfg == exc->cfg && cfb == exc->cfb && cfa == exc->cfa
|
||||||
&& fadestart == exc->fadestart
|
&& fadestart == exc->fadestart
|
||||||
&& fadeend == exc->fadeend
|
&& fadeend == exc->fadeend
|
||||||
&& fog == exc->fog)
|
&& fog == exc->fog)
|
||||||
return exc;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
extra_colormap = Z_Calloc(sizeof (*extra_colormap), PU_LEVEL, NULL);
|
extra_colormap = Z_Calloc(sizeof (*extra_colormap), PU_LEVEL, NULL);
|
||||||
|
|
||||||
extra_colormap->maskcolor = (UINT16)maskcolor;
|
|
||||||
extra_colormap->fadecolor = (UINT16)fadecolor;
|
|
||||||
extra_colormap->maskamt = maskamt;
|
|
||||||
extra_colormap->othermask = othermask;
|
|
||||||
extra_colormap->fadestart = (UINT16)fadestart;
|
extra_colormap->fadestart = (UINT16)fadestart;
|
||||||
extra_colormap->fadeend = (UINT16)fadeend;
|
extra_colormap->fadeend = (UINT16)fadeend;
|
||||||
extra_colormap->fadedist = fadedist;
|
extra_colormap->fadedist = fadedist;
|
||||||
extra_colormap->fog = fog;
|
extra_colormap->fog = fog;
|
||||||
|
|
||||||
extra_colormap->cmaskr = cmaskr;
|
extra_colormap->cr = cr;
|
||||||
extra_colormap->cmaskg = cmaskg;
|
extra_colormap->cg = cg;
|
||||||
extra_colormap->cmaskb = cmaskb;
|
extra_colormap->cb = cb;
|
||||||
extra_colormap->cdestr = cdestr;
|
extra_colormap->ca = ca;
|
||||||
extra_colormap->cdestg = cdestg;
|
extra_colormap->cfr = cfr;
|
||||||
extra_colormap->cdestb = cdestb;
|
extra_colormap->cfg = cfg;
|
||||||
|
extra_colormap->cfb = cfb;
|
||||||
|
extra_colormap->cfa = cfa;
|
||||||
|
|
||||||
extra_colormap->rgba = rgba;
|
extra_colormap->rgba = rgba;
|
||||||
extra_colormap->fadergba = fadergba;
|
extra_colormap->fadergba = fadergba;
|
||||||
|
|
||||||
|
#ifdef EXTRACOLORMAPLUMPS
|
||||||
extra_colormap->lump = LUMPERROR;
|
extra_colormap->lump = LUMPERROR;
|
||||||
extra_colormap->next = extra_colormap->prev = NULL;
|
extra_colormap->lumpname[0] = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
extra_colormap->colormap = R_CreateLightTable(extra_colormap);
|
extra_colormap->colormap = R_CreateLightTable(extra_colormap);
|
||||||
|
|
||||||
|
|
@ -1673,7 +1716,8 @@ static int RoundUp(double number)
|
||||||
return (int)number;
|
return (int)number;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *R_ColormapNameForColormap(extracolormap_t *extra_colormap)
|
#ifdef EXTRACOLORMAPLUMPS
|
||||||
|
const char *R_NameForColormap(extracolormap_t *extra_colormap)
|
||||||
{
|
{
|
||||||
if (!extra_colormap)
|
if (!extra_colormap)
|
||||||
return "NONE";
|
return "NONE";
|
||||||
|
|
@ -1681,9 +1725,9 @@ const char *R_ColormapNameForColormap(extracolormap_t *extra_colormap)
|
||||||
if (extra_colormap->lump == LUMPERROR)
|
if (extra_colormap->lump == LUMPERROR)
|
||||||
return "INLEVEL";
|
return "INLEVEL";
|
||||||
|
|
||||||
return W_CheckNameForNum(extra_colormap->lump);
|
return extra_colormap->lumpname;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// build a table for quick conversion from 8bpp to 15bpp
|
// build a table for quick conversion from 8bpp to 15bpp
|
||||||
|
|
|
||||||
11
src/r_data.h
11
src/r_data.h
|
|
@ -96,12 +96,19 @@ void R_ClearTextureNumCache(boolean btell);
|
||||||
INT32 R_TextureNumForName(const char *name);
|
INT32 R_TextureNumForName(const char *name);
|
||||||
INT32 R_CheckTextureNumForName(const char *name);
|
INT32 R_CheckTextureNumForName(const char *name);
|
||||||
|
|
||||||
|
// Extra Colormap lumps (C_START/C_END) are not used anywhere
|
||||||
|
// Uncomment to enable
|
||||||
|
//#define EXTRACOLORMAPLUMPS
|
||||||
|
|
||||||
void R_ReInitColormaps(UINT16 num);
|
void R_ReInitColormaps(UINT16 num);
|
||||||
void R_ClearColormaps(void);
|
void R_ClearColormaps(void);
|
||||||
extracolormap_t *R_ColormapForName(char *name);
|
void R_AddColormapToList(extracolormap_t *extra_colormap);
|
||||||
lighttable_t *R_CreateLightTable(extracolormap_t *extra_colormap);
|
lighttable_t *R_CreateLightTable(extracolormap_t *extra_colormap);
|
||||||
extracolormap_t *R_CreateColormap(char *p1, char *p2, char *p3);
|
extracolormap_t *R_CreateColormap(char *p1, char *p2, char *p3);
|
||||||
const char *R_ColormapNameForNum(INT32 num);
|
#ifdef EXTRACOLORMAPLUMPS
|
||||||
|
extracolormap_t *R_ColormapForName(char *name);
|
||||||
|
const char *R_NameForColormap(extracolormap_t *extra_colormap);
|
||||||
|
#endif
|
||||||
|
|
||||||
extern INT32 numtextures;
|
extern INT32 numtextures;
|
||||||
|
|
||||||
|
|
|
||||||
16
src/r_defs.h
16
src/r_defs.h
|
|
@ -52,15 +52,12 @@ typedef UINT8 lighttable_t;
|
||||||
// ExtraColormap type. Use for extra_colormaps from now on.
|
// ExtraColormap type. Use for extra_colormaps from now on.
|
||||||
typedef struct extracolormap_s
|
typedef struct extracolormap_s
|
||||||
{
|
{
|
||||||
UINT16 maskcolor, fadecolor;
|
UINT8 fadestart, fadeend;
|
||||||
double maskamt, othermask;
|
UINT8 fadedist;
|
||||||
UINT16 fadestart, fadeend;
|
boolean fog;
|
||||||
UINT32 fadedist;
|
|
||||||
INT32 fog;
|
|
||||||
|
|
||||||
// mask rgb for colormap table generation
|
// rgba for colormap table generation
|
||||||
double cmaskr, cmaskg, cmaskb;
|
UINT8 cr, cg, cb, ca, cfr, cfg, cfb, cfa;
|
||||||
double cdestr, cdestg, cdestb;
|
|
||||||
|
|
||||||
// rgba is used in hw mode for colored sector lighting
|
// rgba is used in hw mode for colored sector lighting
|
||||||
INT32 rgba; // similar to maskcolor in sw mode
|
INT32 rgba; // similar to maskcolor in sw mode
|
||||||
|
|
@ -68,7 +65,10 @@ typedef struct extracolormap_s
|
||||||
|
|
||||||
lighttable_t *colormap;
|
lighttable_t *colormap;
|
||||||
|
|
||||||
|
#ifdef EXTRACOLORMAPLUMPS
|
||||||
lumpnum_t lump; // for colormap lump matching, init to LUMPERROR
|
lumpnum_t lump; // for colormap lump matching, init to LUMPERROR
|
||||||
|
char lumpname[9]; // for netsyncing
|
||||||
|
#endif
|
||||||
|
|
||||||
struct extracolormap_s *next;
|
struct extracolormap_s *next;
|
||||||
struct extracolormap_s *prev;
|
struct extracolormap_s *prev;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue