From fb9a192b17be53d992cc77e57ddfe3fdea636e44 Mon Sep 17 00:00:00 2001 From: Taggerung Date: Thu, 22 Feb 2024 17:08:01 +1030 Subject: [PATCH] View Distance and Shift Click Adds view distance options on ace self interact. Replaces Shift click map/3d marker with a point w/o distance --adjustable in Parameters. Should merge fine into main, doesn't change any files at time of commit --- description.ext | 17 + initPlayerLocal.sqf | 42 ++ taw_vd/CfgFunctions.hpp | 21 + taw_vd/GUI.h | 668 +++++++++++++++++++++++++++ taw_vd/defines.h | 44 ++ taw_vd/fn_onChar.sqf | 36 ++ taw_vd/fn_onSavePressed.sqf | 27 ++ taw_vd/fn_onSaveSelectionChanged.sqf | 28 ++ taw_vd/fn_onSliderChanged.sqf | 35 ++ taw_vd/fn_onTerrainChanged.sqf | 17 + taw_vd/fn_openMenu.sqf | 41 ++ taw_vd/fn_openSaveManager.sqf | 31 ++ taw_vd/fn_stateTracker.fsm | 196 ++++++++ taw_vd/fn_updateViewDistance.sqf | 35 ++ 14 files changed, 1238 insertions(+) create mode 100644 description.ext create mode 100644 initPlayerLocal.sqf create mode 100644 taw_vd/CfgFunctions.hpp create mode 100644 taw_vd/GUI.h create mode 100644 taw_vd/defines.h create mode 100644 taw_vd/fn_onChar.sqf create mode 100644 taw_vd/fn_onSavePressed.sqf create mode 100644 taw_vd/fn_onSaveSelectionChanged.sqf create mode 100644 taw_vd/fn_onSliderChanged.sqf create mode 100644 taw_vd/fn_onTerrainChanged.sqf create mode 100644 taw_vd/fn_openMenu.sqf create mode 100644 taw_vd/fn_openSaveManager.sqf create mode 100644 taw_vd/fn_stateTracker.fsm create mode 100644 taw_vd/fn_updateViewDistance.sqf diff --git a/description.ext b/description.ext new file mode 100644 index 0000000..a1a9341 --- /dev/null +++ b/description.ext @@ -0,0 +1,17 @@ +#include "taw_vd\GUI.h" + +class CfgFunctions +{ + #include "taw_vd\CfgFunctions.hpp" +}; + +class Params +{ + class Param_Waypoints + { + title="Waypoints"; + values[]={0,1,2}; + texts[]={"On", "No Distance", "Off"}; + default = 1; + }; +}; diff --git a/initPlayerLocal.sqf b/initPlayerLocal.sqf new file mode 100644 index 0000000..5043d54 --- /dev/null +++ b/initPlayerLocal.sqf @@ -0,0 +1,42 @@ +//saves player loadout for respawn +[player, [missionnamespace, "virtualinventory"]] call Bis_fnc_saveinventory; + +//makes shift click markers on map become plain dots without distance. +//note: difficulty must be set accordingly +if (paramsArray select 0 == 2) then { +player onMapSingleClick {_shift}; +}; + +if (paramsArray select 0 == 1) then { + disableSerialization; + if (hasInterface) then { waitUntil {!isNull (findDisplay 12)}; + _mapDisplay = findDisplay 12; + _mapControl = _mapDisplay displayCtrl 51; + + _mapControl ctrlAddEventHandler ["MouseMoving", { + TRN_var_mainMapMouseOverCustomMark = "customMark" in (ctrlMapMouseOver (_this select 0)); + }]; + + ["TRN", "onMapSingleClick", { + if (_shift) then { + TRN_var_customMarkLocation = _pos; + }; + }] call BIS_fnc_addStackedEventHandler; + + _mapDisplay displayAddEventHandler ["KeyDown", { + if (!isNil "TRN_var_mainMapMouseOverCustomMark" && {TRN_var_mainMapMouseOverCustomMark} && {(_this select 1) == 211}) then { + TRN_var_customMarkLocation = nil; + }; + }]; + + addMissionEventHandler ["Draw3D", { + if (!isNil "TRN_var_customMarkLocation") then { + drawIcon3D ["\A3\ui_f\data\igui\cfg\cursors\customMark_ca.paa", [1,1,1,0.3], [TRN_var_customMarkLocation select 0, TRN_var_customMarkLocation select 1, (TRN_var_customMarkLocation select 2) + 2], 1.5, 1.5, 0, "", 1, 0, "TahomaB", "", true]; + }; + }]; + }; +}; + +//disables subtitles and spoken sentences "Enemy. inftantry. west. 400" etc +showSubtitles false; +enableSentences false; \ No newline at end of file diff --git a/taw_vd/CfgFunctions.hpp b/taw_vd/CfgFunctions.hpp new file mode 100644 index 0000000..65be88c --- /dev/null +++ b/taw_vd/CfgFunctions.hpp @@ -0,0 +1,21 @@ +class TAW_VD { + tag = "TAWVD"; + + class Initialize { + file = "taw_vd"; + class stateTracker { + ext = ".fsm"; + postInit = 1; + headerType = -1; + }; + + class onSliderChanged {}; + class onTerrainChanged {}; + class updateViewDistance {}; + class openMenu {}; + class onChar {}; + class openSaveManager {}; + class onSavePressed {}; + class onSaveSelectionChanged {}; + }; +}; \ No newline at end of file diff --git a/taw_vd/GUI.h b/taw_vd/GUI.h new file mode 100644 index 0000000..0a5c9ec --- /dev/null +++ b/taw_vd/GUI.h @@ -0,0 +1,668 @@ +#include "defines.h" + +class RscEdit { + type = 2; + style = 0x00 + 0x40; + font = "PuristaMedium"; + shadow = 2; + sizeEx = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + colorBackground[] = {0, 0, 0, 1}; + soundSelect[] = {"",0.1,1}; + soundExpand[] = {"",0.1,1}; + colorText[] = {0.95, 0.95, 0.95, 1}; + colorDisabled[] = {1, 1, 1, 0.25}; + autocomplete = false; + colorSelection[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.3843])", "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.7019])", "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.8862])", 1}; + canModify = 1; +}; + +class RscListBox { + style = 16; + idc = -1; + type = 5; + w = 0.275; + h = 0.04; + font = "PuristaMedium"; + colorSelect[] = {1, 1, 1, 1}; + colorText[] = {1, 1, 1, 1}; + colorBackground[] = {0.28,0.28,0.28,0.28}; + colorSelect2[] = {1, 1, 1, 1}; + colorSelectBackground[] = {0.95, 0.95, 0.95, 0.5}; + colorSelectBackground2[] = {1, 1, 1, 0.5}; + colorScrollbar[] = {0.2, 0.2, 0.2, 1}; + colorPicture[] = {1,1,1,1}; + colorPictureSelected[] = {1,1,1,1}; + colorPictureDisabled[] = {1,1,1,1}; + arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa"; + arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa"; + wholeHeight = 0.45; + rowHeight = 0.04; + color[] = {0.7, 0.7, 0.7, 1}; + colorActive[] = {0,0,0,1}; + colorDisabled[] = {0,0,0,0.3}; + sizeEx = 0.023; + soundSelect[] = {"",0.1,1}; + soundExpand[] = {"",0.1,1}; + soundCollapse[] = {"",0.1,1}; + maxHistoryDelay = 1; + autoScrollSpeed = -1; + autoScrollDelay = 5; + autoScrollRewind = 0; + tooltipColorText[] = {1,1,1,1}; + tooltipColorBox[] = {1,1,1,1}; + tooltipColorShade[] = {0,0,0,0.65}; + + class ListScrollBar { + color[] = {1,1,1,1}; + colorActive[] = {1,1,1,1}; + colorDisabled[] = {1,1,1,0.3}; + thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa"; + arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa"; + arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa"; + border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa"; + shadow = 0; + scrollSpeed = 0.06; + width = 0; + height = 0; + autoScrollEnabled = 1; + autoScrollSpeed = -1; + autoScrollDelay = 5; + autoScrollRewind = 0; + } +}; + +class RscCheckBox { + access = 0; // Control access (0 - ReadAndWrite, 1 - ReadAndCreate, 2 - ReadOnly, 3 - ReadOnlyVerified) + idc = -1; // Control identification (without it, the control won't be displayed) + type = 77; // Type + style = ST_LEFT + ST_MULTI; // Style + default = 0; // Control selected by default (only one within a display can be used) + blinkingPeriod = 0; // Time in which control will fade out and back in. Use 0 to disable the effect. + + x = 0; + y = 0; + w = 1 * GUI_GRID_CENTER_W; // Width + h = 1 * GUI_GRID_CENTER_H; // Height + + //Colors + color[] = { 1, 1, 1, 0.7 }; // Texture color + colorFocused[] = { 1, 1, 1, 1 }; // Focused texture color + colorHover[] = { 1, 1, 1, 1 }; // Mouse over texture color + colorPressed[] = { 1, 1, 1, 1 }; // Mouse pressed texture color + colorDisabled[] = { 1, 1, 1, 0.2 }; // Disabled texture color + + //Background colors + colorBackground[] = { 0, 0, 0, 0 }; // Fill color + colorBackgroundFocused[] = { 0, 0, 0, 0 }; // Focused fill color + colorBackgroundHover[] = { 0, 0, 0, 0 }; // Mouse hover fill color + colorBackgroundPressed[] = { 0, 0, 0, 0 }; // Mouse pressed fill color + colorBackgroundDisabled[] = { 0, 0, 0, 0 }; // Disabled fill color + + //Textures + textureChecked = "\A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_checked_ca.paa"; //Texture of checked CheckBox. + textureUnchecked = "\A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_unchecked_ca.paa"; //Texture of unchecked CheckBox. + textureFocusedChecked = "\A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_checked_ca.paa"; //Texture of checked focused CheckBox (Could be used for showing different texture when focused). + textureFocusedUnchecked = "\A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_unchecked_ca.paa"; //Texture of unchecked focused CheckBox. + textureHoverChecked = "\A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_checked_ca.paa"; + textureHoverUnchecked = "\A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_unchecked_ca.paa"; + texturePressedChecked = "\A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_checked_ca.paa"; + texturePressedUnchecked = "\A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_unchecked_ca.paa"; + textureDisabledChecked = "\A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_checked_ca.paa"; + textureDisabledUnchecked = "\A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_unchecked_ca.paa"; + + tooltip = ""; // Tooltip text + tooltipColorShade[] = { 0, 0, 0, 1 }; // Tooltip background color + tooltipColorText[] = { 1, 1, 1, 1 }; // Tooltip text color + tooltipColorBox[] = { 1, 1, 1, 1 }; // Tooltip frame color + + //Sounds + soundClick[] = { "\A3\ui_f\data\sound\RscButton\soundClick", 0.09, 1 }; // Sound played after control is activated in format {file, volume, pitch} + soundEnter[] = { "\A3\ui_f\data\sound\RscButton\soundEnter", 0.09, 1 }; // Sound played when mouse cursor enters the control + soundPush[] = { "\A3\ui_f\data\sound\RscButton\soundPush", 0.09, 1 }; // Sound played when the control is pushed down + soundEscape[] = { "\A3\ui_f\data\sound\RscButton\soundEscape", 0.09, 1 }; // Sound played when the control is released after pushing down +}; + +class RscXSliderH { + style = 1024; + type = 43; + shadow = 2; + x = 0; + y = 0; + h = 0.029412; + w = 0.400000; + color[] = { + 1, 1, 1, 0.7 + }; + colorActive[] = { + 1, 1, 1, 1 + }; + colorDisabled[] = { + 1, 1, 1, 0.500000 + }; + arrowEmpty = "\A3\ui_f\data\gui\cfg\slider\arrowEmpty_ca.paa"; + arrowFull = "\A3\ui_f\data\gui\cfg\slider\arrowFull_ca.paa"; + border = "\A3\ui_f\data\gui\cfg\slider\border_ca.paa"; + thumb = "\A3\ui_f\data\gui\cfg\slider\thumb_ca.paa"; +}; + +class RscText { + x = 0; + y = 0; + h = 0.037; + w = 0.3; + type = 0; + style = 0; + shadow = 1; + colorShadow[] = {0, 0, 0, 0.5}; + font = "PuristaMedium"; + SizeEx = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + text = ""; + colorText[] = {1, 1, 1, 1.0}; + colorBackground[] = {0, 0, 0, 0}; + linespacing = 1; +}; + +class RscTitle:RscText { + style = 0; + shadow = 0; + sizeEx = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + colorText[] = {0.95, 0.95, 0.95, 1}; +}; + +class RscShortcutButton { + idc = -1; + style = 0; + default = 0; + shadow = 1; + w = 0.183825; + h = "( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 20)"; + color[] = {1,1,1,1.0}; + colorFocused[] = {1,1,1,1.0}; + color2[] = {0.95,0.95,0.95,1}; + colorDisabled[] = {1,1,1,0.25}; + colorBackground[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])",1}; + colorBackgroundFocused[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])",1}; + colorBackground2[] = {1,1,1,1}; + animTextureDefault = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\normal_ca.paa"; + animTextureNormal = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\normal_ca.paa"; + animTextureDisabled = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\normal_ca.paa"; + animTextureOver = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\over_ca.paa"; + animTextureFocused = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\focus_ca.paa"; + animTexturePressed = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\down_ca.paa"; + periodFocus = 1.2; + periodOver = 0.8; + class HitZone + { + left = 0.0; + top = 0.0; + right = 0.0; + bottom = 0.0; + }; + class ShortcutPos + { + left = 0; + top = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 20) - ( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)) / 2"; + w = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1) * (3/4)"; + h = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + }; + class TextPos + { + left = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1) * (3/4)"; + top = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 20) - ( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)) / 2"; + right = 0.005; + bottom = 0.0; + }; + period = 0.4; + font = "PuristaMedium"; + size = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + sizeEx = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + text = ""; + soundEnter[] = {"\A3\ui_f\data\sound\RscButton\soundEnter",0.09,1}; + soundPush[] = {"\A3\ui_f\data\sound\RscButton\soundPush",0.09,1}; + soundClick[] = {"\A3\ui_f\data\sound\RscButton\soundClick",0.09,1}; + soundEscape[] = {"\A3\ui_f\data\sound\RscButton\soundEscape",0.09,1}; + action = ""; + class Attributes + { + font = "PuristaMedium"; + color = "#E5E5E5"; + align = "left"; + shadow = "true"; + }; + class AttributesImage + { + font = "PuristaMedium"; + color = "#E5E5E5"; + align = "left"; + }; +}; + +class RscControlsGroup { + type = 15; + idc = -1; + x = 0; + y = 0; + w = 1; + h = 1; + shadow = 0; + style = 16; + + class ScrollBar { + color[] = {1, 1, 1, 0.6}; + colorActive[] = {1, 1, 1, 1}; + colorDisabled[] = {1, 1, 1, 0.3}; + thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa"; + arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa"; + arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa"; + border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa"; + shadow = 0; + scrollSpeed = 0.05; + }; + + class VScrollbar:ScrollBar { + width = 0.021; + autoScrollSpeed = -1; + autoScrollDelay = 5; + autoScrollRewind = 0; + shadow = 0; + color[] = {1, 1, 1, 0.6}; + }; + + class HScrollbar:ScrollBar { + height = 0.028; + shadow = 0; + color[] = {1, 1, 1, 0.6}; + }; + + //class ListScrollBar : ScrollBar {}; + + class Controls {}; +}; + +class RscControlsGroupNoScrollbars : RscControlsGroup { + class VScrollbar : VScrollbar { + width = 0; + }; + + class HScrollbar : HScrollbar { + height = 0; + }; +}; + +class RscButtonMenu:RscShortcutButton { + idc = -1; + type = 16; + style = "0x02 + 0xC0"; + default = 0; + shadow = 0; + x = 0; + y = 0; + w = 0.095589; + h = 0.039216; + animTextureNormal = "#(argb,8,8,3)color(1,1,1,1)"; + animTextureDisabled = "#(argb,8,8,3)color(1,1,1,1)"; + animTextureOver = "#(argb,8,8,3)color(1,1,1,1)"; + animTextureFocused = "#(argb,8,8,3)color(1,1,1,1)"; + animTexturePressed = "#(argb,8,8,3)color(1,1,1,1)"; + animTextureDefault = "#(argb,8,8,3)color(1,1,1,1)"; + colorBackground[] = {0,0,0,0.8}; + colorBackgroundFocused[] = {1,1,1,1}; + colorBackground2[] = {0.75,0.75,0.75,1}; + color[] = {1,1,1,1}; + colorFocused[] = {0,0,0,1}; + color2[] = {0,0,0,1}; + colorText[] = {1,1,1,1}; + colorDisabled[] = {1,1,1,0.25}; + period = 1.2; + periodFocus = 1.2; + periodOver = 1.2; + size = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + sizeEx = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + tooltipColorText[] = {1,1,1,1}; + tooltipColorBox[] = {1,1,1,1}; + tooltipColorShade[] = {0,0,0,0.65}; + class TextPos + { + left = "0.25 * ( ((safezoneW / safezoneH) min 1.2) / 40)"; + top = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) - ( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)) / 2"; + right = 0.005; + bottom = 0.0; + }; + class Attributes + { + font = "PuristaLight"; + color = "#E5E5E5"; + align = "left"; + shadow = "false"; + }; + class ShortcutPos + { + left = "(6.25 * ( ((safezoneW / safezoneH) min 1.2) / 40)) - 0.0225 - 0.005"; + top = 0.005; + w = 0.0225; + h = 0.03; + }; + soundEnter[] = {"\A3\ui_f\data\sound\RscButtonMenu\soundEnter",0.09,1}; + soundPush[] = {"\A3\ui_f\data\sound\RscButtonMenu\soundPush",0.09,1}; + soundClick[] = {"\A3\ui_f\data\sound\RscButtonMenu\soundClick",0.09,1}; + soundEscape[] = {"\A3\ui_f\data\sound\RscButtonMenu\soundEscape",0.09,1}; + textureNoShortcut = ""; +}; + +class TAW_VDMenu { + idd = MENU_IDD; + name = "TAW_VDMenu"; + movingEnabled = 0; + enableSimulation = 1; + + onLoad = "((_this select 0) displayCtrl 2999) ctrlSetFade 1; ((_this select 0) displayCtrl 2999) ctrlCommit 0;"; + + class controlsBackground { + class TitleBackground : RscText { + colorBackground[] = { "(profilenamespace getvariable ['GUI_BCG_RGB_R',0.3843])", "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.7019])", "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.8862])", "(profilenamespace getvariable ['GUI_BCG_RGB_A',0.7])" }; + idc = -1; + x = .3; + y = .2; + w = .5; + h = (1 / 25); + }; + + class MainBackground : RscText { + colorBackground[] = { 0, 0, 0, .7 }; + idc = -1; + x = .3; + y = .2 + (11 / 250); + w = .5; + h = .57 - (22 / 250); + }; + + class Title : RscTitle { + colorBackround[] = { 0, 0, 0, 0 }; + idc = -1; + text = "View Settings (SCRIPT)"; + x = .3; + y = .2; + w = .8; + h = (1 / 25); + }; + + class OnFootText : RscText { + idc = -1; + text = "Infantry:"; + x = .32; + y = .258; + w = .275; + h = .04; + }; + + class inCarText : OnFootText { + text = "Ground:"; + y = .305; + }; + + class inAirText : OnFootText { + text = "Air:"; + y = .355; + }; + + class ObjectText : OnFootText { + text = "Object:"; + y = .655; + }; + + class DroneText : OnFootText { + text = "Drone:"; + y = .405; + }; + + class TerrainBackground : TitleBackground { + text = "Grass Settings"; + shadow = 0; + y = .46; + }; + + class ObjectBackground : TitleBackground { + text = "Object Settings"; + y = .55; + }; + + class ButtonClose : RscButtonMenu { + idc = -1; + text = "Close"; + onButtonClick = "closeDialog 0;"; + x = 0.3; + y = 0.77 - (1 / 25); + w = (6.25 / 40); + h = (1 / 25); + }; + + class SaveManagerBtn:ButtonClose { + text = "Saves"; + onButtonClick = "[] call tawvd_fnc_openSaveManager;"; + x = .465; + }; + }; + + class controls { + + //Sliders + class VD_onFoot_slider : RscXSliderH { + idc = INFANTRY_SLIDER; + text = ""; + onSliderPosChanged = "[0, _this select 1] call TAWVD_fnc_onSliderChanged;"; + toolTip = "View Distance while on foot"; + x = .42; + y = .30 - (1 / 25); + w = "9 * ( ((safezoneW / safezoneH) min 1.2) / 40)"; + h = "1 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + }; + + class VD_inCar_slider : VD_onFoot_slider { + idc = GROUND_SLIDER; + toolTip = "View distance while in a ground vehicle"; + onSliderPosChanged = "[1, _this select 1] call TAWVD_fnc_onSliderChanged;"; + y = .35 - (1 / 25); + }; + + class VD_inAir_slider : VD_onFoot_slider { + idc = AIR_SLIDER; + toolTip = "View distance while in an aircraft"; + onSliderPosChanged = "[2, _this select 1] call TAWVD_fnc_onSliderChanged;"; + y = .40 - (1 / 25); + }; + + class VD_Object_slider : VD_onFoot_slider { + idc = OBJECT_SLIDER; + toolTip = "Object rendering distance"; + onSliderPosChanged = "[3, _this select 1] call TAWVD_fnc_onSliderChanged;"; + y = .7 - (1 / 25); + }; + + class VD_Drone_slider:VD_onFoot_slider { + idc = DRONE_SLIDER; + toolTip = "View distance while operating a UAV/UGV"; + onSliderPosChanged = "[4, _this select 1] call TAWVD_fnc_onSliderChanged;"; + y = .45 - (1 / 25); + } + + //Values (RscEdit Butons) + class VD_onFoot_Edit : RscEdit { + idc = INFANTRY_EDIT; + text = ""; + onKeyUp = "[_this select 0, _this select 1, 'ground',true] call TAWVD_fnc_onChar;"; + + x = .7; + y = .258; + w = .08; + h = .04; + }; + + class VD_inCar_Edit : VD_onFoot_Edit { + idc = GROUND_EDIT; + onKeyUp = "[_this select 0, _this select 1, 'vehicle',true] call TAWVD_fnc_onChar;"; + y = .31; + }; + + class VD_inAir_Edit : VD_onFoot_Edit { + idc = AIR_EDIT; + onKeyUp = "[_this select 0, _this select 1, 'air',true] call TAWVD_fnc_onChar;"; + y = .36; + }; + + class VD_inDrone_Edit:VD_onFoot_Edit { + idc = DRONE_EDIT; + onKeyUp = "[_this select 0, _this select 1, 'drone',true] call TAWVD_fnc_onChar;"; + y = .41; + }; + + class VD_Object_Edit : VD_onFoot_Edit { + idc = OBJECT_EDIT; + onKeyUp = "[_this select 0, _this select 1, 'object',true] call TAWVD_fnc_onChar;"; + y = .656; + }; + + //Grass Settings + class VD_terrain_none { + idc = TERRAIN_NONE; + type = 11; + style = 0; + font = "PuristaLight"; + color[] = { 1, 1, 1, 1 }; + colorActive[] = { 1, 0.2, 0.2, 1 }; + colorDisabled[] = {0, 0, 0, 1}; + soundEnter[] = { "\A3\ui_f\data\sound\onover", 0.09, 1 }; + soundPush[] = { "\A3\ui_f\data\sound\new1", 0.0, 0 }; + soundClick[] = { "\A3\ui_f\data\sound\onclick", 0.07, 1 }; + soundEscape[] = { "\A3\ui_f\data\sound\onescape", 0.09, 1 }; + text = "None"; + action = "['none'] call TAWVD_fnc_onTerrainChanged;"; + sizeEx = 0.04; + + x = .38; y = .505; + w = .275; h = .04; + }; + + class VD_terrain_low : VD_terrain_none { + idc = -1; + text = "Low"; + action = "['low'] call TAWVD_fnc_onTerrainChanged;"; + x = .47; + }; + + class VD_terrain_normal : VD_terrain_none { + idc = -1; + text = "Normal"; + action = "['norm'] call TAWVD_fnc_onTerrainChanged;"; + x = .56; + }; + + class VD_terrain_high : VD_terrain_none { + idc = -1; + text = "High"; + action = "['high'] call TAWVD_fnc_onTerrainChanged;"; + x = .67; + }; + + class ObjectSyncCheckbox : RscCheckbox + { + idc = 2931; + x = .32; y = .6; + tooltip = "Sync object rendering with view rendering"; + onCheckedChanged = "if((_this select 1) == 1) then {tawvd_syncObject = true;ctrlEnable [2941,false]; ctrlEnable [2942,false];} else {tawvd_syncObject = false; ctrlEnable [2942,true]; ctrlEnable [2941,true];};"; + w = 1 * GUI_GRID_CENTER_W; + h = 1 * GUI_GRID_CENTER_H; + }; + + class ObjectSynctext : RscText { + idc = -1; + text = "Sync with view"; + x = .345; y = .596; + w = .35; h = .04; + }; + + class Manager:RscControlsGroup { + idc = MANAGER_GROUP; + + x = -0.21; y = .2; + w = .5; h = 3; + class Controls { + class SaveLoadGroup:RscControlsGroupNoScrollbars { + idc = SAVELOAD_GROUP; + + x = 0; + y = 0; + w = .5; + h = 3; + + class Controls { + class MyTitleBackground:RscText { + colorBackground[] = { "(profilenamespace getvariable ['GUI_BCG_RGB_R',0.3843])", "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.7019])", "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.8862])", "(profilenamespace getvariable ['GUI_BCG_RGB_A',0.7])" }; + idc = -1; + x = 0; + y = 0; + w = .5; + h = (1 / 25); + }; + + class Title : RscTitle { + colorBackround[] = { 0, 0, 0, 0 }; + idc = -1; + text = "Save Manager"; + x = 0; + y = 0; + w = .8; + h = (1 / 25); + }; + + class MainBackground:RscText { + colorBackground[] = { 0, 0, 0, .7 }; + idc = -1; + x = 0; + y = 0 + (11 / 250); + w = .5; + h = .57 - (22 / 250); + }; + + class SaveList:RscListBox { + idc = SAVES_LIST; + sizeEx = 0.04; + colorBackground[] = {0.1,0.1,0.1,0.9}; + x = 0; y = 0 + (11 / 250); + w = .5; h = .49 - (22 / 250); + + onLBSelChanged = "_this call TAWVD_fnc_onSaveSelectionChanged;"; + }; + + class SaveSlotName:VD_onFoot_Edit { + idc = SLOT_NAME; + text = "SAVE NAME"; + colorBackground[] = {0,0,0,0.6}; + onKeyUp = ""; + + x = .025; y = .42 + (11 / 250); + w = .45; + }; + + class SaveButton:RscButtonMenu { + text = "Save"; + onButtonClick = "[] call TAWVD_fnc_onSavePressed;"; + x = 0; + y = 0.57 - (1 / 25); + w = (6.25 / 40); + h = (1 / 25); + }; + + class HideButton:RscButtonMenu { + text = "Hide"; + onButtonClick = "((findDisplay 2900) displayCtrl 2999) ctrlSetFade 1; ((findDisplay 2900) displayCtrl 2999) ctrlCommit 0.3;"; + x = .16; + y = 0.57 - (1 / 25); + w = (6.25 / 40); + h = (1 / 25); + }; + }; + }; + }; + }; + }; +}; \ No newline at end of file diff --git a/taw_vd/defines.h b/taw_vd/defines.h new file mode 100644 index 0000000..04ab98d --- /dev/null +++ b/taw_vd/defines.h @@ -0,0 +1,44 @@ +/* Main display IDD & IDC's */ +#define MENU_IDD 2900 +#define INFANTRY_SLIDER 2901 +#define INFANTRY_EDIT 2902 +#define GROUND_SLIDER 2911 +#define GROUND_EDIT 2912 +#define AIR_SLIDER 2921 +#define AIR_EDIT 2922 +#define OBJECT_SLIDER 2941 +#define OBJECT_EDIT 2942 +#define DRONE_SLIDER 2951 +#define DRONE_EDIT 2952 +#define TERRAIN_NONE 2950 +#define GUI_GRID_CENTER_WAbs ((safezoneW / safezoneH) min 1.2) +#define GUI_GRID_CENTER_HAbs (GUI_GRID_CENTER_WAbs / 1.2) +#define GUI_GRID_CENTER_W (GUI_GRID_CENTER_WAbs / 40) +#define GUI_GRID_CENTER_H (GUI_GRID_CENTER_HAbs / 25) +#define GUI_GRID_CENTER_X (safezoneX + (safezoneW - GUI_GRID_CENTER_WAbs)/2) +#define GUI_GRID_CENTER_Y (safezoneY + (safezoneH - GUI_GRID_CENTER_HAbs)/2) +#define ST_LEFT 0x00 +#define ST_MULTI 0x10 +#define SEL(ARRAY,INDEX) (ARRAY select INDEX) + +/* Save / Load Manager */ +#define MANAGER_GROUP 2999 +#define SAVELOAD_GROUP 3000 +#define SAVES_LIST 3001 +#define SLOT_NAME 3002 + +/* Namespace Macros */ +#define SVAR_MNS missionNamespace setVariable +#define SVAR_UINS uiNamespace setVariable +#define SVAR_PNS profileNamespace setVariable +#define GVAR_MNS missionNamespace getVariable +#define GVAR_UINS uiNamespace getVariable +#define GVAR_PNS profileNamespace getVariable + +/* Condition Macros */ +#define EQUAL(condition1,condition2) condition1 isEqualTo condition2 + +/* Display Macros */ +#define CONTROL(disp,ctrl) ((findDisplay ##disp) displayCtrl ##ctrl) +#define CONTROL_DATA(ctrl) (lbData[ctrl,lbCurSel ctrl]) +#define CONTROL_DATAI(ctrl,index) ctrl lbData index \ No newline at end of file diff --git a/taw_vd/fn_onChar.sqf b/taw_vd/fn_onChar.sqf new file mode 100644 index 0000000..2026cab --- /dev/null +++ b/taw_vd/fn_onChar.sqf @@ -0,0 +1,36 @@ +#include "defines.h" +/* + Author: Bryan "Tonic" Boardwine + + Description: + When a character is entered it is validated and changes the + correct slider it is associated with. I probably over-complicated + this more then I had to but onChar behaves weird. + + PARAMS: + 0: CONTROL + 1: SCALAR (INT) + 2: STRING (Case option) +*/ +private["_value","_varName","_maxRange"]; +params ["_control","_code","_slider"]; + +disableSerialization; +if(isNull _control) exitWith {}; //POOOOOP + +_maxRange = if(!isNil "tawvd_maxRange") then {tawvd_maxRange} else {20000}; +_value = parseNumber (ctrlText _control); +if(_value > _maxRange OR _value < 100) exitwith {[] call TAWVD_fnc_openMenu;}; + +_varName = switch (_slider) do { + case "ground": {"tawvd_foot"}; + case "vehicle": {"tawvd_car"}; + case "air": {"tawvd_air"}; + case "object": {"tawvd_object"}; + case "drone": {"tawvd_drone"}; + default {"tawvd_foot"}; +}; + +SVAR_MNS [_varName,_value]; +[] call TAWVD_fnc_updateViewDistance; +[] call TAWVD_fnc_openMenu; \ No newline at end of file diff --git a/taw_vd/fn_onSavePressed.sqf b/taw_vd/fn_onSavePressed.sqf new file mode 100644 index 0000000..47525e9 --- /dev/null +++ b/taw_vd/fn_onSavePressed.sqf @@ -0,0 +1,27 @@ +#include "defines.h" +/* + Author: Bryan "Tonic" Boardwine + + Description: + Updates the view distance dependant on whether the player + is on foot, a car or an aircraft. +*/ +private ["_saveIndex","_saveName"]; +_saveIndex = lbCurSel SAVES_LIST; +_saveName = ctrlText SLOT_NAME; + +hint format["saveIndex: %1", _saveIndex]; +SVAR_PNS [format["tawvd_slot_%1",_saveIndex], + [ + _saveName, + tawvd_foot, + tawvd_car, + tawvd_air, + tawvd_drone, + tawvd_object, + tawvd_syncObject + ] +]; + +saveProfileNamespace; +[] call TAWVD_fnc_openSaveManager; diff --git a/taw_vd/fn_onSaveSelectionChanged.sqf b/taw_vd/fn_onSaveSelectionChanged.sqf new file mode 100644 index 0000000..2715028 --- /dev/null +++ b/taw_vd/fn_onSaveSelectionChanged.sqf @@ -0,0 +1,28 @@ +#include "defines.h" +/* + Author: Bryan "Tonic" Boardwine + + Description: + Updates the view distance dependant on whether the player + is on foot, a car or an aircraft. +*/ +private "_saveData"; +params [["_control",controlNull,[controlNull]],["_index",-1,[0]]]; + +/* Error checks */ +if(EQUAL(_index,-1) OR isNull _control) exitWith {}; +_saveData = GVAR_PNS format["tawvd_slot_%1",_index]; +if(isNil "_saveData") exitWith {}; + +/* Set variables to chosen slot data */ +CONTROL(MENU_IDD,SLOT_NAME) ctrlSetText (SEL(_saveData,0)); +SVAR_MNS ["tawvd_foot",SEL(_saveData,1)]; +SVAR_MNS ["tawvd_car",SEL(_saveData,2)]; +SVAR_MNS ["tawvd_air",SEL(_saveData,3)]; +SVAR_MNS ["tawvd_drone",SEL(_saveData,4)]; +SVAR_MNS ["tawvd_object",SEL(_saveData,5)]; +SVAR_MNS ["tawvd_syncObject",SEL(_saveData,6)]; + +/* Update Menu & View Distance */ +[] call TAWVD_fnc_updateViewDistance; +[] call TAWVD_fnc_openMenu; \ No newline at end of file diff --git a/taw_vd/fn_onSliderChanged.sqf b/taw_vd/fn_onSliderChanged.sqf new file mode 100644 index 0000000..a8423d5 --- /dev/null +++ b/taw_vd/fn_onSliderChanged.sqf @@ -0,0 +1,35 @@ +#include "defines.h" +/* + Author: Bryan "Tonic" Boardwine + + Description: + Called when the slider is changed for any field and + updates the view distance for it. +*/ +private "_varData"; +params [["_mode",-1,[0]],["_value",-1,[0]]]; + +if(EQUAL(_mode,-1) OR EQUAL(_value,-1)) exitWith {}; + +disableSerialization; + +_varData = switch(_mode) do { + case 0: {["tawvd_foot",INFANTRY_EDIT]}; + case 1: {["tawvd_car",GROUND_EDIT]}; + case 2: {["tawvd_air",AIR_EDIT]}; + case 3: {["tawvd_object",OBJECT_EDIT]}; + case 4: {["tawvd_drone",DRONE_EDIT]}; +}; + +SVAR_MNS [SEL(_varData,0),round(_value)]; +ctrlSetText[SEL(_varData,1),str(GVAR_MNS SEL(_varData,0))]; +[] call TAWVD_fnc_updateViewDistance; + +if(EQUAL(_mode,3)) then { + setObjectViewDistance [tawvd_object,100]; +}; + +if(tawvd_syncObject) then { + sliderSetPosition[OBJECT_SLIDER, tawvd_object]; + ctrlSetText[OBJECT_EDIT,str(tawvd_object)]; +}; \ No newline at end of file diff --git a/taw_vd/fn_onTerrainChanged.sqf b/taw_vd/fn_onTerrainChanged.sqf new file mode 100644 index 0000000..2194d9d --- /dev/null +++ b/taw_vd/fn_onTerrainChanged.sqf @@ -0,0 +1,17 @@ + +/* + Author: Bryan "Tonic" Boardwine + + Description: + Updates the players terraingrid when called. +*/ +private "_type"; +_type = param [0,"",[""]]; +if(_type == "") exitWith {}; + +switch (_type) do { + case "none": {if(isNil "tawvd_disablenone") then {setTerrainGrid 50;};}; + case "low": {setTerrainGrid 30;}; + case "norm": {setTerrainGrid 12.5;}; + case "high": {setTerrainGrid 3.125;}; +}; \ No newline at end of file diff --git a/taw_vd/fn_openMenu.sqf b/taw_vd/fn_openMenu.sqf new file mode 100644 index 0000000..bac3f4d --- /dev/null +++ b/taw_vd/fn_openMenu.sqf @@ -0,0 +1,41 @@ +#include "defines.h" +/* + Author: Bryan "Tonic" Boardwine + + Description: + Called via addAction and opens the TAW View Distance Menu +*/ +if(isNull (findDisplay MENU_IDD)) then { + if(!createDialog "TAW_VDMenu") exitWith {hint "Something went wrong, the menu won't open?"}; +}; +disableSerialization; + +{ + ctrlSetText[SEL(_x,0),str(SEL(_x,1))]; +} foreach [[INFANTRY_EDIT,tawvd_foot],[GROUND_EDIT,tawvd_car],[AIR_EDIT,tawvd_air],[OBJECT_EDIT,tawvd_object],[DRONE_EDIT,tawvd_drone]]; + +//Setup the sliders +{ + if(!isNil "tawvd_maxRange") then { + slidersetRange [_x select 0,100,tawvd_maxRange]; + } else { + slidersetRange [_x select 0,100,20000]; + }; + ((findDisplay MENU_IDD) displayCtrl (_x select 0)) sliderSetSpeed [100,100,100]; + sliderSetPosition[_x select 0, _x select 1]; +} foreach [[INFANTRY_SLIDER,tawvd_foot],[GROUND_SLIDER,tawvd_car],[AIR_SLIDER,tawvd_air],[OBJECT_SLIDER,tawvd_object],[DRONE_SLIDER,tawvd_drone]]; + +((findDisplay MENU_IDD) displayCtrl 2931) cbSetChecked tawvd_syncObject; + +if(tawvd_syncObject) then { + ctrlEnable [OBJECT_SLIDER,false]; + ctrlEnable [OBJECT_EDIT,false]; +} else { + ctrlEnable [OBJECT_SLIDER,true]; + ctrlEnable [OBJECT_EDIT,true]; +}; + +//Lets disable it.. +if(!isNil "tawvd_disablenone") then { + ctrlEnable [TERRAIN_NONE,false]; +}; \ No newline at end of file diff --git a/taw_vd/fn_openSaveManager.sqf b/taw_vd/fn_openSaveManager.sqf new file mode 100644 index 0000000..03a4029 --- /dev/null +++ b/taw_vd/fn_openSaveManager.sqf @@ -0,0 +1,31 @@ +#include "defines.h" +/* + Author: Bryan "Tonic" Boardwine + + Description: + Updates the view distance dependant on whether the player + is on foot, a car or an aircraft. +*/ +private ["_controlGrp","_saveList"]; +disableSerialization; + +/* Store displays */ +_controlGrp = CONTROL(MENU_IDD,MANAGER_GROUP); +_saveList = CONTROL(MENU_IDD,SAVES_LIST); +lbClear _saveList; //Purge the list + +/* Make the Saves manager group visible */ +_controlGrp ctrlSetfade 0; +_controlGrp ctrlCommit .3; + +/* Fill the listbox */ +for "_i" from 0 to 9 do { + _varData = GVAR_PNS format["tawvd_slot_%1",_i]; + if(!isNil "_varData") then { + _saveList lbAdd SEL(_varData,0); + _saveList lbSetData [(lbSize _saveList)-1,"true"]; + } else { + _saveList lbAdd format["Save Slot %1",_i]; + _saveList lbSetData [(lbSize _saveList)-1,"false"]; + }; +}; \ No newline at end of file diff --git a/taw_vd/fn_stateTracker.fsm b/taw_vd/fn_stateTracker.fsm new file mode 100644 index 0000000..99faa26 --- /dev/null +++ b/taw_vd/fn_stateTracker.fsm @@ -0,0 +1,196 @@ +/*%FSM*/ +/*%FSM*/ +/* +item0[] = {"init",0,250,-39.234997,-157.457230,50.765003,-107.457222,0.000000,"init"}; +item1[] = {"true",8,218,-39.286701,-67.901810,50.713299,-17.901814,0.000000,"true"}; +item2[] = {"I_am_a_loop__",2,250,-37.913574,2.551729,52.086441,52.551727,0.000000,"I am a loop.."}; +item3[] = {"Dead_Player",4,4314,-137.117889,56.721581,-47.117889,106.721581,0.000000,"Dead Player"}; +item4[] = {"I_am_dead_Set_my",2,250,-215.837250,109.620483,-125.837227,159.620499,0.000000,"I am dead" \n "Set my corpse"}; +item5[] = {"Alive_player",4,218,-215.185760,16.088562,-125.185867,66.088623,0.000000,"Alive player"}; +item6[] = {"Re_add_my_action",2,250,-215.481354,-68.055023,-125.481308,-18.054995,0.000000,"Re-add my" \n "action please"}; +item7[] = {"State_changed",4,218,107.007217,1.512135,197.007202,51.512016,0.000000,"State changed"}; +item8[] = {"Update_me",2,250,107.804337,-67.884735,197.804352,-17.884773,0.000000,"Update me"}; +link0[] = {0,1}; +link1[] = {1,2}; +link2[] = {2,3}; +link3[] = {2,7}; +link4[] = {3,4}; +link5[] = {4,5}; +link6[] = {5,6}; +link7[] = {6,1}; +link8[] = {7,8}; +link9[] = {8,1}; +globals[] = {0.000000,0,0,0,0,640,480,1,12,6316128,1,-604.631348,604.623535,339.349304,-422.033386,1146,884,1}; +window[] = {2,-1,-1,-1,-1,1340,208,1648,580,3,1164}; +*//*%FSM*/ +class FSM +{ + fsmName = "TAW_VD State Tracker"; + class States + { + /*%FSM*/ + class init + { + name = "init"; + itemno = 0; + init = /*%FSM*/"private [""_playerState"",""_corpse"",""_actionID"",""_droneState""];" \n + "" \n + "_playerState = vehicle player;" \n + "_droneState = UAVControl (getConnectedUAV player) select 1;" \n + "tawvd_addon_disable = true;" \n + "" \n + "if(isNil {profileNamespace getVariable ""tawvd_foot""}) then {" \n + " profileNamespace setVariable [""tawvd_foot"",viewDistance];" \n + " profileNamespace setVariable [""tawvd_car"",viewDistance];" \n + " profileNamespace setVariable [""tawvd_air"",viewDistance];" \n + " profileNamespace setVariable [""tawvd_drone"",viewDistance];" \n + " profileNamespace setVariable [""tawvd_object"",viewDistance];" \n + " saveProfileNamespace;" \n + "};" \n + "" \n + "tawvd_foot = profileNamespace getVariable [""tawvd_foot"",viewDistance];" \n + "tawvd_car = profileNamespace getVariable [""tawvd_car"",viewDistance];" \n + "tawvd_air = profileNamespace getVariable [""tawvd_air"",viewDistance];" \n + "tawvd_drone = profileNamespace getVariable [""tawvd_drone"",viewDistance];" \n + "tawvd_object = profileNamespace getVariable [""tawvd_object"",viewDistance];" \n + "" \n + "tawvd_syncObject = true;" \n + "if(!isNil ""ace_interact_menu_fnc_createAction"") then {" \n + " _actionID = [""tawvd_menu"",""View Distance Settings"","""",{[] call TAWVD_fnc_openMenu},{true}] call ace_interact_menu_fnc_createAction;" \n + " [typeOf player, 1, [""ACE_SelfActions""], _actionID] call ace_interact_menu_fnc_addActionToClass;" \n + "} else {" \n + " _actionID = player addAction[""Settings"",TAWVD_fnc_openMenu,[],-99,false,false,"""",''];" \n + "};"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class true + { + itemno = 1; + priority = 0.000000; + to="I_am_a_loop__"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"true"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class I_am_a_loop__ + { + name = "I_am_a_loop__"; + itemno = 2; + init = /*%FSM*/""/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class State_changed + { + itemno = 7; + priority = 0.000000; + to="Update_me"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"(vehicle player != _playerState OR (UAVControl getConnectedUAV player select 1) != _droneState)"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class Dead_Player + { + itemno = 3; + priority = 0.000000; + to="I_am_dead_Set_my"; + precondition = /*%FSM*/"isNil ""ace_interact_menu_fnc_createAction"""/*%FSM*/; + condition=/*%FSM*/"!alive player && isNil ""ace_interact_menu_fnc_createAction"""/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class I_am_dead_Set_my + { + name = "I_am_dead_Set_my"; + itemno = 4; + init = /*%FSM*/"_corpse = player;" \n + "_corpse removeAction _actionID;"/*%FSM*/; + precondition = /*%FSM*/"isNil ""ace_interact_menu_fnc_createAction""" \n + ""/*%FSM*/; + class Links + { + /*%FSM*/ + class Alive_player + { + itemno = 5; + priority = 0.000000; + to="Re_add_my_action"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"alive player"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class Re_add_my_action + { + name = "Re_add_my_action"; + itemno = 6; + init = /*%FSM*/"if(isNil ""ace_interact_menu_fnc_createAction"") then {" \n + " _actionID = player addAction[""Settings"",TAWVD_fnc_openMenu,[],-99,false,false,"""",''];" \n + "};"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class true + { + itemno = 1; + priority = 0.000000; + to="I_am_a_loop__"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"true"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class Update_me + { + name = "Update_me"; + itemno = 8; + init = /*%FSM*/"[] call TAWVD_fnc_updateViewDistance;" \n + "_playerState = vehicle player;" \n + "_droneState = UAVControl (getConnectedUAV player) select 1;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class true + { + itemno = 1; + priority = 0.000000; + to="I_am_a_loop__"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"true"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + }; + initState="init"; + finalStates[] = + { + }; +}; +/*%FSM*/ \ No newline at end of file diff --git a/taw_vd/fn_updateViewDistance.sqf b/taw_vd/fn_updateViewDistance.sqf new file mode 100644 index 0000000..31c0683 --- /dev/null +++ b/taw_vd/fn_updateViewDistance.sqf @@ -0,0 +1,35 @@ +#include "defines.h" +/* + Author: Bryan "Tonic" Boardwine + + Description: + Updates the view distance dependant on whether the player + is on foot, a car or an aircraft. +*/ +private "_dist"; +switch (true) do { + case (!(EQUAL(SEL(UAVControl getConnectedUAV player,1),""))): { + setViewDistance tawvd_drone; + _dist = tawvd_drone; + }; + + case ((vehicle player) isKindOf "Man"): { + setViewDistance tawvd_foot; + _dist = tawvd_foot; + }; + + case (((vehicle player) isKindOf "LandVehicle") || ((vehicle player) isKindOf "Ship")): { + setViewDistance tawvd_car; + _dist = tawvd_car; + }; + + case ((vehicle player) isKindOf "Air"): { + setViewDistance tawvd_air; + _dist = tawvd_air; + }; +}; + +if(tawvd_syncObject) then { + setObjectViewDistance [_dist,100]; + tawvd_object = _dist; +}; \ No newline at end of file -- 2.25.1