]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add jetpack
authorTimePath <andrew.hardaker1995@gmail.com>
Tue, 12 May 2015 10:09:44 +0000 (20:09 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Tue, 12 May 2015 10:09:44 +0000 (20:09 +1000)
Fix incorrect ammo from ammo pickups

qcsrc/common/items/all.inc
qcsrc/common/items/item/ammo.qc
qcsrc/common/items/item/armor.qc
qcsrc/common/items/item/health.qc
qcsrc/common/items/item/jetpack.qc [new file with mode: 0644]
qcsrc/common/items/item/pickup.qh
qcsrc/common/items/item/powerup.qc
qcsrc/server/t_items.qc

index 6e2a6ba8c4f7216f6179046f2c2b7652ff056881..5776b7ef264a07e28a8a21c27f63193ccb7b2c6b 100644 (file)
@@ -4,4 +4,5 @@
 #include "item/armor.qc"
 #include "item/buff.qc"
 #include "item/health.qc"
+#include "item/jetpack.qc"
 #include "item/powerup.qc"
index b6f9abcc6eb591102f761c6809f52d15ab7c82a6..449905ea5e37e37db4194c534951d0cbfedf9c5f 100644 (file)
@@ -1,5 +1,7 @@
 #include "ammo.qh"
-#include "../../../server/t_items.qh"
+#ifdef SVQC
+    #include "../../../server/t_items.qh"
+#endif
 
 #define WITH(it) this.m_##it;
 #define CONFIGURE(...) MAP(WITH, __VA_ARGS__)
 DEFINE(Bullets
     ,IF(ALL, CONFIGURE
     ,   model               =   "models/items/a_bullets.mdl"
-    ,   sound               =   "misc/itempickup.wav"
     ,   name                =   "bullets"
-    ,   itemid              =   IT_NAILS
     )
     ,IF(SV, CONFIGURE
     ,   botvalue            =   2000
+    ,   itemid              =   IT_NAILS
     )
 )
 DEFINE(Cells
     ,IF(ALL, CONFIGURE
     ,   model               =   "models/items/a_cells.md3"
-    ,   sound               =   "misc/itempickup.wav"
     ,   name                =   "cells"
-    ,   itemid              =   IT_ROCKETS
     )
     ,IF(SV, CONFIGURE
     ,   botvalue            =   2000
+    ,   itemid              =   IT_CELLS
     )
 )
 DEFINE(Plasma
     ,IF(ALL, CONFIGURE
     ,   model               =   "models/items/a_cells.md3"
-    ,   sound               =   "misc/itempickup.wav"
     ,   name                =   "plasma"
-    ,   itemid              =   IT_ROCKETS
     )
     ,IF(SV, CONFIGURE
     ,   botvalue            =   2000
+    ,   itemid              =   IT_PLASMA
     )
 )
 DEFINE(Rockets
     ,IF(ALL, CONFIGURE
     ,   model               =   "models/items/a_rockets.md3"
-    ,   sound               =   "misc/itempickup.wav"
     ,   name                =   "rockets"
-    ,   itemid              =   IT_ROCKETS
     )
     ,IF(SV, CONFIGURE
     ,   botvalue            =   3000
+    ,   itemid              =   IT_ROCKETS
     )
 )
 DEFINE(Shells
     ,IF(ALL, CONFIGURE
     ,   model               =   "models/items/a_shells.md3"
-    ,   sound               =   "misc/itempickup.wav"
     ,   name                =   "shells"
-    ,   itemid              =   IT_SHELLS
     )
     ,IF(SV, CONFIGURE
     ,   botvalue            =   500
+    ,   itemid              =   IT_SHELLS
     )
 )
 
index a5c52458cab73645d4acde4141f7009597cbe2b5..8cbc9cd8a2905ed2724f5bfb5e8b6b5d65eb1d41 100644 (file)
@@ -1,5 +1,7 @@
 #include "armor.qh"
-#include "../../../server/t_items.qh"
+#ifdef SVQC
+    #include "../../../server/t_items.qh"
+#endif
 
 #define WITH(it) this.m_##it;
 #define CONFIGURE(...) MAP(WITH, __VA_ARGS__)
@@ -10,10 +12,10 @@ DEFINE(ArmorSmall
     ,   model               =   "models/items/item_armor_small.md3"
     ,   sound               =   "misc/armor1.wav"
     ,   name                =   "5 Armor"
-    ,   itemid              =   IT_ARMOR_SHARD
     )
     ,IF(SV, CONFIGURE
     ,   botvalue            =   BOT_PICKUP_RATING_LOW
+    ,   itemid              =   IT_ARMOR_SHARD
     ,   respawntime         =         GET(g_pickup_respawntime_short)
     ,   respawntimejitter   =   GET(g_pickup_respawntimejitter_short)
     )
@@ -24,10 +26,10 @@ DEFINE(ArmorMedium
     ,   model               =   "models/items/item_armor_medium.md3"
     ,   sound               =   "misc/armor10.wav"
     ,   name                =   "25 Armor"
-    ,   itemid              =   IT_ARMOR
     )
     ,IF(SV, CONFIGURE
     ,   botvalue            =   BOT_PICKUP_RATING_MID
+    ,   itemid              =   IT_ARMOR
     ,   respawntime         =         GET(g_pickup_respawntime_medium)
     ,   respawntimejitter   =   GET(g_pickup_respawntimejitter_medium)
     )
@@ -38,10 +40,10 @@ DEFINE(ArmorBig
     ,   model               =   "models/items/item_armor_big.md3"
     ,   sound               =   "misc/armor17_5.wav"
     ,   name                =   "50 Armor"
-    ,   itemid              =   IT_ARMOR
     )
     ,IF(SV, CONFIGURE
     ,   botvalue            =   20000 // FIXME: higher than BOT_PICKUP_RATING_HIGH?
+    ,   itemid              =   IT_ARMOR
     ,   respawntime         =         GET(g_pickup_respawntime_long)
     ,   respawntimejitter   =   GET(g_pickup_respawntimejitter_long)
     )
@@ -52,10 +54,10 @@ DEFINE(ArmorLarge
     ,   model               =   "models/items/item_armor_large.md3"
     ,   sound               =   "misc/armor25.wav"
     ,   name                =   "100 Armor"
-    ,   itemid              =   IT_ARMOR
     )
     ,IF(SV, CONFIGURE
     ,   botvalue            =   BOT_PICKUP_RATING_HIGH
+    ,   itemid              =   IT_ARMOR
     ,   respawntime         =         GET(g_pickup_respawntime_long)
     ,   respawntimejitter   =   GET(g_pickup_respawntimejitter_long)
     )
index 2b4a84bcf13dc1a40e67b2871641ca135e684ee5..fba35e2a9473e6cdd346568be22008fa90593496 100644 (file)
@@ -1,5 +1,7 @@
 #include "health.qh"
-#include "../../../server/t_items.qh"
+#ifdef SVQC
+    #include "../../../server/t_items.qh"
+#endif
 
 #define WITH(it) this.m_##it;
 #define CONFIGURE(...) MAP(WITH, __VA_ARGS__)
@@ -10,10 +12,10 @@ DEFINE(HealthSmall
     ,   model               =   "models/items/g_h1.md3"
     ,   sound               =   "misc/minihealth.wav"
     ,   name                =   "5 Health"
-    ,   itemid              =   IT_5HP
     )
     ,IF(SV, CONFIGURE
     ,   botvalue            =   BOT_PICKUP_RATING_LOW
+    ,   itemid              =   IT_5HP
     ,   respawntime         =         GET(g_pickup_respawntime_short)
     ,   respawntimejitter   =   GET(g_pickup_respawntimejitter_short)
     )
@@ -24,10 +26,10 @@ DEFINE(HealthMedium
     ,   model               =   "models/items/g_h25.md3"
     ,   sound               =   "misc/mediumhealth.wav"
     ,   name                =   "25 Health"
-    ,   itemid              =   IT_25HP
     )
     ,IF(SV, CONFIGURE
     ,   botvalue            =   BOT_PICKUP_RATING_MID
+    ,   itemid              =   IT_25HP
     ,   respawntime         =         GET(g_pickup_respawntime_short)
     ,   respawntimejitter   =   GET(g_pickup_respawntimejitter_short)
     )
@@ -38,10 +40,10 @@ DEFINE(HealthLarge
     ,   model               =   "models/items/g_h50.md3"
     ,   sound               =   "misc/mediumhealth.wav"
     ,   name                =   "50 Health"
-    ,   itemid              =   IT_25HP
     )
     ,IF(SV, CONFIGURE
     ,   botvalue            =   BOT_PICKUP_RATING_MID
+    ,   itemid              =   IT_25HP
     ,   respawntime         =         GET(g_pickup_respawntime_medium)
     ,   respawntimejitter   =   GET(g_pickup_respawntimejitter_medium)
     )
@@ -52,10 +54,10 @@ DEFINE(HealthMega
     ,   model               =   "models/items/g_h100.md3"
     ,   sound               =   "misc/megahealth.wav"
     ,   name                =   "100 Health"
-    ,   itemid              =   IT_HEALTH
     )
     ,IF(SV, CONFIGURE
     ,   botvalue            =   BOT_PICKUP_RATING_HIGH
+    ,   itemid              =   IT_HEALTH
     ,   respawntime         =         GET(g_pickup_respawntime_long)
     ,   respawntimejitter   =   GET(g_pickup_respawntimejitter_long)
     )
diff --git a/qcsrc/common/items/item/jetpack.qc b/qcsrc/common/items/item/jetpack.qc
new file mode 100644 (file)
index 0000000..d130b06
--- /dev/null
@@ -0,0 +1,56 @@
+#ifdef SVQC
+    #include "../../../server/t_items.qh"
+    #include "../../../server/constants.qh"
+#endif
+
+#define WITH(it) this.m_##it;
+#define CONFIGURE(...) MAP(WITH, __VA_ARGS__)
+#define DEFINE(id, ...) REGISTER_ITEM(id, Pickup, MAP(IDENTITY, __VA_ARGS__))
+
+DEFINE(Jetpack
+    ,IF(ALL, CONFIGURE
+    ,   model               =   "models/items/g_jetpack.md3"
+    ,   name                =   "Jet pack"
+    )
+    ,IF(SV, CONFIGURE
+    ,   botvalue            =   BOT_PICKUP_RATING_LOW
+    ,   itemflags           =   FL_POWERUP
+    ,   itemid              =   IT_JETPACK
+    ,   pickupevalfunc      =   commodity_pickupevalfunc
+    ,   respawntime         =         GET(g_pickup_respawntime_powerup)
+    ,   respawntimejitter   =   GET(g_pickup_respawntimejitter_powerup)
+    )
+)
+
+DEFINE(JetpackFuel
+    ,IF(ALL, CONFIGURE
+    ,   model               =   "models/items/g_fuel.md3"
+    ,   name                =   "Fuel"
+    )
+    ,IF(SV, CONFIGURE
+    ,   botvalue            =   BOT_PICKUP_RATING_LOW
+    ,   itemid              =   IT_FUEL
+    ,   pickupevalfunc      =   commodity_pickupevalfunc
+    ,   respawntime         =         GET(g_pickup_respawntime_ammo)
+    ,   respawntimejitter   =   GET(g_pickup_respawntimejitter_ammo)
+    )
+)
+
+DEFINE(JetpackRegen
+    ,IF(ALL, CONFIGURE
+    ,   model               =   "models/items/g_fuelregen.md3"
+    ,   name                =   "Fuel regenerator"
+    )
+    ,IF(SV, CONFIGURE
+    ,   botvalue            =   BOT_PICKUP_RATING_LOW
+    ,   itemflags           =   FL_POWERUP
+    ,   itemid              =   IT_FUEL_REGEN
+    ,   pickupevalfunc      =   commodity_pickupevalfunc
+    ,   respawntime         =         GET(g_pickup_respawntime_powerup)
+    ,   respawntimejitter   =   GET(g_pickup_respawntimejitter_powerup)
+    )
+)
+
+#undef WITH
+#undef CONFIGURE
+#undef DEFINE
index 1bd644a7c3e5f81a8f55fe4fab524c373b5a2a69..1bcbc389950ace48d927602879138988beca896c 100644 (file)
@@ -4,12 +4,12 @@
 CLASS(Pickup, GameItem)
     METHOD(Pickup, respondTo, bool(entity, int))
     ATTRIB(Pickup, m_model, string, string_null)
-    ATTRIB(Pickup, m_sound, string, string_null)
+    ATTRIB(Pickup, m_sound, string, "misc/itempickup.wav")
     ATTRIB(Pickup, m_name, string, string_null)
-    ATTRIB(Pickup, m_itemid, int, 0)
 #ifdef SVQC
     ATTRIB(Pickup, m_botvalue, int, 0)
     ATTRIB(Pickup, m_itemflags, int, 0)
+    ATTRIB(Pickup, m_itemid, int, 0)
     ATTRIB(Pickup, m_pickupevalfunc, float(entity player, entity item), generic_pickupevalfunc)
     ATTRIB(Pickup, m_respawntime, float(), func_null)
     ATTRIB(Pickup, m_respawntimejitter, float(), func_null)
index 7270664d41f61504b98a7c50dcf782ef75c2e06c..9100e0bb3643430a4fe5cb84a2b8e8948e7dead3 100644 (file)
@@ -19,6 +19,8 @@ DEFINE(Strength
     ,   model               =   "models/items/g_strength.md3"
     ,   sound               =   "misc/powerup.wav"
     ,   name                =   "Strength Powerup"
+    )
+    ,IF(SV, CONFIGURE
     ,   itemid              =   IT_STRENGTH
     )
 )
