diff --git a/Source/diablo.cpp b/Source/diablo.cpp index 4b53330c4..096a12c45 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -34,6 +34,7 @@ #include "movie.h" #include "multi.h" #include "nthread.h" +#include "objects.h" #include "options.h" #include "pfile.h" #include "plrmsg.h" @@ -501,6 +502,7 @@ static void SaveOptions() setIniInt("Game", "Auto Equip Jewelry", sgOptions.Gameplay.bAutoEquipJewelry); setIniInt("Game", "Randomize Quests", sgOptions.Gameplay.bRandomizeQuests); setIniInt("Game", "Show Monster Type", sgOptions.Gameplay.bShowMonsterType); + setIniInt("Game", "Disable Crippling Shrines", sgOptions.Gameplay.bDisableCripplingShrines); setIniValue("Network", "Bind Address", sgOptions.Network.szBindAddress); setIniInt("Network", "Port", sgOptions.Network.nPort); @@ -575,6 +577,7 @@ static void LoadOptions() sgOptions.Gameplay.bAutoEquipJewelry = getIniBool("Game", "Auto Equip Jewelry", false); 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); getIniValue("Network", "Bind Address", sgOptions.Network.szBindAddress, sizeof(sgOptions.Network.szBindAddress), "0.0.0.0"); sgOptions.Network.nPort = getIniInt("Network", "Port", 6112); @@ -718,7 +721,7 @@ static bool LeftMouseCmd(bool bShift) bNear = abs(plr[myplr]._px - cursmx) < 2 && abs(plr[myplr]._py - cursmy) < 2; if (pcursitem != -1 && pcurs == CURSOR_HAND && !bShift) { NetSendCmdLocParam1(true, invflag ? CMD_GOTOGETITEM : CMD_GOTOAGETITEM, cursmx, cursmy, pcursitem); - } else if (pcursobj != -1 && (!bShift || (bNear && object[pcursobj]._oBreak == 1))) { + } else if (pcursobj != -1 && (!objectIsDisabled(pcursobj)) && (!bShift || (bNear && object[pcursobj]._oBreak == 1))) { NetSendCmdLocParam1(true, pcurs == CURSOR_DISARM ? CMD_DISARMXY : CMD_OPOBJXY, cursmx, cursmy, pcursobj); } else if (plr[myplr]._pwtype == WT_RANGED) { if (bShift) { diff --git a/Source/objects.cpp b/Source/objects.cpp index f3a6cac74..389024ec4 100644 --- a/Source/objects.cpp +++ b/Source/objects.cpp @@ -4884,6 +4884,21 @@ void OperateLazStand(int pnum, int i) } } +bool objectIsDisabled(int i) +{ + if (!sgOptions.Gameplay.bDisableCripplingShrines) + return false; + if ((object[i]._otype == OBJ_GOATSHRINE) || (object[i]._otype == OBJ_CAULDRON)) + return true; + if ((object[i]._otype != OBJ_SHRINEL) && (object[i]._otype != OBJ_SHRINER)) + return false; + if ((object[i]._oVar1 == SHRINE_FASCINATING) || + (object[i]._oVar1 == SHRINE_ORNATE) || + (object[i]._oVar1 == SHRINE_SACRED)) + return true; + return false; +} + void OperateObject(int pnum, int i, bool TeleFlag) { bool sendmsg; @@ -5646,6 +5661,11 @@ void GetObjectStr(int i) infoclr = COL_RED; } } + if (objectIsDisabled(i)) { + sprintf(tempstr, "%s (disabled)", infostr); + strcpy(infostr, tempstr); + infoclr = COL_RED; + } } void operate_lv24_lever() diff --git a/Source/objects.h b/Source/objects.h index db3b14f66..f8837c649 100644 --- a/Source/objects.h +++ b/Source/objects.h @@ -87,5 +87,6 @@ void operate_lv24_lever(); void objects_454BA8(); void objects_rnd_454BEA(); bool objects_lv_24_454B04(int s); +bool objectIsDisabled(int i); } // namespace devilution diff --git a/Source/options.h b/Source/options.h index 7a7415980..1f1d40703 100644 --- a/Source/options.h +++ b/Source/options.h @@ -93,6 +93,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 Locally disable clicking on shrines which permanently cripple character. */ + bool bDisableCripplingShrines; }; struct ControllerOptions {