]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Items time now supports superweapons too
authorterencehill <piuntn@gmail.com>
Sat, 26 May 2012 17:42:31 +0000 (19:42 +0200)
committerterencehill <piuntn@gmail.com>
Sat, 26 May 2012 17:42:31 +0000 (19:42 +0200)
qcsrc/client/hud.qc
qcsrc/client/waypointsprites.qc
qcsrc/common/constants.qh
qcsrc/server/defs.qh
qcsrc/server/g_world.qc
qcsrc/server/t_items.qc

index f7ca1a5b9867f3ea7d6996b694be0bcfdb96e882..2c0580e7bfa176975bf810f85afcec193ba907d3 100644 (file)
@@ -4922,7 +4922,7 @@ void HUD_CenterPrint (void)
 
 // ItemsTime (#17)
 //
-const float ITEMSTIME_MAXITEMS = 9;
+const float ITEMSTIME_MAXITEMS = 10;
 float ItemsTime_time[ITEMSTIME_MAXITEMS];
 string GetItemsTimePicture(float i)
 {
@@ -4937,6 +4937,7 @@ string GetItemsTimePicture(float i)
                case 6: return "shield";
                case 7: return "fuelregen";
                case 8: return "jetpack";
+               case 9: return "superweapons";
                default: return "";
        }
 }
@@ -5014,6 +5015,7 @@ void HUD_ItemsTime(void)
                ItemsTime_time[6] = getstatf(STAT_SHIELD_TIME);
                ItemsTime_time[7] = getstatf(STAT_FUELREGEN_TIME);
                ItemsTime_time[8] = getstatf(STAT_JETPACK_TIME);
+               ItemsTime_time[9] = getstatf(STAT_SUPERWEAPONS_TIME);
        }
        else
        {
@@ -5029,6 +5031,7 @@ void HUD_ItemsTime(void)
                ItemsTime_time[6] = time + 4;
                ItemsTime_time[7] = time + 19;
                ItemsTime_time[8] = time + 46;
+               ItemsTime_time[9] = time + 28;
        }
 
        float i;
index 9cbb4effc5544faec3057da60c8ccb83ffc15901..0215bf2bc9ea9f096dda66457772cc8d92a534e5 100644 (file)
@@ -221,6 +221,9 @@ float spritelookupblinkvalue(string s)
                case "item-shield":      return 2;
                case "item-fuelregen":   return 2;
                case "item-jetpack":     return 2;
+               case "wpn-fireball":     return 2; // superweapon
+               case "wpn-minstanex":    return 2; // superweapon
+               case "wpn-porto":        return 2; // superweapon
                case "tagged-target":    return 2;
                default:                 return 1;
        }
index 74c45a7a8020d58e4f58f23f7853c2b1a8d91070..12a720e580f3536d60036dd416cee2c75dc44bca 100644 (file)
@@ -209,6 +209,7 @@ const float STAT_STRENGTH_TIME = 85;
 const float STAT_SHIELD_TIME = 86;
 const float STAT_FUELREGEN_TIME = 87;
 const float STAT_JETPACK_TIME = 88;
+const float STAT_SUPERWEAPONS_TIME = 89;
 
 // mod stats (1xx)
 const float STAT_REDALIVE = 100;
index bb8ed4ad6bb76405fa5e96e7a19228ec0e7e0e1e..d279647f494ca7966bce567ebcf43900667d0d95 100644 (file)
@@ -639,6 +639,7 @@ string deathmessage;
 .float item_shield_time;
 .float item_fuelregen_time;
 .float item_jetpack_time;
+.float item_superweapons_time;
 
 .float nex_charge;
 .float nex_charge_rottime;
index 9d5d4158cf720e89db41792cc679e1e200ad5a26..cbe31ec1c09f5189f39c79b3ff2d17a503879c4e 100644 (file)
@@ -804,6 +804,7 @@ void spawnfunc_worldspawn (void)
        addstat(STAT_SHIELD_TIME, AS_FLOAT, item_shield_time);
        addstat(STAT_FUELREGEN_TIME, AS_FLOAT, item_fuelregen_time);
        addstat(STAT_JETPACK_TIME, AS_FLOAT, item_jetpack_time);
