]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add ammoPic attribute
authorTimePath <andrew.hardaker1995@gmail.com>
Tue, 11 Aug 2015 08:52:22 +0000 (18:52 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Wed, 12 Aug 2015 08:36:21 +0000 (18:36 +1000)
qcsrc/common/items/item/ammo.qc
qcsrc/common/items/item/ammo.qh
qcsrc/common/items/item/jetpack.qc
qcsrc/common/weapons/all.qc

index 58f30fb848483ca8438593174e44e3d58592dd92..faf2b26da28b8ded5020d87c86ecbcc92b59b65b 100644 (file)
@@ -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;
index 84f20483e4f2902d65cc325ee8d0f0ca31d0509b..70c4ef1efad17c8b3348133458dd354299a4ef21 100644 (file)
@@ -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))
index ad4ab2d0df48bf0c95b653dd778f1c0ad882495e..25dd9b131c2aadaeedf31117aebec7a63531bc06 100644 (file)
@@ -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
 }
 
index 72c92471a9c537435aaeb29ed20072303c7700a3..53974d8d558f4dc63a90ce8d216439197b88dcf7 100644 (file)
@@ -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?
        }
 }