Merge pull request #2480 from acemod/340doanim2tweak

tweak doAnimation switchMove to do no akward camera jumps whenever possible
This commit is contained in:
commy2 2015-09-17 22:46:54 +02:00
commit 7336e694c1
3 changed files with 19 additions and 4 deletions

View File

@ -44,6 +44,8 @@ if (_animation == "") then {
_animation = [_unit] call FUNC(getDefaultAnim);
};
//if (_animation == animationState _unit) exitWith {};
switch (_priority) do {
case 0 : {
if (_unit == vehicle _unit) then {
@ -62,8 +64,19 @@ switch (_priority) do {
};
};
case 2 : {
// Execute on all machines. SwitchMove has local effects.
[_unit, format ["{_this switchMove '%1'}", _animation]] call FUNC(execRemoteFnc);
// try playMoveNow first
if (_unit == vehicle _unit) then {
[_unit, format ["{_this playMoveNow '%1'}", _animation], _unit] call FUNC(execRemoteFnc);
} else {
// Execute on all machines. PlayMove and PlayMoveNow are bugged: They have no global effects when executed on remote machines inside vehicles.
[_unit, format ["{_this playMoveNow '%1'}", _animation]] call FUNC(execRemoteFnc);
};
// if animation doesn't respond, do switchMove
if (animationState _unit != _animation) then {
// Execute on all machines. SwitchMove has local effects.
[_unit, format ["{_this switchMove '%1'}", _animation]] call FUNC(execRemoteFnc);
};
};
default {};
};

View File

@ -35,6 +35,7 @@ if (vehicle _caller == _caller) then {
case "ainvppnemstpslaywpstdnon_medic": {_lastAnim = "AinvPpneMstpSlayWpstDnon"};
case "ainvpknlmstpslaywpstdnon_medic": {_lastAnim = "AmovPknlMstpSrasWpstDnon"};
};
[_caller, _lastAnim, 2] call EFUNC(common,doAnimation);
};
_caller setvariable [QGVAR(treatmentPrevAnimCaller), nil];

View File

@ -19,7 +19,7 @@
private ["_config", "_callback", "_weaponSelect", "_lastAnim"];
params ["_args"];
_args params ["_caller", "_target","_selectionName","_className", "_items", "_usersOfItems"];
_args params ["_caller", "_target", "_selectionName", "_className", "_items", "_usersOfItems"];
if (primaryWeapon _caller == "ACE_FakePrimaryWeapon") then {
_caller removeWeapon "ACE_FakePrimaryWeapon";
@ -28,13 +28,14 @@ if (vehicle _caller == _caller) then {
_lastAnim = _caller getvariable [QGVAR(treatmentPrevAnimCaller), ""];
//Don't play another medic animation (when player is rapidily treating)
TRACE_2("Reseting to old animation", animationState player, _lastAnim);
switch (tolower _lastAnim) do {
switch (toLower _lastAnim) do {
case "ainvpknlmstpslaywrfldnon_medic": {_lastAnim = "AmovPknlMstpSrasWrflDnon"};
case "ainvppnemstpslaywrfldnon_medic": {_lastAnim = "AmovPpneMstpSrasWrflDnon"};
case "ainvpknlmstpslaywnondnon_medic": {_lastAnim = "AmovPknlMstpSnonWnonDnon"};
case "ainvppnemstpslaywpstdnon_medic": {_lastAnim = "AinvPpneMstpSlayWpstDnon"};
case "ainvpknlmstpslaywpstdnon_medic": {_lastAnim = "AmovPknlMstpSrasWpstDnon"};
};
[_caller, _lastAnim, 2] call EFUNC(common,doAnimation);
};
_caller setvariable [QGVAR(treatmentPrevAnimCaller), nil];