+       addstat(STAT_SUPERWEAPONS_TIME, AS_FLOAT, item_superweapons_time);
        Item_ItemsTime_Init();
 
        if(g_ca || g_freezetag)
index 3d7638c001beda713cf80bcc070c87904782ee57..5762c1774be8cc99e1f435a264738d49344191d5 100644 (file)
@@ -188,6 +188,7 @@ float it_strength_time;
 float it_shield_time;
 float it_fuelregen_time;
 float it_jetpack_time;
+float it_superweapons_time;
 
 void Item_ItemsTime_Init()
 {
@@ -200,6 +201,7 @@ void Item_ItemsTime_Init()
        it_shield_time = -1;
        it_fuelregen_time = -1;
        it_jetpack_time = -1;
+       it_superweapons_time = -1;
 }
 void Item_ItemsTime_Clear()
 {
@@ -212,6 +214,7 @@ void Item_ItemsTime_Clear()
        self.item_shield_time      = (it_shield_time      == -1) ? -1 : 0;
        self.item_fuelregen_time   = (it_fuelregen_time   == -1) ? -1 : 0;
        self.item_jetpack_time     = (it_jetpack_time     == -1) ? -1 : 0;
+       self.item_superweapons_time= (it_superweapons_time== -1) ? -1 : 0;
 }
 void Item_ItemsTime_Get(entity e)
 {
@@ -224,6 +227,7 @@ void Item_ItemsTime_Get(entity e)
        e.item_shield_time = it_shield_time;
        e.item_fuelregen_time = it_fuelregen_time;
        e.item_jetpack_time = it_jetpack_time;
+       e.item_superweapons_time = it_superweapons_time;
 }
 float Item_ItemsTime_UpdateTime_Check(float item_time, float t)
 {
@@ -275,6 +279,10 @@ void Item_ItemsTime_UpdateTime(entity e, float t)
                                if(Item_ItemsTime_UpdateTime_Check(it_shield_time, t))
                                        it_shield_time = t;
                                break;
+                       default:
+                               if(WEPSET_CONTAINS_ANY_EA(e, WEPBIT_SUPERWEAPONS))
+                                       if(Item_ItemsTime_UpdateTime_Check(it_superweapons_time, t))
+                                                       it_superweapons_time = t;
                }
        }
        switch(e.items)
@@ -303,17 +311,29 @@ void Item_Respawn (void)
                sound (self, CH_TRIGGER, "misc/itemrespawn.wav", VOL_BASE, ATTN_NORM);  // play respawn sound
        setorigin (self, self.origin);
 
-       if (self.flags & FL_POWERUP || self.classname == "item_armor_large" || self.items == IT_HEALTH)
+       if(self.flags & FL_POWERUP || self.classname == "item_armor_large" || self.items == IT_HEALTH || WEPSET_CONTAINS_ANY_EA(self, WEPBIT_SUPERWEAPONS))
        {
-               for(t = 0, head = world; (head = find(head, classname, self.classname)); )
+               if(WEPSET_CONTAINS_ANY_EA(self, WEPBIT_SUPERWEAPONS))
                {
-                       // in minstagib .classname is "minstagib" for every item
-                       if (g_minstagib && self.items != head.items)
-                               continue;
-                       if (head.scheduledrespawntime > time)
-                               if (t == 0 || head.scheduledrespawntime < t)
+                       for(t = 0, head = world; (head = nextent(head)); )
+                       {
+                               if(clienttype(head) == CLIENTTYPE_NOTACLIENT)
+                               if(WEPSET_CONTAINS_ANY_EA(head, WEPBIT_SUPERWEAPONS))
+                               if(head.scheduledrespawntime > time)
+                               if(t == 0 || head.scheduledrespawntime < t)
                                        t = head.scheduledrespawntime;
+                       }
                }
+               else
+                       for(t = 0, head = world; (head = find(head, classname, self.classname)); )
+                       {
+                               // in minstagib .classname is "minstagib" for every item
+                               if(g_minstagib && self.items != head.items)
+                                       continue;
+                               if(head.scheduledrespawntime > time)
+                               if(t == 0 || head.scheduledrespawntime < t)
+                                       t = head.scheduledrespawntime;
+                       }
                Item_ItemsTime_UpdateTime(self, t);
                FOR_EACH_REALCLIENT(head)
                {