- Setting a Player.ColorRange now completely disables the translation rather than just

making it an identity map.

SVN r2194 (trunk)
This commit is contained in:
Randy Heit 2010-03-06 03:02:24 +00:00
parent e78fd195d8
commit 38c9bb1900
4 changed files with 10 additions and 2 deletions

View file

@ -2181,7 +2181,7 @@ ESPSResult R_SetPatchStyle (FRenderStyle style, fixed_t alpha, int translation,
if (translation != 0)
{
FRemapTable *table = TranslationToTable(translation);
if (table != NULL)
if (table != NULL && !table->Inactive)
{
dc_translation = table->Remap;
}

View file

@ -79,7 +79,7 @@ const BYTE IcePalette[16][3] =
FRemapTable::FRemapTable(int count)
{
assert(count <= 256);
Inactive = false;
Alloc(count);
// Note that the tables are left uninitialized. It is assumed that
@ -164,6 +164,7 @@ FRemapTable &FRemapTable::operator=(const FRemapTable &o)
{
Alloc(o.NumEntries);
}
Inactive = o.Inactive;
memcpy(Remap, o.Remap, NumEntries*sizeof(*Remap) + NumEntries*sizeof(*Palette));
return *this;
}
@ -929,6 +930,7 @@ static void R_CreatePlayerTranslation (float h, float s, float v, const FPlayerC
// [GRB] Don't translate skins with color range 0-0 (APlayerPawn default)
if (start == 0 && end == 0)
{
table->Inactive = true;
table->UpdateNative();
return;
}
@ -1081,6 +1083,7 @@ static void R_CreatePlayerTranslation (float h, float s, float v, const FPlayerC
}
alttable->UpdateNative();
}
table->Inactive = false;
table->UpdateNative();
}

View file

@ -46,6 +46,7 @@ struct FRemapTable
PalEntry *Palette; // The ideal palette this maps to
FNativePalette *Native; // The Palette stored in a HW texture
int NumEntries; // # of elements in this table (usually 256)
bool Inactive; // This table is inactive and should be treated as if it was passed as NULL
private:
void Free();

View file

@ -527,6 +527,10 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, double x, double y, DWORD tag
case DTA_Translation:
parms->remap = va_arg(tags, FRemapTable *);
if (parms->remap != NULL && parms->remap->Inactive)
{ // If it's inactive, pretend we were passed NULL instead.
parms->remap = NULL;
}
break;
case DTA_ColorOverlay: