Skip to content

Commit eae0e9f

Browse files
committed
[scripts] upgrade TAW-VD
1 parent 9d87165 commit eae0e9f

File tree

5 files changed

+200
-50
lines changed

5 files changed

+200
-50
lines changed

source/taw_vd/dialog.hpp

Lines changed: 150 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,105 @@
11
/*
22
ArmA 3 TAW View Distance Management
3-
Resource Definesby Sa-Matra
43
*/
4+
#define ST_LEFT 0x00
5+
#define ST_MULTI 0x10
6+
#define GUI_GRID_CENTER_WAbs ((safezoneW / safezoneH) min 1.2)
7+
#define GUI_GRID_CENTER_HAbs (GUI_GRID_CENTER_WAbs / 1.2)
8+
#define GUI_GRID_CENTER_W (GUI_GRID_CENTER_WAbs / 40)
9+
#define GUI_GRID_CENTER_H (GUI_GRID_CENTER_HAbs / 25)
10+
#define GUI_GRID_CENTER_X (safezoneX + (safezoneW - GUI_GRID_CENTER_WAbs)/2)
11+
#define GUI_GRID_CENTER_Y (safezoneY + (safezoneH - GUI_GRID_CENTER_HAbs)/2)
512

13+
class TAWVD_Checkbox
14+
{
15+
access = 0; // Control access (0 - ReadAndWrite, 1 - ReadAndCreate, 2 - ReadOnly, 3 - ReadOnlyVerified)
16+
idc = -1; // Control identification (without it, the control won't be displayed)
17+
type = 77; // Type
18+
style = ST_LEFT + ST_MULTI; // Style
19+
default = 0; // Control selected by default (only one within a display can be used)
20+
blinkingPeriod = 0; // Time in which control will fade out and back in. Use 0 to disable the effect.
21+
22+
x = 0;
23+
y = 0;
24+
w = 1 * GUI_GRID_CENTER_W; // Width
25+
h = 1 * GUI_GRID_CENTER_H; // Height
26+
27+
//Colors
28+
color[] = { 1, 1, 1, 0.7 }; // Texture color
29+
colorFocused[] = { 1, 1, 1, 1 }; // Focused texture color
30+
colorHover[] = { 1, 1, 1, 1 }; // Mouse over texture color
31+
colorPressed[] = { 1, 1, 1, 1 }; // Mouse pressed texture color
32+
colorDisabled[] = { 1, 1, 1, 0.2 }; // Disabled texture color
33+
34+
//Background colors
35+
colorBackground[] = { 0, 0, 0, 0 }; // Fill color
36+
colorBackgroundFocused[] = { 0, 0, 0, 0 }; // Focused fill color
37+
colorBackgroundHover[] = { 0, 0, 0, 0 }; // Mouse hover fill color
38+
colorBackgroundPressed[] = { 0, 0, 0, 0 }; // Mouse pressed fill color
39+
colorBackgroundDisabled[] = { 0, 0, 0, 0 }; // Disabled fill color
40+
41+
//Textures
42+
textureChecked = "\A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_checked_ca.paa"; //Texture of checked CheckBox.
43+
textureUnchecked = "\A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_unchecked_ca.paa"; //Texture of unchecked CheckBox.
44+
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).
45+
textureFocusedUnchecked = "\A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_unchecked_ca.paa"; //Texture of unchecked focused CheckBox.
46+
textureHoverChecked = "\A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_checked_ca.paa";
47+
textureHoverUnchecked = "\A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_unchecked_ca.paa";
48+
texturePressedChecked = "\A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_checked_ca.paa";
49+
texturePressedUnchecked = "\A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_unchecked_ca.paa";
50+
textureDisabledChecked = "\A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_checked_ca.paa";
51+
textureDisabledUnchecked = "\A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_unchecked_ca.paa";
52+
53+
tooltip = ""; // Tooltip text
54+
tooltipColorShade[] = { 0, 0, 0, 1 }; // Tooltip background color
55+
tooltipColorText[] = { 1, 1, 1, 1 }; // Tooltip text color
56+
tooltipColorBox[] = { 1, 1, 1, 1 }; // Tooltip frame color
57+
58+
//Sounds
59+
soundClick[] = { "\A3\ui_f\data\sound\RscButton\soundClick", 0.09, 1 }; // Sound played after control is activated in format {file, volume, pitch}
60+
soundEnter[] = { "\A3\ui_f\data\sound\RscButton\soundEnter", 0.09, 1 }; // Sound played when mouse cursor enters the control
61+
soundPush[] = { "\A3\ui_f\data\sound\RscButton\soundPush", 0.09, 1 }; // Sound played when the control is pushed down
62+
soundEscape[] = { "\A3\ui_f\data\sound\RscButton\soundEscape", 0.09, 1 }; // Sound played when the control is released after pushing down
63+
64+
};
665
class TAWVD_RscShortcutButton {
766
idc = -1;
867
style = 0;
968
default = 0;
1069
shadow = 1;
1170
w = 0.183825;
1271
h = "( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 20)";
13-
color[] = {1, 1, 1, 1.0};
14-
color2[] = {0.95, 0.95, 0.95, 1};
15-
colorDisabled[] = {1, 1, 1, 0.25};
16-
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])", 1};
17-
colorBackground2[] = {1, 1, 1, 1};
72+
color[] = {1,1,1,1.0};
73+
colorFocused[] = {1,1,1,1.0};
74+
color2[] = {0.95,0.95,0.95,1};
75+
colorDisabled[] = {1,1,1,0.25};
76+
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};
77+
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};
78+
colorBackground2[] = {1,1,1,1};
1879
animTextureDefault = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\normal_ca.paa";
1980
animTextureNormal = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\normal_ca.paa";
20-
animTextureDisabled = "\A3\ui_f\data\GUI\scCommon\RscShortcutButton\normal_ca.paa";
81+
animTextureDisabled = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\normal_ca.paa";
2182
animTextureOver = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\over_ca.paa";
2283
animTextureFocused = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\focus_ca.paa";
2384
animTexturePressed = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\down_ca.paa";
24-
textureNoShortcut = "#(argb,8,8,3)color(0,0,0,0)";
2585
periodFocus = 1.2;
2686
periodOver = 0.8;
27-
28-
class HitZone {
87+
class HitZone
88+
{
2989
left = 0.0;
3090
top = 0.0;
3191
right = 0.0;
3292
bottom = 0.0;
3393
};
34-
35-
class ShortcutPos {
94+
class ShortcutPos
95+
{
3696
left = 0;
3797
top = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 20) - ( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)) / 2";
3898
w = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1) * (3/4)";
3999
h = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
40100
};
41-
42-
class TextPos {
101+
class TextPos
102+
{
43103
left = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1) * (3/4)";
44104
top = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 20) - ( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)) / 2";
45105
right = 0.005;
@@ -50,20 +110,20 @@ class TAWVD_RscShortcutButton {
50110
size = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
51111
sizeEx = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
52112
text = "";
53-
soundEnter[] = {"\A3\ui_f\data\sound\onover", 0.09, 1};
54-
soundPush[] = {"\A3\ui_f\data\sound\new1", 0.0, 0};
55-
soundClick[] = {"\A3\ui_f\data\sound\onclick", 0.07, 1};
56-
soundEscape[] = {"\A3\ui_f\data\sound\onescape", 0.09, 1};
113+
soundEnter[] = {"\A3\ui_f\data\sound\RscButton\soundEnter",0.09,1};
114+
soundPush[] = {"\A3\ui_f\data\sound\RscButton\soundPush",0.09,1};
115+
soundClick[] = {"\A3\ui_f\data\sound\RscButton\soundClick",0.09,1};
116+
soundEscape[] = {"\A3\ui_f\data\sound\RscButton\soundEscape",0.09,1};
57117
action = "";
58-
59-
class Attributes {
118+
class Attributes
119+
{
60120
font = "PuristaMedium";
61121
color = "#E5E5E5";
62122
align = "left";
63123
shadow = "true";
64124
};
65-
66-
class AttributesImage {
125+
class AttributesImage
126+
{
67127
font = "PuristaMedium";
68128
color = "#E5E5E5";
69129
align = "left";
@@ -106,42 +166,52 @@ class TAWVD_RscButtonMenu : TAWVD_RscShortcutButton {
106166
h = 0.039216;
107167
animTextureNormal = "#(argb,8,8,3)color(1,1,1,1)";
108168
animTextureDisabled = "#(argb,8,8,3)color(1,1,1,1)";
109-
animTextureOver = "#(argb,8,8,3)color(1,1,1,0.5)";
169+
animTextureOver = "#(argb,8,8,3)color(1,1,1,1)";
110170
animTextureFocused = "#(argb,8,8,3)color(1,1,1,1)";
111171
animTexturePressed = "#(argb,8,8,3)color(1,1,1,1)";
112172
animTextureDefault = "#(argb,8,8,3)color(1,1,1,1)";
113-
colorBackground[] = {0, 0, 0, 0.8};
114-
colorBackground2[] = {1, 1, 1, 0.5};
115-
color[] = {1, 1, 1, 1};
116-
color2[] = {1, 1, 1, 1};
117-
colorText[] = {1, 1, 1, 1};
118-
colorDisabled[] = {1, 1, 1, 0.25};
173+
colorBackground[] = {0,0,0,0.8};
174+
colorBackgroundFocused[] = {1,1,1,1};
175+
colorBackground2[] = {0.75,0.75,0.75,1};
176+
color[] = {1,1,1,1};
177+
colorFocused[] = {0,0,0,1};
178+
color2[] = {0,0,0,1};
179+
colorText[] = {1,1,1,1};
180+
colorDisabled[] = {1,1,1,0.25};
119181
period = 1.2;
120182
periodFocus = 1.2;
121183
periodOver = 1.2;
122184
size = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
123185
sizeEx = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
124-
125-
class TextPos {
186+
tooltipColorText[] = {1,1,1,1};
187+
tooltipColorBox[] = {1,1,1,1};
188+
tooltipColorShade[] = {0,0,0,0.65};
189+
class TextPos
190+
{
126191
left = "0.25 * ( ((safezoneW / safezoneH) min 1.2) / 40)";
127192
top = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) - ( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)) / 2";
128193
right = 0.005;
129194
bottom = 0.0;
130195
};
131-
132-
class Attributes {
196+
class Attributes
197+
{
133198
font = "PuristaLight";
134199
color = "#E5E5E5";
135200
align = "left";
136201
shadow = "false";
137202
};
138-
139-
class ShortcutPos {
203+
class ShortcutPos
204+
{
140205
left = "(6.25 * ( ((safezoneW / safezoneH) min 1.2) / 40)) - 0.0225 - 0.005";
141206
top = 0.005;
142207
w = 0.0225;
143208
h = 0.03;
144209
};
210+
soundEnter[] = {"\A3\ui_f\data\sound\RscButtonMenu\soundEnter",0.09,1};
211+
soundPush[] = {"\A3\ui_f\data\sound\RscButtonMenu\soundPush",0.09,1};
212+
soundClick[] = {"\A3\ui_f\data\sound\RscButtonMenu\soundClick",0.09,1};
213+
soundEscape[] = {"\A3\ui_f\data\sound\RscButtonMenu\soundEscape",0.09,1};
214+
textureNoShortcut = "";
145215
};
146216

147217
class TAWVD_RscXSliderH
@@ -213,7 +283,7 @@ class TAW_VD
213283
x = 0.3;
214284
y = 0.2 + (11 / 250);
215285
w = 0.5;
216-
h = 0.4 - (22 / 250);
286+
h = 0.57 - (22 / 250);
217287
};
218288

219289
class VDonFoot : TAWVD_RscText
@@ -242,6 +312,12 @@ class TAW_VD
242312
x = 0.32; y = 0.355;
243313
w = 0.275; h = 0.04;
244314
};
315+
316+
class VDObject : VDinAir
317+
{
318+
text = "Object:";
319+
y = 0.655;
320+
};
245321

246322
class VDTerrSet : TAWVD_RscText
247323
{
@@ -256,6 +332,12 @@ class TAW_VD
256332
h = (1 / 25);
257333
};
258334

335+
class VDObjectSet : VDTerrSet
336+
{
337+
text = "Object Settings";
338+
y = 0.55;
339+
};
340+
259341
};
260342

261343
class controls
@@ -335,6 +417,37 @@ class TAW_VD
335417
x = 0.70; y = 0.36;
336418
w = 0.275; h = 0.04;
337419
};
420+
421+
class ObjectSyncCheckbox : TAWVD_Checkbox
422+
{
423+
idc = 2931;
424+
x = 0.32; y = 0.6;
425+
tooltip = "Sync object rendering with view rendering";
426+
onCheckedChanged = "if((_this select 1) == 1) then {tawvd_syncObject = true;ctrlEnable [2941,false];} else {tawvd_syncObject = false; ctrlEnable [2941,true];};";
427+
428+
};
429+
430+
class ObjectSyncText : TAWVD_RscText
431+
{
432+
idc = -1;
433+
text = "Sync with view";
434+
x = 0.345; y = 0.596;
435+
w = 0.35; h = 0.04;
436+
};
437+
438+
class VD_object_slider : VD_air_slider
439+
{
440+
idc = 2941;
441+
onSliderPosChanged = "[3,_this select 1] call TAWVD_fnc_onSliderChange;";
442+
tooltip = "Object rendering distance";
443+
y = 0.70 - (1 / 25);
444+
};
445+
446+
class VD_Object_Value : VD_air_value
447+
{
448+
idc = 2942;
449+
y = 0.656;
450+
};
338451

339452
class VD_terr_none : TAWVD_activeText
340453
{
@@ -386,7 +499,7 @@ class TAW_VD
386499
text = "Close";
387500
onButtonClick = "closeDialog 0;";
388501
x = 0.48;
389-
y = 0.6 - (1 / 25);
502+
y = 0.77 - (1 / 25);
390503
w = (6.25 / 40);
391504
h = (1 / 25);
392505
};

source/taw_vd/fn_onSliderChange.sqf

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,32 @@ switch (_mode) do
1616
case 0:
1717
{
1818
tawvd_foot = round(_value);
19-
ctrlSetText[2902,format["%1",round(_value)]];
19+
ctrlSetText[2902,format["%1",tawvd_foot]];
2020
[] call TAWVD_fnc_updateViewDistance;
2121
};
2222

2323
case 1:
2424
{
2525
tawvd_car = round(_value);
26-
ctrlSetText[2912,format["%1",round(_value)]];
26+
ctrlSetText[2912,format["%1",tawvd_car]];
2727
[] call TAWVD_fnc_updateViewDistance;
2828
};
2929

3030
case 2:
3131
{
3232
tawvd_air = round(_value);
33-
ctrlSetText[2922,format["%1",round(_value)]];
33+
ctrlSetText[2922,format["%1",tawvd_air]];
3434
[] call TAWVD_fnc_updateViewDistance;
3535
};
36+
37+
case 3: {
38+
tawvd_object = round(_value);
39+
ctrlSetText[2942,format["%1",tawvd_object]];
40+
setObjectViewDistance [tawvd_object,100];
41+
};
42+
};
43+
44+
if(tawvd_syncObject) then {
45+
sliderSetPosition[2941, tawvd_object];
46+
ctrlSetText[2942,format["%1",tawvd_object]];
3647
};

