]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/t_quake3.qc
Merge branch 'master' into TimePath/unified_weapons
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / t_quake3.qc
index bb1128bd60e8c532c217de9d8f9d99f9c0404d27..8eecc5ee3ba67d16d14204ca3776eee16adcd6b1 100644 (file)
@@ -1,3 +1,30 @@
+#include "_all.qh"
+
+#include "../common/weapons/all.qh"
+#include "../common/buffs.qh"
+
+spawnfunc(weapon_crylink);
+spawnfunc(weapon_electro);
+spawnfunc(weapon_hagar);
+spawnfunc(weapon_machinegun);
+spawnfunc(weapon_vortex);
+
+spawnfunc(target_items);
+
+spawnfunc(item_bullets);
+spawnfunc(item_cells);
+spawnfunc(item_rockets);
+spawnfunc(item_shells);
+
+spawnfunc(item_jetpack);
+
+spawnfunc(item_armor_big);
+spawnfunc(item_armor_large);
+spawnfunc(item_armor_small);
+
+spawnfunc(item_health_medium);
+spawnfunc(item_health_mega);
+
 //***********************
 //QUAKE 3 ENTITIES - So people can play quake3 maps with the xonotic weapons
 //***********************
 // NOTE: for best experience, you need to swap MGs with SGs in the map or it won't have a MG
 
 // SG -> SG
-void spawnfunc_ammo_shells()         { spawnfunc_item_shells();         }
+spawnfunc(ammo_shells)         { spawnfunc_item_shells(this);         }
 
 // MG -> MG
-void spawnfunc_weapon_machinegun()   { spawnfunc_weapon_uzi();          }
-void spawnfunc_ammo_bullets()        { spawnfunc_item_bullets();        }
+spawnfunc(ammo_bullets)        { spawnfunc_item_bullets(this);        }
 
 // GL -> Mortar
-void spawnfunc_ammo_grenades()       { spawnfunc_item_rockets();        }
+spawnfunc(ammo_grenades)       { spawnfunc_item_rockets(this);        }
 
-// LG -> Electro
-void spawnfunc_weapon_lightning()    { spawnfunc_weapon_electro();      }
-void spawnfunc_ammo_lightning()      { spawnfunc_item_cells();          }
+// LG -> Lightning
+spawnfunc(weapon_lightning)    { spawnfunc_weapon_electro(this);      }
+spawnfunc(ammo_lightning)      { spawnfunc_item_cells(this);          }
 
 // Plasma -> Hagar
-void spawnfunc_weapon_plasmagun()    { spawnfunc_weapon_hagar();        }
-void spawnfunc_ammo_cells()          { spawnfunc_item_rockets();        }
+spawnfunc(weapon_plasmagun)    { spawnfunc_weapon_hagar(this);        }
+spawnfunc(ammo_cells)          { spawnfunc_item_rockets(this);        }
 
-// Rail -> Nex
-void spawnfunc_weapon_railgun()      { spawnfunc_weapon_nex();          }
-void spawnfunc_ammo_slugs()          { spawnfunc_item_cells();          }
+// Rail -> Vortex
+spawnfunc(weapon_railgun)      { spawnfunc_weapon_vortex(this);          }
+spawnfunc(ammo_slugs)          { spawnfunc_item_cells(this);          }
 
 // BFG -> Crylink
-void spawnfunc_weapon_bfg()          { spawnfunc_weapon_crylink();      }
-void spawnfunc_ammo_bfg()            { spawnfunc_item_cells();          }
+spawnfunc(weapon_bfg)          { spawnfunc_weapon_crylink(this);      }
+spawnfunc(ammo_bfg)            { spawnfunc_item_cells(this);          }
 
 // RL -> RL
-void spawnfunc_ammo_rockets()        { spawnfunc_item_rockets();        }
+spawnfunc(ammo_rockets)        { spawnfunc_item_rockets(this);        }
 
 // Armor
-void spawnfunc_item_armor_body()     { spawnfunc_item_armor_large();    }
-void spawnfunc_item_armor_combat()   { spawnfunc_item_armor_big();      }
-void spawnfunc_item_armor_shard()    { spawnfunc_item_armor_small();    }
-void spawnfunc_item_enviro()         { spawnfunc_item_invincible();     }
+spawnfunc(item_armor_body)     { spawnfunc_item_armor_large(this);    }
+spawnfunc(item_armor_combat)   { spawnfunc_item_armor_big(this);      }
+spawnfunc(item_armor_shard)    { spawnfunc_item_armor_small(this);    }
+spawnfunc(item_enviro)         { spawnfunc_item_invincible(this);     }
 
 // weapon remove ent from df
 void target_init_verify()
@@ -58,43 +84,43 @@ void target_init_verify()
                        }
 }
 
