- Fixed: ZDoom no longer reversed the clipping area on drawbar calls with a

border.
- Fixed: SBarInfo Interpolated aross a new Game.

SVN r2139 (trunk)
This commit is contained in:
Christoph Oelckers 2010-01-28 23:50:20 +00:00
parent 3f140c0549
commit 1f6c915abf
3 changed files with 36 additions and 2 deletions

View file

@ -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);
}

View file

@ -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();

View file

@ -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;