mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Unit cycling
This commit is contained in:
parent
dc19bff189
commit
1890bc1d59
@ -22,26 +22,32 @@ params [["_stepMode",0], ["_stepUnit",0], ["_stepVision",0]];
|
||||
private ["_modes","_visions","_iMode","_iVision","_countModes","_countVisions","_newMode","_newVision","_newUnit"];
|
||||
|
||||
_modes = GVAR(availableModes);
|
||||
_units = GVAR(unitList);
|
||||
_visions = GVAR(availableVisions);
|
||||
|
||||
// Get current index
|
||||
_iMode = abs(_modes find GVAR(camMode));
|
||||
_iUnit = abs(_units find GVAR(camUnit));
|
||||
_iVision = abs(_visions find GVAR(camVision));
|
||||
|
||||
_countModes = count _modes;
|
||||
_countUnits = count _units;
|
||||
_countVisions = count _visions;
|
||||
|
||||
// Step index by step number (lopp ends)
|
||||
_iMode = (_iMode + _stepMode) % _countModes;
|
||||
if (_iMode < 0) then { _iMode = _countModes + _iMode; };
|
||||
|
||||
_iUnit = (_iUnit + _stepUnit) % _countUnits;
|
||||
if (_iUnit < 0) then { _iUnit = _countUnits + _iUnit; };
|
||||
|
||||
_iVision = (_iVision + _stepVision) % _countVisions;
|
||||
if (_iVision < 0) then { _iVision = _countVisions + _iVision; };
|
||||
|
||||
// Get value at new index
|
||||
_newMode = _modes select _iMode;
|
||||
_newUnit = _units select _iUnit;
|
||||
_newVision = _visions select _iVision;
|
||||
|
||||
_newUnit = GVAR(camUnit);
|
||||
|
||||
[_newMode, _newUnit, _newVision] call FUNC(transitionCamera);
|
||||
|
@ -203,10 +203,10 @@ switch (toLower _mode) do {
|
||||
[-1] call FUNC(cycleCamera);
|
||||
};
|
||||
case 203: { // Left arrow
|
||||
|
||||
[nil,1] call FUNC(cycleCamera);
|
||||
};
|
||||
case 205: { // Right arrow
|
||||
|
||||
[nil,-1] call FUNC(cycleCamera);
|
||||
};
|
||||
case 208: { // Down arrow
|
||||
[1] call FUNC(cycleCamera);
|
||||
|
@ -28,7 +28,7 @@ if (isNull _display) exitWith { [_this select 1] call CBA_fnc_removePerFrameHand
|
||||
|
||||
// Camera shouldn't stay on unit that isn't in the list
|
||||
if !(GVAR(camUnit) in GVAR(unitList)) then {
|
||||
[0,objNull] call FUNC(transitionCamera);
|
||||
[nil,1] call FUNC(cycleCamera);
|
||||
};
|
||||
|
||||
// Reduce overhead when unit tree is hidden
|
||||
|
Loading…
Reference in New Issue
Block a user