From 8d5d742287f8af7d422d672f9491e4371a1554f1 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 1 Jun 2008 22:41:46 +0000 Subject: [PATCH] - Fixed: Ouch state was far to easy to achieve. SVN r1013 (trunk) --- docs/rh-log.txt | 1 + src/g_doom/doom_sbar.cpp | 4 ++-- src/g_shared/sbar.h | 4 ++-- src/g_shared/sbar_mugshot.cpp | 13 ++++++++++--- src/g_shared/sbarinfo.h | 2 +- src/g_shared/sbarinfo_display.cpp | 4 ++-- src/g_shared/shared_sbar.cpp | 2 +- 7 files changed, 19 insertions(+), 11 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 839b7e4eb..92efe60d3 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,5 @@ June 1, 2008 (Changes by Graf Zahl) +- Fixed: Ouch state was far to easy to achieve. - Made all the basic texture classes local to their implementation. They are not needed anywhere else. - Changed the HackHack hack for corrupt 256 pixel high textures that diff --git a/src/g_doom/doom_sbar.cpp b/src/g_doom/doom_sbar.cpp index 07ae34b0e..eda0f8bf3 100644 --- a/src/g_doom/doom_sbar.cpp +++ b/src/g_doom/doom_sbar.cpp @@ -724,9 +724,9 @@ private: } } - void SetMugShotState (const char *state_name, bool wait_till_done) + void SetMugShotState (const char *state_name, bool wait_till_done, bool reset) { - MugShot.SetState(state_name, wait_till_done); + MugShot.SetState(state_name, wait_till_done, reset); } enum diff --git a/src/g_shared/sbar.h b/src/g_shared/sbar.h index 61cc62b77..7bece26aa 100644 --- a/src/g_shared/sbar.h +++ b/src/g_shared/sbar.h @@ -201,7 +201,7 @@ struct FMugShot { FMugShot(); void Tick(player_t *player); - bool SetState(const char *state_name, bool wait_till_done=false); + bool SetState(const char *state_name, bool wait_till_done=false, bool reset=false); int UpdateState(player_t *player, bool xdeath, bool animated_god_mode); FTexture *GetFace(player_t *player, const char *default_face, int accuracy, bool xdeath, bool animated_god_mode); @@ -293,7 +293,7 @@ public: virtual void ShowPop (int popnum); virtual void ReceivedWeapon (AWeapon *weapon); virtual bool MustDrawLog(EHudState state); - virtual void SetMugShotState (const char *state_name, bool wait_till_done=false); + virtual void SetMugShotState (const char *state_name, bool wait_till_done=false, bool reset=false); void DrawLog(); protected: diff --git a/src/g_shared/sbar_mugshot.cpp b/src/g_shared/sbar_mugshot.cpp index d3aa3786d..65dcd5061 100644 --- a/src/g_shared/sbar_mugshot.cpp +++ b/src/g_shared/sbar_mugshot.cpp @@ -270,13 +270,15 @@ void FMugShot::Tick(player_t *player) // // Sets the mug shot state and resets it if it is not the state we are // already on. Wait_till_done is basically a priority variable; when set to -// true the state won't change unless the previous state is finished. +// true the state won't change unless the previous state is finished. Reset +// overrides the behavior of only switching when the state is not the one we +// are already on. // Returns true if the requested state was switched to or is already playing, // and false if the requested state could not be set. // //=========================================================================== -bool FMugShot::SetState(const char *state_name, bool wait_till_done) +bool FMugShot::SetState(const char *state_name, bool wait_till_done, bool reset) { // Search for full name. FMugShotState *state = FindMugShotState(FName(state_name, true)); @@ -306,6 +308,11 @@ bool FMugShot::SetState(const char *state_name, bool wait_till_done) } return false; } + else if(reset) + { + state->Reset(); + return true; + } return true; } @@ -379,7 +386,7 @@ int FMugShot::UpdateState(player_t *player, bool xdeath, bool animated_god_mode) full_state_name = "pain."; } full_state_name += player->LastDamageType; - if (SetState(full_state_name)) + if (SetState(full_state_name, false, true)) { bDamageFaceActive = (CurrentState != NULL); LastDamageAngle = damage_angle; diff --git a/src/g_shared/sbarinfo.h b/src/g_shared/sbarinfo.h index 36c721c0e..3fbf55ff9 100644 --- a/src/g_shared/sbarinfo.h +++ b/src/g_shared/sbarinfo.h @@ -339,7 +339,7 @@ public: void ReceivedWeapon (AWeapon *weapon); void FlashItem(const PClass *itemtype); void ShowPop(int popnum); - void SetMugShotState(const char* stateName, bool waitTillDone=false); + void SetMugShotState(const char* stateName, bool waitTillDone=false, bool reset=false); private: void doCommands(SBarInfoBlock &block, int xOffset=0, int yOffset=0, int alpha=FRACUNIT); void DrawGraphic(FTexture* texture, int x, int y, int xOffset, int yOffset, int alpha, bool translate=false, bool dim=false, bool center=false); diff --git a/src/g_shared/sbarinfo_display.cpp b/src/g_shared/sbarinfo_display.cpp index bb91e8845..def8ce490 100644 --- a/src/g_shared/sbarinfo_display.cpp +++ b/src/g_shared/sbarinfo_display.cpp @@ -265,9 +265,9 @@ void DSBarInfo::AttachToPlayer (player_t *player) MugShot.CurrentState = NULL; } -void DSBarInfo::SetMugShotState (const char *state_name, bool wait_till_done) +void DSBarInfo::SetMugShotState (const char *state_name, bool wait_till_done, bool reset) { - MugShot.SetState(state_name, wait_till_done); + MugShot.SetState(state_name, wait_till_done, reset); } void DSBarInfo::Tick () diff --git a/src/g_shared/shared_sbar.cpp b/src/g_shared/shared_sbar.cpp index df72de5db..92e9dcdb1 100644 --- a/src/g_shared/shared_sbar.cpp +++ b/src/g_shared/shared_sbar.cpp @@ -1331,7 +1331,7 @@ bool DBaseStatusBar::MustDrawLog(EHudState) return true; } -void DBaseStatusBar::SetMugShotState(const char *stateName, bool waitTillDone) +void DBaseStatusBar::SetMugShotState(const char *stateName, bool waitTillDone, bool reset) { }