diff --git a/Source/inv.cpp b/Source/inv.cpp index bb819ce50..3eff4a085 100644 --- a/Source/inv.cpp +++ b/Source/inv.cpp @@ -2010,8 +2010,19 @@ bool UseInvItem(int pnum, int cii) if (talkflag) return true; c = cii - INVITEM_BELT_FIRST; + item = &player.SpdList[c]; speedlist = true; + + //If selected speedlist item exists in InvList, use the InvList item. + for (int i = 0; i < player._pNumInv && sgOptions.Gameplay.bAutoRefillBelt; i++) { + if (player.InvList[i]._iMiscId == item->_iMiscId && player.InvList[i]._iSpell == item->_iSpell) { + c = i; + item = &player.InvList[c]; + speedlist = false; + break; + } + } } constexpr int SpeechDelay = 10; @@ -2020,6 +2031,7 @@ bool UseInvItem(int pnum, int cii) return true; } if (item->IDidx == IDI_FUNGALTM) { + PlaySFX(IS_IBOOK); player.Say(HeroSpeech::ThatDidntDoAnything, SpeechDelay); return true; diff --git a/Source/options.cpp b/Source/options.cpp index f8f098411..f2b498ec7 100644 --- a/Source/options.cpp +++ b/Source/options.cpp @@ -281,6 +281,7 @@ void LoadOptions() sgOptions.Gameplay.bRandomizeQuests = GetIniBool("Game", "Randomize Quests", true); sgOptions.Gameplay.bShowMonsterType = GetIniBool("Game", "Show Monster Type", false); sgOptions.Gameplay.bDisableCripplingShrines = GetIniBool("Game", "Disable Crippling Shrines", false); + sgOptions.Gameplay.bAutoRefillBelt = GetIniBool("Game", "Auto Refill Belt", AUTO_PICKUP_DEFAULT(false)); GetIniValue("Network", "Bind Address", sgOptions.Network.szBindAddress, sizeof(sgOptions.Network.szBindAddress), "0.0.0.0"); sgOptions.Network.nPort = GetIniInt("Network", "Port", 6112); @@ -432,6 +433,7 @@ void SaveOptions() SetIniValue("Game", "Randomize Quests", sgOptions.Gameplay.bRandomizeQuests); SetIniValue("Game", "Show Monster Type", sgOptions.Gameplay.bShowMonsterType); SetIniValue("Game", "Disable Crippling Shrines", sgOptions.Gameplay.bDisableCripplingShrines); + SetIniValue("Game", "Auto Refill Belt", sgOptions.Gameplay.bAutoRefillBelt); SetIniValue("Network", "Bind Address", sgOptions.Network.szBindAddress); SetIniValue("Network", "Port", sgOptions.Network.nPort); diff --git a/Source/options.h b/Source/options.h index f75567d6c..4ff24eb64 100644 --- a/Source/options.h +++ b/Source/options.h @@ -134,6 +134,8 @@ struct GameplayOptions { bool bRandomizeQuests; /** @brief Indicates whether or not monster type (Animal, Demon, Undead) is shown along with other monster information. */ bool bShowMonsterType; + /** @brief Refill belt form inventory, or rather, use potions/scrolls from inventory first when belt item is consumed. */ + bool bAutoRefillBelt; /** @brief Locally disable clicking on shrines which permanently cripple character. */ bool bDisableCripplingShrines; };