diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 159af00745..a311ed1ba0 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,6 @@ +January 30, 2009 (Changes by Graf Zahl) +- Added Blzut3's statusbar maintenance patch. + January 29, 2009 (Changes by Graf Zahl) - fixed sound origin of the Mage Wand's missile. diff --git a/src/g_level.cpp b/src/g_level.cpp index bda4858ccc..445fcec684 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -1750,14 +1750,14 @@ void G_InitNew (const char *mapname, bool bTitleLevel) } else { - StatusBar = CreateCustomStatusBar(GETSBARINFOSCRIPT(gameinfo.gametype)); + StatusBar = CreateCustomStatusBar(SCRIPT_DEFAULT); } } if (StatusBar == NULL) { if (gameinfo.gametype & GAME_DoomChex) { - StatusBar = CreateCustomStatusBar (GETSBARINFOSCRIPT(gameinfo.gametype)); + StatusBar = CreateCustomStatusBar (SCRIPT_DEFAULT); } else if (gameinfo.gametype == GAME_Heretic) { diff --git a/src/g_shared/sbarinfo.h b/src/g_shared/sbarinfo.h index e792b31edd..daa1360952 100644 --- a/src/g_shared/sbarinfo.h +++ b/src/g_shared/sbarinfo.h @@ -147,17 +147,9 @@ struct SBarInfo static void Load(); }; -#define NUM_SCRIPTS 5 #define SCRIPT_CUSTOM 0 -#define SCRIPT_DOOM 1 -// The next ones shouldn't be used... yet -#define SCRIPT_HERETIC 2 -#define SCRIPT_HEXEN 3 -#define SCRIPT_STRIFE 4 -// Converts GAME_x to it's script number -#define GETSBARINFOSCRIPT(game) \ - (game & GAME_DoomChex) ? SCRIPT_DOOM : (game == GAME_Heretic ? SCRIPT_HERETIC : (game == GAME_Hexen ? SCRIPT_HEXEN : (game == GAME_Strife ? SCRIPT_STRIFE : SCRIPT_CUSTOM))) -extern SBarInfo *SBarInfoScript[5]; +#define SCRIPT_DEFAULT 1 +extern SBarInfo *SBarInfoScript[2]; // Enums used between the parser and the display diff --git a/src/g_shared/sbarinfo_parser.cpp b/src/g_shared/sbarinfo_parser.cpp index 8530afe2c7..a502cb99ce 100644 --- a/src/g_shared/sbarinfo_parser.cpp +++ b/src/g_shared/sbarinfo_parser.cpp @@ -47,15 +47,7 @@ #include "i_system.h" #include "g_level.h" -SBarInfo *SBarInfoScript[NUM_SCRIPTS] = {NULL,NULL,NULL,NULL,NULL}; -static const char *DefaultScriptNames[NUM_SCRIPTS] = -{ - "SBARINFO", //Custom - "sbarinfo/doom.txt", - NULL, //Heretic - NULL, //Hexen - NULL //Strife -}; +SBarInfo *SBarInfoScript[2] = {NULL,NULL}; static const char *SBarInfoTopLevel[] = { @@ -114,7 +106,7 @@ static const char *SBarInfoRoutineLevel[] = static void FreeSBarInfoScript() { - for(int i = 0;i < NUM_SCRIPTS;i++) + for(int i = 0;i < 2;i++) { if (SBarInfoScript[i] != NULL) { @@ -126,28 +118,25 @@ static void FreeSBarInfoScript() void SBarInfo::Load() { - Printf ("ParseSBarInfo: Loading default status bar definitions.\n"); - for(int i = 1;i < NUM_SCRIPTS;i++) // Read in default bars if they exist + if(gameinfo.statusbar != NULL) { - if(DefaultScriptNames[i] != NULL) + int lump = Wads.CheckNumForFullName(gameinfo.statusbar, true); + if(lump != -1) { - int lump = Wads.CheckNumForFullName(DefaultScriptNames[i], true); - if(lump != -1) - { - if(SBarInfoScript[i] == NULL) - SBarInfoScript[i] = new SBarInfo(lump); - else - SBarInfoScript[i]->ParseSBarInfo(lump); - } + Printf ("ParseSBarInfo: Loading default status bar definition.\n"); + if(SBarInfoScript[SCRIPT_DEFAULT] == NULL) + SBarInfoScript[SCRIPT_DEFAULT] = new SBarInfo(lump); + else + SBarInfoScript[SCRIPT_DEFAULT]->ParseSBarInfo(lump); } } - if(Wads.CheckNumForName(DefaultScriptNames[SCRIPT_CUSTOM]) != -1) + if(Wads.CheckNumForName("SBARINFO") != -1) { Printf ("ParseSBarInfo: Loading custom status bar definition.\n"); int lastlump, lump; lastlump = 0; - while((lump = Wads.FindLump(DefaultScriptNames[SCRIPT_CUSTOM], &lastlump)) != -1) + while((lump = Wads.FindLump("SBARINFO", &lastlump)) != -1) { if(SBarInfoScript[SCRIPT_CUSTOM] == NULL) SBarInfoScript[SCRIPT_CUSTOM] = new SBarInfo(lump); diff --git a/src/gi.cpp b/src/gi.cpp index d26733e227..9715675f61 100644 --- a/src/gi.cpp +++ b/src/gi.cpp @@ -101,6 +101,7 @@ gameinfo_t HexenGameInfo = MAKERGB(104,0,0), MAKERGB(255,0,0), "BagOfHolding", // Hexen doesn't have a backpack so use Heretic's. + NULL, }; gameinfo_t HexenDKGameInfo = @@ -134,6 +135,7 @@ gameinfo_t HexenDKGameInfo = MAKERGB(104,0,0), MAKERGB(255,0,0), "BagOfHolding", + NULL, }; gameinfo_t HereticGameInfo = @@ -167,6 +169,7 @@ gameinfo_t HereticGameInfo = MAKERGB(104,0,0), MAKERGB(255,0,0), "BagOfHolding", + NULL, }; gameinfo_t HereticSWGameInfo = @@ -200,6 +203,7 @@ gameinfo_t HereticSWGameInfo = MAKERGB(104,0,0), MAKERGB(255,0,0), "BagOfHolding", + NULL, }; gameinfo_t SharewareGameInfo = @@ -233,6 +237,7 @@ gameinfo_t SharewareGameInfo = MAKERGB(104,0,0), MAKERGB(255,0,0), "Backpack", + "sbarinfo/doom.txt", }; gameinfo_t RegisteredGameInfo = @@ -266,6 +271,7 @@ gameinfo_t RegisteredGameInfo = MAKERGB(104,0,0), MAKERGB(255,0,0), "Backpack", + "sbarinfo/doom.txt", }; gameinfo_t ChexGameInfo = @@ -299,6 +305,7 @@ gameinfo_t ChexGameInfo = MAKERGB(63,125,57), MAKERGB(95,175,87), "ZorchPack", + "sbarinfo/doom.txt", }; gameinfo_t Chex3GameInfo = @@ -332,6 +339,7 @@ gameinfo_t Chex3GameInfo = MAKERGB(63,125,57), MAKERGB(95,175,87), "ZorchPack", + "sbarinfo/doom.txt", }; gameinfo_t RetailGameInfo = @@ -365,6 +373,7 @@ gameinfo_t RetailGameInfo = MAKERGB(104,0,0), MAKERGB(255,0,0), "Backpack", + "sbarinfo/doom.txt", }; gameinfo_t CommercialGameInfo = @@ -398,6 +407,7 @@ gameinfo_t CommercialGameInfo = MAKERGB(104,0,0), MAKERGB(255,0,0), "Backpack", + "sbarinfo/doom.txt", }; gameinfo_t PlutoniaGameInfo = @@ -431,6 +441,7 @@ gameinfo_t PlutoniaGameInfo = MAKERGB(104,0,0), MAKERGB(255,0,0), "Backpack", + "sbarinfo/doom.txt", }; gameinfo_t TNTGameInfo = @@ -464,6 +475,7 @@ gameinfo_t TNTGameInfo = MAKERGB(104,0,0), MAKERGB(255,0,0), "Backpack", + "sbarinfo/doom.txt", }; gameinfo_t StrifeGameInfo = @@ -497,6 +509,7 @@ gameinfo_t StrifeGameInfo = MAKERGB(104,0,0), MAKERGB(255,0,0), "AmmoSatchel", + NULL, }; gameinfo_t StrifeTeaserGameInfo = @@ -530,6 +543,7 @@ gameinfo_t StrifeTeaserGameInfo = MAKERGB(104,0,0), MAKERGB(255,0,0), "AmmoSatchel", + NULL, }; gameinfo_t StrifeTeaser2GameInfo = @@ -563,4 +577,5 @@ gameinfo_t StrifeTeaser2GameInfo = MAKERGB(104,0,0), MAKERGB(255,0,0), "AmmoSatchel", + NULL, }; diff --git a/src/gi.h b/src/gi.h index 9ef71f8a86..a83f94a5b9 100644 --- a/src/gi.h +++ b/src/gi.h @@ -122,6 +122,7 @@ typedef struct DWORD defaultbloodcolor; DWORD defaultbloodparticlecolor; const char *backpacktype; + const char *statusbar; } gameinfo_t; extern gameinfo_t gameinfo;