Added visual effects

This commit is contained in:
BaerMitUmlaut 2016-12-01 20:54:03 +01:00
parent ba810a22e6
commit 9eba2bd448
12 changed files with 266 additions and 2 deletions

View File

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

View File

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

View File

@ -0,0 +1,6 @@
PREP(effectBloodVolume);
PREP(effectIncapacitated);
PREP(effectPain);
PREP(effectUnconscious);
PREP(handleEffects);
PREP(initEffects);

View File

@ -0,0 +1,6 @@
#include "script_component.hpp"
if (!hasInterface) exitWith {};
[] call FUNC(initEffects);
[FUNC(handleEffects), 1, []] call CBA_fnc_addPerFrameHandler;

View File

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

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

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

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

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

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

View File

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