- Replaced all instances of "flags +=" in sbarinfo_parser.cpp with "flags |="

so that using the same flag multiple times will not have unexpected results.
- sbarinfo update #21
  * Added: sigil image type to correctly draw the sigil's icon.
  * Added: Strife inventory bar style.  This is the only style that is radically
    different from the others.  First of all it changes the SELECTBO to be
    INVCURS and draws it before the icons.  Each box is changed to have a width
    of 35 pixels instead of 31 pixels.  And the INVCURS graphic is drawn at
    (x-6, y-2).
  * Added: whennnotzero flag to drawnumber which will cause it to draw nothing if
    the value is 0.
  * Fixed: New mugshot code would not leave the god state when it was supposed to
    enter the rampage state.
  * Fixed: The ouch state was mostly broken.


SVN r981 (trunk)
This commit is contained in:
Randy Heit 2008-05-19 23:07:08 +00:00
parent 35ea94c014
commit 01e1295c50
5 changed files with 183 additions and 106 deletions

View file

@ -1,3 +1,20 @@
May 19, 2008
- Replaced all instances of "flags +=" in sbarinfo_parser.cpp with "flags |="
so that using the same flag multiple times will not have unexpected results.
May 19, 2008 (sbarinfo update #21)
- Added: sigil image type to correctly draw the sigil's icon.
- Added: Strife inventory bar style. This is the only style that is radically
different from the others. First of all it changes the SELECTBO to be
INVCURS and draws it before the icons. Each box is changed to have a width
of 35 pixels instead of 31 pixels. And the INVCURS graphic is drawn at
(x-6, y-2).
- Added: whennnotzero flag to drawnumber which will cause it to draw nothing if
the value is 0.
- Fixed: New mugshot code would not leave the god state when it was supposed to
enter the rampage state.
- Fixed: The ouch state was mostly broken.
May 18, 2008 (SBarInfo Update #20) May 18, 2008 (SBarInfo Update #20)
- Added: hasweaponpiece command to check for custom weapon pieces. - Added: hasweaponpiece command to check for custom weapon pieces.
- Added: usessecondaryammo command to check if the current weapon has a second - Added: usessecondaryammo command to check if the current weapon has a second

View file

@ -53,7 +53,9 @@ public:
DoCommonInit (); DoCommonInit ();
bEvilGrin = false; bEvilGrin = false;
bNormal = true;
bDamageFaceActive = false; bDamageFaceActive = false;
bOuchActive = false;
CurrentState = NULL; CurrentState = NULL;
RampageTimer = 0; RampageTimer = 0;
LastDamageAngle = 1; LastDamageAngle = 1;
@ -115,7 +117,11 @@ public:
{ {
CurrentState->tick(); CurrentState->tick();
if(CurrentState->finished) if(CurrentState->finished)
{
bNormal = true;
bOuchActive = false;
CurrentState = NULL; CurrentState = NULL;
}
} }
if((CPlayer->cmd.ucmd.buttons & (BT_ATTACK|BT_ALTATTACK)) && !(CPlayer->cheats & (CF_FROZEN | CF_TOTALLYFROZEN))) if((CPlayer->cmd.ucmd.buttons & (BT_ATTACK|BT_ALTATTACK)) && !(CPlayer->cheats & (CF_FROZEN | CF_TOTALLYFROZEN)))
{ {
@ -168,6 +174,8 @@ public:
//See sbarinfo_display.cpp //See sbarinfo_display.cpp
void SetMugShotState (const char* stateName, bool waitTillDone=false) void SetMugShotState (const char* stateName, bool waitTillDone=false)
{ {
bNormal = false; //Assume we are not setting god or normal for now.
bOuchActive = false;
MugShotState *state = (MugShotState *) FindMugShotState(stateName); MugShotState *state = (MugShotState *) FindMugShotState(stateName);
if(state != CurrentState) if(state != CurrentState)
{ {
@ -792,9 +800,13 @@ private:
} }
} }
} }
bool useOuch = false;
const char* stateName = new char[5]; const char* stateName = new char[5];
if (FaceHealth != -1 && CPlayer->health - FaceHealth > 20) if ((FaceHealth != -1 && CPlayer->health - FaceHealth > 20) || bOuchActive)
{
useOuch = true;
stateName = "ouch"; stateName = "ouch";
}
else else
stateName = "pain"; stateName = "pain";
char* fullStateName = new char[sizeof(stateName)+sizeof((const char*) CPlayer->LastDamageType) + 1]; char* fullStateName = new char[sizeof(stateName)+sizeof((const char*) CPlayer->LastDamageType) + 1];
@ -805,6 +817,7 @@ private:
SetMugShotState(stateName); SetMugShotState(stateName);
bDamageFaceActive = !(CurrentState == NULL); bDamageFaceActive = !(CurrentState == NULL);
LastDamageAngle = damageAngle; LastDamageAngle = damageAngle;
bOuchActive = useOuch;
return damageAngle; return damageAngle;
} }
if(bDamageFaceActive) if(bDamageFaceActive)
@ -813,9 +826,13 @@ private:
bDamageFaceActive = false; bDamageFaceActive = false;
else else
{ {
bool useOuch = false;
const char* stateName = new char[5]; const char* stateName = new char[5];
if (FaceHealth != -1 && CPlayer->health - FaceHealth > 20) if ((FaceHealth != -1 && CPlayer->health - FaceHealth > 20) || bOuchActive)
{
useOuch = true;
stateName = "ouch"; stateName = "ouch";
}
else else
stateName = "pain"; stateName = "pain";
char* fullStateName = new char[sizeof(stateName)+sizeof((const char*) CPlayer->LastDamageType) + 1]; char* fullStateName = new char[sizeof(stateName)+sizeof((const char*) CPlayer->LastDamageType) + 1];
@ -824,22 +841,24 @@ private:
SetMugShotState(fullStateName); SetMugShotState(fullStateName);
else else
SetMugShotState(stateName); SetMugShotState(stateName);
bOuchActive = useOuch;
return LastDamageAngle; return LastDamageAngle;
} }
} }
if(RampageTimer == ST_RAMPAGEDELAY) if(RampageTimer == ST_RAMPAGEDELAY)
{ {
SetMugShotState("rampage", true); SetMugShotState("rampage", !bNormal); //If we have nothing better to show use the rampage face.
return 0; return 0;
} }
if(!bEvilGrin) if(bNormal)
{ {
if((CPlayer->cheats & CF_GODMODE) || (CPlayer->mo != NULL && CPlayer->mo->flags2 & MF2_INVULNERABLE)) if((CPlayer->cheats & CF_GODMODE) || (CPlayer->mo != NULL && CPlayer->mo->flags2 & MF2_INVULNERABLE))
SetMugShotState("god"); SetMugShotState("god");
else else
SetMugShotState("normal"); SetMugShotState("normal");
bNormal = true; //SetMugShotState sets bNormal to false.
} }
} }
else else
@ -946,6 +965,8 @@ private:
int FaceHealth; int FaceHealth;
bool bEvilGrin; bool bEvilGrin;
bool bDamageFaceActive; bool bDamageFaceActive;
bool bNormal;
bool bOuchActive;
}; };
IMPLEMENT_CLASS(DDoomStatusBar) IMPLEMENT_CLASS(DDoomStatusBar)

