From 1f0fa7c4575cff0745898fe3e050f2daaf5eb6c7 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 6 Jan 2008 19:10:52 +0000 Subject: [PATCH] - Added SBARINFO update #5 by blzut3: - Fixed: Playerclass still didn't work due to comparing of improper numbers. - Fixed: The arrows on drawinventorybar had a hard coded location instead of relative to the specified coordinates. - Added noarrows flag to drawinventorybar to remove the blue arrows drawn when there are more items to the left or right of the viewable bar. - Added forcescaled flag to the statusbar command. This is ignored on the inventory and inventoryfullscreen types. - Added obituary fix for Strife peasants by Karate Chris. - Added fix for loading during demo playback by Karate Chris. SVN r672 (trunk) --- docs/rh-log.txt | 10 ++++++ src/g_game.cpp | 1 + src/g_shared/sbarinfo.cpp | 57 ++++++++++++++++++++++++++------- src/g_shared/sbarinfo.h | 2 ++ wadsrc/languages/english-us.txt | 4 +-- 5 files changed, 61 insertions(+), 13 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index b1ccce1ce..0a4e7602c 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,14 @@ January 6, 2008 (Changes by Graf Zahl) +- Added SBARINFO update #5 by blzut3: + - Fixed: Playerclass still didn't work due to comparing of improper numbers. + - Fixed: The arrows on drawinventorybar had a hard coded location instead of + relative to the specified coordinates. + - Added noarrows flag to drawinventorybar to remove the blue arrows drawn when + there are more items to the left or right of the viewable bar. + - Added forcescaled flag to the statusbar command. This is ignored on the + inventory and inventoryfullscreen types. +- Added obituary fix for Strife peasants by Karate Chris. +- Added fix for loading during demo playback by Karate Chris. - Added scoreboard fix by Karate Chris. - Added teamgame fix for menu by Karate Chris. - Added GZDoom's Sector_Outside sector type which forces outside fog diff --git a/src/g_game.cpp b/src/g_game.cpp index 0ad90534f..a92d006d7 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -1689,6 +1689,7 @@ void G_DoLoadGame () char *map; gameaction = ga_nothing; + demoplayback = false; FILE *stdfile = fopen (savename.GetChars(), "rb"); if (stdfile == NULL) diff --git a/src/g_shared/sbarinfo.cpp b/src/g_shared/sbarinfo.cpp index da4a2079e..d7905076f 100644 --- a/src/g_shared/sbarinfo.cpp +++ b/src/g_shared/sbarinfo.cpp @@ -32,6 +32,11 @@ EXTERN_CVAR(Int, fraglimit) SBarInfo *SBarInfoScript; +enum //statusbar flags +{ + STATUSBARFLAG_FORCESCALED = 1, +}; + enum //gametype flags { GAMETYPE_SINGLEPLAYER = 1, @@ -82,6 +87,7 @@ enum //drawinventorybar flags { DRAWINVENTORYBAR_ALWAYSSHOW = 1, DRAWINVENTORYBAR_NOARTIBOX = 2, + DRAWINVENTORYBAR_NOARROWS = 4, }; enum //drawgem flags @@ -228,6 +234,18 @@ int SBarInfo::ParseSBarInfo(int lump) { SC_MustGetToken(TK_Identifier); int barNum = SC_MustMatchString(StatusBars); + while(SC_CheckToken(',')) + { + SC_MustGetToken(TK_Identifier); + if(SC_Compare("forcescaled")) + { + this->huds[barNum].forceScaled = true; + } + else + { + SC_ScriptError("Unkown flag '%s'.", sc_String); + } + } SC_MustGetToken('{'); if(barNum == STBAR_AUTOMAP) { @@ -526,6 +544,10 @@ void SBarInfo::ParseSBarInfoBlock(SBarInfoBlock &block) { cmd.flags += DRAWINVENTORYBAR_NOARTIBOX; } + else if(SC_Compare("noarrows")) + { + cmd.flags += DRAWINVENTORYBAR_NOARROWS; + } else { SC_ScriptError("Unknown flag '%s'.", sc_String); @@ -763,11 +785,11 @@ void SBarInfo::ParseSBarInfoBlock(SBarInfoBlock &block) { foundClass = true; if(i == 0) - cmd.special = c; + cmd.special = PlayerClasses[c].Type->ClassIndex; else if(i == 1) - cmd.special2 = c; + cmd.special2 = PlayerClasses[c].Type->ClassIndex; else //should be 2 - cmd.special3 = c; + cmd.special3 = PlayerClasses[c].Type->ClassIndex; break; } } @@ -868,6 +890,11 @@ SBarInfoCommand::SBarInfoCommand() //sets the default values for more predicable font = V_GetFont("CONFONT"); } +SBarInfoBlock::SBarInfoBlock() +{ + forceScaled = false; +} + enum { ST_FACENORMALRIGHT, @@ -1144,6 +1171,11 @@ public: { hud = 0; } + if(SBarInfoScript->huds[hud].forceScaled) //scale the statusbar + { + SetScaled(true); + setsizeneeded = true; + } doCommands(SBarInfoScript->huds[hud]); if(CPlayer->inventorytics > 0 && !(level.flags & LEVEL_NOINVENTORYBAR)) { @@ -1491,15 +1523,18 @@ private: { bool alwaysshow = false; bool artibox = true; + bool noarrows = false; if((cmd.flags & DRAWINVENTORYBAR_ALWAYSSHOW)) alwaysshow = true; if((cmd.flags & DRAWINVENTORYBAR_NOARTIBOX)) artibox = false; + if((cmd.flags & DRAWINVENTORYBAR_NOARROWS)) + noarrows = true; if(drawingFont != cmd.font) { drawingFont = cmd.font; } - DrawInventoryBar(cmd.special, cmd.value, cmd.x, cmd.y, alwaysshow, cmd.special2, cmd.special3, cmd.translation, artibox); + DrawInventoryBar(cmd.special, cmd.value, cmd.x, cmd.y, alwaysshow, cmd.special2, cmd.special3, cmd.translation, artibox, noarrows); break; } case SBARINFO_DRAWBAR: @@ -1677,7 +1712,7 @@ private: } break; case SBARINFO_PLAYERCLASS: - int spawnClass = CPlayer->GetSpawnClass(); + int spawnClass = CPlayer->cls->ClassIndex; if(cmd.special == spawnClass || cmd.special2 == spawnClass || cmd.special3 == spawnClass) { doCommands(cmd.subBlock); @@ -1855,8 +1890,8 @@ private: } void DrawInventoryBar(int type, int num, int x, int y, bool alwaysshow, - int counterx, int countery, EColorRange translation, bool drawArtiboxes) //yes, there is some Copy & Paste here too - { + int counterx, int countery, EColorRange translation, bool drawArtiboxes, bool noArrows) + { //yes, there is some Copy & Paste here too const AInventory *item; int i; @@ -1892,16 +1927,16 @@ private: DrawImage (Images[invBarOffset + imgARTIBOX], x+i*31, y); } // Is there something to the left? - if (CPlayer->mo->FirstInv() != CPlayer->mo->InvFirst) + if (!noArrows && CPlayer->mo->FirstInv() != CPlayer->mo->InvFirst) { DrawImage (Images[!(gametic & 4) ? - invBarOffset + imgINVLFGEM1 : invBarOffset + imgINVLFGEM2], 38, 2); + invBarOffset + imgINVLFGEM1 : invBarOffset + imgINVLFGEM2], x-12, y); } // Is there something to the right? - if (item != NULL) + if (!noArrows && item != NULL) { DrawImage (Images[!(gametic & 4) ? - invBarOffset + imgINVRTGEM1 : invBarOffset + imgINVRTGEM2], 269, 2); + invBarOffset + imgINVRTGEM1 : invBarOffset + imgINVRTGEM2], x+num*31+2, y); } } } diff --git a/src/g_shared/sbarinfo.h b/src/g_shared/sbarinfo.h index 29d0f471b..9b9c93fea 100644 --- a/src/g_shared/sbarinfo.h +++ b/src/g_shared/sbarinfo.h @@ -9,6 +9,8 @@ struct SBarInfoCommand; //we need to be able to use this before it is defined. struct SBarInfoBlock { TArray commands; + bool forceScaled; + SBarInfoBlock(); }; struct SBarInfoCommand diff --git a/wadsrc/languages/english-us.txt b/wadsrc/languages/english-us.txt index 91dfdce29..001fa7e02 100644 --- a/wadsrc/languages/english-us.txt +++ b/wadsrc/languages/english-us.txt @@ -654,8 +654,8 @@ OB_ACOLYTE = "%o was zealously shot down by an Acolyte."; OB_MACIL = "%o should have never rebelled against Macil."; OB_REBEL = "%o was gunned down by a Rebel."; OB_BEGGAR = "%o was beaten to death by the poor."; -OB_PEASANT = "%o should have never picked fights with civilians." -OB_ALIENSPECTE = "%o was struck down by the Spectre"; +OB_PEASANT = "%o should have never picked a fight with a civilian."; +OB_ALIENSPECTE = "%o was struck down by the Spectre."; OB_ENTITY = "%o felt the wrath of The One God."; OB_LOREMASTER = "%o couldn't escape from the Lore Master's grasp."; OB_PROGRAMMER = "%o was deleted by the Programmer.";