removed the hold-number-and-click-mouse controls

Controls
David Dormagen 2013-05-24 00:00:18 +02:00
parent 6c64963f1f
commit 6c861f9165
3 changed files with 5 additions and 153 deletions

View File

@ -505,18 +505,6 @@ public func OnHandSelectionChange(int old, int new, int handslot)
OnSlotObjectChanged(handslot);
}
protected func OnInventoryHotkeyPress(int slot)
{
if(inventory[slot])
inventory[slot]->OnMouseOver(GetOwner());
}
protected func OnInventoryHotkeyRelease(int slot)
{
if(inventory[slot])
inventory[slot]->OnMouseOut(GetOwner());
}
// call from HUDAdapter (Clonk)
public func OnSlotObjectChanged(int slot)
{

View File

@ -8,7 +8,6 @@
/*
used properties:
this.inventory.last_slot: last inventory-slot that has been selected. Used for QuickSwitching
this.inventory.handslot_choice_pending: used to determine if a slot-hotkey (1-9) has already been handled by a mouseclick
other used properties of "this.inventory" might have been declared in Inventory.ocd
@ -21,7 +20,6 @@ func Construction()
if(this.inventory == nil)
this.inventory = {};
this.inventory.last_slot = 0;
this.inventory.handslot_choice_pending = false;
return _inherited(...);
}
@ -105,28 +103,7 @@ public func ObjectControl(int plr, int ctrl, int x, int y, int strength, bool re
this->~DropInventoryItem(hot-1);
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(hot > 0 && hot <= this->MaxContentsCount())
{
SetHandItemPos(hand, hot-1);
this->~OnInventoryHotkeyRelease(hot-1);
return true;
}
// inventory
hot = 0;
if (ctrl == CON_Hotkey0) hot = 10;
@ -141,31 +118,12 @@ public func ObjectControl(int plr, int ctrl, int x, int y, int strength, bool re
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 2 hotkeys are held, the earlier one is being treated as released
if (hot > 0 && hot <= this->MaxContentsCount())
{
// if released, we chose, if not chosen already
if(release)
{
if(this.inventory.handslot_choice_pending == hot)
{
SetHandItemPos(0, hot-1);
this->~OnInventoryHotkeyRelease(hot-1);
}
}
// else we just highlight
else
{
if(this.inventory.handslot_choice_pending)
{
this->~OnInventoryHotkeyRelease(this.inventory.handslot_choice_pending-1);
}
this.inventory.handslot_choice_pending = hot;
this->~OnInventoryHotkeyPress(hot-1);
}
SetHandItemPos(0, hot-1);
return true;
}
}
// Collecting
if (ctrl == CON_Collect)
@ -195,9 +153,7 @@ public func SetHandItemPos(int hand, int inv)
if(hand == 0)
this.inventory.last_slot = this->GetHandItemPos(0);
var r = _inherited(hand, inv, ...);
this.inventory.handslot_choice_pending = false;
return r;
return _inherited(hand, inv, ...);
}
/* Backpack control */
func Selected(object mnu, object mnu_item)

View File

@ -170,52 +170,42 @@
[ControlDef]
Identifier=Hotkey1
GUIName=$CON_Hotkey1$
Hold=1
[ControlDef]
Identifier=Hotkey2
GUIName=$CON_Hotkey2$
Hold=1
[ControlDef]
Identifier=Hotkey3
GUIName=$CON_Hotkey3$
Hold=1
[ControlDef]
Identifier=Hotkey4
GUIName=$CON_Hotkey4$
Hold=1
[ControlDef]
Identifier=Hotkey5
GUIName=$CON_Hotkey5$
Hold=1
[ControlDef]
Identifier=Hotkey6
GUIName=$CON_Hotkey6$
Hold=1
[ControlDef]
Identifier=Hotkey7
GUIName=$CON_Hotkey7$
Hold=1
[ControlDef]
Identifier=Hotkey8
GUIName=$CON_Hotkey8$
Hold=1
[ControlDef]
Identifier=Hotkey9
GUIName=$CON_Hotkey9$
Hold=1
[ControlDef]
Identifier=Hotkey0
GUIName=$CON_Hotkey0$
Hold=1
[ControlDef]
Identifier=DropHotkey1
@ -246,36 +236,6 @@
[ControlDef]
Identifier=DropHotkey0
[ControlDef]
Identifier=Hotkey1Select
[ControlDef]
Identifier=Hotkey2Select
[ControlDef]
Identifier=Hotkey3Select
[ControlDef]
Identifier=Hotkey4Select
[ControlDef]
Identifier=Hotkey5Select
[ControlDef]
Identifier=Hotkey6Select
[ControlDef]
Identifier=Hotkey7Select
[ControlDef]
Identifier=Hotkey8Select
[ControlDef]
Identifier=Hotkey9Select
[ControlDef]
Identifier=Hotkey0Select
# Controlling (contents, vehicles, structures)
@ -1290,58 +1250,6 @@
GUIDesc=$KEY_Hotkey_Desc$
GUIGroup=80
# Hotkey + Mousebutton Select
[Assignment]
Key=CON_Hotkey1,Mouse1ButtonLeft
Control=Hotkey1Select
Priority=200
[Assignment]
Key=CON_Hotkey2,Mouse1ButtonLeft
Control=Hotkey2Select
Priority=200
[Assignment]
Key=CON_Hotkey3,Mouse1ButtonLeft
Control=Hotkey3Select
Priority=200
[Assignment]
Key=CON_Hotkey4,Mouse1ButtonLeft
Control=Hotkey4Select
Priority=200
[Assignment]
Key=CON_Hotkey5,Mouse1ButtonLeft
Control=Hotkey5Select
Priority=200
[Assignment]
Key=CON_Hotkey6,Mouse1ButtonLeft
Control=Hotkey6Select
Priority=200
[Assignment]
Key=CON_Hotkey7,Mouse1ButtonLeft
Control=Hotkey7Select
Priority=200
[Assignment]
Key=CON_Hotkey8,Mouse1ButtonLeft
Control=Hotkey8Select
Priority=200
[Assignment]
Key=CON_Hotkey9,Mouse1ButtonLeft
Control=Hotkey9Select
Priority=200
[Assignment]
Key=CON_Hotkey0,Mouse1ButtonLeft
Control=Hotkey0Select
Priority=200
[Assignment]
Key=Shift+CON_Hotkey1
Control=DropHotkey1