]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
float ids -> constants, thanks for good cleanup tip parasti :3
authorFruitieX <rasse@rasse-lappy.localdomain>
Thu, 10 Jun 2010 00:35:16 +0000 (03:35 +0300)
committerFruitieX <rasse@rasse-lappy.localdomain>
Thu, 10 Jun 2010 00:35:16 +0000 (03:35 +0300)
qcsrc/client/hud.qc
qcsrc/client/hud.qh
qcsrc/common/constants.qh
qcsrc/common/util.qc

index 0db9ffe1b99c0c6301d182a621fe51438adeb64c..c4bd34bc6b8aabdab7f70462ba3ccbbb77d7cac1 100644 (file)
@@ -584,7 +584,7 @@ void HUD_Panel_ExportCfg(string cfgname)
 
                // common cvars for all panels
                float i;
-               for (i = 0; i < panel_cnt; ++i)
+               for (i = 0; i < HUD_PANEL_NUM; ++i)
                {
                        fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), " ", ftos(cvar(strcat("hud_", HUD_Panel_GetName(i)))), "\n"));
                        fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_pos \"", cvar_string(strcat("hud_", HUD_Panel_GetName(i), "_pos")), "\"", "\n"));
@@ -876,7 +876,7 @@ vector HUD_Panel_CheckMove(float id, vector myPos, vector mySize)
        myCenter = '0 0 0'; // shut up fteqcc, there IS a reference
        targCenter = '0 0 0'; // shut up fteqcc, there IS a reference
 
