mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Added visual effects
This commit is contained in:
parent
ba810a22e6
commit
9eba2bd448
@ -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
|
||||
|
||||
|
@ -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));
|
||||
};
|
||||
};
|
||||
|
@ -0,0 +1,6 @@
|
||||
PREP(effectBloodVolume);
|
||||
PREP(effectIncapacitated);
|
||||
PREP(effectPain);
|
||||
PREP(effectUnconscious);
|
||||
PREP(handleEffects);
|
||||
PREP(initEffects);
|
6
addons/medical_ui/XEH_postInit.sqf
Normal file
6
addons/medical_ui/XEH_postInit.sqf
Normal file
@ -0,0 +1,6 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
[] call FUNC(initEffects);
|
||||
[FUNC(handleEffects), 1, []] call CBA_fnc_addPerFrameHandler;
|
@ -4,4 +4,18 @@ ADDON = false;
|
||||
|
||||
#include "XEH_PREP.hpp"
|
||||
|
||||
[
|
||||
QGVAR(painEffectType),
|
||||
"LIST",
|
||||
["Pain effect type", "Selects the used pain effect type"], //@todo
|
||||
"ACE Medical", // @todo
|
||||
[
|
||||
[0, 1],
|
||||
["White flashing", "Pulsing blur"],
|
||||
0
|
||||
],
|
||||
false,
|
||||
{} // TODO!
|
||||
] call CBA_Settings_fnc_init;
|
||||
|
||||
ADDON = true;
|
||||
|
21
addons/medical_ui/functions/fnc_effectBloodVolume.sqf
Normal file
21
addons/medical_ui/functions/fnc_effectBloodVolume.sqf
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* 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) 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;
|
24
addons/medical_ui/functions/fnc_effectIncapacitated.sqf
Normal file
24
addons/medical_ui/functions/fnc_effectIncapacitated.sqf
Normal 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;
|
38
addons/medical_ui/functions/fnc_effectPain.sqf
Normal file
38
addons/medical_ui/functions/fnc_effectPain.sqf
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* 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) exitWith {
|
||||
GVAR(ppPain) ppEffectEnable false;
|
||||
};
|
||||
GVAR(ppPain) ppEffectEnable true;
|
||||
|
||||
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 0.2;
|
||||
[{
|
||||
GVAR(ppPain) ppEffectAdjust _this;
|
||||
GVAR(ppPain) ppEffectCommit 0.5;
|
||||
}, _delayedAdjust, 0.2] call CBA_fnc_waitAndExecute;
|
48
addons/medical_ui/functions/fnc_effectUnconscious.sqf
Normal file
48
addons/medical_ui/functions/fnc_effectUnconscious.sqf
Normal file
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Author: BaerMitUmlaut
|
||||
* Handles the unconscious effect.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Enable <BOOL>
|
||||
* 1: Animated wake up <BOOL>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
params ["_enable", "_animated"];
|
||||
|
||||
if (!_enable && !_animated) exitWith {
|
||||
GVAR(ppUnconsciousBlur) ppEffectEnable false;
|
||||
GVAR(ppUnconsciousBlackout) ppEffectEnable false;
|
||||
};
|
||||
GVAR(ppUnconsciousBlur) ppEffectEnable true;
|
||||
GVAR(ppUnconsciousBlackout) ppEffectEnable true;
|
||||
|
||||
if (_enable) then {
|
||||
GVAR(ppUnconsciousBlur) ppEffectAdjust [5];
|
||||
GVAR(ppUnconsciousBlackout) ppEffectAdjust [1, 1, 0, [0, 0, 0, 1], [0, 0, 0, 0.5], [0, 0, 0, 0], [0.2, 0.12, 0, 0, 0, 0, 1]];
|
||||
GVAR(ppUnconsciousBlur) ppEffectCommit 0.2;
|
||||
GVAR(ppUnconsciousBlackout) ppEffectCommit 0.2;
|
||||
} else {
|
||||
// Animated wake up
|
||||
// Step 1: Widen eye "hole"
|
||||
GVAR(ppUnconsciousBlur) ppEffectAdjust [5];
|
||||
GVAR(ppUnconsciousBlackout) ppEffectAdjust [1, 1, 0, [0, 0, 0, 0.83], [0, 0, 0, 0.5], [0, 0, 0, 0], [0.51, 0.17, 0, 0, 0, 0, 1]];
|
||||
GVAR(ppUnconsciousBlur) ppEffectCommit 0.5;
|
||||
GVAR(ppUnconsciousBlackout) ppEffectCommit 0.5;
|
||||
|
||||
// Step 2: Open it
|
||||
[{
|
||||
GVAR(ppUnconsciousBlur) ppEffectAdjust [5];
|
||||
GVAR(ppUnconsciousBlackout) ppEffectAdjust [1, 1, 0, [0, 0, 0, 0.83], [0, 0, 0, 0.5], [0, 0, 0, 0], [0.7, 0.78, 0, 0, 0, 0, 1]];
|
||||
GVAR(ppUnconsciousBlur) ppEffectCommit 1;
|
||||
GVAR(ppUnconsciousBlackout) ppEffectCommit 2;
|
||||
}, [], 0.5] call CBA_fnc_waitAndExecute;
|
||||
|
||||
// Step 3: Fade away vignette
|
||||
[{
|
||||
GVAR(ppUnconsciousBlackout) ppEffectAdjust [1, 1, 0, [0, 0, 0, 0.83], [0, 0, 0, 0.0], [0, 0, 0, 0], [0.7, 0.78, 0, 0, 0, 0, 1]];
|
||||
GVAR(ppUnconsciousBlackout) ppEffectCommit 0.5;
|
||||
}, [], 1.5] call CBA_fnc_waitAndExecute;
|
||||
};
|
31
addons/medical_ui/functions/fnc_handleEffects.sqf
Normal file
31
addons/medical_ui/functions/fnc_handleEffects.sqf
Normal file
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Author: BaerMitUmlaut
|
||||
* Handles any audible and visual effects of medical.
|
||||
*
|
||||
* Arguments:
|
||||
* None
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private _disableAll = (!isNull curatorCamera) || {!alive ACE_player};
|
||||
if (_disableAll) exitWith {
|
||||
[false, false] call FUNC(effectUnconscious);
|
||||
[false] call FUNC(effectPain);
|
||||
[false] call FUNC(effectBloodVolume);
|
||||
};
|
||||
|
||||
// - Current state info -------------------------------------------------------
|
||||
private _bleedingStrength = [ACE_player] call EFUNC(medical,getBloodloss);
|
||||
private _bleeding = _bleedingStrength > 0;
|
||||
private _bloodVolume = ACE_player getVariable [QEGVAR(medical,bloodVolume), 1];
|
||||
private _unconscious = ACE_player getVariable [QEGVAR(medical,isUnconscious), false];
|
||||
private _heartRate = ACE_player getVariable [QEGVAR(medical,heartRate), 70];
|
||||
private _pain = ACE_player getVariable [QEGVAR(medical,pain), 0];
|
||||
|
||||
// - Visual effects -----------------------------------------------------------
|
||||
[_unconscious, _unconscious && true ] call FUNC(effectUnconscious);
|
||||
[true, _pain ] call FUNC(effectPain);
|
||||
[true, (6 - _bloodVolume) max 0] call FUNC(effectBloodVolume);
|
70
addons/medical_ui/functions/fnc_initEffects.sqf
Normal file
70
addons/medical_ui/functions/fnc_initEffects.sqf
Normal file
@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Author: BaerMitUmlaut
|
||||
* Initializes visual effects of medical.
|
||||
*
|
||||
* Arguments:
|
||||
* None
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
_fnc_createEffect = {
|
||||
params ["_type", "_layer", "_default"];
|
||||
|
||||
private _effect = ppEffectCreate [_type, _layer];
|
||||
_effect ppEffectForceInNVG true;
|
||||
_effect ppEffectAdjust _default;
|
||||
_effect ppEffectCommit 0;
|
||||
|
||||
_effect
|
||||
};
|
||||
|
||||
// - 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;
|
||||
|
||||
// - Pain ---------------------------------------------------------------------
|
||||
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",
|
||||
13502,
|
||||
[0, 0, 0.3, 0.39]
|
||||
] 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;
|
@ -3,7 +3,7 @@
|
||||
#include "\z\ace\addons\main\script_mod.hpp"
|
||||
|
||||
// #define DEBUG_MODE_FULL
|
||||
// #define DISABLE_COMPILE_CACHE
|
||||
#define DISABLE_COMPILE_CACHE
|
||||
// #define CBA_DEBUG_SYNCHRONOUS
|
||||
// #define ENABLE_PERFORMANCE_COUNTERS
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user