From 262f3575aed8a101d96490cf350bf3a1b43cb82e Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 27 Apr 2016 13:16:35 +0200 Subject: [PATCH] - added a "custom" flag to drawmugshot so that the user-specified image can be forced to be used. --- src/g_shared/sbar.h | 1 + src/g_shared/sbar_mugshot.cpp | 2 +- src/g_shared/sbarinfo_commands.cpp | 30 ++++++++++++++++-------------- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/g_shared/sbar.h b/src/g_shared/sbar.h index 560a7500a..03901f66f 100644 --- a/src/g_shared/sbar.h +++ b/src/g_shared/sbar.h @@ -264,6 +264,7 @@ class FMugShot DISABLEOUCH = 0x8, DISABLEPAIN = 0x10, DISABLERAMPAGE = 0x20, + CUSTOM = 0x40, }; FMugShot(); diff --git a/src/g_shared/sbar_mugshot.cpp b/src/g_shared/sbar_mugshot.cpp index b26541c99..148b7cb32 100644 --- a/src/g_shared/sbar_mugshot.cpp +++ b/src/g_shared/sbar_mugshot.cpp @@ -489,7 +489,7 @@ FTexture *FMugShot::GetFace(player_t *player, const char *default_face, int accu if (CurrentState != NULL) { int skin = player->userinfo.GetSkin(); - const char *skin_face = player->morphTics ? player->MorphedPlayerClass->Face.GetChars() : skins[skin].face; + const char *skin_face = (stateflags & FMugShot::CUSTOM) ? nullptr : (player->morphTics ? player->MorphedPlayerClass->Face.GetChars() : skins[skin].face); return CurrentState->GetCurrentFrameTexture(default_face, skin_face, level, angle); } return NULL; diff --git a/src/g_shared/sbarinfo_commands.cpp b/src/g_shared/sbarinfo_commands.cpp index 26b4c9510..854cb4106 100644 --- a/src/g_shared/sbarinfo_commands.cpp +++ b/src/g_shared/sbarinfo_commands.cpp @@ -1578,23 +1578,25 @@ class CommandDrawMugShot : public SBarInfoCommand sc.ScriptError("Expected a number between 1 and 9, got %d instead.", sc.Number); accuracy = sc.Number; sc.MustGetToken(','); - while(sc.CheckToken(TK_Identifier)) + while (sc.CheckToken(TK_Identifier)) { - if(sc.Compare("xdeathface")) - stateFlags = static_cast (stateFlags|FMugShot::XDEATHFACE); - else if(sc.Compare("animatedgodmode")) - stateFlags = static_cast (stateFlags|FMugShot::ANIMATEDGODMODE); - else if(sc.Compare("disablegrin")) - stateFlags = static_cast (stateFlags|FMugShot::DISABLEGRIN); - else if(sc.Compare("disableouch")) - stateFlags = static_cast (stateFlags|FMugShot::DISABLEOUCH); - else if(sc.Compare("disablepain")) - stateFlags = static_cast (stateFlags|FMugShot::DISABLEPAIN); - else if(sc.Compare("disablerampage")) - stateFlags = static_cast (stateFlags|FMugShot::DISABLERAMPAGE); + if (sc.Compare("xdeathface")) + stateFlags = static_cast (stateFlags | FMugShot::XDEATHFACE); + else if (sc.Compare("animatedgodmode")) + stateFlags = static_cast (stateFlags | FMugShot::ANIMATEDGODMODE); + else if (sc.Compare("disablegrin")) + stateFlags = static_cast (stateFlags | FMugShot::DISABLEGRIN); + else if (sc.Compare("disableouch")) + stateFlags = static_cast (stateFlags | FMugShot::DISABLEOUCH); + else if (sc.Compare("disablepain")) + stateFlags = static_cast (stateFlags | FMugShot::DISABLEPAIN); + else if (sc.Compare("disablerampage")) + stateFlags = static_cast (stateFlags | FMugShot::DISABLERAMPAGE); + else if (sc.Compare("custom")) + stateFlags = static_cast (stateFlags | FMugShot::CUSTOM); else sc.ScriptError("Unknown flag '%s'.", sc.String); - if(!sc.CheckToken('|')) + if (!sc.CheckToken('|')) sc.MustGetToken(','); }