Merge pull request #4754 from acemod/medical-rewrite-effects

Medical Rewrite - Post Process Effects
This commit is contained in:
PabstMirror 2017-03-25 10:50:48 -05:00 committed by GitHub
commit d47ea1d25a
36 changed files with 540 additions and 86 deletions

View File

@ -48,7 +48,7 @@ if (!hasInterface) exitWith {};
linearConversion [0, 1, (_this getVariable [QEGVAR(medical,pain), 0]), 1, 1.1, true]; linearConversion [0, 1, (_this getVariable [QEGVAR(medical,pain), 0]), 1, 1.1, true];
}] call FUNC(addDutyFactor); }] call FUNC(addDutyFactor);
[QEGVAR(medical,bloodVolume), { // 100->1.0, 90->1.1, 80->1.2 [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); }] call FUNC(addDutyFactor);
}; };
if (["ACE_Dragging"] call EFUNC(common,isModLoaded)) then { if (["ACE_Dragging"] call EFUNC(common,isModLoaded)) then {

View File

@ -221,14 +221,6 @@ class ACE_Settings {
typeName = "SCALAR"; typeName = "SCALAR";
value = 0.1; 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) { class GVAR(allowUnconsciousAnimationOnTreatment) {
category = CSTRING(Category_Medical); category = CSTRING(Category_Medical);
displayName = CSTRING(MedicalSettings_allowUnconsciousAnimationOnTreatment_DisplayName); displayName = CSTRING(MedicalSettings_allowUnconsciousAnimationOnTreatment_DisplayName);

View File

@ -403,22 +403,6 @@ class CfgVehicles {
typeName = "SCALAR"; typeName = "SCALAR";
defaultValue = 0.1; 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 { class allowUnconsciousAnimationOnTreatment {
displayName = CSTRING(MedicalSettings_allowUnconsciousAnimationOnTreatment_DisplayName); displayName = CSTRING(MedicalSettings_allowUnconsciousAnimationOnTreatment_DisplayName);
description = CSTRING(MedicalSettings_allowUnconsciousAnimationOnTreatment_Description); description = CSTRING(MedicalSettings_allowUnconsciousAnimationOnTreatment_Description);

View File

@ -1,9 +1,5 @@
#include "script_component.hpp" #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; ["ace_interactMenuClosed", {[objNull, 0] call FUNC(displayPatientInformation); }] call CBA_fnc_addEventHandler;
//Handle Deleting Bodies and creating litter on Server: //Handle Deleting Bodies and creating litter on Server:

View File

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

View File

@ -48,7 +48,6 @@ if !(_activated) exitWith {};
[_logic, QGVAR(useLocation_PAK), "useLocation_PAK"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(useLocation_PAK), "useLocation_PAK"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(useLocation_SurgicalKit), "useLocation_SurgicalKit"] 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(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(allowUnconsciousAnimationOnTreatment), "allowUnconsciousAnimationOnTreatment"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(menuTypeStyle), "menuTypeStyle"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(menuTypeStyle), "menuTypeStyle"] call EFUNC(common,readSettingFromModule);

View File

@ -2,7 +2,7 @@
#define COMPONENT_BEAUTIFIED Medical Core #define COMPONENT_BEAUTIFIED Medical Core
#include "\z\ace\addons\main\script_mod.hpp" #include "\z\ace\addons\main\script_mod.hpp"
#define DEBUG_MODE_FULL // #define DEBUG_MODE_FULL
#define DISABLE_COMPILE_CACHE #define DISABLE_COMPILE_CACHE
// #define ENABLE_PERFORMANCE_COUNTERS // #define ENABLE_PERFORMANCE_COUNTERS

View File

@ -2676,48 +2676,6 @@
<Japanese>包帯は体力を完全に回復する</Japanese> <Japanese>包帯は体力を完全に回復する</Japanese>
<Korean>붕대를 감은후 체력을 회복함</Korean> <Korean>붕대를 감은후 체력을 회복함</Korean>
</Key> </Key>
<Key ID="STR_ACE_Medical_painEffectType">
<English>Pain Effect Type</English>
<German>Schmerzeffekt-Typ</German>
<Polish>Rodzaj efektu bólu</Polish>
<Russian>Визуальный эффект боли</Russian>
<Italian>Pain Effect Type</Italian>
<Spanish>Tipo de efecto de dolor</Spanish>
<French>Type d'effet de douleur</French>
<Hungarian>Fájdalom-effekt típusa</Hungarian>
<Portuguese>Tipo do efeito de dor</Portuguese>
<Czech>Typ bolesti - efekt</Czech>
<Japanese>痛みの種類</Japanese>
<Korean>고통 효과 종류</Korean>
</Key>
<Key ID="STR_ACE_Medical_painEffect_Flash">
<English>Colour Flashing</English>
<German>Farbblinken</German>
<Polish>Pulsujące kolory</Polish>
<Russian>Пульсирующий свет</Russian>
<Italian>Colore lampeggiante</Italian>
<Spanish>Parpadeo de color</Spanish>
<French>Flash de couleur</French>
<Hungarian>Színvillódzás</Hungarian>
<Portuguese>Flash de cor</Portuguese>
<Czech>Blikající barva</Czech>
<Japanese>色の点滅</Japanese>
<Korean>색 반짝임</Korean>
</Key>
<Key ID="STR_ACE_Medical_painEffect_Chroma">
<English>Chromatic Aberration</English>
<German>Chromatische Aberration</German>
<Polish>Aberracja chromatyczna</Polish>
<Russian>Хроматическая аберрация</Russian>
<Italian>Aberrazione cromatica</Italian>
<Spanish>Aberración cromática</Spanish>
<French>Aberration chromatique</French>
<Hungarian>Kromatikus aberráció</Hungarian>
<Czech>Chromatická aberace</Czech>
<Portuguese>Aberração Cromática</Portuguese>
<Japanese>色の収差</Japanese>
<Korean>색수차</Korean>
</Key>
<Key ID="STR_ACE_Medical_menuTypeDisplay"> <Key ID="STR_ACE_Medical_menuTypeDisplay">
<English>Style of menu (Medical)</English> <English>Style of menu (Medical)</English>
<Polish>Styl menu medycznego</Polish> <Polish>Styl menu medycznego</Polish>

View File

@ -4,7 +4,6 @@
#define DEBUG_MODE_FULL #define DEBUG_MODE_FULL
#define DISABLE_COMPILE_CACHE #define DISABLE_COMPILE_CACHE
#define CBA_DEBUG_SYNCHRONOUS
//#define ENABLE_PERFORMANCE_COUNTERS //#define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_MEDICAL_DAMAGE #ifdef DEBUG_ENABLED_MEDICAL_DAMAGE

View File

@ -22,7 +22,7 @@
#define TIME_OUT_MOAN 5 #define TIME_OUT_MOAN 5
params [["_unit", objNull, [objNull]], ["_type", "hit", [""]], ["_severity", 0, [0]]]; params [["_unit", objNull, [objNull]], ["_type", "hit", [""]], ["_severity", 0, [0]]];
TRACE_3("",_unit,_type,_severity); // TRACE_3("",_unit,_type,_severity);
if (!local _unit) exitWith { if (!local _unit) exitWith {
ERROR("Unit not local or null"); ERROR("Unit not local or null");

View File

@ -4,7 +4,6 @@
#define DEBUG_MODE_FULL #define DEBUG_MODE_FULL
#define DISABLE_COMPILE_CACHE #define DISABLE_COMPILE_CACHE
#define CBA_DEBUG_SYNCHRONOUS
//#define ENABLE_PERFORMANCE_COUNTERS //#define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_MEDICAL_ENGINE #ifdef DEBUG_ENABLED_MEDICAL_ENGINE

View File

@ -9,3 +9,9 @@ class Extended_PreInit_EventHandlers {
init = QUOTE(call COMPILE_FILE(XEH_preInit)); init = QUOTE(call COMPILE_FILE(XEH_preInit));
}; };
}; };
class Extended_PostInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_postInit));
};
};

View File

@ -1,37 +1,37 @@
class CfgSounds { class CfgSounds {
class ACE_heartbeat_fast_1 { class ACE_heartbeat_fast_1 {
name = "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[] = {}; titles[] = {};
}; };
class ACE_heartbeat_fast_2 { class ACE_heartbeat_fast_2 {
name = "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[] = {}; titles[] = {};
}; };
class ACE_heartbeat_fast_3 { class ACE_heartbeat_fast_3 {
name = "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[] = {}; titles[] = {};
}; };
class ACE_heartbeat_norm_1 { class ACE_heartbeat_norm_1 {
name = "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[] = {}; titles[] = {};
}; };
class ACE_heartbeat_norm_2 { class ACE_heartbeat_norm_2 {
name = "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[] = {}; titles[] = {};
}; };
class ACE_heartbeat_slow_1 { class ACE_heartbeat_slow_1 {
name = "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[] = {}; titles[] = {};
}; };
class ACE_heartbeat_slow_2 { class ACE_heartbeat_slow_2 {
name = "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[] = {}; titles[] = {};
}; };
}; };

View File

@ -0,0 +1,10 @@
TRACE_1("",QUOTE(ADDON));
PREP(effectBleeding);
PREP(effectBloodVolume);
PREP(effectHeartBeat);
PREP(effectIncapacitated);
PREP(effectPain);
PREP(effectUnconscious);
PREP(handleEffects);
PREP(initEffects);

View File

@ -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;

View File

@ -2,6 +2,28 @@
ADDON = false; ADDON = false;
PREP_RECOMPILE_START;
#include "XEH_PREP.hpp" #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; ADDON = true;

View File

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

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,75 @@
/*
* Author: BaerMitUmlaut
* Handles the bleeding effect.
*
* Arguments:
* 0: Enable effect <BOOL>
* 1: Current bloodloss (in l/s) <NUMBER>
*
* 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;
};

View File

@ -0,0 +1,20 @@
/*
* Author: BaerMitUmlaut
* Handles the blood volume effect.
*
* Arguments:
* 0: Enable <BOOL>
* 1: Intensity <NUMBER>
*
* 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;

View File

@ -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;
};
};

View File

@ -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;

View File

@ -0,0 +1,45 @@
/*
* Author: BaerMitUmlaut
* Triggers the pain effect (single flash).
*
* Arguments:
* 0: Enable <BOOL>
* 1: Intensity <NUMBER>
*
* 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;

View File

@ -0,0 +1,108 @@
/*
* Author: BaerMitUmlaut
* Handles the unconscious effect.
*
* Arguments:
* 0: Enable <BOOL>
* 1: Mode (0: instant, 1: animation, 2: fx handler) <NUMBER>
*
* 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;
};
};

View File

@ -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);

View File

@ -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;

View File

@ -3,8 +3,7 @@
#include "\z\ace\addons\main\script_mod.hpp" #include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL // #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS // #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_MEDICAL_UI #ifdef DEBUG_ENABLED_MEDICAL_UI
@ -17,3 +16,12 @@
#include "\z\ace\addons\main\script_macros.hpp" #include "\z\ace\addons\main\script_macros.hpp"
#include "\z\ace\addons\medical\script_macros_medical.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"])

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<Project name="ACE">
<Package name="Medical_ui">
<Key ID="STR_ACE_Medical_ui_painEffectType">
<English>Pain Effect Type</English>
<German>Schmerzeffekt-Typ</German>
<Polish>Rodzaj efektu bólu</Polish>
<Russian>Визуальный эффект боли</Russian>
<Italian>Pain Effect Type</Italian>
<Spanish>Tipo de efecto de dolor</Spanish>
<French>Type d'effet de douleur</French>
<Hungarian>Fájdalom-effekt típusa</Hungarian>
<Portuguese>Tipo do efeito de dor</Portuguese>
<Czech>Typ bolesti - efekt</Czech>
<Japanese>痛みの種類</Japanese>
<Korean>고통 효과 종류</Korean>
</Key>
<Key ID="STR_ACE_Medical_ui_painEffectType_whiteFlashing">
<English>White flashing</English>
</Key>
<Key ID="STR_ACE_Medical_ui_painEffectType_pulsingBlur">
<English>Pulsing blur</English>
</Key>
</Package>
</Project>