From 63e26df7b26f13b8e6b51ec2eb1cd65eafd879c8 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Fri, 7 Aug 2009 04:20:28 +0000 Subject: [PATCH] - 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. SVN r1757 (trunk) --- docs/rh-log.txt | 3 +++ src/d_player.h | 1 + src/g_shared/sbar_mugshot.cpp | 12 +++++++++++- src/thingdef/thingdef_properties.cpp | 9 +++++++++ wadsrc/static/actors/shared/player.txt | 1 + 5 files changed, 25 insertions(+), 1 deletion(-) 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