ACE3/addons/medical/XEH_postInit.sqf

156 lines
5.3 KiB
Plaintext
Raw Normal View History

2015-02-10 17:17:26 +00:00
// ACE Medical System Visual Loop
2015-02-08 09:25:03 +00:00
#include "script_component.hpp"
if (!hasInterface) exitwith{};
GVAR(heartBeatSounds_Fast) = ["ACE_heartbeat_fast_1", "ACE_heartbeat_fast_2", "ACE_heartbeat_fast_3", "ACE_heartbeat_norm_1", "ACE_heartbeat_norm_2"];
GVAR(heartBeatSounds_Normal) = ["ACE_heartbeat_norm_1", "ACE_heartbeat_norm_2"];
GVAR(heartBeatSounds_Slow) = ["ACE_heartbeat_slow_1", "ACE_heartbeat_slow_2", "ACE_heartbeat_norm_1", "ACE_heartbeat_norm_2"];
GVAR(playingHeartBeatSound) = false;
2015-02-10 17:17:26 +00:00
// Initialize all effects
// @todo: make this a macro?
_fnc_createEffect = {
private ["_type", "_layer", "_default"];
_type = _this select 0;
_layer = _this select 1;
_default = _this select 2;
_effect = ppEffectCreate [_type, _layer];
_effect ppEffectForceInNVG true;
_effect ppEffectAdjust _default;
_effect ppEffectCommit 0;
_effect
};
GVAR(effectUnconsciousCC) = [
"ColorCorrections",
4201,
[1,1,0, [0,0,0,1], [0,0,0,0], [1,1,1,1], [0.4,0.4,0,0,0,0.1,0.3]]
] call _fnc_createEffect;
2015-02-10 22:13:52 +00:00
2015-02-10 17:17:26 +00:00
GVAR(effectUnconsciousRB) = [
"RadialBlur",
4202,
[0.01,0.01,0,0]
] call _fnc_createEffect;
GVAR(effectBlindingCC) = [
"ColorCorrections",
4203,
[1,1,0, [1,1,1,0], [0,0,0,1], [0,0,0,0]]
] call _fnc_createEffect;
GVAR(effectBloodVolumeCC) = [
"ColorCorrections",
4204,
[1,1,0, [0,0,0,0], [1,1,1,1], [0.2,0.2,0.2,0]]
] call _fnc_createEffect;
GVAR(effectPainCA) = [
"chromAberration",
4205,
[0, 0, false]
] call _fnc_createEffect;
2015-02-10 22:13:52 +00:00
2015-02-10 17:17:26 +00:00
GVAR(effectPainCC) = [
"ColorCorrections",
4206,
[1,1,0, [1,1,1,1], [0,0,0,0], [1,1,1,1], [1.3,1.3,0,0,0,0.2,2]]
] call _fnc_createEffect;
// @todo; what's this for?
GVAR(effectUnconsciousUnit) = objNull;
2015-02-10 17:17:26 +00:00
// Initialize Other Variables
GVAR(effectBlind) = false;
GVAR(effectTimeBlood) = time;
[{
2015-02-10 22:13:52 +00:00
// Zeus interface is open or player is dead; disable everything
if (!(isNull (findDisplay 312)) or !(alive ACE_player)) exitWith {
2015-02-10 17:17:26 +00:00
GVAR(effectUnconsciousCC) ppEffectEnable false;
GVAR(effectUnconsciousRB) ppEffectEnable false;
GVAR(effectBlindingCC) ppEffectEnable false;
GVAR(effectBloodVolumeCC) ppEffectEnable false;
GVAR(effectPainCA) ppEffectEnable false;
GVAR(effectPainCC) ppEffectEnable false;
[false] call EFUNC(common,disableUserInput); // @todo, only when disabled?
};
// Unconsciousness effect
if (ACE_player getVariable [QGVAR(isUnconscious), false]) then {
GVAR(effectUnconsciousCC) ppEffectEnable true;
GVAR(effectUnconsciousRB) ppEffectEnable true;
GVAR(effectBlind) = true;
[true, true] call EFUNC(common,disableUserInput); // @todo, see above
} else {
GVAR(effectUnconsciousCC) ppEffectEnable false;
GVAR(effectUnconsciousRB) ppEffectEnable false;
[false] call EFUNC(common,disableUserInput); // @todo, see above
if (GVAR(effectBlind)) then {
2015-02-10 22:14:39 +00:00
_strength = 0.78 * (call EFUNC(common,ambientBrightness));
GVAR(effectBlindingCC) ppEffectEnable true;
GVAR(effectBlindingCC) ppEffectAdjust [1,1,_strength, [1,1,1,0], [0,0,0,1], [0,0,0,0]];
GVAR(effectBlindingCC) ppEffectCommit 0;
[{
GVAR(effectBlindingCC) ppEffectAdjust [1,1,0, [1,1,1,0], [0,0,0,1], [0,0,0,0]];
GVAR(effectBlindingCC) ppEffectCommit ((_this select 0) * 2);
}, [_strength], 0.01, 0] call EFUNC(common,waitAndExecute);
[{
GVAR(effectBlindingCC) ppEffectEnable false;
}, [], (_strength * 2) + 0.5, 0] call EFUNC(common,waitAndExecute);
GVAR(effectBlind) = false;
2015-02-10 17:17:26 +00:00
};
};
// @todo: pain effect
// Bleeding Indicator
// @todo: redo this after initial release
if (damage ACE_player > 0.1 and GVAR(effectTimeBlood) + 6 < time) then {
GVAR(effectTimeBlood) = time;
[500 * damage ACE_player] call BIS_fnc_bloodEffect;
};
// Blood Volume Effect
2015-02-10 22:14:11 +00:00
_blood = (ACE_player getVariable [QGVAR(bloodVolume), 100]) / 100;
2015-02-10 17:17:26 +00:00
if (_blood > 0.99) then {
GVAR(effectBloodVolumeCC) ppEffectEnable false;
} else {
GVAR(effectBloodVolumeCC) ppEffectEnable true;
GVAR(effectBloodVolumeCC) ppEffectAdjust [1,1,0, [0,0,0,0], [1,1,1,_blood], [0.2,0.2,0.2,0]];
GVAR(effectBloodVolumeCC) ppEffectCommit 0;
};
2015-02-10 22:14:56 +00:00
/* @todo
// Heart rate sound effect
_heartRate = _unit getvariable[QGVAR(heartRate), 70];
if (_heartRate > 0.1) then {
if (GVAR(playingHeartBeatSound)) exitwith {};
GVAR(playingHeartBeatSound) = true;
_sleep = 60 / _heartRate;
if (_heartRate < 60) then {
_sound = GVAR(heartBeatSounds_Slow) select (random((count GVAR(heartBeatSounds_Slow)) -1));
playSound _sound;
[{
GVAR(playingHeartBeatSound) = false;
}, [], _sleep, _sleep] call EFUNC(common,waitAndExecute);
} else {
2015-02-10 22:14:56 +00:00
if (_heartRate > 120) then {
_sound = GVAR(heartBeatSounds_Fast) select (random((count GVAR(heartBeatSounds_Fast)) -1));
playSound _sound;
[{
GVAR(playingHeartBeatSound) = false;
}, [], _sleep, _sleep] call EFUNC(common,waitAndExecute);
};
};
};
2015-02-10 22:14:56 +00:00
*/
}, 0.5, []] call CBA_fnc_addPerFrameHandler;