- 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) if (translation != 0)
{ {
FRemapTable *table = TranslationToTable(translation); FRemapTable *table = TranslationToTable(translation);
if (table != NULL) if (table != NULL && !table->Inactive)
{ {
dc_translation = table->Remap; dc_translation = table->Remap;
} }

View file

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

View file

@ -46,6 +46,7 @@ struct FRemapTable
PalEntry *Palette; // The ideal palette this maps to PalEntry *Palette; // The ideal palette this maps to
FNativePalette *Native; // The Palette stored in a HW texture FNativePalette *Native; // The Palette stored in a HW texture
int NumEntries; // # of elements in this table (usually 256) 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: private:
void Free(); void Free();

View file

@ -527,6 +527,10 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, double x, double y, DWORD tag
case DTA_Translation: case DTA_Translation:
parms->remap = va_arg(tags, FRemapTable *); 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; break;
case DTA_ColorOverlay: case DTA_ColorOverlay: