diff --git a/addons/advanced_fatigue/XEH_postInit.sqf b/addons/advanced_fatigue/XEH_postInit.sqf index 6716fca96d..e3c17173f5 100644 --- a/addons/advanced_fatigue/XEH_postInit.sqf +++ b/addons/advanced_fatigue/XEH_postInit.sqf @@ -48,7 +48,7 @@ if (!hasInterface) exitWith {}; linearConversion [0, 1, (_this getVariable [QEGVAR(medical,pain), 0]), 1, 1.1, true]; }] call FUNC(addDutyFactor); [QEGVAR(medical,bloodVolume), { // 100->1.0, 90->1.1, 80->1.2 - linearConversion [100, 0, (_this getVariable [QEGVAR(medical,bloodVolume), 100]), 1, 2, true]; + linearConversion [6, 0, (_this getVariable [QEGVAR(medical,bloodVolume), 100]), 1, 2, true]; }] call FUNC(addDutyFactor); }; if (["ACE_Dragging"] call EFUNC(common,isModLoaded)) then { diff --git a/addons/medical/ACE_Settings.hpp b/addons/medical/ACE_Settings.hpp index febac24fa5..b5c1c80d1a 100644 --- a/addons/medical/ACE_Settings.hpp +++ b/addons/medical/ACE_Settings.hpp @@ -221,14 +221,6 @@ class ACE_Settings { typeName = "SCALAR"; value = 0.1; }; - class GVAR(painEffectType) { - category = CSTRING(Category_Medical); - displayName = CSTRING(painEffectType); - typeName = "SCALAR"; - value = 0; - values[] = {CSTRING(painEffect_Flash), CSTRING(painEffect_Chroma)}; - isClientSettable = 1; - }; class GVAR(allowUnconsciousAnimationOnTreatment) { category = CSTRING(Category_Medical); displayName = CSTRING(MedicalSettings_allowUnconsciousAnimationOnTreatment_DisplayName); diff --git a/addons/medical/CfgVehicles.hpp b/addons/medical/CfgVehicles.hpp index b418601593..dbf1e2114e 100644 --- a/addons/medical/CfgVehicles.hpp +++ b/addons/medical/CfgVehicles.hpp @@ -403,22 +403,6 @@ class CfgVehicles { typeName = "SCALAR"; defaultValue = 0.1; }; - class painEffectType { - displayName = CSTRING(painEffectType); - typeName = "SCALAR"; - isClientSettable = 1; - class values { - class flash { - name = CSTRING(painEffect_Flash); - value = 0; - default = 1; - }; - class chroma { - name = CSTRING(painEffect_Chroma); - value = 1; - }; - }; - }; class allowUnconsciousAnimationOnTreatment { displayName = CSTRING(MedicalSettings_allowUnconsciousAnimationOnTreatment_DisplayName); description = CSTRING(MedicalSettings_allowUnconsciousAnimationOnTreatment_Description); diff --git a/addons/medical/XEH_postInit.sqf b/addons/medical/XEH_postInit.sqf index ce54e305f4..00e297590c 100644 --- a/addons/medical/XEH_postInit.sqf +++ b/addons/medical/XEH_postInit.sqf @@ -1,9 +1,5 @@ #include "script_component.hpp" -GVAR(heartBeatSounds_Fast) = ["ACE_heartbeat_fast_1", "ACE_heartbeat_fast_2", "ACE_heartbeat_fast_3"]; -GVAR(heartBeatSounds_Normal) = ["ACE_heartbeat_norm_1", "ACE_heartbeat_norm_2"]; -GVAR(heartBeatSounds_Slow) = ["ACE_heartbeat_slow_1", "ACE_heartbeat_slow_2"]; - ["ace_interactMenuClosed", {[objNull, 0] call FUNC(displayPatientInformation); }] call CBA_fnc_addEventHandler; //Handle Deleting Bodies and creating litter on Server: diff --git a/addons/medical/config.cpp b/addons/medical/config.cpp index 1ac00f09aa..6345e1fbd0 100644 --- a/addons/medical/config.cpp +++ b/addons/medical/config.cpp @@ -19,7 +19,6 @@ class CfgPatches { #include "CfgEden.hpp" #include "CfgEventHandlers.hpp" -#include "CfgSounds.hpp" #include "CfgFactionClasses.hpp" #include "CfgVehicles.hpp" #include "CfgWeapons.hpp" diff --git a/addons/medical/functions/fnc_moduleMedicalSettings.sqf b/addons/medical/functions/fnc_moduleMedicalSettings.sqf index 8aa6efcb46..8c518ac37d 100644 --- a/addons/medical/functions/fnc_moduleMedicalSettings.sqf +++ b/addons/medical/functions/fnc_moduleMedicalSettings.sqf @@ -48,7 +48,6 @@ if !(_activated) exitWith {}; [_logic, QGVAR(useLocation_PAK), "useLocation_PAK"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(useLocation_SurgicalKit), "useLocation_SurgicalKit"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(remainingDamage_Medkit), "remainingDamage_Medkit"] call EFUNC(common,readSettingFromModule); -[_logic, QGVAR(painEffectType), "painEffectType"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(allowUnconsciousAnimationOnTreatment), "allowUnconsciousAnimationOnTreatment"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(menuTypeStyle), "menuTypeStyle"] call EFUNC(common,readSettingFromModule); diff --git a/addons/medical/script_component.hpp b/addons/medical/script_component.hpp index 3802885221..c93f584b0c 100644 --- a/addons/medical/script_component.hpp +++ b/addons/medical/script_component.hpp @@ -2,7 +2,7 @@ #define COMPONENT_BEAUTIFIED Medical Core #include "\z\ace\addons\main\script_mod.hpp" -#define DEBUG_MODE_FULL +// #define DEBUG_MODE_FULL #define DISABLE_COMPILE_CACHE // #define ENABLE_PERFORMANCE_COUNTERS diff --git a/addons/medical/stringtable.xml b/addons/medical/stringtable.xml index 89353de1d4..b1eca333f3 100644 --- a/addons/medical/stringtable.xml +++ b/addons/medical/stringtable.xml @@ -2676,48 +2676,6 @@ 包帯は体力を完全に回復する 붕대를 감은후 체력을 회복함 - - Pain Effect Type - Schmerzeffekt-Typ - Rodzaj efektu bólu - Визуальный эффект боли - Pain Effect Type - Tipo de efecto de dolor - Type d'effet de douleur - Fájdalom-effekt típusa - Tipo do efeito de dor - Typ bolesti - efekt - 痛みの種類 - 고통 효과 종류 - - - Colour Flashing - Farbblinken - Pulsujące kolory - Пульсирующий свет - Colore lampeggiante - Parpadeo de color - Flash de couleur - Színvillódzás - Flash de cor - Blikající barva - 色の点滅 - 색 반짝임 - - - Chromatic Aberration - Chromatische Aberration - Aberracja chromatyczna - Хроматическая аберрация - Aberrazione cromatica - Aberración cromática - Aberration chromatique - Kromatikus aberráció - Chromatická aberace - Aberração Cromática - 色の収差 - 색수차 - Style of menu (Medical) Styl menu medycznego diff --git a/addons/medical_damage/script_component.hpp b/addons/medical_damage/script_component.hpp index e38fd550bb..0d1bc54e7e 100644 --- a/addons/medical_damage/script_component.hpp +++ b/addons/medical_damage/script_component.hpp @@ -4,7 +4,6 @@ #define DEBUG_MODE_FULL #define DISABLE_COMPILE_CACHE -#define CBA_DEBUG_SYNCHRONOUS //#define ENABLE_PERFORMANCE_COUNTERS #ifdef DEBUG_ENABLED_MEDICAL_DAMAGE diff --git a/addons/medical_engine/functions/fnc_playInjuredSound.sqf b/addons/medical_engine/functions/fnc_playInjuredSound.sqf index 53e092da2f..08ec6c3bbc 100644 --- a/addons/medical_engine/functions/fnc_playInjuredSound.sqf +++ b/addons/medical_engine/functions/fnc_playInjuredSound.sqf @@ -22,7 +22,7 @@ #define TIME_OUT_MOAN 5 params [["_unit", objNull, [objNull]], ["_type", "hit", [""]], ["_severity", 0, [0]]]; -TRACE_3("",_unit,_type,_severity); +// TRACE_3("",_unit,_type,_severity); if (!local _unit) exitWith { ERROR("Unit not local or null"); diff --git a/addons/medical_engine/script_component.hpp b/addons/medical_engine/script_component.hpp index 6cdaddc84b..4ae38a8b6e 100644 --- a/addons/medical_engine/script_component.hpp +++ b/addons/medical_engine/script_component.hpp @@ -4,7 +4,6 @@ #define DEBUG_MODE_FULL #define DISABLE_COMPILE_CACHE -#define CBA_DEBUG_SYNCHRONOUS //#define ENABLE_PERFORMANCE_COUNTERS #ifdef DEBUG_ENABLED_MEDICAL_ENGINE diff --git a/addons/medical_ui/CfgEventHandlers.hpp b/addons/medical_ui/CfgEventHandlers.hpp index 93e3311cf2..0d3301d6e0 100644 --- a/addons/medical_ui/CfgEventHandlers.hpp +++ b/addons/medical_ui/CfgEventHandlers.hpp @@ -9,3 +9,9 @@ class Extended_PreInit_EventHandlers { init = QUOTE(call COMPILE_FILE(XEH_preInit)); }; }; + +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_postInit)); + }; +}; diff --git a/addons/medical/CfgSounds.hpp b/addons/medical_ui/CfgSounds.hpp similarity index 59% rename from addons/medical/CfgSounds.hpp rename to addons/medical_ui/CfgSounds.hpp index 9cc5faedf9..077c32ba5e 100644 --- a/addons/medical/CfgSounds.hpp +++ b/addons/medical_ui/CfgSounds.hpp @@ -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[] = {}; }; }; diff --git a/addons/medical_ui/XEH_PREP.hpp b/addons/medical_ui/XEH_PREP.hpp index e69de29bb2..c7f0dd1dfb 100644 --- a/addons/medical_ui/XEH_PREP.hpp +++ b/addons/medical_ui/XEH_PREP.hpp @@ -0,0 +1,10 @@ +TRACE_1("",QUOTE(ADDON)); + +PREP(effectBleeding); +PREP(effectBloodVolume); +PREP(effectHeartBeat); +PREP(effectIncapacitated); +PREP(effectPain); +PREP(effectUnconscious); +PREP(handleEffects); +PREP(initEffects); diff --git a/addons/medical_ui/XEH_postInit.sqf b/addons/medical_ui/XEH_postInit.sqf new file mode 100644 index 0000000000..e3ae32bf2c --- /dev/null +++ b/addons/medical_ui/XEH_postInit.sqf @@ -0,0 +1,17 @@ +#include "script_component.hpp" + +if (!hasInterface) exitWith {}; + +GVAR(nextFadeIn) = 0; +GVAR(heartBeatEffectRunning) = false; + +[false] call FUNC(initEffects); +[LINKFUNC(handleEffects), 1, []] 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; diff --git a/addons/medical_ui/XEH_preInit.sqf b/addons/medical_ui/XEH_preInit.sqf index a7feade1c3..3de7bb526a 100644 --- a/addons/medical_ui/XEH_preInit.sqf +++ b/addons/medical_ui/XEH_preInit.sqf @@ -2,6 +2,28 @@ ADDON = false; +PREP_RECOMPILE_START; #include "XEH_PREP.hpp" +PREP_RECOMPILE_END; + +[ + QGVAR(painEffectType), + "LIST", + [localize LSTRING(painEffectType), "Selects the used pain effect type"], //@todo + "ACE Medical", // @todo + [ + [0, 1], + [localize LSTRING(painEffectType_whiteFlashing), localize LSTRING(painEffectType_pulsingBlur)], + 0 + ], + false, + { + if (isNil QGVAR(ppPain)) exitWith {TRACE_1("Before Post-Init",_this)}; + TRACE_1("reseting ppEffect type",_this); + [true] call FUNC(initEffects); + } +] call CBA_Settings_fnc_init; + +GVAR(lastHeartBeatSound) = 0; ADDON = true; diff --git a/addons/medical_ui/config.cpp b/addons/medical_ui/config.cpp index 60cad71f28..9639603c60 100644 --- a/addons/medical_ui/config.cpp +++ b/addons/medical_ui/config.cpp @@ -15,3 +15,4 @@ class CfgPatches { }; #include "CfgEventHandlers.hpp" +#include "CfgSounds.hpp" diff --git a/addons/medical_ui/data/blood1.paa b/addons/medical_ui/data/blood1.paa new file mode 100644 index 0000000000..47a160172e Binary files /dev/null and b/addons/medical_ui/data/blood1.paa differ diff --git a/addons/medical_ui/data/blood2.paa b/addons/medical_ui/data/blood2.paa new file mode 100644 index 0000000000..b58e0bbc77 Binary files /dev/null and b/addons/medical_ui/data/blood2.paa differ diff --git a/addons/medical_ui/functions/fnc_effectBleeding.sqf b/addons/medical_ui/functions/fnc_effectBleeding.sqf new file mode 100644 index 0000000000..0575585c40 --- /dev/null +++ b/addons/medical_ui/functions/fnc_effectBleeding.sqf @@ -0,0 +1,75 @@ +/* + * Author: BaerMitUmlaut + * Handles the bleeding effect. + * + * Arguments: + * 0: Enable effect + * 1: Current bloodloss (in l/s) + * + * Return Value: + * None + */ +#include "script_component.hpp" +params ["_enable", "_bloodloss"]; +if (isNull findDisplay 46) exitWith {}; + +private _controls = uiNamespace getVariable [QGVAR(bloodControls), [controlNull, controlNull]]; +_controls params ["_blood1", "_blood2"]; + +if (!_enable) exitWith { + _blood1 ctrlSetFade 1; + _blood2 ctrlSetFade 1; + + _blood1 ctrlCommit 0; + _blood2 ctrlCommit 0; +}; + +// Initialize controls +if (isNull _blood1) then { + TRACE_1("Creating Blood Controls",_controls); + _blood1 = findDisplay 46 ctrlCreate ["RscPicture", -1]; + _blood2 = findDisplay 46 ctrlCreate ["RscPicture", -1]; + + _blood1 ctrlSetText QPATHTOF(data\blood1.paa); + _blood2 ctrlSetText QPATHTOF(data\blood2.paa); + + private _pos = [safeZoneXAbs, safeZoneY, safeZoneWAbs, safeZoneH]; + _blood1 ctrlSetPosition _pos; + _blood2 ctrlSetPosition _pos; + + _blood1 ctrlSetFade 1; + _blood2 ctrlSetFade 1; + + _blood1 ctrlCommit 0; + _blood2 ctrlCommit 0; + + uiNamespace setVariable [QGVAR(bloodControls), [_blood1, _blood2]]; +}; + +private _fade = linearConversion [0, 0.002, _bloodloss, 1, 0, true]; + +private _switchBloodFadeInfo = missionNamespace getVariable [QGVAR(switchBloodFadeInfo), [0, 0]]; +_switchBloodFadeInfo params ["_tickCounter", "_lastBloodloss"]; + +if (_tickCounter == 2) then { + if (ctrlFade _blood1 > ctrlFade _blood2) then { + _blood1 ctrlSetFade _fade; + _blood2 ctrlSetFade 1; + } else { + _blood1 ctrlSetFade 1; + _blood2 ctrlSetFade _fade; + }; + + _blood1 ctrlCommit 3; + _blood2 ctrlCommit 3; + + GVAR(switchBloodFadeInfo) = [0, _bloodloss]; +} else { + GVAR(switchBloodFadeInfo) = [_tickCounter + 1, _bloodloss]; +}; + +// Speed up fade on sudden changes +if (abs (_lastBloodloss - _bloodloss) > 0.001) then { + _blood1 ctrlCommit 1; + _blood2 ctrlCommit 1; +}; diff --git a/addons/medical_ui/functions/fnc_effectBloodVolume.sqf b/addons/medical_ui/functions/fnc_effectBloodVolume.sqf new file mode 100644 index 0000000000..92dfbbed74 --- /dev/null +++ b/addons/medical_ui/functions/fnc_effectBloodVolume.sqf @@ -0,0 +1,20 @@ +/* + * Author: BaerMitUmlaut + * Handles the blood volume effect. + * + * Arguments: + * 0: Enable + * 1: Intensity + * + * Return Value: + * None + */ +#include "script_component.hpp" +params ["_enable", "_intensity"]; + +if ((!_enable) || {_intensity == 0}) exitWith { + GVAR(ppBloodVolume) ppEffectEnable false; +}; +GVAR(ppBloodVolume) ppEffectEnable true; +GVAR(ppBloodVolume) ppEffectAdjust [1, 1, 0, [0, 0, 0, 0], [1, 1, 1, 1 - _intensity], [0.2, 0.2, 0.2, 0]]; +GVAR(ppBloodVolume) ppEffectCommit 1; diff --git a/addons/medical_ui/functions/fnc_effectHeartBeat.sqf b/addons/medical_ui/functions/fnc_effectHeartBeat.sqf new file mode 100644 index 0000000000..41f1f04f5c --- /dev/null +++ b/addons/medical_ui/functions/fnc_effectHeartBeat.sqf @@ -0,0 +1,37 @@ +/* + * 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]; +if (_heartRate == 0) exitWith { + TRACE_1("Ending heart beat effect - zero",_heartRate); + GVAR(heartBeatEffectRunning) = false; +}; +private _waitTime = 60 / _heartRate; + +// TRACE_2("",_heartRate,_waitTime); + +switch (true) do { + case (_heartRate > 160): { + // playSound SND_HEARBEAT_FAST; // Array doesn't blend together well, just play one file consistently + playSound "ACE_heartbeat_fast_1"; + [DFUNC(effectHeartBeat), [], _waitTime] call CBA_fnc_waitAndExecute; + }; + case (_heartRate < 60): { + playSound SND_HEARBEAT_SLOW; + [DFUNC(effectHeartBeat), [], _waitTime] call CBA_fnc_waitAndExecute; + + }; + default { + TRACE_1("Ending heart beat effect - normal",_heartRate); + GVAR(heartBeatEffectRunning) = false; + }; +}; diff --git a/addons/medical_ui/functions/fnc_effectIncapacitated.sqf b/addons/medical_ui/functions/fnc_effectIncapacitated.sqf new file mode 100644 index 0000000000..e55c91d243 --- /dev/null +++ b/addons/medical_ui/functions/fnc_effectIncapacitated.sqf @@ -0,0 +1,24 @@ +/* + * Author: BaerMitUmlaut + * Creates the incapacitation effect. + * + * Arguments: + * None + * + * Return Value: + * None + */ +#include "script_component.hpp" + +GVAR(ppIncapacitationBlur) ppEffectEnable true; +GVAR(ppIncapacitationGlare) ppEffectEnable true; + +GVAR(ppIncapacitationBlur) ppEffectAdjust [6]; +GVAR(ppIncapacitationGlare) ppEffectAdjust [1.2, 2, 0, [0, 0, 0, 0], [1, 1, 1, 1], [0, 0, 0, 0]]; +GVAR(ppIncapacitationBlur) ppEffectCommit 0; +GVAR(ppIncapacitationGlare) ppEffectCommit 0; + +GVAR(ppIncapacitationBlur) ppEffectAdjust [0]; +GVAR(ppIncapacitationGlare) ppEffectAdjust [1.0, 1, 0, [0, 0, 0, 0], [1, 1, 1, 1], [0, 0, 0, 0]]; +GVAR(ppIncapacitationBlur) ppEffectCommit 5; +GVAR(ppIncapacitationGlare) ppEffectCommit 5; diff --git a/addons/medical_ui/functions/fnc_effectPain.sqf b/addons/medical_ui/functions/fnc_effectPain.sqf new file mode 100644 index 0000000000..aac0bad017 --- /dev/null +++ b/addons/medical_ui/functions/fnc_effectPain.sqf @@ -0,0 +1,45 @@ +/* + * Author: BaerMitUmlaut + * Triggers the pain effect (single flash). + * + * Arguments: + * 0: Enable + * 1: Intensity + * + * Return Value: + * None + */ +#include "script_component.hpp" +params ["_enable", "_intensity"]; + +if (!_enable || {_intensity == 0}) exitWith { + GVAR(ppPain) ppEffectEnable false; +}; +GVAR(ppPain) ppEffectEnable true; + +// Trigger effect every 2s +private _showNextTick = missionNamespace getVariable [QGVAR(showPainNextTick), true]; +GVAR(showPainNextTick) = !_showNextTick; +if (_showNextTick) exitWith {}; + +private _initialAdjust = []; +private _delayedAdjust = []; + +if (GVAR(painEffectType) == 0) then { + _intensity = linearConversion [0, 1, _intensity, 0, 0.6, true]; + _initialAdjust = [1, 1, 0, [1, 1, 1, _intensity], [1, 1, 1, 1], [0.33, 0.33, 0.33, 0], [0.59, 0.64, 0, 0, 0, 0, 4]]; + _delayedAdjust = [1, 1, 0, [1, 1, 1, 0], [1, 1, 1, 1], [0.33, 0.33, 0.33, 0], [0.59, 0.64, 0, 0, 0, 0, 4]]; +} else { + _intensity = linearConversion [0, 1, _intensity, 0, 0.008, true]; + _initialAdjust = [_intensity, _intensity, 0.3, 0.39]; + _delayedAdjust = [ 0, 0, 0.3, 0.39]; +}; + +GVAR(ppPain) ppEffectAdjust _initialAdjust; +GVAR(ppPain) ppEffectCommit FX_PAIN_FADE_IN; +[{ + params ["_adjust", "_painEffectType"]; + if (GVAR(painEffectType) != _painEffectType) exitWith {TRACE_1("Effect type changed",_this);}; + GVAR(ppPain) ppEffectAdjust _adjust; + GVAR(ppPain) ppEffectCommit FX_PAIN_FADE_OUT; +}, [_delayedAdjust, GVAR(painEffectType)], FX_PAIN_FADE_IN] call CBA_fnc_waitAndExecute; diff --git a/addons/medical_ui/functions/fnc_effectUnconscious.sqf b/addons/medical_ui/functions/fnc_effectUnconscious.sqf new file mode 100644 index 0000000000..e2159ba0f1 --- /dev/null +++ b/addons/medical_ui/functions/fnc_effectUnconscious.sqf @@ -0,0 +1,108 @@ +/* + * Author: BaerMitUmlaut + * Handles the unconscious effect. + * + * Arguments: + * 0: Enable + * 1: Mode (0: instant, 1: animation, 2: fx handler) + * + * Return Value: + * None + */ +#include "script_component.hpp" +params ["_enable", "_mode"]; + +switch (_mode) do { + // Instant (for Zeus or death) + case 0: { + GVAR(ppUnconsciousBlur) ppEffectEnable _enable; + GVAR(ppUnconsciousBlackout) ppEffectEnable _enable; + }; + // Animated (triggered on unconscious event) + case 1: { + if (_enable) then { + ACE_player setVariable [QGVAR(effectUnconsciousTimeout), CBA_missionTime + FX_UNCON_FADE_IN]; + GVAR(ppUnconsciousBlur) ppEffectEnable true; + GVAR(ppUnconsciousBlackout) ppEffectEnable true; + + GVAR(ppUnconsciousBlur) ppEffectAdjust [0]; + GVAR(ppUnconsciousBlackout) ppEffectAdjust [1, 1, 0, [0, 0, 0, 0], [0, 0, 0, 1], [0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1]]; + GVAR(ppUnconsciousBlur) ppEffectCommit 0; + GVAR(ppUnconsciousBlackout) ppEffectCommit 0; + + GVAR(ppUnconsciousBlur) ppEffectAdjust [5]; + GVAR(ppUnconsciousBlackout) ppEffectAdjust [1, 1, 0, [0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1]]; + GVAR(ppUnconsciousBlur) ppEffectCommit FX_UNCON_FADE_IN; + GVAR(ppUnconsciousBlackout) ppEffectCommit FX_UNCON_FADE_IN; + + // Handle next fade in + GVAR(nextFadeIn) = CBA_missionTime + 15 + random 5; + } else { + ACE_player setVariable [QGVAR(effectUnconsciousTimeout), CBA_missionTime + FX_UNCON_FADE_OUT]; + GVAR(ppUnconsciousBlur) ppEffectEnable true; + GVAR(ppUnconsciousBlackout) ppEffectEnable true; + + // Step 1: Widen eye "hole" + GVAR(ppUnconsciousBlur) ppEffectAdjust [5]; + GVAR(ppUnconsciousBlackout) ppEffectAdjust [1, 1, 0, [0, 0, 0, 0.9], [0, 0, 0, 1], [0, 0, 0, 0], [0.51, 0.17, 0, 0, 0, 0, 1]]; + GVAR(ppUnconsciousBlur) ppEffectCommit (FX_UNCON_FADE_OUT * 1/3); + GVAR(ppUnconsciousBlackout) ppEffectCommit (FX_UNCON_FADE_OUT * 1/3); + + // Step 2: Open it + [{ + if (!isNull curatorCamera || {!alive ACE_player}) exitWith {}; + + GVAR(ppUnconsciousBlur) ppEffectAdjust [0]; + GVAR(ppUnconsciousBlackout) ppEffectAdjust [1, 1, 0, [0, 0, 0, 0.8], [0, 0, 0, 1], [0, 0, 0, 0], [0.7, 0.78, 0, 0, 0, 0, 1]]; + GVAR(ppUnconsciousBlur) ppEffectCommit (FX_UNCON_FADE_OUT * 2/3); + GVAR(ppUnconsciousBlackout) ppEffectCommit (FX_UNCON_FADE_OUT * 1/3); + }, [], FX_UNCON_FADE_OUT * 1/3] call CBA_fnc_waitAndExecute; + + // Step 3: Fade away vignette + [{ + if (!isNull curatorCamera || {!alive ACE_player}) exitWith {}; + + GVAR(ppUnconsciousBlackout) ppEffectAdjust [1, 1, 0, [0, 0, 0, 0], [0, 0, 0, 1], [0, 0, 0, 0], [0.7, 0.78, 0, 0, 0, 0, 1]]; + GVAR(ppUnconsciousBlackout) ppEffectCommit (FX_UNCON_FADE_OUT * 1/3); + }, [], FX_UNCON_FADE_OUT * 2/3] call CBA_fnc_waitAndExecute; + }; + }; + // Raised by effectsHandler (blocked if animation in progress) + case 2: { + private _animatedTimeOut = ACE_player getVariable [QGVAR(effectUnconsciousTimeout), 0]; + if (_animatedTimeOut > CBA_missionTime) exitWith {}; + + if (_enable) then { + if (GVAR(nextFadeIn) < CBA_missionTime) then { + GVAR(ppUnconsciousBlur) ppEffectAdjust [5]; + GVAR(ppUnconsciousBlur) ppEffectCommit 0; + + GVAR(ppUnconsciousBlackout) ppEffectAdjust [1, 1, 0, [0, 0, 0, 0.9], [0, 0, 0, 1], [0, 0, 0, 0], [0.51, 0.17, 0, 0, 0, 0, 1]]; + GVAR(ppUnconsciousBlackout) ppEffectCommit (FX_UNCON_FADE_OUT * 2/3); + + [{ + if (!isNull curatorCamera || {!alive ACE_player}) exitWith {}; + + GVAR(ppUnconsciousBlackout) ppEffectAdjust [1, 1, 0, [0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1]]; + GVAR(ppUnconsciousBlackout) ppEffectCommit (FX_UNCON_FADE_OUT * 1/3); + }, [], FX_UNCON_FADE_OUT * 2/3] call CBA_fnc_waitAndExecute; + + ACE_player setVariable [QGVAR(effectUnconsciousTimeout), CBA_missionTime + FX_UNCON_FADE_OUT]; + GVAR(nextFadeIn) = CBA_missionTime + FX_UNCON_FADE_OUT + 15 + random 5; + } else { + GVAR(ppUnconsciousBlur) ppEffectAdjust [5]; + GVAR(ppUnconsciousBlackout) ppEffectAdjust [1, 1, 0, [0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1]]; + GVAR(ppUnconsciousBlur) ppEffectCommit 0; + GVAR(ppUnconsciousBlackout) ppEffectCommit 0; + }; + } else { + GVAR(ppUnconsciousBlur) ppEffectAdjust [0]; + GVAR(ppUnconsciousBlackout) ppEffectAdjust [1, 1, 0, [0, 0, 0, 0], [0, 0, 0, 1], [0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1]]; + GVAR(ppUnconsciousBlur) ppEffectCommit 0; + GVAR(ppUnconsciousBlackout) ppEffectCommit 0; + }; + + GVAR(ppUnconsciousBlur) ppEffectEnable _enable; + GVAR(ppUnconsciousBlackout) ppEffectEnable _enable; + }; +}; diff --git a/addons/medical_ui/functions/fnc_handleEffects.sqf b/addons/medical_ui/functions/fnc_handleEffects.sqf new file mode 100644 index 0000000000..8a02bc26b2 --- /dev/null +++ b/addons/medical_ui/functions/fnc_handleEffects.sqf @@ -0,0 +1,48 @@ +/* + * Author: BaerMitUmlaut + * Handles any visual effects of medical. + * Note: Heart beat sounds run in a different PFH - see fnc_effectHeartBeat. + * + * Arguments: + * None + * + * Return Value: + * None + */ +#include "script_component.hpp" + +if (EGVAR(common,OldIsCamera) || {!alive ACE_player}) exitWith { + [false, 0] call FUNC(effectUnconscious); + [false] call FUNC(effectPain); + [false] call FUNC(effectBloodVolume); + [false] call FUNC(effectBleeding); +}; + +BEGIN_COUNTER(handleEffects); + +// - Current state info ------------------------------------------------------- +private _bleedingStrength = [ACE_player] call EFUNC(medical,getBloodloss); +private _bloodVolume = ACE_player getVariable [QEGVAR(medical,bloodVolume), DEFAULT_BLOOD_VOLUME]; +private _unconscious = ACE_player getVariable [QEGVAR(medical,isUnconscious), false]; +private _heartRate = ACE_player getVariable [QEGVAR(medical,heartRate), DEFAULT_HEART_RATE]; +private _pain = [ACE_player] call EFUNC(medical,getPainLevel); + +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); + +if (!_unconscious) then { + [true, _pain] call FUNC(effectPain); +}; + +[true, _bleedingStrength] call FUNC(effectBleeding); + +END_COUNTER(handleEffects); diff --git a/addons/medical_ui/functions/fnc_initEffects.sqf b/addons/medical_ui/functions/fnc_initEffects.sqf new file mode 100644 index 0000000000..fb7b82b17a --- /dev/null +++ b/addons/medical_ui/functions/fnc_initEffects.sqf @@ -0,0 +1,82 @@ +/* + * Author: BaerMitUmlaut + * Initializes visual effects of medical. + * + * Arguments: + * None + * + * Return Value: + * None + */ +#include "script_component.hpp" + +params [["_justPain", false]]; + +TRACE_1("initEffects",_justPain); + +private _fnc_createEffect = { + params ["_type", "_layer", "_default"]; + + private _effect = ppEffectCreate [_type, _layer]; + _effect ppEffectForceInNVG true; + _effect ppEffectAdjust _default; + _effect ppEffectCommit 0; + + _effect +}; + +// - Pain --------------------------------------------------------------------- +if (!isNil QGVAR(ppPain)) then { + TRACE_1("delete pain",GVAR(ppPain)); + ppEffectDestroy GVAR(ppPain) +}; +if (GVAR(painEffectType) == 0) then { + GVAR(ppPain) = [ + "ColorCorrections", + 13502, + [1, 1, 0, [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]] + ] call _fnc_createEffect; +} else { + GVAR(ppPain) = [ + "RadialBlur", // "Will not do anything if RADIAL BLUR is disabled in Video Options." + 13502, + [0, 0, 0.3, 0.39] + ] call _fnc_createEffect; +}; +TRACE_1("created pain",GVAR(ppPain)); + +if (_justPain) exitWith {}; + +// - Unconscious -------------------------------------------------------------- +GVAR(ppUnconsciousBlur) = [ + "DynamicBlur", + 813, // 135xx does not work + [0] +] call _fnc_createEffect; + +GVAR(ppUnconsciousBlackout) = [ + "ColorCorrections", + 13500, + [1, 1, 0, [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]] +] call _fnc_createEffect; + + +// - Blood volume ------------------------------------------------------------- +GVAR(ppBloodVolume) = [ + "ColorCorrections", + 13503, + [1, 1, 0, [0, 0, 0, 0], [1, 1, 1, 1], [0.2, 0.2, 0.2, 0]] +] call _fnc_createEffect; + +// - Incapacitation ----------------------------------------------------------- +GVAR(ppIncapacitationGlare) = [ + "ColorCorrections", + 13504, + [1, 1, 0, [0, 0, 0, 0], [1, 1, 1, 1], [0, 0, 0, 0]] +] call _fnc_createEffect; + +GVAR(ppIncapacitationBlur) = [ + "DynamicBlur", + 814, // 135xx does not work + [0] +] call _fnc_createEffect; diff --git a/addons/medical_ui/script_component.hpp b/addons/medical_ui/script_component.hpp index 7f15f0b8ab..01618de018 100644 --- a/addons/medical_ui/script_component.hpp +++ b/addons/medical_ui/script_component.hpp @@ -3,8 +3,7 @@ #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL -// #define DISABLE_COMPILE_CACHE -// #define CBA_DEBUG_SYNCHRONOUS +#define DISABLE_COMPILE_CACHE // #define ENABLE_PERFORMANCE_COUNTERS #ifdef DEBUG_ENABLED_MEDICAL_UI @@ -17,3 +16,12 @@ #include "\z\ace\addons\main\script_macros.hpp" #include "\z\ace\addons\medical\script_macros_medical.hpp" + +#define FX_PAIN_FADE_IN 0.3 +#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"]) diff --git a/addons/medical/sounds/heart_beats/fast_1.wav b/addons/medical_ui/sounds/fast_1.wav similarity index 100% rename from addons/medical/sounds/heart_beats/fast_1.wav rename to addons/medical_ui/sounds/fast_1.wav diff --git a/addons/medical/sounds/heart_beats/fast_2.wav b/addons/medical_ui/sounds/fast_2.wav similarity index 100% rename from addons/medical/sounds/heart_beats/fast_2.wav rename to addons/medical_ui/sounds/fast_2.wav diff --git a/addons/medical/sounds/heart_beats/fast_3.wav b/addons/medical_ui/sounds/fast_3.wav similarity index 100% rename from addons/medical/sounds/heart_beats/fast_3.wav rename to addons/medical_ui/sounds/fast_3.wav diff --git a/addons/medical/sounds/heart_beats/norm_1.wav b/addons/medical_ui/sounds/norm_1.wav similarity index 100% rename from addons/medical/sounds/heart_beats/norm_1.wav rename to addons/medical_ui/sounds/norm_1.wav diff --git a/addons/medical/sounds/heart_beats/norm_2.wav b/addons/medical_ui/sounds/norm_2.wav similarity index 100% rename from addons/medical/sounds/heart_beats/norm_2.wav rename to addons/medical_ui/sounds/norm_2.wav diff --git a/addons/medical/sounds/heart_beats/slow_1.wav b/addons/medical_ui/sounds/slow_1.wav similarity index 100% rename from addons/medical/sounds/heart_beats/slow_1.wav rename to addons/medical_ui/sounds/slow_1.wav diff --git a/addons/medical/sounds/heart_beats/slow_2.wav b/addons/medical_ui/sounds/slow_2.wav similarity index 100% rename from addons/medical/sounds/heart_beats/slow_2.wav rename to addons/medical_ui/sounds/slow_2.wav diff --git a/addons/medical_ui/stringtable.xml b/addons/medical_ui/stringtable.xml new file mode 100644 index 0000000000..a0a891d0b2 --- /dev/null +++ b/addons/medical_ui/stringtable.xml @@ -0,0 +1,25 @@ + + + + + Pain Effect Type + Schmerzeffekt-Typ + Rodzaj efektu bólu + Визуальный эффект боли + Pain Effect Type + Tipo de efecto de dolor + Type d'effet de douleur + Fájdalom-effekt típusa + Tipo do efeito de dor + Typ bolesti - efekt + 痛みの種類 + 고통 효과 종류 + + + White flashing + + + Pulsing blur + + +