2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2017-01-29 19:24:16 +00:00
|
|
|
/*
|
|
|
|
* Author: BaerMitUmlaut
|
|
|
|
* Handles the hear beat sound.
|
|
|
|
*
|
|
|
|
* Arguments:
|
2019-04-09 17:51:59 +00:00
|
|
|
* None
|
2017-01-29 19:24:16 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
2019-03-30 16:07:54 +00:00
|
|
|
*
|
|
|
|
* Example:
|
2019-04-09 17:51:59 +00:00
|
|
|
* [] call ace_medical_feedback_fnc_effectHeartBeat
|
2019-03-30 16:07:54 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
2017-01-29 19:24:16 +00:00
|
|
|
*/
|
2018-08-02 14:02:10 +00:00
|
|
|
|
2021-10-10 14:24:10 +00:00
|
|
|
if (EGVAR(common,OldIsCamera)) exitWith {
|
|
|
|
TRACE_2("Ending heart beat effect - scripted camera",_heartRate,EGVAR(common,OldIsCamera));
|
|
|
|
GVAR(heartBeatEffectRunning) = false;
|
|
|
|
};
|
2017-01-29 19:24:16 +00:00
|
|
|
|
2021-10-10 14:24:10 +00:00
|
|
|
private _heartRate = GET_HEART_RATE(ACE_player);
|
2017-03-18 16:53:57 +00:00
|
|
|
if (_heartRate == 0) exitWith {
|
|
|
|
TRACE_1("Ending heart beat effect - zero",_heartRate);
|
|
|
|
GVAR(heartBeatEffectRunning) = false;
|
|
|
|
};
|
2017-01-29 20:20:55 +00:00
|
|
|
private _waitTime = 60 / _heartRate;
|
2017-01-29 19:24:16 +00:00
|
|
|
|
2017-03-18 16:53:57 +00:00
|
|
|
// TRACE_2("",_heartRate,_waitTime);
|
|
|
|
|
2017-02-19 04:11:40 +00:00
|
|
|
switch (true) do {
|
|
|
|
case (_heartRate > 160): {
|
2017-03-18 16:53:57 +00:00
|
|
|
// playSound SND_HEARBEAT_FAST; // Array doesn't blend together well, just play one file consistently
|
2019-11-16 18:42:15 +00:00
|
|
|
if (isGameFocused) then { playSound "ACE_heartbeat_fast_1"; };
|
2018-05-08 10:12:01 +00:00
|
|
|
[FUNC(effectHeartBeat), [], _waitTime] call CBA_fnc_waitAndExecute;
|
2017-02-19 04:11:40 +00:00
|
|
|
};
|
|
|
|
case (_heartRate < 60): {
|
2019-11-16 18:42:15 +00:00
|
|
|
if (isGameFocused) then { playSound SND_HEARBEAT_SLOW; };
|
2018-05-08 10:12:01 +00:00
|
|
|
[FUNC(effectHeartBeat), [], _waitTime] call CBA_fnc_waitAndExecute;
|
2017-02-19 04:11:40 +00:00
|
|
|
};
|
|
|
|
default {
|
2017-03-18 16:53:57 +00:00
|
|
|
TRACE_1("Ending heart beat effect - normal",_heartRate);
|
2017-02-19 04:11:40 +00:00
|
|
|
GVAR(heartBeatEffectRunning) = false;
|
2017-01-29 19:24:16 +00:00
|
|
|
};
|
|
|
|
};
|