From e4be782e143da2741f80966003abc37d0ed56a0a Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 6 Mar 2010 16:24:09 +0000 Subject: [PATCH] - check player translations for identity maps during creation. - fixed: When creating the initial identity translation for player translations the global palette remapping was not taken into account. SVN r2200 (trunk) --- src/r_translate.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/r_translate.cpp b/src/r_translate.cpp index 045dc3f41..d5ef79a1f 100644 --- a/src/r_translate.cpp +++ b/src/r_translate.cpp @@ -918,7 +918,7 @@ static void R_CreatePlayerTranslation (float h, float s, float v, const FPlayerC { for (i = 0; i < table->NumEntries; ++i) { - table->Remap[i] = i; + table->Remap[i] = GPalette.Remap[i]; } memcpy(table->Palette, GPalette.BaseColors, sizeof(*table->Palette) * table->NumEntries); } @@ -935,6 +935,7 @@ static void R_CreatePlayerTranslation (float h, float s, float v, const FPlayerC return; } + table->Inactive = false; range = (float)(end-start+1); bases = s; @@ -947,6 +948,7 @@ static void R_CreatePlayerTranslation (float h, float s, float v, const FPlayerC if (colorset != NULL) { + bool identity = true; // Use the pre-defined range instead of a custom one. if (colorset->Lump < 0) { @@ -960,7 +962,9 @@ static void R_CreatePlayerTranslation (float h, float s, float v, const FPlayerC int palrange = colorset->LastColor - first; for (i = start; i <= end; ++i) { - table->Remap[i] = GPalette.Remap[first + palrange * (i - start) / (end - start)]; + int pi = first + palrange * (i - start) / (end - start); + table->Remap[i] = GPalette.Remap[pi]; + if (pi != i) identity = false; } } } @@ -971,6 +975,7 @@ static void R_CreatePlayerTranslation (float h, float s, float v, const FPlayerC for (i = start; i <= end; ++i) { table->Remap[i] = GPalette.Remap[trans[i]]; + if (trans[i] != i) identity = false; } } for (i = start; i <= end; ++i) @@ -978,6 +983,8 @@ static void R_CreatePlayerTranslation (float h, float s, float v, const FPlayerC table->Palette[i] = GPalette.BaseColors[table->Remap[i]]; table->Palette[i].a = 255; } + // If the colorset created an identity translation mark it as inactive + table->Inactive = identity; } else if (gameinfo.gametype & GAME_DoomStrifeChex) { @@ -1083,7 +1090,6 @@ static void R_CreatePlayerTranslation (float h, float s, float v, const FPlayerC } alttable->UpdateNative(); } - table->Inactive = false; table->UpdateNative(); }