From 1f6c915abfff181cd71376c8f00b1f01c0a1cf1c Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 28 Jan 2010 23:50:20 +0000 Subject: [PATCH] - Fixed: ZDoom no longer reversed the clipping area on drawbar calls with a border. - Fixed: SBarInfo Interpolated aross a new Game. SVN r2139 (trunk) --- src/g_shared/sbarinfo.cpp | 21 +++++++++++++++++++-- src/g_shared/sbarinfo.h | 1 + src/g_shared/sbarinfo_commands.cpp | 16 ++++++++++++++++ 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/src/g_shared/sbarinfo.cpp b/src/g_shared/sbarinfo.cpp index ccc8ff4af..1344ad1c0 100644 --- a/src/g_shared/sbarinfo.cpp +++ b/src/g_shared/sbarinfo.cpp @@ -156,6 +156,7 @@ class SBarInfoCommand virtual void Draw(const SBarInfoMainBlock *block, const DSBarInfo *statusBar)=0; virtual void Parse(FScanner &sc, bool fullScreenOffsets)=0; + virtual void Reset() {} virtual void Tick(const SBarInfoMainBlock *block, const DSBarInfo *statusBar, bool hudChanged) {} protected: @@ -235,6 +236,11 @@ class SBarInfoCommandFlowControl : public SBarInfoCommand commands.Push(cmd); } } + void Reset() + { + for(unsigned int i = 0;i < commands.Size();i++) + commands[i]->Reset(); + } void Tick(const SBarInfoMainBlock *block, const DSBarInfo *statusBar, bool hudChanged) { for(unsigned int i = 0;i < commands.Size();i++) @@ -653,6 +659,12 @@ void SBarInfo::ParseMugShotBlock(FScanner &sc, FMugShotState &state) } } +void SBarInfo::ResetHuds() +{ + for(int i = 0;i < NUMHUDS;i++) + huds[i]->Reset(); +} + int SBarInfo::newImage(const char *patchname) { if(patchname[0] == '\0' || stricmp(patchname, "nullimage") == 0) @@ -823,7 +835,7 @@ class DSBarInfo : public DBaseStatusBar public: DSBarInfo (SBarInfo *script=NULL) : DBaseStatusBar(script->height), ammo1(NULL), ammo2(NULL), ammocount1(0), ammocount2(0), armor(NULL), - pendingPopup(POP_None), currentPopup(POP_None), lastHud(0), + pendingPopup(POP_None), currentPopup(POP_None), lastHud(-1), lastInventoryBar(NULL), lastPopup(NULL) { this->script = script; @@ -944,6 +956,10 @@ public: if (CPlayer != NULL) { AttachToPlayer (CPlayer); + + // Reset the huds + script->ResetHuds(); + lastHud = -1; // Reset } } @@ -970,7 +986,8 @@ public: if (lastPopup != NULL) lastPopup->Tick(NULL, this, false); } - script->huds[lastHud]->Tick(NULL, this, false); + if(lastHud != -1) + script->huds[lastHud]->Tick(NULL, this, false); if(lastInventoryBar != NULL && CPlayer->inventorytics > 0) lastInventoryBar->Tick(NULL, this, false); } diff --git a/src/g_shared/sbarinfo.h b/src/g_shared/sbarinfo.h index b10eb440b..6fd7b1f0c 100644 --- a/src/g_shared/sbarinfo.h +++ b/src/g_shared/sbarinfo.h @@ -97,6 +97,7 @@ struct SBarInfo int GetGameType() { return gameType; } void ParseSBarInfo(int lump); void ParseMugShotBlock(FScanner &sc, FMugShotState &state); + void ResetHuds(); int newImage(const char* patchname); void Init(); SBarInfo(); diff --git a/src/g_shared/sbarinfo_commands.cpp b/src/g_shared/sbarinfo_commands.cpp index 063f9ac3a..a19471464 100644 --- a/src/g_shared/sbarinfo_commands.cpp +++ b/src/g_shared/sbarinfo_commands.cpp @@ -725,6 +725,10 @@ class CommandDrawNumber : public CommandDrawString else if(value == ARMOR) interpolationSpeed = script->interpolateArmor ? script->armorInterpolationSpeed : interpolationSpeed; } + void Reset() + { + drawValue = 0; + } void Tick(const SBarInfoMainBlock *block, const DSBarInfo *statusBar, bool hudChanged) { int num = valueArgument; @@ -1887,6 +1891,10 @@ class CommandDrawBar : public SBarInfoCommand { sc.MustGetToken(TK_IntConst); border = sc.Number; + + // Flip the direction since it represents the area to clip + if(border != 0) + reverse = !reverse; } sc.MustGetToken(';'); @@ -1895,6 +1903,10 @@ class CommandDrawBar : public SBarInfoCommand else if(type == ARMOR) interpolationSpeed = script->interpolateArmor ? script->armorInterpolationSpeed : interpolationSpeed; } + void Reset() + { + drawValue = 0; + } void Tick(const SBarInfoMainBlock *block, const DSBarInfo *statusBar, bool hudChanged) { fixed_t value = 0; @@ -2300,6 +2312,10 @@ class CommandDrawGem : public SBarInfoCommand else interpolationSpeed = script->interpolateArmor ? script->armorInterpolationSpeed : interpolationSpeed; } + void Reset() + { + drawValue = 0; + } void Tick(const SBarInfoMainBlock *block, const DSBarInfo *statusBar, bool hudChanged) { goalValue = armor ? statusBar->armor->Amount : statusBar->CPlayer->mo->health;