Use regular Throw instead of ThrowDelayed for gamepads

There is no need to delay throwing as aiming is now possible at any time
using the analog stick.
qteditor^2
Lukas Werling 2016-03-12 20:21:36 +01:00
parent b8c8bf825c
commit f63f4b9ab3
3 changed files with 17 additions and 43 deletions

View File

@ -246,15 +246,22 @@ public func ObjectControl(int plr, int ctrl, int x, int y, int strength, bool re
return success && VirtualCursor()->IsAiming();
}
// Simulate a mouse cursor for gamepads.
if (PlayerHasVirtualCursor(GetOwner()))
{
x = this.control.mlastx;
y = this.control.mlasty;
}
// save last mouse position:
// if the using has to be canceled, no information about the current x,y
// is available. Thus, the last x,y position needs to be saved
if (ctrl == CON_Use || ctrl == CON_UseAlt)
else if (ctrl == CON_Use || ctrl == CON_UseAlt)
{
this.control.mlastx = x;
this.control.mlasty = y;
}
var proc = GetProcedure();
// building, vehicle, mount, contents, menu control
@ -327,7 +334,7 @@ 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 && status == CONS_Down)
if (ctrl == CON_Throw && currently_in_use && status == CONS_Down)
{
CancelUse();
return true;
@ -336,7 +343,7 @@ public func ObjectControl(int plr, int ctrl, int x, int y, int strength, bool re
// Throwing and dropping
// only if not in house, not grabbing a vehicle and an item selected
// only act on press, not release
if ((ctrl == CON_Throw || ctrl == CON_ThrowDelayed) && !house && (!vehicle || proc == "ATTACH") && status == CONS_Down)
if (ctrl == CON_Throw && !house && (!vehicle || proc == "ATTACH") && status == CONS_Down)
{
if (contents)
{
@ -364,25 +371,6 @@ public func ObjectControl(int plr, int ctrl, int x, int y, int strength, bool re
else
return ObjectCommand("Throw", contents, x, y);
}
// throw delayed
if (ctrl == CON_ThrowDelayed)
{
CancelUse();
if (status == CONS_Up)
{
VirtualCursor()->StopAim();
if (only_drop)
return ObjectCommand("Drop", contents);
else
return ObjectCommand("Throw", contents, this.control.mlastx, this.control.mlasty);
}
else
{
VirtualCursor()->StartAim(this);
return true;
}
}
}
}

View File

@ -21,9 +21,8 @@ global func IsMovementControl(int ctrl)
/** Control throws selected item */
global func IsThrowControl(int ctrl)
{
// left mouse button
if(ctrl == CON_Throw
|| ctrl == CON_ThrowDelayed)
// right mouse button
if(ctrl == CON_Throw)
return true;
return false;
@ -99,4 +98,4 @@ global func IsUseControl(int ctrl)
{
if (ctrl == CON_Use || ctrl == CON_UseAlt) return true;
return false;
}
}

View File

@ -37,7 +37,6 @@
#
# Gamepad controls
# -------------------------------------
# ThrowDelayed
# UseDelayed
# AimUp AimDown AimLeft AimRight
# AimAxisUp AimAxisDown AimAxisLeft AimAxisRight
@ -142,12 +141,6 @@
Hold=1
SendCursorPos=1
[ControlDef]
Identifier=ThrowDelayed
GUIName=$CON_Throw$
GUIDesc=$CON_Throw_Desc$
Hold=1
[ControlDef]
Identifier=Drop
GUIName=$CON_Drop$
@ -973,7 +966,7 @@
Priority=75
[Assignment]
Key=CON_PickUp,CON_ThrowDelayed
Key=CON_PickUp,CON_Throw
Control=Drop
Priority=75
@ -1003,7 +996,7 @@
Key=ControllerLeftTrigger
GUIGroup=20
Priority=100
Control=ThrowDelayed
Control=Throw
# TODO: Zoom
@ -1029,18 +1022,12 @@
Name=*_GamepadCon_*
[Assignment]
Key=CON_Down,CON_UseDelayed
Key=CON_Down,CON_Throw
GUIDisabled=1
GUIGroup=20
Priority=150
Control=Drop
[Assignment]
Key=CON_UseDelayed
GUIName=None
Priority=50
Control=ThrowDelayed
# ======================================================================= #
# Default mouse control #
# ======================================================================= #