void buff_Init(entity ent);
void buff_Init_Compat(entity ent, entity replacement);
-#define BUFF_SPAWNFUNC(e, b, t) void spawnfunc_item_buff_##e() { \
- SELFPARAM(); \
+#define BUFF_SPAWNFUNC(e, b, t) spawnfunc(item_buff_##e) { \
self.buffs = b.m_itemid; \
self.team = t; \
buff_Init(self); \
BUFF_SPAWNFUNC(e##_team2, b, NUM_TEAM_2) \
BUFF_SPAWNFUNC(e##_team3, b, NUM_TEAM_3) \
BUFF_SPAWNFUNC(e##_team4, b, NUM_TEAM_4)
-#define BUFF_SPAWNFUNC_Q3TA_COMPAT(o, r) void spawnfunc_item_##o() { SELFPARAM(); buff_Init_Compat(self, r); }
+#define BUFF_SPAWNFUNC_Q3TA_COMPAT(o, r) spawnfunc(item_##o) { buff_Init_Compat(self, r); }
BUFF_SPAWNFUNCS(resistance, BUFF_RESISTANCE)
BUFF_SPAWNFUNCS(ammo, BUFF_AMMO)
return false;
}
-void spawnfunc_monster_mage() { Monster_Spawn(MON_MAGE.monsterid); }
+spawnfunc(monster_mage) { Monster_Spawn(MON_MAGE.monsterid); }
#endif // SVQC
return false;
}
-void spawnfunc_monster_shambler() { Monster_Spawn(MON_SHAMBLER.monsterid); }
+spawnfunc(monster_shambler) { Monster_Spawn(MON_SHAMBLER.monsterid); }
#endif // SVQC
bool M_Shambler(int req)
return false;
}
-void spawnfunc_monster_spider() { Monster_Spawn(MON_SPIDER.monsterid); }
+spawnfunc(monster_spider) { Monster_Spawn(MON_SPIDER.monsterid); }
#endif // SVQC
bool M_Spider(int req)
return false;
}
-void spawnfunc_monster_wyvern() { Monster_Spawn(MON_WYVERN.monsterid); }
+spawnfunc(monster_wyvern) { Monster_Spawn(MON_WYVERN.monsterid); }
#endif // SVQC
bool M_Wyvern(int req)
return false;
}
-void spawnfunc_monster_zombie() { Monster_Spawn(MON_ZOMBIE.monsterid); }
+spawnfunc(monster_zombie) { Monster_Spawn(MON_ZOMBIE.monsterid); }
#endif // SVQC
bool M_Zombie(int req)
{
setself(e);
e.noalign = true;
- e.monster_loot();
+ e.monster_loot(e);
e.gravity = 1;
e.movetype = MOVETYPE_TOSS;
e.reset = SUB_Remove;
dmg : Do this mutch dmg every .dmgtime intervall when blocked
dmgtime : See above.
*/
-void spawnfunc_func_bobbing()
-{SELFPARAM();
+spawnfunc(func_bobbing)
+{
entity controller;
if (self.noise != "")
{
}
// destructible walls that can be used to trigger target_objective_decrease
-void spawnfunc_func_breakable()
-{SELFPARAM();
+spawnfunc(func_breakable)
+{
float n, i;
if(!self.health)
self.health = 100;
}
// for use in maps with a "model" key set
-void spawnfunc_misc_breakablemodel() {
- spawnfunc_func_breakable();
+spawnfunc(misc_breakablemodel) {
+ spawnfunc_func_breakable(this);
}
#endif
#define TRIGGERS_FUNC_BREAKABLE_H
#ifdef SVQC
-void spawnfunc_func_breakable();
+spawnfunc(func_breakable);
#endif
#endif
2) metallic click
3) in-out
*/
-void spawnfunc_func_button()
-{SELFPARAM();
+spawnfunc(func_button)
+{
SetMovedir ();
if (!InitMovingBrushTrigger())
self.SendFlags |= 1;
}
-void spawnfunc_trigger_conveyor()
+spawnfunc(trigger_conveyor)
{
SetMovedir();
EXACTTRIGGER_INIT;
conveyor_init();
}
-void spawnfunc_func_conveyor()
-{SELFPARAM();
+spawnfunc(func_conveyor)
+{
SetMovedir();
InitMovingBrushTrigger();
self.movetype = MOVETYPE_NONE;
#ifdef SVQC
// spawnflags require key (for now only func_door)
-void spawnfunc_func_door()
-{SELFPARAM();
+spawnfunc(func_door)
+{
// Quake 1 keys compatibility
if (self.spawnflags & SPAWNFLAGS_GOLD_KEY)
self.itemkeys |= ITEM_KEY_BIT(0);
}
-void spawnfunc_func_door_rotating()
-{SELFPARAM();
+spawnfunc(func_door_rotating)
+{
//if (!self.deathtype) // map makers can override this
// self.deathtype = " got in the way";
3) base
*/
-void spawnfunc_func_door_secret()
-{SELFPARAM();
+spawnfunc(func_door_secret)
+{
/*if (!self.deathtype) // map makers can override this
self.deathtype = " got in the way";*/
self.owner.velocity = (v - self.owner.origin) * 10;
}
-void spawnfunc_func_fourier()
-{SELFPARAM();
+spawnfunc(func_fourier)
+{
entity controller;
if (self.noise != "")
{
//self.model = "null";
}
-void spawnfunc_func_ladder()
-{SELFPARAM();
+spawnfunc(func_ladder)
+{
self.mdl = self.model;
EXACTTRIGGER_INIT;
self.touch = func_ladder_touch;
func_ladder_link();
}
-void spawnfunc_func_water()
-{SELFPARAM();
+spawnfunc(func_water)
+{
self.mdl = self.model;
EXACTTRIGGER_INIT;
self.touch = func_ladder_touch;
}
}
-void spawnfunc_func_pendulum()
-{SELFPARAM();
+spawnfunc(func_pendulum)
+{
entity controller;
if (self.noise != "")
{
//Net_LinkEntity(self, 0, false, plat_send);
}
-void spawnfunc_func_plat()
-{SELFPARAM();
+spawnfunc(func_plat)
+{
if (self.sounds == 0)
self.sounds = 2;
self.state = 0;
}
-void spawnfunc_func_pointparticles()
-{SELFPARAM();
+spawnfunc(func_pointparticles)
+{
if(self.model != "")
_setmodel(self, self.model);
if(self.noise != "")
self.nextthink = time;
}
-void spawnfunc_func_sparks()
-{SELFPARAM();
+spawnfunc(func_sparks)
+{
// self.cnt is the amount of sparks that one burst will spawn
if(self.cnt < 1) {
self.cnt = 25.0; // nice default value
self.wait = 0;
self.cnt = 0; // use mdl
- spawnfunc_func_pointparticles();
+ spawnfunc_func_pointparticles(this);
}
#elif defined(CSQC)
"count"
adjusts density, this many particles fall every second for a 1024x1024 area, default is 2000
*/
-void spawnfunc_func_rain()
-{SELFPARAM();
+spawnfunc(func_rain)
+{
self.dest = self.velocity;
self.velocity = '0 0 0';
if (!self.dest)
"count"
adjusts density, this many particles fall every second for a 1024x1024 area, default is 2000
*/
-void spawnfunc_func_snow()
-{SELFPARAM();
+spawnfunc(func_snow)
+{
self.dest = self.velocity;
self.velocity = '0 0 0';
if (!self.dest)
dmgtime : See above.
*/
-void spawnfunc_func_rotating()
-{SELFPARAM();
+spawnfunc(func_rotating)
+{
if (self.noise != "")
{
precache_sound(self.noise);
#ifdef SVQC
-void spawnfunc_func_stardust()
-{SELFPARAM();
+spawnfunc(func_stardust)
+{
self.effects = EF_STARDUST;
CSQCMODEL_AUTOINIT(self);
target : targetname of first spawnfunc_path_corner (starts here)
*/
#ifdef SVQC
-void spawnfunc_func_train()
-{SELFPARAM();
+spawnfunc(func_train)
+{
if (self.noise != "")
precache_sound(self.noise);
controller.think = func_vectormamamam_controller_think;
}
-void spawnfunc_func_vectormamamam()
-{SELFPARAM();
+spawnfunc(func_vectormamamam)
+{
if (self.noise != "")
{
precache_sound(self.noise);
//Net_LinkEntity(self, false, 0, corner_send);
}
-void spawnfunc_path_corner()
-{SELFPARAM();
+spawnfunc(path_corner)
+{
// setup values for overriding train movement
// if a second value does not exist, both start and end speeds are the single value specified
set_platmovetype(self, self.platmovetype);
}
}
-void spawnfunc_misc_follow()
-{SELFPARAM();
+spawnfunc(misc_follow)
+{
InitializeEntity(self, follow_init, INITPRIO_FINDTARGET);
}
#endif
self.state = 0;
}
-void spawnfunc_misc_laser()
-{SELFPARAM();
+spawnfunc(misc_laser)
+{
if(self.mdl)
{
if(self.mdl == "none")
#ifdef SVQC
-void spawnfunc_info_teleport_destination (void)
-{SELFPARAM();
+spawnfunc(info_teleport_destination)
+{
self.classname = "info_teleport_destination";
self.mangle = self.angles;
objerror ("^3Teleport destination without a targetname");
}
-void spawnfunc_misc_teleporter_dest (void)
+spawnfunc(misc_teleporter_dest)
{
- spawnfunc_info_teleport_destination();
+ spawnfunc_info_teleport_destination(this);
}
-void spawnfunc_target_teleporter (void)
+spawnfunc(target_teleporter)
{
- spawnfunc_info_teleport_destination();
+ spawnfunc_info_teleport_destination(this);
}
#endif
.entity chlevel_targ;
-void spawnfunc_target_changelevel_use()
-{SELFPARAM();
+spawnfunc(target_changelevel_use)
+{
if(self.spawnflags & 2)
{
// simply don't react if a non-player triggers it
localcmd(strcat("changelevel ", self.chmap, "\n"));
}
-void spawnfunc_target_changelevel()
-{SELFPARAM();
- self.use = spawnfunc_target_changelevel_use;
+void _spawnfunc_target_changelevel_use() { SELFPARAM(); spawnfunc_target_changelevel_use(this); }
+
+spawnfunc(target_changelevel)
+{
+ self.use = _spawnfunc_target_changelevel_use;
if(!self.count) { self.count = 0.7; }
}
#ifdef SVQC
-void spawnfunc_target_location()
-{SELFPARAM();
+spawnfunc(target_location)
+{
self.classname = "target_location";
// location name in netname
// eventually support: count, teamgame selectors, line of sight?
}
-void spawnfunc_info_location()
-{SELFPARAM();
+spawnfunc(info_location)
+{
self.classname = "target_location";
self.message = self.netname;
}
entity head;
FOR_EACH_SPEC(head) if(head.enemy == activator) { msg_entity = head; target_music_sendto(MSG_ONE, 1); }
}
-void spawnfunc_target_music()
-{SELFPARAM();
+spawnfunc(target_music)
+{
self.use = target_music_use;
self.reset = target_music_reset;
if(!self.volume)
self.cnt = !self.cnt;
self.SendFlags |= 0x80;
}
-void spawnfunc_trigger_music()
-{SELFPARAM();
+spawnfunc(trigger_music)
+{
if(self.model != "")
_setmodel(self, self.model);
if(!self.volume)
}
}
-void spawnfunc_target_spawn()
-{SELFPARAM();
+spawnfunc(target_spawn)
+{
initialize_field_db();
self.use = target_spawn_use;
self.message = strzone(strreplace("'", "\"", self.message));
}
}
-void spawnfunc_target_speaker()
-{SELFPARAM();
+spawnfunc(target_speaker)
+{
// TODO: "*" prefix to sound file name
// TODO: wait and random (just, HOW? random is not a field)
if(self.noise)
}
}
-void spawnfunc_target_voicescript()
-{SELFPARAM();
+spawnfunc(target_voicescript)
+{
// netname: directory of the sound files
// message: list of "sound file" duration "sound file" duration, a *, and again a list
// foo1 4.1 foo2 4.0 foo3 -3.1 * fool1 1.1 fool2 7.1 fool3 9.1 fool4 3.7
After the counter has been triggered "count" times (default 2), it will fire all of it's targets and remove itself.
*/
-void spawnfunc_trigger_counter()
-{SELFPARAM();
+spawnfunc(trigger_counter)
+{
self.wait = -1;
if (!self.count)
self.count = 2;
self.nextthink = 0;
}
-void spawnfunc_trigger_delay()
-{SELFPARAM();
+spawnfunc(trigger_delay)
+{
if(!self.wait)
self.wait = 1;
LOG_INFO("Invalid use of trigger_disablerelay: ", ftos(a), " relays were on, ", ftos(b), " relays were off!\n");
}
-void spawnfunc_trigger_disablerelay()
-{SELFPARAM();
+spawnfunc(trigger_disablerelay)
+{
self.use = trigger_disablerelay_use;
}
#endif
SUB_UseTargets();
}
-void spawnfunc_trigger_flipflop()
-{SELFPARAM();
+void _spawnfunc_trigger_flipflop();
+spawnfunc(trigger_flipflop)
+{
if(self.spawnflags & 1)
self.state = 1;
self.use = flipflop_use;
- self.reset = spawnfunc_trigger_flipflop; // perfect resetter
+ self.reset = _spawnfunc_trigger_flipflop; // perfect resetter
}
+void _spawnfunc_trigger_flipflop() { SELFPARAM(); spawnfunc_trigger_flipflop(this); }
+
#endif
remove(self);
}
-void spawnfunc_trigger_gamestart()
-{SELFPARAM();
+void _spawnfunc_trigger_gamestart();
+spawnfunc(trigger_gamestart)
+{
self.use = gamestart_use;
- self.reset2 = spawnfunc_trigger_gamestart;
+ self.reset2 = _spawnfunc_trigger_gamestart;
if(self.wait)
{
else
InitializeEntity(self, gamestart_use, INITPRIO_FINDTARGET);
}
+void _spawnfunc_trigger_gamestart() { SELFPARAM(); spawnfunc_trigger_gamestart(this); }
+
#endif
}
}
-void spawnfunc_trigger_gravity()
-{SELFPARAM();
+spawnfunc(trigger_gravity)
+{
if(self.gravity == 1)
return;
}
}
-void spawnfunc_trigger_heal()
-{SELFPARAM();
+spawnfunc(trigger_heal)
+{
self.active = ACTIVE_ACTIVE;
EXACTTRIGGER_INIT;
.entity trigger_hurt_next;
entity trigger_hurt_last;
entity trigger_hurt_first;
-void spawnfunc_trigger_hurt()
-{SELFPARAM();
+spawnfunc(trigger_hurt)
+{
EXACTTRIGGER_INIT;
self.active = ACTIVE_ACTIVE;
self.touch = trigger_hurt_touch;
//Net_LinkEntity(self, 0, false, trigger_impulse_send);
}
-void spawnfunc_trigger_impulse()
-{SELFPARAM();
+spawnfunc(trigger_impulse)
+{
self.active = ACTIVE_ACTIVE;
EXACTTRIGGER_INIT;
* values to target a point on the ceiling.
* movedir: if target is not set, this * speed * 10 is the velocity to be reached.
*/
-void spawnfunc_trigger_push()
-{SELFPARAM();
+spawnfunc(trigger_push)
+{
SetMovedir ();
EXACTTRIGGER_INIT;
self.SendFlags |= 1; // update
}
-void spawnfunc_target_push() { target_push_link(); }
-void spawnfunc_info_notnull() { target_push_link(); }
-void spawnfunc_target_position() { target_push_link(); }
+spawnfunc(target_push) { target_push_link(); }
+spawnfunc(info_notnull) { target_push_link(); }
+spawnfunc(target_position) { target_push_link(); }
#endif
* movedir: if target is not set, this * speed * 10 is the velocity to be reached.
*/
#ifdef SVQC
-void spawnfunc_trigger_push();
+spawnfunc(trigger_push);
-void spawnfunc_target_push();
-void spawnfunc_info_notnull();
-void spawnfunc_target_position();
+spawnfunc(target_push);
+spawnfunc(info_notnull);
+spawnfunc(target_position);
#endif
#endif
If spawned without any key specified in itemkeys, this trigger will display an error and remove itself.
message2 and noise2 will be resent to the player every 2 seconds while he is in the trigger zone.
*/
-void spawnfunc_trigger_keylock(void)
-{SELFPARAM();
+spawnfunc(trigger_keylock)
+{
if(!self.itemkeys) { remove(self); return; }
// set unlocked message
return msgin;
}
-void spawnfunc_trigger_magicear()
-{SELFPARAM();
+spawnfunc(trigger_magicear)
+{
self.enemy = magicears;
magicears = self;
self.nextthink = 0;
}
-void spawnfunc_trigger_monoflop()
-{SELFPARAM();
+spawnfunc(trigger_monoflop)
+{
if(!self.wait)
self.wait = 1;
if(self.spawnflags & 1)
4)
set "message" to text string
*/
-void spawnfunc_trigger_multiple()
-{SELFPARAM();
+spawnfunc(trigger_multiple)
+{
self.reset = multi_reset;
if (self.sounds == 1)
{
4)
set "message" to text string
*/
-void spawnfunc_trigger_once()
-{SELFPARAM();
- self.wait = -1;
- spawnfunc_trigger_multiple();
+spawnfunc(trigger_once)
+{
+ this.wait = -1;
+ spawnfunc_trigger_multiple(this);
}
#endif
void multi_trigger();
void multi_reset();
-void spawnfunc_trigger_once();
+spawnfunc(trigger_once);
#endif
-------- SPAWNFLAGS --------
START_ON: assume it is already turned on (when targeted)
*/
-void spawnfunc_trigger_multivibrator()
-{SELFPARAM();
+spawnfunc(trigger_multivibrator)
+{
if(!self.wait)
self.wait = 1;
if(!self.respawntime)
#ifdef SVQC
+void _spawnfunc_trigger_relay();
/*QUAKED spawnfunc_trigger_relay (.5 .5 .5) (-8 -8 -8) (8 8 8)
This fixed size trigger cannot be touched, it can only be fired by other events. It can contain killtargets, targets, delays, and messages.
*/
-void spawnfunc_trigger_relay()
-{SELFPARAM();
+spawnfunc(trigger_relay)
+{
self.use = SUB_UseTargets;
- self.reset = spawnfunc_trigger_relay; // this spawnfunc resets fully
+ self.reset = _spawnfunc_trigger_relay; // this spawnfunc resets fully
}
+void _spawnfunc_trigger_relay() { SELFPARAM(); spawnfunc_trigger_relay(this); }
#endif
setself(this);
}
-void spawnfunc_relay_activate()
-{SELFPARAM();
+spawnfunc(relay_activate)
+{
self.cnt = ACTIVE_ACTIVE;
self.use = relay_activators_use;
}
-void spawnfunc_relay_deactivate()
-{SELFPARAM();
+spawnfunc(relay_deactivate)
+{
self.cnt = ACTIVE_NOT;
self.use = relay_activators_use;
}
-void spawnfunc_relay_activatetoggle()
-{SELFPARAM();
+spawnfunc(relay_activatetoggle)
+{
self.cnt = ACTIVE_TOGGLE;
self.use = relay_activators_use;
}
SUB_UseTargets();
}
-void spawnfunc_trigger_relay_if()
-{SELFPARAM();
+spawnfunc(trigger_relay_if)
+{
self.use = trigger_relay_if_use;
}
#endif
self.team = self.team_saved;
}
-void spawnfunc_trigger_relay_teamcheck()
-{SELFPARAM();
+spawnfunc(trigger_relay_teamcheck)
+{
self.team_saved = self.team;
self.use = trigger_relay_teamcheck_use;
self.reset = trigger_relay_teamcheck_reset;
You should create a common/trigger textured brush covering the entrance to a secret room/area.
Trigger secret can only be trigger by a player's touch and can not be a target itself.
*/
-void spawnfunc_trigger_secret()
-{SELFPARAM();
+spawnfunc(trigger_secret)
+{
// FIXME: should it be disabled in most modes?
// update secrets count
// convert this trigger to trigger_once
self.classname = "trigger_once";
- spawnfunc_trigger_once();
+ spawnfunc_trigger_once(this);
// take over the touch() function, so we can mark secret as found
self.touch = trigger_secret_touch;
.entity swampslug;
#ifdef SVQC
-void spawnfunc_trigger_swamp(void);
+spawnfunc(trigger_swamp);
#endif
void swamp_touch(void);
void swampslug_think();
Players gettin into the swamp will
get slowd down and damaged
*/
-void spawnfunc_trigger_swamp(void)
-{SELFPARAM();
+spawnfunc(trigger_swamp)
+{
// Init stuff
EXACTTRIGGER_INIT;
self.touch = swamp_touch;
WITH(entity, self, e, SUB_UseTargets());
}
-void spawnfunc_trigger_teleport()
-{SELFPARAM();
+spawnfunc(trigger_teleport)
+{
self.angles = '0 0 0';
EXACTTRIGGER_INIT;
self.nextthink = time;
}
-void spawnfunc_trigger_viewlocation()
-{SELFPARAM();
+spawnfunc(trigger_viewlocation)
+{
// we won't check target2 here yet, as it may not even need to exist
if(self.target == "") { LOG_INFO("^1FAIL!\n"); remove(self); return; }
Net_LinkEntity(self, false, 0, viewloc_send);
}
-void spawnfunc_target_viewlocation_start()
-{SELFPARAM();
+spawnfunc(target_viewlocation_start)
+{
self.classname = "target_viewlocation_start";
self.cnt = 1;
viewloc_link();
}
-void spawnfunc_target_viewlocation_end()
-{SELFPARAM();
+spawnfunc(target_viewlocation_end)
+{
self.classname = "target_viewlocation_end";
self.cnt = 2;
viewloc_link();
}
// compatibility
-void spawnfunc_target_viewlocation() { spawnfunc_target_viewlocation_start(); }
+spawnfunc(target_viewlocation) { spawnfunc_target_viewlocation_start(this); }
#elif defined(CSQC)
//tc_acum += 0.25;
}
-void spawnfunc_turret_checkpoint()
-{SELFPARAM();
+spawnfunc(turret_checkpoint)
+{
setorigin(self,self.origin);
self.think = turret_checkpoint_init;
self.nextthink = time + 0.2;
}
// Compat.
-void spawnfunc_walker_checkpoint()
-{SELFPARAM();
+spawnfunc(walker_checkpoint)
+{
self.classname = "turret_checkpoint";
- spawnfunc_turret_checkpoint();
+ spawnfunc_turret_checkpoint(this);
}
-void spawnfunc_turret_targettrigger();
+spawnfunc(turret_targettrigger);
void turret_targettrigger_touch();
void turret_targettrigger_touch()
/*QUAKED turret_targettrigger (.5 .5 .5) ?
*/
-void spawnfunc_turret_targettrigger()
-{SELFPARAM();
+spawnfunc(turret_targettrigger)
+{
if(!autocvar_g_turrets) { remove(self); return; }
InitTrigger ();
movelib_beak_simple((autocvar_g_turrets_unit_ewheel_speed_stop));
}
-void spawnfunc_turret_ewheel() { SELFPARAM(); if(!turret_initialize(TUR_EWHEEL)) remove(self); }
+spawnfunc(turret_ewheel) { if(!turret_initialize(TUR_EWHEEL)) remove(self); }
float t_ewheel(float req)
{SELFPARAM();
remove(self);
}
-void spawnfunc_turret_flac() { SELFPARAM(); if(!turret_initialize(TUR_FLAC)) remove(self); }
+spawnfunc(turret_flac) { if(!turret_initialize(TUR_FLAC)) remove(self); }
float t_flac(float req)
{SELFPARAM();
return true;
}
-void spawnfunc_turret_fusionreactor() { SELFPARAM(); if(!turret_initialize(TUR_FUSIONREACTOR)) remove(self); }
+spawnfunc(turret_fusionreactor) { if(!turret_initialize(TUR_FUSIONREACTOR)) remove(self); }
float t_fusionreactor(float req)
{SELFPARAM();
UpdateCSQCProjectile(self);
}
-void spawnfunc_turret_hellion() { SELFPARAM(); if(!turret_initialize(TUR_HELLION)) remove(self); }
+spawnfunc(turret_hellion) { if(!turret_initialize(TUR_HELLION)) remove(self); }
float t_hellion(float req)
{SELFPARAM();
return 0;
}
-void spawnfunc_turret_hk() { SELFPARAM(); if(!turret_initialize(TUR_HK)) remove(self); }
+spawnfunc(turret_hk) { if(!turret_initialize(TUR_HK)) remove(self); }
float t_hk(float req)
{SELFPARAM();
);
#else
#ifdef SVQC
-void spawnfunc_turret_machinegun() { SELFPARAM(); if(!turret_initialize(TUR_MACHINEGUN)) remove(self); }
+spawnfunc(turret_machinegun) { if(!turret_initialize(TUR_MACHINEGUN)) remove(self); }
void W_MachineGun_MuzzleFlash(void);
);
#else
#ifdef SVQC
-void spawnfunc_turret_mlrs() { SELFPARAM(); if(!turret_initialize(TUR_MLRS)) remove(self); }
+spawnfunc(turret_mlrs) { if(!turret_initialize(TUR_MLRS)) remove(self); }
float t_mlrs(float req)
{SELFPARAM();
}
-void spawnfunc_turret_phaser() { SELFPARAM(); if(!turret_initialize(TUR_PHASER)) remove(self); }
+spawnfunc(turret_phaser) { if(!turret_initialize(TUR_PHASER)) remove(self); }
float t_phaser(float req)
{SELFPARAM();
);
#else
#ifdef SVQC
-void spawnfunc_turret_plasma() { SELFPARAM(); if(!turret_initialize(TUR_PLASMA)) remove(self); }
+spawnfunc(turret_plasma) { if(!turret_initialize(TUR_PLASMA)) remove(self); }
float t_plasma(float req)
{SELFPARAM();
);
#else
#ifdef SVQC
-void spawnfunc_turret_plasma_dual() { SELFPARAM(); if(!turret_initialize(TUR_PLASMA_DUAL)) remove(self); }
+spawnfunc(turret_plasma_dual) { if(!turret_initialize(TUR_PLASMA_DUAL)) remove(self); }
float t_plasma_dual(float req)
{SELFPARAM();
return 0;
}
-void spawnfunc_turret_tesla() { SELFPARAM(); if(!turret_initialize(TUR_TESLA)) remove(self); }
+spawnfunc(turret_tesla) { if(!turret_initialize(TUR_TESLA)) remove(self); }
float t_tesla(float req)
{SELFPARAM();
#endif
}
-void spawnfunc_turret_walker() { SELFPARAM(); if(!turret_initialize(TUR_WALKER)) remove(self); }
+spawnfunc(turret_walker) { if(!turret_initialize(TUR_WALKER)) remove(self); }
float t_walker(float req)
{SELFPARAM();
return true;
}
-void spawnfunc_vehicle_bumblebee()
-{SELFPARAM();
+spawnfunc(vehicle_bumblebee)
+{
if(!autocvar_g_vehicle_bumblebee) { remove(self); return; }
if(!vehicle_initialize(VEH_BUMBLEBEE, false)) { remove(self); return; }
}
racer_blowup();
}
-void spawnfunc_vehicle_racer()
-{SELFPARAM();
+spawnfunc(vehicle_racer)
+{
if(!autocvar_g_vehicle_racer) { remove(self); return; }
if(!vehicle_initialize(VEH_RACER, false)) { remove(self); return; }
}
return false;
}
-void spawnfunc_vehicle_raptor()
-{SELFPARAM();
+spawnfunc(vehicle_raptor)
+{
if(!autocvar_g_vehicle_raptor) { remove(self); return; }
if(!vehicle_initialize(VEH_RAPTOR, false)) { remove(self); return; }
}
return false;
}
-void spawnfunc_vehicle_spiderbot()
-{SELFPARAM();
+spawnfunc(vehicle_spiderbot)
+{
if(!autocvar_g_vehicle_spiderbot) { remove(self); return; }
if(!vehicle_initialize(VEH_SPIDERBOT, false)) { remove(self); return; }
}
#endif
#ifdef IMPLEMENTATION
#ifdef SVQC
-void spawnfunc_weapon_arc(void) { weapon_defaultspawnfunc(WEP_ARC.m_id); }
+spawnfunc(weapon_arc) { weapon_defaultspawnfunc(WEP_ARC.m_id); }
float W_Arc_Beam_Send(entity to, int sf)
{SELFPARAM();
#endif
#ifdef IMPLEMENTATION
#ifdef SVQC
-void spawnfunc_weapon_blaster(void) { weapon_defaultspawnfunc(WEP_BLASTER.m_id); }
-void spawnfunc_weapon_laser(void) { spawnfunc_weapon_blaster(); }
+spawnfunc(weapon_blaster) { weapon_defaultspawnfunc(WEP_BLASTER.m_id); }
+spawnfunc(weapon_laser) { spawnfunc_weapon_blaster(this); }
void W_Blaster_Touch(void)
{SELFPARAM();
#endif
#ifdef IMPLEMENTATION
#ifdef SVQC
-void spawnfunc_weapon_crylink(void) { weapon_defaultspawnfunc(WEP_CRYLINK.m_id); }
+spawnfunc(weapon_crylink) { weapon_defaultspawnfunc(WEP_CRYLINK.m_id); }
void W_Crylink_CheckLinks(entity e)
{
#endif
#ifdef IMPLEMENTATION
#ifdef SVQC
-void spawnfunc_weapon_devastator(void) { weapon_defaultspawnfunc(WEP_DEVASTATOR.m_id); }
-void spawnfunc_weapon_rocketlauncher(void) { spawnfunc_weapon_devastator(); }
+spawnfunc(weapon_devastator) { weapon_defaultspawnfunc(WEP_DEVASTATOR.m_id); }
+spawnfunc(weapon_rocketlauncher) { spawnfunc_weapon_devastator(this); }
void W_Devastator_Unregister(void)
{SELFPARAM();
#endif
#ifdef IMPLEMENTATION
#ifdef SVQC
-void spawnfunc_weapon_electro(void) { weapon_defaultspawnfunc(WEP_ELECTRO.m_id); }
+spawnfunc(weapon_electro) { weapon_defaultspawnfunc(WEP_ELECTRO.m_id); }
void W_Electro_TriggerCombo(vector org, float rad, entity own)
{
#endif
#ifdef IMPLEMENTATION
#ifdef SVQC
-void spawnfunc_weapon_fireball(void) { weapon_defaultspawnfunc(WEP_FIREBALL.m_id); }
+spawnfunc(weapon_fireball) { weapon_defaultspawnfunc(WEP_FIREBALL.m_id); }
void W_Fireball_Explode(void)
{SELFPARAM();
#endif
#ifdef IMPLEMENTATION
#ifdef SVQC
-void spawnfunc_weapon_hagar(void) { weapon_defaultspawnfunc(WEP_HAGAR.m_id); }
+spawnfunc(weapon_hagar) { weapon_defaultspawnfunc(WEP_HAGAR.m_id); }
// NO bounce protection, as bounces are limited!
#endif
#ifdef IMPLEMENTATION
#ifdef SVQC
-void spawnfunc_weapon_hlac(void) { weapon_defaultspawnfunc(WEP_HLAC.m_id); }
+spawnfunc(weapon_hlac) { weapon_defaultspawnfunc(WEP_HLAC.m_id); }
void W_HLAC_Touch(void)
{SELFPARAM();
#ifdef IMPLEMENTATION
#ifdef SVQC
-void spawnfunc_weapon_hmg() { weapon_defaultspawnfunc(WEP_HMG.m_id); }
+spawnfunc(weapon_hmg) { weapon_defaultspawnfunc(WEP_HMG.m_id); }
void W_HeavyMachineGun_Attack_Auto()
{SELFPARAM();
#ifdef IMPLEMENTATION
#ifdef SVQC
-void spawnfunc_weapon_hook(void)
-{SELFPARAM();
+spawnfunc(weapon_hook)
+{
if(g_grappling_hook) // offhand hook
{
startitem_failed = true;
#ifdef IMPLEMENTATION
#ifdef SVQC
-void spawnfunc_weapon_machinegun(void)
-{SELFPARAM();
+spawnfunc(weapon_machinegun)
+{
if(autocvar_sv_q3acompat_machineshotgunswap)
if(self.classname != "droppedweapon")
{
}
weapon_defaultspawnfunc(WEP_MACHINEGUN.m_id);
}
-void spawnfunc_weapon_uzi(void) { spawnfunc_weapon_machinegun(); }
+spawnfunc(weapon_uzi) { spawnfunc_weapon_machinegun(this); }
void W_MachineGun_MuzzleFlash_Think(void)
{SELFPARAM();
#endif
#ifdef IMPLEMENTATION
#ifdef SVQC
-void spawnfunc_weapon_minelayer(void) { weapon_defaultspawnfunc(WEP_MINE_LAYER.m_id); }
+spawnfunc(weapon_minelayer) { weapon_defaultspawnfunc(WEP_MINE_LAYER.m_id); }
void W_MineLayer_Stick(entity to)
{SELFPARAM();
#ifdef IMPLEMENTATION
#ifdef SVQC
-void spawnfunc_weapon_mortar(void) { weapon_defaultspawnfunc(WEP_MORTAR.m_id); }
-void spawnfunc_weapon_grenadelauncher(void) { spawnfunc_weapon_mortar(); }
+spawnfunc(weapon_mortar) { weapon_defaultspawnfunc(WEP_MORTAR.m_id); }
+spawnfunc(weapon_grenadelauncher) { spawnfunc_weapon_mortar(this); }
void W_Mortar_Grenade_Explode(void)
{SELFPARAM();
#ifdef SVQC
#include "../../triggers/trigger/jumppads.qh"
-void spawnfunc_weapon_porto(void) { weapon_defaultspawnfunc(WEP_PORTO.m_id); }
+spawnfunc(weapon_porto) { weapon_defaultspawnfunc(WEP_PORTO.m_id); }
void W_Porto_Success(void)
{SELFPARAM();
#endif
#ifdef IMPLEMENTATION
#ifdef SVQC
-void spawnfunc_weapon_rifle(void) { weapon_defaultspawnfunc(WEP_RIFLE.m_id); }
-void spawnfunc_weapon_campingrifle(void) { spawnfunc_weapon_rifle(); }
-void spawnfunc_weapon_sniperrifle(void) { spawnfunc_weapon_rifle(); }
+spawnfunc(weapon_rifle) { weapon_defaultspawnfunc(WEP_RIFLE.m_id); }
+spawnfunc(weapon_campingrifle) { spawnfunc_weapon_rifle(this); }
+spawnfunc(weapon_sniperrifle) { spawnfunc_weapon_rifle(this); }
void W_Rifle_FireBullet(float pSpread, float pDamage, float pForce, float pSolidPenetration, float pAmmo, int deathtype, float pTracer, float pShots, string pSound)
{SELFPARAM();
#endif
#ifdef IMPLEMENTATION
#ifdef SVQC
-void spawnfunc_weapon_rpc() { weapon_defaultspawnfunc(WEP_RPC.m_id); }
+spawnfunc(weapon_rpc) { weapon_defaultspawnfunc(WEP_RPC.m_id); }
void W_RocketPropelledChainsaw_Explode()
{SELFPARAM();
#endif
#ifdef IMPLEMENTATION
#ifdef SVQC
-void spawnfunc_weapon_seeker(void) { weapon_defaultspawnfunc(WEP_SEEKER.m_id); }
+spawnfunc(weapon_seeker) { weapon_defaultspawnfunc(WEP_SEEKER.m_id); }
// ============================
// Begin: Missile functions, these are general functions to be manipulated by other code
#endif
#ifdef IMPLEMENTATION
#ifdef SVQC
-void spawnfunc_weapon_shockwave(void)
-{SELFPARAM();
+spawnfunc(weapon_shockwave)
+{
//if(autocvar_sv_q3acompat_machineshockwaveswap) // WEAPONTODO
if(autocvar_sv_q3acompat_machineshotgunswap)
if(self.classname != "droppedweapon")
#endif
#ifdef IMPLEMENTATION
#ifdef SVQC
-void spawnfunc_weapon_shotgun(void) { weapon_defaultspawnfunc(WEP_SHOTGUN.m_id); }
+spawnfunc(weapon_shotgun) { weapon_defaultspawnfunc(WEP_SHOTGUN.m_id); }
void W_Shotgun_Attack(float isprimary)
{SELFPARAM();
#endif
#ifdef IMPLEMENTATION
#ifdef SVQC
-void spawnfunc_weapon_tuba(void) { weapon_defaultspawnfunc(WEP_TUBA.m_id); }
+spawnfunc(weapon_tuba) { weapon_defaultspawnfunc(WEP_TUBA.m_id); }
bool W_Tuba_HasPlayed(entity pl, string melody, int instrument, bool ignorepitch, float mintempo, float maxtempo)
{
#endif
#ifdef IMPLEMENTATION
#ifdef SVQC
-void spawnfunc_weapon_vaporizer(void) { weapon_defaultspawnfunc(WEP_VAPORIZER.m_id); }
-void spawnfunc_weapon_minstanex(void) { spawnfunc_weapon_vaporizer(); }
+spawnfunc(weapon_vaporizer) { weapon_defaultspawnfunc(WEP_VAPORIZER.m_id); }
+spawnfunc(weapon_minstanex) { spawnfunc_weapon_vaporizer(this); }
void W_RocketMinsta_Explosion(vector loc)
{SELFPARAM();
#endif
#ifdef IMPLEMENTATION
#ifdef SVQC
-void spawnfunc_weapon_vortex(void) { weapon_defaultspawnfunc(WEP_VORTEX.m_id); }
-void spawnfunc_weapon_nex(void) { spawnfunc_weapon_vortex(); }
+spawnfunc(weapon_vortex) { weapon_defaultspawnfunc(WEP_VORTEX.m_id); }
+spawnfunc(weapon_nex) { spawnfunc_weapon_vortex(this); }
void SendCSQCVortexBeamParticle(float charge) {
vector v;
W_DecreaseAmmo(myammo);
}
-void spawnfunc_weapon_vortex(void); // defined in t_items.qc
+spawnfunc(weapon_vortex); // defined in t_items.qc
.float vortex_chargepool_pauseregen_finished;
bool W_Vortex(int req)
#include "progname.qh"
#include "registry.qh"
#include "sortlist.qc"
+#include "spawnfunc.qh"
#include "static.qh"
#include "string.qh"
#include "struct.qh"
cvar_set("prvm_backtraceforwarnings", ftos(war)); \
} while (0)
+#define ASSERT(expr) do { if (!(expr)) LOG_FATAL("assertion failed: " #expr "\n"); } while (0)
+
#endif
--- /dev/null
+#ifndef SPAWNFUNC_H
+#define SPAWNFUNC_H
+
+/** If this global exists, only functions with spawnfunc_ name prefix qualify as spawn functions */
+noref bool require_spawnfunc_prefix;
+.bool spawnfunc_checked;
+
+bool entityfieldassignablefromeditor(int i) {
+ switch (entityfieldtype(i)) {
+ case FIELD_STRING:
+ case FIELD_FLOAT:
+ case FIELD_VECTOR:
+ return true;
+ }
+ return false;
+}
+
+#define _spawnfunc_checktypes(fld) if (fieldname == #fld) \
+ if (!entityfieldassignablefromeditor(i)) LOG_FATALF("Entity field '%s' cannot be whitelisted\n", fieldname);
+#define _spawnfunc_check(fld) if (fieldname == #fld) \
+ continue;
+
+#define spawnfunc_1(id, whitelist) spawnfunc_2(id, whitelist)
+#define spawnfunc_2(id, whitelist) void spawnfunc_##id(entity this) { \
+ this = self; \
+ if (!this.spawnfunc_checked) { \
+ for (int i = 0, n = numentityfields(); i < n; ++i) { \
+ string value = getentityfieldstring(i, this); \
+ string fieldname = entityfieldname(i); \
+ whitelist(_spawnfunc_checktypes) \
+ if (value == "") continue; \
+ if (fieldname == "") continue; \
+ FIELDS_COMMON(_spawnfunc_check) \
+ whitelist(_spawnfunc_check) \
+ LOG_WARNINGF(_("Entity field %s.%s (%s) is not whitelisted. If you believe this is an error, please file an issue.\n"), fieldname, #id, value); \
+ } \
+ this.spawnfunc_checked = true; \
+ } \
+} \
+[[accumulate]] void spawnfunc_##id(entity this)
+
+#define FIELD_SCALAR(fld, n) \
+ fld(n)
+#define FIELD_VEC(fld, n) \
+ fld(n) \
+ fld(n##_x) \
+ fld(n##_y) \
+ fld(n##_z)
+
+#define FIELDS_NONE(fld)
+#define FIELDS_ALL(fld) if (false)
+
+#define FIELDS_COMMON(fld) \
+ FIELD_SCALAR(fld, classname) \
+ FIELD_SCALAR(fld, spawnfunc_checked) \
+ /**/
+
+#define FIELDS_UNION(fld) \
+ FIELD_SCALAR(fld, Version) \
+ FIELD_SCALAR(fld, ammo_cells) \
+ FIELD_SCALAR(fld, ammo_nails) \
+ FIELD_SCALAR(fld, ammo_rockets) \
+ FIELD_SCALAR(fld, armorvalue) \
+ FIELD_SCALAR(fld, atten) \
+ FIELD_SCALAR(fld, bgmscriptdecay) \
+ FIELD_SCALAR(fld, bgmscriptsustain) \
+ FIELD_SCALAR(fld, bgmscript) \
+ FIELD_SCALAR(fld, button0) \
+ FIELD_SCALAR(fld, cnt) \
+ FIELD_SCALAR(fld, colormap) \
+ FIELD_SCALAR(fld, count) \
+ FIELD_SCALAR(fld, debrisdamageforcescale) \
+ FIELD_SCALAR(fld, debrisfadetime) \
+ FIELD_SCALAR(fld, debristimejitter) \
+ FIELD_SCALAR(fld, debristime) \
+ FIELD_SCALAR(fld, debris) \
+ FIELD_SCALAR(fld, delay) \
+ FIELD_SCALAR(fld, dmg) \
+ FIELD_SCALAR(fld, dmg_edge) \
+ FIELD_SCALAR(fld, dmg_force) \
+ FIELD_SCALAR(fld, dmg_radius) \
+ FIELD_SCALAR(fld, effects) \
+ FIELD_SCALAR(fld, flags) \
+ FIELD_SCALAR(fld, fog) \
+ FIELD_SCALAR(fld, frame) \
+ FIELD_SCALAR(fld, gametypefilter) \
+ FIELD_SCALAR(fld, gravity) \
+ FIELD_SCALAR(fld, health) \
+ FIELD_SCALAR(fld, height) \
+ FIELD_SCALAR(fld, impulse) \
+ FIELD_SCALAR(fld, killtarget) \
+ FIELD_SCALAR(fld, lerpfrac) \
+ FIELD_SCALAR(fld, light_lev) \
+ FIELD_SCALAR(fld, lip) \
+ FIELD_SCALAR(fld, loddistance1) \
+ FIELD_SCALAR(fld, lodmodel1) \
+ FIELD_SCALAR(fld, ltime) \
+ FIELD_SCALAR(fld, mdl) \
+ FIELD_SCALAR(fld, message2) \
+ FIELD_SCALAR(fld, message) \
+ FIELD_SCALAR(fld, modelindex) \
+ FIELD_SCALAR(fld, modelscale) \
+ FIELD_SCALAR(fld, model) \
+ FIELD_SCALAR(fld, movetype) \
+ FIELD_SCALAR(fld, netname) \
+ FIELD_SCALAR(fld, nextthink) \
+ FIELD_SCALAR(fld, noalign) \
+ FIELD_SCALAR(fld, noise1) \
+ FIELD_SCALAR(fld, noise2) \
+ FIELD_SCALAR(fld, noise) \
+ FIELD_SCALAR(fld, phase) \
+ FIELD_SCALAR(fld, race_place) \
+ FIELD_SCALAR(fld, radius) \
+ FIELD_SCALAR(fld, respawntimejitter) \
+ FIELD_SCALAR(fld, respawntime) \
+ FIELD_SCALAR(fld, restriction) \
+ FIELD_SCALAR(fld, scale) \
+ FIELD_SCALAR(fld, skin) \
+ FIELD_SCALAR(fld, solid) \
+ FIELD_SCALAR(fld, sound1) \
+ FIELD_SCALAR(fld, sounds) \
+ FIELD_SCALAR(fld, spawnflags) \
+ FIELD_SCALAR(fld, speed) \
+ FIELD_SCALAR(fld, strength) \
+ FIELD_SCALAR(fld, target2) \
+ FIELD_SCALAR(fld, target3) \
+ FIELD_SCALAR(fld, target4) \
+ FIELD_SCALAR(fld, targetname) \
+ FIELD_SCALAR(fld, target) \
+ FIELD_SCALAR(fld, target_random) \
+ FIELD_SCALAR(fld, team) \
+ FIELD_SCALAR(fld, turret_scale_health) \
+ FIELD_SCALAR(fld, turret_scale_range) \
+ FIELD_SCALAR(fld, turret_scale_respawn) \
+ FIELD_SCALAR(fld, volume) \
+ FIELD_SCALAR(fld, wait) \
+ FIELD_SCALAR(fld, warpzone_fadeend) \
+ FIELD_SCALAR(fld, warpzone_fadestart) \
+ FIELD_VEC(fld, absmax) \
+ FIELD_VEC(fld, absmin) \
+ FIELD_VEC(fld, angles) \
+ FIELD_VEC(fld, avelocity) \
+ FIELD_VEC(fld, maxs) \
+ FIELD_VEC(fld, maxs) \
+ FIELD_VEC(fld, mins) \
+ FIELD_VEC(fld, modelscale_vec) \
+ FIELD_VEC(fld, origin) \
+ FIELD_VEC(fld, velocity) \
+ /**/
+
+#define spawnfunc(...) EVAL(OVERLOAD(spawnfunc, __VA_ARGS__, FIELDS_UNION))
+
+#endif
void error(string e) = #10;
float test();
-void spawnfunc_worldspawn()
+spawnfunc(worldspawn)
{
float r;
LOG_TRACE("TESTCASE: START\n");
}
// spawnfunc_waypoint map entity
-void spawnfunc_waypoint()
-{SELFPARAM();
+spawnfunc(waypoint)
+{
setorigin(self, self.origin);
// schedule a relink after other waypoints have had a chance to spawn
waypoint_clearlinks(self);
* Functions
*/
-void spawnfunc_waypoint();
+spawnfunc(waypoint);
void waypoint_addlink(entity from, entity to);
void waypoint_think();
void waypoint_clearlinks(entity wp);
self.angles_y = a.y;
// we leave Rick Roll alone
}
-void spawnfunc_info_autoscreenshot()
-{SELFPARAM();
+spawnfunc(info_autoscreenshot)
+{
if(++num_autoscreenshot > autocvar_g_max_info_autoscreenshot)
{
objerror("Too many info_autoscreenshot entitites. FAIL!");
e.angles = fixedvectoangles2(trace_plane_normal, v_forward);
e.angles = AnglesTransform_ApplyToAngles(e.angles, '-90 0 0'); // so unrotated models work
}
- WITH(entity, self, e, spawnfunc_func_breakable());
+ WITH(entity, self, e, spawnfunc_func_breakable(e));
// now, is it valid?
if(f == 0)
{
#define INDEPENDENT_ATTACK_FINISHED
-noref float require_spawnfunc_prefix; // if this float exists, only functions with spawnfunc_ name prefix qualify as spawn functions
-
#define BUTTON_ATCK button0
#define BUTTON_JUMP button2
#define BUTTON_ATCK2 button3
else
self.light_lev = 0;
}
-void spawnfunc_dynlight()
+spawnfunc(dynlight)
{
if (!self.light_lev)
self.light_lev = 200;
self.default_solid = sol;
// non-solid model entities:
-void spawnfunc_misc_gamemodel() { SELFPARAM(); self.angles_x = -self.angles.x; G_MODEL_INIT (SOLID_NOT) } // model entity
-void spawnfunc_misc_clientmodel() { SELFPARAM(); self.angles_x = -self.angles.x; G_CLIENTMODEL_INIT(SOLID_NOT) } // model entity
-void spawnfunc_misc_models() { SELFPARAM(); self.angles_x = -self.angles.x; G_MODEL_INIT (SOLID_NOT) } // DEPRECATED old compat entity with confusing name, do not use
+spawnfunc(misc_gamemodel) { self.angles_x = -self.angles.x; G_MODEL_INIT (SOLID_NOT) } // model entity
+spawnfunc(misc_clientmodel) { self.angles_x = -self.angles.x; G_CLIENTMODEL_INIT(SOLID_NOT) } // model entity
+spawnfunc(misc_models) { self.angles_x = -self.angles.x; G_MODEL_INIT (SOLID_NOT) } // DEPRECATED old compat entity with confusing name, do not use
// non-solid brush entities:
-void spawnfunc_func_illusionary() { SELFPARAM(); G_MODEL_INIT (SOLID_NOT) } // Q1 name (WARNING: MISPREDICTED)
-void spawnfunc_func_clientillusionary() { SELFPARAM(); G_CLIENTMODEL_INIT(SOLID_NOT) } // brush entity
-void spawnfunc_func_static() { SELFPARAM(); G_MODEL_INIT (SOLID_NOT) } // DEPRECATED old alias name from some other game
+spawnfunc(func_illusionary) { G_MODEL_INIT (SOLID_NOT) } // Q1 name (WARNING: MISPREDICTED)
+spawnfunc(func_clientillusionary) { G_CLIENTMODEL_INIT(SOLID_NOT) } // brush entity
+spawnfunc(func_static) { G_MODEL_INIT (SOLID_NOT) } // DEPRECATED old alias name from some other game
// solid brush entities
-void spawnfunc_func_wall() { SELFPARAM(); G_MODEL_INIT (SOLID_BSP) } // Q1 name
-void spawnfunc_func_clientwall() { SELFPARAM(); G_CLIENTMODEL_INIT(SOLID_BSP) } // brush entity (WARNING: MISPREDICTED)
+spawnfunc(func_wall) { G_MODEL_INIT (SOLID_BSP) } // Q1 name
+spawnfunc(func_clientwall) { G_CLIENTMODEL_INIT(SOLID_BSP) } // brush entity (WARNING: MISPREDICTED)
#include "command/common.qh"
#include "../warpzonelib/common.qh"
-void spawnfunc_info_null (void)
-{SELFPARAM();
+spawnfunc(info_null)
+{
remove(self);
// if anything breaks, tell the mapper to fix his map! info_null is meant to remove itself immediately.
}
//void() SUB_UseTargets;
void() SUB_Remove;
-void spawnfunc_info_null (void);
+spawnfunc(info_null);
void setanim(entity e, vector anim, float looping, float override, float restart);
WITH(entity, self, randomseed, randomseed.think()); // sets random seed and nextthink
}
-void spawnfunc___init_dedicated_server(void)
-{SELFPARAM();
+spawnfunc(__init_dedicated_server)
+{
// handler for _init/_init map (only for dedicated server initialization)
world_initialized = -1; // don't complain
void WeaponStats_Init();
void WeaponStats_Shutdown();
void Physics_AddStats();
-void spawnfunc_worldspawn (void)
-{SELFPARAM();
+spawnfunc(worldspawn)
+{
float fd, l, j, n;
string s;
world_initialized = 1;
}
-void spawnfunc_light (void)
-{SELFPARAM();
+spawnfunc(light)
+{
//makestatic (self); // Who the f___ did that?
remove(self);
}
itemkeys MUST always have exactly one bit set.
*/
-void spawnfunc_item_key()
-{SELFPARAM();
+spawnfunc(item_key)
+{
string _netname;
vector _colormod;
---------NOTES----------
Don't use this entity on new maps! Use item_key instead.
*/
-void spawnfunc_item_key1(void)
-{SELFPARAM();
- self.classname = "item_key";
- self.itemkeys = ITEM_KEY_BIT(1);
- spawnfunc_item_key();
+spawnfunc(item_key1)
+{
+ this.classname = "item_key";
+ this.itemkeys = ITEM_KEY_BIT(1);
+ spawnfunc_item_key(this);
};
/*QUAKED item_key2 (0 .5 .8) (-16 -16 -24) (16 16 32) FLOATING
---------NOTES----------
Don't use this entity on new maps! Use item_key instead.
*/
-void spawnfunc_item_key2(void)
-{SELFPARAM();
- self.classname = "item_key";
- self.itemkeys = ITEM_KEY_BIT(0);
- spawnfunc_item_key();
+spawnfunc(item_key2)
+{
+ this.classname = "item_key";
+ this.itemkeys = ITEM_KEY_BIT(0);
+ spawnfunc_item_key(this);
};
/**/ i(entity, other) \
/**/ o(entity, other) \
/**/
-.void() monster_loot;
+.void(entity this) monster_loot;
MUTATOR_HOOKABLE(MonsterDropItem, EV_MonsterDropItem);
/**
}
// spawnfuncs
-void spawnfunc_info_player_attacker()
-{SELFPARAM();
+spawnfunc(info_player_attacker)
+{
if (!g_assault) { remove(self); return; }
self.team = NUM_TEAM_1; // red, gets swapped every round
- spawnfunc_info_player_deathmatch();
+ spawnfunc_info_player_deathmatch(this);
}
-void spawnfunc_info_player_defender()
-{SELFPARAM();
+spawnfunc(info_player_defender)
+{
if (!g_assault) { remove(self); return; }
self.team = NUM_TEAM_2; // blue, gets swapped every round
- spawnfunc_info_player_deathmatch();
+ spawnfunc_info_player_deathmatch(this);
}
-void spawnfunc_target_objective()
-{SELFPARAM();
+spawnfunc(target_objective)
+{
if (!g_assault) { remove(self); return; }
self.classname = "target_objective";
self.spawn_evalfunc = target_objective_spawn_evalfunc;
}
-void spawnfunc_target_objective_decrease()
-{SELFPARAM();
+spawnfunc(target_objective_decrease)
+{
if (!g_assault) { remove(self); return; }
self.classname = "target_objective_decrease";
}
// destructible walls that can be used to trigger target_objective_decrease
-void spawnfunc_func_assault_destructible()
-{SELFPARAM();
+spawnfunc(func_assault_destructible)
+{
if (!g_assault) { remove(self); return; }
self.spawnflags = 3;
else
self.team = NUM_TEAM_1;
- spawnfunc_func_breakable();
+ spawnfunc_func_breakable(this);
}
-void spawnfunc_func_assault_wall()
-{SELFPARAM();
+spawnfunc(func_assault_wall)
+{
if (!g_assault) { remove(self); return; }
self.classname = "func_assault_wall";
InitializeEntity(self, assault_setenemytoobjective, INITPRIO_FINDTARGET);
}
-void spawnfunc_target_assault_roundend()
-{SELFPARAM();
+spawnfunc(target_assault_roundend)
+{
if (!g_assault) { remove(self); return; }
self.winning = 0; // round not yet won by attackers
self.reset = target_assault_roundend_reset;
}
-void spawnfunc_target_assault_roundstart()
-{SELFPARAM();
+spawnfunc(target_assault_roundstart)
+{
if (!g_assault) { remove(self); return; }
assault_attacker_team = NUM_TEAM_1;
"noise3" sound played when flag is lost in the field and respawns itself...
"noise4" sound played when flag is dropped by a player...
"noise5" sound played when flag touches the ground... */
-void spawnfunc_item_flag_team1()
-{SELFPARAM();
+spawnfunc(item_flag_team1)
+{
if(!g_ctf) { remove(self); return; }
ctf_FlagSetup(NUM_TEAM_1, self);
"noise3" sound played when flag is lost in the field and respawns itself...
"noise4" sound played when flag is dropped by a player...
"noise5" sound played when flag touches the ground... */
-void spawnfunc_item_flag_team2()
-{SELFPARAM();
+spawnfunc(item_flag_team2)
+{
if(!g_ctf) { remove(self); return; }
ctf_FlagSetup(NUM_TEAM_2, self);
"noise3" sound played when flag is lost in the field and respawns itself...
"noise4" sound played when flag is dropped by a player...
"noise5" sound played when flag touches the ground... */
-void spawnfunc_item_flag_team3()
-{SELFPARAM();
+spawnfunc(item_flag_team3)
+{
if(!g_ctf) { remove(self); return; }
ctf_FlagSetup(NUM_TEAM_3, self);
"noise3" sound played when flag is lost in the field and respawns itself...
"noise4" sound played when flag is dropped by a player...
"noise5" sound played when flag touches the ground... */
-void spawnfunc_item_flag_team4()
-{SELFPARAM();
+spawnfunc(item_flag_team4)
+{
if(!g_ctf) { remove(self); return; }
ctf_FlagSetup(NUM_TEAM_4, self);
"noise3" sound played when flag is lost in the field and respawns itself...
"noise4" sound played when flag is dropped by a player...
"noise5" sound played when flag touches the ground... */
-void spawnfunc_item_flag_neutral()
-{SELFPARAM();
+spawnfunc(item_flag_neutral)
+{
if(!g_ctf) { remove(self); return; }
if(!cvar("g_ctf_oneflag")) { remove(self); return; }
Keys:
"netname" Name of the team (for example Red, Blue, Green, Yellow, Life, Death, Offense, Defense, etc)...
"cnt" Scoreboard color of the team (for example 4 is red and 13 is blue)... */
-void spawnfunc_ctf_team()
-{SELFPARAM();
+spawnfunc(ctf_team)
+{
if(!g_ctf) { remove(self); return; }
self.classname = "ctf_team";
}
// compatibility for quake maps
-void spawnfunc_team_CTF_redflag() { spawnfunc_item_flag_team1(); }
-void spawnfunc_team_CTF_blueflag() { spawnfunc_item_flag_team2(); }
-void spawnfunc_team_CTF_redplayer() { spawnfunc_info_player_team1(); }
-void spawnfunc_team_CTF_blueplayer() { spawnfunc_info_player_team2(); }
-void spawnfunc_team_CTF_redspawn() { spawnfunc_info_player_team1(); }
-void spawnfunc_team_CTF_bluespawn() { spawnfunc_info_player_team2(); }
+spawnfunc(team_CTF_redflag) { spawnfunc_item_flag_team1(this); }
+spawnfunc(team_CTF_blueflag) { spawnfunc_item_flag_team2(this); }
+spawnfunc(team_CTF_redplayer) { spawnfunc_info_player_team1(this); }
+spawnfunc(team_CTF_blueplayer) { spawnfunc_info_player_team2(this); }
+spawnfunc(team_CTF_redspawn) { spawnfunc_info_player_team1(this); }
+spawnfunc(team_CTF_bluespawn) { spawnfunc_info_player_team2(this); }
-void team_CTF_neutralflag() { spawnfunc_item_flag_neutral(); }
-void team_neutralobelisk() { spawnfunc_item_flag_neutral(); }
+void team_CTF_neutralflag() { SELFPARAM(); spawnfunc_item_flag_neutral(self); }
+void team_neutralobelisk() { SELFPARAM(); spawnfunc_item_flag_neutral(self); }
// ==============
// code from here on is just to support maps that don't have flag and team entities
void ctf_SpawnTeam (string teamname, int teamcolor)
-{SELFPARAM();
- setself(spawn());
- self.classname = "ctf_team";
- self.netname = teamname;
- self.cnt = teamcolor;
-
- spawnfunc_ctf_team();
-
- setself(this);
+{
+ entity this = new(ctf_team);
+ this.netname = teamname;
+ this.cnt = teamcolor;
+ this.spawnfunc_checked = true;
+ WITH(entity, self, this, spawnfunc_ctf_team(this));
}
void ctf_DelayedInit() // Do this check with a delay so we can wait for teams to be set up.
/*QUAKED spawnfunc_dom_controlpoint (0 .5 .8) (-16 -16 -24) (16 16 32)
Control point for Domination gameplay.
*/
-void spawnfunc_dom_controlpoint()
-{SELFPARAM();
+spawnfunc(dom_controlpoint)
+{
if(!g_domination)
{
remove(self);
(this is a global sound, like "Red team has captured a control point")
*/
-void spawnfunc_dom_team()
-{SELFPARAM();
+spawnfunc(dom_team)
+{
if(!g_domination || autocvar_g_domination_teams_override >= 2)
{
remove(self);
setself(this);
}
+void _spawnfunc_dom_controlpoint() { SELFPARAM(); spawnfunc_dom_controlpoint(self); }
void dom_spawnpoint(vector org)
{SELFPARAM();
setself(spawn());
self.classname = "dom_controlpoint";
- self.think = spawnfunc_dom_controlpoint;
+ self.think = _spawnfunc_dom_controlpoint;
self.nextthink = time;
setorigin(self, org);
- spawnfunc_dom_controlpoint();
+ spawnfunc_dom_controlpoint(this);
setself(this);
}
#include "../../common/monsters/spawn.qh"
#include "../../common/monsters/sv_monsters.qh"
-void spawnfunc_invasion_spawnpoint()
-{SELFPARAM();
+spawnfunc(invasion_spawnpoint)
+{
if(!g_invasion) { remove(self); return; }
self.classname = "invasion_spawnpoint";
//=======================//
// team ents //
//=======================//
-void spawnfunc_nexball_team(void)
-{SELFPARAM();
+spawnfunc(nexball_team)
+{
if(!g_nexball)
{
remove(self);
self.nextthink = game_starttime + autocvar_g_nexball_delay_start;
}
-void spawnfunc_nexball_basketball(void)
-{SELFPARAM();
+spawnfunc(nexball_basketball)
+{
nexball_mode |= NBM_BASKETBALL;
self.classname = "nexball_basketball";
if (!(balls & BALL_BASKET))
SpawnBall();
}
-void spawnfunc_nexball_football(void)
-{SELFPARAM();
+spawnfunc(nexball_football)
+{
nexball_mode |= NBM_FOOTBALL;
self.classname = "nexball_football";
self.solid = SOLID_TRIGGER;
self.touch = GoalTouch;
}
-void spawnfunc_nexball_redgoal(void)
-{SELFPARAM();
+spawnfunc(nexball_redgoal)
+{
self.team = NUM_TEAM_1;
SpawnGoal();
}
-void spawnfunc_nexball_bluegoal(void)
-{SELFPARAM();
+spawnfunc(nexball_bluegoal)
+{
self.team = NUM_TEAM_2;
SpawnGoal();
}
-void spawnfunc_nexball_yellowgoal(void)
-{SELFPARAM();
+spawnfunc(nexball_yellowgoal)
+{
self.team = NUM_TEAM_3;
SpawnGoal();
}
-void spawnfunc_nexball_pinkgoal(void)
-{SELFPARAM();
+spawnfunc(nexball_pinkgoal)
+{
self.team = NUM_TEAM_4;
SpawnGoal();
}
-void spawnfunc_nexball_fault(void)
-{SELFPARAM();
+spawnfunc(nexball_fault)
+{
self.team = GOAL_FAULT;
if(self.noise == "")
self.noise = "misc/typehit.wav";
SpawnGoal();
}
-void spawnfunc_nexball_out(void)
-{SELFPARAM();
+spawnfunc(nexball_out)
+{
self.team = GOAL_OUT;
if(self.noise == "")
self.noise = "misc/typehit.wav";
//Spawnfuncs preserved for compatibility
//
-void spawnfunc_ball(void)
+spawnfunc(ball)
{
- spawnfunc_nexball_football();
+ spawnfunc_nexball_football(this);
}
-void spawnfunc_ball_football(void)
+spawnfunc(ball_football)
{
- spawnfunc_nexball_football();
+ spawnfunc_nexball_football(this);
}
-void spawnfunc_ball_basketball(void)
+spawnfunc(ball_basketball)
{
- spawnfunc_nexball_basketball();
+ spawnfunc_nexball_basketball(this);
}
// The "red goal" is defended by blue team. A ball in there counts as a point for red.
-void spawnfunc_ball_redgoal(void)
+spawnfunc(ball_redgoal)
{
- spawnfunc_nexball_bluegoal(); // I blame Revenant
+ spawnfunc_nexball_bluegoal(this); // I blame Revenant
}
-void spawnfunc_ball_bluegoal(void)
+spawnfunc(ball_bluegoal)
{
- spawnfunc_nexball_redgoal(); // but he didn't mean to cause trouble :p
+ spawnfunc_nexball_redgoal(this); // but he didn't mean to cause trouble :p
}
-void spawnfunc_ball_fault(void)
+spawnfunc(ball_fault)
{
- spawnfunc_nexball_fault();
+ spawnfunc_nexball_fault(this);
}
-void spawnfunc_ball_bound(void)
+spawnfunc(ball_bound)
{
- spawnfunc_nexball_out();
+ spawnfunc_nexball_out(this);
}
//=======================//
"target" - first control point.
"target2" - second control point.
*/
-void spawnfunc_onslaught_link()
-{SELFPARAM();
+spawnfunc(onslaught_link)
+{
if(!g_onslaught) { remove(self); return; }
if (self.target == "" || self.target2 == "")
"message" - name of this control point (should reflect the location in the map, such as "center bridge", "north tower", etc)
*/
-void spawnfunc_onslaught_controlpoint()
-{SELFPARAM();
+spawnfunc(onslaught_controlpoint)
+{
if(!g_onslaught) { remove(self); return; }
ons_ControlPoint_Setup(self);
"team" - team that owns this generator (5 = red, 14 = blue, etc), MUST BE SET.
"targetname" - name that spawnfunc_onslaught_link entities will use to target this.
*/
-void spawnfunc_onslaught_generator()
-{SELFPARAM();
+spawnfunc(onslaught_generator)
+{
if(!g_onslaught) { remove(self); return; }
if(!self.team) { objerror("team must be set"); }
Keys:
"netname" Name of the team (for example Red, Blue, Green, Yellow, Life, Death, Offense, Defense, etc)...
"cnt" Scoreboard color of the team (for example 4 is red and 13 is blue)... */
-void spawnfunc_tdm_team()
-{SELFPARAM();
+spawnfunc(tdm_team)
+{
if(!g_tdm || !self.cnt) { remove(self); return; }
self.classname = "tdm_team";
// code from here on is just to support maps that don't have team entities
void tdm_SpawnTeam (string teamname, float teamcolor)
-{SELFPARAM();
- setself(spawn());
- self.classname = "tdm_team";
- self.netname = teamname;
- self.cnt = teamcolor;
-
- spawnfunc_tdm_team();
-
- setself(this);
+{
+ entity this = new(tdm_team);
+ this.netname = teamname;
+ this.cnt = teamcolor;
+ this.spawnfunc_checked = true;
+ WITH(entity, self, this, spawnfunc_tdm_team(this));
}
void tdm_DelayedInit()
#include "../../common/items/all.qc"
-void spawnfunc_item_minst_cells()
-{SELFPARAM();
+spawnfunc(item_minst_cells)
+{
if (!g_instagib) { remove(self); return; }
if (!self.ammo_cells) self.ammo_cells = autocvar_g_instagib_ammo_drop;
StartItemA(ITEM_VaporizerCells);
e.noalign = self.noalign;
e.cnt = self.cnt;
e.team = self.team;
- WITH(entity, self, e, spawnfunc_item_minst_cells());
+ WITH(entity, self, e, spawnfunc_item_minst_cells(e));
return true;
}
#include "mutator.qh"
void W_Blaster_Attack(float, float, float, float, float, float, float, float, float, float);
-void spawnfunc_weapon_hmg();
-void spawnfunc_weapon_rpc();
+spawnfunc(weapon_hmg);
+spawnfunc(weapon_rpc);
void ok_DecreaseCharge(entity ent, int wep)
{
self.ok_item = true;
self.noalign = true;
self.pickup_anyway = true;
- spawnfunc_item_armor_small();
+ spawnfunc_item_armor_small(this);
self.movetype = MOVETYPE_TOSS;
self.gravity = 1;
self.reset = SUB_Remove;
return false;
}
+void _spawnfunc_weapon_hmg() { SELFPARAM(); spawnfunc_weapon_hmg(this); }
+void _spawnfunc_weapon_rpc() { SELFPARAM(); spawnfunc_weapon_rpc(this); }
+
MUTATOR_HOOKFUNCTION(ok_OnEntityPreSpawn)
{SELFPARAM();
if(autocvar_g_powerups)
wep.team = self.team;
wep.respawntime = autocvar_g_overkill_superguns_respawn_time;
wep.pickup_anyway = true;
- wep.think = spawnfunc_weapon_hmg;
+ wep.think = _spawnfunc_weapon_hmg;
wep.nextthink = time + 0.1;
return true;
}
wep.team = self.team;
wep.respawntime = autocvar_g_overkill_superguns_respawn_time;
wep.pickup_anyway = true;
- wep.think = spawnfunc_weapon_rpc;
+ wep.think = _spawnfunc_weapon_rpc;
wep.nextthink = time + 0.1;
return true;
}
const float MAX_CHECKPOINTS = 255;
-void spawnfunc_target_checkpoint();
+spawnfunc(target_checkpoint);
.float race_penalty;
.float race_penalty_accumulator;
return current;
}
-void spawnfunc_trigger_race_checkpoint()
-{SELFPARAM();
+spawnfunc(trigger_race_checkpoint)
+{
vector o;
if(!g_race && !g_cts) { remove(self); return; }
InitializeEntity(self, trigger_race_checkpoint_verify, INITPRIO_FINDTARGET);
}
-void spawnfunc_target_checkpoint() // defrag entity
-{SELFPARAM();
+spawnfunc(target_checkpoint) // defrag entity
+{
vector o;
if(!g_race && !g_cts) { remove(self); return; }
defrag_ents = 1;
InitializeEntity(self, trigger_race_checkpoint_verify, INITPRIO_FINDTARGET);
}
-void spawnfunc_target_startTimer() { spawnfunc_target_checkpoint(); }
-void spawnfunc_target_stopTimer() { spawnfunc_target_checkpoint(); }
+spawnfunc(target_startTimer) { spawnfunc_target_checkpoint(this); }
+spawnfunc(target_stopTimer) { spawnfunc_target_checkpoint(this); }
void race_AbandonRaceCheck(entity p)
{
self.race_checkpoint = self.race_respawn_checkpoint;
}
-void spawnfunc_info_player_race (void)
-{SELFPARAM();
+spawnfunc(info_player_race)
+{
if(!g_race && !g_cts) { remove(self); return; }
++race_spawns;
- spawnfunc_info_player_deathmatch();
+ spawnfunc_info_player_deathmatch(this);
if(self.race_place > race_highest_place_spawn)
race_highest_place_spawn = self.race_place;
race_ImposePenaltyTime(activator, self.race_penalty, self.race_penalty_reason);
}
-void spawnfunc_trigger_race_penalty()
-{SELFPARAM();
+spawnfunc(trigger_race_penalty)
+{
EXACTTRIGGER_INIT;
self.use = penalty_use;
{ Net_LinkEntity(self, false, 0, SpawnPoint_Send); }
}
-void spawnfunc_info_player_survivor (void)
+spawnfunc(info_player_survivor)
{
- spawnfunc_info_player_deathmatch();
+ spawnfunc_info_player_deathmatch(this);
}
-void spawnfunc_info_player_start (void)
+spawnfunc(info_player_start)
{
- spawnfunc_info_player_deathmatch();
+ spawnfunc_info_player_deathmatch(this);
}
-void spawnfunc_info_player_deathmatch (void)
-{SELFPARAM();
+spawnfunc(info_player_deathmatch)
+{
self.classname = "info_player_deathmatch";
relocate_spawnpoint();
}
/*QUAKED spawnfunc_info_player_team1 (1 0 0) (-16 -16 -24) (16 16 24)
Starting point for a player in team one (Red).
Keys: "angle" viewing angle when spawning. */
-void spawnfunc_info_player_team1()
-{SELFPARAM();
- if(g_assault) { remove(self); return; }
+spawnfunc(info_player_team1)
+{
+ if(g_assault) { remove(this); return; }
- self.team = NUM_TEAM_1; // red
- spawnfunc_info_player_deathmatch();
+ this.team = NUM_TEAM_1; // red
+ spawnfunc_info_player_deathmatch(this);
}
/*QUAKED spawnfunc_info_player_team2 (1 0 0) (-16 -16 -24) (16 16 24)
Starting point for a player in team two (Blue).
Keys: "angle" viewing angle when spawning. */
-void spawnfunc_info_player_team2()
-{SELFPARAM();
- if(g_assault) { remove(self); return; }
+spawnfunc(info_player_team2)
+{
+ if(g_assault) { remove(this); return; }
- self.team = NUM_TEAM_2; // blue
- spawnfunc_info_player_deathmatch();
+ this.team = NUM_TEAM_2; // blue
+ spawnfunc_info_player_deathmatch(this);
}
/*QUAKED spawnfunc_info_player_team3 (1 0 0) (-16 -16 -24) (16 16 24)
Starting point for a player in team three (Yellow).
Keys: "angle" viewing angle when spawning. */
-void spawnfunc_info_player_team3()
-{SELFPARAM();
- if(g_assault) { remove(self); return; }
+spawnfunc(info_player_team3)
+{
+ if(g_assault) { remove(this); return; }
- self.team = NUM_TEAM_3; // yellow
- spawnfunc_info_player_deathmatch();
+ this.team = NUM_TEAM_3; // yellow
+ spawnfunc_info_player_deathmatch(this);
}
/*QUAKED spawnfunc_info_player_team4 (1 0 0) (-16 -16 -24) (16 16 24)
Starting point for a player in team four (Purple).
Keys: "angle" viewing angle when spawning. */
-void spawnfunc_info_player_team4()
-{SELFPARAM();
- if(g_assault) { remove(self); return; }
+spawnfunc(info_player_team4)
+{
+ if(g_assault) { remove(this); return; }
- self.team = NUM_TEAM_4; // purple
- spawnfunc_info_player_deathmatch();
+ this.team = NUM_TEAM_4; // purple
+ spawnfunc_info_player_deathmatch(this);
}
// Returns:
float SpawnEvent_Send(entity to, int sf);
entity Spawn_FilterOutBadSpots(entity firstspot, float mindist, float teamcheck);
entity SelectSpawnPoint (float anypoint);
-void spawnfunc_info_player_deathmatch();
+spawnfunc(info_player_deathmatch);
void spawnpoint_use();
#endif
float globflockcnt;
-void spawnfunc_flockerspawn()
+spawnfunc(flockerspawn)
{SELFPARAM();
++globflockcnt;
.float rendermode;
.vector rendercolor;
-void spawnfunc_weapon_crossbow() {}
-void spawnfunc_weapon_handgrenade() {}
-void spawnfunc_ammo_crossbow() {}
-void spawnfunc_ammo_9mmclip() {}
-void spawnfunc_ammo_gaussclip() {}
-void spawnfunc_weapon_rpg() {}
-void spawnfunc_weapon_357() {}
+spawnfunc(weapon_crossbow) {}
+spawnfunc(weapon_handgrenade) {}
+spawnfunc(ammo_crossbow) {}
+spawnfunc(ammo_9mmclip) {}
+spawnfunc(ammo_gaussclip) {}
+spawnfunc(weapon_rpg) {}
+spawnfunc(weapon_357) {}
void ammo_ARgrenades() {}
-void spawnfunc_item_battery() {}
-void spawnfunc_ammo_rpgclip() {}
+spawnfunc(item_battery) {}
+spawnfunc(ammo_rpgclip) {}
void weapon_9mmAR() {}
-void spawnfunc_weapon_tripmine() {}
-void spawnfunc_weapon_snark() {}
-void spawnfunc_ammo_buckshot() {}
+spawnfunc(weapon_tripmine) {}
+spawnfunc(weapon_snark) {}
+spawnfunc(ammo_buckshot) {}
void ammo_9mmAR() {}
-void spawnfunc_ammo_357() {}
-void spawnfunc_weapon_gauss() {}
-void spawnfunc_weapon_hornetgun() {}
-//void spawnfunc_weapon_shotgun() {}
-void spawnfunc_item_healthkit() {}
-void spawnfunc_item_longjump() {}
-void spawnfunc_item_antidote() {}
-void spawnfunc_func_recharge() {}
-void spawnfunc_info_node() {}
-void spawnfunc_env_sound() {}
-void spawnfunc_light_spot() {}
-void spawnfunc_func_healthcharger() {}
+spawnfunc(ammo_357) {}
+spawnfunc(weapon_gauss) {}
+spawnfunc(weapon_hornetgun) {}
+//spawnfunc(weapon_shotgun) {}
+spawnfunc(item_healthkit) {}
+spawnfunc(item_longjump) {}
+spawnfunc(item_antidote) {}
+spawnfunc(func_recharge) {}
+spawnfunc(info_node) {}
+spawnfunc(env_sound) {}
+spawnfunc(light_spot) {}
+spawnfunc(func_healthcharger) {}
StartItem(Item_Model(a.m_model), 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)
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;
}
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)
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)
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;
}
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)
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)
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)
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)
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)
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)
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)
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)
}
// 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)
+{
precache_sound("weapons/strength_fire.wav");
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();
centerprint(activator, self.message);
}
-void spawnfunc_target_items (void)
-{SELFPARAM();
+spawnfunc(target_items)
+{
float n, i, j;
entity e;
string s;
}
}
-void spawnfunc_item_fuel(void)
-{SELFPARAM();
+spawnfunc(item_fuel)
+{
if(!self.ammo_fuel)
self.ammo_fuel = g_pickup_fuel;
if(!self.pickup_anyway)
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);
#endif
#ifdef SVQC
-void spawnfunc_item_strength();
-void spawnfunc_item_invincible();
-void spawnfunc_item_armor_small();
-void spawnfunc_item_shells();
-void spawnfunc_item_bullets();
-void spawnfunc_item_rockets();
+spawnfunc(item_strength);
+spawnfunc(item_invincible);
+spawnfunc(item_armor_small);
+spawnfunc(item_shells);
+spawnfunc(item_bullets);
+spawnfunc(item_rockets);
float autocvar_sv_simple_items;
bool ItemSend(entity to, int sf);
#include "../common/weapons/all.qh"
-void spawnfunc_weapon_electro();
-void spawnfunc_weapon_hagar();
-void spawnfunc_weapon_machinegun();
-void spawnfunc_item_bullets();
-void spawnfunc_item_armor_large();
-void spawnfunc_item_armor_large();
-void spawnfunc_item_health_mega();
-void spawnfunc_item_health_medium();
+spawnfunc(weapon_electro);
+spawnfunc(weapon_hagar);
+spawnfunc(weapon_machinegun);
+spawnfunc(item_bullets);
+spawnfunc(item_armor_large);
+spawnfunc(item_armor_large);
+spawnfunc(item_health_mega);
+spawnfunc(item_health_medium);
//***********************
//QUAKE 1 ENTITIES - So people can play quake1 maps with the xonotic weapons
//***********************
-void spawnfunc_weapon_nailgun() {spawnfunc_weapon_electro();}
-void spawnfunc_weapon_supernailgun() {spawnfunc_weapon_hagar();}
-void spawnfunc_weapon_supershotgun() {spawnfunc_weapon_machinegun();}
-
-void spawnfunc_item_spikes() {spawnfunc_item_bullets();}
-//void spawnfunc_item_armor1() {spawnfunc_item_armor_medium;} // FIXME: in Quake this is green armor, in Xonotic maps it is an armor shard
-void spawnfunc_item_armor2() {spawnfunc_item_armor_large();}
-void item_armorInv() {spawnfunc_item_armor_large();}
-void spawnfunc_item_health() {SELFPARAM();if (self.spawnflags & 2) spawnfunc_item_health_mega();else spawnfunc_item_health_medium();}
+spawnfunc(weapon_nailgun) {spawnfunc_weapon_electro(this);}
+spawnfunc(weapon_supernailgun) {spawnfunc_weapon_hagar(this);}
+spawnfunc(weapon_supershotgun) {spawnfunc_weapon_machinegun(this);}
+
+spawnfunc(item_spikes) {spawnfunc_item_bullets(this);}
+//spawnfunc(item_armor1) {spawnfunc_item_armor_medium(this);} // FIXME: in Quake this is green armor, in Xonotic maps it is an armor shard
+spawnfunc(item_armor2) {spawnfunc_item_armor_large(this);}
+void item_armorInv() {SELFPARAM();spawnfunc_item_armor_large(self);}
+spawnfunc(item_health) {if (self.spawnflags & 2) spawnfunc_item_health_mega(this);else spawnfunc_item_health_medium(this);}
//spawnfunc_item_spikes
//spawnfunc_item_health
#include "../common/weapons/all.qh"
#include "../common/buffs.qh"
-void spawnfunc_weapon_crylink();
-void spawnfunc_weapon_electro();
-void spawnfunc_weapon_hagar();
-void spawnfunc_weapon_machinegun();
-void spawnfunc_weapon_vortex();
+spawnfunc(weapon_crylink);
+spawnfunc(weapon_electro);
+spawnfunc(weapon_hagar);
+spawnfunc(weapon_machinegun);
+spawnfunc(weapon_vortex);
-void spawnfunc_target_items();
+spawnfunc(target_items);
-void spawnfunc_item_bullets();
-void spawnfunc_item_cells();
-void spawnfunc_item_rockets();
-void spawnfunc_item_shells();
+spawnfunc(item_bullets);
+spawnfunc(item_cells);
+spawnfunc(item_rockets);
+spawnfunc(item_shells);
-void spawnfunc_item_jetpack();
+spawnfunc(item_jetpack);
-void spawnfunc_item_armor_big();
-void spawnfunc_item_armor_large();
-void spawnfunc_item_armor_small();
+spawnfunc(item_armor_big);
+spawnfunc(item_armor_large);
+spawnfunc(item_armor_small);
-void spawnfunc_item_health_medium();
-void spawnfunc_item_health_mega();
+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_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 -> Lightning
-void spawnfunc_weapon_lightning() { spawnfunc_weapon_electro(); }
-void spawnfunc_ammo_lightning() { spawnfunc_item_cells(); }
+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 -> Vortex
-void spawnfunc_weapon_railgun() { spawnfunc_weapon_vortex(); }
-void spawnfunc_ammo_slugs() { spawnfunc_item_cells(); }
+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()
}
}
-void spawnfunc_target_init()
-{SELFPARAM();
+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);
}
targ.nextthink = time;
}
self.spawnflags = 2;
- spawnfunc_target_items();
+ spawnfunc_target_items(this);
InitializeEntity(self, target_init_verify, INITPRIO_FINDTARGET);
}
-void spawnfunc_target_give()
-{SELFPARAM();
+spawnfunc(target_give)
+{
InitializeEntity(self, target_give_init, INITPRIO_FINDTARGET);
}
-//void spawnfunc_item_flight() /* handled by buffs mutator or jetpack */
-//void spawnfunc_item_haste() /* handled by buffs mutator */
-//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() /* handled by buffs mutator */
-//void spawnfunc_item_regen() /* handled by buffs mutator */
+//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()
-{SELFPARAM();
+spawnfunc(item_flight)
+{
if(!cvar("g_buffs") || !cvar("g_buffs_flight"))
- spawnfunc_item_jetpack();
+ spawnfunc_item_jetpack(this);
else
buff_Init_Compat(self, BUFF_FLIGHT);
}
entity warpzone_position_first;
entity warpzone_camera_first;
.entity warpzone_next;
-void spawnfunc_misc_warpzone_position(void)
-{SELFPARAM();
+spawnfunc(misc_warpzone_position)
+{
// "target", "angles", "origin"
self.warpzone_next = warpzone_position_first;
warpzone_position_first = self;
}
-void spawnfunc_trigger_warpzone_position(void)
+spawnfunc(trigger_warpzone_position)
{
- spawnfunc_misc_warpzone_position();
+ spawnfunc_misc_warpzone_position(this);
}
-void spawnfunc_trigger_warpzone(void)
-{SELFPARAM();
+spawnfunc(trigger_warpzone)
+{
// warp zone entities must have:
// "killtarget" pointing to a target_position with a direction arrow
// that points AWAY from the warp zone, and that is inside
self.warpzone_next = warpzone_first;
warpzone_first = self;
}
-void spawnfunc_func_camera(void)
-{SELFPARAM();
+spawnfunc(func_camera)
+{
if(!self.scale)
self.scale = self.modelscale;
if(!self.scale)
setself(e);
}
-void spawnfunc_trigger_warpzone_reconnect()
-{SELFPARAM();
+spawnfunc(trigger_warpzone_reconnect)
+{
self.use = trigger_warpzone_reconnect_use;
}
-void spawnfunc_target_warpzone_reconnect()
+spawnfunc(target_warpzone_reconnect)
{
- spawnfunc_trigger_warpzone_reconnect(); // both names make sense here :(
+ spawnfunc_trigger_warpzone_reconnect(this); // both names make sense here :(
}
void WarpZone_PlayerPhysics_FixVAngle(void)