Skip to content

Commit b812abd

Browse files
committed
Merge FixAutomapHardcodedRS branch
1 parent 8adfd23 commit b812abd

13 files changed

Lines changed: 151 additions & 80 deletions

File tree

Source.zip

1.11 MB
Binary file not shown.

Source/controls/game_controls.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ bool GetGameAction(const SDL_Event &event, ControllerButtonEvent ctrlEvent, Game
166166
|| (!VirtualGamepadState.secondaryActionButton.isHeld && ControllerActionHeld == GameActionType_SECONDARY_ACTION)
167167
|| (!VirtualGamepadState.spellActionButton.isHeld && ControllerActionHeld == GameActionType_CAST_SPELL)) {
168168
ControllerActionHeld = GameActionType_NONE;
169-
LastMouseButtonAction = MouseActionType::None;
169+
LastPlayerAction = PlayerActionType::None;
170170
}
171171
}
172172
}
@@ -265,7 +265,7 @@ void PressControllerButton(ControllerButton button)
265265
switch (button) {
266266
case devilution::ControllerButton_BUTTON_DPAD_UP:
267267
PressEscKey();
268-
LastMouseButtonAction = MouseActionType::None;
268+
LastPlayerAction = PlayerActionType::None;
269269
PadHotspellMenuActive = false;
270270
PadMenuNavigatorActive = false;
271271
gamemenu_on();

Source/controls/game_controls.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ enum GameActionType : uint8_t {
2121
GameActionType_TOGGLE_SPELL_BOOK,
2222
GameActionType_TOGGLE_QUEST_LOG,
2323
GameActionType_SEND_KEY,
24+
GameActionType_MOVE_AUTOMAP,
2425
};
2526

2627
struct GameActionSendKey {

Source/controls/plrctrls.cpp

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ void Interact()
515515
}
516516

517517
NetSendCmdLoc(MyPlayerId, true, myPlayer.UsesRangedWeapon() ? CMD_RATTACKXY : CMD_SATTACKXY, position);
518-
LastMouseButtonAction = MouseActionType::Attack;
518+
LastPlayerAction = PlayerActionType::Attack;
519519
return;
520520
}
521521

@@ -525,19 +525,19 @@ void Interact()
525525
} else {
526526
NetSendCmdParam1(true, CMD_RATTACKID, pcursmonst);
527527
}
528-
LastMouseButtonAction = MouseActionType::AttackMonsterTarget;
528+
LastPlayerAction = PlayerActionType::AttackMonsterTarget;
529529
return;
530530
}
531531

532532
if (leveltype != DTYPE_TOWN && PlayerUnderCursor != nullptr && !myPlayer.friendlyMode) {
533533
NetSendCmdParam1(true, myPlayer.UsesRangedWeapon() ? CMD_RATTACKPID : CMD_ATTACKPID, PlayerUnderCursor->getId());
534-
LastMouseButtonAction = MouseActionType::AttackPlayerTarget;
534+
LastPlayerAction = PlayerActionType::AttackPlayerTarget;
535535
return;
536536
}
537537

538538
if (ObjectUnderCursor != nullptr) {
539539
NetSendCmdLoc(MyPlayerId, true, CMD_OPOBJXY, cursPosition);
540-
LastMouseButtonAction = MouseActionType::OperateObject;
540+
LastPlayerAction = PlayerActionType::OperateObject;
541541
return;
542542
}
543543
}
@@ -1826,15 +1826,6 @@ void HandleRightStickMotion()
18261826
return;
18271827
}
18281828

1829-
if (AutomapActive) { // move map
1830-
int dx = 0;
1831-
int dy = 0;
1832-
acc.Pool(&dx, &dy, 32);
1833-
AutomapOffset.deltaX += dy + dx;
1834-
AutomapOffset.deltaY += dy - dx;
1835-
return;
1836-
}
1837-
18381829
{ // move cursor
18391830
InvalidateInventorySlot();
18401831
int x = MousePosition.x;
@@ -1899,7 +1890,7 @@ void plrctrls_after_check_curs_move()
18991890
}
19001891

