mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-28 06:53:58 +00:00
- added some functionality to FDynamicColormap to allow not creating
the colormap data if it isn't needed by the renderer. SVN r635 (trunk)
This commit is contained in:
parent
d12ede252f
commit
3eb741e391
6 changed files with 36 additions and 3 deletions
|
@ -1,4 +1,6 @@
|
|||
December 24, 2007 (Changes by Graf Zahl)
|
||||
- added some functionality to FDynamicColormap to allow not creating
|
||||
the colormap data.
|
||||
- also replaced the AM crosshair drawer by a DCanvas::DrawPixel function.
|
||||
- moved the AM line drawer into DCanvas as a virtual function. While testing
|
||||
this code I discovered that the antialias precalculation was never used
|
||||
|
|
|
@ -180,7 +180,7 @@ FFont * V_GetFont(const char *name)
|
|||
if (strlen(name) > 8)
|
||||
{
|
||||
fullname.Format("%s.fon", name);
|
||||
lump = Wads.CheckNumForFullName(name);
|
||||
lump = Wads.CheckNumForFullName(fullname);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -659,14 +659,18 @@ FDynamicColormap *GetSpecialLights (PalEntry color, PalEntry fade, int desaturat
|
|||
|
||||
// Not found. Create it.
|
||||
colormap = new FDynamicColormap;
|
||||
colormap->Maps = new BYTE[NUMCOLORMAPS*256];
|
||||
colormap->Next = NormalLight.Next;
|
||||
colormap->Color = color;
|
||||
colormap->Fade = fade;
|
||||
colormap->Desaturate = desaturate;
|
||||
NormalLight.Next = colormap;
|
||||
|
||||
colormap->BuildLights ();
|
||||
if (screen->UsesColormap())
|
||||
{
|
||||
colormap->Maps = new BYTE[NUMCOLORMAPS*256];
|
||||
colormap->BuildLights ();
|
||||
}
|
||||
else colormap->Maps = NULL;
|
||||
|
||||
return colormap;
|
||||
}
|
||||
|
@ -788,6 +792,24 @@ void FDynamicColormap::ChangeColorFade (PalEntry lightcolor, PalEntry fadecolor)
|
|||
}
|
||||
}
|
||||
|
||||
void FDynamicColormap::RebuildAllLights()
|
||||
{
|
||||
if (screen->UsesColormap())
|
||||
{
|
||||
FDynamicColormap *cm;
|
||||
|
||||
for (cm = &NormalLight; cm != NULL; cm = cm->Next)
|
||||
{
|
||||
if (cm->Maps == NULL)
|
||||
{
|
||||
cm->Maps = new BYTE[NUMCOLORMAPS*256];
|
||||
cm->BuildLights ();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CCMD (testcolor)
|
||||
{
|
||||
FString colorstring;
|
||||
|
|
|
@ -71,6 +71,7 @@ struct FDynamicColormap
|
|||
void ChangeColor (PalEntry lightcolor, int desaturate);
|
||||
void ChangeColorFade (PalEntry lightcolor, PalEntry fadecolor);
|
||||
void BuildLights ();
|
||||
static void RebuildAllLights();
|
||||
|
||||
BYTE *Maps;
|
||||
PalEntry Color;
|
||||
|
|
|
@ -328,6 +328,11 @@ void DCanvas::Dim (PalEntry color, float damount, int x1, int y1, int w, int h)
|
|||
}
|
||||
}
|
||||
|
||||
bool DCanvas::UsesColormap() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
int V_GetColorFromString (const DWORD *palette, const char *cstr)
|
||||
{
|
||||
int c[3], i, p;
|
||||
|
|
|
@ -179,6 +179,9 @@ public:
|
|||
// Calculate gamma table
|
||||
void CalcGamma (float gamma, BYTE gammalookup[256]);
|
||||
|
||||
// Can be overridden so that the colormaps for sector color/fade won't be built.
|
||||
virtual bool UsesColormap() const;
|
||||
|
||||
// Text drawing functions -----------------------------------------------
|
||||
|
||||
virtual void SetFont (FFont *font);
|
||||
|
|
Loading…
Reference in a new issue