mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Prevent repeating key down events
This commit is contained in:
parent
53a0a9343b
commit
9b3b5e9750
@ -32,6 +32,7 @@ switch (toLower _mode) do {
|
||||
|
||||
// Initalize display variables
|
||||
GVAR(ctrlKey) = false;
|
||||
GVAR(heldKeys) = [];
|
||||
GVAR(mouse) = [false,false];
|
||||
GVAR(mousePos) = [0.5,0.5];
|
||||
|
||||
@ -71,6 +72,7 @@ switch (toLower _mode) do {
|
||||
|
||||
// Cleanup display variables
|
||||
GVAR(ctrlKey) = nil;
|
||||
GVAR(heldKeys) = nil;
|
||||
GVAR(mouse) = nil;
|
||||
GVAR(mousePos) = nil;
|
||||
|
||||
@ -111,7 +113,8 @@ switch (toLower _mode) do {
|
||||
[localize LSTRING(freeCamRight),"D"],
|
||||
[localize LSTRING(freeCamUp),"Q"],
|
||||
[localize LSTRING(freeCamDown),"Z"],
|
||||
[localize LSTRING(freeCamVision),"N"],
|
||||
[localize LSTRING(freeCamNextVis),"N"],
|
||||
[localize LSTRING(freeCamPrevVis),"Ctrl + N"],
|
||||
[localize LSTRING(freeCamSpeed),"Scrollwheel"],
|
||||
[localize LSTRING(freeCamZoom),"Ctrl + Scrollwheel"]
|
||||
];
|
||||
@ -164,6 +167,10 @@ switch (toLower _mode) do {
|
||||
case "onkeydown": {
|
||||
_args params ["_display","_dik","_shift","_ctrl","_alt"];
|
||||
|
||||
// Handle held keys (prevent repeat calling)
|
||||
if (_dik in GVAR(heldKeys)) exitwith {};
|
||||
GVAR(heldKeys) pushBack _dik;
|
||||
|
||||
switch (_dik) do {
|
||||
case 1: { // Esc
|
||||
[player,false] call FUNC(setSpectator); // Handle esc menu goes here, currently closes for purposes of testing
|
||||
@ -205,8 +212,12 @@ switch (toLower _mode) do {
|
||||
GVAR(camBoom) = -0.5;
|
||||
};
|
||||
case 49: { // N
|
||||
if (_ctrl) then {
|
||||
[nil,nil,-1] call FUNC(cycleCamera);
|
||||
} else {
|
||||
[nil,nil,1] call FUNC(cycleCamera);
|
||||
};
|
||||
};
|
||||
case 50: { // M
|
||||
[_display,nil,nil,nil,true] call FUNC(toggleInterface);
|
||||
(_display displayCtrl IDC_MAP) ctrlMapAnimAdd [0, 0.5, [GVAR(camUnit),GVAR(camera)] select (GVAR(camMode) == 0)];
|
||||
@ -234,6 +245,9 @@ switch (toLower _mode) do {
|
||||
case "onkeyup": {
|
||||
_args params ["_display","_dik","_shift","_ctrl","_alt"];
|
||||
|
||||
// No longer being held
|
||||
GVAR(heldKeys) = GVAR(heldKeys) - [_dik];
|
||||
|
||||
switch (_dik) do {
|
||||
case 16: { // Q
|
||||
GVAR(camBoom) = 0;
|
||||
|
@ -131,8 +131,11 @@
|
||||
<Key ID="STR_ACE_Spectator_freeCamSpeed">
|
||||
<English>Speed Up/Down</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Spectator_freeCamVision">
|
||||
<English>Toggle Vision Mode</English>
|
||||
<Key ID="STR_ACE_Spectator_freeCamNextVis">
|
||||
<English>Next Vision Mode</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Spectator_freeCamPrevVis">
|
||||
<English>Previous Vision Mode</English>
|
||||
</Key>
|
||||
|
||||
<Key ID="STR_ACE_Spectator_uiToggleInterface">
|
||||
|
Loading…
Reference in New Issue
Block a user