-void spawnfunc_target_init()
+spawnfunc(target_init)
 {
        self.spawnflags = 0; // remove all weapons except the ones listed below
        self.netname = "shotgun"; // keep these weapons through the remove trigger
-       spawnfunc_target_items();
+       spawnfunc_target_items(this);
        InitializeEntity(self, target_init_verify, INITPRIO_FINDTARGET);
 }
 
 // weapon give ent from defrag
 void target_give_init()
-{
+{SELFPARAM();
        entity targ;
        for (targ = world; (targ = find(targ, targetname, self.target)); ) {
-               if (targ.classname == "weapon_rocketlauncher") {
-                       self.ammo_rockets += targ.count * autocvar_g_balance_rocketlauncher_ammo;
-                       self.netname = "rocketlauncher";
+               if (targ.classname == "weapon_rocketlauncher" || targ.classname == "weapon_devastator") {
+                       self.ammo_rockets += targ.count * WEP_CVAR(devastator, ammo);
+                       self.netname = "devastator";
                }
                else if (targ.classname == "weapon_plasmagun") {
-                       self.ammo_rockets += targ.count * autocvar_g_balance_hagar_primary_ammo;
+                       self.ammo_rockets += targ.count * WEP_CVAR_PRI(hagar, ammo); // WEAPONTODO
                        if(self.netname == "")
                                self.netname = "hagar";
                        else
                                self.netname = strcat(self.netname, " hagar");
                }
                else if (targ.classname == "weapon_bfg") {
-                       self.ammo_cells += targ.count * autocvar_g_balance_crylink_primary_ammo;
+                       self.ammo_cells += targ.count * WEP_CVAR_PRI(crylink, ammo);
                        if(self.netname == "")
                                self.netname = "crylink";
                        else
                                self.netname = strcat(self.netname, " crylink");
                }
-               else if (targ.classname == "weapon_grenadelauncher") {
-                       self.ammo_rockets += targ.count * autocvar_g_balance_grenadelauncher_primary_ammo;
+               else if (targ.classname == "weapon_grenadelauncher" || targ.classname == "weapon_mortar") {
+                       self.ammo_rockets += targ.count * WEP_CVAR_PRI(mortar, ammo); // WEAPONTODO
                        if(self.netname == "")
-                               self.netname = "grenadelauncher";
+                               self.netname = "mortar";
                        else
-                               self.netname = strcat(self.netname, " grenadelauncher");
+                               self.netname = strcat(self.netname, " mortar");
                }
                else if (targ.classname == "item_armor_body")
                        self.armorvalue = 100;
@@ -105,27 +131,33 @@ void target_give_init()
         targ.nextthink = time;
        }
        self.spawnflags = 2;
-       spawnfunc_target_items();
+       spawnfunc_target_items(this);
        InitializeEntity(self, target_init_verify, INITPRIO_FINDTARGET);
 }
 
-void spawnfunc_target_give()
+spawnfunc(target_give)
 {
        InitializeEntity(self, target_give_init, INITPRIO_FINDTARGET);
 }
 
-//void spawnfunc_item_flight()       /* not supported */
-//void spawnfunc_item_haste()        /* not supported */
-//void spawnfunc_item_health()       /* handled in t_quake.qc */
-//void spawnfunc_item_health_large() /* handled in t_items.qc */
-//void spawnfunc_item_health_small() /* handled in t_items.qc */
-//void spawnfunc_item_health_mega()  /* handled in t_items.qc */
-//void spawnfunc_item_invis()        /* not supported */
-//void spawnfunc_item_regen()        /* not supported */
+//spawnfunc(item_flight)       /* handled by buffs mutator or jetpack */
+//spawnfunc(item_haste)        /* handled by buffs mutator */
+//spawnfunc(item_health)       /* handled in t_quake.qc */
+//spawnfunc(item_health_large) /* handled in t_items.qc */
+//spawnfunc(item_health_small) /* handled in t_items.qc */
+//spawnfunc(item_health_mega)  /* handled in t_items.qc */
+//spawnfunc(item_invis)        /* handled by buffs mutator */
+//spawnfunc(item_regen)        /* handled by buffs mutator */
 
 // CTF spawnfuncs handled in mutators/gamemode_ctf.qc now
 
-void spawnfunc_item_flight()         { spawnfunc_item_jetpack();       }
+spawnfunc(item_flight)
+{
+       if(!cvar("g_buffs") || !cvar("g_buffs_flight"))
+               spawnfunc_item_jetpack(this);
+       else
+               buff_Init_Compat(self, BUFF_FLIGHT);
+}
 
 .float notteam;
 .float notsingle;
@@ -134,7 +166,7 @@ void spawnfunc_item_flight()         { spawnfunc_item_jetpack();       }
 .float notta;
 .string gametype;
 float DoesQ3ARemoveThisEntity()
-{
+{SELFPARAM();
        // Q3 style filters (DO NOT USE, THIS IS COMPAT ONLY)
 
        if(self.notq3a)