Browse Source

Add option to disable clicking on character crippling shrines

pull/1616/head
Xadhoom 5 years ago committed by Anders Jenbo
parent
commit
bf908da5bc
  1. 5
      Source/diablo.cpp
  2. 20
      Source/objects.cpp
  3. 1
      Source/objects.h
  4. 2
      Source/options.h

5
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) {

20
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()

1
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

2
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 {

Loading…
Cancel
Save