now always use on leftclick and throw on rightclick (drop if you click your Clonk or below); also removed some old references to the right mouse button (UseAlt)

Controls
David Dormagen 2015-03-09 13:33:31 +01:00
parent 77e8d77921
commit 379d189787
7 changed files with 50 additions and 140 deletions

View File

@ -313,7 +313,7 @@ public func ObjectControl(int plr, int ctrl, int x, int y, int strength, bool re
var contents = this->GetHandItem(0);
// usage
var use = (ctrl == CON_Use || ctrl == CON_UseDelayed || ctrl == CON_UseAlt || ctrl == CON_UseAltDelayed);
var use = (ctrl == CON_Use || ctrl == CON_UseDelayed);
if (use)
{
if (house)
@ -362,25 +362,33 @@ public func ObjectControl(int plr, int ctrl, int x, int y, int strength, bool re
}
}
// A click on throw can also just abort usage without having any other effects.
// todo: figure out if wise.
var currently_in_use = this.control.current_object != nil;
if ((ctrl == CON_Throw || ctrl == CON_ThrowDelayed) && currently_in_use && !release)
{
CancelUse();
return true;
}
// Throwing and dropping
// only if not in house, not grabbing a vehicle and an item selected
// only act on press, not release
if (!house && (!vehicle || proc == "ATTACH") && !release)
{
{
if (contents && !contents->~QueryRejectDeparture(this))
{
// special treatmant so that we know it's a forced throw
if(ctrl == CON_ForcedThrow)
{
ctrl = CON_Throw;
}
{
// just drop in certain situations
var only_drop = proc == "SCALE" || proc == "HANGLE" || proc == "SWIM";
// also drop if no throw would be possible anyway
if (only_drop || Distance(0, 0, x, y) < 10 || (Abs(x) < 10 && y > 10))
only_drop = true;
// throw
if (ctrl == CON_Throw)
{
CancelUse();
if (proc == "SCALE" || proc == "HANGLE" || proc == "SWIM")
if (only_drop)
return ObjectCommand("Drop", contents);
else
return ObjectCommand("Throw", contents, x, y);
@ -393,7 +401,7 @@ public func ObjectControl(int plr, int ctrl, int x, int y, int strength, bool re
{
VirtualCursor()->StopAim();
if (proc == "SCALE" || proc == "HANGLE")
if (only_drop)
return ObjectCommand("Drop", contents);
else
return ObjectCommand("Throw", contents, this.control.mlastx, this.control.mlasty);
@ -500,7 +508,12 @@ func FxShelvedCommandStop(target, effect, reason, temp)
public func CancelUse()
{
if (!this.control.current_object) return;
if (!this.control.current_object)
{
// just forget any possibly stored actions
StopShelvedCommand();
return;
}
// use the saved x,y coordinates for canceling
CancelUseControl(this.control.mlastx, this.control.mlasty);
@ -806,16 +819,7 @@ func FxItemRemovalCheckStop(object target, proplist effect, int reason, bool tem
// Control use redirected to script
func ControlUse2Script(int ctrl, int x, int y, int strength, bool repeat, bool release, object obj)
{
// click on UseAlt cancels Use
if ((ctrl == CON_UseAlt || ctrl == CON_UseAltDelayed) && !release)
{
if (this.control.current_object)
CancelUseControl(x, y);
StopShelvedCommand();
return true;
}
{
// standard use
if (ctrl == CON_Use)
{

View File

@ -43,8 +43,8 @@ func Control2Menu(int ctrl, int x, int y, int strength, bool repeat, bool releas
if (release)
{
// select
if (ctrl == CON_UseDelayed || ctrl == CON_UseAltDelayed)
this->GetMenu()->~OnMouseClick(mex,mey, ctrl == CON_UseAltDelayed);
if (ctrl == CON_UseDelayed)
this->GetMenu()->~OnMouseClick(mex,mey);
}
return true;

View File

@ -23,7 +23,6 @@ global func IsThrowControl(int ctrl)
{
// left mouse button
if(ctrl == CON_Throw
|| ctrl == CON_ForcedThrow
|| ctrl == CON_ThrowDelayed)
return true;
@ -98,9 +97,6 @@ global func IsCrewControl(int ctrl)
/** Control uses selected item */
global func IsUseControl(int ctrl)
{
if(ctrl == CON_Use
|| ctrl == CON_UseAlt)
return true;
if (ctrl == CON_Use) return true;
return false;
}

View File

@ -97,43 +97,6 @@ global func PlayerControl(int plr, int ctrl, id spec_id, int x, int y, int stren
}
// Control not handled yet - possibly open info dialogue?
if (ctrl == CON_UseAlt)
{
// possibly close old dialogue?
var effect_name = Format("CurrentPlayerObjectInfoDialogue%d", plr);
var effect = GetEffect(effect_name, nil);
var old_target;
if (effect && effect.dialogue)
{
old_target = effect.dialogue.target;
effect.dialogue->Close();
}
var target = nil;
for (var o in FindObjects(Find_AtPoint(x, y), Find_Func("HasObjectInformationDialogue"), Sort_Distance(x, y)))
{
target = o;
break;
}
if (target && (target != old_target))
{
var d = target->~GetObjectInformationDialogue();
if (!d) d = CreateObject(HUD_ObjectInfoDisplay, target->GetX(), target->GetY(), plr);
d->SetTarget(target);
if (!target->~OnObjectInformationDialogueOpen(d))
d->StandardDisplay();
if (!effect)
effect = AddEffect(effect_name, nil, 1, 0, nil);
effect.dialogue = d;
}
else
if (effect)
RemoveEffect(nil, nil, effect);
}
// Nothing to handle control then
return false;
}

View File

@ -144,10 +144,7 @@
GUIName=$CON_Throw$
GUIDesc=$CON_Throw_Desc$
Hold=1
[ControlDef]
Identifier=ForcedThrow
Hold=1
SendCursorPos=1
[ControlDef]
Identifier=ThrowDelayed
@ -256,20 +253,6 @@
Identifier=CancelMenu
GUIName=$CON_MenuCancel$
[ControlDef]
Identifier=UseAlt
GUIName=$CON_UseAlt$
GUIDesc=$CON_UseAlt_Desc$
Hold=1
SendCursorPos=1
[ControlDef]
Identifier=UseAltDelayed
GUIName=$CON_UseAlt$
GUIDesc=$CON_UseAlt_Desc$
Hold=1
SendCursorPos=1
[ControlDef]
Identifier=Contents
GUIName=$CON_Contents$
@ -673,16 +656,16 @@
GUIDisabled=1
GUIGroup=20
Control=Use
[Assignment]
Key=Shift+Mouse1ButtonLeft
Key=Mouse1ButtonRight
Priority=100
GUIName=$KEY_MouseUseAlt$
GUIDesc=$KEY_MouseUseAlt_Desc$
GUIName=$KEY_MouseThrow$
GUIDesc=$KEY_MouseThrow_Desc$
GUIDisabled=1
GUIGroup=20
Control=UseAlt
Control=Throw
# Zoom
[Assignment]
@ -836,14 +819,6 @@
GUIGroup=20
Priority=100
Control=UseDelayed
[Assignment]
Key=Joy1D
GUIName=$KEY_GamepadUseAlt$
GUIDesc=$KEY_GamepadUseAlt_Desc$
GUIGroup=20
Priority=100
Control=UseAltDelayed
# Zoom
@ -952,23 +927,6 @@
Control=GUICursor
Priority=100
# Forced Throw (also calls standard throw, if forced throw is not treated)
[Assignment]
Key=Mouse1ButtonRight
GUIDisabled=1
GUIGroup=20
Priority=151
Control=ForcedThrow
# Standard throw
[Assignment]
Key=CON_Use
GUIName=None
Priority=50
Control=Throw
# ======================================================================= #
# Default hotkey controls #
# ======================================================================= #

View File

@ -9,11 +9,6 @@ CON_AimAxisRight=Zielen - Rechts (Analog Stick)
CON_AimAxisUp=Zielen - Hoch (Analog Stick)
CON_AimAxisDown=Zielen - Runter (Analog Stick)
CON_Throw=Werfen
CON_Throw_Desc=Werfen des Gegenstandes in der Hand in die anvisierte Richtung.
CON_ThrowAlt=Werfen (andere Hand)
CON_ThrowAlt_Desc=Werfen des Gegenstandes in der anderen Hand in die anvisierte Richtung.
CON_QuickSwitch=Schnellwechsel
CON_QuickSwitch_Desc=Das zuletzt angewählte Inventarobjekt auswählen.
CON_InventoryShiftForward=Nächstes Item
@ -27,8 +22,8 @@ CON_DropAlt_Desc=Ablegen des Gegenstandes in der anderen Hand.
CON_Use=Benutzen
CON_Use_Desc=Benutzen des Gegenstandes in der Hand.
CON_UseAlt=Benutzen (andere Hand)
CON_UseAlt_Desc=Benutzen des Gegenstandes in der anderen Hand.
CON_Throw=Werfen
CON_Throw_Desc=Werfen des Gegenstandes in der Hand in die anvisierte Richtung.
CON_Hotkey1=Hotkey 1
CON_Hotkey2=Hotkey 2
@ -67,15 +62,14 @@ CON_ZoomOut_Desc=Aus der Spielwelt herauszoomen um eine Übersicht zu bekommen.
# -- Assignment specific strings
KEY_MouseUse=Benutzen / Werfen
KEY_MouseUse_Desc=Benutzen des Gegenstandes in der Hand. Falls der Gegenstand nicht benutzt werden kann, wird er stattdessen in die Richtung geworfen in die der Cursor zeigt.
KEY_MouseUseAlt=Benutzen / Werfen (andere Hand)
KEY_MouseUseAlt_Desc=Benutzen des Gegenstandes in der anderen Hand. Falls der Gegenstand nicht benutzt werden kann, wird er stattdessen in die Richtung geworfen in die der Cursor zeigt.
KEY_MouseUse=Benutzen
KEY_MouseUse_Desc=Benutzen des Gegenstandes in der Hand.
KEY_MouseThrow=Werfen
KEY_MouseThrow_Desc=Werfen des Gegenstandes in der Hand.
KEY_GamepadUse=Benutzen / Werfen
KEY_GamepadUse_Desc=Benutzen des Gegenstandes in der Hand. Falls der Gegenstand nicht benutzt werden kann, wird er stattdessen bei Loslassen der Taste in die Richtung geworfen in die mit dem Analog Stick gezielt wird.
KEY_GamepadUseAlt=Benutzen / Werfen (andere Hand)
KEY_GamepadUseAlt_Desc=Benutzen des Gegenstandes in der anderen Hand. Falls der Gegenstand nicht benutzt werden kann, wird er stattdessen bei Loslassen der Taste in die Richtung geworfen in die mit dem Analog Stick gezielt wird.
KEY_Left=Links
KEY_Left_Desc=Nach links laufen, schwimmen, hangeln oder sich nach links von einer Wand abstoßen. Beim Klettern links an einer Wand kann hiermit ein Gegenstand aufgenommen werden der in der Wand steckt.

View File

@ -9,10 +9,6 @@ CON_AimAxisRight=Aim - Right (Analog Stick)
CON_AimAxisUp=Aim - Up (Analog Stick)
CON_AimAxisDown=Aim - Down (Analog Stick)
CON_Throw=Throw
CON_Throw_Desc=Throw the item in the hand into the aimed direction.
CON_ThrowAlt=Throw (other hand)
CON_ThrowAlt_Desc=Throw the item in the other hand into the aimed direction.
CON_QuickSwitch=Quick Switch
CON_QuickSwitch_Desc=Change the selection to the last active item slot.
@ -27,8 +23,8 @@ CON_DropAlt_Desc=Drop the item in the other hand.
CON_Use=Use
CON_Use_Desc=Use the item in the hand.
CON_UseAlt=Use (other hand)
CON_UseAlt_Desc=Use the item in the other hand.
CON_Throw=Throw
CON_Throw_Desc=Throw the item in the hand into the aimed direction.
CON_Hotkey1=Hotkey 1
CON_Hotkey2=Hotkey 2
@ -67,15 +63,14 @@ CON_ZoomOut_Desc=Zoom out of the game world to get an overview.
# -- Assignment specific strings
KEY_MouseUse=Use / Throw
KEY_MouseUse_Desc=Use the item in the hand. If the item cannot be used, it is thrown into the direction of the cursor instead.
KEY_MouseUseAlt=Use / Throw (other hand)
KEY_MouseUseAlt_Desc=Use the item in the other hand. If the item cannot be used, it is thrown into the direction of the cursor instead.
KEY_MouseUse=Use
KEY_MouseUse_Desc=Use the item in the hand.
KEY_MouseThrow=Throw
KEY_MouseThrow_Desc=Throw the item in the hand.
KEY_GamepadUse=Use / Throw
KEY_GamepadUse_Desc=Use the item in the hand. If the item cannot be used, it is thrown into the direction in which you aim with the analog stick on release.
KEY_GamepadUseAlt=Use / Throw (other hand)
KEY_GamepadUseAlt_Desc=Use the item in the other hand. If the item cannot be used, it is thrown into the direction in which you aim with the analog stick on release.
KEY_Left=Left
KEY_Left_Desc=Run, swim, hangle to the left or let go from a right wall. While climbing on a left wall, you can collect an item that is stuck in it with this key.