From 621625b48dc0378f8133fdf4b3e43882a77bd721 Mon Sep 17 00:00:00 2001 From: bux578 Date: Tue, 13 Jan 2015 11:59:28 +0100 Subject: [PATCH 1/9] init --- addons/nametags/CfgEventHandlers.hpp | 5 +++++ addons/nametags/XEH_preInit.sqf | 3 +++ addons/nametags/config.cpp | 17 +++++++++++++++++ addons/nametags/functions/fnc_empty.sqf | 3 +++ addons/nametags/script_component.hpp | 12 ++++++++++++ 5 files changed, 40 insertions(+) create mode 100644 addons/nametags/CfgEventHandlers.hpp create mode 100644 addons/nametags/XEH_preInit.sqf create mode 100644 addons/nametags/config.cpp create mode 100644 addons/nametags/functions/fnc_empty.sqf create mode 100644 addons/nametags/script_component.hpp diff --git a/addons/nametags/CfgEventHandlers.hpp b/addons/nametags/CfgEventHandlers.hpp new file mode 100644 index 0000000000..51c0e909d7 --- /dev/null +++ b/addons/nametags/CfgEventHandlers.hpp @@ -0,0 +1,5 @@ +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE( call compile preprocessFileLineNumbers PATHTOF(XEH_preInit.sqf) ); + }; +}; \ No newline at end of file diff --git a/addons/nametags/XEH_preInit.sqf b/addons/nametags/XEH_preInit.sqf new file mode 100644 index 0000000000..a515eb4187 --- /dev/null +++ b/addons/nametags/XEH_preInit.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +PREP(empty); \ No newline at end of file diff --git a/addons/nametags/config.cpp b/addons/nametags/config.cpp new file mode 100644 index 0000000000..6c8d8ca938 --- /dev/null +++ b/addons/nametags/config.cpp @@ -0,0 +1,17 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + units[] = {}; + weapons[] = {}; + requiredVersion = 0.60; + requiredAddons[] = {"ace_core"}; + version = "0.95"; + versionStr = "0.95"; + versionAr[] = {0,95,0}; + author[] = {""}; + authorUrl = ""; + }; +}; + +#include "CfgEventHandlers.hpp" \ No newline at end of file diff --git a/addons/nametags/functions/fnc_empty.sqf b/addons/nametags/functions/fnc_empty.sqf new file mode 100644 index 0000000000..028fb068c9 --- /dev/null +++ b/addons/nametags/functions/fnc_empty.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +diag_log text format["This is here as an example!!!"]; \ No newline at end of file diff --git a/addons/nametags/script_component.hpp b/addons/nametags/script_component.hpp new file mode 100644 index 0000000000..5def4b85b4 --- /dev/null +++ b/addons/nametags/script_component.hpp @@ -0,0 +1,12 @@ +#define COMPONENT NameTags +#include "\z\ace\addons\main\script_mod.hpp" + +#ifdef DEBUG_ENABLED_NameTags + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_NameTags + #define DEBUG_SETTINGS DEBUG_SETTINGS_NameTags +#endif + +#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file From 069eb7860abe9533b1dc087715fe73ace8e25141 Mon Sep 17 00:00:00 2001 From: bux578 Date: Tue, 13 Jan 2015 12:29:13 +0100 Subject: [PATCH 2/9] cba'fied nametags --- addons/nametags/CfgEventHandlers.hpp | 10 +- addons/nametags/CfgVehicles.hpp | 56 ++++++++ addons/nametags/RscTitles.hpp | 41 ++++++ addons/nametags/XEH_postInit.sqf | 62 +++++++++ addons/nametags/XEH_preInit.sqf | 8 +- addons/nametags/config.cpp | 62 ++++++++- addons/nametags/functions/common.sqf | 26 ++++ addons/nametags/functions/fnc_canShow.sqf | 27 ++++ addons/nametags/functions/fnc_doShow.sqf | 93 +++++++++++++ .../functions/fnc_drawNameTagIcon.sqf | 63 +++++++++ addons/nametags/functions/fnc_empty.sqf | 3 - .../nametags/functions/fnc_getVehicleData.sqf | 123 ++++++++++++++++++ .../nametags/functions/fnc_moduleNameTags.sqf | 29 +++++ .../functions/fnc_onMouseZChanged.sqf | 18 +++ addons/nametags/functions/fnc_setText.sqf | 23 ++++ .../nametags/functions/script_component.hpp | 1 + 16 files changed, 632 insertions(+), 13 deletions(-) create mode 100644 addons/nametags/CfgVehicles.hpp create mode 100644 addons/nametags/RscTitles.hpp create mode 100644 addons/nametags/XEH_postInit.sqf create mode 100644 addons/nametags/functions/common.sqf create mode 100644 addons/nametags/functions/fnc_canShow.sqf create mode 100644 addons/nametags/functions/fnc_doShow.sqf create mode 100644 addons/nametags/functions/fnc_drawNameTagIcon.sqf delete mode 100644 addons/nametags/functions/fnc_empty.sqf create mode 100644 addons/nametags/functions/fnc_getVehicleData.sqf create mode 100644 addons/nametags/functions/fnc_moduleNameTags.sqf create mode 100644 addons/nametags/functions/fnc_onMouseZChanged.sqf create mode 100644 addons/nametags/functions/fnc_setText.sqf create mode 100644 addons/nametags/functions/script_component.hpp diff --git a/addons/nametags/CfgEventHandlers.hpp b/addons/nametags/CfgEventHandlers.hpp index 51c0e909d7..6a84bb0246 100644 --- a/addons/nametags/CfgEventHandlers.hpp +++ b/addons/nametags/CfgEventHandlers.hpp @@ -1,5 +1,11 @@ class Extended_PreInit_EventHandlers { class ADDON { - init = QUOTE( call compile preprocessFileLineNumbers PATHTOF(XEH_preInit.sqf) ); + init = QUOTE( call COMPILE_FILE(XEH_preInit) ); }; -}; \ No newline at end of file +}; + +class Extended_PostInit_EventHandlers { + class ADDON { + postInit = QUOTE(call COMPILE_FILE(XEH_postInit) ); + }; +}; diff --git a/addons/nametags/CfgVehicles.hpp b/addons/nametags/CfgVehicles.hpp new file mode 100644 index 0000000000..5aac521ae9 --- /dev/null +++ b/addons/nametags/CfgVehicles.hpp @@ -0,0 +1,56 @@ +class CfgVehicles { + class Module_F; + class ACE_ModuleNameTags: Module_F { + author = "$STR_ACE_Core_ACETeam"; + category = "ACE"; + displayName = "Name Tags"; + function = FUNC(moduleNameTags); + scope = 2; + isGlobal = 1; + icon = QUOTE(PATHTOF(UI\IconNameTags_ca.paa)); + class Arguments { + class PlayerNamesViewDistance { + displayName = "Player Names View Dist."; + description = "Distance in meters at which player names are shown. Default: 5"; + typeName = "NUMBER"; + defaultValue = 5; + }; + class ShowNamesForAI { + displayName = "Show name tags for AI?"; + description = "Show the name and rank tags for friendly AI units? Default: No"; + typeName = "BOOL"; + class values { + class Yes { + name = "Yes"; + value = 1; + }; + class No { + default = 1; + name = "No"; + value = 0; + }; + }; + }; + class Visibility { + displayName = "Visibility of crew info"; + description = "Forces visibility of vehicle crew info, or by default allows players to choose it on their own. Default: Do Not Force"; + typeName = "INT"; + class values { + class DoNotForce { + default = 1; + name = "Do Not Force"; + value = 0; + }; + class ForceShow { + name = "Force Show"; + value = 1; + }; + class ForceHide { + name = "Force Hide"; + value = -1; + }; + }; + }; + }; + }; +}; diff --git a/addons/nametags/RscTitles.hpp b/addons/nametags/RscTitles.hpp new file mode 100644 index 0000000000..fc2c52c678 --- /dev/null +++ b/addons/nametags/RscTitles.hpp @@ -0,0 +1,41 @@ +#define ACE_CrewInfo_TextIDC 11123 + +#define CT_STRUCTURED_TEXT 13 +#define ST_LEFT 0 + +class RscTitles { + titles[]={"ACE_CrewInfo_dialog"}; + class ACE_CrewInfo_dialog { + idd = -1; + movingEnable = 1; + duration = 1; + fadein = 0; + fadeout = 999999; + name = "ACE_CrewInfo_dialog"; + controlsBackground[] = {"ACE_CrewInfo_text"}; + onLoad = "uiNamespace setVariable ['ACE_CrewInfo_dialog', _this select 0]"; + onUnload = "uiNamespace setVariable ['ACE_CrewInfo_dialog', objNull]"; + + class ACE_CrewInfo_text { + idc = ACE_CrewInfo_TextIDC; + type = CT_STRUCTURED_TEXT; + style = ST_LEFT; + x = SafeZonex + SafezoneW - 0.31; + y = SafeZoneY + SafeZoneH * 0.4; + w = 0.3; + h = 0.6; + size = 0.018; + colorBackground[] = { 0, 0, 0, 0 }; + colortext[] = { + "(profilenamespace getvariable ['IGUI_TEXT_RGB_R',0])", + "(profilenamespace getvariable ['IGUI_TEXT_RGB_G',1])", + "(profilenamespace getvariable ['IGUI_TEXT_RGB_B',1])", + "(profilenamespace getvariable ['IGUI_TEXT_RGB_A',0.8])" + }; + text=""; + class Attributes { + align = right; + }; + }; + }; +}; diff --git a/addons/nametags/XEH_postInit.sqf b/addons/nametags/XEH_postInit.sqf new file mode 100644 index 0000000000..b512e8b133 --- /dev/null +++ b/addons/nametags/XEH_postInit.sqf @@ -0,0 +1,62 @@ +#include "script_component.hpp" + +// by commy2 and CAA-Picard + +if (!hasInterface) exitWith {}; + +GVAR(ShowNamesTime) = -10; + +addMissionEventHandler ["Draw3D", { + if !(profileNamespace getVariable ["ACE_showPlayerNames", true]) exitWith {}; + + _player = ACE_player; + if (profileNamespace getVariable ["ACE_showPlayerNamesOnlyOnCursor", true]) then { + _target = cursorTarget; + _target = if (_target in allUnitsUAV) then {objNull} else {effectiveCommander _target}; + + if (!isNull _target && {side group _target == playerSide} && {_target != _player} && {isPlayer _target || {GVAR(ShowNamesForAI)}} && {!(_target getVariable ["ACE_hideName", false])}) then { + _distance = _player distance _target; + _alpha = ((1 - 0.2 * (_distance - GVAR(PlayerNamesViewDistance))) min 1) * GVAR(PlayerNamesMaxAlpha); + if (profileNamespace getVariable ["ACE_showPlayerNamesOnlyOnKeyPress", false]) then { + _alpha = _alpha min (1 - (time - GVAR(ShowNamesTime) - 1)); + }; + [_player, _target, _alpha, _distance * 0.026] call FUNC(drawNameTagIcon); + }; + } else { + _pos = positionCameraToWorld [0, 0, 0]; + _targets = _pos nearObjects ["Man", GVAR(PlayerNamesViewDistance) + 5]; + + if (!surfaceIsWater _pos) then { + _pos = ATLtoASL _pos; + }; + _pos2 = positionCameraToWorld [0, 0, 1]; + if (!surfaceIsWater _pos2) then { + _pos2 = ATLtoASL _pos2; + }; + _vecy = _pos2 vectorDiff _pos; + + { + _target = if (_x in allUnitsUAV) then {objNull} else {effectiveCommander _x}; + + if (!isNull _target && {side group _target == playerSide} && {_target != _player} && {isPlayer _target || {GVAR(ShowNamesForAI)}} && {!(_target getVariable ["ACE_hideName", false])}) then { + _relPos = (visiblePositionASL _target) vectorDiff _pos; + _distance = vectorMagnitude _relPos; + _projDist = _relPos vectorDistance (_vecy vectorMultiply (_relPos vectorDotProduct _vecy)); + + _alpha = ((1 - 0.2 * (_distance - GVAR(PlayerNamesViewDistance))) min (1 - 0.15 * (_projDist * 5 - _distance - 3)) min 1) * GVAR(PlayerNamesMaxAlpha); + + if (profileNamespace getVariable ["ACE_showPlayerNamesOnlyOnKeyPress", false]) then { + _alpha = _alpha min (1 - (time - GVAR(ShowNamesTime) - 1)); + }; + + // Check if there is line of sight + if (_alpha > 0) then { + if (lineIntersects [_pos, (visiblePositionASL _target) vectorAdd [0,0,1], vehicle _player, _target]) then { + _alpha = 0; + }; + }; + [_player, _target, _alpha, _distance * 0.026] call FUNC(drawNameTagIcon); + }; + } forEach _targets; + }; +}]; diff --git a/addons/nametags/XEH_preInit.sqf b/addons/nametags/XEH_preInit.sqf index a515eb4187..440aa2231d 100644 --- a/addons/nametags/XEH_preInit.sqf +++ b/addons/nametags/XEH_preInit.sqf @@ -1,3 +1,9 @@ #include "script_component.hpp" -PREP(empty); \ No newline at end of file +PREP(canShow); +PREP(doShow); +PREP(drawNameTagIcon); +PREP(getVehicleData); +PREP(moduleNameTags); +PREP(onMouseZChanged); +PREP(setText); diff --git a/addons/nametags/config.cpp b/addons/nametags/config.cpp index 6c8d8ca938..9cba032947 100644 --- a/addons/nametags/config.cpp +++ b/addons/nametags/config.cpp @@ -5,13 +5,61 @@ class CfgPatches { units[] = {}; weapons[] = {}; requiredVersion = 0.60; - requiredAddons[] = {"ace_core"}; - version = "0.95"; - versionStr = "0.95"; - versionAr[] = {0,95,0}; - author[] = {""}; - authorUrl = ""; + requiredAddons[] = {"ace_main", "ace_common", "ace_interaction"}; + version = QUOTE(VERSION); + versionStr = QUOTE(VERSION); + versionAr[] = {VERSION_AR}; + author[] = {"commy2", "CAA-Picard"}; + authorUrl = "https://github.com/commy2/"; }; }; -#include "CfgEventHandlers.hpp" \ No newline at end of file +#include "CfgEventHandlers.hpp" +#include "CfgVehicles.hpp" + +class ACE_Core_Default_Keys { + class showNames { + displayName = "$STR_ACE_NameTags_ShowNames"; + condition = "true"; + statement = QUOTE( GVAR(ShowNamesTime) = time; if (call FUNC(canShow)) then {call FUNC(doShow);}; ); + key = 29; + shift = 0; + control = 0; + alt = 0; + allowHolding = 1; + }; +}; + +class ACE_Core_Options { + class showPlayerNames { + displayName = "$STR_ACE_NameTags_ShowPlayerNames"; + default = 1; + }; + class showPlayerNamesOnlyOnCursor { + displayName = "$STR_ACE_NameTags_ShowPlayerNamesOnlyOnCursor"; + default = 1; + }; + class showPlayerNamesOnlyOnKeyPress { + displayName = "$STR_ACE_NameTags_ShowPlayerNamesOnlyOnKeyPress"; + default = 0; + }; + class showPlayerRanks { + displayName = "$STR_ACE_NameTags_ShowPlayerRanks"; + default = 1; + }; + class showVehicleCrewInfo { + displayName = "$STR_ACE_CrewInfo_ShowVehicleCrewInfo"; + default = 1; + }; +}; + +class ACE_Parameters_Numeric { + GVAR(PlayerNamesViewDistance) = 5; + GVAR(PlayerNamesMaxAlpha) = 0.8; + GVAR(CrewInfoVisibility) = 0; +}; +class ACE_Parameters_Boolean { + GVAR(ShowNamesForAI) = 0; +}; + +#include diff --git a/addons/nametags/functions/common.sqf b/addons/nametags/functions/common.sqf new file mode 100644 index 0000000000..caa7a3e982 --- /dev/null +++ b/addons/nametags/functions/common.sqf @@ -0,0 +1,26 @@ +/* + Author: aeroson + + Description: + Images, index in images and order of roles. + Defined number also implies order, lower number shows more on top of the list. +*/ + +#include "script_component.hpp" + +#define PILOT 0 +#define DRIVER 1 +#define COPILOT PILOT +#define COMMANDER 2 +#define GUNNER 3 +#define FFV 4 +#define CARGO 5 + +#define ROLE_IMAGES [ \ + "a3\ui_f\data\IGUI\Cfg\Actions\getinpilot_ca.paa", \ + "a3\ui_f\data\IGUI\Cfg\Actions\getindriver_ca.paa", \ + "a3\ui_f\data\IGUI\Cfg\Actions\getincommander_ca.paa", \ + "a3\ui_f\data\IGUI\Cfg\Actions\getingunner_ca.paa", \ + QUOTE(PATHTOF(UI\icon_position_ffv.paa)), \ + "a3\ui_f\data\IGUI\Cfg\Actions\getincargo_ca.paa" \ +] diff --git a/addons/nametags/functions/fnc_canShow.sqf b/addons/nametags/functions/fnc_canShow.sqf new file mode 100644 index 0000000000..612baac2d3 --- /dev/null +++ b/addons/nametags/functions/fnc_canShow.sqf @@ -0,0 +1,27 @@ +/* + Author: aeroson + + Description: + Might be called several times a second + + Parameters: + None + + Returns: + true if CrewInfo can be shown, false otherwise +*/ + +#include "script_component.hpp" + +private["_player"]; + +_player = ACE_player; + +// AGM_NameTags_ShowVehicleCrewInfo: -1 force NO, 0 doesnt care, 1 force YES + +vehicle _player != _player && +{ + (GVAR(CrewInfoVisibility) == 1) || + (GVAR(CrewInfoVisibility) != -1 && profileNamespace getVariable ["ACE_showVehicleCrewInfo", false]) +} && +{!(vehicle _player isKindOf "ParachuteBase")}; diff --git a/addons/nametags/functions/fnc_doShow.sqf b/addons/nametags/functions/fnc_doShow.sqf new file mode 100644 index 0000000000..dd23d0d085 --- /dev/null +++ b/addons/nametags/functions/fnc_doShow.sqf @@ -0,0 +1,93 @@ +/* + Author: aeroson + + Description: + Shows the actual text and sets text the crew info + + Parameters: + None + + Returns: + Nothing +*/ + +#include "script_component.hpp" +#include QUOTE(PATHTOF(functions\common.sqf)); + +private["_roleImages", "_player", "_vehicle", "_type", "_config", "_text", "_data", "_isAir", "_turretUnits", "_turretRoles", "_index", "_roleType", "_unit", "_toShow"]; + + +_player = ACE_player; +_vehicle = vehicle _player; +_type = typeOf _vehicle; +_config = configFile >> "CfgVehicles" >> _type; +_text = format[" %2
", getText(_config>>"picture"), getText (_config >> "DisplayName")]; + + + +_data = [_type] call FUNC(getVehicleData); + +_isAir = _data select 0; +_data = _data select 1; + +_turretUnits = [_data, { _vehicle turretUnit (_x select 0) } ] call EFUNC(Core,map); +_turretRoles = [_data, { _x select 1 } ] call EFUNC(Core,map); + + +_roleType = CARGO; +_toShow = []; +{ + switch (_x) do { + case commander _vehicle: { + _roleType = COMMANDER; + }; + case gunner _vehicle: { + _roleType = GUNNER; + }; + case driver _vehicle: { + _roleType = if(_isAir) then { PILOT } else { DRIVER }; + }; + default { + _index = _turretUnits find _x; + if(_index !=-1 ) then { + _roleType = _turretRoles select _index; + } else { + _roleType = CARGO; + }; + }; + }; + _toShow pushBack [_x, _roleType]; +} forEach crew _vehicle; + + +_toShow = [ + _toShow, + [], + { + _x select 1 + }, + "ASCEND", + { + _unit = _x select 0; + alive _unit + } +] call BIS_fnc_sortBy; + + +_roleImages = ROLE_IMAGES; +{ + _unit = _x select 0; + _roleType = _x select 1; + _text = _text + format["%1
", [_unit] call EFUNC(Core,getName), _roleImages select _roleType]; +} forEach _toShow; + + +("ACE_CrewInfo_CrewInfo" call BIS_fnc_rscLayer) cutRsc ["ACE_CrewInfo_dialog", "PLAIN", 1, false]; + +terminate (missionNamespace getVariable [QGVAR(hideCrewInfoHandle), scriptNull]); +GVAR(hideCrewInfoHandle) = 0 spawn { + sleep 2; + ("ACE_CrewInfo_CrewInfo" call BIS_fnc_rscLayer) cutFadeOut 2; +}; + +[_text] call FUNC(setText); diff --git a/addons/nametags/functions/fnc_drawNameTagIcon.sqf b/addons/nametags/functions/fnc_drawNameTagIcon.sqf new file mode 100644 index 0000000000..06a5963217 --- /dev/null +++ b/addons/nametags/functions/fnc_drawNameTagIcon.sqf @@ -0,0 +1,63 @@ +/* + * Author: commy2, CAA-Picard + * + * Draw the nametag and rank icon. + * + * Argument: + * 0: Unit (Array) + * 1: alpha (Number) + * 2: Height offset (Number) + * + * Return value: + * None. + */ + +#include "script_component.hpp" + +#define TEXTURES_RANKS [ \ + "", \ + "\A3\Ui_f\data\GUI\Cfg\Ranks\private_gs.paa", \ + "\A3\Ui_f\data\GUI\Cfg\Ranks\corporal_gs.paa", \ + "\A3\Ui_f\data\GUI\Cfg\Ranks\sergeant_gs.paa", \ + "\A3\Ui_f\data\GUI\Cfg\Ranks\lieutenant_gs.paa", \ + "\A3\Ui_f\data\GUI\Cfg\Ranks\captain_gs.paa", \ + "\A3\Ui_f\data\GUI\Cfg\Ranks\major_gs.paa", \ + "\A3\Ui_f\data\GUI\Cfg\Ranks\colonel_gs.paa" \ +] + +private ["_player", "_target", "_alpha", "_heightOffset", "_height", "_position", "_color", "_name", "_rank", "_size"]; + +_player = _this select 0; +_target = _this select 1; +_alpha = _this select 2; +_heightOffset = _this select 3; + +_height = [2, 1.5, 1, 1.5, 1] select (["STAND", "CROUCH", "PRONE", "UNDEFINED", ""] find stance _target); + +_position = visiblePositionASL _target; +// Convert position to ASLW (expected by drawIcon3D) and add height offsets +_position set [2, ((_target modelToWorld [0,0,0]) select 2) + _height + _heightOffset]; + +_color = if !(group _target == group _player) then { + [0.77, 0.51, 0.08, _alpha] +} else { + [[1, 1, 1, _alpha], [1, 0, 0, _alpha], [0, 1, 0, _alpha], [0, 0, 1, _alpha], [1, 1, 0, _alpha]] select (["MAIN", "RED", "GREEN", "BLUE", "YELLOW"] find (if (_target == _player) then {0} else {assignedTeam _target})) max 0 +}; + +_name = [_target, true] call EFUNC(Core,getName); + +_rank = TEXTURES_RANKS select ((["PRIVATE", "CORPORAL", "SERGEANT", "LIEUTENANT", "CAPTAIN", "MAJOR", "COLONEL"] find rank _target) + 1); +_size = [0, 1] select (profileNamespace getVariable ["ACE_showPlayerRanks", true]); + +drawIcon3D [ + _rank, + _color, + _position, + _size, + _size, + 0, + _name, + 2, + 0.033, + "PuristaMedium" +]; diff --git a/addons/nametags/functions/fnc_empty.sqf b/addons/nametags/functions/fnc_empty.sqf deleted file mode 100644 index 028fb068c9..0000000000 --- a/addons/nametags/functions/fnc_empty.sqf +++ /dev/null @@ -1,3 +0,0 @@ -#include "script_component.hpp" - -diag_log text format["This is here as an example!!!"]; \ No newline at end of file diff --git a/addons/nametags/functions/fnc_getVehicleData.sqf b/addons/nametags/functions/fnc_getVehicleData.sqf new file mode 100644 index 0000000000..6a0ca43fcd --- /dev/null +++ b/addons/nametags/functions/fnc_getVehicleData.sqf @@ -0,0 +1,123 @@ +/* + Author: aeroson + + Description: + Gathers and caches data needed by AGM_CrewInfo_fnc_doShow + What really does make difference for the engine is simulation of CfgAmmo + Priority of roles is: driver/pilot, gunner, copilot, commander, ffv, cargo + + Parameters: + None + + Returns: + [ + Is vehicle inherited from Air ? + Array categorizing each vehicle's turret + ] +*/ + +#include "script_component.hpp" +#include QUOTE(PATHTOF(functions\common.sqf)); + + +private ["_type", "_varName", "_data"]; + +_type = _this select 0; + +_varName = format ["AGM_CrewInfo_Cache_%1", _type]; +_data = + (uiNamespace getVariable _varName); + +if (!isNil "_data") exitWith { + _data +}; + +_data = []; + + + +private ["_isAir", "_config", "_fnc_addTurret", "_fnc_addTurretUnit"]; + +_isAir = _type isKindOf "Air"; + +_fnc_addTurretUnit = { + + private ["_config", "_path", "_role", "_simulationEmpty", "_simulationLaserDesignate", "_simulationOther", "_magazine", "_ammo", "_simulation"]; + + _config = _this select 0; + _path = _this select 1; + _role = CARGO; + + _simulationEmpty = 0; + _simulationLaserDesignate = 0; + _simulationOther = 0; + { + { + _magazine = configFile >> "CfgMagazines" >> _x; + _ammo = configFile >> "CfgAmmo" >> getText (_magazine >> "ammo"); + _simulation = getText (_ammo >> "simulation"); + + if(_simulation=="") then { + _simulationEmpty = _simulationEmpty + 1; + } else { + if(_simulation=="laserDesignate") then { + _simulationLaserDesignate = _simulationLaserDesignate + 1; + } else { + _simulationOther = _simulationOther + 1; + }; + }; + + } forEach getArray (configFile >> "CfgWeapons" >> _x >> "magazines"); + } forEach getArray (_config >> "weapons"); + + if(_simulationOther>0) then { + _role = GUNNER; + }; + if (_role == CARGO && {getNumber (_config >> "isCopilot") == 1}) then { + _role = COPILOT; + }; + if (_role == CARGO && {_simulationLaserDesignate>0 || getNumber (_config >> "primaryObserver") == 1}) then { + _role = COMMANDER; + }; + if (_role == CARGO && {getNumber (_config >> "isPersonTurret") == 1}) then { + _role = FFV; + }; + + _data pushBack [_path, _role]; + +}; + + +_fnc_addTurret = { + + private ["_config", "_path", "_count", "_offset", "_index", "_turretPath", "_turretConfig"]; + + _config = _this select 0; + _path = _this select 1; + + _config = _config >> "Turrets"; + _count = count _config; + + _offset = 0; + + for "_index" from 0 to (_count - 1) do { + _turretPath = _path + [_index - _offset]; + _turretConfig = _config select _index; + if (isClass _turretConfig) then { + [_turretConfig, _turretPath] call _fnc_addTurretUnit; + [_turretConfig, _turretPath] call _fnc_addTurret; + } else { + _offset = _offset + 1; + }; + + }; + +}; + + +_config = configFile >> "CfgVehicles" >> _type; +[_config, []] call _fnc_addTurret; + +_data = [_isAir, _data]; +uiNamespace setVariable [_varName, _data]; + +_data diff --git a/addons/nametags/functions/fnc_moduleNameTags.sqf b/addons/nametags/functions/fnc_moduleNameTags.sqf new file mode 100644 index 0000000000..c19b993ee5 --- /dev/null +++ b/addons/nametags/functions/fnc_moduleNameTags.sqf @@ -0,0 +1,29 @@ +/* + * Author: CAA-Picard + * + * Initializes the name tags module. + * + * Arguments: + * Whatever the module provides. + * + * Return Value: + * None + */ + +#include "script_component.hpp" + +if !(isServer) exitWith {}; + +_logic = _this select 0; +_units = _this select 1; +_activated = _this select 2; + +if !(_activated) exitWith {}; + +GVAR(Module) = true; + +[_logic, QGVAR(PlayerNamesViewDistance), "PlayerNamesViewDistance" ] call EFUNC(Core,readNumericParameterFromModule); +[_logic, QGVAR(ShowNamesForAI), "ShowNamesForAI" ] call EFUNC(Core,readBooleanParameterFromModule); +[_logic, QGVAR(CrewInfoVisibility), "Visibility" ] call EFUNC(Core,readNumericParameterFromModule); + +diag_log text "[ACE]: NameTags Module Initialized."; diff --git a/addons/nametags/functions/fnc_onMouseZChanged.sqf b/addons/nametags/functions/fnc_onMouseZChanged.sqf new file mode 100644 index 0000000000..8892f201bc --- /dev/null +++ b/addons/nametags/functions/fnc_onMouseZChanged.sqf @@ -0,0 +1,18 @@ +/* + Author: aeroson + + Description: + Callback for mouse wheel change + + Parameters: + None + + Returns: + Nothing +*/ + +#include "script_component.hpp" + +if(call FUNC(canShow)) then { + call FUNC(doShow); +}; diff --git a/addons/nametags/functions/fnc_setText.sqf b/addons/nametags/functions/fnc_setText.sqf new file mode 100644 index 0000000000..1c740f76b0 --- /dev/null +++ b/addons/nametags/functions/fnc_setText.sqf @@ -0,0 +1,23 @@ +/* + Author: aeroson + + Description: + Sets the text on the dialog + + Parameters: + None + + Returns: + Nothing +*/ + +#define GVAR(TextIDC) 11123 + +private["_text", "_ctrl"]; + +disableSerialization; + +_text = _this select 0; +_ctrl = (uiNamespace getVariable QGVAR(dialog)) displayCtrl GVAR(TextIDC); +_ctrl ctrlSetStructuredText parseText _text; +_ctrl ctrlCommit 0; diff --git a/addons/nametags/functions/script_component.hpp b/addons/nametags/functions/script_component.hpp new file mode 100644 index 0000000000..b8135e8ecd --- /dev/null +++ b/addons/nametags/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\nametags\script_component.hpp" From 38ed8003890f64df9a2d0eda7110ab4a57119a08 Mon Sep 17 00:00:00 2001 From: bux578 Date: Tue, 13 Jan 2015 12:30:20 +0100 Subject: [PATCH 3/9] move ui folder, cleanup --- TO_MERGE/agm/NameTags/RscTitles.hpp | 41 ----- TO_MERGE/agm/NameTags/clientInit.sqf | 60 -------- TO_MERGE/agm/NameTags/config.cpp | 143 ------------------ .../NameTags/functions/CrewInfo/common.sqf | 24 --- .../functions/CrewInfo/fn_canShow.sqf | 26 ---- .../NameTags/functions/CrewInfo/fn_doShow.sqf | 92 ----------- .../functions/CrewInfo/fn_getVehicleData.sqf | 123 --------------- .../functions/CrewInfo/fn_onMouseZChanged.sqf | 16 -- .../functions/CrewInfo/fn_setText.sqf | 23 --- .../NameTags/functions/fn_drawNameTagIcon.sqf | 61 -------- .../NameTags/functions/fn_moduleNameTags.sqf | 27 ---- TO_MERGE/agm/NameTags/stringtable.xml | 72 --------- .../nametags}/UI/IconNameTags_ca.paa | Bin .../nametags}/UI/icon_position_ffv.paa | Bin 14 files changed, 708 deletions(-) delete mode 100644 TO_MERGE/agm/NameTags/RscTitles.hpp delete mode 100644 TO_MERGE/agm/NameTags/clientInit.sqf delete mode 100644 TO_MERGE/agm/NameTags/config.cpp delete mode 100644 TO_MERGE/agm/NameTags/functions/CrewInfo/common.sqf delete mode 100644 TO_MERGE/agm/NameTags/functions/CrewInfo/fn_canShow.sqf delete mode 100644 TO_MERGE/agm/NameTags/functions/CrewInfo/fn_doShow.sqf delete mode 100644 TO_MERGE/agm/NameTags/functions/CrewInfo/fn_getVehicleData.sqf delete mode 100644 TO_MERGE/agm/NameTags/functions/CrewInfo/fn_onMouseZChanged.sqf delete mode 100644 TO_MERGE/agm/NameTags/functions/CrewInfo/fn_setText.sqf delete mode 100644 TO_MERGE/agm/NameTags/functions/fn_drawNameTagIcon.sqf delete mode 100644 TO_MERGE/agm/NameTags/functions/fn_moduleNameTags.sqf delete mode 100644 TO_MERGE/agm/NameTags/stringtable.xml rename {TO_MERGE/agm/NameTags => addons/nametags}/UI/IconNameTags_ca.paa (100%) rename {TO_MERGE/agm/NameTags => addons/nametags}/UI/icon_position_ffv.paa (100%) diff --git a/TO_MERGE/agm/NameTags/RscTitles.hpp b/TO_MERGE/agm/NameTags/RscTitles.hpp deleted file mode 100644 index 32ea8d5c3d..0000000000 --- a/TO_MERGE/agm/NameTags/RscTitles.hpp +++ /dev/null @@ -1,41 +0,0 @@ -#define AGM_CrewInfo_TextIDC 11123 - -#define CT_STRUCTURED_TEXT 13 -#define ST_LEFT 0 - -class RscTitles { - titles[]={"AGM_CrewInfo_dialog"}; - class AGM_CrewInfo_dialog { - idd = -1; - movingEnable = 1; - duration = 1; - fadein = 0; - fadeout = 999999; - name = "AGM_CrewInfo_dialog"; - controlsBackground[] = {"AGM_CrewInfo_text"}; - onLoad = "uiNamespace setVariable ['AGM_CrewInfo_dialog', _this select 0]"; - onUnload = "uiNamespace setVariable ['AGM_CrewInfo_dialog', objNull]"; - - class AGM_CrewInfo_text { - idc = AGM_CrewInfo_TextIDC; - type = CT_STRUCTURED_TEXT; - style = ST_LEFT; - x = SafeZonex + SafezoneW - 0.31; - y = SafeZoneY + SafeZoneH*0.4; - w = 0.3; - h = 0.6; - size = 0.018; - colorBackground[] = { 0, 0, 0, 0 }; - colortext[] = { - "(profilenamespace getvariable ['IGUI_TEXT_RGB_R',0])", - "(profilenamespace getvariable ['IGUI_TEXT_RGB_G',1])", - "(profilenamespace getvariable ['IGUI_TEXT_RGB_B',1])", - "(profilenamespace getvariable ['IGUI_TEXT_RGB_A',0.8])" - }; - text=""; - class Attributes { - align = right; - }; - }; - }; -}; diff --git a/TO_MERGE/agm/NameTags/clientInit.sqf b/TO_MERGE/agm/NameTags/clientInit.sqf deleted file mode 100644 index aa325bbd7e..0000000000 --- a/TO_MERGE/agm/NameTags/clientInit.sqf +++ /dev/null @@ -1,60 +0,0 @@ -// by commy2 and CAA-Picard - -if (!hasInterface) exitWith {}; - -AGM_NameTags_ShowNamesTime = -10; - -addMissionEventHandler ["Draw3D", { - if !(profileNamespace getVariable ["AGM_showPlayerNames", true]) exitWith {}; - - _player = AGM_player; - if (profileNamespace getVariable ["AGM_showPlayerNamesOnlyOnCursor", true]) then { - _target = cursorTarget; - _target = if (_target in allUnitsUAV) then {objNull} else {effectiveCommander _target}; - - if (!isNull _target && {side group _target == playerSide} && {_target != _player} && {isPlayer _target || {AGM_NameTags_ShowNamesForAI}} && {!(_target getVariable ["AGM_hideName", false])}) then { - _distance = _player distance _target; - _alpha = ((1 - 0.2 * (_distance - AGM_NameTags_PlayerNamesViewDistance)) min 1) * AGM_NameTags_PlayerNamesMaxAlpha; - if (profileNamespace getVariable ["AGM_showPlayerNamesOnlyOnKeyPress", false]) then { - _alpha = _alpha min (1 - (time - AGM_NameTags_ShowNamesTime - 1)); - }; - [_player, _target, _alpha, _distance * 0.026] call AGM_NameTags_fnc_drawNameTagIcon; - }; - } else { - _pos = positionCameraToWorld [0, 0, 0]; - _targets = _pos nearObjects ["Man", AGM_NameTags_PlayerNamesViewDistance + 5]; - - if (!surfaceIsWater _pos) then { - _pos = ATLtoASL _pos; - }; - _pos2 = positionCameraToWorld [0, 0, 1]; - if (!surfaceIsWater _pos2) then { - _pos2 = ATLtoASL _pos2; - }; - _vecy = _pos2 vectorDiff _pos; - - { - _target = if (_x in allUnitsUAV) then {objNull} else {effectiveCommander _x}; - - if (!isNull _target && {side group _target == playerSide} && {_target != _player} && {isPlayer _target || {AGM_NameTags_ShowNamesForAI}} && {!(_target getVariable ["AGM_hideName", false])}) then { - _relPos = (visiblePositionASL _target) vectorDiff _pos; - _distance = vectorMagnitude _relPos; - _projDist = _relPos vectorDistance (_vecy vectorMultiply (_relPos vectorDotProduct _vecy)); - - _alpha = ((1 - 0.2 * (_distance - AGM_NameTags_PlayerNamesViewDistance)) min (1 - 0.15 * (_projDist * 5 - _distance - 3)) min 1) * AGM_NameTags_PlayerNamesMaxAlpha; - - if (profileNamespace getVariable ["AGM_showPlayerNamesOnlyOnKeyPress", false]) then { - _alpha = _alpha min (1 - (time - AGM_NameTags_ShowNamesTime - 1)); - }; - - // Check if there is line of sight - if (_alpha > 0) then { - if (lineIntersects [_pos, (visiblePositionASL _target) vectorAdd [0,0,1], vehicle _player, _target]) then { - _alpha = 0; - }; - }; - [_player, _target, _alpha, _distance * 0.026] call AGM_NameTags_fnc_drawNameTagIcon; - }; - } forEach _targets; - }; -}]; diff --git a/TO_MERGE/agm/NameTags/config.cpp b/TO_MERGE/agm/NameTags/config.cpp deleted file mode 100644 index aa0be72b5e..0000000000 --- a/TO_MERGE/agm/NameTags/config.cpp +++ /dev/null @@ -1,143 +0,0 @@ -class CfgPatches { - class AGM_NameTags { - units[] = {}; - weapons[] = {}; - requiredVersion = 0.60; - requiredAddons[] = {AGM_Core, AGM_Interaction}; - version = "0.95"; - versionStr = "0.95"; - versionAr[] = {0,95,0}; - author[] = {"commy2", "CAA-Picard"}; - authorUrl = "https://github.com/commy2/"; - }; -}; - -class CfgFunctions { - class AGM_NameTags { - class AGM_NameTags { - file = "\AGM_NameTags\functions"; - class drawNameTagIcon; - class moduleNameTags; - }; - }; - class AGM_CrewInfo { - class AGM_CrewInfo { - file = "AGM_NameTags\functions\CrewInfo"; - class canShow; - class doShow; - class getVehicleData; - class onMouseZChanged; - class setText; - }; - }; -}; - -class Extended_PostInit_EventHandlers { - class AGM_NameTags { - clientInit = "call compile preprocessFileLineNumbers '\AGM_NameTags\clientInit.sqf'"; - }; -}; - -class AGM_Core_Default_Keys { - class showNames { - displayName = "$STR_AGM_NameTags_ShowNames"; - condition = "true"; - statement = "AGM_NameTags_ShowNamesTime = time; if (call AGM_CrewInfo_fnc_canShow) then {call AGM_CrewInfo_fnc_doShow;};"; - key = 29; - shift = 0; - control = 0; - alt = 0; - allowHolding = 1; - }; -}; - -class AGM_Core_Options { - class showPlayerNames { - displayName = "$STR_AGM_NameTags_ShowPlayerNames"; - default = 1; - }; - class showPlayerNamesOnlyOnCursor { - displayName = "$STR_AGM_NameTags_ShowPlayerNamesOnlyOnCursor"; - default = 1; - }; - class showPlayerNamesOnlyOnKeyPress { - displayName = "$STR_AGM_NameTags_ShowPlayerNamesOnlyOnKeyPress"; - default = 0; - }; - class showPlayerRanks { - displayName = "$STR_AGM_NameTags_ShowPlayerRanks"; - default = 1; - }; - class showVehicleCrewInfo { - displayName = "$STR_AGM_CrewInfo_ShowVehicleCrewInfo"; - default = 1; - }; -}; - -class AGM_Parameters_Numeric { - AGM_NameTags_PlayerNamesViewDistance = 5; - AGM_NameTags_PlayerNamesMaxAlpha = 0.8; - AGM_NameTags_CrewInfoVisibility = 0; -}; -class AGM_Parameters_Boolean { - AGM_NameTags_ShowNamesForAI = 0; -}; - -class CfgVehicles { - class Module_F; - class AGM_ModuleNameTags: Module_F { - author = "$STR_AGM_Core_AGMTeam"; - category = "AGM"; - displayName = "Name Tags"; - function = "AGM_NameTags_fnc_moduleNameTags"; - scope = 2; - isGlobal = 1; - icon = "\AGM_NameTags\UI\IconNameTags_ca.paa"; - class Arguments { - class PlayerNamesViewDistance { - displayName = "Player Names View Dist."; - description = "Distance in meters at which player names are shown. Default: 5"; - typeName = "NUMBER"; - defaultValue = 5; - }; - class ShowNamesForAI { - displayName = "Show name tags for AI?"; - description = "Show the name and rank tags for friendly AI units? Default: No"; - typeName = "BOOL"; - class values { - class Yes { - name = "Yes"; - value = 1; - }; - class No { - default = 1; - name = "No"; - value = 0; - }; - }; - }; - class Visibility { - displayName = "Visibility of crew info"; - description = "Forces visibility of vehicle crew info, or by default allows players to choose it on their own. Default: Do Not Force"; - typeName = "INT"; - class values { - class DoNotForce { - default = 1; - name = "Do Not Force"; - value = 0; - }; - class ForceShow { - name = "Force Show"; - value = 1; - }; - class ForceHide { - name = "Force Hide"; - value = -1; - }; - }; - }; - }; - }; -}; - -#include diff --git a/TO_MERGE/agm/NameTags/functions/CrewInfo/common.sqf b/TO_MERGE/agm/NameTags/functions/CrewInfo/common.sqf deleted file mode 100644 index aa80cdfa8d..0000000000 --- a/TO_MERGE/agm/NameTags/functions/CrewInfo/common.sqf +++ /dev/null @@ -1,24 +0,0 @@ -/* - Author: aeroson - - Description: - Images, index in images and order of roles. - Defined number also implies order, lower number shows more on top of the list. -*/ - -#define PILOT 0 -#define DRIVER 1 -#define COPILOT PILOT -#define COMMANDER 2 -#define GUNNER 3 -#define FFV 4 -#define CARGO 5 - -#define ROLE_IMAGES [ \ - "a3\ui_f\data\IGUI\Cfg\Actions\getinpilot_ca.paa", \ - "a3\ui_f\data\IGUI\Cfg\Actions\getindriver_ca.paa", \ - "a3\ui_f\data\IGUI\Cfg\Actions\getincommander_ca.paa", \ - "a3\ui_f\data\IGUI\Cfg\Actions\getingunner_ca.paa", \ - "AGM_NameTags\UI\icon_position_ffv.paa", \ - "a3\ui_f\data\IGUI\Cfg\Actions\getincargo_ca.paa" \ -] diff --git a/TO_MERGE/agm/NameTags/functions/CrewInfo/fn_canShow.sqf b/TO_MERGE/agm/NameTags/functions/CrewInfo/fn_canShow.sqf deleted file mode 100644 index 8e3dadedec..0000000000 --- a/TO_MERGE/agm/NameTags/functions/CrewInfo/fn_canShow.sqf +++ /dev/null @@ -1,26 +0,0 @@ -/* - Author: aeroson - - Description: - Might be called several times a second - - Parameters: - None - - Returns: - true if CrewInfo can be shown, false otherwise -*/ - -private["_player"]; - - -_player = AGM_player; - -// AGM_NameTags_ShowVehicleCrewInfo: -1 force NO, 0 doesnt care, 1 force YES - -vehicle _player != _player && -{ - (AGM_NameTags_CrewInfoVisibility == 1) || - (AGM_NameTags_CrewInfoVisibility != -1 && profileNamespace getVariable ["AGM_showVehicleCrewInfo", false]) -} && -{!(vehicle _player isKindOf "ParachuteBase")}; diff --git a/TO_MERGE/agm/NameTags/functions/CrewInfo/fn_doShow.sqf b/TO_MERGE/agm/NameTags/functions/CrewInfo/fn_doShow.sqf deleted file mode 100644 index 869cdb6fb7..0000000000 --- a/TO_MERGE/agm/NameTags/functions/CrewInfo/fn_doShow.sqf +++ /dev/null @@ -1,92 +0,0 @@ -/* - Author: aeroson - - Description: - Shows the actual text and sets text the crew info - - Parameters: - None - - Returns: - Nothing -*/ - -#include "common.sqf" - -private["_roleImages", "_player", "_vehicle", "_type", "_config", "_text", "_data", "_isAir", "_turretUnits", "_turretRoles", "_index", "_roleType", "_unit", "_toShow"]; - - -_player = AGM_player; -_vehicle = vehicle _player; -_type = typeOf _vehicle; -_config = configFile >> "CfgVehicles" >> _type; -_text = format[" %2
", getText(_config>>"picture"), getText (_config >> "DisplayName")]; - - - -_data = [_type] call AGM_CrewInfo_fnc_getVehicleData; - -_isAir = _data select 0; -_data = _data select 1; - -_turretUnits = [_data, { _vehicle turretUnit (_x select 0) } ] call AGM_Core_fnc_map; -_turretRoles = [_data, { _x select 1 } ] call AGM_Core_fnc_map; - - -_roleType = CARGO; -_toShow = []; -{ - switch (_x) do { - case commander _vehicle: { - _roleType = COMMANDER; - }; - case gunner _vehicle: { - _roleType = GUNNER; - }; - case driver _vehicle: { - _roleType = if(_isAir) then { PILOT } else { DRIVER }; - }; - default { - _index = _turretUnits find _x; - if(_index !=-1 ) then { - _roleType = _turretRoles select _index; - } else { - _roleType = CARGO; - }; - }; - }; - _toShow pushBack [_x, _roleType]; -} forEach crew _vehicle; - - -_toShow = [ - _toShow, - [], - { - _x select 1 - }, - "ASCEND", - { - _unit = _x select 0; - alive _unit - } -] call BIS_fnc_sortBy; - - -_roleImages = ROLE_IMAGES; -{ - _unit = _x select 0; - _roleType = _x select 1; - _text = _text + format["%1
", [_unit] call AGM_Core_fnc_getName, _roleImages select _roleType]; -} forEach _toShow; - - -("AGM_CrewInfo_CrewInfo" call BIS_fnc_rscLayer) cutRsc ["AGM_CrewInfo_dialog", "PLAIN", 1, false]; - -terminate (missionNamespace getVariable ["AGM_CrewInfo_hideCrewInfoHandle", scriptNull]); -AGM_CrewInfo_hideCrewInfoHandle = 0 spawn { - sleep 2; - ("AGM_CrewInfo_CrewInfo" call BIS_fnc_rscLayer) cutFadeOut 2; -}; - -[_text] call AGM_CrewInfo_fnc_setText; diff --git a/TO_MERGE/agm/NameTags/functions/CrewInfo/fn_getVehicleData.sqf b/TO_MERGE/agm/NameTags/functions/CrewInfo/fn_getVehicleData.sqf deleted file mode 100644 index d58c0ec458..0000000000 --- a/TO_MERGE/agm/NameTags/functions/CrewInfo/fn_getVehicleData.sqf +++ /dev/null @@ -1,123 +0,0 @@ -/* - Author: aeroson - - Description: - Gathers and caches data needed by AGM_CrewInfo_fnc_doShow - What really does make difference for the engine is simulation of CfgAmmo - Priority of roles is: driver/pilot, gunner, copilot, commander, ffv, cargo - - Parameters: - None - - Returns: - [ - Is vehicle inherited from Air ? - Array categorizing each vehicle's turret - ] -*/ - -#include "common.sqf" - - - -private ["_type", "_varName", "_data"]; - -_type = _this select 0; - -_varName = format ["AGM_CrewInfo_Cache_%1", _type]; -_data = + (uiNamespace getVariable _varName); - -if (!isNil "_data") exitWith { - _data -}; - -_data = []; - - - -private ["_isAir", "_config", "_fnc_addTurret", "_fnc_addTurretUnit"]; - -_isAir = _type isKindOf "Air"; - -_fnc_addTurretUnit = { - - private ["_config", "_path", "_role", "_simulationEmpty", "_simulationLaserDesignate", "_simulationOther", "_magazine", "_ammo", "_simulation"]; - - _config = _this select 0; - _path = _this select 1; - _role = CARGO; - - _simulationEmpty = 0; - _simulationLaserDesignate = 0; - _simulationOther = 0; - { - { - _magazine = configFile >> "CfgMagazines" >> _x; - _ammo = configfile >> "CfgAmmo" >> getText (_magazine >> "ammo"); - _simulation = getText (_ammo >> "simulation"); - - if(_simulation=="") then { - _simulationEmpty = _simulationEmpty + 1; - } else { - if(_simulation=="laserDesignate") then { - _simulationLaserDesignate = _simulationLaserDesignate + 1; - } else { - _simulationOther = _simulationOther + 1; - }; - }; - - } forEach getArray (configfile >> "CfgWeapons" >> _x >> "magazines"); - } forEach getArray (_config >> "weapons"); - - if(_simulationOther>0) then { - _role = GUNNER; - }; - if (_role == CARGO && {getNumber (_config >> "isCopilot") == 1}) then { - _role = COPILOT; - }; - if (_role == CARGO && {_simulationLaserDesignate>0 || getNumber (_config >> "primaryObserver") == 1}) then { - _role = COMMANDER; - }; - if (_role == CARGO && {getNumber (_config >> "isPersonTurret") == 1}) then { - _role = FFV; - }; - - _data pushBack [_path, _role]; - -}; - - -_fnc_addTurret = { - - private ["_config", "_path", "_count", "_offset", "_index", "_turretPath", "_turretConfig"]; - - _config = _this select 0; - _path = _this select 1; - - _config = _config >> "Turrets"; - _count = count _config; - - _offset = 0; - - for "_index" from 0 to (_count - 1) do { - _turretPath = _path + [_index - _offset]; - _turretConfig = _config select _index; - if (isClass _turretConfig) then { - [_turretConfig, _turretPath] call _fnc_addTurretUnit; - [_turretConfig, _turretPath] call _fnc_addTurret; - } else { - _offset = _offset + 1; - }; - - }; - -}; - - -_config = configFile >> "CfgVehicles" >> _type; -[_config, []] call _fnc_addTurret; - -_data = [_isAir, _data]; -uiNamespace setVariable [_varName, _data]; - -_data diff --git a/TO_MERGE/agm/NameTags/functions/CrewInfo/fn_onMouseZChanged.sqf b/TO_MERGE/agm/NameTags/functions/CrewInfo/fn_onMouseZChanged.sqf deleted file mode 100644 index 92cb5255c3..0000000000 --- a/TO_MERGE/agm/NameTags/functions/CrewInfo/fn_onMouseZChanged.sqf +++ /dev/null @@ -1,16 +0,0 @@ -/* - Author: aeroson - - Description: - Callback for mouse wheel change - - Parameters: - None - - Returns: - Nothing -*/ - -if(call AGM_CrewInfo_fnc_canShow) then { - call AGM_CrewInfo_fnc_doShow; -}; diff --git a/TO_MERGE/agm/NameTags/functions/CrewInfo/fn_setText.sqf b/TO_MERGE/agm/NameTags/functions/CrewInfo/fn_setText.sqf deleted file mode 100644 index 7c31b910c8..0000000000 --- a/TO_MERGE/agm/NameTags/functions/CrewInfo/fn_setText.sqf +++ /dev/null @@ -1,23 +0,0 @@ -/* - Author: aeroson - - Description: - Sets the text on the dialog - - Parameters: - None - - Returns: - Nothing -*/ - -#define AGM_CrewInfo_TextIDC 11123 - -private["_text", "_ctrl"]; - -disableSerialization; - -_text = _this select 0; -_ctrl = (uiNamespace getVariable "AGM_CrewInfo_dialog") displayCtrl AGM_CrewInfo_TextIDC; -_ctrl ctrlSetStructuredText parseText _text; -_ctrl ctrlCommit 0; diff --git a/TO_MERGE/agm/NameTags/functions/fn_drawNameTagIcon.sqf b/TO_MERGE/agm/NameTags/functions/fn_drawNameTagIcon.sqf deleted file mode 100644 index fd9f66f635..0000000000 --- a/TO_MERGE/agm/NameTags/functions/fn_drawNameTagIcon.sqf +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Author: commy2, CAA-Picard - * - * Draw the nametag and rank icon. - * - * Argument: - * 0: Unit (Array) - * 1: alpha (Number) - * 2: Height offset (Number) - * - * Return value: - * None. - */ - -#define TEXTURES_RANKS [ \ - "", \ - "\A3\Ui_f\data\GUI\Cfg\Ranks\private_gs.paa", \ - "\A3\Ui_f\data\GUI\Cfg\Ranks\corporal_gs.paa", \ - "\A3\Ui_f\data\GUI\Cfg\Ranks\sergeant_gs.paa", \ - "\A3\Ui_f\data\GUI\Cfg\Ranks\lieutenant_gs.paa", \ - "\A3\Ui_f\data\GUI\Cfg\Ranks\captain_gs.paa", \ - "\A3\Ui_f\data\GUI\Cfg\Ranks\major_gs.paa", \ - "\A3\Ui_f\data\GUI\Cfg\Ranks\colonel_gs.paa" \ -] - -private ["_player", "_target", "_alpha", "_heightOffset", "_height", "_position", "_color", "_name", "_rank", "_size"]; - -_player = _this select 0; -_target = _this select 1; -_alpha = _this select 2; -_heightOffset = _this select 3; - -_height = [2, 1.5, 1, 1.5, 1] select (["STAND", "CROUCH", "PRONE", "UNDEFINED", ""] find stance _target); - -_position = visiblePositionASL _target; -// Convert position to ASLW (expected by drawIcon3D) and add height offsets -_position set [2, ((_target modelToWorld [0,0,0]) select 2) + _height + _heightOffset]; - -_color = if !(group _target == group _player) then { - [0.77, 0.51, 0.08, _alpha] -} else { - [[1, 1, 1, _alpha], [1, 0, 0, _alpha], [0, 1, 0, _alpha], [0, 0, 1, _alpha], [1, 1, 0, _alpha]] select (["MAIN", "RED", "GREEN", "BLUE", "YELLOW"] find (if (_target == _player) then {0} else {assignedTeam _target})) max 0 -}; - -_name = [_target, true] call AGM_Core_fnc_getName; - -_rank = TEXTURES_RANKS select ((["PRIVATE", "CORPORAL", "SERGEANT", "LIEUTENANT", "CAPTAIN", "MAJOR", "COLONEL"] find rank _target) + 1); -_size = [0, 1] select (profileNamespace getVariable ["AGM_showPlayerRanks", true]); - -drawIcon3D [ - _rank, - _color, - _position, - _size, - _size, - 0, - _name, - 2, - 0.033, - "PuristaMedium" -]; diff --git a/TO_MERGE/agm/NameTags/functions/fn_moduleNameTags.sqf b/TO_MERGE/agm/NameTags/functions/fn_moduleNameTags.sqf deleted file mode 100644 index 33b3941dc6..0000000000 --- a/TO_MERGE/agm/NameTags/functions/fn_moduleNameTags.sqf +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Author: CAA-Picard - * - * Initializes the name tags module. - * - * Arguments: - * Whatever the module provides. - * - * Return Value: - * None - */ - -if !(isServer) exitWith {}; - -_logic = _this select 0; -_units = _this select 1; -_activated = _this select 2; - -if !(_activated) exitWith {}; - -AGM_NameTags_Module = true; - -[_logic, "AGM_NameTags_PlayerNamesViewDistance", "PlayerNamesViewDistance" ] call AGM_Core_fnc_readNumericParameterFromModule; -[_logic, "AGM_NameTags_ShowNamesForAI", "ShowNamesForAI" ] call AGM_Core_fnc_readBooleanParameterFromModule; -[_logic, "AGM_NameTags_CrewInfoVisibility", "Visibility" ] call AGM_Core_fnc_readNumericParameterFromModule; - -diag_log text "[AGM]: NameTags Module Initialized."; diff --git a/TO_MERGE/agm/NameTags/stringtable.xml b/TO_MERGE/agm/NameTags/stringtable.xml deleted file mode 100644 index a558b8986f..0000000000 --- a/TO_MERGE/agm/NameTags/stringtable.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - Show Names - Namen anzeigen - Mostrar nombres - Afficher noms - Zobrazit jména - Pokaż nazwy - Nevek mutatása - Показать имена - - - Show player names - Spielernamen anzeigen - Mostrar nombres de jugadores - Pokaż nazwy graczy - Afficher nom des joueurs - Játékosnevek mutatása - Zobrazit jména hráčů - Mostrar nomes de jogadores - Mostra i nomi dei giocatori - Показать имена игроков - - - Show player name only on cursor (requires player names) - Pokaż nazwę gracza tylko pod kursorem - Mostrar nombres solo en el cursor (requiere Mostrar nombres de jugadores) - Zeige Spielernamen nur an, wenn die Maus auf sie gerrichtet ist (benötigt Spielernamen) - Noms uniquement sous le curseur (si noms affichés) - Zobrazit jméno hráče jenom na kurzor (vyžaduje jména hráčů) - Mostra i nomi solo se puntati (richiede i nomi dei giocatori abilitati) - Mostrar nome de jogador somente no cursor (requer nome de jogadores) - Játékosok nevének mutatása (névcímke szükséges) - Показать имена игроков только под курсором (требует имен игроков) - - - Show player name only on keypress (requires player names) - Spielernamen nur auf Tastendruck anzeigen (benötigt Spielernamen) - Mostrar nombres solo al pulsar (requiere Mostrar nombres de jugadores) - Noms uniquement sur pression de la touche (si noms affichés) - Zobrazit jména hráčů jen na klávesu (vyžaduje jména hráčů) - Pokaż nazwę gracza tylko po przytrzymaniu klawisza - Játékosnevek mutatása gombnyomásra(névcíme szükséges) - Показать имена игроков только по нажатию клавиши (требует имен игроков) - - - Show player ranks (requires player names) - Spielerränge anzeigen (benötig Spielernamen) - Pokaż rangi graczy (wymaga nazw graczy) - Mostrar rango de los jugadores (requiere Mostrar nombres de jugadores) - Grade des joueurs (si noms affichés) - Zobrazit hodnosti hráčů (vyžaduje jména hráčů) - Mostra i gradi (richiede i nomi dei giocatori abilitati) - Mostrar patente de jogadores (requer nome de jogadores) - Játékosok rendfokozatának mutatása (névcímke szükséges) - Показать звания игроков (требует имен игроков) - - - - - Show vehicle crew info - Zeige Fahrzeugbesatzung - Mostrar tripulantes - Pokaż informacje o załodze pojazdu - Zobrazit info o posádce vozidla - Показать экипаж - - - \ No newline at end of file diff --git a/TO_MERGE/agm/NameTags/UI/IconNameTags_ca.paa b/addons/nametags/UI/IconNameTags_ca.paa similarity index 100% rename from TO_MERGE/agm/NameTags/UI/IconNameTags_ca.paa rename to addons/nametags/UI/IconNameTags_ca.paa diff --git a/TO_MERGE/agm/NameTags/UI/icon_position_ffv.paa b/addons/nametags/UI/icon_position_ffv.paa similarity index 100% rename from TO_MERGE/agm/NameTags/UI/icon_position_ffv.paa rename to addons/nametags/UI/icon_position_ffv.paa From cd74a5bb6aab37f8a29df7898f4cc1434ab9ec18 Mon Sep 17 00:00:00 2001 From: bux578 Date: Tue, 13 Jan 2015 15:17:12 +0100 Subject: [PATCH 4/9] change sqf include to hpp https://github.com/KoffeinFlummi/ACE3/pull/10#issuecomment-69745232 --- addons/nametags/functions/{common.sqf => common.hpp} | 0 addons/nametags/functions/fnc_doShow.sqf | 2 +- addons/nametags/functions/fnc_getVehicleData.sqf | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename addons/nametags/functions/{common.sqf => common.hpp} (100%) diff --git a/addons/nametags/functions/common.sqf b/addons/nametags/functions/common.hpp similarity index 100% rename from addons/nametags/functions/common.sqf rename to addons/nametags/functions/common.hpp diff --git a/addons/nametags/functions/fnc_doShow.sqf b/addons/nametags/functions/fnc_doShow.sqf index dd23d0d085..cb0e524f26 100644 --- a/addons/nametags/functions/fnc_doShow.sqf +++ b/addons/nametags/functions/fnc_doShow.sqf @@ -12,7 +12,7 @@ */ #include "script_component.hpp" -#include QUOTE(PATHTOF(functions\common.sqf)); +#include "common.hpp"; private["_roleImages", "_player", "_vehicle", "_type", "_config", "_text", "_data", "_isAir", "_turretUnits", "_turretRoles", "_index", "_roleType", "_unit", "_toShow"]; diff --git a/addons/nametags/functions/fnc_getVehicleData.sqf b/addons/nametags/functions/fnc_getVehicleData.sqf index 6a0ca43fcd..5914bc1f7e 100644 --- a/addons/nametags/functions/fnc_getVehicleData.sqf +++ b/addons/nametags/functions/fnc_getVehicleData.sqf @@ -17,7 +17,7 @@ */ #include "script_component.hpp" -#include QUOTE(PATHTOF(functions\common.sqf)); +#include "common.hpp"; private ["_type", "_varName", "_data"]; From efe68df72897ecc1a287c2400ff468922055b8da Mon Sep 17 00:00:00 2001 From: bux578 Date: Tue, 13 Jan 2015 15:29:55 +0100 Subject: [PATCH 5/9] add stringtable --- addons/nametags/stringtable.xml | 72 +++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 addons/nametags/stringtable.xml diff --git a/addons/nametags/stringtable.xml b/addons/nametags/stringtable.xml new file mode 100644 index 0000000000..7d085b9d44 --- /dev/null +++ b/addons/nametags/stringtable.xml @@ -0,0 +1,72 @@ + + + + + + Show Names + Namen anzeigen + Mostrar nombres + Afficher noms + Zobrazit jména + Pokaż nazwy + Nevek mutatása + Показать имена + + + Show player names + Spielernamen anzeigen + Mostrar nombres de jugadores + Pokaż nazwy graczy + Afficher nom des joueurs + Játékosnevek mutatása + Zobrazit jména hráčů + Mostrar nomes de jogadores + Mostra i nomi dei giocatori + Показать имена игроков + + + Show player name only on cursor (requires player names) + Pokaż nazwę gracza tylko pod kursorem + Mostrar nombres solo en el cursor (requiere Mostrar nombres de jugadores) + Zeige Spielernamen nur an, wenn die Maus auf sie gerrichtet ist (benötigt Spielernamen) + Noms uniquement sous le curseur (si noms affichés) + Zobrazit jméno hráče jenom na kurzor (vyžaduje jména hráčů) + Mostra i nomi solo se puntati (richiede i nomi dei giocatori abilitati) + Mostrar nome de jogador somente no cursor (requer nome de jogadores) + Játékosok nevének mutatása (névcímke szükséges) + Показать имена игроков только под курсором (требует имен игроков) + + + Show player name only on keypress (requires player names) + Spielernamen nur auf Tastendruck anzeigen (benötigt Spielernamen) + Mostrar nombres solo al pulsar (requiere Mostrar nombres de jugadores) + Noms uniquement sur pression de la touche (si noms affichés) + Zobrazit jména hráčů jen na klávesu (vyžaduje jména hráčů) + Pokaż nazwę gracza tylko po przytrzymaniu klawisza + Játékosnevek mutatása gombnyomásra(névcíme szükséges) + Показать имена игроков только по нажатию клавиши (требует имен игроков) + + + Show player ranks (requires player names) + Spielerränge anzeigen (benötig Spielernamen) + Pokaż rangi graczy (wymaga nazw graczy) + Mostrar rango de los jugadores (requiere Mostrar nombres de jugadores) + Grade des joueurs (si noms affichés) + Zobrazit hodnosti hráčů (vyžaduje jména hráčů) + Mostra i gradi (richiede i nomi dei giocatori abilitati) + Mostrar patente de jogadores (requer nome de jogadores) + Játékosok rendfokozatának mutatása (névcímke szükséges) + Показать звания игроков (требует имен игроков) + + + + + Show vehicle crew info + Zeige Fahrzeugbesatzung + Mostrar tripulantes + Pokaż informacje o załodze pojazdu + Zobrazit info o posádce vozidla + Показать экипаж + + + From 992b3f721b0a6c4ebbef0369fcd5e56ad3413746 Mon Sep 17 00:00:00 2001 From: bux578 Date: Tue, 13 Jan 2015 15:39:58 +0100 Subject: [PATCH 6/9] 4 spaces --- addons/nametags/CfgEventHandlers.hpp | 4 +- addons/nametags/CfgVehicles.hpp | 104 +++++++++++++-------------- addons/nametags/RscTitles.hpp | 6 +- addons/nametags/config.cpp | 8 +-- 4 files changed, 61 insertions(+), 61 deletions(-) diff --git a/addons/nametags/CfgEventHandlers.hpp b/addons/nametags/CfgEventHandlers.hpp index 6a84bb0246..8d2422059a 100644 --- a/addons/nametags/CfgEventHandlers.hpp +++ b/addons/nametags/CfgEventHandlers.hpp @@ -1,11 +1,11 @@ class Extended_PreInit_EventHandlers { class ADDON { - init = QUOTE( call COMPILE_FILE(XEH_preInit) ); + init = QUOTE(call COMPILE_FILE(XEH_preInit)); }; }; class Extended_PostInit_EventHandlers { class ADDON { - postInit = QUOTE(call COMPILE_FILE(XEH_postInit) ); + postInit = QUOTE(call COMPILE_FILE(XEH_postInit)); }; }; diff --git a/addons/nametags/CfgVehicles.hpp b/addons/nametags/CfgVehicles.hpp index 5aac521ae9..991f7becb3 100644 --- a/addons/nametags/CfgVehicles.hpp +++ b/addons/nametags/CfgVehicles.hpp @@ -1,56 +1,56 @@ class CfgVehicles { - class Module_F; - class ACE_ModuleNameTags: Module_F { - author = "$STR_ACE_Core_ACETeam"; - category = "ACE"; - displayName = "Name Tags"; - function = FUNC(moduleNameTags); - scope = 2; - isGlobal = 1; - icon = QUOTE(PATHTOF(UI\IconNameTags_ca.paa)); - class Arguments { - class PlayerNamesViewDistance { - displayName = "Player Names View Dist."; - description = "Distance in meters at which player names are shown. Default: 5"; - typeName = "NUMBER"; - defaultValue = 5; - }; - class ShowNamesForAI { - displayName = "Show name tags for AI?"; - description = "Show the name and rank tags for friendly AI units? Default: No"; - typeName = "BOOL"; - class values { - class Yes { - name = "Yes"; - value = 1; - }; - class No { - default = 1; - name = "No"; - value = 0; - }; + class Module_F; + class ACE_ModuleNameTags : Module_F { + author = "$STR_ACE_Core_ACETeam"; + category = "ACE"; + displayName = "Name Tags"; + function = FUNC(moduleNameTags); + scope = 2; + isGlobal = 1; + icon = QUOTE(PATHTOF(UI\IconNameTags_ca.paa)); + class Arguments { + class PlayerNamesViewDistance { + displayName = "Player Names View Dist."; + description = "Distance in meters at which player names are shown. Default: 5"; + typeName = "NUMBER"; + defaultValue = 5; + }; + class ShowNamesForAI { + displayName = "Show name tags for AI?"; + description = "Show the name and rank tags for friendly AI units? Default: No"; + typeName = "BOOL"; + class values { + class Yes { + name = "Yes"; + value = 1; + }; + class No { + default = 1; + name = "No"; + value = 0; + }; + }; + }; + class Visibility { + displayName = "Visibility of crew info"; + description = "Forces visibility of vehicle crew info, or by default allows players to choose it on their own. Default: Do Not Force"; + typeName = "INT"; + class values { + class DoNotForce { + default = 1; + name = "Do Not Force"; + value = 0; + }; + class ForceShow { + name = "Force Show"; + value = 1; + }; + class ForceHide { + name = "Force Hide"; + value = -1; + }; + }; + }; }; - }; - class Visibility { - displayName = "Visibility of crew info"; - description = "Forces visibility of vehicle crew info, or by default allows players to choose it on their own. Default: Do Not Force"; - typeName = "INT"; - class values { - class DoNotForce { - default = 1; - name = "Do Not Force"; - value = 0; - }; - class ForceShow { - name = "Force Show"; - value = 1; - }; - class ForceHide { - name = "Force Hide"; - value = -1; - }; - }; - }; }; - }; }; diff --git a/addons/nametags/RscTitles.hpp b/addons/nametags/RscTitles.hpp index fc2c52c678..7f0ddc2135 100644 --- a/addons/nametags/RscTitles.hpp +++ b/addons/nametags/RscTitles.hpp @@ -4,7 +4,7 @@ #define ST_LEFT 0 class RscTitles { - titles[]={"ACE_CrewInfo_dialog"}; + titles[] = { "ACE_CrewInfo_dialog" }; class ACE_CrewInfo_dialog { idd = -1; movingEnable = 1; @@ -12,7 +12,7 @@ class RscTitles { fadein = 0; fadeout = 999999; name = "ACE_CrewInfo_dialog"; - controlsBackground[] = {"ACE_CrewInfo_text"}; + controlsBackground[] = { "ACE_CrewInfo_text" }; onLoad = "uiNamespace setVariable ['ACE_CrewInfo_dialog', _this select 0]"; onUnload = "uiNamespace setVariable ['ACE_CrewInfo_dialog', objNull]"; @@ -32,7 +32,7 @@ class RscTitles { "(profilenamespace getvariable ['IGUI_TEXT_RGB_B',1])", "(profilenamespace getvariable ['IGUI_TEXT_RGB_A',0.8])" }; - text=""; + text = ""; class Attributes { align = right; }; diff --git a/addons/nametags/config.cpp b/addons/nametags/config.cpp index 9cba032947..a807c850e3 100644 --- a/addons/nametags/config.cpp +++ b/addons/nametags/config.cpp @@ -5,11 +5,11 @@ class CfgPatches { units[] = {}; weapons[] = {}; requiredVersion = 0.60; - requiredAddons[] = {"ace_main", "ace_common", "ace_interaction"}; + requiredAddons[] = { "ace_main", "ace_common", "ace_interaction" }; version = QUOTE(VERSION); versionStr = QUOTE(VERSION); - versionAr[] = {VERSION_AR}; - author[] = {"commy2", "CAA-Picard"}; + versionAr[] = { VERSION_AR }; + author[] = { "commy2", "CAA-Picard" }; authorUrl = "https://github.com/commy2/"; }; }; @@ -21,7 +21,7 @@ class ACE_Core_Default_Keys { class showNames { displayName = "$STR_ACE_NameTags_ShowNames"; condition = "true"; - statement = QUOTE( GVAR(ShowNamesTime) = time; if (call FUNC(canShow)) then {call FUNC(doShow);}; ); + statement = QUOTE(GVAR(ShowNamesTime) = time; if (call FUNC(canShow)) then{ call FUNC(doShow); };); key = 29; shift = 0; control = 0; From f2ef2fa886e472c1a7f34d62bf3f1df365a4af3f Mon Sep 17 00:00:00 2001 From: bux578 Date: Tue, 13 Jan 2015 16:32:15 +0100 Subject: [PATCH 7/9] core -> config --- addons/nametags/CfgVehicles.hpp | 2 +- addons/nametags/config.cpp | 4 ++-- addons/nametags/functions/fnc_doShow.sqf | 6 +++--- addons/nametags/functions/fnc_drawNameTagIcon.sqf | 2 +- addons/nametags/functions/fnc_moduleNameTags.sqf | 6 +++--- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/addons/nametags/CfgVehicles.hpp b/addons/nametags/CfgVehicles.hpp index 991f7becb3..5fdd441933 100644 --- a/addons/nametags/CfgVehicles.hpp +++ b/addons/nametags/CfgVehicles.hpp @@ -1,7 +1,7 @@ class CfgVehicles { class Module_F; class ACE_ModuleNameTags : Module_F { - author = "$STR_ACE_Core_ACETeam"; + author = "$STR_ACE_Common_ACETeam"; category = "ACE"; displayName = "Name Tags"; function = FUNC(moduleNameTags); diff --git a/addons/nametags/config.cpp b/addons/nametags/config.cpp index a807c850e3..d979bb2bb4 100644 --- a/addons/nametags/config.cpp +++ b/addons/nametags/config.cpp @@ -17,7 +17,7 @@ class CfgPatches { #include "CfgEventHandlers.hpp" #include "CfgVehicles.hpp" -class ACE_Core_Default_Keys { +class ACE_Common_Default_Keys { class showNames { displayName = "$STR_ACE_NameTags_ShowNames"; condition = "true"; @@ -30,7 +30,7 @@ class ACE_Core_Default_Keys { }; }; -class ACE_Core_Options { +class ACE_Common_Options { class showPlayerNames { displayName = "$STR_ACE_NameTags_ShowPlayerNames"; default = 1; diff --git a/addons/nametags/functions/fnc_doShow.sqf b/addons/nametags/functions/fnc_doShow.sqf index cb0e524f26..16a6329347 100644 --- a/addons/nametags/functions/fnc_doShow.sqf +++ b/addons/nametags/functions/fnc_doShow.sqf @@ -30,8 +30,8 @@ _data = [_type] call FUNC(getVehicleData); _isAir = _data select 0; _data = _data select 1; -_turretUnits = [_data, { _vehicle turretUnit (_x select 0) } ] call EFUNC(Core,map); -_turretRoles = [_data, { _x select 1 } ] call EFUNC(Core,map); +_turretUnits = [_data, { _vehicle turretUnit (_x select 0) } ] call EFUNC(common,map); +_turretRoles = [_data, { _x select 1 } ] call EFUNC(common,map); _roleType = CARGO; @@ -78,7 +78,7 @@ _roleImages = ROLE_IMAGES; { _unit = _x select 0; _roleType = _x select 1; - _text = _text + format["%1
", [_unit] call EFUNC(Core,getName), _roleImages select _roleType]; + _text = _text + format["%1
", [_unit] call EFUNC(common,getName), _roleImages select _roleType]; } forEach _toShow; diff --git a/addons/nametags/functions/fnc_drawNameTagIcon.sqf b/addons/nametags/functions/fnc_drawNameTagIcon.sqf index 06a5963217..f2a8a1f946 100644 --- a/addons/nametags/functions/fnc_drawNameTagIcon.sqf +++ b/addons/nametags/functions/fnc_drawNameTagIcon.sqf @@ -44,7 +44,7 @@ _color = if !(group _target == group _player) then { [[1, 1, 1, _alpha], [1, 0, 0, _alpha], [0, 1, 0, _alpha], [0, 0, 1, _alpha], [1, 1, 0, _alpha]] select (["MAIN", "RED", "GREEN", "BLUE", "YELLOW"] find (if (_target == _player) then {0} else {assignedTeam _target})) max 0 }; -_name = [_target, true] call EFUNC(Core,getName); +_name = [_target, true] call EFUNC(common,getName); _rank = TEXTURES_RANKS select ((["PRIVATE", "CORPORAL", "SERGEANT", "LIEUTENANT", "CAPTAIN", "MAJOR", "COLONEL"] find rank _target) + 1); _size = [0, 1] select (profileNamespace getVariable ["ACE_showPlayerRanks", true]); diff --git a/addons/nametags/functions/fnc_moduleNameTags.sqf b/addons/nametags/functions/fnc_moduleNameTags.sqf index c19b993ee5..b701a2db8c 100644 --- a/addons/nametags/functions/fnc_moduleNameTags.sqf +++ b/addons/nametags/functions/fnc_moduleNameTags.sqf @@ -22,8 +22,8 @@ if !(_activated) exitWith {}; GVAR(Module) = true; -[_logic, QGVAR(PlayerNamesViewDistance), "PlayerNamesViewDistance" ] call EFUNC(Core,readNumericParameterFromModule); -[_logic, QGVAR(ShowNamesForAI), "ShowNamesForAI" ] call EFUNC(Core,readBooleanParameterFromModule); -[_logic, QGVAR(CrewInfoVisibility), "Visibility" ] call EFUNC(Core,readNumericParameterFromModule); +[_logic, QGVAR(PlayerNamesViewDistance), "PlayerNamesViewDistance" ] call EFUNC(common,readNumericParameterFromModule); +[_logic, QGVAR(ShowNamesForAI), "ShowNamesForAI" ] call EFUNC(common,readBooleanParameterFromModule); +[_logic, QGVAR(CrewInfoVisibility), "Visibility" ] call EFUNC(common,readNumericParameterFromModule); diag_log text "[ACE]: NameTags Module Initialized."; From 7271e25c5663b02fb3b4e969cd51caa2964258fd Mon Sep 17 00:00:00 2001 From: bux578 Date: Tue, 13 Jan 2015 20:12:41 +0100 Subject: [PATCH 8/9] probably fixing config --- addons/nametags/CfgVehicles.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/nametags/CfgVehicles.hpp b/addons/nametags/CfgVehicles.hpp index 5fdd441933..444622f0ed 100644 --- a/addons/nametags/CfgVehicles.hpp +++ b/addons/nametags/CfgVehicles.hpp @@ -4,7 +4,7 @@ class CfgVehicles { author = "$STR_ACE_Common_ACETeam"; category = "ACE"; displayName = "Name Tags"; - function = FUNC(moduleNameTags); + function = QFUNC(moduleNameTags); scope = 2; isGlobal = 1; icon = QUOTE(PATHTOF(UI\IconNameTags_ca.paa)); From db4f88261d76f586e00046103647eeac1fbee730 Mon Sep 17 00:00:00 2001 From: jaynus Date: Tue, 13 Jan 2015 16:47:23 -0800 Subject: [PATCH 9/9] nametags fixed. --- addons/nametags/$PBOPREFIX$ | 1 + addons/nametags/CfgEventHandlers.hpp | 2 +- addons/nametags/XEH_postInit.sqf | 1 - addons/nametags/XEH_preInit.sqf | 1 + addons/nametags/functions/fnc_setText.sqf | 6 ++++-- addons/nametags/script_component.hpp | 8 ++++---- 6 files changed, 11 insertions(+), 8 deletions(-) create mode 100644 addons/nametags/$PBOPREFIX$ diff --git a/addons/nametags/$PBOPREFIX$ b/addons/nametags/$PBOPREFIX$ new file mode 100644 index 0000000000..d0e4754193 --- /dev/null +++ b/addons/nametags/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\nametags \ No newline at end of file diff --git a/addons/nametags/CfgEventHandlers.hpp b/addons/nametags/CfgEventHandlers.hpp index 8d2422059a..e75956f440 100644 --- a/addons/nametags/CfgEventHandlers.hpp +++ b/addons/nametags/CfgEventHandlers.hpp @@ -6,6 +6,6 @@ class Extended_PreInit_EventHandlers { class Extended_PostInit_EventHandlers { class ADDON { - postInit = QUOTE(call COMPILE_FILE(XEH_postInit)); + init = QUOTE(call COMPILE_FILE(XEH_postInit)); }; }; diff --git a/addons/nametags/XEH_postInit.sqf b/addons/nametags/XEH_postInit.sqf index b512e8b133..a7c084a73e 100644 --- a/addons/nametags/XEH_postInit.sqf +++ b/addons/nametags/XEH_postInit.sqf @@ -1,7 +1,6 @@ #include "script_component.hpp" // by commy2 and CAA-Picard - if (!hasInterface) exitWith {}; GVAR(ShowNamesTime) = -10; diff --git a/addons/nametags/XEH_preInit.sqf b/addons/nametags/XEH_preInit.sqf index 440aa2231d..940135dd47 100644 --- a/addons/nametags/XEH_preInit.sqf +++ b/addons/nametags/XEH_preInit.sqf @@ -1,5 +1,6 @@ #include "script_component.hpp" + PREP(canShow); PREP(doShow); PREP(drawNameTagIcon); diff --git a/addons/nametags/functions/fnc_setText.sqf b/addons/nametags/functions/fnc_setText.sqf index 1c740f76b0..e7d1b748b1 100644 --- a/addons/nametags/functions/fnc_setText.sqf +++ b/addons/nametags/functions/fnc_setText.sqf @@ -11,13 +11,15 @@ Nothing */ -#define GVAR(TextIDC) 11123 +#include "script_component.hpp" + +#define TextIDC 11123 private["_text", "_ctrl"]; disableSerialization; _text = _this select 0; -_ctrl = (uiNamespace getVariable QGVAR(dialog)) displayCtrl GVAR(TextIDC); +_ctrl = (uiNamespace getVariable QGVAR(dialog)) displayCtrl TextIDC; _ctrl ctrlSetStructuredText parseText _text; _ctrl ctrlCommit 0; diff --git a/addons/nametags/script_component.hpp b/addons/nametags/script_component.hpp index 5def4b85b4..6cffb95618 100644 --- a/addons/nametags/script_component.hpp +++ b/addons/nametags/script_component.hpp @@ -1,12 +1,12 @@ -#define COMPONENT NameTags +#define COMPONENT nametags #include "\z\ace\addons\main\script_mod.hpp" -#ifdef DEBUG_ENABLED_NameTags +#ifdef DEBUG_ENABLED_NAMETAGS #define DEBUG_MODE_FULL #endif -#ifdef DEBUG_SETTINGS_NameTags - #define DEBUG_SETTINGS DEBUG_SETTINGS_NameTags +#ifdef DEBUG_SETTINGS_NAMETAGS + #define DEBUG_SETTINGS DEBUG_SETTINGS_NAMETAGS #endif #include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file