resting: port

This commit is contained in:
Nicolás Badano 2015-01-15 19:34:35 -03:00
parent e377cd0229
commit f9de90c6f9
12 changed files with 1503 additions and 1482 deletions

View File

@ -0,0 +1 @@
z\ace\addons\resting

View File

@ -0,0 +1,6 @@
class Extended_PreInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_preInit));
};
};

1389
addons/resting/CfgMoves.hpp Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,22 @@
class CfgWeapons {
class Rifle_Long_Base_F;
class arifle_MX_Base_F;
class arifle_MX_SW_F : arifle_MX_Base_F {
ACE_Bipod = 1;
};
class LMG_Mk200_F : Rifle_Long_Base_F {
ACE_Bipod = 1;
};
class LMG_Zafir_F: Rifle_Long_Base_F {
ACE_Bipod = 1;
};
class LRR_base_F : Rifle_Long_Base_F {
ACE_Bipod = 1;
};
class GM6_base_F : Rifle_Long_Base_F {
ACE_Bipod = 1;
};
};

View File

@ -0,0 +1,4 @@
#include "script_component.hpp"
PREP(hasBipod);
PREP(restWeapon);

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +0,0 @@
// by commy2
private ["_weapon", "_config"];
_weapon = _this select 0;
_config = configFile >> "CfgWeapons" >> _weapon;
getNumber (_config >> "AGM_Bipod") == 1 || {getNumber (_config >> "tmr_autorest_deployable") == 1}

View File

@ -0,0 +1,12 @@
// by commy2
#include "script_component.hpp"
private ["_weapon", "_config"];
_weapon = _this select 0;
_config = configFile >> "CfgWeapons" >> _weapon;
getNumber (_config >> "ACE_Bipod") == 1 ||
getNumber (_config >> "AGM_Bipod") == 1 ||
{getNumber (_config >> "tmr_autorest_deployable") == 1}

View File

