diff --git a/.gitignore b/.gitignore index 0003c88..c2f9e6d 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ # Notepad++ backups # *.bak + +.vscode/ diff --git a/defines/VehicleFlags.hpp b/defines/VehicleFlags.hpp index 2e13fb2..752753a 100644 --- a/defines/VehicleFlags.hpp +++ b/defines/VehicleFlags.hpp @@ -84,30 +84,159 @@ class VehicleFlags { actionID = "flag_simpleshape"; actionTitle = "Simple Shapes"; - class GreenOctagon { - actionID = "flag_simpleshape_greenoctagon"; - actionTitle = "Green Octagon"; - texture = "textures\simple_shape\flag_simpleshape_greenoctagon_co.paa"; + class Blue { + actionID = "flags_simpleshape_blue"; + actionTitle = "Blue"; + + class BlueCircle { + actionID = "flag_simpleshape_bluecircle"; + actionTitle = "Blue Circle"; + texture = "textures\simple_shape\flag_simpleshape_bluecircle_co.paa"; + }; + class BlueOctagon { + actionID = "flag_simpleshape_blueoctagon"; + actionTitle = "Blue Octagon"; + texture = "textures\simple_shape\flag_simpleshape_blueoctagon_co.paa"; + }; + class BluePentagon { + actionID = "flag_simpleshape_bluepentagon"; + actionTitle = "Blue Pentagon"; + texture = "textures\simple_shape\flag_simpleshape_bluepentagon_co.paa"; + }; + class BlueSquare { + actionID = "flag_simpleshape_bluesquare"; + actionTitle = "Blue Square"; + texture = "textures\simple_shape\flag_simpleshape_bluesquare_co.paa"; + }; + class BlueTriangle { + actionID = "flag_simpleshape_bluetriangle"; + actionTitle = "Blue Triangle"; + texture = "textures\simple_shape\flag_simpleshape_bluetriangle_co.paa"; + }; }; - class BlueCircle { - actionID = "flag_simpleshape_bluecircle"; - actionTitle = "Blue Circle"; - texture = "textures\simple_shape\flag_simpleshape_bluecircle_co.paa"; + + class Green { + actionID = "flags_simpleshape_green"; + actionTitle = "Green"; + + class GreenCircle { + actionID = "flag_simpleshape_greencircle"; + actionTitle = "Green Circle"; + texture = "textures\simple_shape\flag_simpleshape_greencircle_co.paa"; + }; + class GreenOctagon { + actionID = "flag_simpleshape_greenoctagon"; + actionTitle = "Green Octagon"; + texture = "textures\simple_shape\flag_simpleshape_greenoctagon_co.paa"; + }; + class GreenPentagon { + actionID = "flag_simpleshape_greenpentagon"; + actionTitle = "Green Pentagon"; + texture = "textures\simple_shape\flag_simpleshape_greenpentagon_co.paa"; + }; + class GreenSquare { + actionID = "flag_simpleshape_greensquare"; + actionTitle = "Green Square"; + texture = "textures\simple_shape\flag_simpleshape_greensquare_co.paa"; + }; + class GreenTriangle { + actionID = "flag_simpleshape_greentriangle"; + actionTitle = "Green Triangle"; + texture = "textures\simple_shape\flag_simpleshape_greentriangle_co.paa"; + }; }; - class OrangeSquare { - actionID = "flag_simpleshape_orangesquare"; - actionTitle = "Orange Square"; - texture = "textures\simple_shape\flag_simpleshape_orangesquare_co.paa"; + + class Orange { + actionID = "flags_simpleshape_orange"; + actionTitle = "Orange"; + + class OrangeCircle { + actionID = "flag_simpleshape_orangecircle"; + actionTitle = "Orange Circle"; + texture = "textures\simple_shape\flag_simpleshape_orangecircle_co.paa"; + }; + class OrangeOctagon { + actionID = "flag_simpleshape_orangeoctagon"; + actionTitle = "Orange Octagon"; + texture = "textures\simple_shape\flag_simpleshape_orangeoctagon_co.paa"; + }; + class OrangePentagon { + actionID = "flag_simpleshape_orangepentagon"; + actionTitle = "Orange Pentagon"; + texture = "textures\simple_shape\flag_simpleshape_orangepentagon_co.paa"; + }; + class OrangeSquare { + actionID = "flag_simpleshape_orangesquare"; + actionTitle = "Orange Square"; + texture = "textures\simple_shape\flag_simpleshape_orangesquare_co.paa"; + }; + class OrangeTriangle { + actionID = "flag_simpleshape_orangetriangle"; + actionTitle = "Orange Triangle"; + texture = "textures\simple_shape\flag_simpleshape_orangetriangle_co.paa"; + }; }; - class PinkTriangle { - actionID = "flag_simpleshape_pinktriangle"; - actionTitle = "Pink Triangle"; - texture = "textures\simple_shape\flag_simpleshape_pinktriangle_co.paa"; + + class Pink { + actionID = "flags_simpleshape_pink"; + actionTitle = "Pink"; + + class PinkCircle { + actionID = "flag_simpleshape_pinkcircle"; + actionTitle = "Pink Circle"; + texture = "textures\simple_shape\flag_simpleshape_pinkcircle_co.paa"; + }; + class PinkOctagon { + actionID = "flag_simpleshape_pinkoctagon"; + actionTitle = "Pink Octagon"; + texture = "textures\simple_shape\flag_simpleshape_pinkoctagon_co.paa"; + }; + class PinkPentagon { + actionID = "flag_simpleshape_pinkpentagon"; + actionTitle = "Pink Pentagon"; + texture = "textures\simple_shape\flag_simpleshape_pinkpentagon_co.paa"; + }; + class PinkSquare { + actionID = "flag_simpleshape_pinksquare"; + actionTitle = "Pink Square"; + texture = "textures\simple_shape\flag_simpleshape_pinksquare_co.paa"; + }; + class PinkTriangle { + actionID = "flag_simpleshape_pinktriangle"; + actionTitle = "Pink Triangle"; + texture = "textures\simple_shape\flag_simpleshape_pinktriangle_co.paa"; + }; }; - class RedPentagon { - actionID = "flag_simpleshape_redpentagon"; - actionTitle = "Red Pentagon"; - texture = "textures\simple_shape\flag_simpleshape_redpentagon_co.paa"; + + class Red { + actionID = "flags_simpleshape_red"; + actionTitle = "Red"; + + class RedCircle { + actionID = "flag_simpleshape_redcircle"; + actionTitle = "Red Circle"; + texture = "textures\simple_shape\flag_simpleshape_redcircle_co.paa"; + }; + class RedOctagon { + actionID = "flag_simpleshape_redoctagon"; + actionTitle = "Red Octagon"; + texture = "textures\simple_shape\flag_simpleshape_redoctagon_co.paa"; + }; + class RedPentagon { + actionID = "flag_simpleshape_redpentagon"; + actionTitle = "Red Pentagon"; + texture = "textures\simple_shape\flag_simpleshape_redpentagon_co.paa"; + }; + class RedSquare { + actionID = "flag_simpleshape_redsquare"; + actionTitle = "Red Square"; + texture = "textures\simple_shape\flag_simpleshape_redsquare_co.paa"; + }; + class RedTriangle { + actionID = "flag_simpleshape_redtriangle"; + actionTitle = "Red Triangle"; + texture = "textures\simple_shape\flag_simpleshape_redtriangle_co.paa"; + }; }; }; diff --git a/framework/CfgFunctions.hpp b/framework/CfgFunctions.hpp index e6b146d..55ce5b1 100644 --- a/framework/CfgFunctions.hpp +++ b/framework/CfgFunctions.hpp @@ -175,6 +175,8 @@ class DOUBLES(PREFIX,vehicleFlags) { class addFlagActions {}; class draw3D {}; class getActionsFlagCategories {}; + class compileFlagAction {}; + class compileFlagCategoryAction {}; class getVehicleFlagsCfg {}; class isClassExcluded {}; }; diff --git a/framework/vehicleFlags/functions/fn_compileFlagAction.sqf b/framework/vehicleFlags/functions/fn_compileFlagAction.sqf new file mode 100644 index 0000000..1736185 --- /dev/null +++ b/framework/vehicleFlags/functions/fn_compileFlagAction.sqf @@ -0,0 +1,38 @@ +params ["_target", "_player", "_params", "_flagOptionCfg"]; +_params params ["_rootActionID", "_flagCategoryActionID", "_flagSubclassesCfgs"]; + +private _flagOptionID = getText(_flagOptionCfg >> "actionID"); +private _flagOptionTitle = getText(_flagOptionCfg >> "actionTitle"); +private _flagOptionTexture = getText(_flagOptionCfg >> "texture"); + +// if the texture doesn't exist at the config path, skip this flag option +if (not (fileExists _flagOptionTexture)) then { + diag_log format ["WARN: Flag option texture not found: %1", _flagOptionTexture]; + continue +}; + +// diag_log format ["NewFlagOption: %1 %2", _flagOptionID, _flagOptionData]; + +private _newFlagOption = [ + + _rootActionID + "_" + _flagCategoryActionID + "_" + _flagOptionID, // id + _flagOptionTitle, // displayed title + _flagOptionTexture, // flag icon + { + params ["_target", "_player", "_params"]; + _params params ["_flagOptionTexture"]; + _target forceFlagTexture _flagOptionTexture; + }, // statement + { + params ["_target", "_player", "_params"]; + alive _target; + // true; + }, // condition + nil, // child code + [_flagOptionTexture], // params + nil, // position + 4, // distance + [false, false, false, false, false] // other params +] call ace_interact_menu_fnc_createAction; + +_newFlagOption; \ No newline at end of file diff --git a/framework/vehicleFlags/functions/fn_compileFlagCategoryAction.sqf b/framework/vehicleFlags/functions/fn_compileFlagCategoryAction.sqf new file mode 100644 index 0000000..fd9dec4 --- /dev/null +++ b/framework/vehicleFlags/functions/fn_compileFlagCategoryAction.sqf @@ -0,0 +1,52 @@ +// diag_log format ["NewFlagCategory: %1 %2", _flagCategory, _flagOptions]; + +params ["_rootActionID", "_flagCategoryCfg"]; +private _flagCategoryActionID = getText(_flagCategoryCfg >> "actionID"); +private _flagCategoryTitle = getText(_flagCategoryCfg >> "actionTitle"); + +private _flagSubclassesCfgs = _flagCategoryCfg call BIS_fnc_returnChildren; + +private _flagCategoryAction = [ + _rootActionID + "_" + _flagCategoryActionID, // id + _flagCategoryTitle, // displayed title + getText((_flagSubclassesCfgs#0) >> "texture"), // flag icon for category - use first flag option + {true}, // statement + { + params ["_target", "_player", "_params"]; + alive _target; + // true; + }, // condition + { + // generate child code under category + // this is the level where actual flag options will be displayed + params ["_target", "_player", "_params"]; + // these params are passed from the parent action + _params params ["_rootActionID", "_flagCategoryActionID", "_flagSubclassesCfgs"]; + + private _individualFlagActions = []; + { // forEach _flagSubclassesCfgs; // we'll generate flag options for each category + private _flagOptionCfg = _x; + + // generate flag option for this flag option + private _newFlagOption = [ + _target, + _player, + _params, + _flagOptionCfg + ] call FUNC(compileFlagAction); + + // add flag option to category subactions + _individualFlagActions pushBack [_newFlagOption, [], _target]; + } forEach _flagSubclassesCfgs; + + // return the generated flag options to the category as child actions + _individualFlagActions; + }, // child code + [_rootActionID, _flagCategoryActionID, _flagSubclassesCfgs], // params + nil, // position + 4, // distance + [false, false, false, false, false], // other params + nil // modifier function code +] call ace_interact_menu_fnc_createAction; + +_flagCategoryAction; \ No newline at end of file diff --git a/framework/vehicleFlags/functions/fn_getActionsFlagCategories.sqf b/framework/vehicleFlags/functions/fn_getActionsFlagCategories.sqf index 1c9aabc..9ee5efe 100644 --- a/framework/vehicleFlags/functions/fn_getActionsFlagCategories.sqf +++ b/framework/vehicleFlags/functions/fn_getActionsFlagCategories.sqf @@ -11,80 +11,18 @@ params ["_rootActionID", "_flagCategoryCfgs"]; private _allCategoryActions = []; { - // diag_log format ["NewFlagCategory: %1 %2", _flagCategory, _flagOptions]; - - private _flagCategoryCfg = _x; - private _flagCategoryActionID = getText(_flagCategoryCfg >> "actionID"); - private _flagCategoryTitle = getText(_flagCategoryCfg >> "actionTitle"); - - private _flagSubclassesCfgs = _flagCategoryCfg call BIS_fnc_returnChildren; - - private _flagCategoryAction = [ - _rootActionID + "_" + _flagCategoryActionID, // id - _flagCategoryTitle, // displayed title - getText((_flagSubclassesCfgs#0) >> "texture"), // flag icon for category - use first flag option - {true}, // statement + _flagCategoryActions = []; + if (configName _x == "SimpleShapes") then { { - params ["_target", "_player", "_params"]; - alive _target; - // true; - }, // condition - { - // generate child code under category - // this is the level where actual flag options will be displayed - params ["_target", "_player", "_params"]; - _params params ["_rootActionID", "_flagCategoryActionID", "_flagSubclassesCfgs"]; - - private _individualFlagActions = []; - { // forEach _flagSubclassesCfgs; - private _flagOptionCfg = _x; - private _flagOptionID = getText(_flagOptionCfg >> "actionID"); - private _flagOptionTitle = getText(_flagOptionCfg >> "actionTitle"); - private _flagOptionTexture = getText(_flagOptionCfg >> "texture"); - - // if the texture doesn't exist at the config path, skip this flag option - if (not (fileExists _flagOptionTexture)) then {continue}; - - // diag_log format ["NewFlagOption: %1 %2", _flagOptionID, _flagOptionData]; - - private _newFlagOption = [ - - _rootActionID + "_" + _flagCategoryActionID + "_" + _flagOptionID, // id - _flagOptionTitle, // displayed title - _flagOptionTexture, // flag icon - { - params ["_target", "_player", "_params"]; - _params params ["_flagOptionTexture"]; - _target forceFlagTexture _flagOptionTexture; - }, // statement - { - params ["_target", "_player", "_params"]; - alive _target; - // true; - }, // condition - nil, // child code - [_flagOptionTexture], // params - nil, // position - 4, // distance - [false, false, false, false, false] // other params - ] call ace_interact_menu_fnc_createAction; - - // add flag option to category subactions - _individualFlagActions pushBack [_newFlagOption, [], _target]; - } forEach _flagSubclassesCfgs; - - // return the generated flag options to the category as child actions - _individualFlagActions; - }, // child code - [_rootActionID, _flagCategoryActionID, _flagSubclassesCfgs], // params - nil, // position - 4, // distance - [false, false, false, false, false], // other params - nil // modifier function code - ] call ace_interact_menu_fnc_createAction; - + _flagCategoryActions pushBack ([_rootActionID, _x] call FUNC(compileFlagCategoryAction)); + } forEach (_x call BIS_fnc_returnChildren); + } else { + _flagCategoryActions pushBack (_x call FUNC(compileFlagCategoryAction)); + }; // add category to all category actions array - _allCategoryActions pushBack [_flagCategoryAction, [], _target]; + { + _allCategoryActions pushBack [_x, [], _target]; + } forEach _flagCategoryActions; } forEach _flagCategoryCfgs; _allCategoryActions; \ No newline at end of file diff --git a/textures/simple_shape/flag_simpleshape_bluecircle_co.paa b/textures/simple_shape/flag_simpleshape_bluecircle_co.paa index 58e6d42..08bc21e 100644 Binary files a/textures/simple_shape/flag_simpleshape_bluecircle_co.paa and b/textures/simple_shape/flag_simpleshape_bluecircle_co.paa differ diff --git a/textures/simple_shape/flag_simpleshape_blueoctagon_co.paa b/textures/simple_shape/flag_simpleshape_blueoctagon_co.paa new file mode 100644 index 0000000..dc7a6bd Binary files /dev/null and b/textures/simple_shape/flag_simpleshape_blueoctagon_co.paa differ diff --git a/textures/simple_shape/flag_simpleshape_bluepentagon_co.paa b/textures/simple_shape/flag_simpleshape_bluepentagon_co.paa new file mode 100644 index 0000000..1f6b311 Binary files /dev/null and b/textures/simple_shape/flag_simpleshape_bluepentagon_co.paa differ diff --git a/textures/simple_shape/flag_simpleshape_bluesquare_co.paa b/textures/simple_shape/flag_simpleshape_bluesquare_co.paa new file mode 100644 index 0000000..d3e822f Binary files /dev/null and b/textures/simple_shape/flag_simpleshape_bluesquare_co.paa differ diff --git a/textures/simple_shape/flag_simpleshape_bluetriangle_co.paa b/textures/simple_shape/flag_simpleshape_bluetriangle_co.paa new file mode 100644 index 0000000..6dc8db8 Binary files /dev/null and b/textures/simple_shape/flag_simpleshape_bluetriangle_co.paa differ diff --git a/textures/simple_shape/flag_simpleshape_greencircle_co.paa b/textures/simple_shape/flag_simpleshape_greencircle_co.paa new file mode 100644 index 0000000..8e8ca88 Binary files /dev/null and b/textures/simple_shape/flag_simpleshape_greencircle_co.paa differ diff --git a/textures/simple_shape/flag_simpleshape_greenoctagon_co.paa b/textures/simple_shape/flag_simpleshape_greenoctagon_co.paa index e513171..fb53a12 100644 Binary files a/textures/simple_shape/flag_simpleshape_greenoctagon_co.paa and b/textures/simple_shape/flag_simpleshape_greenoctagon_co.paa differ diff --git a/textures/simple_shape/flag_simpleshape_greenpentagon_co.paa b/textures/simple_shape/flag_simpleshape_greenpentagon_co.paa new file mode 100644 index 0000000..f6a295a Binary files /dev/null and b/textures/simple_shape/flag_simpleshape_greenpentagon_co.paa differ diff --git a/textures/simple_shape/flag_simpleshape_greensquare_co.paa b/textures/simple_shape/flag_simpleshape_greensquare_co.paa new file mode 100644 index 0000000..e9975a3 Binary files /dev/null and b/textures/simple_shape/flag_simpleshape_greensquare_co.paa differ diff --git a/textures/simple_shape/flag_simpleshape_greentriangle_co.paa b/textures/simple_shape/flag_simpleshape_greentriangle_co.paa new file mode 100644 index 0000000..3145f77 Binary files /dev/null and b/textures/simple_shape/flag_simpleshape_greentriangle_co.paa differ diff --git a/textures/simple_shape/flag_simpleshape_orangecircle_co.paa b/textures/simple_shape/flag_simpleshape_orangecircle_co.paa new file mode 100644 index 0000000..0cd8f25 Binary files /dev/null and b/textures/simple_shape/flag_simpleshape_orangecircle_co.paa differ diff --git a/textures/simple_shape/flag_simpleshape_orangeoctagon_co.paa b/textures/simple_shape/flag_simpleshape_orangeoctagon_co.paa new file mode 100644 index 0000000..2311679 Binary files /dev/null and b/textures/simple_shape/flag_simpleshape_orangeoctagon_co.paa differ diff --git a/textures/simple_shape/flag_simpleshape_orangepentagon_co.paa b/textures/simple_shape/flag_simpleshape_orangepentagon_co.paa new file mode 100644 index 0000000..96002fa Binary files /dev/null and b/textures/simple_shape/flag_simpleshape_orangepentagon_co.paa differ diff --git a/textures/simple_shape/flag_simpleshape_orangesquare_co.paa b/textures/simple_shape/flag_simpleshape_orangesquare_co.paa index 7b12c21..0c23af6 100644 Binary files a/textures/simple_shape/flag_simpleshape_orangesquare_co.paa and b/textures/simple_shape/flag_simpleshape_orangesquare_co.paa differ diff --git a/textures/simple_shape/flag_simpleshape_orangetriangle_co.paa b/textures/simple_shape/flag_simpleshape_orangetriangle_co.paa new file mode 100644 index 0000000..27af985 Binary files /dev/null and b/textures/simple_shape/flag_simpleshape_orangetriangle_co.paa differ diff --git a/textures/simple_shape/flag_simpleshape_pinkcircle_co.paa b/textures/simple_shape/flag_simpleshape_pinkcircle_co.paa new file mode 100644 index 0000000..075c947 Binary files /dev/null and b/textures/simple_shape/flag_simpleshape_pinkcircle_co.paa differ diff --git a/textures/simple_shape/flag_simpleshape_pinkoctagon_co.paa b/textures/simple_shape/flag_simpleshape_pinkoctagon_co.paa new file mode 100644 index 0000000..fda6e0d Binary files /dev/null and b/textures/simple_shape/flag_simpleshape_pinkoctagon_co.paa differ diff --git a/textures/simple_shape/flag_simpleshape_pinkpentagon_co.paa b/textures/simple_shape/flag_simpleshape_pinkpentagon_co.paa new file mode 100644 index 0000000..1b18e3c Binary files /dev/null and b/textures/simple_shape/flag_simpleshape_pinkpentagon_co.paa differ diff --git a/textures/simple_shape/flag_simpleshape_pinksquare_co.paa b/textures/simple_shape/flag_simpleshape_pinksquare_co.paa new file mode 100644 index 0000000..95a37f6 Binary files /dev/null and b/textures/simple_shape/flag_simpleshape_pinksquare_co.paa differ diff --git a/textures/simple_shape/flag_simpleshape_pinktriangle_co.paa b/textures/simple_shape/flag_simpleshape_pinktriangle_co.paa index 7fe2735..dbecfa3 100644 Binary files a/textures/simple_shape/flag_simpleshape_pinktriangle_co.paa and b/textures/simple_shape/flag_simpleshape_pinktriangle_co.paa differ diff --git a/textures/simple_shape/flag_simpleshape_redcircle_co.paa b/textures/simple_shape/flag_simpleshape_redcircle_co.paa new file mode 100644 index 0000000..ac63139 Binary files /dev/null and b/textures/simple_shape/flag_simpleshape_redcircle_co.paa differ diff --git a/textures/simple_shape/flag_simpleshape_redoctagon_co.paa b/textures/simple_shape/flag_simpleshape_redoctagon_co.paa new file mode 100644 index 0000000..49bb1f4 Binary files /dev/null and b/textures/simple_shape/flag_simpleshape_redoctagon_co.paa differ diff --git a/textures/simple_shape/flag_simpleshape_redpentagon_co.paa b/textures/simple_shape/flag_simpleshape_redpentagon_co.paa index d6fcac8..9556c95 100644 Binary files a/textures/simple_shape/flag_simpleshape_redpentagon_co.paa and b/textures/simple_shape/flag_simpleshape_redpentagon_co.paa differ diff --git a/textures/simple_shape/flag_simpleshape_redsquare_co.paa b/textures/simple_shape/flag_simpleshape_redsquare_co.paa new file mode 100644 index 0000000..fea6018 Binary files /dev/null and b/textures/simple_shape/flag_simpleshape_redsquare_co.paa differ diff --git a/textures/simple_shape/flag_simpleshape_redtriangle_co.paa b/textures/simple_shape/flag_simpleshape_redtriangle_co.paa new file mode 100644 index 0000000..4e64dc5 Binary files /dev/null and b/textures/simple_shape/flag_simpleshape_redtriangle_co.paa differ