4 #include "../dpdefs/progsdefs.qh"
5 #include "../dpdefs/dpextensions.qh"
7 #include "../common/buffs.qh"
8 #include "../common/weapons/weapons.qh"
10 #include "../common/mapinfo.qh"
13 //***********************
14 //QUAKE 3 ENTITIES - So people can play quake3 maps with the xonotic weapons
15 //***********************
17 // NOTE: for best experience, you need to swap MGs with SGs in the map or it won't have a MG
20 void spawnfunc_ammo_shells() { spawnfunc_item_shells(); }
23 void spawnfunc_ammo_bullets() { spawnfunc_item_bullets(); }
26 void spawnfunc_ammo_grenades() { spawnfunc_item_rockets(); }
29 void spawnfunc_weapon_lightning() { spawnfunc_weapon_electro(); }
30 void spawnfunc_ammo_lightning() { spawnfunc_item_cells(); }
33 void spawnfunc_weapon_plasmagun() { spawnfunc_weapon_hagar(); }
34 void spawnfunc_ammo_cells() { spawnfunc_item_rockets(); }
37 void spawnfunc_weapon_railgun() { spawnfunc_weapon_vortex(); }
38 void spawnfunc_ammo_slugs() { spawnfunc_item_plasma(); }
41 void spawnfunc_weapon_bfg() { spawnfunc_weapon_crylink(); }
42 void spawnfunc_ammo_bfg() { spawnfunc_item_plasma(); }
45 void spawnfunc_ammo_rockets() { spawnfunc_item_rockets(); }
48 void spawnfunc_item_armor_body() { spawnfunc_item_armor_large(); }
49 void spawnfunc_item_armor_combat() { spawnfunc_item_armor_big(); }
50 void spawnfunc_item_armor_shard() { spawnfunc_item_armor_small(); }
51 void spawnfunc_item_enviro() { spawnfunc_item_invincible(); }
53 // weapon remove ent from df
54 void target_init_verify()
57 for(trigger = world; (trigger = find(trigger, classname, "trigger_multiple")); )
58 for(targ = world; (targ = find(targ, targetname, trigger.target)); )
59 if (targ.classname == "target_init" || targ.classname == "target_give" || targ.classname == "target_items")
66 //setsize(targ, trigger.mins, trigger.maxs);
67 //setorigin(targ, trigger.origin);
72 void spawnfunc_target_init()
74 self.spawnflags = 0; // remove all weapons except the ones listed below
75 self.netname = "shotgun"; // keep these weapons through the remove trigger
76 spawnfunc_target_items();
77 InitializeEntity(self, target_init_verify, INITPRIO_FINDTARGET);
80 // weapon give ent from defrag
81 void target_give_init()
84 for (targ = world; (targ = find(targ, targetname, self.target)); ) {
85 if (targ.classname == "weapon_rocketlauncher" || targ.classname == "weapon_devastator") {
86 self.ammo_rockets += targ.count * WEP_CVAR(devastator, ammo);
87 self.netname = "devastator";
89 else if (targ.classname == "weapon_plasmagun") {
90 self.ammo_rockets += targ.count * WEP_CVAR_PRI(hagar, ammo); // WEAPONTODO
91 if(self.netname == "")
92 self.netname = "hagar";
94 self.netname = strcat(self.netname, " hagar");
96 else if (targ.classname == "weapon_bfg") {
97 self.ammo_cells += targ.count * WEP_CVAR_PRI(crylink, ammo);
98 if(self.netname == "")
99 self.netname = "crylink";
101 self.netname = strcat(self.netname, " crylink");
103 else if (targ.classname == "weapon_grenadelauncher" || targ.classname == "weapon_mortar") {
104 self.ammo_rockets += targ.count * WEP_CVAR_PRI(mortar, ammo); // WEAPONTODO
105 if(self.netname == "")
106 self.netname = "mortar";
108 self.netname = strcat(self.netname, " mortar");
110 else if (targ.classname == "item_armor_body")
111 self.armorvalue = 100;
112 else if (targ.classname == "item_health_mega")
114 //remove(targ); // removing ents in init functions causes havoc, workaround:
115 targ.think = SUB_Remove;
116 targ.nextthink = time;
119 spawnfunc_target_items();
120 InitializeEntity(self, target_init_verify, INITPRIO_FINDTARGET);
123 void spawnfunc_target_give()
125 InitializeEntity(self, target_give_init, INITPRIO_FINDTARGET);
128 //void spawnfunc_item_flight() /* handled by buffs mutator or jetpack */
129 //void spawnfunc_item_haste() /* handled by buffs mutator */
130 //void spawnfunc_item_health() /* handled in t_quake.qc */
131 //void spawnfunc_item_health_large() /* handled in t_items.qc */
132 //void spawnfunc_item_health_small() /* handled in t_items.qc */
133 //void spawnfunc_item_health_mega() /* handled in t_items.qc */
134 //void spawnfunc_item_invis() /* handled by buffs mutator */
135 //void spawnfunc_item_regen() /* handled by buffs mutator */
137 // CTF spawnfuncs handled in mutators/gamemode_ctf.qc now
139 void spawnfunc_item_flight()
141 if(!cvar("g_buffs") || !cvar("g_buffs_flight"))
142 spawnfunc_item_jetpack();
144 buff_Init_Compat(self, BUFF_FLIGHT);
153 float DoesQ3ARemoveThisEntity()
155 // Q3 style filters (DO NOT USE, THIS IS COMPAT ONLY)
158 if(!teamplay || g_tdm || g_ctf)
162 if (!(!teamplay || g_tdm || g_ctf))
180 // static char *gametypeNames[] = {"ffa", "tournament", "single", "team", "ctf", "oneflag", "obelisk", "harvester", "teamtournament"}
181 gametypename = "ffa";
183 gametypename = "team";
185 gametypename = "ctf";
187 gametypename = "single";
188 // we do not have the other types (oneflag, obelisk, harvester, teamtournament)
189 if(strstrofs(self.gametype, gametypename, 0) < 0)