From 840d766d83c30414fc23db5f08064ec6e69aa37c Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Thu, 16 Jul 2015 23:58:58 +0100 Subject: [PATCH] Fixing typos, updating interface --- addons/spectator/UI/interface.hpp | 32 ++++++++++++------- .../functions/fnc_handleInterface.sqf | 19 ++++++----- addons/spectator/functions/fnc_handleTree.sqf | 2 +- addons/spectator/functions/fnc_updateView.sqf | 15 ++++----- addons/spectator/script_component.hpp | 15 ++++----- addons/spectator/stringtable.xml | 4 +++ 6 files changed, 50 insertions(+), 37 deletions(-) diff --git a/addons/spectator/UI/interface.hpp b/addons/spectator/UI/interface.hpp index 3a3f3acfad..4996212ce2 100644 --- a/addons/spectator/UI/interface.hpp +++ b/addons/spectator/UI/interface.hpp @@ -1,3 +1,4 @@ +class RscButtonMenu; class RscControlsGroup; class RscMapControl; class RscPicture; @@ -28,11 +29,11 @@ class GVAR(overlay) { }; class controls { class compass: RscControlsGroup { - idc = IDC_TOOL; + idc = IDC_COMP; x = safeZoneX; y = safeZoneY; w = safeZoneW; - h = H_PART(1); + h = TOOL_H; class controls { class compassBack: RscText { x = COMPASS_X; @@ -85,7 +86,7 @@ class GVAR(overlay) { }; }; class nameTool: RscText { - idc = IDC_NAME; + idc = IDC_TOOL_NAME; x = safeZoneX; y = safeZoneY; w = TOOL_W * 2; @@ -100,7 +101,7 @@ class GVAR(overlay) { style = 64; }; class viewTool: nameTool { - idc = IDC_VIEW; + idc = IDC_TOOL_VIEW; x = safeZoneX + TOOL_W * 2 + MARGIN; w = TOOL_W; }; @@ -109,7 +110,7 @@ class GVAR(overlay) { style = 64; }; class clockTool: viewTool { - idc = IDC_CLOCK; + idc = IDC_TOOL_CLOCK; x = safeZoneX + TOOL_W * 3 + MARGIN * 2; }; class clockFrame: clockTool { @@ -117,7 +118,7 @@ class GVAR(overlay) { style = 64; }; class focusTool: viewTool { - idc = IDC_FOCUS; + idc = IDC_TOOL_FOCUS; x = safeZoneX + safeZoneW - TOOL_W * 3 - MARGIN * 2; }; class focusFrame: focusTool { @@ -125,7 +126,7 @@ class GVAR(overlay) { style = 64; }; class fovTool: viewTool { - idc = IDC_FOV; + idc = IDC_TOOL_FOV; x = safeZoneX + safeZoneW - TOOL_W * 2 - MARGIN; }; class fovFrame: fovTool { @@ -133,7 +134,7 @@ class GVAR(overlay) { style = 64; }; class speedTool: viewTool { - idc = IDC_SPEED; + idc = IDC_TOOL_SPEED; x = safeZoneX + safeZoneW - TOOL_W; }; class speedFrame: speedTool { @@ -145,7 +146,7 @@ class GVAR(overlay) { x = safeZoneX; y = safezoneY + TOOL_H * 2; w = TOOL_W * 2; - h = safeZoneH - TOOL_H * 4; + h = safeZoneH - TOOL_H * 5; borderSize = 1; colorBorder[] = {1,1,1,1}; colorBackground[] = {0.1,0.1,0.1,0.8}; @@ -156,9 +157,18 @@ class GVAR(overlay) { 1 }; multiselectEnabled = 0; - maxHistoryDelay = 0; + maxHistoryDelay = -1; onTreeDblClick = QUOTE([ARR_2('onTreeDblClick',_this)] call FUNC(handleInterface)); }; + class unitRefresh: RscButtonMenu { + x = safeZoneX; + y = safeZoneY + safeZoneH - TOOL_H * 3; + w = TOOL_W * 2; + h = TOOL_H; + sizeEx = TOOL_H; + text = CSTRING(RefreshList); + action = QUOTE([] call FUNC(handleTree)); + }; class spectatorMap: RscMapControl { idc = IDC_MAP; x = safeZoneX; @@ -189,7 +199,7 @@ class GVAR(overlay) { "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.8862])", 1 }; - sizeEx = H_PART(1.2); + sizeEx = H_PART(1); text = CSTRING(HelpTitle); }; class helpColumnLeft: RscStructuredText { diff --git a/addons/spectator/functions/fnc_handleInterface.sqf b/addons/spectator/functions/fnc_handleInterface.sqf index 58f042781e..6c1e29286c 100644 --- a/addons/spectator/functions/fnc_handleInterface.sqf +++ b/addons/spectator/functions/fnc_handleInterface.sqf @@ -43,7 +43,8 @@ switch (toLower _mode) do { GVAR(camDolly) = [false,false,false,false]; GVAR(camFocus) = [-1,-1]; GVAR(camFOV) = 0.7; - GVAR(camSpeed) = 0.1; + GVAR(camPos) set [2,20]; + GVAR(camSpeed) = 1; GVAR(camTilt) = -10; GVAR(camZoom) = 3; GVAR(gunCam) = false; @@ -60,6 +61,8 @@ switch (toLower _mode) do { GVAR(camera) setDir GVAR(camPan); [] call FUNC(updateView); + GVAR(camera) camSetFOV GVAR(camFOV); + // Handle camera movement [FUNC(handleCamera), 0] call CBA_fnc_addPerFrameHandler; @@ -129,13 +132,13 @@ switch (toLower _mode) do { (_display displayCtrl IDC_MAP) mapCenterOnCamera false; // Set text values - (_display displayCtrl IDC_FOCUS) ctrlSetText str(GVAR(camFocus)); - (_display displayCtrl IDC_FOV) ctrlSetText str(GVAR(camFOV)); - (_display displayCtrl IDC_SPEED) ctrlSetText format ["%1 m/s",GVAR(camSpeed)]; - (_display displayCtrl IDC_VIEW) ctrlSetText (["FREE","FIRST","THIRD"] select GVAR(camMode)); + (_display displayCtrl IDC_TOOL_FOCUS) ctrlSetText str(GVAR(camFocus)); + (_display displayCtrl IDC_TOOL_FOV) ctrlSetText str(GVAR(camFOV)); + (_display displayCtrl IDC_TOOL_SPEED) ctrlSetText format ["%1 m/s",GVAR(camSpeed)]; + (_display displayCtrl IDC_TOOL_VIEW) ctrlSetText (["FREE","FIRST","THIRD"] select GVAR(camMode)); // Keep unit tree up to date - call FUNC(handleTree); + [] call FUNC(handleTree); // Hacky way to enable keybindings //_display displayAddEventHandler ["KeyUp", {[_this,'keyup'] call CBA_events_fnc_keyHandler}]; @@ -223,8 +226,8 @@ switch (toLower _mode) do { GVAR(camDolly) set [3,true]; }; case 35: { // H - private ["_help","_dsiplay","_show"]; - _help = _dsiplay displayCtrl IDC_HELP; + private ["_help","_show"]; + _help = _display displayCtrl IDC_HELP; _show = !ctrlShown _help; _help ctrlShow _show; diff --git a/addons/spectator/functions/fnc_handleTree.sqf b/addons/spectator/functions/fnc_handleTree.sqf index fce039a7a2..730dfde312 100644 --- a/addons/spectator/functions/fnc_handleTree.sqf +++ b/addons/spectator/functions/fnc_handleTree.sqf @@ -31,7 +31,7 @@ _ctrl = _display displayCtrl IDC_TREE; _curSelData = _ctrl tvData (tvCurSel _ctrl); // Clear the tree -_ctrl tvDelete []; +tvClear _ctrl; // Update the tree _cachedGrps = []; diff --git a/addons/spectator/functions/fnc_updateView.sqf b/addons/spectator/functions/fnc_updateView.sqf index db85bdf6ae..fbf58b7f7c 100644 --- a/addons/spectator/functions/fnc_updateView.sqf +++ b/addons/spectator/functions/fnc_updateView.sqf @@ -8,26 +8,24 @@ if (_newMode != GVAR(camMode)) then { GVAR(camMode) = _newMode; }; -GVAR(camera) camSetFOV GVAR(camFOV); +// When no units available to spectate, exit to freecam +if (GVAR(unitList) isEqualTo []) then { + GVAR(camMode) = 0; +}; -if (_newMode == 0) then { // Free +if (GVAR(camMode) == 0) then { // Free GVAR(camera) cameraEffect ["internal", "back"]; // HUD stuff showCinemaBorder false; cameraEffectEnableHUD false; } else { - // When no units available to spectate, exit to freecam - if (unitList isEqualTo []) exitWith { - [0] call FUNC(updateView); - }; - // First ensure valid unit is selected if !(GVAR(camUnit) in GVAR(unitList)) then { GVAR(camUnit) = GVAR(unitList) select floor(random(count GVAR(unitList))); }; - if (_newMode == 1) then { // Internal + if (GVAR(camMode) == 1) then { // Internal // Handle gun cam if (GVAR(gunCam)) then { GVAR(camUnit) switchCamera "gunner"; @@ -42,4 +40,3 @@ if (_newMode == 0) then { // Free GVAR(camera) cameraEffect ["terminate", "back"]; cameraEffectEnableHUD true; }; - diff --git a/addons/spectator/script_component.hpp b/addons/spectator/script_component.hpp index 5fd73a6b3f..d6163b1afd 100644 --- a/addons/spectator/script_component.hpp +++ b/addons/spectator/script_component.hpp @@ -29,21 +29,20 @@ #define COMPASS_X (safeZoneW * 0.5 - (COMPASS_W * 0.5)) // IDCs -#define IDC_TOOL 3670 +#define IDC_TOOL 3000 #define IDC_COMP 4490 #define IDC_TREE 6187 #define IDC_MAP 6791 #define IDC_HELP 7631 -#define IDC_TOOL_CLOCK 3002 -#define IDC_TOOL_FOCUS 3003 -#define IDC_TOOL_FOV 3004 -#define IDC_TOOL_NAME 3000 -#define IDC_TOOL_SPEED 3005 -#define IDC_TOOL_VIEW 3001 +#define IDC_TOOL_CLOCK 3003 +#define IDC_TOOL_FOCUS 3004 +#define IDC_TOOL_FOV 3005 +#define IDC_TOOL_NAME 3001 +#define IDC_TOOL_SPEED 3006 +#define IDC_TOOL_VIEW 3002 #define IDC_COMP_0 5000 #define IDC_COMP_90 5090 #define IDC_COMP_180 5180 #define IDC_COMP_270 5270 - diff --git a/addons/spectator/stringtable.xml b/addons/spectator/stringtable.xml index 5963481b46..6c0aa3e534 100644 --- a/addons/spectator/stringtable.xml +++ b/addons/spectator/stringtable.xml @@ -67,9 +67,13 @@ Ukončit misi když umřou všichni hráči (výchozí BIS chování)? + Spectator Controls + + Refresh List +