From: TimePath Date: Tue, 11 Aug 2015 08:52:22 +0000 (+1000) Subject: Add ammoPic attribute X-Git-Tag: xonotic-v0.8.2~2063^2~2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=18727bca9e59c2e1c6ce19a0159accc236f1c594;p=xonotic%2Fxonotic-data.pk3dir.git Add ammoPic attribute --- diff --git a/qcsrc/common/items/item/ammo.qc b/qcsrc/common/items/item/ammo.qc index 58f30fb84..faf2b26da 100644 --- a/qcsrc/common/items/item/ammo.qc +++ b/qcsrc/common/items/item/ammo.qc @@ -6,6 +6,7 @@ REGISTER_ITEM(Bullets, Ammo) { this.m_model = "models/items/a_bullets.mdl"; this.m_name = "bullets"; + this.m_ammoPic = "ammo_bullets"; #ifdef SVQC this.m_botvalue = 2000; this.m_itemid = IT_NAILS; @@ -14,6 +15,7 @@ REGISTER_ITEM(Bullets, Ammo) { REGISTER_ITEM(Cells, Ammo) { this.m_model = "models/items/a_cells.md3"; this.m_name = "cells"; + this.m_ammoPic = "ammo_cells"; #ifdef SVQC this.m_botvalue = 2000; this.m_itemid = IT_CELLS; @@ -22,6 +24,7 @@ REGISTER_ITEM(Cells, Ammo) { REGISTER_ITEM(Plasma, Ammo) { this.m_model = "models/items/a_cells.md3"; this.m_name = "plasma"; + this.m_ammoPic = "ammo_cells"; #ifdef SVQC this.m_botvalue = 2000; this.m_itemid = IT_PLASMA; @@ -30,6 +33,7 @@ REGISTER_ITEM(Plasma, Ammo) { REGISTER_ITEM(Rockets, Ammo) { this.m_model = "models/items/a_rockets.md3"; this.m_name = "rockets"; + this.m_ammoPic = "ammo_rockets"; #ifdef SVQC this.m_botvalue = 3000; this.m_itemid = IT_ROCKETS; @@ -38,6 +42,7 @@ REGISTER_ITEM(Rockets, Ammo) { REGISTER_ITEM(Shells, Ammo) { this.m_model = "models/items/a_shells.md3"; this.m_name = "shells"; + this.m_ammoPic = "ammo_shells"; #ifdef SVQC this.m_botvalue = 500; this.m_itemid = IT_SHELLS; diff --git a/qcsrc/common/items/item/ammo.qh b/qcsrc/common/items/item/ammo.qh index 84f20483e..70c4ef1ef 100644 --- a/qcsrc/common/items/item/ammo.qh +++ b/qcsrc/common/items/item/ammo.qh @@ -2,6 +2,7 @@ #define AMMO_H #include "pickup.qh" CLASS(Ammo, Pickup) + ATTRIB(Ammo, m_ammoPic, string, string_null) #ifdef SVQC ATTRIB(Ammo, m_pickupevalfunc, float(entity player, entity item), commodity_pickupevalfunc) ATTRIB(Ammo, m_respawntime, float(), GET(g_pickup_respawntime_ammo)) diff --git a/qcsrc/common/items/item/jetpack.qc b/qcsrc/common/items/item/jetpack.qc index ad4ab2d0d..25dd9b131 100644 --- a/qcsrc/common/items/item/jetpack.qc +++ b/qcsrc/common/items/item/jetpack.qc @@ -3,28 +3,26 @@ #include "../../../server/constants.qh" #endif -REGISTER_ITEM(Jetpack, Pickup) { +#include "ammo.qh" +#include "powerup.qh" + +REGISTER_ITEM(Jetpack, Powerup) { this.m_model = "models/items/g_jetpack.md3"; this.m_name = "Jet pack"; #ifdef SVQC this.m_botvalue = BOT_PICKUP_RATING_LOW; - this.m_itemflags = FL_POWERUP; this.m_itemid = IT_JETPACK; this.m_pickupevalfunc = commodity_pickupevalfunc; - this.m_respawntime = GET(g_pickup_respawntime_powerup); - this.m_respawntimejitter = GET(g_pickup_respawntimejitter_powerup); #endif } -REGISTER_ITEM(JetpackFuel, Pickup) { - this.m_model = "models/items/g_fuel.md3"; - this.m_name = "Fuel"; +REGISTER_ITEM(JetpackFuel, Ammo) { + this.m_model = "models/items/g_fuel.md3"; + this.m_name = "Fuel"; + this.m_ammoPic = "ammo_fuel"; #ifdef SVQC - this.m_botvalue = BOT_PICKUP_RATING_LOW; - this.m_itemid = IT_FUEL; - this.m_pickupevalfunc = commodity_pickupevalfunc; - this.m_respawntime = GET(g_pickup_respawntime_ammo); - this.m_respawntimejitter = GET(g_pickup_respawntimejitter_ammo); + this.m_botvalue = BOT_PICKUP_RATING_LOW; + this.m_itemid = IT_FUEL; #endif } diff --git a/qcsrc/common/weapons/all.qc b/qcsrc/common/weapons/all.qc index 72c92471a..53974d8d5 100644 --- a/qcsrc/common/weapons/all.qc +++ b/qcsrc/common/weapons/all.qc @@ -353,14 +353,14 @@ void W_RandomWeapons(entity e, float n) string GetAmmoPicture(.int ammotype) { - switch(ammotype) + switch (ammotype) { - case ammo_shells: return "ammo_shells"; - case ammo_nails: return "ammo_bullets"; - case ammo_rockets: return "ammo_rockets"; - case ammo_cells: return "ammo_cells"; - case ammo_plasma: return "ammo_cells"; - case ammo_fuel: return "ammo_fuel"; + case ammo_shells: return ITEM_Shells.m_ammoPic; + case ammo_nails: return ITEM_Bullets.m_ammoPic; + case ammo_rockets: return ITEM_Rockets.m_ammoPic; + case ammo_cells: return ITEM_Cells.m_ammoPic; + case ammo_plasma: return ITEM_Plasma.m_ammoPic; + case ammo_fuel: return ITEM_JetpackFuel.m_ammoPic; default: return ""; // wtf, no ammo type? } }