@@ -27,6 +29,8 @@ DEFINE(Shield
     ,   model               =   "models/items/g_invincible.md3"
     ,   sound               =   "misc/powerup_shield.wav"
     ,   name                =   "Shield"
+    )
+    ,IF(SV, CONFIGURE
     ,   itemid              =   IT_INVINCIBLE
     )
 )
index 8a8f74008a8f66c0ef248451b77d9537188ca0ac..4a87edd0e9e410275c57ca6c214e8607e1c527a4 100644 (file)
@@ -1478,7 +1478,7 @@ void spawnfunc_item_fuel(void)
                self.ammo_fuel = g_pickup_fuel;
        if(!self.pickup_anyway)
                self.pickup_anyway = g_pickup_ammo_anyway;
-       StartItem ("models/items/g_fuel.md3", "misc/itempickup.wav", g_pickup_respawntime_ammo, g_pickup_respawntimejitter_ammo, "Fuel", IT_FUEL, 0, 0, commodity_pickupevalfunc, BOT_PICKUP_RATING_LOW);
+       StartItemA (ITEM_JetpackFuel);
 }
 
 void spawnfunc_item_fuel_regen(void)
@@ -1488,7 +1488,7 @@ void spawnfunc_item_fuel_regen(void)
                spawnfunc_item_fuel();
                return;
        }
-       StartItem ("models/items/g_fuelregen.md3", "misc/itempickup.wav", g_pickup_respawntime_powerup, g_pickup_respawntimejitter_powerup, "Fuel regenerator", IT_FUEL_REGEN, 0, FL_POWERUP, commodity_pickupevalfunc, BOT_PICKUP_RATING_LOW);
+       StartItemA (ITEM_JetpackRegen);
 }
 
 void spawnfunc_item_jetpack(void)
@@ -1500,7 +1500,7 @@ void spawnfunc_item_jetpack(void)
                spawnfunc_item_fuel();
                return;
        }
-       StartItem ("models/items/g_jetpack.md3", "misc/itempickup.wav", g_pickup_respawntime_powerup, g_pickup_respawntimejitter_powerup, "Jet pack", IT_JETPACK, 0, FL_POWERUP, commodity_pickupevalfunc, BOT_PICKUP_RATING_LOW);
+       StartItemA (ITEM_Jetpack);
 }
 
 float GiveWeapon(entity e, float wpn, float op, float val)