]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/t_items.qc
Nades: don't forget to think
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / t_items.qc
index be4991c2a8e05b07bef76aa0ecc0294f1a82cad8..89d6b06caf07ff80ef2631e2ab1c33f27c75709a 100644 (file)
@@ -3,7 +3,6 @@
 #include "../common/items/all.qc"
 
 #if defined(SVQC)
-    #include "_all.qh"
 
     #include "bot/bot.qh"
     #include "bot/waypoints.qh"
 
     #include "../common/weapons/all.qh"
 
-    #include "../warpzonelib/util_server.qh"
+    #include "../lib/warpzone/util_server.qh"
 #endif
 
 #ifdef CSQC
-void ItemDraw()
-{SELFPARAM();
+void ItemDraw(entity self)
+{
     if(self.gravity)
     {
         Movetype_Physics_MatchServer(autocvar_cl_projectiles_sloppy);
@@ -64,8 +63,8 @@ void ItemDraw()
     }
 }
 
-void ItemDrawSimple()
-{SELFPARAM();
+void ItemDrawSimple(entity this)
+{
     if(self.gravity)
     {
         Movetype_Physics_MatchServer(autocvar_cl_projectiles_sloppy);
@@ -246,8 +245,8 @@ void ItemRead(float _IsNew)
 #endif
 
 #ifdef SVQC
-bool ItemSend(entity to, int sf)
-{SELFPARAM();
+bool ItemSend(entity this, entity to, int sf)
+{
        if(self.gravity)
                sf |= ISF_DROP;
        else
@@ -476,7 +475,7 @@ void Item_RespawnCountdown (void)
                                {
                                        entity wi = get_weaponinfo(self.weapon);
                                        if (wi.m_id) {
-                                               entity wp = WaypointSprite_Spawn(WP_Weapon, 0, 0, self, '0 0 64', world, 0, self, waypointsprite_attached, true, RADARICON_POWERUP);
+                                               entity wp = WaypointSprite_Spawn(WP_Weapon, 0, 0, self, '0 0 64', world, 0, self, waypointsprite_attached, true, RADARICON_Weapon);
                                                wp.wp_extra = wi.m_id;
                                                break;
                                        }
@@ -484,7 +483,7 @@ void Item_RespawnCountdown (void)
                                {
                                        entity ii = self.itemdef;
                                        if (ii.m_id) {
-                                               entity wp = WaypointSprite_Spawn(WP_Item, 0, 0, self, '0 0 64', world, 0, self, waypointsprite_attached, true, RADARICON_POWERUP);
+                                               entity wp = WaypointSprite_Spawn(WP_Item, 0, 0, self, '0 0 64', world, 0, self, waypointsprite_attached, true, RADARICON_Item);
                                                wp.wp_extra = ii.m_id;
                                                break;
                                        }
@@ -1203,8 +1202,8 @@ void StartItemA (entity a)
     StartItem(strzone(a.m_model.model_str()), a.m_sound, a.m_respawntime(), a.m_respawntimejitter(), a.m_name, a.m_itemid, 0, a.m_itemflags, a.m_pickupevalfunc, a.m_botvalue);
 }
 
-void spawnfunc_item_rockets()
-{SELFPARAM();
+spawnfunc(item_rockets)
+{
        if(!self.ammo_rockets)
                self.ammo_rockets = g_pickup_rockets;
        if(!self.pickup_anyway)
@@ -1212,14 +1211,14 @@ void spawnfunc_item_rockets()
     StartItemA (ITEM_Rockets);
 }
 
-void spawnfunc_item_bullets()
-{SELFPARAM();
+spawnfunc(item_bullets)
+{
        if(!weaponswapping)
        if(autocvar_sv_q3acompat_machineshotgunswap)
        if(self.classname != "droppedweapon")
        {
                weaponswapping = true;
-               spawnfunc_item_shells();
+               spawnfunc_item_shells(this);
                weaponswapping = false;
                return;
        }
@@ -1231,8 +1230,8 @@ void spawnfunc_item_bullets()
     StartItemA (ITEM_Bullets);
 }
 
-void spawnfunc_item_cells()
-{SELFPARAM();
+spawnfunc(item_cells)
+{
        if(!self.ammo_cells)
                self.ammo_cells = g_pickup_cells;
        if(!self.pickup_anyway)
@@ -1240,8 +1239,8 @@ void spawnfunc_item_cells()
        StartItemA (ITEM_Cells);
 }
 
-void spawnfunc_item_plasma()
-{SELFPARAM();
+spawnfunc(item_plasma)
+{
        if(!self.ammo_plasma)
                self.ammo_plasma = g_pickup_plasma;
        if(!self.pickup_anyway)
@@ -1249,14 +1248,14 @@ void spawnfunc_item_plasma()
        StartItemA (ITEM_Plasma);
 }
 
-void spawnfunc_item_shells()
-{SELFPARAM();
+spawnfunc(item_shells)
+{
        if(!weaponswapping)
        if(autocvar_sv_q3acompat_machineshotgunswap)
        if(self.classname != "droppedweapon")
        {
                weaponswapping = true;
-               spawnfunc_item_bullets();
+               spawnfunc_item_bullets(this);
                weaponswapping = false;
                return;
        }
@@ -1268,8 +1267,8 @@ void spawnfunc_item_shells()
        StartItemA (ITEM_Shells);
 }
 
-void spawnfunc_item_armor_small()
-{SELFPARAM();
+spawnfunc(item_armor_small)
+{
        if(!self.armorvalue)
                self.armorvalue = g_pickup_armorsmall;
        if(!self.max_armorvalue)
@@ -1279,8 +1278,8 @@ void spawnfunc_item_armor_small()
        StartItemA (ITEM_ArmorSmall);
 }
 
-void spawnfunc_item_armor_medium()
-{SELFPARAM();
+spawnfunc(item_armor_medium)
+{
        if(!self.armorvalue)
                self.armorvalue = g_pickup_armormedium;
        if(!self.max_armorvalue)
@@ -1290,8 +1289,8 @@ void spawnfunc_item_armor_medium()
        StartItemA (ITEM_ArmorMedium);
 }
 
-void spawnfunc_item_armor_big()
-{SELFPARAM();
+spawnfunc(item_armor_big)
+{
        if(!self.armorvalue)
                self.armorvalue = g_pickup_armorbig;
        if(!self.max_armorvalue)
@@ -1301,8 +1300,8 @@ void spawnfunc_item_armor_big()
        StartItemA (ITEM_ArmorLarge);
 }
 
-void spawnfunc_item_armor_large()
-{SELFPARAM();
+spawnfunc(item_armor_large)
+{
        if(!self.armorvalue)
                self.armorvalue = g_pickup_armorlarge;
        if(!self.max_armorvalue)
@@ -1312,8 +1311,8 @@ void spawnfunc_item_armor_large()
        StartItemA (ITEM_ArmorMega);
 }
 
-void spawnfunc_item_health_small()
-{SELFPARAM();
+spawnfunc(item_health_small)
+{
        if(!self.max_health)
                self.max_health = g_pickup_healthsmall_max;
        if(!self.health)
@@ -1323,8 +1322,8 @@ void spawnfunc_item_health_small()
        StartItemA (ITEM_HealthSmall);
 }
 
-void spawnfunc_item_health_medium()
-{SELFPARAM();
+spawnfunc(item_health_medium)
+{
        if(!self.max_health)
                self.max_health = g_pickup_healthmedium_max;
        if(!self.health)
@@ -1334,8 +1333,8 @@ void spawnfunc_item_health_medium()
     StartItemA (ITEM_HealthMedium);
 }
 
-void spawnfunc_item_health_large()
-{SELFPARAM();
+spawnfunc(item_health_large)
+{
        if(!self.max_health)
                self.max_health = g_pickup_healthlarge_max;
        if(!self.health)
@@ -1345,8 +1344,8 @@ void spawnfunc_item_health_large()
        StartItemA (ITEM_HealthLarge);
 }
 
-void spawnfunc_item_health_mega()
-{SELFPARAM();
+spawnfunc(item_health_mega)
+{
     if(!self.max_health)
         self.max_health = g_pickup_healthmega_max;
     if(!self.health)
@@ -1357,28 +1356,28 @@ void spawnfunc_item_health_mega()
 }
 
 // support old misnamed entities
-void spawnfunc_item_armor1() { spawnfunc_item_armor_small(); }  // FIXME: in Quake this is green armor, in Xonotic maps it is an armor shard
-void spawnfunc_item_armor25() { spawnfunc_item_armor_large(); }
-void spawnfunc_item_health1() { spawnfunc_item_health_small(); }
-void spawnfunc_item_health25() { spawnfunc_item_health_medium(); }
-void spawnfunc_item_health100() { spawnfunc_item_health_mega(); }
+spawnfunc(item_armor1) { spawnfunc_item_armor_small(this); }  // FIXME: in Quake this is green armor, in Xonotic maps it is an armor shard
+spawnfunc(item_armor25) { spawnfunc_item_armor_large(this); }
+spawnfunc(item_health1) { spawnfunc_item_health_small(this); }
+spawnfunc(item_health25) { spawnfunc_item_health_medium(this); }
+spawnfunc(item_health100) { spawnfunc_item_health_mega(this); }
 
-void spawnfunc_item_strength()
-{SELFPARAM();
+spawnfunc(item_strength)
+{
                if(!self.strength_finished)
                        self.strength_finished = autocvar_g_balance_powerup_strength_time;
                StartItemA (ITEM_Strength);
 }
 
-void spawnfunc_item_invincible()
-{SELFPARAM();
+spawnfunc(item_invincible)
+{
                if(!self.invincible_finished)
                        self.invincible_finished = autocvar_g_balance_powerup_invincible_time;
                StartItemA (ITEM_Shield);
 }
 
 // compatibility:
-void spawnfunc_item_quad() {SELFPARAM(); self.classname = "item_strength";spawnfunc_item_strength();}
+spawnfunc(item_quad) { self.classname = "item_strength";spawnfunc_item_strength(this);}
 
 void target_items_use()
 {SELFPARAM();
@@ -1404,8 +1403,8 @@ void target_items_use()
                centerprint(activator, self.message);
 }
 
-void spawnfunc_target_items (void)
-{SELFPARAM();
+spawnfunc(target_items)
+{
        float n, i, j;
        entity e;
        string s;
@@ -1525,8 +1524,8 @@ void spawnfunc_target_items (void)
        }
 }
 
-void spawnfunc_item_fuel(void)
-{SELFPARAM();
+spawnfunc(item_fuel)
+{
        if(!self.ammo_fuel)
                self.ammo_fuel = g_pickup_fuel;
        if(!self.pickup_anyway)
@@ -1534,23 +1533,23 @@ void spawnfunc_item_fuel(void)
        StartItemA (ITEM_JetpackFuel);
 }
 
-void spawnfunc_item_fuel_regen(void)
+spawnfunc(item_fuel_regen)
 {
        if(start_items & ITEM_JetpackRegen.m_itemid)
        {
-               spawnfunc_item_fuel();
+               spawnfunc_item_fuel(this);
                return;
        }
        StartItemA (ITEM_JetpackRegen);
 }
 
-void spawnfunc_item_jetpack(void)
-{SELFPARAM();
+spawnfunc(item_jetpack)
+{
        if(!self.ammo_fuel)
                self.ammo_fuel = g_pickup_fuel_jetpack;
        if(start_items & ITEM_Jetpack.m_itemid)
        {
-               spawnfunc_item_fuel();
+               spawnfunc_item_fuel(this);
                return;
        }
        StartItemA (ITEM_Jetpack);