Skip to content

Commit

Permalink
Advanced Fatigue - Increase per unit performance factor editor slider (
Browse files Browse the repository at this point in the history
…#10327)

Increase per unit performance factor editor slider
  • Loading branch information
johnb432 authored Sep 22, 2024
1 parent c0b1a45 commit 155c8aa
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 4 deletions.
32 changes: 29 additions & 3 deletions addons/advanced_fatigue/CfgEden.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,35 @@ class Cfg3DEN {
class Attributes {
class Slider;
class GVAR(slider): Slider {
attributeLoad = "params [""_ctrlGroup""]; private _slider = _ctrlGroup controlsGroupCtrl 100; private _edit = _ctrlGroup controlsGroupCtrl 101; _slider sliderSetPosition _value; _edit ctrlSetText ([_value, 1, 1] call CBA_fnc_formatNumber); ";
attributeSave = "params [""_ctrlGroup""]; sliderPosition (_ctrlGroup controlsGroupCtrl 100); ";
onLoad = "params [""_ctrlGroup""]; private _slider = _ctrlGroup controlsGroupCtrl 100; private _edit = _ctrlGroup controlsGroupCtrl 101; _slider sliderSetRange [0, 2]; _slider ctrlAddEventHandler [""SliderPosChanged"", { params [""_slider""]; private _edit = (ctrlParentControlsGroup _slider) controlsGroupCtrl 101; private _value = sliderPosition _slider; _edit ctrlSetText ([_value, 1, 1] call CBA_fnc_formatNumber); }]; _edit ctrlAddEventHandler [""KillFocus"", { params [""_edit""]; private _slider = (ctrlParentControlsGroup _edit) controlsGroupCtrl 100; private _value = ((parseNumber ctrlText _edit) min 2) max 0; _slider sliderSetPosition _value; _edit ctrlSetText str _value; }];";
#pragma hemtt suppress pw3_padded_arg
attributeLoad = QUOTE(
params ['_ctrlGroup']; \
private _slider = _ctrlGroup controlsGroupCtrl 100; \
private _edit = _ctrlGroup controlsGroupCtrl 101; \
_slider sliderSetPosition _value; \
_edit ctrlSetText ([ARR_3(_value,1,1)] call CBA_fnc_formatNumber); \
);
attributeSave = QUOTE(params ['_ctrlGroup']; sliderPosition (_ctrlGroup controlsGroupCtrl 100));
#pragma hemtt suppress pw3_padded_arg
onLoad = QUOTE(
params ['_ctrlGroup']; \
private _slider = _ctrlGroup controlsGroupCtrl 100; \
private _edit = _ctrlGroup controlsGroupCtrl 101; \
_slider sliderSetRange [ARR_2(0,MAX_PERFORMANCE_FACTOR)]; \
_slider ctrlAddEventHandler [ARR_2('SliderPosChanged',{ \
params ['_slider']; \
private _edit = (ctrlParentControlsGroup _slider) controlsGroupCtrl 101; \
private _value = sliderPosition _slider; \
_edit ctrlSetText ([ARR_3(_value,1,1)] call CBA_fnc_formatNumber); \
})]; \
_edit ctrlAddEventHandler [ARR_2('KillFocus',{ \
params ['_edit']; \
private _slider = (ctrlParentControlsGroup _edit) controlsGroupCtrl 100; \
private _value = ((parseNumber ctrlText _edit) min MAX_PERFORMANCE_FACTOR) max 0; \
_slider sliderSetPosition _value; \
_edit ctrlSetText str _value; \
})]; \
);
};
};
class Object {
Expand Down
2 changes: 1 addition & 1 deletion addons/advanced_fatigue/initSettings.inc.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"SLIDER",
[LSTRING(PerformanceFactor), LSTRING(PerformanceFactor_Description)],
LSTRING(DisplayName),
[0, 10, 1, 2],
[0, MAX_PERFORMANCE_FACTOR, 1, 2],
1,
{
// Recalculate values if the setting is changed mid-mission
Expand Down
2 changes: 2 additions & 0 deletions addons/advanced_fatigue/script_component.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@
#define AE1_MAXRESERVE 4000000 // mmol
#define AE2_MAXRESERVE 84000 // mmol
#define AN_MAXRESERVE 2300 // mmol

#define MAX_PERFORMANCE_FACTOR 10

0 comments on commit 155c8aa

Please sign in to comment.