From a65f1d19fa5dcc89b618e31a645cfeb1d6bd0ccd Mon Sep 17 00:00:00 2001 From: BaerMitUmlaut Date: Mon, 7 Nov 2016 22:19:55 +0100 Subject: [PATCH] Added state machine debug functionality --- addons/medical/XEH_postInit.sqf | 26 ++++++++++++++++++++++++++ addons/medical/script_component.hpp | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/addons/medical/XEH_postInit.sqf b/addons/medical/XEH_postInit.sqf index fbb5dc78a3..434086bf4b 100644 --- a/addons/medical/XEH_postInit.sqf +++ b/addons/medical/XEH_postInit.sqf @@ -35,3 +35,29 @@ if (!hasInterface) exitWith {}; linearConversion [0, 1, _pain, 1, 5, true]; }] call EFUNC(common,arithmeticSetSource); + +#ifdef DEBUG_MODE_FULL + if (hasInterface) then { + private _ctrl = findDisplay 46 ctrlCreate ["RscText", -1]; + _ctrl ctrlSetPosition [ + safeZoneX, + safeZoneY, + safeZoneW, + 40 * pixelH + ]; + _ctrl ctrlSetFontHeight (40 * pixelH); + _ctrl ctrlSetTextColor [0.6, 0, 0, 1]; + _ctrl ctrlCommit 0; + uiNamespace setVariable [QGVAR(debugControl), _ctrl]; + + [{ + private _playerState = [ACE_player, GVAR(STATE_MACHINE)] call CBA_statemachine_fnc_getCurrentState; + (uiNamespace getVariable [QGVAR(debugControl), controlNull]) ctrlSetText format ["Player state: %1", _playerState]; + + if (!isNull cursorTarget && {cursorTarget isKindOf "CAManBase"}) then { + private _targetState = [cursorTarget, GVAR(STATE_MACHINE)] call CBA_statemachine_fnc_getCurrentState; + drawIcon3D ["", [0.6, 0, 0, 1], cursorTarget modelToWorld (cursorTarget selectionPosition "pelvis"), 0, 0, 0, format ["State: %1", _targetState], 2, 40 * pixelH, "RobotoCondensed"]; + }; + }] call CBA_fnc_addPerFrameHandler; + }; +#endif diff --git a/addons/medical/script_component.hpp b/addons/medical/script_component.hpp index c93f584b0c..3802885221 100644 --- a/addons/medical/script_component.hpp +++ b/addons/medical/script_component.hpp @@ -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