diff --git a/src/menu/menu.h b/src/menu/menu.h index 55884ab84..f9611433c 100644 --- a/src/menu/menu.h +++ b/src/menu/menu.h @@ -346,6 +346,7 @@ class FListMenuItemPlayerDisplay : public FListMenuItem void SetPlayerClass(int classnum, bool force = false); bool UpdatePlayerClass(); void UpdateRandomClass(); + void UpdateTranslation(); public: diff --git a/src/menu/playerdisplay.cpp b/src/menu/playerdisplay.cpp index ec3f512ce..aa8208004 100644 --- a/src/menu/playerdisplay.cpp +++ b/src/menu/playerdisplay.cpp @@ -48,6 +48,7 @@ #include "gi.h" #include "r_defs.h" #include "r_state.h" +#include "r_data/r_translate.h" //============================================================================= @@ -386,9 +387,33 @@ void FListMenuItemPlayerDisplay::UpdateRandomClass() mPlayerState = GetDefaultByType (mPlayerClass->Type)->SeeState; mPlayerTics = mPlayerState->GetTics(); mRandomTimer = 6; + + // Since the newly displayed class may used a different translation + // range than the old one, we need to update the translation, too. + UpdateTranslation(); } } +//============================================================================= +// +// +// +//============================================================================= + +void FListMenuItemPlayerDisplay::UpdateTranslation() +{ + int PlayerColor = players[consoleplayer].userinfo.color; + int PlayerSkin = players[consoleplayer].userinfo.skin; + int PlayerColorset = players[consoleplayer].userinfo.colorset; + + if (mPlayerClass != NULL) + { + PlayerSkin = R_FindSkin (skins[PlayerSkin].name, int(mPlayerClass - &PlayerClasses[0])); + R_GetPlayerTranslation(PlayerColor, + P_GetPlayerColorSet(mPlayerClass->Type->TypeName, PlayerColorset), + &skins[PlayerSkin], translationtables[TRANSLATION_Players][MAXPLAYERS]); + } +} //============================================================================= // diff --git a/src/menu/playermenu.cpp b/src/menu/playermenu.cpp index 7aa668eaa..99eedfe66 100644 --- a/src/menu/playermenu.cpp +++ b/src/menu/playermenu.cpp @@ -55,8 +55,6 @@ EXTERN_CVAR (Float, autoaim) EXTERN_CVAR(Bool, neverswitchonpickup) EXTERN_CVAR (Bool, cl_run) -void R_GetPlayerTranslation (int color, const FPlayerColorSet *colorset, FPlayerSkin *skin, FRemapTable *table); - //============================================================================= // // Player's name diff --git a/src/r_data/r_translate.cpp b/src/r_data/r_translate.cpp index 10bbc6539..b7f2ca69f 100644 --- a/src/r_data/r_translate.cpp +++ b/src/r_data/r_translate.cpp @@ -1117,4 +1117,3 @@ void R_GetPlayerTranslation (int color, const FPlayerColorSet *colorset, FPlayer R_CreatePlayerTranslation (h, s, v, colorset, skin, table, NULL); } - diff --git a/src/r_data/r_translate.h b/src/r_data/r_translate.h index 21488155b..d61a9a22e 100644 --- a/src/r_data/r_translate.h +++ b/src/r_data/r_translate.h @@ -98,8 +98,8 @@ FRemapTable *TranslationToTable(int translation); void R_InitTranslationTables (void); void R_DeinitTranslationTables(); -// [RH] Actually create a player's translation table. -void R_BuildPlayerTranslation (int player); +void R_BuildPlayerTranslation (int player); // [RH] Actually create a player's translation table. +void R_GetPlayerTranslation (int color, const struct FPlayerColorSet *colorset, class FPlayerSkin *skin, struct FRemapTable *table); extern const BYTE IcePalette[16][3];