-       for (i = 0; i < panel_cnt; ++i) {
+       for (i = 0; i < HUD_PANEL_NUM; ++i) {
                if(i == id || !HUD_Panel_CheckActive(i))
                        continue;
 
@@ -980,7 +980,7 @@ vector HUD_Panel_CheckResize(float id, vector myPos, vector mySize)
        myCenter = '0 0 0'; // shut up fteqcc, there IS a reference
        targCenter = '0 0 0'; // shut up fteqcc, there IS a reference
 
-       for (i = 0; i < panel_cnt; ++i) {
+       for (i = 0; i < HUD_PANEL_NUM; ++i) {
                if(i == id || !HUD_Panel_CheckActive(i))
                        continue;
 
@@ -1211,7 +1211,7 @@ void HUD_Panel_Mouse()
                vector panelPos;
                vector panelSize;
 
-               for(i = 0; i <= panel_cnt; ++i)
+               for(i = 0; i <= HUD_PANEL_NUM; ++i)
                {
                        panelPos = HUD_Panel_GetPos(i);
                        panelSize = HUD_Panel_GetSize(i);
@@ -1324,7 +1324,7 @@ float weaponorder_cmp(float i, float j, entity pass)
 
 void HUD_WeaponIcons()
 {
-       float id = 0;
+       float id = HUD_PANEL_WEAPONICONS;
        float alpha, stat_weapons; // "constants"
        vector pos, mySize, accuracy_color;
        float i, weapid, fade, weapon_stats, weapon_hit, weapon_damage, weapon_cnt; // variables
@@ -1466,7 +1466,7 @@ string GetAmmoPicture(float i)
 
 void HUD_Inventory()
 {
-       float id = 1;
+       float id = HUD_PANEL_INVENTORY;
        float i;
        float stat_items;
 
@@ -1557,7 +1557,7 @@ void HUD_Inventory()
 // Powerups (#2)
 //
 void HUD_Powerups() {
-       float id = 2;
+       float id = HUD_PANEL_POWERUPS;
        float stat_items;
        stat_items = getstati(STAT_ITEMS);
 
@@ -1781,7 +1781,7 @@ void HUD_Powerups() {
 //
 void HUD_HealthArmor(void)
 {
-       float id = 3;
+       float id = HUD_PANEL_HEALTHARMOR;
        vector pos, mySize;
        pos = HUD_Panel_GetPos(id);
        mySize = HUD_Panel_GetSize(id);
@@ -2412,7 +2412,7 @@ void HUD_Centerprint(string s1, float type, float msg)
 
 void HUD_Notify (void)
 {
-       float id = 4;
+       float id = HUD_PANEL_NOTIFY;
        vector pos, mySize;
        pos = HUD_Panel_GetPos(id);
        mySize = HUD_Panel_GetSize(id);
@@ -2678,7 +2678,7 @@ void HUD_Notify (void)
 //
 void HUD_Timer()
 {
-       float id = 5;
+       float id = HUD_PANEL_TIMER;
        vector pos, mySize;
        pos = HUD_Panel_GetPos(id);
        mySize = HUD_Panel_GetSize(id);
@@ -2737,7 +2737,7 @@ void HUD_Timer()
 //
 void HUD_Radar(void)
 {
-       float id = 6;
+       float id = HUD_PANEL_RADAR;
        vector pos, mySize;
        pos = HUD_Panel_GetPos(id);
        mySize = HUD_Panel_GetSize(id);
@@ -2863,7 +2863,7 @@ void HUD_Radar(void)
 //
 void HUD_Score()
 {
-       float id = 7;
+       float id = HUD_PANEL_SCORE;
        vector pos, mySize;
        pos = HUD_Panel_GetPos(id);
        mySize = HUD_Panel_GetSize(id);
@@ -3011,7 +3011,7 @@ void HUD_Score()
 // Race timer (#8)
 //
 void HUD_RaceTimer (void) {
-       float id = 8;
+       float id = HUD_PANEL_RACETIMER;
        vector pos, mySize;
        pos = HUD_Panel_GetPos(id);
        mySize = HUD_Panel_GetSize(id);
@@ -3154,7 +3154,7 @@ float vote_change; // "time" when vote_active changed
 
 void HUD_VoteWindow(void) 
 {
-       float id = 9;
+       float id = HUD_PANEL_VOTE;
        vector pos, mySize;
        pos = HUD_Panel_GetPos(id);
        mySize = HUD_Panel_GetSize(id);
@@ -3660,7 +3660,7 @@ void HUD_ModIcons(void)
        if (gametype != GAME_KEYHUNT && gametype != GAME_CTF && gametype != GAME_NEXBALL && gametype != GAME_CTS && gametype != GAME_RACE && !hud_configure)
                return;
 
-       float id = 10;
+       float id = HUD_PANEL_MODICONS;
        vector pos, mySize;
        pos = HUD_Panel_GetPos(id);
        mySize = HUD_Panel_GetSize(id);
@@ -3701,7 +3701,7 @@ void HUD_ModIcons(void)
 //
 void HUD_DrawPressedKeys(void)
 {
-       float id = 11;
+       float id = HUD_PANEL_PRESSEDKEYS;
        vector pos, mySize;
        pos = HUD_Panel_GetPos(id);
        mySize = HUD_Panel_GetSize(id);
@@ -3732,7 +3732,7 @@ void HUD_DrawPressedKeys(void)
 float chat_prevtime;
 void HUD_Chat(void)
 {
-       float id = 12;
+       float id = HUD_PANEL_CHAT;
        vector pos, mySize;
        pos = HUD_Panel_GetPos(id);
        mySize = HUD_Panel_GetSize(id);
index ce8fc3a2ff13c0dae328de441670b810a544b7ca..fb736c5e693fb712fa7b8de4742e04fc1f94d4d2 100644 (file)
@@ -1,5 +1,3 @@
-float panel_cnt = 13; // NOTE: IDs start from 0!
-
 vector mousepos;
 vector panel_click_distance; // mouse cursor distance from the top left corner of the panel (saved only upon a click)
 vector panel_click_resizeorigin; // coordinates for opposite point when resizing
index 7fcbec7bf1f606caecb2d99258cf59efc0e61adb..facf3bc9506d2a36da606352e2653413b1f24038 100644 (file)
@@ -565,3 +565,19 @@ float WR_KILLMESSAGE    = 8; // (CSQC) sets w_deathtypestring or leaves it alone
 float WR_RELOAD         = 9; // (SVQC) does not need to do anything
 float WR_RESETPLAYER    = 10; // (SVQC) does not need to do anything
 float WR_IMPACTEFFECT  = 11; // (CSQC) impact effect
+
+
+float HUD_PANEL_WEAPONICONS    = 0;
+float HUD_PANEL_INVENTORY      = 1;
+float HUD_PANEL_POWERUPS       = 2;
+float HUD_PANEL_HEALTHARMOR    = 3;
+float HUD_PANEL_NOTIFY         = 4;
+float HUD_PANEL_TIMER          = 5;
+float HUD_PANEL_RADAR          = 6;
+float HUD_PANEL_SCORE          = 7;
+float HUD_PANEL_RACETIMER      = 8;
+float HUD_PANEL_VOTE           = 9;
+float HUD_PANEL_MODICONS       = 10;
+float HUD_PANEL_PRESSEDKEYS    = 11;
+float HUD_PANEL_CHAT           = 12;
+float HUD_PANEL_NUM            = 13;
index bad6ee9400aef7a6b4ce99ec23f1b9bda38e1d17..5329d4e0accc171a4ce02b893f5f265fe122ea1b 100644 (file)
@@ -1953,19 +1953,19 @@ float get_model_parameters(string m, float sk)
 string HUD_Panel_GetName(float id)
 {
        switch(id) {
-               case 0: return "weaponicons"; break;
-               case 1: return "inventory"; break;
-               case 2: return "powerups"; break;
-               case 3: return "healtharmor"; break;
-               case 4: return "notify"; break;
-               case 5: return "timer"; break;
-               case 6: return "radar"; break;
-               case 7: return "score"; break;
-               case 8: return "racetimer"; break;
-               case 9: return "vote"; break;
-               case 10: return "modicons"; break;
-               case 11: return "pressedkeys"; break;
-               case 12: return "chat"; break;
+               case HUD_PANEL_WEAPONICONS: return "weaponicons"; break;
+               case HUD_PANEL_INVENTORY: return "inventory"; break;
+               case HUD_PANEL_POWERUPS: return "powerups"; break;
+               case HUD_PANEL_HEALTHARMOR: return "healtharmor"; break;
+               case HUD_PANEL_NOTIFY: return "notify"; break;
+               case HUD_PANEL_TIMER: return "timer"; break;
+               case HUD_PANEL_RADAR: return "radar"; break;
+               case HUD_PANEL_SCORE: return "score"; break;
+               case HUD_PANEL_RACETIMER: return "racetimer"; break;
+               case HUD_PANEL_VOTE: return "vote"; break;
+               case HUD_PANEL_MODICONS: return "modicons"; break;
+               case HUD_PANEL_PRESSEDKEYS: return "pressedkeys"; break;
+               case HUD_PANEL_CHAT: return "chat"; break;
                default: return "";
        }
 }