#endif
#else
#ifdef SVQC
-void spawnfunc_weapon_arc (void) // should this really be here?
-{
- weapon_defaultspawnfunc(WEP_ARC);
-}
+void spawnfunc_weapon_arc() { weapon_defaultspawnfunc(WEP_ARC); }
float W_Arc_Beam_Send(entity to, float sf)
{
);
#else
#ifdef SVQC
+void spawnfunc_weapon_laser() { weapon_defaultspawnfunc(WEP_LASER); }
void(float imp) W_SwitchWeapon;
void() W_LastWeapon;
.float swing_prev;
}
}
-void spawnfunc_weapon_laser(void)
-{
- weapon_defaultspawnfunc(WEP_LASER);
-}
-
float W_Laser(float request)
{
switch(request)
);
#else
#ifdef SVQC
+void spawnfunc_weapon_crylink() { weapon_defaultspawnfunc(WEP_CRYLINK); }
.float gravity;
.float crylink_waitrelease;
.entity crylink_lastgroup;
}
}
-void spawnfunc_weapon_crylink (void)
-{
- weapon_defaultspawnfunc(WEP_CRYLINK);
-}
-
float w_crylink(float req)
{
float ammo_amount;
#endif
#else
#ifdef SVQC
-void spawnfunc_weapon_rocketlauncher()
-{
- weapon_defaultspawnfunc(WEP_DEVASTATOR);
-}
+void spawnfunc_weapon_devastator() { weapon_defaultspawnfunc(WEP_DEVASTATOR); }
+void spawnfunc_weapon_rocketlauncher() { spawnfunc_weapon_devastator(); }
void W_Devastator_Unregister()
{
#endif
#else
#ifdef SVQC
+void spawnfunc_weapon_electro() { weapon_defaultspawnfunc(WEP_ELECTRO); }
+
.float electro_count;
.float electro_secondarytime;
electro_shotorigin[3] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ELECTRO), FALSE, FALSE, 4);
}
-void spawnfunc_weapon_electro (void)
-{
- weapon_defaultspawnfunc(WEP_ELECTRO);
-}
-
void w_electro_checkattack()
{
if(self.electro_count > 1)
);
#else
#ifdef SVQC
+void spawnfunc_weapon_fireball() { weapon_defaultspawnfunc(WEP_FIREBALL); }
+
.float bot_primary_fireballmooth; // whatever a mooth is
.vector fireball_impactvec;
.float fireball_primarytime;
other = proj; MUTATOR_CALLHOOK(EditProjectile);
}
-void spawnfunc_weapon_fireball (void)
-{
- weapon_defaultspawnfunc(WEP_FIREBALL);
-}
-
float w_fireball(float req)
{
switch(req)
);
#else
#ifdef SVQC
+void spawnfunc_weapon_hagar() { weapon_defaultspawnfunc(WEP_HAGAR); }
// NO bounce protection, as bounces are limited!
void W_Hagar_Explode (void)
}
}
-void spawnfunc_weapon_hagar (void)
-{
- weapon_defaultspawnfunc(WEP_HAGAR);
-}
-
float w_hagar(float req)
{
float ammo_amount;
);
#else
#ifdef SVQC
+void spawnfunc_weapon_hlac() { weapon_defaultspawnfunc(WEP_HLAC); }
void W_HLAC_Touch (void)
{
}
}
-void spawnfunc_weapon_hlac (void)
-{
- weapon_defaultspawnfunc(WEP_HLAC);
-}
-
float w_hlac(float req)
{
float ammo_amount;
);
#else
#ifdef SVQC
+void spawnfunc_weapon_hook()
+{
+ if(g_grappling_hook) // offhand hook
+ {
+ startitem_failed = TRUE;
+ remove(self);
+ return;
+ }
+ weapon_defaultspawnfunc(WEP_HOOK);
+}
+
.float dmg;
.float dmg_edge;
.float dmg_radius;
other = gren; MUTATOR_CALLHOOK(EditProjectile);
}
-void spawnfunc_weapon_hook (void)
-{
- if(g_grappling_hook) // offhand hook
- {
- startitem_failed = TRUE;
- remove(self);
- return;
- }
- weapon_defaultspawnfunc(WEP_HOOK);
-}
-
float w_hook(float req)
{
float hooked_time_max, hooked_fuel;
/* shortname */ "uzi",
/* fullname */ _("Machine Gun")
);
+
+#ifdef SVQC
+#endif
#else
#ifdef SVQC
+void spawnfunc_weapon_uzi()
+{
+ if(autocvar_sv_q3acompat_machineshotgunswap)
+ if(self.classname != "droppedweapon")
+ {
+ weapon_defaultspawnfunc(WEP_SHOTGUN);
+ return;
+ }
+ weapon_defaultspawnfunc(WEP_UZI);
+}
// leilei's fancy muzzleflash stuff
void UZI_Flash_Go()
}
-void spawnfunc_weapon_machinegun(); // defined in t_items.qc
-
float w_uzi(float req)
{
float ammo_amount;
/* shortname */ "minstanex",
/* fullname */ _("MinstaNex")
);
+
+#ifdef SVQC
+void spawnfunc_weapon_minstanex (void)
+{
+ weapon_defaultspawnfunc(WEP_MINSTANEX);
+}
+#endif
#else
#ifdef SVQC
.float minstanex_lasthit;
W_DecreaseAmmo(ammo_cells, ((g_minstagib) ? 1 : autocvar_g_balance_minstanex_ammo), autocvar_g_balance_minstanex_reload_ammo);
}
-void spawnfunc_weapon_minstanex (void); // defined in t_items.qc
-
float w_minstanex(float req)
{
float ammo_amount;
/* shortname */ "nex",
/* fullname */ _("Nex")
);
+
+#ifdef SVQC
+void spawnfunc_weapon_nex (void)
+{
+ weapon_defaultspawnfunc(WEP_NEX);
+}
+#endif
#else
#ifdef SVQC
);
#else
#ifdef SVQC
+void spawnfunc_weapon_shotgun()
+{
+ if(autocvar_sv_q3acompat_machineshotgunswap)
+ if(self.classname != "droppedweapon")
+ {
+ weapon_defaultspawnfunc(WEP_UZI);
+ return;
+ }
+ weapon_defaultspawnfunc(WEP_SHOTGUN);
+}
+
void W_Shotgun_Attack (void)
{
../common/teams.qh
../common/util.qh
../common/counting.qh
-../common/weapons/weapons.qh // TODO
+weapons/cl_weapons.qh
+../common/weapons/weapons.qh // WEAPONTODO
../common/urllib.qh
../common/command/markup.qh
../common/command/rpn.qh
}
}
-float weaponswapping;
-float internalteam;
-
-void weapon_defaultspawnfunc(float wpn)
-{
- entity e;
- float t;
- var .float ammofield;
- string s;
- entity oldself;
- float i, j;
- float f;
-
- if(self.classname != "droppedweapon" && self.classname != "replacedweapon")
- {
- e = get_weaponinfo(wpn);
-
- if(e.spawnflags & WEP_FLAG_MUTATORBLOCKED)
- {
- print("Attempted to spawn a mutator-blocked weapon; these guns will in the future require a mutator\n");
- /*
- objerror("Attempted to spawn a mutator-blocked weapon rejected");
- startitem_failed = TRUE;
- return;
- */
- }
-
- s = W_Apply_Weaponreplace(e.netname);
- ret_string = s;
- other = e;
- MUTATOR_CALLHOOK(SetWeaponreplace);
- s = ret_string;
- if(s == "")
- {
- remove(self);
- startitem_failed = TRUE;
- return;
- }
- t = tokenize_console(s);
- if(t >= 2)
- {
- self.team = --internalteam;
- oldself = self;
- for(i = 1; i < t; ++i)
- {
- s = argv(i);
- for(j = WEP_FIRST; j <= WEP_LAST; ++j)
- {
- e = get_weaponinfo(j);
- if(e.netname == s)
- {
- self = spawn();
- copyentity(oldself, self);
- self.classname = "replacedweapon";
- weapon_defaultspawnfunc(j);
- break;
- }
- }
- if(j > WEP_LAST)
- {
- print("The weapon replace list for ", oldself.classname, " contains an unknown weapon ", s, ". Skipped.\n");
- }
- }
- self = oldself;
- }
- if(t >= 1) // always the case!
- {
- s = argv(0);
- wpn = 0;
- for(j = WEP_FIRST; j <= WEP_LAST; ++j)
- {
- e = get_weaponinfo(j);
- if(e.netname == s)
- {
- wpn = j;
- break;
- }
- }
- if(j > WEP_LAST)
- {
- print("The weapon replace list for ", self.classname, " contains an unknown weapon ", s, ". Skipped.\n");
- }
- }
- if(wpn == 0)
- {
- remove(self);
- startitem_failed = TRUE;
- return;
- }
- }
-
- e = get_weaponinfo(wpn);
-
- if(!self.respawntime)
- {
- if(WEPSET_CONTAINS_ANY_EA(e, WEPBIT_SUPERWEAPONS))
- {
- self.respawntime = g_pickup_respawntime_superweapon;
- self.respawntimejitter = g_pickup_respawntimejitter_superweapon;
- }
- else
- {
- self.respawntime = g_pickup_respawntime_weapon;
- self.respawntimejitter = g_pickup_respawntimejitter_weapon;
- }
- }
-
- if(WEPSET_CONTAINS_ANY_EA(e, WEPBIT_SUPERWEAPONS))
- if(!self.superweapons_finished)
- self.superweapons_finished = autocvar_g_balance_superweapons_time;
-
- if(e.items)
- {
- for(i = 0, j = 1; i < 24; ++i, j *= 2)
- {
- if(e.items & j)
- {
- ammofield = Item_CounterField(j);
- if(!self.ammofield)
- self.ammofield = cvar(strcat("g_pickup_", Item_CounterFieldName(j), "_weapon"));
- }
- }
- }
-
- // pickup anyway
- if(g_pickup_weapons_anyway)
- self.pickup_anyway = TRUE;
-
- f = FL_WEAPON;
-
- // no weapon-stay on superweapons
- if(WEPSET_CONTAINS_ANY_EA(e, WEPBIT_SUPERWEAPONS))
- f |= FL_NO_WEAPON_STAY;
-
- // weapon stay isn't supported for teamed weapons
- if(self.team)
- f |= FL_NO_WEAPON_STAY;
-
- StartItem(e.model, "weapons/weaponpickup.wav", self.respawntime, self.respawntimejitter, e.message, 0, e.weapon, f, weapon_pickupevalfunc, e.bot_pickupbasevalue);
- if (self.modelindex) // don't precache if self was removed
- weapon_action(e.weapon, WR_PRECACHE);
-}
-
-void spawnfunc_weapon_shotgun (void);
-void spawnfunc_weapon_uzi (void) {
- if(autocvar_sv_q3acompat_machineshotgunswap)
- if(self.classname != "droppedweapon")
- {
- weapon_defaultspawnfunc(WEP_SHOTGUN);
- return;
- }
- weapon_defaultspawnfunc(WEP_UZI);
-}
-
-void spawnfunc_weapon_shotgun (void) {
- if(autocvar_sv_q3acompat_machineshotgunswap)
- if(self.classname != "droppedweapon")
- {
- weapon_defaultspawnfunc(WEP_UZI);
- return;
- }
- weapon_defaultspawnfunc(WEP_SHOTGUN);
-}
-
-void spawnfunc_weapon_nex (void)
-{
- weapon_defaultspawnfunc(WEP_NEX);
-}
-
-void spawnfunc_weapon_minstanex (void)
-{
- weapon_defaultspawnfunc(WEP_MINSTANEX);
-}
-
void spawnfunc_item_rockets (void) {
if(!self.ammo_rockets)
self.ammo_rockets = g_pickup_rockets;
}
return substring(out, 1, -1);
}
+
+void weapon_defaultspawnfunc(float wpn)
+{
+ entity e;
+ float t;
+ var .float ammofield;
+ string s;
+ entity oldself;
+ float i, j;
+ float f;
+
+ if(self.classname != "droppedweapon" && self.classname != "replacedweapon")
+ {
+ e = get_weaponinfo(wpn);
+
+ if(e.spawnflags & WEP_FLAG_MUTATORBLOCKED)
+ {
+ print("Attempted to spawn a mutator-blocked weapon; these guns will in the future require a mutator\n");
+ /*
+ objerror("Attempted to spawn a mutator-blocked weapon rejected");
+ startitem_failed = TRUE;
+ return;
+ */
+ }
+
+ s = W_Apply_Weaponreplace(e.netname);
+ ret_string = s;
+ other = e;
+ MUTATOR_CALLHOOK(SetWeaponreplace);
+ s = ret_string;
+ if(s == "")
+ {
+ remove(self);
+ startitem_failed = TRUE;
+ return;
+ }
+ t = tokenize_console(s);
+ if(t >= 2)
+ {
+ self.team = --internalteam;
+ oldself = self;
+ for(i = 1; i < t; ++i)
+ {
+ s = argv(i);
+ for(j = WEP_FIRST; j <= WEP_LAST; ++j)
+ {
+ e = get_weaponinfo(j);
+ if(e.netname == s)
+ {
+ self = spawn();
+ copyentity(oldself, self);
+ self.classname = "replacedweapon";
+ weapon_defaultspawnfunc(j);
+ break;
+ }
+ }
+ if(j > WEP_LAST)
+ {
+ print("The weapon replace list for ", oldself.classname, " contains an unknown weapon ", s, ". Skipped.\n");
+ }
+ }
+ self = oldself;
+ }
+ if(t >= 1) // always the case!
+ {
+ s = argv(0);
+ wpn = 0;
+ for(j = WEP_FIRST; j <= WEP_LAST; ++j)
+ {
+ e = get_weaponinfo(j);
+ if(e.netname == s)
+ {
+ wpn = j;
+ break;
+ }
+ }
+ if(j > WEP_LAST)
+ {
+ print("The weapon replace list for ", self.classname, " contains an unknown weapon ", s, ". Skipped.\n");
+ }
+ }
+ if(wpn == 0)
+ {
+ remove(self);
+ startitem_failed = TRUE;
+ return;
+ }
+ }
+
+ e = get_weaponinfo(wpn);
+
+ if(!self.respawntime)
+ {
+ if(WEPSET_CONTAINS_ANY_EA(e, WEPBIT_SUPERWEAPONS))
+ {
+ self.respawntime = g_pickup_respawntime_superweapon;
+ self.respawntimejitter = g_pickup_respawntimejitter_superweapon;
+ }
+ else
+ {
+ self.respawntime = g_pickup_respawntime_weapon;
+ self.respawntimejitter = g_pickup_respawntimejitter_weapon;
+ }
+ }
+
+ if(WEPSET_CONTAINS_ANY_EA(e, WEPBIT_SUPERWEAPONS))
+ if(!self.superweapons_finished)
+ self.superweapons_finished = autocvar_g_balance_superweapons_time;
+
+ if(e.items)
+ {
+ for(i = 0, j = 1; i < 24; ++i, j *= 2)
+ {
+ if(e.items & j)
+ {
+ ammofield = Item_CounterField(j);
+ if(!self.ammofield)
+ self.ammofield = cvar(strcat("g_pickup_", Item_CounterFieldName(j), "_weapon"));
+ }
+ }
+ }
+
+ // pickup anyway
+ if(g_pickup_weapons_anyway)
+ self.pickup_anyway = TRUE;
+
+ f = FL_WEAPON;
+
+ // no weapon-stay on superweapons
+ if(WEPSET_CONTAINS_ANY_EA(e, WEPBIT_SUPERWEAPONS))
+ f |= FL_NO_WEAPON_STAY;
+
+ // weapon stay isn't supported for teamed weapons
+ if(self.team)
+ f |= FL_NO_WEAPON_STAY;
+
+ StartItem(e.model, "weapons/weaponpickup.wav", self.respawntime, self.respawntimejitter, e.message, 0, e.weapon, f, weapon_pickupevalfunc, e.bot_pickupbasevalue);
+ if (self.modelindex) // don't precache if self was removed
+ weapon_action(e.weapon, WR_PRECACHE);
+}