Code cleanup

This commit is contained in:
johnb432 2024-07-20 11:23:31 +02:00
parent 397826df75
commit 7f7fbf5efa
3 changed files with 27 additions and 26 deletions

View File

@ -5,7 +5,7 @@ class RscTitles {
class GVAR(checkPulse) {
idd = -1;
enableSimulation = 1;
onLoad = QUOTE(with uiNamespace do {GVAR(checkPulseDisplay) = _this # 0});
onLoad = QUOTE(uiNamespace setVariable [ARR_2(QQGVAR(checkPulseDisplay),_this select 0)]);
duration = 60;
class ControlsBackground {
class TheVignette: RscPicture {
@ -15,13 +15,14 @@ class RscTitles {
w = "safezoneW";
h = "safezoneH";
text = QPATHTOF(ui\checkPulse_ca.paa);
};};
};
};
class Controls {};
class Objects {
class TheWatch: RscWatch {
idc = 5001;
model = "\a3\Missions_F_Oldman\Systems\UI\Objects\WatchDummy.p3d";
position[] = {0,0,0.15};
position[] = {0, 0, 0.15};
inBack = 0;
scale = 2;
enableZoom = 0;

View File

@ -1,22 +1,23 @@
#include "..\script_component.hpp"
/*
* Author: Pabst Mirror
* ok
* Author: PabstMirror
* Handles the progress of pulse checking.
*
* Arguments:
* 0,0: Medic <OBJECT>
* 0,1: Patient <OBJECT>
* 0: Arguments <ARRAY>
* - 0: Medic (not used) <OBJECT>
* - 1: Patient <OBJECT>
*
* Return Value:
* None
* Continue pulse checking <BOOL>
*
* Example:
* [[player, cursorObject]] call ace_medical_treatment_fnc_checkPulse
* [[player, cursorObject]] call ace_medical_treatment_fnc_checkPulseProgress
*
* Public: No
*/
(_this # 0) params ["", "_patient"];
(_this select 0) params ["", "_patient"];
private _display = uiNamespace getVariable [QGVAR(checkPulseDisplay), displayNull];
@ -25,23 +26,22 @@ if (isNull _display) then {
QGVAR(checkPulse) cutRsc [QGVAR(checkPulse), "PLAIN"];
_display setVariable [QGVAR(lastPulse), CBA_missionTime - 0.5];
} else {
private _pulse = GET_HEART_RATE(_patient);
_lastPulse = _display getVariable [QGVAR(lastPulse), -1];
private _pulse = GET_HEART_RATE(_patient);
_lastPulse = _display getVariable [QGVAR(lastPulse), -1];
private _nextPulse = _lastPulse + (if (_pulse == 0) then {1e99} else { 60 / _pulse });
if (time > _nextPulse) then { _display setVariable [QGVAR(lastPulse), _nextPulse]; };
private _fade = (linearConversion [-.1, 0, CBA_missionTime - _nextPulse, 0, 0.85, true] max linearConversion [0.35, 0, CBA_missionTime - _lastPulse, 0, 0.75, true]) ^ 2;
private _nextPulse = _lastPulse + (if (_pulse == 0) then {1e99} else { 60 / _pulse });
if (CBA_missionTime > _nextPulse) then { _display setVariable [QGVAR(lastPulse), _nextPulse]; };
private _fade = (linearConversion [-0.1, 0, CBA_missionTime - _nextPulse, 0, 0.85, true] max linearConversion [0.35, 0, CBA_missionTime - _lastPulse, 0, 0.75, true]) ^ 2;
private _ctrlVignette = _display displayCtrl 5000;
_ctrlVignette ctrlSetTextColor [0,0,0,_fade];
private _ctrlVignette = _display displayCtrl 5000;
_ctrlVignette ctrlSetTextColor [0, 0, 0, _fade];
private _ctrlWatch = _display displayCtrl 5001;
_ctrlWatch ctrlSetPosition [safeZoneX + (safeZoneW * 0.5), (ctrlPosition _ctrlWatch) # 1, safeZoneY + (safeZoneH * 0.5)];
_ctrlWatch ctrlCommit 0;
_ctrlWatch ctrlAnimateModel ["WatchSecond", linearConversion [0, 60, floor ((daytime * 3600) % 60), 0, 1]];
_ctrlWatch ctrlAnimateModel ["WatchHour", (daytime / 12) % 1];
_ctrlWatch ctrlAnimateModel ["WatchMinute", daytime % 1];
private _ctrlWatch = _display displayCtrl 5001;
_ctrlWatch ctrlSetPosition [safeZoneX + (safeZoneW * 0.5), (ctrlPosition _ctrlWatch) select 1, safeZoneY + (safeZoneH * 0.5)];
_ctrlWatch ctrlCommit 0;
_ctrlWatch ctrlAnimateModel ["WatchSecond", linearConversion [0, 60, floor ((daytime * 3600) % 60), 0, 1]];
_ctrlWatch ctrlAnimateModel ["WatchHour", (dayTime / 12) % 1];
_ctrlWatch ctrlAnimateModel ["WatchMinute", dayTime % 1];
};
true

View File

@ -5,8 +5,8 @@
*
* Arguments:
* 0: Arguments <ARRAY>
* 0: Medic <OBJECT>
* 1: Patient <OBJECT>
* - 0: Medic <OBJECT>
* - 1: Patient <OBJECT>
*
* Return Value:
* Continue CPR <BOOL>