Browse Source

Holding mouse when shift is held shouldn't lock to a target (Spells)

pull/2969/head
obligaron 5 years ago committed by Anders Jenbo
parent
commit
0818c55b88
  1. 2
      Source/controls/plrctrls.cpp
  2. 2
      Source/cursor.cpp
  3. 6
      Source/diablo.cpp
  4. 6
      Source/player.cpp
  5. 2
      Source/player.h
  6. 6
      Source/track.cpp

2
Source/controls/plrctrls.cpp

@ -1441,7 +1441,7 @@ void PerformSpellAction()
}
UpdateSpellTarget();
CheckPlrSpell();
CheckPlrSpell(false);
}
void CtrlUseInvItem()

2
Source/cursor.cpp

@ -330,7 +330,7 @@ void CheckCursMove()
my = clamp(my, 0, MAXDUNY - 1);
// While holding the button down we should retain target (but potentially lose it if it dies, goes out of view, etc)
if (sgbMouseDown != CLICK_NONE && pcursinvitem == -1 && IsNoneOf(LastMouseButtonAction, MouseActionType::Attack)) {
if (sgbMouseDown != CLICK_NONE && pcursinvitem == -1 && IsNoneOf(LastMouseButtonAction, MouseActionType::Attack, MouseActionType::Spell)) {
if (pcursmonst != -1) {
if (Monsters[pcursmonst]._mDelFlag || Monsters[pcursmonst]._mhitpoints >> 6 <= 0
|| ((dFlags[Monsters[pcursmonst].position.tile.x][Monsters[pcursmonst].position.tile.y] & BFLAG_VISIBLE) == 0))

6
Source/diablo.cpp

@ -359,7 +359,7 @@ void LeftMouseUp(int wParam)
ReleaseStoreBtn();
}
void RightMouseDown()
void RightMouseDown(bool isShiftHeld)
{
LastMouseButtonAction = MouseActionType::None;
@ -382,7 +382,7 @@ void RightMouseDown()
&& (pcursinvitem == -1 || !UseInvItem(MyPlayerId, pcursinvitem))) {
if (pcurs == CURSOR_HAND) {
if (pcursinvitem == -1 || !UseInvItem(MyPlayerId, pcursinvitem))
CheckPlrSpell();
CheckPlrSpell(isShiftHeld);
} else if (pcurs > CURSOR_HAND && pcurs < CURSOR_FIRSTITEM) {
NewCursor(CURSOR_HAND);
}
@ -631,7 +631,7 @@ void GameEventHandler(uint32_t uMsg, int32_t wParam, int32_t lParam)
GetMousePos(lParam);
if (sgbMouseDown == CLICK_NONE) {
sgbMouseDown = CLICK_RIGHT;
RightMouseDown();
RightMouseDown((wParam & DVL_MK_SHIFT) != 0);
}
return;
case DVL_WM_RBUTTONUP:

6
Source/player.cpp

@ -3433,7 +3433,7 @@ void CalcPlrStaff(Player &player)
}
}
void CheckPlrSpell()
void CheckPlrSpell(bool isShiftHeld)
{
bool addflag = false;
int sl;
@ -3513,11 +3513,11 @@ void CheckPlrSpell()
Direction sd = GetDirection(myPlayer.position.tile, cursPosition);
sl = GetSpellLevel(MyPlayerId, myPlayer._pRSpell);
NetSendCmdLocParam4(true, CMD_SPELLXYD, cursPosition, myPlayer._pRSpell, myPlayer._pRSplType, static_cast<uint16_t>(sd), sl);
} else if (pcursmonst != -1) {
} else if (pcursmonst != -1 && !isShiftHeld) {
LastMouseButtonAction = MouseActionType::SpellMonsterTarget;
sl = GetSpellLevel(MyPlayerId, myPlayer._pRSpell);
NetSendCmdParam4(true, CMD_SPELLID, pcursmonst, myPlayer._pRSpell, myPlayer._pRSplType, sl);
} else if (pcursplr != -1) {
} else if (pcursplr != -1 && !isShiftHeld) {
LastMouseButtonAction = MouseActionType::SpellPlayerTarget;
sl = GetSpellLevel(MyPlayerId, myPlayer._pRSpell);
NetSendCmdParam4(true, CMD_SPELLPID, pcursplr, myPlayer._pRSpell, myPlayer._pRSplType, sl);

2
Source/player.h

@ -631,7 +631,7 @@ void ClrPlrPath(Player &player);
bool PosOkPlayer(const Player &player, Point position);
void MakePlrPath(Player &player, Point targetPosition, bool endspace);
void CalcPlrStaff(Player &player);
void CheckPlrSpell();
void CheckPlrSpell(bool isShiftHeld);
void SyncPlrAnim(int pnum);
void SyncInitPlrPos(int pnum);
void SyncInitPlr(int pnum);

6
Source/track.cpp

@ -68,15 +68,15 @@ void RepeatMouseAction()
NetSendCmdParam1(true, rangedAttack ? CMD_RATTACKPID : CMD_ATTACKPID, pcursplr);
break;
case MouseActionType::Spell:
CheckPlrSpell();
CheckPlrSpell(true);
break;
case MouseActionType::SpellMonsterTarget:
if (pcursmonst != -1)
CheckPlrSpell();
CheckPlrSpell(false);
break;
case MouseActionType::SpellPlayerTarget:
if (pcursplr != -1 && !gbFriendlyMode)
CheckPlrSpell();
CheckPlrSpell(false);
break;
case MouseActionType::OperateObject:
if (pcursobj != -1) {

Loading…
Cancel
Save