From 47e28b63d682198e39f29aff9bb8a14b9259630b Mon Sep 17 00:00:00 2001 From: terencehill Date: Sat, 26 May 2012 19:42:31 +0200 Subject: [PATCH] Items time now supports superweapons too --- qcsrc/client/hud.qc | 5 ++++- qcsrc/client/waypointsprites.qc | 3 +++ qcsrc/common/constants.qh | 1 + qcsrc/server/defs.qh | 1 + qcsrc/server/g_world.qc | 1 + qcsrc/server/t_items.qc | 34 ++++++++++++++++++++++++++------- 6 files changed, 37 insertions(+), 8 deletions(-) diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index f7ca1a5b9..2c0580e7b 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -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; diff --git a/qcsrc/client/waypointsprites.qc b/qcsrc/client/waypointsprites.qc index 9cbb4effc..0215bf2bc 100644 --- a/qcsrc/client/waypointsprites.qc +++ b/qcsrc/client/waypointsprites.qc @@ -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; } diff --git a/qcsrc/common/constants.qh b/qcsrc/common/constants.qh index 74c45a7a8..12a720e58 100644 --- a/qcsrc/common/constants.qh +++ b/qcsrc/common/constants.qh @@ -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; diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index bb8ed4ad6..d279647f4 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -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; diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index 9d5d4158c..cbe31ec1c 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -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) diff --git a/qcsrc/server/t_items.qc b/qcsrc/server/t_items.qc index 3d7638c00..5762c1774 100644 --- a/qcsrc/server/t_items.qc +++ b/qcsrc/server/t_items.qc @@ -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) { -- 2.39.2