forked from Mirrors/openclonk
Hotkeys select the item at release now
Holding hotkey + left/right mouse button selects it into the corresponding handrope
parent
a0e9ef1406
commit
db53603396
|
@ -639,6 +639,16 @@ public func OnHandSelectionChange(int old, int new, int handslot)
|
|||
OnSlotObjectChanged(handslot);
|
||||
}
|
||||
|
||||
protected func OnInventoryHotkeyPress(int slot)
|
||||
{
|
||||
backpack[slot]->OnMouseOver(GetOwner());
|
||||
}
|
||||
|
||||
protected func OnInventoryHotkeyRelease(int slot)
|
||||
{
|
||||
backpack[slot]->OnMouseOut(GetOwner());
|
||||
}
|
||||
|
||||
// call from HUDAdapter (Clonk)
|
||||
public func OnSlotObjectChanged(int slot)
|
||||
{
|
||||
|
|
|
@ -45,6 +45,8 @@ local force_collection;
|
|||
local inventory;
|
||||
local use_objects;
|
||||
|
||||
local handslot_choice_pending;
|
||||
|
||||
/* Item limit */
|
||||
|
||||
private func HandObjects() { return 2; }
|
||||
|
@ -86,6 +88,8 @@ public func SetHandItemPos(int hand, int inv)
|
|||
this->~OnSlotFull(hand);
|
||||
else
|
||||
this->~OnSlotEmpty(hand);
|
||||
|
||||
handslot_choice_pending = false;
|
||||
}
|
||||
|
||||
/* Returns the position in the inventory of the ith use item */
|
||||
|
@ -487,6 +491,14 @@ public func ObjectControl(int plr, int ctrl, int x, int y, int strength, bool re
|
|||
if (!this)
|
||||
return false;
|
||||
|
||||
if(ctrl == CON_InteractionBar)
|
||||
{
|
||||
if(!release);
|
||||
// todo: show action bar
|
||||
else;
|
||||
// todo: hide action bar
|
||||
}
|
||||
|
||||
//Log(Format("%d, %d, %s, strength: %d, repeat: %v, release: %v", x,y,GetPlayerControlName(ctrl), strength, repeat, release),this);
|
||||
|
||||
// Backpack menu
|
||||
|
@ -610,6 +622,37 @@ public func ObjectControl(int plr, int ctrl, int x, int y, int strength, bool re
|
|||
return true;
|
||||
}
|
||||
|
||||
// this wall of text is called when 1-0 is beeing held, and left or right mouse button is pressed.
|
||||
var hand = 0;
|
||||
hot = 0;
|
||||
if (ctrl == CON_Hotkey0Select) hot = 10;
|
||||
if (ctrl == CON_Hotkey1Select) hot = 1;
|
||||
if (ctrl == CON_Hotkey2Select) hot = 2;
|
||||
if (ctrl == CON_Hotkey3Select) hot = 3;
|
||||
if (ctrl == CON_Hotkey4Select) hot = 4;
|
||||
if (ctrl == CON_Hotkey5Select) hot = 5;
|
||||
if (ctrl == CON_Hotkey6Select) hot = 6;
|
||||
if (ctrl == CON_Hotkey7Select) hot = 7;
|
||||
if (ctrl == CON_Hotkey8Select) hot = 8;
|
||||
if (ctrl == CON_Hotkey9Select) hot = 9;
|
||||
if (ctrl == CON_Hotkey0SelectAlt) {hot = 10; hand=1; }
|
||||
if (ctrl == CON_Hotkey1SelectAlt) {hot = 1; hand=1; }
|
||||
if (ctrl == CON_Hotkey2SelectAlt) {hot = 2; hand=1; }
|
||||
if (ctrl == CON_Hotkey3SelectAlt) {hot = 3; hand=1; }
|
||||
if (ctrl == CON_Hotkey4SelectAlt) {hot = 4; hand=1; }
|
||||
if (ctrl == CON_Hotkey5SelectAlt) {hot = 5; hand=1; }
|
||||
if (ctrl == CON_Hotkey6SelectAlt) {hot = 6; hand=1; }
|
||||
if (ctrl == CON_Hotkey7SelectAlt) {hot = 7; hand=1; }
|
||||
if (ctrl == CON_Hotkey8SelectAlt) {hot = 8; hand=1; }
|
||||
if (ctrl == CON_Hotkey9SelectAlt) {hot = 9; hand=1; }
|
||||
|
||||
if(hot > 0 && hot <= MaxContentsCount())
|
||||
{
|
||||
SetHandItemPos(hand, hot-1);
|
||||
this->~OnInventoryHotkeyRelease(hot-1);
|
||||
return true;
|
||||
}
|
||||
|
||||
// inventory
|
||||
hot = 0;
|
||||
if (ctrl == CON_Hotkey0) hot = 10;
|
||||
|
@ -623,13 +666,33 @@ public func ObjectControl(int plr, int ctrl, int x, int y, int strength, bool re
|
|||
if (ctrl == CON_Hotkey8) hot = 8;
|
||||
if (ctrl == CON_Hotkey9) hot = 9;
|
||||
|
||||
// only the last-pressed key is taken into consideration.
|
||||
// if 2 hotkeys are held, the earlier one is beeing treated as released
|
||||
if (hot > 0 && hot <= MaxContentsCount())
|
||||
{
|
||||
SetHandItemPos(0, hot-1);
|
||||
// if released, we chose, if not chosen already
|
||||
if(release)
|
||||
{
|
||||
if(handslot_choice_pending == hot)
|
||||
{
|
||||
SetHandItemPos(0, hot-1);
|
||||
this->~OnInventoryHotkeyRelease(hot-1);
|
||||
}
|
||||
}
|
||||
// else we just highlight
|
||||
else
|
||||
{
|
||||
if(handslot_choice_pending)
|
||||
{
|
||||
this->~OnInventoryHotkeyRelease(handslot_choice_pending-1);
|
||||
}
|
||||
handslot_choice_pending = hot;
|
||||
this->~OnInventoryHotkeyPress(hot-1);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
var proc = GetProcedure();
|
||||
|
||||
// cancel usage
|
||||
|
|
|
@ -156,6 +156,20 @@ protected func OnHandSelectionChange(int old, int new, int handslot)
|
|||
return _inherited(old, new, handslot, ...);
|
||||
}
|
||||
|
||||
protected func OnInventoryHotkeyPress(int slot)
|
||||
{
|
||||
if (HUDcontroller)
|
||||
HUDcontroller->OnInventoryHotkeyPress(slot);
|
||||
return _inherited(slot, ...);
|
||||
}
|
||||
|
||||
protected func OnInventoryHotkeyRelease(int slot)
|
||||
{
|
||||
if (HUDcontroller)
|
||||
HUDcontroller->OnInventoryHotkeyRelease(slot);
|
||||
return _inherited(slot, ...);
|
||||
}
|
||||
|
||||
// when two items switch place
|
||||
protected func OnInventoryChange(int old, int new)
|
||||
{
|
||||
|
|
|
@ -173,43 +173,103 @@
|
|||
|
||||
[ControlDef]
|
||||
Identifier=Hotkey1
|
||||
SendCursorPos=1
|
||||
Hold=1
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Hotkey2
|
||||
SendCursorPos=1
|
||||
Hold=1
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Hotkey3
|
||||
SendCursorPos=1
|
||||
Hold=1
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Hotkey4
|
||||
SendCursorPos=1
|
||||
Hold=1
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Hotkey5
|
||||
SendCursorPos=1
|
||||
Hold=1
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Hotkey6
|
||||
SendCursorPos=1
|
||||
Hold=1
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Hotkey7
|
||||
SendCursorPos=1
|
||||
Hold=1
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Hotkey8
|
||||
SendCursorPos=1
|
||||
Hold=1
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Hotkey9
|
||||
SendCursorPos=1
|
||||
Hold=1
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Hotkey0
|
||||
SendCursorPos=1
|
||||
Hold=1
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Hotkey1Select
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Hotkey1SelectAlt
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Hotkey2Select
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Hotkey2SelectAlt
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Hotkey3Select
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Hotkey3SelectAlt
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Hotkey4Select
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Hotkey4SelectAlt
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Hotkey5Select
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Hotkey5SelectAlt
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Hotkey6Select
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Hotkey6SelectAlt
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Hotkey7Select
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Hotkey7SelectAlt
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Hotkey8Select
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Hotkey8SelectAlt
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Hotkey9Select
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Hotkey9SelectAlt
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Hotkey0Select
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Hotkey0SelectAlt
|
||||
|
||||
# Controlling (contents, vehicles, structures)
|
||||
|
||||
|
@ -295,6 +355,10 @@
|
|||
GUIDesc=Interact with object in landscape
|
||||
SendCursorPos=1
|
||||
|
||||
[ControlDef]
|
||||
Identifier=InteractionBar
|
||||
Hold=1
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Enter
|
||||
GUIName=Enter
|
||||
|
@ -307,7 +371,6 @@
|
|||
GUIDesc=Exit the building
|
||||
|
||||
|
||||
|
||||
# Interaction Hotkeys (lower bar)
|
||||
|
||||
[ControlDef]
|
||||
|
@ -1200,6 +1263,106 @@
|
|||
Key=0
|
||||
Control=Hotkey0
|
||||
|
||||
[Assignment]
|
||||
Key=Hotkey1,Mouse1ButtonLeft
|
||||
Control=Hotkey1Select
|
||||
Priority=200
|
||||
|
||||
[Assignment]
|
||||
Key=Hotkey1,Mouse1ButtonRight
|
||||
Control=Hotkey1SelectAlt
|
||||
Priority=200
|
||||
|
||||
[Assignment]
|
||||
Key=Hotkey2,Mouse1ButtonLeft
|
||||
Control=Hotkey2Select
|
||||
Priority=200
|
||||
|
||||
[Assignment]
|
||||
Key=Hotkey2,Mouse1ButtonRight
|
||||
Control=Hotkey2SelectAlt
|
||||
Priority=200
|
||||
|
||||
[Assignment]
|
||||
Key=Hotkey3,Mouse1ButtonLeft
|
||||
Control=Hotkey3Select
|
||||
Priority=200
|
||||
|
||||
[Assignment]
|
||||
Key=Hotkey3,Mouse1ButtonRight
|
||||
Control=Hotkey3SelectAlt
|
||||
Priority=200
|
||||
|
||||
[Assignment]
|
||||
Key=Hotkey4,Mouse1ButtonLeft
|
||||
Control=Hotkey4Select
|
||||
Priority=200
|
||||
|
||||
[Assignment]
|
||||
Key=Hotkey4,Mouse1ButtonRight
|
||||
Control=Hotkey4SelectAlt
|
||||
Priority=200
|
||||
|
||||
[Assignment]
|
||||
Key=Hotkey5,Mouse1ButtonLeft
|
||||
Control=Hotkey5Select
|
||||
Priority=200
|
||||
|
||||
[Assignment]
|
||||
Key=Hotkey5,Mouse1ButtonRight
|
||||
Control=Hotkey5SelectAlt
|
||||
Priority=200
|
||||
|
||||
[Assignment]
|
||||
Key=Hotkey6,Mouse1ButtonLeft
|
||||
Control=Hotkey6Select
|
||||
Priority=200
|
||||
|
||||
[Assignment]
|
||||
Key=Hotkey6,Mouse1ButtonRight
|
||||
Control=Hotkey6SelectAlt
|
||||
Priority=200
|
||||
|
||||
[Assignment]
|
||||
Key=Hotkey7,Mouse1ButtonLeft
|
||||
Control=Hotkey7Select
|
||||
Priority=200
|
||||
|
||||
[Assignment]
|
||||
Key=Hotkey7,Mouse1ButtonRight
|
||||
Control=Hotkey7SelectAlt
|
||||
Priority=200
|
||||
|
||||
[Assignment]
|
||||
Key=Hotkey8,Mouse1ButtonLeft
|
||||
Control=Hotkey8Select
|
||||
Priority=200
|
||||
|
||||
[Assignment]
|
||||
Key=Hotkey8,Mouse1ButtonRight
|
||||
Control=Hotkey8SelectAlt
|
||||
Priority=200
|
||||
|
||||
[Assignment]
|
||||
Key=Hotkey9,Mouse1ButtonLeft
|
||||
Control=Hotkey9Select
|
||||
Priority=200
|
||||
|
||||
[Assignment]
|
||||
Key=Hotkey9,Mouse1ButtonRight
|
||||
Control=Hotkey9SelectAlt
|
||||
Priority=200
|
||||
|
||||
[Assignment]
|
||||
Key=Hotkey0,Mouse1ButtonLeft
|
||||
Control=Hotkey0Select
|
||||
Priority=200
|
||||
|
||||
[Assignment]
|
||||
Key=Hotkey0,Mouse1ButtonRight
|
||||
Control=Hotkey0SelectAlt
|
||||
Priority=200
|
||||
|
||||
[Assignment]
|
||||
Key=Shift+Hotkey1
|
||||
Control=InteractionHotkey1
|
||||
|
@ -1287,6 +1450,11 @@
|
|||
[ControlSet]
|
||||
Name=*
|
||||
|
||||
# Interaction-Bar
|
||||
[Assignment]
|
||||
Key=L
|
||||
Control=InteractionBar
|
||||
|
||||
# Collect
|
||||
|
||||
[Assignment]
|
||||
|
|
Loading…
Reference in New Issue