View file

@ -216,6 +216,7 @@ enum //drawimage flags
DRAWIMAGE_OFFSET_CENTER = 256, DRAWIMAGE_OFFSET_CENTER = 256,
DRAWIMAGE_ARMOR = 512, DRAWIMAGE_ARMOR = 512,
DRAWIMAGE_WEAPONICON = 1024, DRAWIMAGE_WEAPONICON = 1024,
DRAWIMAGE_SIGIL = 2048,
}; };
enum //drawnumber flags enum //drawnumber flags
@ -238,6 +239,7 @@ enum //drawnumber flags
DRAWNUMBER_GLOBALVAR = 0x8000, DRAWNUMBER_GLOBALVAR = 0x8000,
DRAWNUMBER_GLOBALARRAY = 0x10000, DRAWNUMBER_GLOBALARRAY = 0x10000,
DRAWNUMBER_FILLZEROS = 0x20000, DRAWNUMBER_FILLZEROS = 0x20000,
DRAWNUMBER_WHENNOTZERO = 0x40000,
}; };
enum //drawbar flags (will go into special2) enum //drawbar flags (will go into special2)
@ -399,6 +401,8 @@ private:
MugShotState *currentState; MugShotState *currentState;
bool weaponGrin; bool weaponGrin;
bool damageFaceActive; bool damageFaceActive;
bool mugshotNormal;
bool ouchActive;
int lastDamageAngle; int lastDamageAngle;
int rampageTimer; int rampageTimer;
int oldHealth; int oldHealth;

View file

