ACE3/addons/medical_feedback/functions/fnc_handleEffects.sqf
10Dozen b30f023c04
Adds Icon option for Low blood volume at Medical Feedback (#7507)
* Adds Icon option for Low blood volume at Medical Feedback

- Adds setting to switch Low blood volume effect with 3 options: Color fading, Icon, Color fading + Icon
- Adds icon to UI on low blood
- Adds icon PAA files

* Review fixes

- Added ACE tags to added controls
- Added defines for GUI position/size
- Added missing newline at EOF
- Updated fnc_effectBloodVolumeIcon (removed usage of uiNamespace and minor changes)
- CBA_fnc_addSetting is now used to init settings
- Icon path macro updated to return formatted path

* Review fixes vol.2

- Removed `disableSerialization` and added default value for indicator control and not null checks to effectBVI function
- Removed defines from RscInGameUI and used a3 defines instead
- Changed formatting of macroses

* Review fixes vol.3

- Fixed exec code of BV setting
- Removed ctrlCommit from eBVI function
- Changed initEffects function to be able to update pain and BV effects only
- Changed control name from `BloodVolumeInfoIndicator` to `bloodVolumeIndicator`
- Various formatting tweaks (spaces/lines/uppercase/periods)

* Review fixed vol.4

- Remove extra checks from eBVI func
- Restores contol's onLoad script using ARR_2(QQGVAR())
2020-02-22 14:42:59 -06:00

62 lines
2.0 KiB
Plaintext

#include "script_component.hpp"
/*
* Author: BaerMitUmlaut
* Handles any visual effects of medical.
* Note: Heart beat sounds run in a different PFH - see fnc_effectHeartBeat.
*
* Arguments:
* 0: Manual, instant update (optional, default false) <BOOL>
*
* Return Value:
* None
*
* Example:
* [] call ace_medical_feedback_fnc_handleEffects
*
* Public: No
*/
params [["_manualUpdate", false]];
if (EGVAR(common,OldIsCamera) || {!alive ACE_player}) exitWith {
[false, 0] call FUNC(effectUnconscious);
[false] call FUNC(effectPain);
[false] call FUNC(effectBloodVolume);
[false] call FUNC(effectBloodVolumeIcon);
[false] call FUNC(effectBleeding);
};
BEGIN_COUNTER(handleEffects);
// - Current state info -------------------------------------------------------
private _bleedingStrength = GET_BLOOD_LOSS(ACE_player);
private _bloodVolume = GET_BLOOD_VOLUME(ACE_player);
private _unconscious = IS_UNCONSCIOUS(ACE_player);
private _heartRate = GET_HEART_RATE(ACE_player);
private _pain = GET_PAIN_PERCEIVED(ACE_player);
if ((!GVAR(heartBeatEffectRunning)) && {_heartRate != 0} && {(_heartRate > 160) || {_heartRate < 60}}) then {
TRACE_1("Starting heart beat effect",_heartRate);
GVAR(heartBeatEffectRunning) = true;
[] call FUNC(effectHeartBeat);
};
// - Visual effects -----------------------------------------------------------
[_unconscious, 2] call FUNC(effectUnconscious);
[
true,
linearConversion [BLOOD_VOLUME_CLASS_2_HEMORRHAGE, BLOOD_VOLUME_CLASS_4_HEMORRHAGE, _bloodVolume, 0, 1, true]
] call FUNC(effectBloodVolume);
[
true,
ceil linearConversion [
BLOOD_VOLUME_CLASS_2_HEMORRHAGE, BLOOD_VOLUME_CLASS_4_HEMORRHAGE,
_bloodVolume,
ICON_BLOODVOLUME_IDX_MIN, ICON_BLOODVOLUME_IDX_MAX, true
]
] call FUNC(effectBloodVolumeIcon);
[!_unconscious, _pain] call FUNC(effectPain);
[!_unconscious, _bleedingStrength, _manualUpdate] call FUNC(effectBleeding);
END_COUNTER(handleEffects);