source/taw_vd/fn_openTAWVD.sqf

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,19 @@ disableSerialization;
1111
ctrlSetText[2902, format["%1", tawvd_foot]];
1212
ctrlSetText[2912, format["%1", tawvd_car]];
1313
ctrlSetText[2922, format["%1", tawvd_air]];
14+
ctrlSetText[2942, format["%1", tawvd_object]];
1415

15-
//Setup Sliders range
16-
{ slidersetRange [_x,100,12000];} foreach [2901,2911,2921];
17-
//Setup Sliders speed
18-
{ ((findDisplay 2900) displayCtrl _x) sliderSetSpeed [100,100,100]; } foreach [2901,2911,2921];
19-
//Setup Sliders position
16+
//Setup the sliders
2017
{
18+
slidersetRange [_x select 0,100,12000];
19+
((findDisplay 2900) displayCtrl (_x select 0)) sliderSetSpeed [100,100,100];
2120
sliderSetPosition[_x select 0, _x select 1];
22-
} foreach [[2901,tawvd_foot],[2911,tawvd_car],[2921,tawvd_air]];
21+
} foreach [[2901,tawvd_foot],[2911,tawvd_car],[2921,tawvd_air],[2941,tawvd_object]];
22+
23+
((finddisplay 2900) displayCtrl 2931) cbSetChecked tawvd_syncObject;
24+
25+
if(tawvd_syncObject) then {
26+
ctrlEnable [2941,false];
27+
} else {
28+
ctrlEnable [2941,true];
29+
};

source/taw_vd/fn_tawvdInit.sqf

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@
33
Author: Bryan "Tonic" Boardwine
44
55
Description:
6-
Master init for TAW View Distance (Addon version). If the script verson is present it will exit.
6+
Master init for TAW View Distance (Addon version).
7+
If the script verson is present it will exit.
78
*/
89
if(!isMultiplayer) exitWith {};
910
tawvd_foot = viewDistance;
1011
tawvd_car = viewDistance;
1112
tawvd_air = viewDistance;
13+
tawvd_syncObject = true; //Enable the automatic syncing of Object View rendering with the current view distance.
14+
tawvd_object = tawvd_foot;
15+
1216
tawvd_addon_disable = true;
1317
//The hacky method... Apparently if you stall (sleep or waitUntil) with CfgFunctions you stall the mission initialization process... Good job BIS, why wouldn't you spawn it via preInit or postInit?
1418
[] spawn

0 commit comments

Comments
 (0)