@ -53,6 +53,7 @@
#include "r_translate.h" #include "r_translate.h"
#include "r_main.h" #include "r_main.h"
#include "a_weaponpiece.h" #include "a_weaponpiece.h"
#include "a_strifeglobal.h"
static FRandom pr_chainwiggle; //use the same method of chain wiggling as heretic. static FRandom pr_chainwiggle; //use the same method of chain wiggling as heretic.
@ -66,6 +67,7 @@ enum
{ {
imgARTIBOX, imgARTIBOX,
imgSELECTBOX, imgSELECTBOX,
imgCURSOR,
imgINVLFGEM1, imgINVLFGEM1,
imgINVLFGEM2, imgINVLFGEM2,
imgINVRTGEM1, imgINVRTGEM1,
@ -234,7 +236,7 @@ DSBarInfo::DSBarInfo () : DBaseStatusBar (SBarInfoScript->height),
{ {
static const char *InventoryBarLumps[] = static const char *InventoryBarLumps[] =
{ {
"ARTIBOX", "SELECTBO", "INVGEML1", "ARTIBOX", "SELECTBO", "INVCURS", "INVGEML1",
"INVGEML2", "INVGEMR1", "INVGEMR2", "INVGEML2", "INVGEMR1", "INVGEMR2",
"USEARTIA", "USEARTIB", "USEARTIC", "USEARTID", "USEARTIA", "USEARTIB", "USEARTIC", "USEARTID",
}; };
@ -263,6 +265,8 @@ DSBarInfo::DSBarInfo () : DBaseStatusBar (SBarInfoScript->height),
lastPrefix = ""; lastPrefix = "";
weaponGrin = false; weaponGrin = false;
damageFaceActive = false; damageFaceActive = false;
mugshotNormal = true;
ouchActive = false;
lastDamageAngle = 1; lastDamageAngle = 1;
chainWiggle = 0; chainWiggle = 0;
artiflash = 4; artiflash = 4;
@ -401,7 +405,11 @@ void DSBarInfo::Tick ()
{ {
currentState->tick(); currentState->tick();
if(currentState->finished) if(currentState->finished)
{
ouchActive = false;
mugshotNormal = true;
currentState = NULL; currentState = NULL;
}
} }
if((CPlayer->cmd.ucmd.buttons & (BT_ATTACK|BT_ALTATTACK)) && !(CPlayer->cheats & (CF_FROZEN | CF_TOTALLYFROZEN))) if((CPlayer->cmd.ucmd.buttons & (BT_ATTACK|BT_ALTATTACK)) && !(CPlayer->cheats & (CF_FROZEN | CF_TOTALLYFROZEN)))
{ {
@ -462,6 +470,8 @@ void DSBarInfo::ShowPop(int popnum)
//waitTillDone is basically a priority variable when just to true the state won't change unless the previous state is finished. //waitTillDone is basically a priority variable when just to true the state won't change unless the previous state is finished.
void DSBarInfo::SetMugShotState(const char* stateName, bool waitTillDone) void DSBarInfo::SetMugShotState(const char* stateName, bool waitTillDone)
{ {
mugshotNormal = false;
ouchActive = false;
MugShotState *state = (MugShotState *) FindMugShotState(stateName); MugShotState *state = (MugShotState *) FindMugShotState(stateName);
if(state != currentState) if(state != currentState)
{ {
@ -583,6 +593,12 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset, int a
texture = TexMan[weapon->Icon]; texture = TexMan[weapon->Icon];
} }
} }
else if(cmd.flags & DRAWIMAGE_SIGIL)
{
AInventory *item = CPlayer->mo->FindInventory<ASigil>();
if (item != NULL)
texture = TexMan[item->Icon];
}
else if((cmd.flags & DRAWIMAGE_INVENTORYICON)) else if((cmd.flags & DRAWIMAGE_INVENTORYICON))
texture = TexMan[cmd.sprite]; texture = TexMan[cmd.sprite];
else if(cmd.sprite != -1) else if(cmd.sprite != -1)
@ -703,6 +719,8 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset, int a
translation = cmd.translation2; translation = cmd.translation2;
else if(cmd.special4 != -1 && value >= cmd.special4) //high else if(cmd.special4 != -1 && value >= cmd.special4) //high
translation = cmd.translation3; translation = cmd.translation3;
if((cmd.flags & DRAWNUMBER_WHENNOTZERO) && value == 0)
break;
DrawNumber(value, cmd.special, cmd.x, cmd.y, xOffset, yOffset, alpha, translation, cmd.special2, fillzeros); DrawNumber(value, cmd.special, cmd.x, cmd.y, xOffset, yOffset, alpha, translation, cmd.special2, fillzeros);
break; break;
} }
@ -1401,9 +1419,13 @@ int DSBarInfo::updateState(bool xdth, bool animatedgodmode)
} }
} }
} }
bool setOuch = false;
const char* stateName = new char[5]; const char* stateName = new char[5];
if (mugshotHealth != -1 && CPlayer->health - mugshotHealth > 20) if ((mugshotHealth != -1 && CPlayer->health - mugshotHealth > 20) || ouchActive)
{
setOuch = true;
stateName = "ouch"; stateName = "ouch";
}
else else
stateName = "pain"; stateName = "pain";
char* fullStateName = new char[sizeof(stateName)+sizeof((const char*) CPlayer->LastDamageType) + 1]; char* fullStateName = new char[sizeof(stateName)+sizeof((const char*) CPlayer->LastDamageType) + 1];
@ -1414,6 +1436,7 @@ int DSBarInfo::updateState(bool xdth, bool animatedgodmode)
SetMugShotState(stateName); SetMugShotState(stateName);
damageFaceActive = !(currentState == NULL); damageFaceActive = !(currentState == NULL);
lastDamageAngle = damageAngle; lastDamageAngle = damageAngle;
ouchActive = setOuch;
return damageAngle; return damageAngle;
} }
if(damageFaceActive) if(damageFaceActive)
@ -1422,9 +1445,13 @@ int DSBarInfo::updateState(bool xdth, bool animatedgodmode)
damageFaceActive = false; damageFaceActive = false;
else else
{ {
bool setOuch = false;
const char* stateName = new char[5]; const char* stateName = new char[5];
if (mugshotHealth != -1 && CPlayer->health - mugshotHealth > 20) if ((mugshotHealth != -1 && CPlayer->health - mugshotHealth > 20) || ouchActive)
{
setOuch = true;
stateName = "ouch"; stateName = "ouch";
}
else else
stateName = "pain"; stateName = "pain";
char* fullStateName = new char[sizeof(stateName)+sizeof((const char*) CPlayer->LastDamageType) + 1]; char* fullStateName = new char[sizeof(stateName)+sizeof((const char*) CPlayer->LastDamageType) + 1];
@ -1433,17 +1460,18 @@ int DSBarInfo::updateState(bool xdth, bool animatedgodmode)
SetMugShotState(fullStateName); SetMugShotState(fullStateName);
else else
SetMugShotState(stateName); SetMugShotState(stateName);
ouchActive = setOuch;
return lastDamageAngle; return lastDamageAngle;
} }
} }
if(rampageTimer == ST_RAMPAGETIME) if(rampageTimer == ST_RAMPAGETIME)
{ {
SetMugShotState("rampage", true); SetMugShotState("rampage", !mugshotNormal);
return 0; return 0;
} }
if(!weaponGrin) if(mugshotNormal)
{ {
if((CPlayer->cheats & CF_GODMODE) || (CPlayer->mo != NULL && CPlayer->mo->flags2 & MF2_INVULNERABLE)) if((CPlayer->cheats & CF_GODMODE) || (CPlayer->mo != NULL && CPlayer->mo->flags2 & MF2_INVULNERABLE))
{ {
@ -1454,6 +1482,7 @@ int DSBarInfo::updateState(bool xdth, bool animatedgodmode)
} }
else else
SetMugShotState("normal"); SetMugShotState("normal");
mugshotNormal = true; //SetMugShotState sets this to false
} }
} }
else else
@ -1479,6 +1508,7 @@ void DSBarInfo::DrawInventoryBar(int type, int num, int x, int y, int xOffset, i
{ //yes, there is some Copy & Paste here too { //yes, there is some Copy & Paste here too
AInventory *item; AInventory *item;
int i; int i;
int spacing = (type != GAME_Strife) ? 31 : 35;
// If the player has no artifacts, don't draw the bar // If the player has no artifacts, don't draw the bar
CPlayer->mo->InvFirst = ValidateInvFirst(num); CPlayer->mo->InvFirst = ValidateInvFirst(num);
@ -1488,13 +1518,10 @@ void DSBarInfo::DrawInventoryBar(int type, int num, int x, int y, int xOffset, i
{ {
if(drawArtiboxes) if(drawArtiboxes)
{ {
DrawGraphic(Images[invBarOffset + imgARTIBOX], x+i*31, y, xOffset, yOffset, alpha); DrawGraphic(Images[invBarOffset + imgARTIBOX], x+i*spacing, y, xOffset, yOffset, alpha);
}
DrawGraphic(TexMan(item->Icon), x+i*31, y, xOffset, yOffset, alpha, false, item->Amount <= 0);
if(alwaysshowcounter || item->Amount != 1)
{
DrawNumber(item->Amount, 3, counterx+i*31, countery, xOffset, yOffset, alpha, translation);
} }
if(type != GAME_Strife) //Strife draws the cursor before the icons
DrawGraphic(TexMan(item->Icon), x+i*spacing, y, xOffset, yOffset, alpha, false, item->Amount <= 0);
if(item == CPlayer->mo->InvSel) if(item == CPlayer->mo->InvSel)
{ {
if(type == GAME_Heretic) if(type == GAME_Heretic)
@ -1505,27 +1532,37 @@ void DSBarInfo::DrawInventoryBar(int type, int num, int x, int y, int xOffset, i
{ {
DrawGraphic(Images[invBarOffset + imgSELECTBOX], x+i*31, y-1, xOffset, yOffset, alpha); DrawGraphic(Images[invBarOffset + imgSELECTBOX], x+i*31, y-1, xOffset, yOffset, alpha);
} }
else if(type == GAME_Strife)
{
DrawGraphic(Images[invBarOffset + imgCURSOR], x+i*35-6, y-2, xOffset, yOffset, alpha);
}
else else
{ {
DrawGraphic(Images[invBarOffset + imgSELECTBOX], x+i*31, y, xOffset, yOffset, alpha); DrawGraphic(Images[invBarOffset + imgSELECTBOX], x+i*31, y, xOffset, yOffset, alpha);
} }
} }
if(type == GAME_Strife)
DrawGraphic(TexMan(item->Icon), x+i*spacing, y, xOffset, yOffset, alpha, false, item->Amount <= 0);
if(alwaysshowcounter || item->Amount != 1)
{
DrawNumber(item->Amount, 3, counterx+i*spacing, countery, xOffset, yOffset, alpha, translation);
}
} }
for (; i < num && drawArtiboxes; ++i) for (; i < num && drawArtiboxes; ++i)
{ {
DrawGraphic(Images[invBarOffset + imgARTIBOX], x+i*31, y, xOffset, yOffset, alpha); DrawGraphic(Images[invBarOffset + imgARTIBOX], x+i*spacing, y, xOffset, yOffset, alpha);
} }
// Is there something to the left? // Is there something to the left?
if (!noArrows && CPlayer->mo->FirstInv() != CPlayer->mo->InvFirst) if (!noArrows && CPlayer->mo->FirstInv() != CPlayer->mo->InvFirst)
{ {
DrawGraphic(Images[!(gametic & 4) ? DrawGraphic(Images[!(gametic & 4) ?
invBarOffset + imgINVLFGEM1 : invBarOffset + imgINVLFGEM2], x-12, y, xOffset, yOffset, alpha); invBarOffset + imgINVLFGEM1 : invBarOffset + imgINVLFGEM2], (type != GAME_Strife) ? x-12 : x-14, y, xOffset, yOffset, alpha);
} }
// Is there something to the right? // Is there something to the right?
if (!noArrows && item != NULL) if (!noArrows && item != NULL)
{ {
DrawGraphic(Images[!(gametic & 4) ? DrawGraphic(Images[!(gametic & 4) ?
invBarOffset + imgINVRTGEM1 : invBarOffset + imgINVRTGEM2], x+num*31+2, y, xOffset, yOffset, alpha); invBarOffset + imgINVRTGEM1 : invBarOffset + imgINVRTGEM2], (type != GAME_Strife) ? x+num*31+2 : x+num*35-4, y, xOffset, yOffset, alpha);
} }
} }
} }

