From 01e1295c5088dd4ffaa3b06222994a40371144d3 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Mon, 19 May 2008 23:07:08 +0000 Subject: [PATCH] - 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) --- docs/rh-log.txt | 17 +++ src/g_doom/doom_sbar.cpp | 29 ++++- src/g_shared/sbarinfo.h | 4 + src/g_shared/sbarinfo_display.cpp | 65 ++++++++--- src/g_shared/sbarinfo_parser.cpp | 174 +++++++++++++++--------------- 5 files changed, 183 insertions(+), 106 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index a204a67a5..1d1c5d0e2 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -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) - Added: hasweaponpiece command to check for custom weapon pieces. - Added: usessecondaryammo command to check if the current weapon has a second diff --git a/src/g_doom/doom_sbar.cpp b/src/g_doom/doom_sbar.cpp index 355367add..e54658c1a 100644 --- a/src/g_doom/doom_sbar.cpp +++ b/src/g_doom/doom_sbar.cpp @@ -53,7 +53,9 @@ public: DoCommonInit (); bEvilGrin = false; + bNormal = true; bDamageFaceActive = false; + bOuchActive = false; CurrentState = NULL; RampageTimer = 0; LastDamageAngle = 1; @@ -115,7 +117,11 @@ public: { CurrentState->tick(); if(CurrentState->finished) + { + bNormal = true; + bOuchActive = false; CurrentState = NULL; + } } if((CPlayer->cmd.ucmd.buttons & (BT_ATTACK|BT_ALTATTACK)) && !(CPlayer->cheats & (CF_FROZEN | CF_TOTALLYFROZEN))) { @@ -168,6 +174,8 @@ public: //See sbarinfo_display.cpp 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); if(state != CurrentState) { @@ -792,9 +800,13 @@ private: } } } + bool useOuch = false; 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"; + } else stateName = "pain"; char* fullStateName = new char[sizeof(stateName)+sizeof((const char*) CPlayer->LastDamageType) + 1]; @@ -805,6 +817,7 @@ private: SetMugShotState(stateName); bDamageFaceActive = !(CurrentState == NULL); LastDamageAngle = damageAngle; + bOuchActive = useOuch; return damageAngle; } if(bDamageFaceActive) @@ -813,9 +826,13 @@ private: bDamageFaceActive = false; else { + bool useOuch = false; 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"; + } else stateName = "pain"; char* fullStateName = new char[sizeof(stateName)+sizeof((const char*) CPlayer->LastDamageType) + 1]; @@ -824,22 +841,24 @@ private: SetMugShotState(fullStateName); else SetMugShotState(stateName); + bOuchActive = useOuch; return LastDamageAngle; } } if(RampageTimer == ST_RAMPAGEDELAY) { - SetMugShotState("rampage", true); + SetMugShotState("rampage", !bNormal); //If we have nothing better to show use the rampage face. return 0; } - if(!bEvilGrin) + if(bNormal) { if((CPlayer->cheats & CF_GODMODE) || (CPlayer->mo != NULL && CPlayer->mo->flags2 & MF2_INVULNERABLE)) SetMugShotState("god"); else SetMugShotState("normal"); + bNormal = true; //SetMugShotState sets bNormal to false. } } else @@ -946,6 +965,8 @@ private: int FaceHealth; bool bEvilGrin; bool bDamageFaceActive; + bool bNormal; + bool bOuchActive; }; IMPLEMENT_CLASS(DDoomStatusBar) diff --git a/src/g_shared/sbarinfo.h b/src/g_shared/sbarinfo.h index bb00088de..b9e889148 100644 --- a/src/g_shared/sbarinfo.h +++ b/src/g_shared/sbarinfo.h @@ -216,6 +216,7 @@ enum //drawimage flags DRAWIMAGE_OFFSET_CENTER = 256, DRAWIMAGE_ARMOR = 512, DRAWIMAGE_WEAPONICON = 1024, + DRAWIMAGE_SIGIL = 2048, }; enum //drawnumber flags @@ -238,6 +239,7 @@ enum //drawnumber flags DRAWNUMBER_GLOBALVAR = 0x8000, DRAWNUMBER_GLOBALARRAY = 0x10000, DRAWNUMBER_FILLZEROS = 0x20000, + DRAWNUMBER_WHENNOTZERO = 0x40000, }; enum //drawbar flags (will go into special2) @@ -399,6 +401,8 @@ private: MugShotState *currentState; bool weaponGrin; bool damageFaceActive; + bool mugshotNormal; + bool ouchActive; int lastDamageAngle; int rampageTimer; int oldHealth; diff --git a/src/g_shared/sbarinfo_display.cpp b/src/g_shared/sbarinfo_display.cpp index a4a2666b3..ef71cf64a 100644 --- a/src/g_shared/sbarinfo_display.cpp +++ b/src/g_shared/sbarinfo_display.cpp @@ -53,6 +53,7 @@ #include "r_translate.h" #include "r_main.h" #include "a_weaponpiece.h" +#include "a_strifeglobal.h" static FRandom pr_chainwiggle; //use the same method of chain wiggling as heretic. @@ -66,6 +67,7 @@ enum { imgARTIBOX, imgSELECTBOX, + imgCURSOR, imgINVLFGEM1, imgINVLFGEM2, imgINVRTGEM1, @@ -234,7 +236,7 @@ DSBarInfo::DSBarInfo () : DBaseStatusBar (SBarInfoScript->height), { static const char *InventoryBarLumps[] = { - "ARTIBOX", "SELECTBO", "INVGEML1", + "ARTIBOX", "SELECTBO", "INVCURS", "INVGEML1", "INVGEML2", "INVGEMR1", "INVGEMR2", "USEARTIA", "USEARTIB", "USEARTIC", "USEARTID", }; @@ -263,6 +265,8 @@ DSBarInfo::DSBarInfo () : DBaseStatusBar (SBarInfoScript->height), lastPrefix = ""; weaponGrin = false; damageFaceActive = false; + mugshotNormal = true; + ouchActive = false; lastDamageAngle = 1; chainWiggle = 0; artiflash = 4; @@ -401,7 +405,11 @@ void DSBarInfo::Tick () { currentState->tick(); if(currentState->finished) + { + ouchActive = false; + mugshotNormal = true; currentState = NULL; + } } 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. void DSBarInfo::SetMugShotState(const char* stateName, bool waitTillDone) { + mugshotNormal = false; + ouchActive = false; MugShotState *state = (MugShotState *) FindMugShotState(stateName); if(state != currentState) { @@ -583,6 +593,12 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset, int a texture = TexMan[weapon->Icon]; } } + else if(cmd.flags & DRAWIMAGE_SIGIL) + { + AInventory *item = CPlayer->mo->FindInventory(); + if (item != NULL) + texture = TexMan[item->Icon]; + } else if((cmd.flags & DRAWIMAGE_INVENTORYICON)) texture = TexMan[cmd.sprite]; else if(cmd.sprite != -1) @@ -703,6 +719,8 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset, int a translation = cmd.translation2; else if(cmd.special4 != -1 && value >= cmd.special4) //high 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); break; } @@ -1401,9 +1419,13 @@ int DSBarInfo::updateState(bool xdth, bool animatedgodmode) } } } + bool setOuch = false; 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"; + } else stateName = "pain"; 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); damageFaceActive = !(currentState == NULL); lastDamageAngle = damageAngle; + ouchActive = setOuch; return damageAngle; } if(damageFaceActive) @@ -1422,9 +1445,13 @@ int DSBarInfo::updateState(bool xdth, bool animatedgodmode) damageFaceActive = false; else { + bool setOuch = false; 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"; + } else stateName = "pain"; 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); else SetMugShotState(stateName); + ouchActive = setOuch; return lastDamageAngle; } } if(rampageTimer == ST_RAMPAGETIME) { - SetMugShotState("rampage", true); + SetMugShotState("rampage", !mugshotNormal); return 0; } - if(!weaponGrin) + if(mugshotNormal) { 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 SetMugShotState("normal"); + mugshotNormal = true; //SetMugShotState sets this to false } } 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 AInventory *item; int i; + int spacing = (type != GAME_Strife) ? 31 : 35; // If the player has no artifacts, don't draw the bar 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) { - DrawGraphic(Images[invBarOffset + imgARTIBOX], x+i*31, 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); + DrawGraphic(Images[invBarOffset + imgARTIBOX], x+i*spacing, y, xOffset, yOffset, alpha); } + 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(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); } + else if(type == GAME_Strife) + { + DrawGraphic(Images[invBarOffset + imgCURSOR], x+i*35-6, y-2, xOffset, yOffset, alpha); + } else { 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) { - 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? if (!noArrows && CPlayer->mo->FirstInv() != CPlayer->mo->InvFirst) { 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? if (!noArrows && item != NULL) { 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); } } } diff --git a/src/g_shared/sbarinfo_parser.cpp b/src/g_shared/sbarinfo_parser.cpp index 4459a96a8..cb92d3c63 100644 --- a/src/g_shared/sbarinfo_parser.cpp +++ b/src/g_shared/sbarinfo_parser.cpp @@ -397,7 +397,7 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block) } if(sc.CheckToken(TK_AndAnd)) { - cmd.flags += DRAWIMAGE_SWITCHABLE_AND; + cmd.flags |= DRAWIMAGE_SWITCHABLE_AND; sc.MustGetToken(TK_Identifier); cmd.setString(sc, sc.String, 1); const PClass* item = PClass::FindClass(sc.String); @@ -430,23 +430,25 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block) { getImage = false; if(sc.Compare("playericon")) - cmd.flags += DRAWIMAGE_PLAYERICON; + cmd.flags |= DRAWIMAGE_PLAYERICON; else if(sc.Compare("ammoicon1")) - cmd.flags += DRAWIMAGE_AMMO1; + cmd.flags |= DRAWIMAGE_AMMO1; else if(sc.Compare("ammoicon2")) - cmd.flags += DRAWIMAGE_AMMO2; + cmd.flags |= DRAWIMAGE_AMMO2; else if(sc.Compare("armoricon")) - cmd.flags += DRAWIMAGE_ARMOR; + cmd.flags |= DRAWIMAGE_ARMOR; 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")) { - cmd.flags += DRAWIMAGE_TRANSLATABLE; + cmd.flags |= DRAWIMAGE_TRANSLATABLE; getImage = true; } else { - cmd.flags += DRAWIMAGE_INVENTORYICON; + cmd.flags |= DRAWIMAGE_INVENTORYICON; const PClass* item = PClass::FindClass(sc.String); 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); if(sc.Compare("center")) - cmd.flags += DRAWIMAGE_OFFSET_CENTER; + cmd.flags |= DRAWIMAGE_OFFSET_CENTER; else 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")) cmd.flags = DRAWNUMBER_FRAGS; else if(sc.Compare("kills")) - cmd.flags += DRAWNUMBER_KILLS; + cmd.flags |= DRAWNUMBER_KILLS; else if(sc.Compare("monsters")) - cmd.flags += DRAWNUMBER_MONSTERS; + cmd.flags |= DRAWNUMBER_MONSTERS; else if(sc.Compare("items")) - cmd.flags += DRAWNUMBER_ITEMS; + cmd.flags |= DRAWNUMBER_ITEMS; else if(sc.Compare("totalitems")) - cmd.flags += DRAWNUMBER_TOTALITEMS; + cmd.flags |= DRAWNUMBER_TOTALITEMS; else if(sc.Compare("secrets")) - cmd.flags += DRAWNUMBER_SECRETS; + cmd.flags |= DRAWNUMBER_SECRETS; else if(sc.Compare("totalsecrets")) - cmd.flags += DRAWNUMBER_TOTALSECRETS; + cmd.flags |= DRAWNUMBER_TOTALSECRETS; else if(sc.Compare("armorclass")) - cmd.flags += DRAWNUMBER_ARMORCLASS; + cmd.flags |= DRAWNUMBER_ARMORCLASS; else if(sc.Compare("globalvar")) { - cmd.flags += DRAWNUMBER_GLOBALVAR; + cmd.flags |= DRAWNUMBER_GLOBALVAR; sc.MustGetToken(TK_IntConst); if(sc.Number < 0 || sc.Number >= NUM_GLOBALVARS) 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()] { - cmd.flags += DRAWNUMBER_GLOBALARRAY; + cmd.flags |= DRAWNUMBER_GLOBALARRAY; sc.MustGetToken(TK_IntConst); if(sc.Number < 0 || sc.Number >= NUM_GLOBALVARS) 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)) { if(sc.Compare("fillzeros")) - { - cmd.flags += DRAWNUMBER_FILLZEROS; - Printf("%d", cmd.flags); - } + cmd.flags |= DRAWNUMBER_FILLZEROS; + else if(sc.Compare("whennotzero")) + cmd.flags |= DRAWNUMBER_WHENNOTZERO; else sc.ScriptError("Unknown flag '%s'.", sc.String); if(!sc.CheckToken('|')) @@ -623,9 +624,9 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block) while(sc.CheckToken(TK_Identifier)) { if(sc.Compare("xdeathface")) - cmd.flags += DRAWMUGSHOT_XDEATHFACE; + cmd.flags |= DRAWMUGSHOT_XDEATHFACE; else if(sc.Compare("animatedgodmode")) - cmd.flags += DRAWMUGSHOT_ANIMATEDGODMODE; + cmd.flags |= DRAWMUGSHOT_ANIMATEDGODMODE; else sc.ScriptError("Unknown flag '%s'.", sc.String); if(!sc.CheckToken('|')) @@ -643,15 +644,15 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block) if(sc.Compare("alternateonempty")) { alternateonempty = true; - cmd.flags += DRAWSELECTEDINVENTORY_ALTERNATEONEMPTY; + cmd.flags |= DRAWSELECTEDINVENTORY_ALTERNATEONEMPTY; } else if(sc.Compare("artiflash")) { - cmd.flags += DRAWSELECTEDINVENTORY_ARTIFLASH; + cmd.flags |= DRAWSELECTEDINVENTORY_ARTIFLASH; } else if(sc.Compare("alwaysshowcounter")) { - cmd.flags += DRAWSELECTEDINVENTORY_ALWAYSSHOWCOUNTER; + cmd.flags |= DRAWSELECTEDINVENTORY_ALWAYSSHOWCOUNTER; } else { @@ -703,54 +704,51 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block) } case SBARINFO_DRAWINVENTORYBAR: 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; - } else if(sc.Compare("Hexen")) - { cmd.special = GAME_Hexen; - } - if(sc.Compare("Doom") || sc.Compare("Heretic") || sc.Compare("Hexen")) - { - 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 if(sc.Compare("Strife")) + cmd.special = GAME_Strife; else - { 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(','); this->getCoordinates(sc, cmd); cmd.special2 = cmd.x + 26; @@ -875,13 +873,13 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block) while(sc.CheckToken(TK_Identifier)) { if(sc.Compare("wiggle")) - cmd.flags += DRAWGEM_WIGGLE; + cmd.flags |= DRAWGEM_WIGGLE; else if(sc.Compare("translatable")) - cmd.flags += DRAWGEM_TRANSLATABLE; + cmd.flags |= DRAWGEM_TRANSLATABLE; else if(sc.Compare("armor")) - cmd.flags += DRAWGEM_ARMOR; + cmd.flags |= DRAWGEM_ARMOR; else if(sc.Compare("reverse")) - cmd.flags += DRAWGEM_REVERSE; + cmd.flags |= DRAWGEM_REVERSE; else sc.ScriptError("Unknown drawgem flag '%s'.", sc.String); if(!sc.CheckToken('|')) @@ -918,7 +916,7 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block) sc.MustGetToken(','); sc.MustGetToken(TK_Identifier); if(sc.Compare("vertical")) - cmd.flags += DRAWSHADER_VERTICAL; + cmd.flags |= DRAWSHADER_VERTICAL; else if(!sc.Compare("horizontal")) sc.ScriptError("Unknown direction '%s'.", sc.String); sc.MustGetToken(','); @@ -928,7 +926,7 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block) { sc.ScriptError("Exspected 'reverse', got '%s' instead.", sc.String); } - cmd.flags += DRAWSHADER_REVERSE; + cmd.flags |= DRAWSHADER_REVERSE; sc.MustGetToken(','); } this->getCoordinates(sc, cmd); @@ -960,7 +958,7 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block) sc.MustGetToken(','); sc.MustGetToken(TK_Identifier); if(sc.Compare("vertical")) - cmd.flags += DRAWKEYBAR_VERTICAL; + cmd.flags |= DRAWKEYBAR_VERTICAL; else if(!sc.Compare("horizontal")) sc.ScriptError("Unknown direction '%s'.", sc.String); sc.MustGetToken(','); @@ -974,13 +972,13 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block) while(sc.CheckToken(TK_Identifier)) { if(sc.Compare("singleplayer")) - cmd.flags += GAMETYPE_SINGLEPLAYER; + cmd.flags |= GAMETYPE_SINGLEPLAYER; else if(sc.Compare("cooperative")) - cmd.flags += GAMETYPE_COOPERATIVE; + cmd.flags |= GAMETYPE_COOPERATIVE; else if(sc.Compare("deathmatch")) - cmd.flags += GAMETYPE_DEATHMATCH; + cmd.flags |= GAMETYPE_DEATHMATCH; else if(sc.Compare("teamgame")) - cmd.flags += GAMETYPE_TEAMGAME; + cmd.flags |= GAMETYPE_TEAMGAME; else sc.ScriptError("Unknown gamemode: %s", sc.String); if(sc.CheckToken('{')) @@ -1037,7 +1035,7 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block) { if(sc.Compare("not")) { - cmd.flags += SBARINFOEVENT_NOT; + cmd.flags |= SBARINFOEVENT_NOT; } else 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.Compare("not")) - cmd.flags += SBARINFOEVENT_NOT; + cmd.flags |= SBARINFOEVENT_NOT; else sc.ScriptError("Exspected 'not' got '%s' instead.", sc.String); } @@ -1090,7 +1088,7 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block) sc.MustGetToken(TK_Identifier); if(sc.Compare("not")) { - cmd.flags += SBARINFOEVENT_NOT; + cmd.flags |= SBARINFOEVENT_NOT; sc.MustGetToken(TK_Identifier); } for(int i = 0;i < 2;i++) @@ -1103,12 +1101,12 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block) } if(sc.CheckToken(TK_OrOr)) { - cmd.flags += SBARINFOEVENT_OR; + cmd.flags |= SBARINFOEVENT_OR; sc.MustGetToken(TK_Identifier); } else if(sc.CheckToken(TK_AndAnd)) { - cmd.flags += SBARINFOEVENT_AND; + cmd.flags |= SBARINFOEVENT_AND; sc.MustGetToken(TK_Identifier); } else @@ -1121,7 +1119,7 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block) sc.MustGetToken(TK_Identifier); if(sc.Compare("not")) { - cmd.flags += SBARINFOEVENT_NOT; + cmd.flags |= SBARINFOEVENT_NOT; sc.MustGetToken(TK_Identifier); } for(int i = 0;i < 2;i++) @@ -1134,12 +1132,12 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block) } if(sc.CheckToken(TK_OrOr)) { - cmd.flags += SBARINFOEVENT_OR; + cmd.flags |= SBARINFOEVENT_OR; sc.MustGetToken(TK_Identifier); } else if(sc.CheckToken(TK_AndAnd)) { - cmd.flags += SBARINFOEVENT_AND; + cmd.flags |= SBARINFOEVENT_AND; sc.MustGetToken(TK_Identifier); } else