Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Advanced Fatigue - Increase per unit performance factor editor slider #10327

Merged
merged 1 commit into from
Sep 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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