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
3 changed files with 19 additions and 4 deletions

View File

@ -44,6 +44,8 @@ if (_animation == "") then {
_animation = [_unit] call FUNC(getDefaultAnim); _animation = [_unit] call FUNC(getDefaultAnim);
}; };
//if (_animation == animationState _unit) exitWith {};
switch (_priority) do { switch (_priority) do {
case 0 : { case 0 : {
if (_unit == vehicle _unit) then { if (_unit == vehicle _unit) then {
@ -62,9 +64,20 @@ switch (_priority) do {
}; };
}; };
case 2 : { case 2 : {
// 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. // Execute on all machines. SwitchMove has local effects.
[_unit, format ["{_this switchMove '%1'}", _animation]] call FUNC(execRemoteFnc); [_unit, format ["{_this switchMove '%1'}", _animation]] call FUNC(execRemoteFnc);
}; };
};
default {}; default {};
}; };

View File

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

View File

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