Skip to content

Commit

Permalink
Nametags - Adjustable colors settings (#6641)
Browse files Browse the repository at this point in the history
* Move hard coded nametag team colors to settings

Also made the default colors lighter to make them easier to read

* Added myself to contributors

* Fixed Nametag to Name Tag

* Optimized array copying

* Moved team color settings to color subcategory and used vanilla localization strings

* Split a long line into a more readable multiline solution
  • Loading branch information
zharf authored and PabstMirror committed Nov 17, 2018
1 parent 8119e87 commit e007230
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 7 deletions.
1 change: 1 addition & 0 deletions AUTHORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ Drill <[email protected]>
Dudakov aka [OMCB]Kaban <[email protected]>
Drofseh <[email protected]>
Dslyecxi <[email protected]>
Eclipser <[email protected]>
ElTyranos
eRazeri
evromalarkey <[email protected]>
Expand Down
6 changes: 1 addition & 5 deletions addons/nametags/ACE_Settings.hpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
class ACE_Settings {
class GVAR(defaultNametagColor) {
value[] = {0.77, 0.51, 0.08, 1};
typeName = "COLOR";
isClientSettable = 1;
displayName = CSTRING(DefaultNametagColor);
category = CSTRING(Module_DisplayName);
movedToSQF = 1;
};
class GVAR(showPlayerNames) {
value = 1;
Expand Down
2 changes: 2 additions & 0 deletions addons/nametags/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ PREP_RECOMPILE_START;
#include "XEH_PREP.hpp"
PREP_RECOMPILE_END;

#include "initSettings.sqf"

ADDON = true;
12 changes: 10 additions & 2 deletions addons/nametags/functions/fnc_drawNameTagIcon.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,18 @@ _fnc_parameters = {
private _color = [1, 1, 1, _alpha];
if ((group _target) != (group _player)) then {
_color = +GVAR(defaultNametagColor); //Make a copy, then multiply both alpha values (allows client to decrease alpha in settings)
_color set [3, (_color select 3) * _alpha];
} else {
_color = [[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 ([assignedTeam _target] param [0, "MAIN"])) max 0);
_color = +([
GVAR(nametagColorMain),
GVAR(nametagColorRed),
GVAR(nametagColorGreen),
GVAR(nametagColorBlue),
GVAR(nametagColorYellow)
] select (
(["MAIN", "RED", "GREEN", "BLUE", "YELLOW"] find ([assignedTeam _target] param [0, "MAIN"])) max 0
));
};
_color set [3, (_color select 3) * _alpha];

private _scale = [0.333, 0.5, 0.666, 0.83333, 1] select GVAR(tagSize);

Expand Down
56 changes: 56 additions & 0 deletions addons/nametags/initSettings.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// CBA Settings [ADDON: ace_nametags]:

[
QGVAR(defaultNametagColor), "COLOR",
[LSTRING(DefaultNametagColor)],
[format ["ACE %1", localize LSTRING(Module_DisplayName)], localize "str_a3_rscdisplaygameoptions_buttongui"],
[0.77, 0.51, 0.08, 1],
false, // isGlobal
{[QGVAR(defaultNametagColor), _this] call EFUNC(common,cbaSettings_settingChanged)}
] call CBA_settings_fnc_init;

[
QGVAR(nametagColorMain), "COLOR",
["str_team_main"],
[format ["ACE %1", localize LSTRING(Module_DisplayName)], localize "str_a3_rscdisplaygameoptions_buttongui"],
[1.00, 1.00, 1.00, 1],
false, // isGlobal
{[QGVAR(nametagColorMain), _this] call EFUNC(common,cbaSettings_settingChanged)}
] call CBA_settings_fnc_init;

[
QGVAR(nametagColorRed), "COLOR",
["str_team_red"],
[format ["ACE %1", localize LSTRING(Module_DisplayName)], localize "str_a3_rscdisplaygameoptions_buttongui"],
[1.00, 0.67, 0.67, 1],
false, // isGlobal
{[QGVAR(nametagColorRed), _this] call EFUNC(common,cbaSettings_settingChanged)}
] call CBA_settings_fnc_init;

[
QGVAR(nametagColorGreen), "COLOR",
["str_team_green"],
[format ["ACE %1", localize LSTRING(Module_DisplayName)], localize "str_a3_rscdisplaygameoptions_buttongui"],
[0.67, 1.00, 0.67, 1],
false, // isGlobal
{[QGVAR(nametagColorGreen), _this] call EFUNC(common,cbaSettings_settingChanged)}
] call CBA_settings_fnc_init;

[
QGVAR(nametagColorBlue), "COLOR",
["str_team_blue"],
[format ["ACE %1", localize LSTRING(Module_DisplayName)], localize "str_a3_rscdisplaygameoptions_buttongui"],
[0.67, 0.67, 1.00, 1],
false, // isGlobal
{[QGVAR(nametagColorBlue), _this] call EFUNC(common,cbaSettings_settingChanged)}
] call CBA_settings_fnc_init;

[
QGVAR(nametagColorYellow),
"COLOR",
["str_team_yellow"],
[format ["ACE %1", localize LSTRING(Module_DisplayName)], localize "str_a3_rscdisplaygameoptions_buttongui"],
[1.00, 1.00, 0.67, 1],
false, // isGlobal
{[QGVAR(nametagColorYellow), _this] call EFUNC(common,cbaSettings_settingChanged)}
] call CBA_settings_fnc_init;

0 comments on commit e007230

Please sign in to comment.