2017-08-12 13:25:48 +00:00
|
|
|
/*
|
|
|
|
* Author: Nelson Duarte, SilentSpike
|
|
|
|
* Updates spectator UI unit info widget
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [] call ace_spectator_fnc_ui_updateWidget
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "script_component.hpp"
|
|
|
|
#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_GUNNER "a3\Ui_f\data\IGUI\Cfg\CommandBar\imageGunner_ca.paa"
|
2017-08-26 18:16:24 +00:00
|
|
|
#define IMG_CARGO "a3\Ui_f\data\IGUI\Cfg\CommandBar\imageCargo_ca.paa"
|
|
|
|
#define IMG_UNARMED "" // TODO: Find suitable unarmed icon
|
2017-08-12 13:25:48 +00:00
|
|
|
|
2017-08-17 11:50:43 +00:00
|
|
|
// Hide if no target or widget is toggled off
|
2017-08-30 15:36:53 +00:00
|
|
|
if (!GVAR(uiWidgetVisible) || {isNull GVAR(camFocus)}) exitWith {CTRL_WIDGET ctrlShow false};
|
2017-08-12 13:25:48 +00:00
|
|
|
|
2017-08-30 15:36:53 +00:00
|
|
|
private _focus = GVAR(camFocus);
|
2017-08-12 13:25:48 +00:00
|
|
|
|
|
|
|
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]; };
|
|
|
|
|
2017-08-26 18:16:24 +00:00
|
|
|
private _unitTypePicture = "";
|
|
|
|
private _vehicleTypePicture = "";
|
|
|
|
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);
|
|
|
|
};
|
|
|
|
|
2017-08-12 13:25:48 +00:00
|
|
|
|
|
|
|
private _weapon = currentWeapon _focus;
|
|
|
|
private _weaponPicture = if (_weapon != "") then {
|
2017-08-26 18:16:24 +00:00
|
|
|
getText (configFile >> "CfgWeapons" >> _weapon >> "Picture")
|
2017-08-12 13:25:48 +00:00
|
|
|
} else {
|
2017-08-26 18:16:24 +00:00
|
|
|
IMG_UNARMED
|
2017-08-12 13:25:48 +00:00
|
|
|
};
|
|
|
|
|
2017-08-26 18:16:24 +00:00
|
|
|
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]]
|
|
|
|
];
|
2017-08-12 13:25:48 +00:00
|
|
|
|
|
|
|
CTRL_WIDGET_NAME ctrlSetText _name;
|
|
|
|
CTRL_WIDGET_KILLS ctrlSetText str _kills;
|
|
|
|
CTRL_WIDGET_LAND ctrlSetText str _softKills;
|
|
|
|
CTRL_WIDGET_ARMORED ctrlSetText str _armoredKills;
|
|
|
|
CTRL_WIDGET_AIR ctrlSetText str _airKills;
|
|
|
|
CTRL_WIDGET_DEATHS ctrlSetText str _deaths;
|
|
|
|
CTRL_WIDGET_TOTAL ctrlSetText str _total;
|
|
|
|
|
2017-08-26 18:16:24 +00:00
|
|
|
CTRL_WIDGET_WEAPON ctrlSetText _weaponPicture;
|
|
|
|
CTRL_WIDGET_THROWABLE ctrlSetText _throwablePicture;
|
2017-08-12 13:25:48 +00:00
|
|
|
|
2017-08-26 18:16:24 +00:00
|
|
|
CTRL_WIDGET_UNIT ctrlSetText _unitTypePicture;
|
|
|
|
CTRL_WIDGET_VEHICLE ctrlSetText _vehicleTypePicture;
|
|
|
|
CTRL_WIDGET_VEHICLE_POS ctrlSetText _vehiclePositionPicture;
|
2017-08-12 13:25:48 +00:00
|
|
|
|
|
|
|
// Handle widget toggling
|
|
|
|
if !(ctrlShown CTRL_WIDGET) then {
|
|
|
|
CTRL_WIDGET ctrlShow true;
|
|
|
|
};
|