Skip to content

Commit

Permalink
Merge pull request #39 from ARCOMM/spect-tracers
Browse files Browse the repository at this point in the history
Spectator tracers & UI
  • Loading branch information
James Kingsley committed Mar 15, 2016
2 parents 24f7cc1 + 5ffeb97 commit daf22ea
Show file tree
Hide file tree
Showing 14 changed files with 845 additions and 530 deletions.
2 changes: 1 addition & 1 deletion ARCMF.VR/.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.4
1.1.5
135 changes: 81 additions & 54 deletions ARCMF.VR/f/spect/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,14 +424,13 @@ class RscSpectButton {
colorText[] = PRIMARYCOLOR;
color[] = {1,1,1,1};
colorBackground[] = BACKGROUND_COLOR;
font = "PuristaLight";
h = 0.039216;
font = "RobotoCondensed";
offsetPressedX = 0;
offsetPressedY = 0;
offsetX = 0;
offsetY = 0;
shadow = 0;
sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.005)";
soundClick[] = {"\A3\ui_f\data\sound\RscSpectButton\soundClick",0.09,1};
soundEnter[] = {"\A3\ui_f\data\sound\RscSpectButton\soundEnter",0.09,1};
soundEscape[] = {"\A3\ui_f\data\sound\RscSpectButton\soundEscape",0.09,1};
Expand All @@ -443,6 +442,7 @@ class RscSpectButton {
tooltipColorShade[] = BACKGROUND_COLOR; // Tooltip background color
tooltipColorText[] = PRIMARYCOLOR; // Tooltip text color
tooltipColorBox[] = BACKGROUND_COLOR; // Tooltip frame color
h = 0.039216;
w = 0.095589;
x = 0;
y = 0;
Expand Down Expand Up @@ -536,37 +536,37 @@ class RscSpectList
arrowEmpty = "";
arrowFull = "";
color[] = {1,1,1,1};
colorActive[] = {1,0,0,0.8};
colorBackground[] = {0,0,0,0.5};
colorDisabled[] = {1,1,1,0.25};
colorActive[] = {0.2,0.2,0.2,1};
colorBackground[] = {0.1,0.1,0.1,1};
colorDisabled[] = {0.1,0.1,0.1,0.5};
colorScrollbar[] = {1,0,0,0};
colorSelect[] = {1,1,1,0.8};
colorSelectBackground[] = {1,1,1,0.7};
colorSelect[] = {1,1,1,1};
colorSelectBackground[] = {0.2,0.2,0.2,1};
colorText[] = {1,1,1,1};
font = "PuristaMedium";
h = 0.035;
maxHistoryDelay = 1;
shadow = 1;
sizeEx = "( ( ( ((safezoneW / safezoneH) min 0.9) / 1.2) / 25) * 1)";
sizeEx = "(((((safezoneW / safezoneH) min 0.9) / 1.2) / 25) * 1)";
soundCollapse[] = {"\A3\ui_f\data\sound\RscCombo\soundCollapse",0.1,1};
soundExpand[] = {"\A3\ui_f\data\sound\RscCombo\soundExpand",0.1,1};
soundSelect[] = {"\A3\ui_f\data\sound\RscCombo\soundSelect",0.1,1};
type = 5;
style = 528;
w = 0.12;
wholeHeight = 0.45;
h = 0.035;
w = 0.12;
x = 0;
y = 0;
class ListScrollBar
{
arrowEmpty = "";
arrowFull = "";
border = "";
color[] = {1,1,1,0};
colorActive[] = {1,1,1,0};
colorDisabled[] = {1,1,1,0.1};
color[] = {1,1,1,0.75};
colorActive[] = {1,1,1,1};
colorDisabled[] = {1,1,1,0.5};
shadow = 0;
thumb = "";
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";
thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa";
};
autoScrollSpeed = 0;
autoScrollDelay = 0;
Expand Down Expand Up @@ -668,17 +668,48 @@ class f_spec_dialog {
};
};
class controls {
class SpecUnitBox: RscSpectList
{
idc = 2100;
x = 0 * safezoneW + safezoneX;
y = 0.03 * safezoneH + safezoneY;
w = 0.15 * safezoneW;
h = 0.97 * safezoneH;
onLBSelChanged = "[""LBListSelChanged"",_this] call f_fnc_EventHandler";
shadow = 0;
font = "RobotoCondensed";
sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.001)";
};
class ToggleUnitListButton: RscSpectButton
{
idc = 5534;
x = 0.15 * safezoneW + safezoneX;
y = 0.041 * safezoneH + safezoneY;
w = 0.02 * safezoneW;
h = 0.03 * safezoneH;
colorBorder[] = {1,1,1,1};
colorBackgroundActive[] = ARCRED;
colorBackgroundDisabled[] = {0.1,0.1,0.1,0.75};
colorDisabled[] = {0.4,0.4,0.4,1};
colorFocused[] = {0.1,0.1,0.1,1};
colorShadow[] = {1,1,1,1};
colorText[] = {1,1,1,1};
color[] = {1,1,1,1};
colorBackground[] = {0.1,0.1,0.1,1};
text = "<<";
onButtonClick = "[_this select 0,6] call f_fnc_HandleMenu";
};
class FilterAIButton: RscSpectButton
{
idc = 2111;
x = 0 * safezoneW + safezoneX;
y = 0 * safezoneH + safezoneY;
w = 0.05 * safezoneW;
h = 0.03 * safezoneH;
text = "All units";
tooltip = "Toggle AI";
sizeEx = "( ( ( ((safezoneW / safezoneH) min 0.9) / 1.2) / 25) * 1)";
text = "SHOW AI (YES)";
onButtonClick = "[_this select 0,0] call f_fnc_HandleMenu";
onMouseEnter = "[_this select 0, true] call f_fnc_AnimButton";
onMouseExit = "[_this select 0, false] call f_fnc_AnimButton";

};
class SideFilterButton: RscSpectButton
Expand All @@ -688,67 +719,63 @@ class f_spec_dialog {
y = 0 * safezoneH + safezoneY;
w = 0.05 * safezoneW;
h = 0.03 * safezoneH;
text = "All Sides";
tooltip = "Filter by side";
sizeEx = "(((((safezoneW / safezoneH) min 0.9) / 1.2) / 25) * 1)";
text = "UNIT LIST (ALL SIDES)";
tooltip = "Filter unit list by side";
onButtonClick = "[_this select 0,1] call f_fnc_HandleMenu";
onMouseEnter = "[_this select 0, true] call f_fnc_AnimButton";
onMouseExit = "[_this select 0, false] call f_fnc_AnimButton";
};
class TagsNameButton: RscSpectButton
{
idc = 2113;
x = 0.1 * safezoneW + safezoneX;
y = 0 * safezoneH + safezoneY;
w = 0.05 * safezoneW;
w = 0.07 * safezoneW;
h = 0.03 * safezoneH;
text = "Tags Off";
text = "TAGS (OFF)";
tooltip = "Filter tags by side/players";
sizeEx = "(((((safezoneW / safezoneH) min 0.9) / 1.2) / 25) * 1)";
onButtonClick = "[_this select 0,2] call f_fnc_HandleMenu";
onMouseEnter = "[_this select 0, true] call f_fnc_AnimButton";
onMouseExit = "[_this select 0, false] call f_fnc_AnimButton";
};
class TracersButton: RscSpectButton
{
idc = 2236;
x = 0.17 * safezoneW + safezoneX;
y = 0 * safezoneH + safezoneY;
w = 0.07 * safezoneW;
h = 0.03 * safezoneH;
text = "3D TRACERS (OFF)";
tooltip = "Warning: May cause major lag";
onButtonClick = "[_this select 0,5] call f_fnc_HandleMenu";
onMouseEnter = "[_this select 0, true] call f_fnc_AnimButton";
onMouseExit = "[_this select 0, false] call f_fnc_AnimButton";
};
class FirstPersonButton: RscSpectButton
{
idc = 2114;
x = 0.15 * safezoneW + safezoneX;
x = 0.22 * safezoneW + safezoneX;
y = 0 * safezoneH + safezoneY;
w = 0.05 * safezoneW;
h = 0.03 * safezoneH;
text = "First Person";
tooltip = "Switch between First Person or Third person";
sizeEx = "(((((safezoneW / safezoneH) min 0.9) / 1.2) / 25) * 1)";
text = "VIEW (FIRST PERSON)";
onButtonClick = "[_this select 0,3] call f_fnc_HandleMenu";
onMouseEnter = "[_this select 0, true] call f_fnc_AnimButton";
onMouseExit = "[_this select 0, false] call f_fnc_AnimButton";
};
class RespawnButton: RscSpectButton
{
idc = 5532;
x = 0.2 * safezoneW + safezoneX;
x = 0.25 * safezoneW + safezoneX;
y = 0 * safezoneH + safezoneY;
w = 0.05 * safezoneW;
h = 0.03 * safezoneH;
text = "Respawn";
text = "RESPAWN";
tooltip = "Respawn back into the game";
sizeEx = "(((((safezoneW / safezoneH) min 0.9) / 1.2) / 25) * 1)";
onButtonClick = "[_this select 0,4] call f_fnc_HandleMenu";
onMouseEnter = "[_this select 0, true] call f_fnc_AnimButton";
onMouseExit = "[_this select 0, false] call f_fnc_AnimButton";
};
class SpecUnitBox: RscSpectList
{
idc = 2100;
x = 0 * safezoneW + safezoneX;
y = 0.03 * safezoneH + safezoneY;
w = 0.1 * safezoneW;
h = 0.97 * safezoneH;
onLBSelChanged = "[""LBListSelChanged"",_this] call F_fnc_EventHandler";
shadow = 0;
font = "PuristaMedium";
};
class SpecText: RscSpectText
{
idc = 1000;
text = "Unknown";
x = 0.430336 * safezoneW + safezoneX;
y = 0.00159198 * safezoneH + safezoneY;
w = 0.800 * safezoneW;
h = 0.0200 * safezoneH;
};
class SpectMap : RscSpectMapControl
{
type = 100;
Expand Down
15 changes: 15 additions & 0 deletions ARCMF.VR/f/spect/fn_AnimButton.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
disableSerialization;

private ["_ctrl","_hover"];

_ctrl = _this select 0;
_hover = _this select 1;
_pos = ctrlPosition _ctrl; // [x, y, w, h]

if (_hover) then {
_ctrl ctrlSetPosition [(_pos select 0), (_pos select 1), (_pos select 2), (_pos select 3) + 0.02];
} else {
_ctrl ctrlSetPosition [(_pos select 0), (_pos select 1), (_pos select 2), (0.03 * safeZoneH)];
};

_ctrl ctrlCommit 0.15;
39 changes: 27 additions & 12 deletions ARCMF.VR/f/spect/fn_CamInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ _this spawn {
lbClear _listBox;
// set inital values.
#include "macros.hpp"
f_cam_controls = [F_CAM_HELPFRAME,F_CAM_HELPBACK,F_CAM_MOUSEHANDLER,F_CAM_UNITLIST,F_CAM_SPECTEXT,F_CAM_HELPCANCEL,F_CAM_HELPCANCEL,F_CAM_MINIMAP,F_CAM_FULLMAP,F_CAM_BUTTIONFILTER,F_CAM_BUTTIONTAGS,F_CAM_BUTTIONTAGSNAME,F_CAM_BUTTIONFIRSTPERSON,F_CAM_BUTTONRESPAWN];
f_cam_controls = [F_CAM_HELPFRAME,F_CAM_HELPBACK,F_CAM_MOUSEHANDLER,F_CAM_UNITLIST,F_CAM_HELPCANCEL,F_CAM_HELPCANCEL,F_CAM_MINIMAP,F_CAM_FULLMAP,F_CAM_BUTTIONFILTER,F_CAM_BUTTIONTAGS,F_CAM_BUTTIONTAGSNAME,F_CAM_BUTTIONFIRSTPERSON,F_CAM_BUTTONRESPAWN,F_CAM_TOGGLELIST,F_CAM_TRACERS];
f_cam_units = [];
f_cam_players = [];
f_cam_startX = 0;
Expand Down Expand Up @@ -102,14 +102,19 @@ _this spawn {
f_cam_muteSpectators = true;

// Menu (Top left)
f_cam_menuControls = [2111,2112,2113,2114,5532];
f_cam_menuControls = [2111,2112,2113,2236,2114,5532];
f_cam_menuShown = true;
f_cam_menuWorking = false;
f_cam_sideButton = 0; // 0 = ALL, 1 = BLUFOR , 2 = OPFOR, 3 = INDFOR , 4 = Civ
f_cam_sideNames = ["All Sides","BLUFOR","OPFOR","INDFOR","CIV"];
f_cam_sideNames = ["UNIT LIST (ALL SIDES)","UNIT LIST (BLUFOR)","UNIT LIST (OPFOR)","UNIT LIST (INDFOR)","UNIT LIST (CIV)"];

f_cam_tagsButton = 0;
f_cam_tagsNames = ["Tags Off","All Sides","All Players","BLUFOR","OPFOR","INDFOR","CIV"];
f_cam_tagsNames = ["TAGS (OFF)","TAGS (ALL SIDES)","TAGS (ALL PLAYERS)","TAGS (BLUFOR)","TAGS (OPFOR)","TAGS (INDFOR)","TAGS (CIV)"];

f_cam_tracersButton = 0;
f_cam_tracersNames = ["3D TRACERS (OFF)", "3D TRACERS (PLAYERS)", "3D TRACERS (AI)", "3D TRACERS (BOTH)"];

f_cam_unitListShow = true;

// Colors
/*
Expand Down Expand Up @@ -168,23 +173,33 @@ _this spawn {
};
_camera
};

#include "tracers.sqf"

// create the UI
createDialog "f_spec_dialog";
// add keyboard events
// hide minimap

((findDisplay 9228) displayCtrl 1350) ctrlShow false;
((findDisplay 9228) displayCtrl 1350) mapCenterOnCamera false;

// hide big map
((findDisplay 9228) displayCtrl 1360) ctrlShow false;
((findDisplay 9228) displayCtrl 1360) mapCenterOnCamera false;
/*

// Auto-size controls
_btnWidth = safeZoneW / (count f_cam_menuControls);
_w = 0 * safeZoneW + safeZoneX;

{
((findDisplay 9228) displayCtrl _x) ctrlSetPosition [_w, (0 * safeZoneH + safeZoneY), _btnWidth, (0.03 * safeZoneH)];
((findDisplay 9228) displayCtrl _x) ctrlCommit 0;
_w = _w + _btnWidth;
} forEach f_cam_menuControls;

if (!(call ARC_fnc_isRespawnEnabled)) then {
((findDisplay 9228) displayCtrl 5532) ctrlEnable false;
((findDisplay 9228) displayCtrl 5532) ctrlShow false;
((findDisplay 9228) displayCtrl 5532) ctrlSetTooltip "Disabled";
} else {
((findDisplay 9228) displayCtrl 5532) ctrlSetTooltip "Respawn back into the game";
};
*/

f_cam_helptext = "<t align='left'><t color='#FFFFFF'><t size='1.5'>Camera</t><br />Hold Right-Click to pan the camera<br />Use the Scroll-Wheel or Numpad +/- to zoom in and out<br />Use Ctrl + Right-Click to change FOV zoom<br />Press Space to toggle freecam<br /><br /><t size='1.5'>Interface</t><br />Press H to toggle the help window<br />Press M to toggle between no map, minimap and full size map<br />Press T to toggle tracers on the map<br />Press I to toggle tags</t></t>";

hintSilent (parseText f_cam_helptext);
Expand Down
5 changes: 4 additions & 1 deletion ARCMF.VR/f/spect/fn_EventHandler.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ switch (_type) do
if (f_cam_mode == 0 || f_cam_mode == 1) then {
f_cam_curTarget = _unit;
if (f_cam_toggleCamera) then {f_cam_curTarget switchCamera "INTERNAL";};
ctrlSetText [1000,format ["%1", name f_cam_curTarget]];
//ctrlSetText [1000,format ["%1", name f_cam_curTarget]];
};

if (f_cam_mode == 3) then {
Expand Down Expand Up @@ -278,19 +278,22 @@ switch (_type) do
case 0: {
ctrlShow [2110, true];
ctrlShow [2010, true];
ctrlShow [5534, true];
ctrlShow [1350, false];
ctrlShow [1360, false];
};
case 1: {
ctrlShow [2110, true];
ctrlShow [2010, true];
ctrlShow [1350, true];
ctrlShow [5534, true];
ctrlShow [1360, false];
};
case 2: {
ctrlShow [2110, false];
ctrlShow [2010, false];
ctrlShow [1350, false];
ctrlShow [5534, false];
ctrlShow [1360, true];

_displayDialog = (findDisplay 9228);
Expand Down
15 changes: 9 additions & 6 deletions ARCMF.VR/f/spect/fn_GetPlayers.sqf
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
private ["_arr"];
_players = [];
_ai = [];

{
if(isNil "f_cam_side" || {side _x == f_cam_side}) then
{
if({isPlayer _x} count (units _x) > 0) then {_players pushBack _x}
else {_ai pushBack _x};
if (isNil "f_cam_side" || {side _x == f_cam_side}) then {
if ({isPlayer _x} count (units _x) > 0) then {
_players pushBack _x
} else {
_ai pushBack _x
};
};
} forEach allGroups;

} foreach allGroups;
[_players,_ai]
[_players, _ai]
Loading

0 comments on commit daf22ea

Please sign in to comment.