From 93cbee1110d8ab9add9b212e15f337107f737286 Mon Sep 17 00:00:00 2001 From: TimePath Date: Mon, 24 Aug 2015 14:24:28 +1000 Subject: [PATCH] Fix their waypoints --- qcsrc/client/waypointsprites.qc | 16 ++++------------ qcsrc/common/items/item.qh | 3 +++ qcsrc/common/items/item/armor.qc | 5 +++++ qcsrc/common/items/item/health.qc | 5 +++++ qcsrc/common/items/item/jetpack.qc | 6 ++++++ qcsrc/common/items/item/powerup.qc | 26 ++++++++++++++++---------- qcsrc/server/t_items.qc | 23 ++++++----------------- 7 files changed, 45 insertions(+), 39 deletions(-) diff --git a/qcsrc/client/waypointsprites.qc b/qcsrc/client/waypointsprites.qc index 40fc56a41..8c7c54af2 100644 --- a/qcsrc/client/waypointsprites.qc +++ b/qcsrc/client/waypointsprites.qc @@ -170,19 +170,17 @@ float spritelookupblinkvalue(string s) if(get_weaponinfo(stof(substring(s, 4, strlen(s)))).spawnflags & WEP_FLAG_SUPERWEAPON) return 2; + FOREACH(ITEMS, it.m_waypoint == s, LAMBDA( + return it.m_waypointblink; + )); + switch(s) { case "ons-cp-atck": return 2; case "ons-cp-dfnd": return 0.5; - case "item_health_mega": return 2; - case "item_armor_large": return 2; case "item-invis": return 2; case "item-extralife": return 2; case "item-speed": return 2; - case "item-strength": return 2; - case "item-shield": return 2; - case "item-fuelregen": return 2; - case "item-jetpack": return 2; case "tagged-target": return 2; default: return 1; } @@ -253,15 +251,9 @@ string spritelookuptext(string s) case "dom-blue": return _("Control point"); case "dom-yellow": return _("Control point"); case "dom-pink": return _("Control point"); - case "item_health_mega": return _("Mega health"); - case "item_armor_large": return _("Large armor"); case "item-invis": return _("Invisibility"); case "item-extralife": return _("Extra life"); case "item-speed": return _("Speed"); - case "item-strength": return _("Strength"); - case "item-shield": return _("Shield"); - case "item-fuelregen": return _("Fuel regen"); - case "item-jetpack": return _("Jet Pack"); case "frozen": return _("Frozen!"); case "tagged-target": return _("Tagged"); case "vehicle": return _("Vehicle"); diff --git a/qcsrc/common/items/item.qh b/qcsrc/common/items/item.qh index 16db39728..6e566f6cc 100644 --- a/qcsrc/common/items/item.qh +++ b/qcsrc/common/items/item.qh @@ -7,6 +7,9 @@ CLASS(GameItem, Object) ATTRIB(GameItem, m_id, int, 0) ATTRIB(GameItem, m_name, string, string_null) ATTRIB(GameItem, m_icon, string, string_null) + ATTRIB(GameItem, m_color, vector, '1 1 1') + ATTRIB(GameItem, m_waypoint, string, string_null) + ATTRIB(GameItem, m_waypointblink, int, 1) METHOD(GameItem, display, void(entity this, void(string name, string icon) returns)) { returns(this.m_name, this.m_icon ? sprintf("/gfx/hud/%s/%s", cvar_string("menu_skin"), this.m_icon) : string_null); } diff --git a/qcsrc/common/items/item/armor.qc b/qcsrc/common/items/item/armor.qc index a4fa60574..43fc3283f 100644 --- a/qcsrc/common/items/item/armor.qc +++ b/qcsrc/common/items/item/armor.qc @@ -34,6 +34,8 @@ REGISTER_ITEM(ArmorLarge, Armor) { this.m_sound = "misc/armor17_5.wav"; this.m_name = "50 Armor"; this.m_icon = "armor"; + this.m_color = '0 1 0'; + this.m_waypoint = _("Large armor"); #ifdef SVQC this.m_botvalue = 20000; // FIXME: higher than BOT_PICKUP_RATING_HIGH? this.m_itemid = IT_ARMOR; @@ -47,6 +49,9 @@ REGISTER_ITEM(ArmorMega, Armor) { this.m_sound = "misc/armor25.wav"; this.m_name = "100 Armor"; this.m_icon = "item_large_armor"; + this.m_color = '0 1 0'; + this.m_waypoint = _("Mega armor"); + this.m_waypointblink = 2; #ifdef SVQC this.m_botvalue = BOT_PICKUP_RATING_HIGH; this.m_itemid = IT_ARMOR; diff --git a/qcsrc/common/items/item/health.qc b/qcsrc/common/items/item/health.qc index dded21951..823c81288 100644 --- a/qcsrc/common/items/item/health.qc +++ b/qcsrc/common/items/item/health.qc @@ -34,6 +34,8 @@ REGISTER_ITEM(HealthLarge, Health) { this.m_sound = "misc/mediumhealth.wav"; this.m_name = "50 Health"; this.m_icon = "health"; + this.m_color = '1 0 0'; + this.m_waypoint = _("Large health"); #ifdef SVQC this.m_botvalue = BOT_PICKUP_RATING_MID; this.m_itemid = IT_25HP; @@ -47,6 +49,9 @@ REGISTER_ITEM(HealthMega, Health) { this.m_sound = "misc/megahealth.wav"; this.m_name = "100 Health"; this.m_icon = "item_mega_health"; + this.m_color = '1 0 0'; + this.m_waypoint = _("Mega health"); + this.m_waypointblink = 2; #ifdef SVQC this.m_botvalue = BOT_PICKUP_RATING_HIGH; this.m_itemid = IT_HEALTH; diff --git a/qcsrc/common/items/item/jetpack.qc b/qcsrc/common/items/item/jetpack.qc index 856704dd8..dcc16b6e4 100644 --- a/qcsrc/common/items/item/jetpack.qc +++ b/qcsrc/common/items/item/jetpack.qc @@ -10,6 +10,9 @@ REGISTER_ITEM(Jetpack, Powerup) { this.m_model = "models/items/g_jetpack.md3"; this.m_name = "Jet pack"; this.m_icon = "jetpack"; + this.m_color = '0.5 0.5 0.5'; + this.m_waypoint = _("Jet Pack"); + this.m_waypointblink = 2; #ifdef SVQC this.m_botvalue = BOT_PICKUP_RATING_LOW; this.m_itemid = IT_JETPACK; @@ -31,6 +34,9 @@ REGISTER_ITEM(JetpackRegen, Pickup) { this.m_model = "models/items/g_fuelregen.md3"; this.m_name = "Fuel regenerator"; this.m_icon = "fuelregen"; + this.m_color = '1 0.5 0'; + this.m_waypoint = _("Fuel regen"); + this.m_waypointblink = 2; #ifdef SVQC this.m_botvalue = BOT_PICKUP_RATING_LOW; this.m_itemflags = FL_POWERUP; diff --git a/qcsrc/common/items/item/powerup.qc b/qcsrc/common/items/item/powerup.qc index fe3258211..6d38d6374 100644 --- a/qcsrc/common/items/item/powerup.qc +++ b/qcsrc/common/items/item/powerup.qc @@ -5,16 +5,22 @@ .int m_itemid; #endif REGISTER_ITEM(Strength, Powerup) { - this.m_model = "models/items/g_strength.md3"; - this.m_sound = "misc/powerup.wav"; - this.m_name = "Strength Powerup"; - this.m_icon = "strength"; - this.m_itemid = IT_STRENGTH; + this.m_model = "models/items/g_strength.md3"; + this.m_sound = "misc/powerup.wav"; + this.m_name = "Strength Powerup"; + this.m_icon = "strength"; + this.m_color = '0 0 1'; + this.m_waypoint = _("Strength"); + this.m_waypointblink = 2; + this.m_itemid = IT_STRENGTH; } REGISTER_ITEM(Shield, Powerup) { - this.m_model = "models/items/g_invincible.md3"; - this.m_sound = "misc/powerup_shield.wav"; - this.m_name = "Shield"; - this.m_icon = "shield"; - this.m_itemid = IT_INVINCIBLE; + this.m_model = "models/items/g_invincible.md3"; + this.m_sound = "misc/powerup_shield.wav"; + this.m_name = "Shield"; + this.m_icon = "shield"; + this.m_color = '1 0 1'; + this.m_waypoint = _("Shield"); + this.m_waypointblink = 2; + this.m_itemid = IT_INVINCIBLE; } diff --git a/qcsrc/server/t_items.qc b/qcsrc/server/t_items.qc index 406f8ec33..e281cfacf 100644 --- a/qcsrc/server/t_items.qc +++ b/qcsrc/server/t_items.qc @@ -457,24 +457,13 @@ void Item_RespawnCountdown (void) self.count += 1; if(self.count == 1) { - string name; + string name = string_null; vector rgb = '1 0 1'; - name = string_null; - switch (self.items) - { - case ITEM_JetpackRegen.m_itemid: name = "item-fuelregen"; rgb = '1 0.5 0'; break; - case ITEM_Jetpack.m_itemid: name = "item-jetpack"; rgb = '0.5 0.5 0.5'; break; - case ITEM_Strength.m_itemid: name = "item-strength"; rgb = '0 0 1'; break; - case ITEM_Shield.m_itemid: name = "item-shield"; rgb = '1 0 1'; break; - case ITEM_HealthMega.m_itemid: - //if (self.classname == "item_health_mega") - {name = "item_health_mega"; rgb = '1 0 0';} - break; - case ITEM_ArmorMega.m_itemid: - if (self.itemdef == ITEM_ArmorMega) - {name = "item_armor_large"; rgb = '0 1 0';} - break; - } + entity e = self.itemdef; + if (e) { + name = e.m_waypoint; + rgb = e.m_color; + } MUTATOR_CALLHOOK(Item_RespawnCountdown, name, rgb); name = item_name; rgb = item_color; -- 2.39.2