Improve spectator focus widget (#5452)

* Optimize widget updates
* Improve focus widget vehicle position display
* Remove insignia from widget
* Add current throwable to widget
* Fix padding/spacing of widget items
* Fix incorrect vehicle cargo icon being used
This commit is contained in:
SilentSpike 2017-08-26 19:16:24 +01:00 committed by GitHub
parent 78fafc93cb
commit 4afcc546e7
3 changed files with 113 additions and 86 deletions

View File

@ -18,7 +18,8 @@
#define IMG_COMMANDER "a3\Ui_f\data\IGUI\Cfg\CommandBar\imageCommander_ca.paa" #define IMG_COMMANDER "a3\Ui_f\data\IGUI\Cfg\CommandBar\imageCommander_ca.paa"
#define IMG_DRIVER "a3\Ui_f\data\IGUI\Cfg\CommandBar\imageDriver_ca.paa" #define IMG_DRIVER "a3\Ui_f\data\IGUI\Cfg\CommandBar\imageDriver_ca.paa"
#define IMG_GUNNER "a3\Ui_f\data\IGUI\Cfg\CommandBar\imageGunner_ca.paa" #define IMG_GUNNER "a3\Ui_f\data\IGUI\Cfg\CommandBar\imageGunner_ca.paa"
#define IMG_CARGO "a3\Ui_f\data\IGUI\Cfg\CommandBar\imageCommander_ca.paa" #define IMG_CARGO "a3\Ui_f\data\IGUI\Cfg\CommandBar\imageCargo_ca.paa"
#define IMG_UNARMED "" // TODO: Find suitable unarmed icon
// Hide if no target or widget is toggled off // Hide if no target or widget is toggled off
if (!GVAR(uiWidgetVisible) || {isNull GVAR(camTarget)}) exitWith {CTRL_WIDGET ctrlShow false}; if (!GVAR(uiWidgetVisible) || {isNull GVAR(camTarget)}) exitWith {CTRL_WIDGET ctrlShow false};
@ -28,41 +29,60 @@ private _focus = GVAR(camTarget);
private _name = ([_focus] call EFUNC(common,getName)) select [0, NAME_MAX_CHARACTERS]; private _name = ([_focus] call EFUNC(common,getName)) select [0, NAME_MAX_CHARACTERS];
if !(isPlayer _focus) then { _name = format ["%1: %2", localize "str_player_ai", _name]; }; if !(isPlayer _focus) then { _name = format ["%1: %2", localize "str_player_ai", _name]; };
private _unitTypePicture = [_focus] call EFUNC(common,getVehicleIcon); private _unitTypePicture = "";
private _vehicleTypePicture = getText (configFile >> "CfgVehicles" >> typeOf vehicle _focus >> "Picture"); private _vehicleTypePicture = "";
private _insigniaTexture = ["GetGroupTexture", [group _focus]] call BIS_fnc_dynamicGroups; private _vehiclePositionPicture = "";
if (_focus != vehicle _focus) then {
_vehicleTypePicture = getText (configFile >> "CfgVehicles" >> typeOf vehicle _focus >> "Picture");
_vehiclePositionPicture = switch (_focus) do {
case (commander vehicle _focus): {IMG_COMMANDER};
case (driver vehicle _focus): {IMG_DRIVER};
case (gunner vehicle _focus): {IMG_GUNNER};
default {IMG_CARGO};
};
} else {
_unitTypePicture = [_focus] call EFUNC(common,getVehicleIcon);
};
private _weapon = currentWeapon _focus; private _weapon = currentWeapon _focus;
private _weaponPicture = if (_weapon != "") then { private _weaponPicture = if (_weapon != "") then {
getText (configFile >> "CfgWeapons" >> _weapon >> "Picture"); getText (configFile >> "CfgWeapons" >> _weapon >> "Picture")
} else { } else {
if (_focus != vehicle _focus) then { IMG_UNARMED
if (commander vehicle _focus == _focus) exitWith {IMG_COMMANDER};
if (driver vehicle _focus == _focus) exitWith {IMG_DRIVER};
if (gunner vehicle _focus == _focus) exitWith {IMG_GUNNER};
IMG_CARGO
} else {""};
}; };
(getPlayerScores _focus) params [["_kills",0,[0]], ["_softKills",0,[0]], ["_armoredKills",0,[0]], ["_airKills",0,[0]], ["_deaths",0,[0]], ["_total",0,[0]]]; private _throwable = (currentThrowable _focus) param [0,""];
private _throwablePicture = if (_throwable != "") then {
getText (configFile >> "CfgMagazines" >> _throwable >> "Picture")
} else {
IMG_UNARMED
};
(getPlayerScores _focus) params [
["_kills",0,[0]],
["_softKills",0,[0]],
["_armoredKills",0,[0]],
["_airKills",0,[0]],
["_deaths",0,[0]],
["_total",0,[0]]
];
CTRL_WIDGET_NAME ctrlSetText _name; CTRL_WIDGET_NAME ctrlSetText _name;
CTRL_WIDGET_AVATAR ctrlSetText _insigniaTexture;
CTRL_WIDGET_KILLS ctrlSetText str _kills; CTRL_WIDGET_KILLS ctrlSetText str _kills;
CTRL_WIDGET_LAND ctrlSetText str _softKills; CTRL_WIDGET_LAND ctrlSetText str _softKills;
CTRL_WIDGET_ARMORED ctrlSetText str _armoredKills; CTRL_WIDGET_ARMORED ctrlSetText str _armoredKills;
CTRL_WIDGET_AIR ctrlSetText str _airKills; CTRL_WIDGET_AIR ctrlSetText str _airKills;
CTRL_WIDGET_DEATHS ctrlSetText str _deaths; CTRL_WIDGET_DEATHS ctrlSetText str _deaths;
CTRL_WIDGET_TOTAL ctrlSetText str _total; CTRL_WIDGET_TOTAL ctrlSetText str _total;
CTRL_WIDGET_WEAPON ctrlSetText _weaponPicture; CTRL_WIDGET_WEAPON ctrlSetText _weaponPicture;
CTRL_WIDGET_THROWABLE ctrlSetText _throwablePicture;
CTRL_WIDGET_UNIT ctrlSetText (["",_unitTypePicture] select (vehicle _focus == _focus)); CTRL_WIDGET_UNIT ctrlSetText _unitTypePicture;
CTRL_WIDGET_UNIT ctrlShow (vehicle _focus == _focus); CTRL_WIDGET_VEHICLE ctrlSetText _vehicleTypePicture;
CTRL_WIDGET_VEHICLE ctrlSetText (["",_vehicleTypePicture] select (vehicle _focus != _focus)); CTRL_WIDGET_VEHICLE_POS ctrlSetText _vehiclePositionPicture;
CTRL_WIDGET_VEHICLE ctrlShow (vehicle _focus != _focus);
CTRL_WIDGET_WEAPON ctrlShow (_weaponPicture != "");
CTRL_WIDGET_WEAPON_BACK ctrlShow (_weaponPicture != "");
// Handle widget toggling // Handle widget toggling
if !(ctrlShown CTRL_WIDGET) then { if !(ctrlShown CTRL_WIDGET) then {

View File

@ -120,8 +120,8 @@
#define CTRL_WIDGET_UNIT (SPEC_DISPLAY displayCtrl IDC_WIDGET_UNIT) #define CTRL_WIDGET_UNIT (SPEC_DISPLAY displayCtrl IDC_WIDGET_UNIT)
#define IDC_WIDGET_NAME 60033 #define IDC_WIDGET_NAME 60033
#define CTRL_WIDGET_NAME (SPEC_DISPLAY displayCtrl IDC_WIDGET_NAME) #define CTRL_WIDGET_NAME (SPEC_DISPLAY displayCtrl IDC_WIDGET_NAME)
#define IDC_WIDGET_AVATAR 60034 #define IDC_WIDGET_VEHICLE_POS 60034
#define CTRL_WIDGET_AVATAR (SPEC_DISPLAY displayCtrl IDC_WIDGET_AVATAR) #define CTRL_WIDGET_VEHICLE_POS (SPEC_DISPLAY displayCtrl IDC_WIDGET_VEHICLE_POS)
#define IDC_WIDGET_KILLS 60035 #define IDC_WIDGET_KILLS 60035
#define CTRL_WIDGET_KILLS (SPEC_DISPLAY displayCtrl IDC_WIDGET_KILLS) #define CTRL_WIDGET_KILLS (SPEC_DISPLAY displayCtrl IDC_WIDGET_KILLS)
#define IDC_WIDGET_LAND 60036 #define IDC_WIDGET_LAND 60036
@ -136,5 +136,5 @@
#define CTRL_WIDGET_TOTAL (SPEC_DISPLAY displayCtrl IDC_WIDGET_TOTAL) #define CTRL_WIDGET_TOTAL (SPEC_DISPLAY displayCtrl IDC_WIDGET_TOTAL)
#define IDC_WIDGET_WEAPON 60041 #define IDC_WIDGET_WEAPON 60041
#define CTRL_WIDGET_WEAPON (SPEC_DISPLAY displayCtrl IDC_WIDGET_WEAPON) #define CTRL_WIDGET_WEAPON (SPEC_DISPLAY displayCtrl IDC_WIDGET_WEAPON)
#define IDC_WIDGET_WEAPON_BACK 60042 #define IDC_WIDGET_THROWABLE 60042
#define CTRL_WIDGET_WEAPON_BACK (SPEC_DISPLAY displayCtrl IDC_WIDGET_WEAPON_BACK) #define CTRL_WIDGET_THROWABLE (SPEC_DISPLAY displayCtrl IDC_WIDGET_THROWABLE)

View File

@ -259,112 +259,111 @@ class GVAR(display) {
}; };
class FocusInfo: RscControlsGroupNoScrollbars { class FocusInfo: RscControlsGroupNoScrollbars {
idc = IDC_WIDGET; idc = IDC_WIDGET;
x = X_PART(12.1); x = X_PART(12.9);
y = Y_PART(24); y = Y_PART(24);
w = W_PART(16); w = W_PART(14.2);
h = H_PART(3.5); h = H_PART(3.5);
class controls { class controls {
class UpperBackground: RscText { class UpperBackground: RscText {
x = W_PART(3.5); x = 0;
y = 0; y = 0;
w = W_PART(12.4); w = W_PART(14.2);
h = H_PART(1.4); h = H_PART(1.4);
colorBackground[] = {0,0,0,0.75}; colorBackground[] = {0,0,0,0.75};
}; };
class LowerLeftBackground: RscText { class StatsBackground: RscText {
idc = CTRL_WIDGET_WEAPON_BACK; x = 0;
x = W_PART(9.8);
y = H_PART(1.5); y = H_PART(1.5);
w = W_PART(6.1); w = W_PART(6);
h = H_PART(2);
colorBackground[] = {0,0,0,0.75};
};
class WeaponBackground: RscText {
x = W_PART(6.1);
y = H_PART(1.5);
w = W_PART(6);
h = H_PART(2); h = H_PART(2);
colorBackground[] = {1,1,1,0.4}; colorBackground[] = {1,1,1,0.4};
}; };
class LowerRightBackground: RscText { class ThrowableBackground: RscText {
x = W_PART(3.5); x = W_PART(12.2);
y = H_PART(1.5); y = H_PART(1.5);
w = W_PART(6.2); w = W_PART(2);
h = H_PART(2); h = H_PART(2);
colorBackground[] = {0,0,0,0.75}; colorBackground[] = {1,1,1,0.4};
};
class AvatarBackground: RscText {
x = W_PART(-0.2);
y = 0;
w = W_PART(3.6);
h = H_PART(3.5);
colorBackground[] = {0,0,0,0.75};
};
class VehicleType: RscPicture {
idc = IDC_WIDGET_VEHICLE;
text = "\A3\ui_f\data\map\vehicleicons\iconMan_ca.paa";
x = W_PART(13.5);
y = H_PART(0.3);
w = W_PART(2.1);
h = H_PART(1);
};
class UnitType: RscPictureKeepAspect {
idc = IDC_WIDGET_UNIT;
text = "\A3\ui_f\data\map\vehicleicons\iconMan_ca.paa";
x = W_PART(14.6);
y = H_PART(0.3);
w = W_PART(1);
h = H_PART(1);
}; };
class Name: RscText { class Name: RscText {
shadow = 0; shadow = 0;
idc = IDC_WIDGET_NAME; idc = IDC_WIDGET_NAME;
text = ""; text = "";
x = W_PART(3.6); x = W_PART(0.1);
y = 0; y = H_PART(0.1);
w = W_PART(9.9); w = W_PART(10.8);
h = H_PART(1.4); h = H_PART(1.2);
sizeEx = H_PART(1); sizeEx = H_PART(1);
}; };
class Avatar: RscPictureKeepAspect { class VehiclePos: RscPictureKeepAspect {
idc = IDC_WIDGET_AVATAR; idc = IDC_WIDGET_VEHICLE_POS;
text = "a3\Ui_f\data\GUI\Cfg\UnitInsignia\bi_ca.paa"; text = "";
x = 0; x = W_PART(11);
y = H_PART(0.3); y = H_PART(0.2);
w = W_PART(3.2); w = W_PART(1);
h = H_PART(2.9); h = H_PART(1);
};
class VehicleType: RscPicture {
idc = IDC_WIDGET_VEHICLE;
text = "";
x = W_PART(12.1);
y = H_PART(0.2);
w = W_PART(2);
h = H_PART(1);
};
class UnitType: RscPictureKeepAspect {
idc = IDC_WIDGET_UNIT;
text = "";
x = W_PART(13.1);
y = H_PART(0.2);
w = W_PART(1);
h = H_PART(1);
}; };
class Kills: RscPictureKeepAspect { class Kills: RscPictureKeepAspect {
text = "a3\Ui_f\data\IGUI\Cfg\MPTable\infantry_ca.paa"; text = "a3\Ui_f\data\IGUI\Cfg\MPTable\infantry_ca.paa";
x = W_PART(3.6); x = W_PART(0.1);
y = H_PART(1.6); y = H_PART(1.6);
w = W_PART(0.8); w = W_PART(0.8);
h = H_PART(0.8); h = H_PART(0.8);
}; };
class LandKills: RscPictureKeepAspect { class LandKills: RscPictureKeepAspect {
text = "a3\Ui_f\data\IGUI\Cfg\MPTable\soft_ca.paa"; text = "a3\Ui_f\data\IGUI\Cfg\MPTable\soft_ca.paa";
x = W_PART(4.64); x = W_PART(1.1);
y = H_PART(1.6); y = H_PART(1.6);
w = W_PART(0.8); w = W_PART(0.8);
h = H_PART(0.8); h = H_PART(0.8);
}; };
class ArmoredKills: RscPictureKeepAspect { class ArmoredKills: RscPictureKeepAspect {
text = "a3\Ui_f\data\IGUI\Cfg\MPTable\armored_ca.paa"; text = "a3\Ui_f\data\IGUI\Cfg\MPTable\armored_ca.paa";
x = W_PART(5.76); x = W_PART(2.1);
y = H_PART(1.6); y = H_PART(1.6);
w = W_PART(0.8); w = W_PART(0.8);
h = H_PART(0.8); h = H_PART(0.8);
}; };
class AirKills: RscPictureKeepAspect { class AirKills: RscPictureKeepAspect {
text = "a3\Ui_f\data\IGUI\Cfg\MPTable\air_ca.paa"; text = "a3\Ui_f\data\IGUI\Cfg\MPTable\air_ca.paa";
x = W_PART(6.9); x = W_PART(3.1);
y = H_PART(1.6); y = H_PART(1.6);
w = W_PART(0.8); w = W_PART(0.8);
h = H_PART(0.8); h = H_PART(0.8);
}; };
class Deaths: RscPictureKeepAspect { class Deaths: RscPictureKeepAspect {
text = "a3\Ui_f\data\IGUI\Cfg\MPTable\killed_ca.paa"; text = "a3\Ui_f\data\IGUI\Cfg\MPTable\killed_ca.paa";
x = W_PART(7.92); x = W_PART(4.1);
y = H_PART(1.6); y = H_PART(1.6);
w = W_PART(0.8); w = W_PART(0.8);
h = H_PART(0.8); h = H_PART(0.8);
}; };
class Total: RscPictureKeepAspect { class Total: RscPictureKeepAspect {
text = "a3\Ui_f\data\IGUI\Cfg\MPTable\total_ca.paa"; text = "a3\Ui_f\data\IGUI\Cfg\MPTable\total_ca.paa";
x = W_PART(8.86); x = W_PART(5.1);
y = H_PART(1.6); y = H_PART(1.6);
w = W_PART(0.8); w = W_PART(0.8);
h = H_PART(0.8); h = H_PART(0.8);
@ -374,9 +373,9 @@ class GVAR(display) {
shadow = 0; shadow = 0;
idc = IDC_WIDGET_KILLS; idc = IDC_WIDGET_KILLS;
text = ""; text = "";
x = W_PART(3.6); x = W_PART(0.1);
y = H_PART(2.5); y = H_PART(2.5);
w = W_PART(0.9); w = W_PART(0.8);
h = H_PART(0.9); h = H_PART(0.9);
sizeEx = H_PART(0.7); sizeEx = H_PART(0.7);
}; };
@ -385,7 +384,7 @@ class GVAR(display) {
shadow = 0; shadow = 0;
idc = IDC_WIDGET_LAND; idc = IDC_WIDGET_LAND;
text = ""; text = "";
x = W_PART(4.6); x = W_PART(1.1);
y = H_PART(2.5); y = H_PART(2.5);
w = W_PART(0.8); w = W_PART(0.8);
h = H_PART(0.9); h = H_PART(0.9);
@ -396,7 +395,7 @@ class GVAR(display) {
shadow = 0; shadow = 0;
idc = IDC_WIDGET_ARMORED; idc = IDC_WIDGET_ARMORED;
text = ""; text = "";
x = W_PART(5.7); x = W_PART(2.1);
y = H_PART(2.5); y = H_PART(2.5);
w = W_PART(0.8); w = W_PART(0.8);
h = H_PART(0.9); h = H_PART(0.9);
@ -407,7 +406,7 @@ class GVAR(display) {
shadow = 0; shadow = 0;
idc = IDC_WIDGET_AIR; idc = IDC_WIDGET_AIR;
text = ""; text = "";
x = W_PART(6.8); x = W_PART(3.1);
y = H_PART(2.5); y = H_PART(2.5);
w = W_PART(0.8); w = W_PART(0.8);
h = H_PART(0.9); h = H_PART(0.9);
@ -418,7 +417,7 @@ class GVAR(display) {
shadow = 0; shadow = 0;
idc = IDC_WIDGET_DEATHS; idc = IDC_WIDGET_DEATHS;
text = ""; text = "";
x = W_PART(7.9); x = W_PART(4.1);
y = H_PART(2.5); y = H_PART(2.5);
w = W_PART(0.8); w = W_PART(0.8);
h = H_PART(0.9); h = H_PART(0.9);
@ -429,7 +428,7 @@ class GVAR(display) {
shadow = 0; shadow = 0;
idc = IDC_WIDGET_TOTAL; idc = IDC_WIDGET_TOTAL;
text = ""; text = "";
x = W_PART(8.8); x = W_PART(5.1);
y = H_PART(2.5); y = H_PART(2.5);
w = W_PART(0.8); w = W_PART(0.8);
h = H_PART(0.9); h = H_PART(0.9);
@ -437,10 +436,18 @@ class GVAR(display) {
}; };
class WeaponPicture: RscPictureKeepAspect { class WeaponPicture: RscPictureKeepAspect {
idc = IDC_WIDGET_WEAPON; idc = IDC_WIDGET_WEAPON;
text = "A3\weapons_F\Rifles\MX\data\UI\gear_mx_rifle_X_CA.paa"; text = "";
x = W_PART(9.9); x = W_PART(6.2);
y = H_PART(1.6); y = H_PART(1.6);
w = W_PART(5.9); w = W_PART(5.8);
h = H_PART(1.8);
};
class ThrowablePicture: RscPictureKeepAspect {
idc = IDC_WIDGET_THROWABLE;
text = "";
x = W_PART(12.3);
y = H_PART(1.6);
w = W_PART(1.8);
h = H_PART(1.8); h = H_PART(1.8);
}; };
}; };