From 38c9bb1900409a055ebe72d790fd1844f5c365be Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sat, 6 Mar 2010 03:02:24 +0000 Subject: [PATCH] - Setting a Player.ColorRange now completely disables the translation rather than just making it an identity map. SVN r2194 (trunk) --- src/r_draw.cpp | 2 +- src/r_translate.cpp | 5 ++++- src/r_translate.h | 1 + src/v_draw.cpp | 4 ++++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/r_draw.cpp b/src/r_draw.cpp index 12cf3c51f..ce836f839 100644 --- a/src/r_draw.cpp +++ b/src/r_draw.cpp @@ -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; } diff --git a/src/r_translate.cpp b/src/r_translate.cpp index 553d4fcf1..045dc3f41 100644 --- a/src/r_translate.cpp +++ b/src/r_translate.cpp @@ -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(); } diff --git a/src/r_translate.h b/src/r_translate.h index 730dac541..21488155b 100644 --- a/src/r_translate.h +++ b/src/r_translate.h @@ -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(); diff --git a/src/v_draw.cpp b/src/v_draw.cpp index e46a99d12..42b0b5145 100644 --- a/src/v_draw.cpp +++ b/src/v_draw.cpp @@ -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: