Fixed colormap matching code again * Added debug messages for matching code

This commit is contained in:
mazmazz 2018-09-10 20:52:37 -04:00
parent 1e4f5e8d45
commit 3da38f2a9b
2 changed files with 40 additions and 1 deletions

View file

@ -877,6 +877,7 @@ static void P_NetUnArchiveWorld(void)
if (diff3 & SD_COLORMAP)
{
extracolormap_t *exc;
size_t dbg_i = 0;
UINT8 fadestart = READUINT8(get),
fadeend = READUINT8(get),
@ -920,8 +921,33 @@ static void P_NetUnArchiveWorld(void)
break;
}
for (exc = extra_colormaps; exc; exc = exc->next)
{
#ifdef EXTRACOLORMAPLUMPS
if (exc->lump != LUMPERROR)
{
dbg_i++;
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)
{
CONS_Debug(DBG_RENDER, "P_NetUnArchiveWorld: Found map %d: rgba(%d,%d,%d,%d) fadergba(%d,%d,%d,%d)\n",
dbg_i, cr, cg, cb, ca, cfr, cfg, cfb, cfa);
break;
}
dbg_i++;
}
if (!exc)
{
CONS_Debug(DBG_RENDER, "P_NetUnArchiveWorld: Creating map %d: rgba(%d,%d,%d,%d) fadergba(%d,%d,%d,%d)\n",
dbg_i, cr, cg, cb, ca, cfr, cfg, cfb, cfa);
exc = Z_Calloc(sizeof (*exc), PU_LEVEL, NULL);
exc->fadestart = fadestart;

View file

@ -1552,6 +1552,8 @@ extracolormap_t *R_CreateColormap(char *p1, char *p2, char *p3)
INT32 rgba, fadergba;
size_t dbg_i = 0;
#define HEX2INT(x) (UINT32)(x >= '0' && x <= '9' ? x - '0' : x >= 'a' && x <= 'f' ? x - 'a' + 10 : x >= 'A' && x <= 'F' ? x - 'A' + 10 : 0)
#define ALPHA2INT(x) (x >= 'a' && x <= 'z' ? x - 'a' : x >= 'A' && x <= 'Z' ? x - 'A' : x >= '0' && x <= '9' ? 25 : 0)
if (p1[0] == '#')
@ -1635,16 +1637,27 @@ extracolormap_t *R_CreateColormap(char *p1, char *p2, char *p3)
{
#ifdef EXTRACOLORMAPLUMPS
if (exc->lump != LUMPERROR)
{
dbg_i++;
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;
{
CONS_Debug(DBG_RENDER, "R_CreateColormap: Found map %d: rgba(%d,%d,%d,%d) fadergba(%d,%d,%d,%d)\n",
dbg_i, cr, cg, cb, ca, cfr, cfg, cfb, cfa);
return exc;
}
dbg_i++;
}
CONS_Debug(DBG_RENDER, "R_CreateColormap: Creating map %d: rgba(%d,%d,%d,%d) fadergba(%d,%d,%d,%d)\n",
dbg_i, cr, cg, cb, ca, cfr, cfg, cfb, cfa);
extra_colormap = Z_Calloc(sizeof (*extra_colormap), PU_LEVEL, NULL);
extra_colormap->fadestart = (UINT16)fadestart;