diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 5eb30a881..80aab37c1 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,5 @@ September 7, 2009 (Changes by Graf Zahl) +- moved definition of games' default armor icons into gameinfo definition. - fixed: The PNG loader for true color textures overwrote the IDAT size with the IDAT id when reading the image. diff --git a/src/d_main.cpp b/src/d_main.cpp index d3cda5dbb..2e7aaa929 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -1961,29 +1961,27 @@ void D_DoomMain (void) // [RH] Try adding .deh and .bex files on the command line. // If there are none, try adding any in the config file. - //if (gameinfo.gametype == GAME_Doom) + if (!ConsiderPatches ("-deh", ".deh") && + !ConsiderPatches ("-bex", ".bex") && + (gameinfo.gametype == GAME_Doom) && + GameConfig->SetSection ("Doom.DefaultDehacked")) { - if (!ConsiderPatches ("-deh", ".deh") && - !ConsiderPatches ("-bex", ".bex") && - (gameinfo.gametype == GAME_Doom) && - GameConfig->SetSection ("Doom.DefaultDehacked")) - { - const char *key; - const char *value; + const char *key; + const char *value; - while (GameConfig->NextInSection (key, value)) + while (GameConfig->NextInSection (key, value)) + { + if (stricmp (key, "Path") == 0 && FileExists (value)) { - if (stricmp (key, "Path") == 0 && FileExists (value)) - { - Printf ("Applying patch %s\n", value); - DoDehPatch (value, true); - } + Printf ("Applying patch %s\n", value); + DoDehPatch (value, true); } } - - DoDehPatch (NULL, true); // See if there's a patch in a PWAD - FinishDehPatch (); // Create replacements for dehacked pickups } + + DoDehPatch (NULL, true); // See if there's a patch in a PWAD + FinishDehPatch (); // Create replacements for dehacked pickups + FActorInfo::StaticSetActorNums (); diff --git a/src/g_shared/a_armor.cpp b/src/g_shared/a_armor.cpp index cf3745e2a..9e43ccfb6 100644 --- a/src/g_shared/a_armor.cpp +++ b/src/g_shared/a_armor.cpp @@ -40,24 +40,13 @@ void ABasicArmor::Tick () AbsorbCount = 0; if (!Icon.isValid()) { - switch (gameinfo.gametype) - { - case GAME_Chex: - case GAME_Doom: - Icon = TexMan.CheckForTexture (SavePercent == FRACUNIT/3 ? "ARM1A0" : "ARM2A0", FTexture::TEX_Any); - break; + const char *icon = gameinfo.ArmorIcon1; - case GAME_Heretic: - Icon = TexMan.CheckForTexture (SavePercent == FRACUNIT/2 ? "SHLDA0" : "SHD2A0", FTexture::TEX_Any); - break; + if (SavePercent >= gameinfo.Armor2Percent && gameinfo.ArmorIcon2[0] != 0) + icon = gameinfo.ArmorIcon2; - case GAME_Strife: - Icon = TexMan.CheckForTexture (SavePercent == FRACUNIT/3 ? "I_ARM2" : "I_ARM1", FTexture::TEX_Any); - break; - - default: - break; - } + if (icon[0] != 0) + Icon = TexMan.CheckForTexture (icon, FTexture::TEX_Any); } } diff --git a/src/gi.cpp b/src/gi.cpp index f9ae66ea4..a3faf4958 100644 --- a/src/gi.cpp +++ b/src/gi.cpp @@ -233,6 +233,21 @@ void FMapInfoParser::ParseGameInfo() } } } + else if(nextKey.CompareNoCase("armoricons") == 0) + { + sc.MustGetToken(TK_StringConst); + strncpy(gameinfo.ArmorIcon1, sc.String, 8); + gameinfo.ArmorIcon1[8] = 0; + if (sc.CheckToken(',')) + { + sc.MustGetToken(TK_FloatConst); + gameinfo.Armor2Percent = FLOAT2FIXED(sc.Float); + sc.MustGetToken(','); + sc.MustGetToken(TK_StringConst); + strncpy(gameinfo.ArmorIcon2, sc.String, 8); + gameinfo.ArmorIcon2[8] = 0; + } + } // Insert valid keys here. GAMEINFOKEY_CSTRING(titlePage, "titlePage", 8) GAMEINFOKEY_STRINGARRAY(creditPages, "creditPage", 8) diff --git a/src/gi.h b/src/gi.h index 99f08ff59..bf6fd3026 100644 --- a/src/gi.h +++ b/src/gi.h @@ -82,12 +82,15 @@ struct gameinfo_t FString chatSound; FString finaleMusic; char finaleFlat[9]; - FString quitSound; char borderFlat[9]; + char SkyFlatName[9]; + char ArmorIcon1[9]; + char ArmorIcon2[9]; + fixed_t Armor2Percent; + FString quitSound; gameborder_t *border; int telefogheight; int defKickback; - char SkyFlatName[9]; FString translator; DWORD defaultbloodcolor; DWORD defaultbloodparticlecolor; diff --git a/src/m_cheat.cpp b/src/m_cheat.cpp index fbd99762b..bcf36d45d 100644 --- a/src/m_cheat.cpp +++ b/src/m_cheat.cpp @@ -688,7 +688,7 @@ void cht_Give (player_t *player, const char *name, int amount) { ABasicArmorPickup *armor = Spawn (0,0,0, NO_REPLACE); armor->SaveAmount = 100*deh.BlueAC; - armor->SavePercent = gameinfo.gametype != GAME_Heretic ? FRACUNIT/2 : FRACUNIT*3/4; + armor->SavePercent = gameinfo.Armor2Percent > 0? gameinfo.Armor2Percent : FRACUNIT/2; if (!armor->CallTryPickup (player->mo)) { armor->Destroy (); diff --git a/wadsrc/static/mapinfo/chex.txt b/wadsrc/static/mapinfo/chex.txt index dd39100fe..ee80a90e5 100644 --- a/wadsrc/static/mapinfo/chex.txt +++ b/wadsrc/static/mapinfo/chex.txt @@ -23,6 +23,7 @@ gameinfo defaultbloodcolor = "3f 7d 39" defaultbloodparticlecolor = "5f af 57" backpacktype = "ZorchPack" + armoricons = "ARM1A0", 0.5, "ARM2A0" statusbar = "sbarinfo/doom.txt" intermissionmusic = "$MUSIC_INTER" intermissioncounter = true diff --git a/wadsrc/static/mapinfo/doomcommon.txt b/wadsrc/static/mapinfo/doomcommon.txt index 01085df71..4339a5dcb 100644 --- a/wadsrc/static/mapinfo/doomcommon.txt +++ b/wadsrc/static/mapinfo/doomcommon.txt @@ -22,6 +22,7 @@ gameinfo defaultbloodcolor = "68 00 00" defaultbloodparticlecolor = "ff 00 00" backpacktype = "Backpack" + armoricons = "ARM1A0", 0.5, "ARM2A0" statusbar = "sbarinfo/doom.txt" intermissionmusic = "$MUSIC_DM2INT" intermissioncounter = true diff --git a/wadsrc/static/mapinfo/heretic.txt b/wadsrc/static/mapinfo/heretic.txt index 181917123..390152447 100644 --- a/wadsrc/static/mapinfo/heretic.txt +++ b/wadsrc/static/mapinfo/heretic.txt @@ -23,6 +23,7 @@ gameinfo defaultbloodcolor = "68 00 00" defaultbloodparticlecolor = "ff 00 00" backpacktype = "BagOfHolding" + armoricons = "SHLDA0", 0.75, "SHD2A0" statusbar = "" intermissionmusic = "mus_intr" intermissioncounter = false diff --git a/wadsrc/static/mapinfo/strife.txt b/wadsrc/static/mapinfo/strife.txt index e2162b63c..e8fd62f95 100644 --- a/wadsrc/static/mapinfo/strife.txt +++ b/wadsrc/static/mapinfo/strife.txt @@ -23,6 +23,7 @@ gameinfo defaultbloodcolor = "68 00 00" defaultbloodparticlecolor = "ff 00 00" backpacktype = "AmmoSatchel" + armoricons = "I_ARM2", 0.5, "I_ARM1" statusbar = "" intermissionmusic = "d_slide" intermissioncounter = false