4 #include "../dpdefs/progsdefs.qh"
5 #include "../dpdefs/dpextensions.qh"
6 #include "../common/buffs.qh"
7 #include "../common/weapons/weapons.qh"
9 #include "../common/mapinfo.qh"
12 //***********************
13 //QUAKE 3 ENTITIES - So people can play quake3 maps with the xonotic weapons
14 //***********************
16 // NOTE: for best experience, you need to swap MGs with SGs in the map or it won't have a MG
19 void spawnfunc_ammo_shells() { spawnfunc_item_shells(); }
22 void spawnfunc_ammo_bullets() { spawnfunc_item_bullets(); }
25 void spawnfunc_ammo_grenades() { spawnfunc_item_rockets(); }
28 void spawnfunc_weapon_lightning() { spawnfunc_weapon_electro(); }
29 void spawnfunc_ammo_lightning() { spawnfunc_item_cells(); }
32 void spawnfunc_weapon_plasmagun() { spawnfunc_weapon_hagar(); }
33 void spawnfunc_ammo_cells() { spawnfunc_item_rockets(); }
36 void spawnfunc_weapon_railgun() { spawnfunc_weapon_vortex(); }
37 void spawnfunc_ammo_slugs() { spawnfunc_item_plasma(); }
40 void spawnfunc_weapon_bfg() { spawnfunc_weapon_crylink(); }
41 void spawnfunc_ammo_bfg() { spawnfunc_item_plasma(); }
44 void spawnfunc_ammo_rockets() { spawnfunc_item_rockets(); }
47 void spawnfunc_item_armor_body() { spawnfunc_item_armor_large(); }
48 void spawnfunc_item_armor_combat() { spawnfunc_item_armor_big(); }
49 void spawnfunc_item_armor_shard() { spawnfunc_item_armor_small(); }
50 void spawnfunc_item_enviro() { spawnfunc_item_invincible(); }
52 // weapon remove ent from df
53 void target_init_verify()
56 for(trigger = world; (trigger = find(trigger, classname, "trigger_multiple")); )
57 for(targ = world; (targ = find(targ, targetname, trigger.target)); )
58 if (targ.classname == "target_init" || targ.classname == "target_give" || targ.classname == "target_items")
65 //setsize(targ, trigger.mins, trigger.maxs);
66 //setorigin(targ, trigger.origin);
71 void spawnfunc_target_init()
73 self.spawnflags = 0; // remove all weapons except the ones listed below
74 self.netname = "shotgun"; // keep these weapons through the remove trigger
75 spawnfunc_target_items();
76 InitializeEntity(self, target_init_verify, INITPRIO_FINDTARGET);
79 // weapon give ent from defrag
80 void target_give_init()
83 for (targ = world; (targ = find(targ, targetname, self.target)); ) {
84 if (targ.classname == "weapon_rocketlauncher" || targ.classname == "weapon_devastator") {
85 self.ammo_rockets += targ.count * WEP_CVAR(devastator, ammo);
86 self.netname = "devastator";
88 else if (targ.classname == "weapon_plasmagun") {
89 self.ammo_rockets += targ.count * WEP_CVAR_PRI(hagar, ammo); // WEAPONTODO
90 if(self.netname == "")
91 self.netname = "hagar";
93 self.netname = strcat(self.netname, " hagar");
95 else if (targ.classname == "weapon_bfg") {
96 self.ammo_cells += targ.count * WEP_CVAR_PRI(crylink, ammo);
97 if(self.netname == "")
98 self.netname = "crylink";
100 self.netname = strcat(self.netname, " crylink");
102 else if (targ.classname == "weapon_grenadelauncher" || targ.classname == "weapon_mortar") {
103 self.ammo_rockets += targ.count * WEP_CVAR_PRI(mortar, ammo); // WEAPONTODO
104 if(self.netname == "")
105 self.netname = "mortar";
107 self.netname = strcat(self.netname, " mortar");
109 else if (targ.classname == "item_armor_body")
110 self.armorvalue = 100;
111 else if (targ.classname == "item_health_mega")
113 //remove(targ); // removing ents in init functions causes havoc, workaround:
114 targ.think = SUB_Remove;
115 targ.nextthink = time;
118 spawnfunc_target_items();
119 InitializeEntity(self, target_init_verify, INITPRIO_FINDTARGET);
122 void spawnfunc_target_give()
124 InitializeEntity(self, target_give_init, INITPRIO_FINDTARGET);
127 //void spawnfunc_item_flight() /* handled by buffs mutator or jetpack */
128 //void spawnfunc_item_haste() /* handled by buffs mutator */
129 //void spawnfunc_item_health() /* handled in t_quake.qc */
130 //void spawnfunc_item_health_large() /* handled in t_items.qc */
131 //void spawnfunc_item_health_small() /* handled in t_items.qc */
132 //void spawnfunc_item_health_mega() /* handled in t_items.qc */
133 //void spawnfunc_item_invis() /* handled by buffs mutator */
134 //void spawnfunc_item_regen() /* handled by buffs mutator */
136 // CTF spawnfuncs handled in mutators/gamemode_ctf.qc now
138 void spawnfunc_item_flight()
140 if(!cvar("g_buffs") || !cvar("g_buffs_flight"))
141 spawnfunc_item_jetpack();
143 buff_Init_Compat(self, BUFF_FLIGHT);
152 float DoesQ3ARemoveThisEntity()
154 // Q3 style filters (DO NOT USE, THIS IS COMPAT ONLY)
157 if(!teamplay || g_tdm || g_ctf)
161 if (!(!teamplay || g_tdm || g_ctf))
179 // static char *gametypeNames[] = {"ffa", "tournament", "single", "team", "ctf", "oneflag", "obelisk", "harvester", "teamtournament"}
180 gametypename = "ffa";
182 gametypename = "team";
184 gametypename = "ctf";
186 gametypename = "single";
187 // we do not have the other types (oneflag, obelisk, harvester, teamtournament)
188 if(strstrofs(self.gametype, gametypename, 0) < 0)