mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-16 01:31:30 +00:00
Add R_CopyColormap
This commit is contained in:
parent
3da58f436c
commit
85d89287de
2 changed files with 49 additions and 16 deletions
62
src/r_data.c
62
src/r_data.c
|
@ -1367,26 +1367,35 @@ extracolormap_t *R_GetDefaultColormap(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// R_CheckDefaultColormap()
|
// R_CopyColormap()
|
||||||
//
|
//
|
||||||
boolean R_CheckDefaultColormapValues(extracolormap_t *extra_colormap, boolean checkrgba, boolean checkfadergba, boolean checkparams)
|
extracolormap_t *R_CopyColormap(extracolormap_t *extra_colormap, boolean lighttable)
|
||||||
{
|
{
|
||||||
|
extracolormap_t *exc = Z_Calloc(sizeof (*exc), PU_LEVEL, NULL);
|
||||||
|
|
||||||
if (!extra_colormap)
|
if (!extra_colormap)
|
||||||
return true;
|
extra_colormap = R_GetDefaultColormap();
|
||||||
else
|
|
||||||
return (
|
*exc = *extra_colormap;
|
||||||
(!checkparams ? true :
|
exc->next = exc->prev = NULL;
|
||||||
(extra_colormap->fadestart == 0
|
|
||||||
&& extra_colormap->fadeend == 31
|
|
||||||
&& !extra_colormap->fog)
|
|
||||||
)
|
|
||||||
&& (!checkrgba ? true : extra_colormap->rgba == 0)
|
|
||||||
&& (!checkfadergba ? true : extra_colormap->fadergba == 0x19000000)
|
|
||||||
#ifdef EXTRACOLORMAPLUMPS
|
#ifdef EXTRACOLORMAPLUMPS
|
||||||
&& extra_colormap->lump == LUMPERROR
|
strncpy(exc->lumpname, extra_colormap->lumpname, 9);
|
||||||
&& extra_colormap->lumpname[0] == 0
|
|
||||||
|
if (exc->lump != LUMPERROR && lighttable)
|
||||||
|
{
|
||||||
|
// aligned on 8 bit for asm code
|
||||||
|
exc->colormap = Z_MallocAlign(W_LumpLength(lump), PU_LEVEL, NULL, 16);
|
||||||
|
W_ReadLump(lump, exc->colormap);
|
||||||
|
}
|
||||||
|
else
|
||||||
#endif
|
#endif
|
||||||
);
|
if (lighttable)
|
||||||
|
exc->colormap = R_CreateLightTable(exc);
|
||||||
|
else
|
||||||
|
exc->colormap = NULL;
|
||||||
|
|
||||||
|
return exc;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -1423,6 +1432,29 @@ void R_AddColormapToList(extracolormap_t *extra_colormap)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// R_CheckDefaultColormap()
|
||||||
|
//
|
||||||
|
boolean R_CheckDefaultColormapValues(extracolormap_t *extra_colormap, boolean checkrgba, boolean checkfadergba, boolean checkparams)
|
||||||
|
{
|
||||||
|
if (!extra_colormap)
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return (
|
||||||
|
(!checkparams ? true :
|
||||||
|
(extra_colormap->fadestart == 0
|
||||||
|
&& extra_colormap->fadeend == 31
|
||||||
|
&& !extra_colormap->fog)
|
||||||
|
)
|
||||||
|
&& (!checkrgba ? true : extra_colormap->rgba == 0)
|
||||||
|
&& (!checkfadergba ? true : extra_colormap->fadergba == 0x19000000)
|
||||||
|
#ifdef EXTRACOLORMAPLUMPS
|
||||||
|
&& extra_colormap->lump == LUMPERROR
|
||||||
|
&& extra_colormap->lumpname[0] == 0
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef EXTRACOLORMAPLUMPS
|
#ifdef EXTRACOLORMAPLUMPS
|
||||||
extracolormap_t *R_ColormapForName(char *name)
|
extracolormap_t *R_ColormapForName(char *name)
|
||||||
{
|
{
|
||||||
|
|
|
@ -107,8 +107,9 @@ void R_ReInitColormaps(UINT16 num);
|
||||||
void R_ClearColormaps(void);
|
void R_ClearColormaps(void);
|
||||||
extracolormap_t *R_CreateDefaultColormap(boolean lighttable);
|
extracolormap_t *R_CreateDefaultColormap(boolean lighttable);
|
||||||
extracolormap_t *R_GetDefaultColormap(void);
|
extracolormap_t *R_GetDefaultColormap(void);
|
||||||
boolean R_CheckDefaultColormapValues(extracolormap_t *extra_colormap, boolean checkrgba, boolean checkfadergba, boolean checkparams);
|
extracolormap_t *R_CopyColormap(extracolormap_t *extra_colormap, boolean lighttable);
|
||||||
void R_AddColormapToList(extracolormap_t *extra_colormap);
|
void R_AddColormapToList(extracolormap_t *extra_colormap);
|
||||||
|
boolean R_CheckDefaultColormapValues(extracolormap_t *extra_colormap, boolean checkrgba, boolean checkfadergba, boolean checkparams);
|
||||||
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);
|
||||||
#ifdef EXTRACOLORMAPLUMPS
|
#ifdef EXTRACOLORMAPLUMPS
|
||||||
|
|
Loading…
Reference in a new issue