Switch heartbeat to waitAndExec, allow switching pain settings

This commit is contained in:
PabstMirror 2017-02-18 22:11:40 -06:00
parent 34f87f89bb
commit 97ec22bd9a
17 changed files with 85 additions and 108 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -2676,48 +2676,6 @@
<Japanese>包帯は体力を完全に回復する</Japanese>
<Korean>붕대를 감은후 체력을 회복함</Korean>
</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">
<English>Style of menu (Medical)</English>
<Polish>Styl menu medycznego</Polish>

View File

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

View File

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

View File

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

View File

@ -2,9 +2,10 @@
if (!hasInterface) exitWith {};
[] call FUNC(initEffects);
[FUNC(handleEffects), 1, []] call CBA_fnc_addPerFrameHandler;
[FUNC(effectHeartBeat), 0, []] call CBA_fnc_addPerFrameHandler;
GVAR(heartBeatEffectRunning) = false;
[false] call FUNC(initEffects);
[LINKFUNC(handleEffects), 1, []] call CBA_fnc_addPerFrameHandler;
["ace_unconscious", {
params ["_unit", "_unconscious"];

View File

@ -7,7 +7,7 @@ ADDON = false;
[
QGVAR(painEffectType),
"LIST",
["Pain effect type", "Selects the used pain effect type"], //@todo
[localize LSTRING(painEffectType), "Selects the used pain effect type"], //@todo
"ACE Medical", // @todo
[
[0, 1],
@ -15,7 +15,11 @@ ADDON = false;
0
],
false,
{} // TODO!
{
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;

View File

@ -12,7 +12,7 @@
#include "script_component.hpp"
params ["_enable", "_intensity"];
if (!_enable) exitWith {
if ((!_enable) || {_intensity == 0}) exitWith {
GVAR(ppBloodVolume) ppEffectEnable false;
};
GVAR(ppBloodVolume) ppEffectEnable true;

View File

@ -11,18 +11,22 @@
#include "script_component.hpp"
private _heartRate = ACE_player getVariable [QEGVAR(medical,heartRate), DEFAULT_HEART_RATE];
if (_heartRate == 0) exitWith {};
if (_heartRate == 0) exitWith {GVAR(heartBeatEffectRunning) = false;};
private _waitTime = 60 / _heartRate;
if (CBA_missionTime - GVAR(lastHeartBeatSound) > _waitTime) then {
GVAR(lastHeartBeatSound) = CBA_missionTime;
switch (true) do {
case (_heartRate > 160): {
playSound SND_HEARBEAT_FAST;
[DFUNC(effectHeartBeat), [], _waitTime] call CBA_fnc_waitAndExecute;
};
case (_heartRate < 60): {
playSound SND_HEARBEAT_SLOW;
[DFUNC(effectHeartBeat), [], _waitTime] call CBA_fnc_waitAndExecute;
switch (true) do {
case (_heartRate > 160): {
playSound SND_HEARBEAT_FAST;
};
case (_heartRate < 60): {
playSound SND_HEARBEAT_SLOW;
};
};
default {
TRACE_1("Ending heart beat effect",_heartRate);
GVAR(heartBeatEffectRunning) = false;
};
};

View File

@ -12,7 +12,7 @@
#include "script_component.hpp"
params ["_enable", "_intensity"];
if (!_enable) exitWith {
if (!_enable || {_intensity == 0}) exitWith {
GVAR(ppPain) ppEffectEnable false;
};
GVAR(ppPain) ppEffectEnable true;
@ -38,6 +38,8 @@ if (GVAR(painEffectType) == 0) then {
GVAR(ppPain) ppEffectAdjust _initialAdjust;
GVAR(ppPain) ppEffectCommit FX_PAIN_FADE_IN;
[{
GVAR(ppPain) ppEffectAdjust _this;
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, FX_PAIN_FADE_IN] call CBA_fnc_waitAndExecute;
}, [_delayedAdjust, GVAR(painEffectType)], FX_PAIN_FADE_IN] call CBA_fnc_waitAndExecute;

View File

@ -11,8 +11,7 @@
*/
#include "script_component.hpp"
private _disableAll = (!isNull curatorCamera) || {!alive ACE_player};
if (_disableAll) exitWith {
if (EGVAR(common,OldIsCamera) || {!alive ACE_player}) exitWith {
[false, 0] call FUNC(effectUnconscious);
[false] call FUNC(effectPain);
[false] call FUNC(effectBloodVolume);
@ -21,12 +20,18 @@ if (_disableAll) exitWith {
// - Current state info -------------------------------------------------------
private _bleedingStrength = [ACE_player] call EFUNC(medical,getBloodloss);
private _bleeding = _bleedingStrength > 0;
// private _bleeding = _bleedingStrength > 0;
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);
[

View File

@ -10,6 +10,10 @@
*/
#include "script_component.hpp"
params [["_justPain", false]];
TRACE_1("initEffects",_justPain);
private _fnc_createEffect = {
params ["_type", "_layer", "_default"];
@ -21,6 +25,28 @@ private _fnc_createEffect = {
_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",
@ -34,20 +60,6 @@ GVAR(ppUnconsciousBlackout) = [
[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) = [

View File

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

View File

@ -0,0 +1,19 @@
<?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>
</Package>
</Project>