Skip to content

Commit

Permalink
Spectator overhaul (#5171)
Browse files Browse the repository at this point in the history
- Overhauls the spectator module entirely to share a similar UX to BI's "End Game Spectator" while maintaining some of the extended flexibility of ACE Spectator.
- Simplifies spectator setup by reducing the number of settings. More advanced setup is still possible via the API functions provided.
  • Loading branch information
kymckay authored Aug 12, 2017
1 parent 606e9c0 commit d3ce75d
Show file tree
Hide file tree
Showing 103 changed files with 4,083 additions and 2,561 deletions.
2 changes: 2 additions & 0 deletions addons/common/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ PREP(getTurretDirection);
PREP(getUavControlPosition);
PREP(getVehicleCargo);
PREP(getVehicleCodriver);
PREP(getVehicleIcon);
PREP(getVersion);
PREP(getWeaponAzimuthAndInclination);
PREP(getWeaponIndex);
Expand All @@ -99,6 +100,7 @@ PREP(isEngineer);
PREP(isEOD);
PREP(isFeatureCameraActive);
PREP(isInBuilding);
PREP(isMedic);
PREP(isModLoaded);
PREP(isPlayer);
PREP(isUnderwater);
Expand Down
50 changes: 50 additions & 0 deletions addons/common/functions/fnc_getVehicleIcon.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Author: AACO
* Function used to get the vehicle icon for provided object (cached for repeat use)
*
* Arguments:
* 0: Object to get icon of <OBJECT/STRING>
*
* Return Value:
* Icon of vehicle <STRING>
*
* Examples:
* ["B_Soldier_F"] call ace_common_fnc_getVehicleIcon;
*
* Public: Yes
*/

#include "script_component.hpp"
#define DEFAULT_TEXTURE "\A3\ui_f\data\Map\VehicleIcons\iconVehicle_ca.paa"

params [["_object", objNull, [objNull, ""]]];

if ((_object isEqualType objNull && {isNull _object}) || {_object isEqualType "" && {_object == ""}}) exitWith { DEFAULT_TEXTURE };

ISNILS(GVAR(vehicleIconCache),call CBA_fnc_createNamespace);

private _objectType = if (_object isEqualType objNull) then {
typeOf _object
} else {
_object
};
private _cachedValue = GVAR(vehicleIconCache) getVariable _objectType;

if (isNil "_cachedValue") then {
private _vehicleValue = getText (configfile >> "CfgVehicles" >> _objectType >> "icon");
private _vehicleIconValue = getText (configfile >> "CfgVehicleIcons" >> _vehicleValue);

if (_vehicleIconValue == "") then {
if (_vehicleValue != "" && {((toLower _vehicleValue) find ".paa") > -1}) then {
_cachedValue = _vehicleValue;
} else {
_cachedValue = DEFAULT_TEXTURE;
};
} else {
_cachedValue = _vehicleIconValue;
};

GVAR(vehicleIconCache) setVariable [_objectType, _cachedValue];
};

_cachedValue
23 changes: 23 additions & 0 deletions addons/common/functions/fnc_isMedic.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Author: SilentSpike
* Check if a unit is a medic
*
* Arguments:
* 0: The Unit <OBJECT>
*
* ReturnValue:
* Unit is medic <BOOL>
*
* Example:
* [player] call ace_common_fnc_isMedic
*
* Public: Yes
*/

#include "script_component.hpp"

params ["_unit"];

private _isMedic = _unit getVariable [QEGVAR(medical,medicClass), getNumber (configFile >> "CfgVehicles" >> typeOf _unit >> "attendant")];

_isMedic > 0
24 changes: 11 additions & 13 deletions addons/spectator/ACE_Settings.hpp
Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
class ACE_Settings {
class GVAR(filterUnits) {
displayName = CSTRING(units_DisplayName);
description = CSTRING(units_Description);
typeName = "SCALAR";
value = 2;
values[] = {CSTRING(units_none), CSTRING(units_players), CSTRING(units_playable), CSTRING(units_all)};
};
class GVAR(filterSides) {
displayName = CSTRING(sides_DisplayName);
description = CSTRING(sides_Description);
typeName = "SCALAR";
class GVAR(enableAI) {
displayName = CSTRING(ai_DisplayName);
description = CSTRING(ai_Description);
typeName = "BOOL";
value = 0;
values[] = {CSTRING(sides_player), CSTRING(sides_friendly), CSTRING(sides_hostile), CSTRING(sides_all)};
};
class GVAR(restrictModes) {
displayName = CSTRING(modes_DisplayName);
description = CSTRING(modes_Description);
typeName = "SCALAR";
value = 0;
values[] = {CSTRING(modes_all), CSTRING(modes_unit), CSTRING(modes_free), CSTRING(modes_internal), CSTRING(modes_external)};
values[] = {CSTRING(modes_all), CSTRING(modes_unit), "$STR_A3_Spectator_free_camera_tooltip", "$STR_A3_Spectator_1pp_camera_tooltip", "$STR_A3_Spectator_3pp_camera_tooltip"};
};
class GVAR(restrictVisions) {
displayName = CSTRING(visions_DisplayName);
Expand All @@ -27,4 +19,10 @@ class ACE_Settings {
value = 0;
values[] = {CSTRING(modes_all), CSTRING(visions_nv), CSTRING(visions_ti), "$STR_Special_None"};
};
class GVAR(mapLocations) {
displayName = CSTRING(mapLocations_DisplayName);
description = CSTRING(mapLocations_Description);
typeName = "BOOL";
value = 0;
};
};
12 changes: 12 additions & 0 deletions addons/spectator/CfgEventHandlers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,15 @@ class Extended_PostInit_EventHandlers {
init = QUOTE(call COMPILE_FILE(XEH_postInit));
};
};

class Extended_DisplayLoad_EventHandlers {
class RscRespawnCounter {
ADDON = QUOTE(_this call FUNC(compat_counter));
};
class RscDisplayEGSpectator {
ADDON = QUOTE(_this call FUNC(compat_spectatorBI));
};
class RscDisplayCurator {
ADDON = QUOTE(_this call FUNC(compat_zeus));
};
};
79 changes: 28 additions & 51 deletions addons/spectator/CfgVehicles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,59 +3,17 @@ class CfgVehicles {
class GVAR(moduleSettings): ACE_Module {
scope = 2;
displayName = CSTRING(Settings_DisplayName);
icon = QPATHTOF(UI\Icon_Module_Spectator_ca.paa);
icon = QPATHTOF(data\Icon_Module_Spectator_ca.paa);
category = "ACE";
function = QFUNC(moduleSpectatorSettings);
isGlobal = 1;
author = ECSTRING(common,ACETeam);
class Arguments {
class unitsFilter {
displayName = CSTRING(units_DisplayName);
description = CSTRING(units_Description);
typeName = "NUMBER";
class values {
class none {
name = CSTRING(units_none);
value = 0;
};
class players {
name = CSTRING(units_players);
value = 1;
};
class playable {
name = CSTRING(units_playable);
value = 2;
default = 1;
};
class all {
name = CSTRING(units_all);
value = 3;
};
};
};
class sidesFilter {
displayName = CSTRING(sides_DisplayName);
description = CSTRING(sides_Description);
typeName = "NUMBER";
class values {
class player {
name = CSTRING(sides_player);
value = 0;
default = 1;
};
class friendly {
name = CSTRING(sides_friendly);
value = 1;
};
class hostile {
name = CSTRING(sides_hostile);
value = 2;
};
class all {
name = CSTRING(sides_all);
value = 3;
};
};
class enableAI {
displayName = CSTRING(ai_DisplayName);
description = CSTRING(ai_Description);
typeName = "BOOL";
defaultValue = 0;
};
class cameraModes {
displayName = CSTRING(modes_DisplayName);
Expand All @@ -72,15 +30,15 @@ class CfgVehicles {
value = 1;
};
class free {
name = CSTRING(modes_free);
name = "$STR_A3_Spectator_free_camera_tooltip";
value = 2;
};
class internal {
name = CSTRING(modes_internal);
name = "$STR_A3_Spectator_1pp_camera_tooltip";
value = 3;
};
class external {
name = CSTRING(modes_external);
name = "$STR_A3_Spectator_3pp_camera_tooltip";
value = 4;
};
};
Expand Down Expand Up @@ -109,9 +67,28 @@ class CfgVehicles {
};
};
};
class mapLocations {
displayName = CSTRING(mapLocations_DisplayName);
description = CSTRING(mapLocations_Description);
typeName = "BOOL";
defaultValue = 0;
};
};
class ModuleDescription {
description = CSTRING(Settings_Description);
};
};
class VirtualMan_F;
class GVAR(virtual): VirtualMan_F {
author = ECSTRING(common,ACETeam);
displayName = CSTRING(DisplayName);
scope = 2;
scopeArsenal = 0;
scopeCurator = 0;

weapons[] = {};

delete ACE_Actions;
delete ACE_SelfActions;
};
};
Loading

0 comments on commit d3ce75d

Please sign in to comment.