Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nametags - Adjustable colors settings #6641

Merged
merged 6 commits into from
Nov 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe [format ["%1 %2",localize "str_team", localize "str_team_red"]],
so we get "Team Red"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was considering this but I'm not proficient enough in all the languages to know if the word order for that would be grammatically correct (for Finnish it would be reversed...)

[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;