Browse Source

Assign ctrl to drop items

pull/2985/head
Yuri Pourre 5 years ago committed by Anders Jenbo
parent
commit
b8450dc792
  1. 4
      Source/controls/plrctrls.cpp
  2. 5
      Source/diablo.cpp
  3. 15
      Source/inv.cpp
  4. 4
      Source/inv.h
  5. 1
      Source/miniwin/miniwin.h
  6. 1
      Source/miniwin/misc_msg.cpp

4
Source/controls/plrctrls.cpp

@ -1416,7 +1416,7 @@ void PerformSpellAction()
TryIconCurs();
NewCursor(CURSOR_HAND);
} else {
CheckInvItem(true);
CheckInvItem(true, false);
ResetInvCursorPosition();
}
return;
@ -1463,7 +1463,7 @@ void CtrlUseInvItem()
}
if (item->isEquipment()) {
CheckInvItem(true); // auto-equip if it's an equipment
CheckInvItem(true, false); // auto-equip if it's an equipment
ResetInvCursorPosition();
} else {
UseInvItem(MyPlayerId, pcursinvitem);

5
Source/diablo.cpp

@ -308,6 +308,7 @@ void LeftMouseDown(int wParam)
}
bool isShiftHeld = (wParam & DVL_MK_SHIFT) != 0;
bool isCtrlHeld = (wParam & DVL_MK_CTRL) != 0;
if (!MainPanel.Contains(MousePosition)) {
if (!gmenu_is_active() && !TryIconCurs()) {
@ -320,7 +321,7 @@ void LeftMouseDown(int wParam)
CheckChrBtns();
} else if (invflag && RightPanel.Contains(MousePosition)) {
if (!dropGoldFlag)
CheckInvItem(isShiftHeld);
CheckInvItem(isShiftHeld, isCtrlHeld);
} else if (sbookflag && RightPanel.Contains(MousePosition)) {
CheckSBook();
} else if (pcurs >= CURSOR_FIRSTITEM) {
@ -337,7 +338,7 @@ void LeftMouseDown(int wParam)
}
} else {
if (!talkflag && !dropGoldFlag && !gmenu_is_active())
CheckInvScrn(isShiftHeld);
CheckInvScrn(isShiftHeld, isCtrlHeld);
DoPanBtn();
if (pcurs > CURSOR_HAND && pcurs < CURSOR_FIRSTITEM)
NewCursor(CURSOR_HAND);

15
Source/inv.cpp

@ -21,6 +21,7 @@
#include "plrmsg.h"
#include "stores.h"
#include "towners.h"
#include "controls/plrctrls.h"
#include "utils/language.h"
#include "utils/sdl_geometry.h"
#include "utils/stdcompat/optional.hpp"
@ -671,7 +672,7 @@ void CheckInvPaste(int pnum, Point cursorPosition)
}
}
void CheckInvCut(int pnum, Point cursorPosition, bool automaticMove)
void CheckInvCut(int pnum, Point cursorPosition, bool automaticMove, bool dropItem)
{
auto &player = Players[pnum];
@ -885,6 +886,10 @@ void CheckInvCut(int pnum, Point cursorPosition, bool automaticMove)
}
}
}
if (dropItem) {
TryDropItem();
}
}
void CheckBookLevel(Player &player)
@ -1505,20 +1510,20 @@ void inv_update_rem_item(Player &player, BYTE iv)
CalcPlrInv(player, player._pmode != PM_DEATH);
}
void CheckInvItem(bool isShiftHeld)
void CheckInvItem(bool isShiftHeld, bool isCtrlHeld)
{
if (pcurs >= CURSOR_FIRSTITEM) {
CheckInvPaste(MyPlayerId, MousePosition);
} else {
CheckInvCut(MyPlayerId, MousePosition, isShiftHeld);
CheckInvCut(MyPlayerId, MousePosition, isShiftHeld, isCtrlHeld);
}
}
void CheckInvScrn(bool isShiftHeld)
void CheckInvScrn(bool isShiftHeld, bool isCtrlHeld)
{
if (MousePosition.x > 190 + PANEL_LEFT && MousePosition.x < 437 + PANEL_LEFT
&& MousePosition.y > PANEL_TOP && MousePosition.y < 33 + PANEL_TOP) {
CheckInvItem(isShiftHeld);
CheckInvItem(isShiftHeld, isCtrlHeld);
}
}

4
Source/inv.h

@ -150,12 +150,12 @@ bool GoldAutoPlace(Player &player);
bool GoldAutoPlaceInInventorySlot(Player &player, int slotIndex);
void CheckInvSwap(Player &player, BYTE bLoc, int idx, uint16_t wCI, int seed, bool bId, uint32_t dwBuff);
void inv_update_rem_item(Player &player, BYTE iv);
void CheckInvItem(bool isShiftHeld = false);
void CheckInvItem(bool isShiftHeld = false, bool isCtrlHeld = false);
/**
* Check for interactions with belt
*/
void CheckInvScrn(bool isShiftHeld);
void CheckInvScrn(bool isShiftHeld, bool isCtrlHeld);
void CheckItemStats(Player &player);
void InvGetItem(int pnum, Item *item, int ii);
void AutoGetItem(int pnum, Item *item, int ii);

1
Source/miniwin/miniwin.h

@ -163,6 +163,7 @@ void ClearMessageQueue();
#define DVL_VK_OEM_6 0xDD // For the US standard keyboard, the ']}' key
#define DVL_VK_OEM_7 0xDE // For the US standard keyboard, the 'single-quote/double-quote' key
#define DVL_MK_CTRL 0x0008
#define DVL_MK_SHIFT 0x0004
#define DVL_MK_LBUTTON 0x0001
#define DVL_MK_RBUTTON 0x0002

1
Source/miniwin/misc_msg.cpp

@ -261,6 +261,7 @@ int32_t PositionForMouse(int16_t x, int16_t y)
int32_t KeystateForMouse(int32_t ret)
{
ret |= (SDL_GetModState() & KMOD_SHIFT) != 0 ? DVL_MK_SHIFT : 0;
ret |= (SDL_GetModState() & KMOD_CTRL) != 0 ? DVL_MK_CTRL : 0;
// XXX: other DVL_MK_* codes not implemented
return ret;
}

Loading…
Cancel
Save