View file

@ -397,7 +397,7 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
} }
if(sc.CheckToken(TK_AndAnd)) if(sc.CheckToken(TK_AndAnd))
{ {
cmd.flags += DRAWIMAGE_SWITCHABLE_AND; cmd.flags |= DRAWIMAGE_SWITCHABLE_AND;
sc.MustGetToken(TK_Identifier); sc.MustGetToken(TK_Identifier);
cmd.setString(sc, sc.String, 1); cmd.setString(sc, sc.String, 1);
const PClass* item = PClass::FindClass(sc.String); const PClass* item = PClass::FindClass(sc.String);
@ -430,23 +430,25 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
{ {
getImage = false; getImage = false;
if(sc.Compare("playericon")) if(sc.Compare("playericon"))
cmd.flags += DRAWIMAGE_PLAYERICON; cmd.flags |= DRAWIMAGE_PLAYERICON;
else if(sc.Compare("ammoicon1")) else if(sc.Compare("ammoicon1"))
cmd.flags += DRAWIMAGE_AMMO1; cmd.flags |= DRAWIMAGE_AMMO1;
else if(sc.Compare("ammoicon2")) else if(sc.Compare("ammoicon2"))
cmd.flags += DRAWIMAGE_AMMO2; cmd.flags |= DRAWIMAGE_AMMO2;
else if(sc.Compare("armoricon")) else if(sc.Compare("armoricon"))
cmd.flags += DRAWIMAGE_ARMOR; cmd.flags |= DRAWIMAGE_ARMOR;
else if(sc.Compare("weaponicon")) else if(sc.Compare("weaponicon"))
cmd.flags += DRAWIMAGE_WEAPONICON; cmd.flags |= DRAWIMAGE_WEAPONICON;
else if(sc.Compare("sigil"))
cmd.flags |= DRAWIMAGE_SIGIL;
else if(sc.Compare("translatable")) else if(sc.Compare("translatable"))
{ {
cmd.flags += DRAWIMAGE_TRANSLATABLE; cmd.flags |= DRAWIMAGE_TRANSLATABLE;
getImage = true; getImage = true;
} }
else else
{ {
cmd.flags += DRAWIMAGE_INVENTORYICON; cmd.flags |= DRAWIMAGE_INVENTORYICON;
const PClass* item = PClass::FindClass(sc.String); const PClass* item = PClass::FindClass(sc.String);
if(item == NULL || !PClass::FindClass("Inventory")->IsAncestorOf(item)) //must be a kind of Inventory if(item == NULL || !PClass::FindClass("Inventory")->IsAncestorOf(item)) //must be a kind of Inventory
{ {
@ -466,7 +468,7 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
{ {
sc.MustGetToken(TK_Identifier); sc.MustGetToken(TK_Identifier);
if(sc.Compare("center")) if(sc.Compare("center"))
cmd.flags += DRAWIMAGE_OFFSET_CENTER; cmd.flags |= DRAWIMAGE_OFFSET_CENTER;
else else
sc.ScriptError("Expected 'center' got '%s' instead.", sc.String); sc.ScriptError("Expected 'center' got '%s' instead.", sc.String);
} }
@ -527,22 +529,22 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
else if(sc.Compare("frags")) else if(sc.Compare("frags"))
cmd.flags = DRAWNUMBER_FRAGS; cmd.flags = DRAWNUMBER_FRAGS;
else if(sc.Compare("kills")) else if(sc.Compare("kills"))
cmd.flags += DRAWNUMBER_KILLS; cmd.flags |= DRAWNUMBER_KILLS;
else if(sc.Compare("monsters")) else if(sc.Compare("monsters"))
cmd.flags += DRAWNUMBER_MONSTERS; cmd.flags |= DRAWNUMBER_MONSTERS;
else if(sc.Compare("items")) else if(sc.Compare("items"))
cmd.flags += DRAWNUMBER_ITEMS; cmd.flags |= DRAWNUMBER_ITEMS;
else if(sc.Compare("totalitems")) else if(sc.Compare("totalitems"))
cmd.flags += DRAWNUMBER_TOTALITEMS; cmd.flags |= DRAWNUMBER_TOTALITEMS;
else if(sc.Compare("secrets")) else if(sc.Compare("secrets"))
cmd.flags += DRAWNUMBER_SECRETS; cmd.flags |= DRAWNUMBER_SECRETS;
else if(sc.Compare("totalsecrets")) else if(sc.Compare("totalsecrets"))
cmd.flags += DRAWNUMBER_TOTALSECRETS; cmd.flags |= DRAWNUMBER_TOTALSECRETS;
else if(sc.Compare("armorclass")) else if(sc.Compare("armorclass"))
cmd.flags += DRAWNUMBER_ARMORCLASS; cmd.flags |= DRAWNUMBER_ARMORCLASS;
else if(sc.Compare("globalvar")) else if(sc.Compare("globalvar"))
{ {
cmd.flags += DRAWNUMBER_GLOBALVAR; cmd.flags |= DRAWNUMBER_GLOBALVAR;
sc.MustGetToken(TK_IntConst); sc.MustGetToken(TK_IntConst);
if(sc.Number < 0 || sc.Number >= NUM_GLOBALVARS) if(sc.Number < 0 || sc.Number >= NUM_GLOBALVARS)
sc.ScriptError("Global variable number out of range: %d", sc.Number); sc.ScriptError("Global variable number out of range: %d", sc.Number);
@ -550,7 +552,7 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
} }
else if(sc.Compare("globalarray")) //acts like variable[playernumber()] else if(sc.Compare("globalarray")) //acts like variable[playernumber()]
{ {
cmd.flags += DRAWNUMBER_GLOBALARRAY; cmd.flags |= DRAWNUMBER_GLOBALARRAY;
sc.MustGetToken(TK_IntConst); sc.MustGetToken(TK_IntConst);
if(sc.Number < 0 || sc.Number >= NUM_GLOBALVARS) if(sc.Number < 0 || sc.Number >= NUM_GLOBALVARS)
sc.ScriptError("Global variable number out of range: %d", sc.Number); sc.ScriptError("Global variable number out of range: %d", sc.Number);
@ -572,10 +574,9 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
while(sc.CheckToken(TK_Identifier)) while(sc.CheckToken(TK_Identifier))
{ {
if(sc.Compare("fillzeros")) if(sc.Compare("fillzeros"))
{ cmd.flags |= DRAWNUMBER_FILLZEROS;
cmd.flags += DRAWNUMBER_FILLZEROS; else if(sc.Compare("whennotzero"))
Printf("%d", cmd.flags); cmd.flags |= DRAWNUMBER_WHENNOTZERO;
}
else else
sc.ScriptError("Unknown flag '%s'.", sc.String); sc.ScriptError("Unknown flag '%s'.", sc.String);
if(!sc.CheckToken('|')) if(!sc.CheckToken('|'))
@ -623,9 +624,9 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
while(sc.CheckToken(TK_Identifier)) while(sc.CheckToken(TK_Identifier))
{ {
if(sc.Compare("xdeathface")) if(sc.Compare("xdeathface"))
cmd.flags += DRAWMUGSHOT_XDEATHFACE; cmd.flags |= DRAWMUGSHOT_XDEATHFACE;
else if(sc.Compare("animatedgodmode")) else if(sc.Compare("animatedgodmode"))
cmd.flags += DRAWMUGSHOT_ANIMATEDGODMODE; cmd.flags |= DRAWMUGSHOT_ANIMATEDGODMODE;
else else
sc.ScriptError("Unknown flag '%s'.", sc.String); sc.ScriptError("Unknown flag '%s'.", sc.String);
if(!sc.CheckToken('|')) if(!sc.CheckToken('|'))
@ -643,15 +644,15 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
if(sc.Compare("alternateonempty")) if(sc.Compare("alternateonempty"))
{ {
alternateonempty = true; alternateonempty = true;
cmd.flags += DRAWSELECTEDINVENTORY_ALTERNATEONEMPTY; cmd.flags |= DRAWSELECTEDINVENTORY_ALTERNATEONEMPTY;
} }
else if(sc.Compare("artiflash")) else if(sc.Compare("artiflash"))
{ {
cmd.flags += DRAWSELECTEDINVENTORY_ARTIFLASH; cmd.flags |= DRAWSELECTEDINVENTORY_ARTIFLASH;
} }
else if(sc.Compare("alwaysshowcounter")) else if(sc.Compare("alwaysshowcounter"))
{ {
cmd.flags += DRAWSELECTEDINVENTORY_ALWAYSSHOWCOUNTER; cmd.flags |= DRAWSELECTEDINVENTORY_ALWAYSSHOWCOUNTER;
} }
else else
{ {
@ -703,54 +704,51 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
} }
case SBARINFO_DRAWINVENTORYBAR: case SBARINFO_DRAWINVENTORYBAR:
sc.MustGetToken(TK_Identifier); sc.MustGetToken(TK_Identifier);
if(sc.Compare("Heretic")) if(sc.Compare("Doom"))
{ cmd.special = GAME_Doom;
else if(sc.Compare("Heretic"))
cmd.special = GAME_Heretic; cmd.special = GAME_Heretic;
}
else if(sc.Compare("Hexen")) else if(sc.Compare("Hexen"))
{
cmd.special = GAME_Hexen; cmd.special = GAME_Hexen;
} else if(sc.Compare("Strife"))
if(sc.Compare("Doom") || sc.Compare("Heretic") || sc.Compare("Hexen")) cmd.special = GAME_Strife;
{
sc.MustGetToken(',');
while(sc.CheckToken(TK_Identifier))
{
if(sc.Compare("alwaysshow"))
{
cmd.flags += DRAWINVENTORYBAR_ALWAYSSHOW;
}
else if(sc.Compare("noartibox"))
{
cmd.flags += DRAWINVENTORYBAR_NOARTIBOX;
}
else if(sc.Compare("noarrows"))
{
cmd.flags += DRAWINVENTORYBAR_NOARROWS;
}
else if(sc.Compare("alwaysshowcounter"))
{
cmd.flags += DRAWINVENTORYBAR_ALWAYSSHOWCOUNTER;
}
else
{
sc.ScriptError("Unknown flag '%s'.", sc.String);
}
if(!sc.CheckToken('|'))
sc.MustGetToken(',');
}
sc.MustGetToken(TK_IntConst);
cmd.value = sc.Number;
sc.MustGetToken(',');
sc.MustGetToken(TK_Identifier);
cmd.font = V_GetFont(sc.String);
if(cmd.font == NULL)
sc.ScriptError("Unknown font '%s'.", sc.String);
}
else else
{
sc.ScriptError("Unkown style '%s'.", sc.String); sc.ScriptError("Unkown style '%s'.", sc.String);
sc.MustGetToken(',');
while(sc.CheckToken(TK_Identifier))
{
if(sc.Compare("alwaysshow"))
{
cmd.flags |= DRAWINVENTORYBAR_ALWAYSSHOW;
}
else if(sc.Compare("noartibox"))
{
cmd.flags |= DRAWINVENTORYBAR_NOARTIBOX;
}
else if(sc.Compare("noarrows"))
{
cmd.flags |= DRAWINVENTORYBAR_NOARROWS;
}
else if(sc.Compare("alwaysshowcounter"))
{
cmd.flags |= DRAWINVENTORYBAR_ALWAYSSHOWCOUNTER;
}
else
{
sc.ScriptError("Unknown flag '%s'.", sc.String);
}
if(!sc.CheckToken('|'))
sc.MustGetToken(',');
} }
sc.MustGetToken(TK_IntConst);
cmd.value = sc.Number;
sc.MustGetToken(',');
sc.MustGetToken(TK_Identifier);
cmd.font = V_GetFont(sc.String);
if(cmd.font == NULL)
sc.ScriptError("Unknown font '%s'.", sc.String);
sc.MustGetToken(','); sc.MustGetToken(',');
this->getCoordinates(sc, cmd); this->getCoordinates(sc, cmd);
cmd.special2 = cmd.x + 26; cmd.special2 = cmd.x + 26;
@ -875,13 +873,13 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
while(sc.CheckToken(TK_Identifier)) while(sc.CheckToken(TK_Identifier))
{ {
if(sc.Compare("wiggle")) if(sc.Compare("wiggle"))
cmd.flags += DRAWGEM_WIGGLE; cmd.flags |= DRAWGEM_WIGGLE;
else if(sc.Compare("translatable")) else if(sc.Compare("translatable"))
cmd.flags += DRAWGEM_TRANSLATABLE; cmd.flags |= DRAWGEM_TRANSLATABLE;
else if(sc.Compare("armor")) else if(sc.Compare("armor"))
cmd.flags += DRAWGEM_ARMOR; cmd.flags |= DRAWGEM_ARMOR;
else if(sc.Compare("reverse")) else if(sc.Compare("reverse"))
cmd.flags += DRAWGEM_REVERSE; cmd.flags |= DRAWGEM_REVERSE;
else else
sc.ScriptError("Unknown drawgem flag '%s'.", sc.String); sc.ScriptError("Unknown drawgem flag '%s'.", sc.String);
if(!sc.CheckToken('|')) if(!sc.CheckToken('|'))
@ -918,7 +916,7 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
sc.MustGetToken(','); sc.MustGetToken(',');
sc.MustGetToken(TK_Identifier); sc.MustGetToken(TK_Identifier);
if(sc.Compare("vertical")) if(sc.Compare("vertical"))
cmd.flags += DRAWSHADER_VERTICAL; cmd.flags |= DRAWSHADER_VERTICAL;
else if(!sc.Compare("horizontal")) else if(!sc.Compare("horizontal"))
sc.ScriptError("Unknown direction '%s'.", sc.String); sc.ScriptError("Unknown direction '%s'.", sc.String);
sc.MustGetToken(','); sc.MustGetToken(',');
@ -928,7 +926,7 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
{ {
sc.ScriptError("Exspected 'reverse', got '%s' instead.", sc.String); sc.ScriptError("Exspected 'reverse', got '%s' instead.", sc.String);
} }
cmd.flags += DRAWSHADER_REVERSE; cmd.flags |= DRAWSHADER_REVERSE;
sc.MustGetToken(','); sc.MustGetToken(',');
} }
this->getCoordinates(sc, cmd); this->getCoordinates(sc, cmd);
@ -960,7 +958,7 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
sc.MustGetToken(','); sc.MustGetToken(',');
sc.MustGetToken(TK_Identifier); sc.MustGetToken(TK_Identifier);
if(sc.Compare("vertical")) if(sc.Compare("vertical"))
cmd.flags += DRAWKEYBAR_VERTICAL; cmd.flags |= DRAWKEYBAR_VERTICAL;
else if(!sc.Compare("horizontal")) else if(!sc.Compare("horizontal"))
sc.ScriptError("Unknown direction '%s'.", sc.String); sc.ScriptError("Unknown direction '%s'.", sc.String);
sc.MustGetToken(','); sc.MustGetToken(',');
@ -974,13 +972,13 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
while(sc.CheckToken(TK_Identifier)) while(sc.CheckToken(TK_Identifier))
{ {
if(sc.Compare("singleplayer")) if(sc.Compare("singleplayer"))
cmd.flags += GAMETYPE_SINGLEPLAYER; cmd.flags |= GAMETYPE_SINGLEPLAYER;
else if(sc.Compare("cooperative")) else if(sc.Compare("cooperative"))
cmd.flags += GAMETYPE_COOPERATIVE; cmd.flags |= GAMETYPE_COOPERATIVE;
else if(sc.Compare("deathmatch")) else if(sc.Compare("deathmatch"))
cmd.flags += GAMETYPE_DEATHMATCH; cmd.flags |= GAMETYPE_DEATHMATCH;
else if(sc.Compare("teamgame")) else if(sc.Compare("teamgame"))
cmd.flags += GAMETYPE_TEAMGAME; cmd.flags |= GAMETYPE_TEAMGAME;
else else
sc.ScriptError("Unknown gamemode: %s", sc.String); sc.ScriptError("Unknown gamemode: %s", sc.String);
if(sc.CheckToken('{')) if(sc.CheckToken('{'))
@ -1037,7 +1035,7 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
{ {
if(sc.Compare("not")) if(sc.Compare("not"))
{ {
cmd.flags += SBARINFOEVENT_NOT; cmd.flags |= SBARINFOEVENT_NOT;
} }
else else
sc.ScriptError("Expected 'not' got '%s' instead.", sc.String); sc.ScriptError("Expected 'not' got '%s' instead.", sc.String);
@ -1063,7 +1061,7 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
if(sc.CheckToken(TK_Identifier)) if(sc.CheckToken(TK_Identifier))
{ {
if(sc.Compare("not")) if(sc.Compare("not"))
cmd.flags += SBARINFOEVENT_NOT; cmd.flags |= SBARINFOEVENT_NOT;
else else
sc.ScriptError("Exspected 'not' got '%s' instead.", sc.String); sc.ScriptError("Exspected 'not' got '%s' instead.", sc.String);
} }
@ -1090,7 +1088,7 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
sc.MustGetToken(TK_Identifier); sc.MustGetToken(TK_Identifier);
if(sc.Compare("not")) if(sc.Compare("not"))
{ {
cmd.flags += SBARINFOEVENT_NOT; cmd.flags |= SBARINFOEVENT_NOT;
sc.MustGetToken(TK_Identifier); sc.MustGetToken(TK_Identifier);
} }
for(int i = 0;i < 2;i++) for(int i = 0;i < 2;i++)
@ -1103,12 +1101,12 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
} }
if(sc.CheckToken(TK_OrOr)) if(sc.CheckToken(TK_OrOr))
{ {
cmd.flags += SBARINFOEVENT_OR; cmd.flags |= SBARINFOEVENT_OR;
sc.MustGetToken(TK_Identifier); sc.MustGetToken(TK_Identifier);
} }
else if(sc.CheckToken(TK_AndAnd)) else if(sc.CheckToken(TK_AndAnd))
{ {
cmd.flags += SBARINFOEVENT_AND; cmd.flags |= SBARINFOEVENT_AND;
sc.MustGetToken(TK_Identifier); sc.MustGetToken(TK_Identifier);
} }
else else
@ -1121,7 +1119,7 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
sc.MustGetToken(TK_Identifier); sc.MustGetToken(TK_Identifier);
if(sc.Compare("not")) if(sc.Compare("not"))
{ {
cmd.flags += SBARINFOEVENT_NOT; cmd.flags |= SBARINFOEVENT_NOT;
sc.MustGetToken(TK_Identifier); sc.MustGetToken(TK_Identifier);
} }
for(int i = 0;i < 2;i++) for(int i = 0;i < 2;i++)
@ -1134,12 +1132,12 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
} }
if(sc.CheckToken(TK_OrOr)) if(sc.CheckToken(TK_OrOr))
{ {
cmd.flags += SBARINFOEVENT_OR; cmd.flags |= SBARINFOEVENT_OR;
sc.MustGetToken(TK_Identifier); sc.MustGetToken(TK_Identifier);
} }
else if(sc.CheckToken(TK_AndAnd)) else if(sc.CheckToken(TK_AndAnd))
{ {
cmd.flags += SBARINFOEVENT_AND; cmd.flags |= SBARINFOEVENT_AND;
sc.MustGetToken(TK_Identifier); sc.MustGetToken(TK_Identifier);
} }
else else