@ -10,6 +10,7 @@
* None
*
*/
#include "script_component.hpp"
#define RESTEDRECOIL 0.6
#define BIPODRECOIL 0.3
@ -35,37 +36,37 @@ _fnc_unRestWeapon = {
private "_animation";
_animation = animationState _unit;
if (_unit getVariable ["AGM_bipodDeployed", false]) then {
if (_unit getVariable ["ACE_bipodDeployed", false]) then {
_unit setUnitRecoilCoefficient (unitRecoilCoefficient _unit / BIPODRECOIL);
if (_animation find "_agm_deploy" != -1) then {
//[_unit, [_animation, "_agm_deploy", ""] call CBA_fnc_replace, 2] call AGM_Core_fnc_doAnimation;
_unit switchMove ([_animation, "_agm_deploy", ""] call CBA_fnc_replace);
if (_animation find "_ace_deploy" != -1) then {
//[_unit, [_animation, "_ace_deploy", ""] call CBA_fnc_replace, 2] call EFUNC(common,doAnimation);
_unit switchMove ([_animation, "_ace_deploy", ""] call CBA_fnc_replace);
};
private "_picture";
_picture = getText (configFile >> "CfgWeapons" >> _weapon >> "picture");
[localize "STR_AGM_Resting_BipodUndeployed", _picture] call AGM_Core_fnc_displayTextPicture;
[localize "STR_ACE_Resting_BipodUndeployed", _picture] call EFUNC(common,displayTextPicture);
} else {
_unit setUnitRecoilCoefficient (unitRecoilCoefficient _unit / RESTEDRECOIL);
if (_animation find "_agm_rested" != -1) then {
//[_unit, [_animation, "_agm_rested", ""] call CBA_fnc_replace, 2] call AGM_Core_fnc_doAnimation;
_unit switchMove ([_animation, "_agm_rested", ""] call CBA_fnc_replace);
if (_animation find "_ace_rested" != -1) then {
//[_unit, [_animation, "_ace_rested", ""] call CBA_fnc_replace, 2] call EFUNC(common,doAnimation);
_unit switchMove ([_animation, "_ace_rested", ""] call CBA_fnc_replace);
};
private "_picture";
_picture = getText (configFile >> "CfgWeapons" >> _weapon >> "picture");
[localize "STR_AGM_Resting_WeaponLifted", _picture] call AGM_Core_fnc_displayTextPicture;
[localize "STR_ACE_Resting_WeaponLifted", _picture] call EFUNC(common,displayTextPicture);
};
_unit setVariable ["AGM_weaponRested", false];
_unit setVariable ["AGM_bipodDeployed", false];
_unit setVariable ["ACE_weaponRested", false];
_unit setVariable ["ACE_bipodDeployed", false];
};
if (_unit getVariable ["AGM_weaponRested", false]) exitWith {call _fnc_unRestWeapon};
if (_unit getVariable ["ACE_weaponRested", false]) exitWith {call _fnc_unRestWeapon};
// exit if this is not an available animation
if (!isClass (configFile >> "CfgMovesMaleSdr" >> "States" >> format ["%1_agm_deploy", animationState _unit])) exitWith {};
if (!isClass (configFile >> "CfgMovesMaleSdr" >> "States" >> format ["%1_ace_deploy", animationState _unit])) exitWith {};
// PREPARE INTERSECTS
private "_fnc_getIntersection";
@ -131,7 +132,7 @@ private "_intersects";
_intersects = call _fnc_getIntersection;
if (true in _intersects) then {
_unit setVariable ["AGM_weaponRested", true];
_unit setVariable ["ACE_weaponRested", true];
private "_restedPosition";
_restedPosition = getPosASL _unit;
@ -139,27 +140,27 @@ if (true in _intersects) then {
// REST THE WEAPON
addCamShake CAMSHAKE;
if ([_weapon] call AGM_Resting_fnc_hasBipod && {_intersects select 3}) then {
_unit setVariable ["AGM_bipodDeployed", true];
if ([_weapon] call FUNC(hasBipod) && {_intersects select 3}) then {
_unit setVariable ["ACE_bipodDeployed", true];
_unit setUnitRecoilCoefficient (BIPODRECOIL * unitRecoilCoefficient _unit);
//[_unit, format ["%1_agm_deploy", animationState _unit], 2] call AGM_Core_fnc_doAnimation;
_unit switchMove format ["%1_agm_deploy", animationState _unit];
//[_unit, format ["%1_ace_deploy", animationState _unit], 2] call EFUNC(common,doAnimation);
_unit switchMove format ["%1_ace_deploy", animationState _unit];
private "_picture";
_picture = getText (configFile >> "CfgWeapons" >> _weapon >> "picture");
[localize "STR_AGM_Resting_BipodDeployed", _picture] call AGM_Core_fnc_displayTextPicture;
[localize "STR_ACE_Resting_BipodDeployed", _picture] call EFUNC(common,displayTextPicture);
} else {
_unit setVariable ["AGM_bipodDeployed", false];
_unit setVariable ["ACE_bipodDeployed", false];
_unit setUnitRecoilCoefficient (RESTEDRECOIL * unitRecoilCoefficient _unit);
//[_unit, format ["%1_agm_rested", animationState _unit], 2] call AGM_Core_fnc_doAnimation;
_unit switchMove format ["%1_agm_rested", animationState _unit];
//[_unit, format ["%1_ace_rested", animationState _unit], 2] call EFUNC(common,doAnimation);
_unit switchMove format ["%1_ace_rested", animationState _unit];
private "_picture";
_picture = getText (configFile >> "CfgWeapons" >> _weapon >> "picture");
[localize "STR_AGM_Resting_WeaponRested", _picture] call AGM_Core_fnc_displayTextPicture;
[localize "STR_ACE_Resting_WeaponRested", _picture] call EFUNC(common,displayTextPicture);
};
// CHECK FOR PLAYER MOVING AWAY, CHANGING WEAPONS ETC
@ -171,11 +172,11 @@ if (true in _intersects) then {
_fnc_getIntersection = _this select 4;
_restedPosition = _this select 5;
while {_unit getVariable ["AGM_weaponRested", false]} do {
while {_unit getVariable ["ACE_weaponRested", false]} do {
_intersects = call _fnc_getIntersection;
if (
_unit != AGM_player
_unit != ACE_player
|| {_vehicle != vehicle _unit}
|| {inputAction "reloadMagazine" != 0}
|| {weaponLowered _unit}

View File

@ -0,0 +1 @@
#include "\z\ace\addons\resting\script_component.hpp"

View File

@ -0,0 +1,12 @@
#define COMPONENT resting
#include "\z\ace\Addons\main\script_mod.hpp"
#ifdef DEBUG_ENABLED_RESTING
#define DEBUG_MODE_FULL
#endif
#ifdef DEBUG_SETTINGS_RESTING
#define DEBUG_SETTINGS DEBUG_SETTINGS_RESTING
#endif
#include "\z\ace\Addons\main\script_macros.hpp"

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project name="AGM">
<Project name="ACE">
<Package name="Resting">
<Key ID="STR_AGM_Resting_RestWeapon">
<Key ID="STR_ACE_Resting_RestWeapon">
<English>Rest Weapon</English>
<German>Waffe auflegen</German>
<Spanish>Apoyar el arma</Spanish>
@ -15,7 +15,7 @@
<Italian>Appoggia l'arma</Italian>
</Key>
<Key ID="STR_AGM_Resting_BipodDeployed">
<Key ID="STR_ACE_Resting_BipodDeployed">
<English>Bipod deployed</English>
<German>Zweibein ausgeklappt</German>
<Spanish>Bípode desplegado</Spanish>
@ -27,7 +27,7 @@
<Portuguese>Bipé apoiado</Portuguese>
<Italian>Bipiede appoggiato</Italian>
</Key>
<Key ID="STR_AGM_Resting_WeaponRested">
<Key ID="STR_ACE_Resting_WeaponRested">
<English>Weapon rested</English>
<German>Waffe aufgelegt</German>
<Spanish>Arma apoyada</Spanish>
@ -40,7 +40,7 @@
<Italian>Arma appoggiata</Italian>
</Key>
<Key ID="STR_AGM_Resting_BipodUndeployed">
<Key ID="STR_ACE_Resting_BipodUndeployed">
<English>Bipod undeployed</English>
<German>Zweibein eingeklappt</German>
<Spanish>Bípode plegado</Spanish>
@ -52,7 +52,7 @@
<Portuguese>Bipé recolhido</Portuguese>
<Italian>Bipiede richiuso</Italian>
</Key>
<Key ID="STR_AGM_Resting_WeaponLifted">
<Key ID="STR_ACE_Resting_WeaponLifted">
<English>Weapon lifted</English>
<German>Waffe gehoben</German>
<Spanish>Arma levantada</Spanish>