]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Make the CCR() color replacement function common and add the cvars for it
authorSamual Lenks <samual@xonotic.org>
Thu, 7 Feb 2013 00:16:42 +0000 (19:16 -0500)
committerSamual Lenks <samual@xonotic.org>
Thu, 7 Feb 2013 00:16:42 +0000 (19:16 -0500)
_hud_common.cfg
qcsrc/common/notifications.qc
qcsrc/common/notifications.qh
qcsrc/common/util.qc
qcsrc/common/util.qh

index ba88a2a4fa6fedcd4f2343caeb2e8b1445b1893e..0cada5f8906a6412504f88a20108172cf867b7dd 100644 (file)
@@ -8,6 +8,15 @@ seta hud_configure_grid_alpha 0.15 "alpha for visible grid when in configure mod
 seta hud_fontsize 11 "text fontsize for the hud"
 seta hud_width 560 "2D virtual width for the hud"
 
+seta hud_colorset_foreground_1 "^2" "primary priority (important names, etc)"
+seta hud_colorset_foreground_2 "^3" "secondary priority (items, locations, numbers, etc)"
+seta hud_colorset_foreground_3 "^4" "tertiary priority or relatively inconsequential text"
+seta hud_colorset_foreground_4 "^1" "notice/attention grabbing texting"
+seta hud_colorset_kill_1 "^1" "'bad' or 'dangerous' text (death messages against you, kill notifications, etc)"
+seta hud_colorset_kill_2 "^3" "similar to above, but less important... OR, a highlight out of above message type"
+seta hud_colorset_kill_3 "^4" "'good' or 'beneficial' text (you fragging someone, etc)"
+seta hud_colorset_background "^7" "neutral/unimportant text"
+
 // general hud panel cvars (i.e. shouldn't be adjusted by a skin config)
 seta hud_panel_weapons_ammo_full_shells 60 "show 100% of the status bar at this ammo count"
 seta hud_panel_weapons_ammo_full_nails 320 "show 100% of the status bar at this ammo count"
@@ -90,4 +99,4 @@ seta hud_shownames_mindistance 1000 "start fading alpha/size at this distance"
 seta hud_shownames_maxdistance 5000 "alpha/size is 0 at this distance"
 seta hud_shownames_antioverlap 1 "if two tags get too close to each other, fade out the one further away from you"
 seta hud_shownames_antioverlap_distance 50 "2d distance to other tag after which to fade out"
-seta hud_shownames_offset 52 "offset (along z-axis) tag from player origin by this many units"
\ No newline at end of file
+seta hud_shownames_offset 52 "offset (along z-axis) tag from player origin by this many units"
index 437f51e172835ad6cd5419551253b11aee94d813..1ce0d0bedf8dcfb628d3288d914db5ef25892d92 100644 (file)
@@ -15,28 +15,6 @@ string TCR(string input, string teamcolor, string teamtext) // TODO: MOVE TO UTI
        return input;
 }
 
-// color code replace, place inside of sprintf and parse the string
-string CCR(string input) // TODO: MOVE TO UTIL.QC
-{
-       // Default colors listed in comments
-       
-       // foreground/normal colors
-       input = strreplace("^F1", "^2", input); // Green  // primary priority (important names, etc)
-       input = strreplace("^F2", "^3", input); // Yellow // secondary priority (items, locations, numbers, etc)
-       input = strreplace("^F3", "^4", input); // Blue   // tertiary priority or relatively inconsequential text
-       input = strreplace("^F4", "^1", input); // Red    // notice/attention grabbing texting
-
-       // "kill" colors
-       input = strreplace("^K1", "^1", input); // Red    // "bad" or "dangerous" text (death messages against you, kill notifications, etc)
-       input = strreplace("^K2", "^3", input); // Yellow // similar to above, but less important... OR, a highlight out of above message type
-       input = strreplace("^K3", "^4", input); // Blue   // "good" or "beneficial" text (you fragging someone, etc)
-
-       // background colors
-       input = strreplace("^BG", "^7", input); // White // neutral/unimportant text
-       input = strreplace("^N", "^7", input);  // White // "none"-- reset to white...
-       return input;
-}
-
 #ifndef MENUQC
 // select between the normal or the gentle message string based on client (or server) settings
 string normal_or_gentle(string normal, string gentle)
index 8b6298c3d9d777093a815a6ff4725c0c28cb1120..de2d9f9fbc6d71275b99595e30462261013f4f6f 100644 (file)
@@ -10,7 +10,6 @@
 #define MSG_DEATH 4 // "Personal" AND "Global" death messages 
 
 string TCR(string input, string teamcolor, string teamtext); // team code replace
-string CCR(string input); // color code replace, place inside of sprintf and parse the string
 
 void Dump_Notifications(float fh, float alsoprint);
 
index 0cc53bd33c35de1f7f659ad83df5be142bb22b76..89eae22239d20c16166768b48f9274bf682bd3fa 100644 (file)
@@ -2530,3 +2530,25 @@ void backtrace(string msg)
        cvar_set("prvm_backtraceforwarnings", ftos(war));
 }
 #endif
+
+// color code replace, place inside of sprintf and parse the string
+string CCR(string input)
+{
+       // See the autocvar declarations in util.qh for default values
+       
+       // foreground/normal colors
+       input = strreplace("^F1", autocvar_hud_colorset_foreground_1, input); 
+       input = strreplace("^F2", autocvar_hud_colorset_foreground_2, input); 
+       input = strreplace("^F3", autocvar_hud_colorset_foreground_3, input); 
+       input = strreplace("^F4", autocvar_hud_colorset_foreground_4, input); 
+
+       // "kill" colors
+       input = strreplace("^K1", autocvar_hud_colorset_kill_1, input);
+       input = strreplace("^K2", autocvar_hud_colorset_kill_2, input);
+       input = strreplace("^K3", autocvar_hud_colorset_kill_3, input);
+
+       // background colors
+       input = strreplace("^BG", autocvar_hud_colorset_background, input);
+       input = strreplace("^N", "^7", input); // "none"-- reset to white...
+       return input;
+}
index 263d7f8229d9bd65ac143918f104682a38116a8c..6b1e5d39a3fd6f1f91dedc75f11371680afb6c47 100644 (file)
@@ -380,3 +380,16 @@ float Count_Proper_Strings(string improper, string...count);
 float Count_Proper_Floats(float improper, float...count);
 
 void backtrace(string msg);
+
+// color code replace, place inside of sprintf and parse the string
+// defaults described as comments
+var string autocvar_hud_colorset_foreground_1 = "^2"; // F1 - Green  // primary priority (important names, etc)
+var string autocvar_hud_colorset_foreground_2 = "^3"; // F2 - Yellow // secondary priority (items, locations, numbers, etc)
+var string autocvar_hud_colorset_foreground_3 = "^4"; // F3 - Blue   // tertiary priority or relatively inconsequential text
+var string autocvar_hud_colorset_foreground_4 = "^1"; // F4 - Red    // notice/attention grabbing texting
+var string autocvar_hud_colorset_kill_1 = "^1"; // K1 - Red    // "bad" or "dangerous" text (death messages against you, kill notifications, etc)
+var string autocvar_hud_colorset_kill_2 = "^3"; // K2 - Yellow // similar to above, but less important... OR, a highlight out of above message type
+var string autocvar_hud_colorset_kill_3 = "^4"; // K3 - Blue   // "good" or "beneficial" text (you fragging someone, etc)
+var string autocvar_hud_colorset_background = "^7"; // BG - White // neutral/unimportant text
+
+string CCR(string input);