mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
revive tmr camshake
This commit is contained in:
parent
d7d0f00592
commit
12280bbcad
14
addons/recoil/CfgEventHandlers.hpp
Normal file
14
addons/recoil/CfgEventHandlers.hpp
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
class Extended_PreInit_EventHandlers {
|
||||
class ADDON {
|
||||
init = QUOTE(call COMPILE_FILE(XEH_preInit));
|
||||
};
|
||||
};
|
||||
|
||||
class Extended_FiredBIS_EventHandlers {
|
||||
class CAManBase {
|
||||
class ADDON {
|
||||
clientFiredBIS = QUOTE(if (_this select 0 == ACE_player) then {_this call FUNC(camshake)};);
|
||||
};
|
||||
};
|
||||
};
|
85
addons/recoil/CfgMoves.hpp
Normal file
85
addons/recoil/CfgMoves.hpp
Normal file
@ -0,0 +1,85 @@
|
||||
|
||||
// Completely disable BI's camshake on fire.
|
||||
#define ACE_CAMSHAKEFIRE_BASE 0
|
||||
#define ACE_CAMSHAKEFIRE_LESS 0
|
||||
#define ACE_CAMSHAKEFIRE_MORE 0
|
||||
|
||||
// Go through all modes that have a camshakefire defined and change it to ours.
|
||||
class CfgMovesBasic {
|
||||
class Default {
|
||||
camShakeFire = ACE_CAMSHAKEFIRE_NORMAL;
|
||||
};
|
||||
};
|
||||
|
||||
class CfgMovesMaleSdr: CfgMovesBasic {
|
||||
class States {
|
||||
class AmovPercMstpSlowWrflDnon;
|
||||
class AmovPknlMstpSlowWrflDnon: AmovPercMstpSlowWrflDnon {
|
||||
camShakeFire = ACE_CAMSHAKEFIRE_LESS;
|
||||
};
|
||||
|
||||
class AmovPercMstpSrasWrflDnon;
|
||||
class AmovPpneMstpSrasWrflDnon: AmovPercMstpSrasWrflDnon {
|
||||
camShakeFire = ACE_CAMSHAKEFIRE_LESS;
|
||||
};
|
||||
|
||||
class AmovPknlMstpSrasWlnrDnon: Default {
|
||||
camShakeFire = ACE_CAMSHAKEFIRE_LESS;
|
||||
};
|
||||
|
||||
class AmovPknlMrunSlowWrflDf;
|
||||
class AmovPknlMtacSlowWrflDf: AmovPknlMrunSlowWrflDf {
|
||||
camShakeFire = ACE_CAMSHAKEFIRE_MORE;
|
||||
};
|
||||
|
||||
class AmovPknlMrunSlowWrflDfl;
|
||||
class AmovPknlMtacSlowWrflDfl: AmovPknlMrunSlowWrflDfl {
|
||||
camShakeFire = ACE_CAMSHAKEFIRE_MORE;
|
||||
};
|
||||
|
||||
class AmovPknlMrunSlowWrflDl;
|
||||
class AmovPknlMtacSlowWrflDl: AmovPknlMrunSlowWrflDl {
|
||||
camShakeFire = ACE_CAMSHAKEFIRE_MORE;
|
||||
};
|
||||
|
||||
class AmovPknlMrunSlowWrflDbl;
|
||||
class AmovPknlMtacSlowWrflDbl: AmovPknlMrunSlowWrflDbl {
|
||||
camShakeFire = ACE_CAMSHAKEFIRE_MORE;
|
||||
};
|
||||
|
||||
class AmovPknlMrunSlowWrflDb;
|
||||
class AmovPknlMtacSlowWrflDb: AmovPknlMrunSlowWrflDb {
|
||||
camShakeFire = ACE_CAMSHAKEFIRE_MORE;
|
||||
};
|
||||
|
||||
class AmovPknlMrunSlowWrflDbr;
|
||||
class AmovPknlMtacSlowWrflDbr: AmovPknlMrunSlowWrflDbr {
|
||||
camShakeFire = ACE_CAMSHAKEFIRE_MORE;
|
||||
};
|
||||
|
||||
class AmovPknlMrunSlowWrflDr;
|
||||
class AmovPknlMtacSlowWrflDr: AmovPknlMrunSlowWrflDr {
|
||||
camShakeFire = ACE_CAMSHAKEFIRE_MORE;
|
||||
};
|
||||
|
||||
class AmovPknlMrunSlowWrflDfr;
|
||||
class AmovPknlMtacSlowWrflDfr: AmovPknlMrunSlowWrflDfr {
|
||||
camShakeFire = ACE_CAMSHAKEFIRE_MORE;
|
||||
};
|
||||
|
||||
class AmovPknlMstpSrasWrflDnon;
|
||||
class AmovPknlMwlkSrasWrflDf: AmovPknlMstpSrasWrflDnon {
|
||||
camShakeFire = ACE_CAMSHAKEFIRE_NORMAL;
|
||||
};
|
||||
|
||||
class AmovPknlMrunSrasWrflDf;
|
||||
class AmovPknlMtacSrasWrflDf: AmovPknlMrunSrasWrflDf {
|
||||
camShakeFire = ACE_CAMSHAKEFIRE_MORE;
|
||||
};
|
||||
|
||||
class AmovPknlMwlkSrasWpstDf;
|
||||
class AmovPknlMtacSrasWpstDf: AmovPknlMwlkSrasWpstDf {
|
||||
camShakeFire = ACE_CAMSHAKEFIRE_MORE;
|
||||
};
|
||||
};
|
||||
};
|
@ -1,11 +1,11 @@
|
||||
|
||||
#define KICKBACK 1.4
|
||||
|
||||
#define MUZZLETEMP 1
|
||||
#define MUZZLETEMP 1.2
|
||||
#define MUZZLEPERM 0.4
|
||||
|
||||
#define MUZZLECLIMB_POS 1
|
||||
#define MUZZLERIGHT_POS 0.4
|
||||
#define MUZZLERIGHT_POS 0.2
|
||||
|
||||
#define MUZZLECLIMB_MAG 1
|
||||
#define MUZZLERIGHT_MAG 1
|
||||
|
8
addons/recoil/XEH_preInit.sqf
Normal file
8
addons/recoil/XEH_preInit.sqf
Normal file
@ -0,0 +1,8 @@
|
||||
// by commy2
|
||||
#include "script_component.hpp"
|
||||
|
||||
ADDON = false;
|
||||
|
||||
PREP(camshake);
|
||||
|
||||
ADDON = true;
|
@ -12,4 +12,12 @@ class CfgPatches {
|
||||
};
|
||||
};
|
||||
|
||||
#include "CfgEventHandlers.hpp"
|
||||
|
||||
#include "CfgMoves.hpp"
|
||||
#include "CfgRecoils.hpp"
|
||||
|
||||
class CfgCameraShake {
|
||||
// What does this do, really? It seems like the engine no longer respects it.
|
||||
defaultCaliberCoefWeaponFire = 0;
|
||||
};
|
||||
|
63
addons/recoil/functions/fnc_camshake.sqf
Normal file
63
addons/recoil/functions/fnc_camshake.sqf
Normal file
@ -0,0 +1,63 @@
|
||||
// TMR: Small Arms - Recoil initialization and functions
|
||||
// (C) 2013 Ryan Schultz. See LICENSE.
|
||||
// Edited prefixes for compatability in AGM_Realism by KoffeinFlummi
|
||||
// Edited by commy2
|
||||
#include "script_component.hpp"
|
||||
|
||||
#define BASE_POWER 0.40
|
||||
#define BASE_TIME 0.19
|
||||
#define BASE_FREQ 13
|
||||
#define RECOIL_COEF 40
|
||||
|
||||
private ["_unit", "_weapon", "_muzzle"];
|
||||
|
||||
_unit = _this select 0;
|
||||
_weapon = _this select 1;
|
||||
_muzzle = _this select 2;
|
||||
|
||||
if (toLower _weapon in ["throw", "put"]) exitWith {};
|
||||
|
||||
private ["_powerMod", "_timeMod", "_freqMod"];
|
||||
|
||||
_powerMod = ([0, -0.1, -0.1, 0, -0.2] select (["STAND", "CROUCH", "PRONE", "UNDEFINED", ""] find stance _unit)) + ([0, -1, 0, -1] select (["INTERNAL", "EXTERNAL", "GUNNER", "GROUP"] find cameraView));
|
||||
_timeMod = 0;
|
||||
_freqMod = 0;
|
||||
|
||||
// to get camshake read kickback
|
||||
private ["_config", "_recoil"];
|
||||
|
||||
_config = configFile >> "CfgWeapons" >> _weapon;
|
||||
_recoil = if (_muzzle == _weapon) then {
|
||||
getText (_config >> "recoil")
|
||||
} else {
|
||||
getText (_config >> _muzzle >> "recoil")
|
||||
};
|
||||
|
||||
_recoil = getArray (configFile >> "CfgRecoils" >> _recoil >> "kickBack");
|
||||
if (count _recoil < 2) then {
|
||||
_recoil = [0, 0];
|
||||
};
|
||||
|
||||
// parse numbers
|
||||
_recoil set [0, call compile format ["%1", _recoil select 0]];
|
||||
_recoil set [1, call compile format ["%1", _recoil select 1]];
|
||||
|
||||
private "_powerCoef";
|
||||
_powerCoef = RECOIL_COEF * linearConversion [0, 1, random 1, _recoil select 0, _recoil select 1, false];
|
||||
|
||||
if (isWeaponRested _unit) then {_powerMod = _powerMod - 0.07};
|
||||
if (isWeaponDeployed _unit) then {_powerMod = _powerMod - 0.11};
|
||||
|
||||
private "_camshake";
|
||||
_camshake = [
|
||||
_powerCoef * (BASE_POWER + _powerMod) max 0,
|
||||
BASE_TIME + _timeMod max 0,
|
||||
BASE_FREQ + _freqMod max 0
|
||||
];
|
||||
|
||||
/*
|
||||
systemChat str _camshake;
|
||||
copyToClipboard format ["addCamShake %1;", _camshake];
|
||||
*/
|
||||
|
||||
addCamShake _camshake;
|
1
addons/recoil/functions/script_component.hpp
Normal file
1
addons/recoil/functions/script_component.hpp
Normal file
@ -0,0 +1 @@
|
||||
#include "\z\ace\addons\overpressure\script_component.hpp"
|
Loading…
Reference in New Issue
Block a user