Moved heart beat sounds to medical ui

This commit is contained in:
BaerMitUmlaut 2017-01-29 20:24:16 +01:00
parent ecbe429f9d
commit 20cf30a7c6
16 changed files with 49 additions and 10 deletions

View File

@ -19,7 +19,6 @@ class CfgPatches {
#include "CfgEden.hpp"
#include "CfgEventHandlers.hpp"
#include "CfgSounds.hpp"
#include "CfgFactionClasses.hpp"
#include "CfgVehicles.hpp"
#include "CfgWeapons.hpp"

View File

@ -1,37 +1,37 @@
class CfgSounds {
class ACE_heartbeat_fast_1 {
name = "ACE_heartbeat_fast_1";
sound[] = {QPATHTOF(sounds\heart_beats\fast_1.wav), "db+1", 1};
sound[] = {QPATHTOF(sounds\fast_1.wav), "db+1", 1};
titles[] = {};
};
class ACE_heartbeat_fast_2 {
name = "ACE_heartbeat_fast_2";
sound[] = {QPATHTOF(sounds\heart_beats\fast_2.wav), "db+1", 1};
sound[] = {QPATHTOF(sounds\fast_2.wav), "db+1", 1};
titles[] = {};
};
class ACE_heartbeat_fast_3 {
name = "ACE_heartbeat_fast_3";
sound[] = {QPATHTOF(sounds\heart_beats\fast_3.wav), "db+1", 1};
sound[] = {QPATHTOF(sounds\fast_3.wav), "db+1", 1};
titles[] = {};
};
class ACE_heartbeat_norm_1 {
name = "ACE_heartbeat_norm_1";
sound[] = {QPATHTOF(sounds\heart_beats\norm_1.wav), "db+1", 1};
sound[] = {QPATHTOF(sounds\norm_1.wav), "db+1", 1};
titles[] = {};
};
class ACE_heartbeat_norm_2 {
name = "ACE_heartbeat_norm_2";
sound[] = {QPATHTOF(sounds\heart_beats\norm_2.wav), "db+1", 1};
sound[] = {QPATHTOF(sounds\norm_2.wav), "db+1", 1};
titles[] = {};
};
class ACE_heartbeat_slow_1 {
name = "ACE_heartbeat_slow_1";
sound[] = {QPATHTOF(sounds\heart_beats\slow_1.wav), "db+1", 1};
sound[] = {QPATHTOF(sounds\slow_1.wav), "db+1", 1};
titles[] = {};
};
class ACE_heartbeat_slow_2 {
name = "ACE_heartbeat_slow_2";
sound[] = {QPATHTOF(sounds\heart_beats\slow_2.wav), "db+1", 1};
sound[] = {QPATHTOF(sounds\slow_2.wav), "db+1", 1};
titles[] = {};
};
};

View File

@ -1,5 +1,6 @@
PREP(effectBleeding);
PREP(effectBloodVolume);
PREP(effectHeartBeat);
PREP(effectIncapacitated);
PREP(effectPain);
PREP(effectUnconscious);

View File

@ -3,11 +3,13 @@
if (!hasInterface) exitWith {};
[] call FUNC(initEffects);
[FUNC(handleEffects), 1, []] call CBA_fnc_addPerFrameHandler;
[FUNC(handleEffects), 1, []] call CBA_fnc_addPerFrameHandler;
[FUNC(effectHeartBeat), 0, []] call CBA_fnc_addPerFrameHandler;
["ace_unconscious", {
params ["_unit", "_unconscious"];
if (_unit != ACE_player) exitWith {};
[_unconscious, 1] call FUNC(effectUnconscious);
["unconscious", _unconscious] call EFUNC(common,setDisableUserInputStatus);
}] call CBA_fnc_addEventHandler;

View File

@ -18,4 +18,6 @@ ADDON = false;
{} // TODO!
] call CBA_Settings_fnc_init;
GVAR(lastHeartBeatSound) = 0;
ADDON = true;

View File

@ -15,3 +15,4 @@ class CfgPatches {
};
#include "CfgEventHandlers.hpp"
#include "CfgSounds.hpp"

View File

@ -0,0 +1,29 @@
/*
* Author: BaerMitUmlaut
* Handles the hear beat sound.
*
* Arguments:
* None
*
* Return Value:
* None
*/
#include "script_component.hpp"
private _heartRate = ACE_player getVariable [QEGVAR(medical,heartRate), DEFAULT_HEART_RATE]
private _waitTime = 60 / _heartRate;
if (_heartRate == 0) exitWith {};
if (CBA_missionTime - GVAR(lastHeartBeatSound) > _waitTime) then {
GVAR(lastHeartBeatSound) = CBA_missionTime;
switch (true) do {
case (_heartRate > 160): {
playSound SND_HEARBEAT_FAST;
};
case (_heartRate < 60): {
playSound SND_HEARBEAT_SLOW;
};
};
};

View File

@ -1,6 +1,7 @@
/*
* Author: BaerMitUmlaut
* Handles any audible and visual effects of medical.
* Handles any visual effects of medical.
* Note: Heart beat sounds run in a different PFH - see fnc_effectHeartBeat.
*
* Arguments:
* None

View File

@ -22,3 +22,7 @@
#define FX_PAIN_FADE_OUT 0.7
#define FX_UNCON_FADE_IN 2.0
#define FX_UNCON_FADE_OUT 5.0
#define SND_HEARBEAT_FAST (selectRandom ["ACE_heartbeat_fast_1", "ACE_heartbeat_fast_2", "ACE_heartbeat_fast_3"])
#define SND_HEARBEAT_NORMAL (selectRandom ["ACE_heartbeat_norm_1", "ACE_heartbeat_norm_2"])
#define SND_HEARBEAT_SLOW (selectRandom ["ACE_heartbeat_slow_1", "ACE_heartbeat_slow_2"])