19011892
// While holding the button down we should retain target (but potentially lose it if it dies, goes out of view, etc)
1902-
if (ControllerActionHeld != GameActionType_NONE && IsNoneOf(LastMouseButtonAction, MouseActionType::None, MouseActionType::Attack, MouseActionType::Spell)) {
1893+
if (ControllerActionHeld != GameActionType_NONE && IsNoneOf(LastPlayerAction, PlayerActionType::None, PlayerActionType::Attack, PlayerActionType::Spell)) {
19031894
InvalidateTargets();
19041895

19051896
if (pcursmonst == -1 && ObjectUnderCursor == nullptr && pcursitem == -1 && pcursinvitem == -1 && pcursstashitem == StashStruct::EmptyCell && PlayerUnderCursor == nullptr) {
@@ -2100,11 +2091,11 @@ void PerformSpellAction()
21002091
UpdateSpellTarget(myPlayer._pRSpell);
21012092
CheckPlrSpell(false);
21022093
if (PlayerUnderCursor != nullptr)
2103-
LastMouseButtonAction = MouseActionType::SpellPlayerTarget;
2094+
LastPlayerAction = PlayerActionType::SpellPlayerTarget;
21042095
else if (pcursmonst != -1)
2105-
LastMouseButtonAction = MouseActionType::SpellMonsterTarget;
2096+
LastPlayerAction = PlayerActionType::SpellMonsterTarget;
21062097
else
2107-
LastMouseButtonAction = MouseActionType::Spell;
2098+
LastPlayerAction = PlayerActionType::Spell;
21082099
}
21092100

21102101
void CtrlUseInvItem()
@@ -2187,7 +2178,7 @@ void PerformSecondaryAction()
21872178
NetSendCmdLocParam1(true, CMD_GOTOAGETITEM, cursPosition, pcursitem);
21882179
} else if (ObjectUnderCursor != nullptr) {
21892180
NetSendCmdLoc(MyPlayerId, true, CMD_OPOBJXY, cursPosition);
2190-
LastMouseButtonAction = MouseActionType::OperateObject;
2181+
LastPlayerAction = PlayerActionType::OperateObject;
21912182
} else {
21922183
if (pcursmissile != nullptr) {
21932184
MakePlrPath(myPlayer, pcursmissile->position.tile, true);
@@ -2204,7 +2195,7 @@ void PerformSecondaryAction()
22042195

22052196
void QuickCast(size_t slot)
22062197
{
2207-
MouseActionType prevMouseButtonAction = LastMouseButtonAction;
2198+
PlayerActionType prevMouseButtonAction = LastPlayerAction;
22082199
Player &myPlayer = *MyPlayer;
22092200
SpellID spell = myPlayer._pSplHotKey[slot];
22102201
SpellType spellType = myPlayer._pSplTHotKey[slot];
@@ -2214,7 +2205,7 @@ void QuickCast(size_t slot)
22142205
}
22152206

22162207
CheckPlrSpell(false, spell, spellType);
2217-
LastMouseButtonAction = prevMouseButtonAction;
2208+
LastPlayerAction = prevMouseButtonAction;
22182209
}
22192210

22202211
} // namespace devilution

Source/cursor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,7 @@ void ShiftToDiamondGridAlignment(Point screenPosition, Point &tile, bool &flipfl
762762
*/
763763
bool CheckMouseHold(const Point currentTile)
764764
{
765-
if ((sgbMouseDown != CLICK_NONE || ControllerActionHeld != GameActionType_NONE) && IsNoneOf(LastMouseButtonAction, MouseActionType::None, MouseActionType::Attack, MouseActionType::Spell)) {
765+
if ((sgbMouseDown != CLICK_NONE || ControllerActionHeld != GameActionType_NONE) && IsNoneOf(LastPlayerAction, PlayerActionType::None, PlayerActionType::Attack, PlayerActionType::Spell)) {
766766
InvalidateTargets();
767767

768768
if (pcursmonst == -1 && ObjectUnderCursor == nullptr && pcursitem == -1 && pcursinvitem == -1 && pcursstashitem == StashStruct::EmptyCell && PlayerUnderCursor == nullptr) {

0 commit comments

Comments
 (0)