diff --git a/docs/rh-log.txt b/docs/rh-log.txt index a3517d101a..07acffe26c 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,7 @@ August 6, 2009 +- Added player MugShotMaxHealth property. Negative values use the player's + max health as the mug shot max health, zero uses 100 as the mug shot max + health, and positive values used directly as the mug shot max health. - Added buddha cheat. - Added TELEFRAG_DAMAGE constant, and changed the two places that still used 1000 as the threshold for god mode damage to use it instead. (Players with diff --git a/src/d_player.h b/src/d_player.h index 0e7b017f42..14ca804090 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -117,6 +117,7 @@ public: int crouchsprite; int MaxHealth; + int MugShotMaxHealth; int RunHealth; int PlayerFlags; TObjPtr InvFirst; // first inventory item displayed on inventory bar diff --git a/src/g_shared/sbar_mugshot.cpp b/src/g_shared/sbar_mugshot.cpp index 28479684dd..c62e7c4d61 100644 --- a/src/g_shared/sbar_mugshot.cpp +++ b/src/g_shared/sbar_mugshot.cpp @@ -40,6 +40,7 @@ #include "d_event.h" #include "sbar.h" #include "sbarinfo.h" +#include "templates.h" #define ST_RAMPAGEDELAY (2*TICRATE) #define ST_MUCHPAIN 20 @@ -476,7 +477,16 @@ FTexture *FMugShot::GetFace(player_t *player, const char *default_face, int accu { int angle = UpdateState(player, stateflags); int level = 0; - while (player->health < (accuracy-1-level) * (player->mo->GetMaxHealth()/accuracy)) + int max = player->mo->MugShotMaxHealth; + if (max < 0) + { + max = player->mo->GetMaxHealth(); + } + else if (max == 0) + { + max = 100; + } + while (player->health < (accuracy - 1 - level) * (max / accuracy)) { level++; } diff --git a/src/thingdef/thingdef_properties.cpp b/src/thingdef/thingdef_properties.cpp index 5c73bb5197..9429a14167 100644 --- a/src/thingdef/thingdef_properties.cpp +++ b/src/thingdef/thingdef_properties.cpp @@ -1860,6 +1860,15 @@ DEFINE_CLASS_PROPERTY_PREFIX(player, maxhealth, I, PlayerPawn) defaults->MaxHealth = z; } +//========================================================================== +// +//========================================================================== +DEFINE_CLASS_PROPERTY_PREFIX(player, mugshotmaxhealth, I, PlayerPawn) +{ + PROP_INT_PARM(z, 0); + defaults->MugShotMaxHealth = z; +} + //========================================================================== // //========================================================================== diff --git a/wadsrc/static/actors/shared/player.txt b/wadsrc/static/actors/shared/player.txt index 618510cc5b..194e58048f 100644 --- a/wadsrc/static/actors/shared/player.txt +++ b/wadsrc/static/actors/shared/player.txt @@ -27,6 +27,7 @@ Actor PlayerPawn : Actor native Player.ColorRange 0,0 Player.SoundClass "player" Player.DamageScreenColor "ff 00 00" + Player.MugShotMaxHealth 0 } Actor PlayerChunk : PlayerPawn native