From: TimePath Date: Thu, 24 Sep 2015 02:48:07 +0000 (+1000) Subject: Spawnfunc whitelist X-Git-Tag: xonotic-v0.8.2~1886^2~3 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=7a85bc59ba3d8d35a90d20b364f53669430eb229;p=xonotic%2Fxonotic-data.pk3dir.git Spawnfunc whitelist --- diff --git a/qcsrc/common/buffs.qh b/qcsrc/common/buffs.qh index 3eff9e26b..31654ebf8 100644 --- a/qcsrc/common/buffs.qh +++ b/qcsrc/common/buffs.qh @@ -145,8 +145,7 @@ REGISTER_BUFF(MAGNET) { 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); \ @@ -157,7 +156,7 @@ void buff_Init_Compat(entity ent, entity replacement); 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) diff --git a/qcsrc/common/monsters/monster/mage.qc b/qcsrc/common/monsters/monster/mage.qc index d2881e9ba..f30c62e21 100644 --- a/qcsrc/common/monsters/monster/mage.qc +++ b/qcsrc/common/monsters/monster/mage.qc @@ -343,7 +343,7 @@ float M_Mage_Attack(float attack_type) return false; } -void spawnfunc_monster_mage() { Monster_Spawn(MON_MAGE.monsterid); } +spawnfunc(monster_mage) { Monster_Spawn(MON_MAGE.monsterid); } #endif // SVQC diff --git a/qcsrc/common/monsters/monster/shambler.qc b/qcsrc/common/monsters/monster/shambler.qc index ea7fbbf7c..3354d2f20 100644 --- a/qcsrc/common/monsters/monster/shambler.qc +++ b/qcsrc/common/monsters/monster/shambler.qc @@ -211,7 +211,7 @@ float M_Shambler_Attack(float attack_type) 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) diff --git a/qcsrc/common/monsters/monster/spider.qc b/qcsrc/common/monsters/monster/spider.qc index fb71c2f22..f2bc7d789 100644 --- a/qcsrc/common/monsters/monster/spider.qc +++ b/qcsrc/common/monsters/monster/spider.qc @@ -124,7 +124,7 @@ bool M_Spider_Attack(int attack_type) 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) diff --git a/qcsrc/common/monsters/monster/wyvern.qc b/qcsrc/common/monsters/monster/wyvern.qc index af174603d..d65bcf648 100644 --- a/qcsrc/common/monsters/monster/wyvern.qc +++ b/qcsrc/common/monsters/monster/wyvern.qc @@ -101,7 +101,7 @@ float M_Wyvern_Attack(float attack_type) 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) diff --git a/qcsrc/common/monsters/monster/zombie.qc b/qcsrc/common/monsters/monster/zombie.qc index ed169c99d..6242a757d 100644 --- a/qcsrc/common/monsters/monster/zombie.qc +++ b/qcsrc/common/monsters/monster/zombie.qc @@ -138,7 +138,7 @@ float M_Zombie_Attack(float attack_type) 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) diff --git a/qcsrc/common/monsters/sv_monsters.qc b/qcsrc/common/monsters/sv_monsters.qc index 8eab200a6..519a5322e 100644 --- a/qcsrc/common/monsters/sv_monsters.qc +++ b/qcsrc/common/monsters/sv_monsters.qc @@ -49,7 +49,7 @@ void monster_dropitem() { setself(e); e.noalign = true; - e.monster_loot(); + e.monster_loot(e); e.gravity = 1; e.movetype = MOVETYPE_TOSS; e.reset = SUB_Remove; diff --git a/qcsrc/common/triggers/func/bobbing.qc b/qcsrc/common/triggers/func/bobbing.qc index 298043bb5..8c7000d93 100644 --- a/qcsrc/common/triggers/func/bobbing.qc +++ b/qcsrc/common/triggers/func/bobbing.qc @@ -28,8 +28,8 @@ noise : path/name of looping .wav file to play. 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 != "") { diff --git a/qcsrc/common/triggers/func/breakable.qc b/qcsrc/common/triggers/func/breakable.qc index 0430db2d4..09ae8002b 100644 --- a/qcsrc/common/triggers/func/breakable.qc +++ b/qcsrc/common/triggers/func/breakable.qc @@ -266,8 +266,8 @@ void func_breakable_reset() } // 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; @@ -335,7 +335,7 @@ void spawnfunc_func_breakable() } // for use in maps with a "model" key set -void spawnfunc_misc_breakablemodel() { - spawnfunc_func_breakable(); +spawnfunc(misc_breakablemodel) { + spawnfunc_func_breakable(this); } #endif diff --git a/qcsrc/common/triggers/func/breakable.qh b/qcsrc/common/triggers/func/breakable.qh index b641d9446..75cfb94c6 100644 --- a/qcsrc/common/triggers/func/breakable.qh +++ b/qcsrc/common/triggers/func/breakable.qh @@ -2,7 +2,7 @@ #define TRIGGERS_FUNC_BREAKABLE_H #ifdef SVQC -void spawnfunc_func_breakable(); +spawnfunc(func_breakable); #endif #endif diff --git a/qcsrc/common/triggers/func/button.qc b/qcsrc/common/triggers/func/button.qc index 228b3f810..17a30cfd0 100644 --- a/qcsrc/common/triggers/func/button.qc +++ b/qcsrc/common/triggers/func/button.qc @@ -112,8 +112,8 @@ When a button is touched, it moves some distance in the direction of it's angle, 2) metallic click 3) in-out */ -void spawnfunc_func_button() -{SELFPARAM(); +spawnfunc(func_button) +{ SetMovedir (); if (!InitMovingBrushTrigger()) diff --git a/qcsrc/common/triggers/func/conveyor.qc b/qcsrc/common/triggers/func/conveyor.qc index 4f5a7d6ea..32c12299e 100644 --- a/qcsrc/common/triggers/func/conveyor.qc +++ b/qcsrc/common/triggers/func/conveyor.qc @@ -129,15 +129,15 @@ void conveyor_init() 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; diff --git a/qcsrc/common/triggers/func/door.qc b/qcsrc/common/triggers/func/door.qc index 8d19a740c..7abbe0880 100644 --- a/qcsrc/common/triggers/func/door.qc +++ b/qcsrc/common/triggers/func/door.qc @@ -723,8 +723,8 @@ void door_reset() #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); diff --git a/qcsrc/common/triggers/func/door_rotating.qc b/qcsrc/common/triggers/func/door_rotating.qc index fbe579c13..e01a7e73e 100644 --- a/qcsrc/common/triggers/func/door_rotating.qc +++ b/qcsrc/common/triggers/func/door_rotating.qc @@ -44,8 +44,8 @@ void door_rotating_init_startopen() } -void spawnfunc_func_door_rotating() -{SELFPARAM(); +spawnfunc(func_door_rotating) +{ //if (!self.deathtype) // map makers can override this // self.deathtype = " got in the way"; diff --git a/qcsrc/common/triggers/func/door_secret.qc b/qcsrc/common/triggers/func/door_secret.qc index b79322878..10536fd94 100644 --- a/qcsrc/common/triggers/func/door_secret.qc +++ b/qcsrc/common/triggers/func/door_secret.qc @@ -194,8 +194,8 @@ If a secret door has a targetname, it will only be opened by it's botton or trig 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";*/ diff --git a/qcsrc/common/triggers/func/fourier.qc b/qcsrc/common/triggers/func/fourier.qc index 552fffe5a..2b3d07f6e 100644 --- a/qcsrc/common/triggers/func/fourier.qc +++ b/qcsrc/common/triggers/func/fourier.qc @@ -39,8 +39,8 @@ void func_fourier_controller_think() self.owner.velocity = (v - self.owner.origin) * 10; } -void spawnfunc_func_fourier() -{SELFPARAM(); +spawnfunc(func_fourier) +{ entity controller; if (self.noise != "") { diff --git a/qcsrc/common/triggers/func/ladder.qc b/qcsrc/common/triggers/func/ladder.qc index fc3d47210..3785299e2 100644 --- a/qcsrc/common/triggers/func/ladder.qc +++ b/qcsrc/common/triggers/func/ladder.qc @@ -39,8 +39,8 @@ void func_ladder_link() //self.model = "null"; } -void spawnfunc_func_ladder() -{SELFPARAM(); +spawnfunc(func_ladder) +{ self.mdl = self.model; EXACTTRIGGER_INIT; self.touch = func_ladder_touch; @@ -48,8 +48,8 @@ void spawnfunc_func_ladder() func_ladder_link(); } -void spawnfunc_func_water() -{SELFPARAM(); +spawnfunc(func_water) +{ self.mdl = self.model; EXACTTRIGGER_INIT; self.touch = func_ladder_touch; diff --git a/qcsrc/common/triggers/func/pendulum.qc b/qcsrc/common/triggers/func/pendulum.qc index b23541e03..d8bab869e 100644 --- a/qcsrc/common/triggers/func/pendulum.qc +++ b/qcsrc/common/triggers/func/pendulum.qc @@ -21,8 +21,8 @@ void func_pendulum_controller_think() } } -void spawnfunc_func_pendulum() -{SELFPARAM(); +spawnfunc(func_pendulum) +{ entity controller; if (self.noise != "") { diff --git a/qcsrc/common/triggers/func/plat.qc b/qcsrc/common/triggers/func/plat.qc index f2c57be21..de4c53cb5 100644 --- a/qcsrc/common/triggers/func/plat.qc +++ b/qcsrc/common/triggers/func/plat.qc @@ -59,8 +59,8 @@ void plat_link() //Net_LinkEntity(self, 0, false, plat_send); } -void spawnfunc_func_plat() -{SELFPARAM(); +spawnfunc(func_plat) +{ if (self.sounds == 0) self.sounds = 2; diff --git a/qcsrc/common/triggers/func/pointparticles.qc b/qcsrc/common/triggers/func/pointparticles.qc index 3c11b2a5b..25764f387 100644 --- a/qcsrc/common/triggers/func/pointparticles.qc +++ b/qcsrc/common/triggers/func/pointparticles.qc @@ -112,8 +112,8 @@ void pointparticles_reset() self.state = 0; } -void spawnfunc_func_pointparticles() -{SELFPARAM(); +spawnfunc(func_pointparticles) +{ if(self.model != "") _setmodel(self, self.model); if(self.noise != "") @@ -157,8 +157,8 @@ void spawnfunc_func_pointparticles() 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 @@ -179,7 +179,7 @@ void spawnfunc_func_sparks() self.wait = 0; self.cnt = 0; // use mdl - spawnfunc_func_pointparticles(); + spawnfunc_func_pointparticles(this); } #elif defined(CSQC) diff --git a/qcsrc/common/triggers/func/rainsnow.qc b/qcsrc/common/triggers/func/rainsnow.qc index 8c00f9ce2..25085ae4a 100644 --- a/qcsrc/common/triggers/func/rainsnow.qc +++ b/qcsrc/common/triggers/func/rainsnow.qc @@ -26,8 +26,8 @@ Keys: "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) @@ -64,8 +64,8 @@ Keys: "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) diff --git a/qcsrc/common/triggers/func/rotating.qc b/qcsrc/common/triggers/func/rotating.qc index 2e3c7851a..be2c7ed9c 100644 --- a/qcsrc/common/triggers/func/rotating.qc +++ b/qcsrc/common/triggers/func/rotating.qc @@ -26,8 +26,8 @@ dmg : Do this mutch dmg every .dmgtime intervall when blocked dmgtime : See above. */ -void spawnfunc_func_rotating() -{SELFPARAM(); +spawnfunc(func_rotating) +{ if (self.noise != "") { precache_sound(self.noise); diff --git a/qcsrc/common/triggers/func/stardust.qc b/qcsrc/common/triggers/func/stardust.qc index 0c329cdb2..859cdf53d 100644 --- a/qcsrc/common/triggers/func/stardust.qc +++ b/qcsrc/common/triggers/func/stardust.qc @@ -1,6 +1,6 @@ #ifdef SVQC -void spawnfunc_func_stardust() -{SELFPARAM(); +spawnfunc(func_stardust) +{ self.effects = EF_STARDUST; CSQCMODEL_AUTOINIT(self); diff --git a/qcsrc/common/triggers/func/train.qc b/qcsrc/common/triggers/func/train.qc index 4149b538d..60c8730eb 100644 --- a/qcsrc/common/triggers/func/train.qc +++ b/qcsrc/common/triggers/func/train.qc @@ -183,8 +183,8 @@ speed : speed the train moves (can be overridden by each spawnfunc_path_corner) 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); diff --git a/qcsrc/common/triggers/func/vectormamamam.qc b/qcsrc/common/triggers/func/vectormamamam.qc index 32355004b..57d3a0636 100644 --- a/qcsrc/common/triggers/func/vectormamamam.qc +++ b/qcsrc/common/triggers/func/vectormamamam.qc @@ -98,8 +98,8 @@ void func_vectormamamam_findtarget() controller.think = func_vectormamamam_controller_think; } -void spawnfunc_func_vectormamamam() -{SELFPARAM(); +spawnfunc(func_vectormamamam) +{ if (self.noise != "") { precache_sound(self.noise); diff --git a/qcsrc/common/triggers/misc/corner.qc b/qcsrc/common/triggers/misc/corner.qc index 390fd2c79..ccac77b6c 100644 --- a/qcsrc/common/triggers/misc/corner.qc +++ b/qcsrc/common/triggers/misc/corner.qc @@ -26,8 +26,8 @@ void corner_link() //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); diff --git a/qcsrc/common/triggers/misc/follow.qc b/qcsrc/common/triggers/misc/follow.qc index 02c9dcc27..842248a4b 100644 --- a/qcsrc/common/triggers/misc/follow.qc +++ b/qcsrc/common/triggers/misc/follow.qc @@ -62,8 +62,8 @@ void follow_init() } } -void spawnfunc_misc_follow() -{SELFPARAM(); +spawnfunc(misc_follow) +{ InitializeEntity(self, follow_init, INITPRIO_FINDTARGET); } #endif diff --git a/qcsrc/common/triggers/misc/laser.qc b/qcsrc/common/triggers/misc/laser.qc index 52d2caf65..ec4a9e277 100644 --- a/qcsrc/common/triggers/misc/laser.qc +++ b/qcsrc/common/triggers/misc/laser.qc @@ -203,8 +203,8 @@ void laser_reset() self.state = 0; } -void spawnfunc_misc_laser() -{SELFPARAM(); +spawnfunc(misc_laser) +{ if(self.mdl) { if(self.mdl == "none") diff --git a/qcsrc/common/triggers/misc/teleport_dest.qc b/qcsrc/common/triggers/misc/teleport_dest.qc index a3c978353..00752cfa5 100644 --- a/qcsrc/common/triggers/misc/teleport_dest.qc +++ b/qcsrc/common/triggers/misc/teleport_dest.qc @@ -1,7 +1,7 @@ #ifdef SVQC -void spawnfunc_info_teleport_destination (void) -{SELFPARAM(); +spawnfunc(info_teleport_destination) +{ self.classname = "info_teleport_destination"; self.mangle = self.angles; @@ -17,14 +17,14 @@ void spawnfunc_info_teleport_destination (void) 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 diff --git a/qcsrc/common/triggers/target/changelevel.qc b/qcsrc/common/triggers/target/changelevel.qc index 8dc694e62..259acab9a 100644 --- a/qcsrc/common/triggers/target/changelevel.qc +++ b/qcsrc/common/triggers/target/changelevel.qc @@ -3,8 +3,8 @@ .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 @@ -35,9 +35,11 @@ void spawnfunc_target_changelevel_use() 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; } } diff --git a/qcsrc/common/triggers/target/location.qc b/qcsrc/common/triggers/target/location.qc index 554032ee6..14512c794 100644 --- a/qcsrc/common/triggers/target/location.qc +++ b/qcsrc/common/triggers/target/location.qc @@ -1,13 +1,13 @@ #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; } diff --git a/qcsrc/common/triggers/target/music.qc b/qcsrc/common/triggers/target/music.qc index 33261eabd..2c5262885 100644 --- a/qcsrc/common/triggers/target/music.qc +++ b/qcsrc/common/triggers/target/music.qc @@ -46,8 +46,8 @@ void target_music_use() 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) @@ -125,8 +125,8 @@ void trigger_music_use() 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) diff --git a/qcsrc/common/triggers/target/spawn.qc b/qcsrc/common/triggers/target/spawn.qc index 591b971d5..554d38226 100644 --- a/qcsrc/common/triggers/target/spawn.qc +++ b/qcsrc/common/triggers/target/spawn.qc @@ -332,8 +332,8 @@ void initialize_field_db() } } -void spawnfunc_target_spawn() -{SELFPARAM(); +spawnfunc(target_spawn) +{ initialize_field_db(); self.use = target_spawn_use; self.message = strzone(strreplace("'", "\"", self.message)); diff --git a/qcsrc/common/triggers/target/speaker.qc b/qcsrc/common/triggers/target/speaker.qc index e0701dc14..42cfe3200 100644 --- a/qcsrc/common/triggers/target/speaker.qc +++ b/qcsrc/common/triggers/target/speaker.qc @@ -75,8 +75,8 @@ void target_speaker_reset() } } -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) diff --git a/qcsrc/common/triggers/target/voicescript.qc b/qcsrc/common/triggers/target/voicescript.qc index 35d84da8d..1d1816a77 100644 --- a/qcsrc/common/triggers/target/voicescript.qc +++ b/qcsrc/common/triggers/target/voicescript.qc @@ -73,8 +73,8 @@ void target_voicescript_next(entity pl) } } -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 diff --git a/qcsrc/common/triggers/trigger/counter.qc b/qcsrc/common/triggers/trigger/counter.qc index 9eb7eb072..41f9f79ec 100644 --- a/qcsrc/common/triggers/trigger/counter.qc +++ b/qcsrc/common/triggers/trigger/counter.qc @@ -36,8 +36,8 @@ If nomessage is not set, t will print "1 more.. " etc when triggered and "sequen 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; diff --git a/qcsrc/common/triggers/trigger/delay.qc b/qcsrc/common/triggers/trigger/delay.qc index a3e08e4d8..eb0c0af77 100644 --- a/qcsrc/common/triggers/trigger/delay.qc +++ b/qcsrc/common/triggers/trigger/delay.qc @@ -11,8 +11,8 @@ void delay_reset() self.nextthink = 0; } -void spawnfunc_trigger_delay() -{SELFPARAM(); +spawnfunc(trigger_delay) +{ if(!self.wait) self.wait = 1; diff --git a/qcsrc/common/triggers/trigger/disablerelay.qc b/qcsrc/common/triggers/trigger/disablerelay.qc index 4545df195..a1f13d277 100644 --- a/qcsrc/common/triggers/trigger/disablerelay.qc +++ b/qcsrc/common/triggers/trigger/disablerelay.qc @@ -24,8 +24,8 @@ void trigger_disablerelay_use() 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 diff --git a/qcsrc/common/triggers/trigger/flipflop.qc b/qcsrc/common/triggers/trigger/flipflop.qc index b5a2eb8b2..e039173fb 100644 --- a/qcsrc/common/triggers/trigger/flipflop.qc +++ b/qcsrc/common/triggers/trigger/flipflop.qc @@ -9,11 +9,14 @@ void flipflop_use() 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 diff --git a/qcsrc/common/triggers/trigger/gamestart.qc b/qcsrc/common/triggers/trigger/gamestart.qc index 1b72780e5..30e6ebae7 100644 --- a/qcsrc/common/triggers/trigger/gamestart.qc +++ b/qcsrc/common/triggers/trigger/gamestart.qc @@ -6,10 +6,11 @@ void gamestart_use() 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) { @@ -19,4 +20,6 @@ void spawnfunc_trigger_gamestart() else InitializeEntity(self, gamestart_use, INITPRIO_FINDTARGET); } +void _spawnfunc_trigger_gamestart() { SELFPARAM(); spawnfunc_trigger_gamestart(this); } + #endif diff --git a/qcsrc/common/triggers/trigger/gravity.qc b/qcsrc/common/triggers/trigger/gravity.qc index 659a33690..7ce15c2e2 100644 --- a/qcsrc/common/triggers/trigger/gravity.qc +++ b/qcsrc/common/triggers/trigger/gravity.qc @@ -85,8 +85,8 @@ void trigger_gravity_touch() } } -void spawnfunc_trigger_gravity() -{SELFPARAM(); +spawnfunc(trigger_gravity) +{ if(self.gravity == 1) return; diff --git a/qcsrc/common/triggers/trigger/heal.qc b/qcsrc/common/triggers/trigger/heal.qc index 323a4a160..af307a299 100644 --- a/qcsrc/common/triggers/trigger/heal.qc +++ b/qcsrc/common/triggers/trigger/heal.qc @@ -25,8 +25,8 @@ void trigger_heal_touch() } } -void spawnfunc_trigger_heal() -{SELFPARAM(); +spawnfunc(trigger_heal) +{ self.active = ACTIVE_ACTIVE; EXACTTRIGGER_INIT; diff --git a/qcsrc/common/triggers/trigger/hurt.qc b/qcsrc/common/triggers/trigger/hurt.qc index 7a1201193..535ba8500 100644 --- a/qcsrc/common/triggers/trigger/hurt.qc +++ b/qcsrc/common/triggers/trigger/hurt.qc @@ -57,8 +57,8 @@ defalt dmg = 5 .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; diff --git a/qcsrc/common/triggers/trigger/impulse.qc b/qcsrc/common/triggers/trigger/impulse.qc index 2b3bb5729..c40fed3a8 100644 --- a/qcsrc/common/triggers/trigger/impulse.qc +++ b/qcsrc/common/triggers/trigger/impulse.qc @@ -150,8 +150,8 @@ void trigger_impulse_link() //Net_LinkEntity(self, 0, false, trigger_impulse_send); } -void spawnfunc_trigger_impulse() -{SELFPARAM(); +spawnfunc(trigger_impulse) +{ self.active = ACTIVE_ACTIVE; EXACTTRIGGER_INIT; diff --git a/qcsrc/common/triggers/trigger/jumppads.qc b/qcsrc/common/triggers/trigger/jumppads.qc index 5eb252218..dfdcd7b3a 100644 --- a/qcsrc/common/triggers/trigger/jumppads.qc +++ b/qcsrc/common/triggers/trigger/jumppads.qc @@ -363,8 +363,8 @@ void trigger_push_link() * 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; @@ -406,9 +406,9 @@ void target_push_link() 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 diff --git a/qcsrc/common/triggers/trigger/jumppads.qh b/qcsrc/common/triggers/trigger/jumppads.qh index bb0f4750e..efce0df62 100644 --- a/qcsrc/common/triggers/trigger/jumppads.qh +++ b/qcsrc/common/triggers/trigger/jumppads.qh @@ -59,10 +59,10 @@ void trigger_push_findtarget(); * 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 diff --git a/qcsrc/common/triggers/trigger/keylock.qc b/qcsrc/common/triggers/trigger/keylock.qc index 17313f0aa..7ee777385 100644 --- a/qcsrc/common/triggers/trigger/keylock.qc +++ b/qcsrc/common/triggers/trigger/keylock.qc @@ -132,8 +132,8 @@ wait: prevent triggering again for this amount of time (default: 5) - applies to 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 diff --git a/qcsrc/common/triggers/trigger/magicear.qc b/qcsrc/common/triggers/trigger/magicear.qc index 0c8a7d359..c20514e1a 100644 --- a/qcsrc/common/triggers/trigger/magicear.qc +++ b/qcsrc/common/triggers/trigger/magicear.qc @@ -162,8 +162,8 @@ string trigger_magicear_processmessage_forallears(entity source, float teamsay, return msgin; } -void spawnfunc_trigger_magicear() -{SELFPARAM(); +spawnfunc(trigger_magicear) +{ self.enemy = magicears; magicears = self; diff --git a/qcsrc/common/triggers/trigger/monoflop.qc b/qcsrc/common/triggers/trigger/monoflop.qc index 5129ce35c..d81f6e371 100644 --- a/qcsrc/common/triggers/trigger/monoflop.qc +++ b/qcsrc/common/triggers/trigger/monoflop.qc @@ -34,8 +34,8 @@ void monoflop_reset() self.nextthink = 0; } -void spawnfunc_trigger_monoflop() -{SELFPARAM(); +spawnfunc(trigger_monoflop) +{ if(!self.wait) self.wait = 1; if(self.spawnflags & 1) diff --git a/qcsrc/common/triggers/trigger/multi.qc b/qcsrc/common/triggers/trigger/multi.qc index 007e6da2f..ca26d214a 100644 --- a/qcsrc/common/triggers/trigger/multi.qc +++ b/qcsrc/common/triggers/trigger/multi.qc @@ -139,8 +139,8 @@ sounds 4) set "message" to text string */ -void spawnfunc_trigger_multiple() -{SELFPARAM(); +spawnfunc(trigger_multiple) +{ self.reset = multi_reset; if (self.sounds == 1) { @@ -202,9 +202,9 @@ sounds 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 diff --git a/qcsrc/common/triggers/trigger/multi.qh b/qcsrc/common/triggers/trigger/multi.qh index df14a518e..5e72a96a2 100644 --- a/qcsrc/common/triggers/trigger/multi.qh +++ b/qcsrc/common/triggers/trigger/multi.qh @@ -2,5 +2,5 @@ void multi_trigger(); void multi_reset(); -void spawnfunc_trigger_once(); +spawnfunc(trigger_once); #endif diff --git a/qcsrc/common/triggers/trigger/multivibrator.qc b/qcsrc/common/triggers/trigger/multivibrator.qc index d9c6c2e60..78b3383fc 100644 --- a/qcsrc/common/triggers/trigger/multivibrator.qc +++ b/qcsrc/common/triggers/trigger/multivibrator.qc @@ -55,8 +55,8 @@ respawntime: "off" cycle time (default: same as wait) -------- 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) diff --git a/qcsrc/common/triggers/trigger/relay.qc b/qcsrc/common/triggers/trigger/relay.qc index 20962cd49..178daad90 100644 --- a/qcsrc/common/triggers/trigger/relay.qc +++ b/qcsrc/common/triggers/trigger/relay.qc @@ -1,10 +1,12 @@ #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 diff --git a/qcsrc/common/triggers/trigger/relay_activators.qc b/qcsrc/common/triggers/trigger/relay_activators.qc index b765151fd..147b6178a 100644 --- a/qcsrc/common/triggers/trigger/relay_activators.qc +++ b/qcsrc/common/triggers/trigger/relay_activators.qc @@ -21,20 +21,20 @@ void relay_activators_use() 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; } diff --git a/qcsrc/common/triggers/trigger/relay_if.qc b/qcsrc/common/triggers/trigger/relay_if.qc index cadd95e58..e45996bd8 100644 --- a/qcsrc/common/triggers/trigger/relay_if.qc +++ b/qcsrc/common/triggers/trigger/relay_if.qc @@ -13,8 +13,8 @@ void trigger_relay_if_use() SUB_UseTargets(); } -void spawnfunc_trigger_relay_if() -{SELFPARAM(); +spawnfunc(trigger_relay_if) +{ self.use = trigger_relay_if_use; } #endif diff --git a/qcsrc/common/triggers/trigger/relay_teamcheck.qc b/qcsrc/common/triggers/trigger/relay_teamcheck.qc index f93287a92..ab2b87aaa 100644 --- a/qcsrc/common/triggers/trigger/relay_teamcheck.qc +++ b/qcsrc/common/triggers/trigger/relay_teamcheck.qc @@ -26,8 +26,8 @@ void trigger_relay_teamcheck_reset() 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; diff --git a/qcsrc/common/triggers/trigger/secret.qc b/qcsrc/common/triggers/trigger/secret.qc index 27347d9e8..d16d2773c 100644 --- a/qcsrc/common/triggers/trigger/secret.qc +++ b/qcsrc/common/triggers/trigger/secret.qc @@ -51,8 +51,8 @@ killtarget: remove all entities with this targetname when triggered 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 @@ -78,7 +78,7 @@ void spawnfunc_trigger_secret() // 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; diff --git a/qcsrc/common/triggers/trigger/swamp.qc b/qcsrc/common/triggers/trigger/swamp.qc index b9a4acd1a..2ae068d82 100644 --- a/qcsrc/common/triggers/trigger/swamp.qc +++ b/qcsrc/common/triggers/trigger/swamp.qc @@ -21,7 +21,7 @@ .entity swampslug; #ifdef SVQC -void spawnfunc_trigger_swamp(void); +spawnfunc(trigger_swamp); #endif void swamp_touch(void); void swampslug_think(); @@ -116,8 +116,8 @@ void swamp_link() 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; diff --git a/qcsrc/common/triggers/trigger/teleport.qc b/qcsrc/common/triggers/trigger/teleport.qc index 129f4e387..95bd7fbbd 100644 --- a/qcsrc/common/triggers/trigger/teleport.qc +++ b/qcsrc/common/triggers/trigger/teleport.qc @@ -47,8 +47,8 @@ void Teleport_Touch (void) WITH(entity, self, e, SUB_UseTargets()); } -void spawnfunc_trigger_teleport() -{SELFPARAM(); +spawnfunc(trigger_teleport) +{ self.angles = '0 0 0'; EXACTTRIGGER_INIT; diff --git a/qcsrc/common/triggers/trigger/viewloc.qc b/qcsrc/common/triggers/trigger/viewloc.qc index de2d3aac2..73d722cf0 100644 --- a/qcsrc/common/triggers/trigger/viewloc.qc +++ b/qcsrc/common/triggers/trigger/viewloc.qc @@ -80,8 +80,8 @@ void viewloc_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; } @@ -114,21 +114,21 @@ void viewloc_link() 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) diff --git a/qcsrc/common/turrets/checkpoint.qc b/qcsrc/common/turrets/checkpoint.qc index 2b0bd6f67..bb2bff22c 100644 --- a/qcsrc/common/turrets/checkpoint.qc +++ b/qcsrc/common/turrets/checkpoint.qc @@ -67,16 +67,16 @@ void turret_checkpoint_init() //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); } diff --git a/qcsrc/common/turrets/targettrigger.qc b/qcsrc/common/turrets/targettrigger.qc index 98c23c458..625746341 100644 --- a/qcsrc/common/turrets/targettrigger.qc +++ b/qcsrc/common/turrets/targettrigger.qc @@ -1,4 +1,4 @@ -void spawnfunc_turret_targettrigger(); +spawnfunc(turret_targettrigger); void turret_targettrigger_touch(); void turret_targettrigger_touch() @@ -27,8 +27,8 @@ 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 (); diff --git a/qcsrc/common/turrets/unit/ewheel.qc b/qcsrc/common/turrets/unit/ewheel.qc index e61897cdd..d4e632c4c 100644 --- a/qcsrc/common/turrets/unit/ewheel.qc +++ b/qcsrc/common/turrets/unit/ewheel.qc @@ -121,7 +121,7 @@ void ewheel_move_idle() 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(); diff --git a/qcsrc/common/turrets/unit/flac.qc b/qcsrc/common/turrets/unit/flac.qc index 228049f41..b819ae950 100644 --- a/qcsrc/common/turrets/unit/flac.qc +++ b/qcsrc/common/turrets/unit/flac.qc @@ -28,7 +28,7 @@ void turret_flac_projectile_think_explode() 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(); diff --git a/qcsrc/common/turrets/unit/fusionreactor.qc b/qcsrc/common/turrets/unit/fusionreactor.qc index 3ba1ff074..c1e2f5d45 100644 --- a/qcsrc/common/turrets/unit/fusionreactor.qc +++ b/qcsrc/common/turrets/unit/fusionreactor.qc @@ -40,7 +40,7 @@ bool turret_fusionreactor_firecheck() 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(); diff --git a/qcsrc/common/turrets/unit/hellion.qc b/qcsrc/common/turrets/unit/hellion.qc index f785f4e95..1b798bbaa 100644 --- a/qcsrc/common/turrets/unit/hellion.qc +++ b/qcsrc/common/turrets/unit/hellion.qc @@ -76,7 +76,7 @@ void turret_hellion_missile_think() 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(); diff --git a/qcsrc/common/turrets/unit/hk.qc b/qcsrc/common/turrets/unit/hk.qc index f01275187..4dcbe9592 100644 --- a/qcsrc/common/turrets/unit/hk.qc +++ b/qcsrc/common/turrets/unit/hk.qc @@ -273,7 +273,7 @@ float turret_hk_addtarget(entity e_target,entity e_sender) 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(); diff --git a/qcsrc/common/turrets/unit/machinegun.qc b/qcsrc/common/turrets/unit/machinegun.qc index afecb7fa5..bde4f560b 100644 --- a/qcsrc/common/turrets/unit/machinegun.qc +++ b/qcsrc/common/turrets/unit/machinegun.qc @@ -11,7 +11,7 @@ REGISTER_TURRET( ); #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); diff --git a/qcsrc/common/turrets/unit/mlrs.qc b/qcsrc/common/turrets/unit/mlrs.qc index 1a3c9220b..9ae666307 100644 --- a/qcsrc/common/turrets/unit/mlrs.qc +++ b/qcsrc/common/turrets/unit/mlrs.qc @@ -11,7 +11,7 @@ REGISTER_TURRET( ); #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(); diff --git a/qcsrc/common/turrets/unit/phaser.qc b/qcsrc/common/turrets/unit/phaser.qc index e1ddef3a9..ca947623e 100644 --- a/qcsrc/common/turrets/unit/phaser.qc +++ b/qcsrc/common/turrets/unit/phaser.qc @@ -57,7 +57,7 @@ void beam_think() } -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(); diff --git a/qcsrc/common/turrets/unit/plasma.qc b/qcsrc/common/turrets/unit/plasma.qc index df986d79e..36966a1ae 100644 --- a/qcsrc/common/turrets/unit/plasma.qc +++ b/qcsrc/common/turrets/unit/plasma.qc @@ -11,7 +11,7 @@ REGISTER_TURRET( ); #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(); diff --git a/qcsrc/common/turrets/unit/plasma_dual.qc b/qcsrc/common/turrets/unit/plasma_dual.qc index f3bd32448..6469c0591 100644 --- a/qcsrc/common/turrets/unit/plasma_dual.qc +++ b/qcsrc/common/turrets/unit/plasma_dual.qc @@ -11,7 +11,7 @@ REGISTER_TURRET( ); #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(); diff --git a/qcsrc/common/turrets/unit/tesla.qc b/qcsrc/common/turrets/unit/tesla.qc index 50e37182c..76f8083a9 100644 --- a/qcsrc/common/turrets/unit/tesla.qc +++ b/qcsrc/common/turrets/unit/tesla.qc @@ -89,7 +89,7 @@ float turret_tesla_firecheck() 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(); diff --git a/qcsrc/common/turrets/unit/walker.qc b/qcsrc/common/turrets/unit/walker.qc index 9e7b0cbe1..ceacde8c2 100644 --- a/qcsrc/common/turrets/unit/walker.qc +++ b/qcsrc/common/turrets/unit/walker.qc @@ -334,7 +334,7 @@ void walker_move_path() #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(); diff --git a/qcsrc/common/vehicles/unit/bumblebee.qc b/qcsrc/common/vehicles/unit/bumblebee.qc index 96fef6c05..fb06eabf5 100644 --- a/qcsrc/common/vehicles/unit/bumblebee.qc +++ b/qcsrc/common/vehicles/unit/bumblebee.qc @@ -768,8 +768,8 @@ float bumble_raygun_send(entity to, float sf) 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; } } diff --git a/qcsrc/common/vehicles/unit/racer.qc b/qcsrc/common/vehicles/unit/racer.qc index 62a6e850f..1422ab83a 100644 --- a/qcsrc/common/vehicles/unit/racer.qc +++ b/qcsrc/common/vehicles/unit/racer.qc @@ -667,8 +667,8 @@ void racer_deadtouch() 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; } } diff --git a/qcsrc/common/vehicles/unit/raptor.qc b/qcsrc/common/vehicles/unit/raptor.qc index 96a84892c..0108a3e70 100644 --- a/qcsrc/common/vehicles/unit/raptor.qc +++ b/qcsrc/common/vehicles/unit/raptor.qc @@ -789,8 +789,8 @@ float raptor_impulse(float _imp) 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; } } diff --git a/qcsrc/common/vehicles/unit/spiderbot.qc b/qcsrc/common/vehicles/unit/spiderbot.qc index 7d03c7736..d2d99e1e6 100644 --- a/qcsrc/common/vehicles/unit/spiderbot.qc +++ b/qcsrc/common/vehicles/unit/spiderbot.qc @@ -811,8 +811,8 @@ bool spiderbot_impulse(int _imp) 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; } } diff --git a/qcsrc/common/weapons/weapon/arc.qc b/qcsrc/common/weapons/weapon/arc.qc index a6a073099..cf117c823 100644 --- a/qcsrc/common/weapons/weapon/arc.qc +++ b/qcsrc/common/weapons/weapon/arc.qc @@ -126,7 +126,7 @@ vector Draw_ArcBeam_callback_last_bottom; // NOTE: in same coordinate system as #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(); diff --git a/qcsrc/common/weapons/weapon/blaster.qc b/qcsrc/common/weapons/weapon/blaster.qc index b20713c02..e91f424c1 100644 --- a/qcsrc/common/weapons/weapon/blaster.qc +++ b/qcsrc/common/weapons/weapon/blaster.qc @@ -48,8 +48,8 @@ BLASTER_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP) #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(); diff --git a/qcsrc/common/weapons/weapon/crylink.qc b/qcsrc/common/weapons/weapon/crylink.qc index 6821d5a0e..3801b0b53 100644 --- a/qcsrc/common/weapons/weapon/crylink.qc +++ b/qcsrc/common/weapons/weapon/crylink.qc @@ -64,7 +64,7 @@ CRYLINK_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP) #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) { diff --git a/qcsrc/common/weapons/weapon/devastator.qc b/qcsrc/common/weapons/weapon/devastator.qc index cb2d16659..149dbe4dd 100644 --- a/qcsrc/common/weapons/weapon/devastator.qc +++ b/qcsrc/common/weapons/weapon/devastator.qc @@ -62,8 +62,8 @@ DEVASTATOR_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP) #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(); diff --git a/qcsrc/common/weapons/weapon/electro.qc b/qcsrc/common/weapons/weapon/electro.qc index 7f02a00ce..6ff7229d4 100644 --- a/qcsrc/common/weapons/weapon/electro.qc +++ b/qcsrc/common/weapons/weapon/electro.qc @@ -67,7 +67,7 @@ void W_Electro_ExplodeCombo(void); #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) { diff --git a/qcsrc/common/weapons/weapon/fireball.qc b/qcsrc/common/weapons/weapon/fireball.qc index a37ae8f09..f2c8c64ac 100644 --- a/qcsrc/common/weapons/weapon/fireball.qc +++ b/qcsrc/common/weapons/weapon/fireball.qc @@ -55,7 +55,7 @@ FIREBALL_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP) #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(); diff --git a/qcsrc/common/weapons/weapon/hagar.qc b/qcsrc/common/weapons/weapon/hagar.qc index d55a1b607..29ec6b78d 100644 --- a/qcsrc/common/weapons/weapon/hagar.qc +++ b/qcsrc/common/weapons/weapon/hagar.qc @@ -56,7 +56,7 @@ HAGAR_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP) #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! diff --git a/qcsrc/common/weapons/weapon/hlac.qc b/qcsrc/common/weapons/weapon/hlac.qc index 074b76053..034a2502d 100644 --- a/qcsrc/common/weapons/weapon/hlac.qc +++ b/qcsrc/common/weapons/weapon/hlac.qc @@ -48,7 +48,7 @@ HLAC_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP) #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(); diff --git a/qcsrc/common/weapons/weapon/hmg.qc b/qcsrc/common/weapons/weapon/hmg.qc index c55304118..18e07204a 100644 --- a/qcsrc/common/weapons/weapon/hmg.qc +++ b/qcsrc/common/weapons/weapon/hmg.qc @@ -41,7 +41,7 @@ HMG_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP) #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(); diff --git a/qcsrc/common/weapons/weapon/hook.qc b/qcsrc/common/weapons/weapon/hook.qc index b7f51b54c..3828bdb1e 100644 --- a/qcsrc/common/weapons/weapon/hook.qc +++ b/qcsrc/common/weapons/weapon/hook.qc @@ -59,8 +59,8 @@ HOOK_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP) #ifdef IMPLEMENTATION #ifdef SVQC -void spawnfunc_weapon_hook(void) -{SELFPARAM(); +spawnfunc(weapon_hook) +{ if(g_grappling_hook) // offhand hook { startitem_failed = true; diff --git a/qcsrc/common/weapons/weapon/machinegun.qc b/qcsrc/common/weapons/weapon/machinegun.qc index 01efced0f..61f9210d9 100644 --- a/qcsrc/common/weapons/weapon/machinegun.qc +++ b/qcsrc/common/weapons/weapon/machinegun.qc @@ -55,8 +55,8 @@ MACHINEGUN_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP) #ifdef IMPLEMENTATION #ifdef SVQC -void spawnfunc_weapon_machinegun(void) -{SELFPARAM(); +spawnfunc(weapon_machinegun) +{ if(autocvar_sv_q3acompat_machineshotgunswap) if(self.classname != "droppedweapon") { @@ -65,7 +65,7 @@ void spawnfunc_weapon_machinegun(void) } 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(); diff --git a/qcsrc/common/weapons/weapon/minelayer.qc b/qcsrc/common/weapons/weapon/minelayer.qc index 1c7e89fde..d1212d6a1 100644 --- a/qcsrc/common/weapons/weapon/minelayer.qc +++ b/qcsrc/common/weapons/weapon/minelayer.qc @@ -57,7 +57,7 @@ void W_MineLayer_Think(void); #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(); diff --git a/qcsrc/common/weapons/weapon/mortar.qc b/qcsrc/common/weapons/weapon/mortar.qc index d03eb8e56..b766b1c33 100644 --- a/qcsrc/common/weapons/weapon/mortar.qc +++ b/qcsrc/common/weapons/weapon/mortar.qc @@ -56,8 +56,8 @@ MORTAR_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP) #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(); diff --git a/qcsrc/common/weapons/weapon/porto.qc b/qcsrc/common/weapons/weapon/porto.qc index 58c28716a..4438c5d83 100644 --- a/qcsrc/common/weapons/weapon/porto.qc +++ b/qcsrc/common/weapons/weapon/porto.qc @@ -41,7 +41,7 @@ PORTO_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP) #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(); diff --git a/qcsrc/common/weapons/weapon/rifle.qc b/qcsrc/common/weapons/weapon/rifle.qc index 66be38175..69e325d8e 100644 --- a/qcsrc/common/weapons/weapon/rifle.qc +++ b/qcsrc/common/weapons/weapon/rifle.qc @@ -47,9 +47,9 @@ RIFLE_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP) #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(); diff --git a/qcsrc/common/weapons/weapon/rpc.qc b/qcsrc/common/weapons/weapon/rpc.qc index 51c040440..a8509c15e 100644 --- a/qcsrc/common/weapons/weapon/rpc.qc +++ b/qcsrc/common/weapons/weapon/rpc.qc @@ -45,7 +45,7 @@ RPC_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP) #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(); diff --git a/qcsrc/common/weapons/weapon/seeker.qc b/qcsrc/common/weapons/weapon/seeker.qc index 0687437af..d3d8ac3c7 100644 --- a/qcsrc/common/weapons/weapon/seeker.qc +++ b/qcsrc/common/weapons/weapon/seeker.qc @@ -84,7 +84,7 @@ SEEKER_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP) #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 diff --git a/qcsrc/common/weapons/weapon/shockwave.qc b/qcsrc/common/weapons/weapon/shockwave.qc index b56a41fbb..de8f34777 100644 --- a/qcsrc/common/weapons/weapon/shockwave.qc +++ b/qcsrc/common/weapons/weapon/shockwave.qc @@ -82,8 +82,8 @@ void Net_ReadShockwaveParticle(void); #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") diff --git a/qcsrc/common/weapons/weapon/shotgun.qc b/qcsrc/common/weapons/weapon/shotgun.qc index 814d57303..ce93321a9 100644 --- a/qcsrc/common/weapons/weapon/shotgun.qc +++ b/qcsrc/common/weapons/weapon/shotgun.qc @@ -52,7 +52,7 @@ SHOTGUN_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP) #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(); diff --git a/qcsrc/common/weapons/weapon/tuba.qc b/qcsrc/common/weapons/weapon/tuba.qc index 20100bf39..6d1cf3a6f 100644 --- a/qcsrc/common/weapons/weapon/tuba.qc +++ b/qcsrc/common/weapons/weapon/tuba.qc @@ -54,7 +54,7 @@ float W_Tuba_MarkClientOnlyFieldsAsUsed() { #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) { diff --git a/qcsrc/common/weapons/weapon/vaporizer.qc b/qcsrc/common/weapons/weapon/vaporizer.qc index 13c3fef8c..edc7079d9 100644 --- a/qcsrc/common/weapons/weapon/vaporizer.qc +++ b/qcsrc/common/weapons/weapon/vaporizer.qc @@ -55,8 +55,8 @@ VAPORIZER_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP) #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(); diff --git a/qcsrc/common/weapons/weapon/vortex.qc b/qcsrc/common/weapons/weapon/vortex.qc index 2e515137c..5e7cc479c 100644 --- a/qcsrc/common/weapons/weapon/vortex.qc +++ b/qcsrc/common/weapons/weapon/vortex.qc @@ -59,8 +59,8 @@ VORTEX_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP) #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; @@ -129,7 +129,7 @@ void W_Vortex_Attack(float issecondary) 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) diff --git a/qcsrc/lib/_all.inc b/qcsrc/lib/_all.inc index aa541bd69..2b15e8acb 100644 --- a/qcsrc/lib/_all.inc +++ b/qcsrc/lib/_all.inc @@ -20,6 +20,7 @@ #include "progname.qh" #include "registry.qh" #include "sortlist.qc" +#include "spawnfunc.qh" #include "static.qh" #include "string.qh" #include "struct.qh" diff --git a/qcsrc/lib/log.qh b/qcsrc/lib/log.qh index f74dd4aa2..3d186e389 100644 --- a/qcsrc/lib/log.qh +++ b/qcsrc/lib/log.qh @@ -59,4 +59,6 @@ noref bool autocvar_prvm_backtraceforwarnings; cvar_set("prvm_backtraceforwarnings", ftos(war)); \ } while (0) +#define ASSERT(expr) do { if (!(expr)) LOG_FATAL("assertion failed: " #expr "\n"); } while (0) + #endif diff --git a/qcsrc/lib/spawnfunc.qh b/qcsrc/lib/spawnfunc.qh new file mode 100644 index 000000000..e443552ec --- /dev/null +++ b/qcsrc/lib/spawnfunc.qh @@ -0,0 +1,153 @@ +#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 diff --git a/qcsrc/server-testcase/framework.qc b/qcsrc/server-testcase/framework.qc index f874b616b..1ec7115ef 100644 --- a/qcsrc/server-testcase/framework.qc +++ b/qcsrc/server-testcase/framework.qc @@ -4,7 +4,7 @@ string vtos(vector v) = #27; void error(string e) = #10; float test(); -void spawnfunc_worldspawn() +spawnfunc(worldspawn) { float r; LOG_TRACE("TESTCASE: START\n"); diff --git a/qcsrc/server/bot/waypoints.qc b/qcsrc/server/bot/waypoints.qc index b34af78bb..8f50d0276 100644 --- a/qcsrc/server/bot/waypoints.qc +++ b/qcsrc/server/bot/waypoints.qc @@ -293,8 +293,8 @@ void waypoint_schedulerelink(entity wp) } // 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); diff --git a/qcsrc/server/bot/waypoints.qh b/qcsrc/server/bot/waypoints.qh index 87141c4bc..fde524bb9 100644 --- a/qcsrc/server/bot/waypoints.qh +++ b/qcsrc/server/bot/waypoints.qh @@ -38,7 +38,7 @@ float botframe_cachedwaypointlinks; * Functions */ -void spawnfunc_waypoint(); +spawnfunc(waypoint); void waypoint_addlink(entity from, entity to); void waypoint_think(); void waypoint_clearlinks(entity wp); diff --git a/qcsrc/server/cheats.qc b/qcsrc/server/cheats.qc index 26af000d2..0721d05fc 100644 --- a/qcsrc/server/cheats.qc +++ b/qcsrc/server/cheats.qc @@ -129,8 +129,8 @@ void info_autoscreenshot_findtarget() 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!"); @@ -372,7 +372,7 @@ float CheatCommand(float argc) 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) { diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index 5072e4900..82d6e7b6b 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -5,8 +5,6 @@ #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 diff --git a/qcsrc/server/g_lights.qc b/qcsrc/server/g_lights.qc index f7382d166..bd5232a1c 100644 --- a/qcsrc/server/g_lights.qc +++ b/qcsrc/server/g_lights.qc @@ -86,7 +86,7 @@ void dynlight_use() else self.light_lev = 0; } -void spawnfunc_dynlight() +spawnfunc(dynlight) { if (!self.light_lev) self.light_lev = 200; diff --git a/qcsrc/server/g_models.qc b/qcsrc/server/g_models.qc index 8bb2b1b6a..3a94d6f1a 100644 --- a/qcsrc/server/g_models.qc +++ b/qcsrc/server/g_models.qc @@ -177,15 +177,15 @@ float g_clientmodel_genericsendentity (entity to, int sf) 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) diff --git a/qcsrc/server/g_subs.qc b/qcsrc/server/g_subs.qc index 723087a96..585ac42e0 100644 --- a/qcsrc/server/g_subs.qc +++ b/qcsrc/server/g_subs.qc @@ -5,8 +5,8 @@ #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. } diff --git a/qcsrc/server/g_subs.qh b/qcsrc/server/g_subs.qh index d62bbb612..77f49ae5a 100644 --- a/qcsrc/server/g_subs.qh +++ b/qcsrc/server/g_subs.qh @@ -8,7 +8,7 @@ void() SUB_CalcAngleMoveDone; //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); diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index b5a2806d7..635b0d8e8 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -534,8 +534,8 @@ void RandomSeed_Spawn() 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 @@ -572,8 +572,8 @@ void ClientInit_Spawn(); void WeaponStats_Init(); void WeaponStats_Shutdown(); void Physics_AddStats(); -void spawnfunc_worldspawn (void) -{SELFPARAM(); +spawnfunc(worldspawn) +{ float fd, l, j, n; string s; @@ -920,8 +920,8 @@ void spawnfunc_worldspawn (void) world_initialized = 1; } -void spawnfunc_light (void) -{SELFPARAM(); +spawnfunc(light) +{ //makestatic (self); // Who the f___ did that? remove(self); } diff --git a/qcsrc/server/item_key.qc b/qcsrc/server/item_key.qc index 6a1527745..f25879c88 100644 --- a/qcsrc/server/item_key.qc +++ b/qcsrc/server/item_key.qc @@ -148,8 +148,8 @@ This is the only correct way to put keys on the map! itemkeys MUST always have exactly one bit set. */ -void spawnfunc_item_key() -{SELFPARAM(); +spawnfunc(item_key) +{ string _netname; vector _colormod; @@ -255,11 +255,11 @@ FLOATING: the item will float in air, instead of aligning to the floor by fallin ---------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 @@ -274,9 +274,9 @@ FLOATING: the item will float in air, instead of aligning to the floor by fallin ---------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); }; diff --git a/qcsrc/server/mutators/events.qh b/qcsrc/server/mutators/events.qh index 881938f06..1492b9f6a 100644 --- a/qcsrc/server/mutators/events.qh +++ b/qcsrc/server/mutators/events.qh @@ -257,7 +257,7 @@ MUTATOR_HOOKABLE(MonsterRespawn, EV_MonsterRespawn); /**/ i(entity, other) \ /**/ o(entity, other) \ /**/ -.void() monster_loot; +.void(entity this) monster_loot; MUTATOR_HOOKABLE(MonsterDropItem, EV_MonsterDropItem); /** diff --git a/qcsrc/server/mutators/gamemode_assault.qc b/qcsrc/server/mutators/gamemode_assault.qc index 844043222..1a10e3c6c 100644 --- a/qcsrc/server/mutators/gamemode_assault.qc +++ b/qcsrc/server/mutators/gamemode_assault.qc @@ -251,24 +251,24 @@ void assault_new_round() } // 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"; @@ -278,8 +278,8 @@ void spawnfunc_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"; @@ -296,8 +296,8 @@ void spawnfunc_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; @@ -308,11 +308,11 @@ void spawnfunc_func_assault_destructible() 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"; @@ -324,8 +324,8 @@ void spawnfunc_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 @@ -335,8 +335,8 @@ void spawnfunc_target_assault_roundend() 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; diff --git a/qcsrc/server/mutators/gamemode_ctf.qc b/qcsrc/server/mutators/gamemode_ctf.qc index 060752c11..db93a4321 100644 --- a/qcsrc/server/mutators/gamemode_ctf.qc +++ b/qcsrc/server/mutators/gamemode_ctf.qc @@ -2251,8 +2251,8 @@ Keys: "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); @@ -2269,8 +2269,8 @@ Keys: "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); @@ -2287,8 +2287,8 @@ Keys: "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); @@ -2305,8 +2305,8 @@ Keys: "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); @@ -2323,8 +2323,8 @@ Keys: "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; } @@ -2337,8 +2337,8 @@ Note: If you use spawnfunc_ctf_team entities you must define at least 2! Howeve 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"; @@ -2346,15 +2346,15 @@ void spawnfunc_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); } // ============== @@ -2378,15 +2378,12 @@ void ctf_ScoreRules(int teams) // 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. diff --git a/qcsrc/server/mutators/gamemode_domination.qc b/qcsrc/server/mutators/gamemode_domination.qc index 6fa778309..50d644836 100644 --- a/qcsrc/server/mutators/gamemode_domination.qc +++ b/qcsrc/server/mutators/gamemode_domination.qc @@ -447,8 +447,8 @@ MUTATOR_HOOKFUNCTION(dom_BotRoles) /*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); @@ -492,8 +492,8 @@ Keys: (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); @@ -567,14 +567,15 @@ void dom_spawnteam (string teamname, float teamcolor, string pointmodel, float p 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); } diff --git a/qcsrc/server/mutators/gamemode_invasion.qc b/qcsrc/server/mutators/gamemode_invasion.qc index 412e7bd54..5dbe12d22 100644 --- a/qcsrc/server/mutators/gamemode_invasion.qc +++ b/qcsrc/server/mutators/gamemode_invasion.qc @@ -6,8 +6,8 @@ #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"; diff --git a/qcsrc/server/mutators/gamemode_nexball.qc b/qcsrc/server/mutators/gamemode_nexball.qc index e3480a42e..0227f9687 100644 --- a/qcsrc/server/mutators/gamemode_nexball.qc +++ b/qcsrc/server/mutators/gamemode_nexball.qc @@ -408,8 +408,8 @@ void GoalTouch(void) //=======================// // team ents // //=======================// -void spawnfunc_nexball_team(void) -{SELFPARAM(); +spawnfunc(nexball_team) +{ if(!g_nexball) { remove(self); @@ -534,8 +534,8 @@ void SpawnBall(void) 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)) @@ -557,8 +557,8 @@ void spawnfunc_nexball_basketball(void) SpawnBall(); } -void spawnfunc_nexball_football(void) -{SELFPARAM(); +spawnfunc(nexball_football) +{ nexball_mode |= NBM_FOOTBALL; self.classname = "nexball_football"; self.solid = SOLID_TRIGGER; @@ -598,37 +598,37 @@ void SpawnGoal(void) 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"; @@ -639,34 +639,34 @@ void spawnfunc_nexball_out(void) //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); } //=======================// diff --git a/qcsrc/server/mutators/gamemode_onslaught.qc b/qcsrc/server/mutators/gamemode_onslaught.qc index e5d127748..9d88f7069 100644 --- a/qcsrc/server/mutators/gamemode_onslaught.qc +++ b/qcsrc/server/mutators/gamemode_onslaught.qc @@ -2044,8 +2044,8 @@ keys: "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 == "") @@ -2069,8 +2069,8 @@ keys: "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); @@ -2085,8 +2085,8 @@ keys: "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"); } diff --git a/qcsrc/server/mutators/gamemode_tdm.qc b/qcsrc/server/mutators/gamemode_tdm.qc index 27cc19b0a..451e4a55c 100644 --- a/qcsrc/server/mutators/gamemode_tdm.qc +++ b/qcsrc/server/mutators/gamemode_tdm.qc @@ -8,8 +8,8 @@ Note: If you use spawnfunc_tdm_team entities you must define at least 2! Howeve 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"; @@ -18,15 +18,12 @@ void spawnfunc_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() diff --git a/qcsrc/server/mutators/mutator_instagib.qc b/qcsrc/server/mutators/mutator_instagib.qc index 7488fd295..938b98735 100644 --- a/qcsrc/server/mutators/mutator_instagib.qc +++ b/qcsrc/server/mutators/mutator_instagib.qc @@ -7,8 +7,8 @@ #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); @@ -357,7 +357,7 @@ MUTATOR_HOOKFUNCTION(instagib_FilterItem) 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; } diff --git a/qcsrc/server/mutators/mutator_overkill.qc b/qcsrc/server/mutators/mutator_overkill.qc index 5b7018b30..33df11312 100644 --- a/qcsrc/server/mutators/mutator_overkill.qc +++ b/qcsrc/server/mutators/mutator_overkill.qc @@ -4,8 +4,8 @@ #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) { @@ -84,7 +84,7 @@ MUTATOR_HOOKFUNCTION(ok_PlayerDies) 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; @@ -205,6 +205,9 @@ MUTATOR_HOOKFUNCTION(ok_PlayerSpawn) 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) @@ -222,7 +225,7 @@ MUTATOR_HOOKFUNCTION(ok_OnEntityPreSpawn) 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; } @@ -239,7 +242,7 @@ MUTATOR_HOOKFUNCTION(ok_OnEntityPreSpawn) 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; } diff --git a/qcsrc/server/race.qc b/qcsrc/server/race.qc index 1638dc985..fbf1eaa18 100644 --- a/qcsrc/server/race.qc +++ b/qcsrc/server/race.qc @@ -86,7 +86,7 @@ string race_readName(string map, float pos) const float MAX_CHECKPOINTS = 255; -void spawnfunc_target_checkpoint(); +spawnfunc(target_checkpoint); .float race_penalty; .float race_penalty_accumulator; @@ -929,8 +929,8 @@ vector trigger_race_checkpoint_spawn_evalfunc(entity player, entity spot, vector return current; } -void spawnfunc_trigger_race_checkpoint() -{SELFPARAM(); +spawnfunc(trigger_race_checkpoint) +{ vector o; if(!g_race && !g_cts) { remove(self); return; } @@ -977,8 +977,8 @@ void spawnfunc_trigger_race_checkpoint() 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; @@ -1018,8 +1018,8 @@ void spawnfunc_target_checkpoint() // defrag entity 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) { @@ -1059,11 +1059,11 @@ void race_RetractPlayer() 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; @@ -1141,8 +1141,8 @@ void penalty_use() 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; diff --git a/qcsrc/server/spawnpoints.qc b/qcsrc/server/spawnpoints.qc index 3a574b28b..3c2851b91 100644 --- a/qcsrc/server/spawnpoints.qc +++ b/qcsrc/server/spawnpoints.qc @@ -141,18 +141,18 @@ void relocate_spawnpoint() { 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(); } @@ -160,47 +160,47 @@ void spawnfunc_info_player_deathmatch (void) /*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: diff --git a/qcsrc/server/spawnpoints.qh b/qcsrc/server/spawnpoints.qh index e697001c1..c6ed28a4c 100644 --- a/qcsrc/server/spawnpoints.qh +++ b/qcsrc/server/spawnpoints.qh @@ -6,6 +6,6 @@ float spawnpoint_nag; 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 diff --git a/qcsrc/server/steerlib.qc b/qcsrc/server/steerlib.qc index 6ebfc8ad3..fbf84da32 100644 --- a/qcsrc/server/steerlib.qc +++ b/qcsrc/server/steerlib.qc @@ -640,7 +640,7 @@ void flocker_hunter_think() float globflockcnt; -void spawnfunc_flockerspawn() +spawnfunc(flockerspawn) {SELFPARAM(); ++globflockcnt; diff --git a/qcsrc/server/t_halflife.qc b/qcsrc/server/t_halflife.qc index f041dd396..043828200 100644 --- a/qcsrc/server/t_halflife.qc +++ b/qcsrc/server/t_halflife.qc @@ -5,30 +5,30 @@ .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) {} diff --git a/qcsrc/server/t_items.qc b/qcsrc/server/t_items.qc index 0fbbf2732..c256d4df9 100644 --- a/qcsrc/server/t_items.qc +++ b/qcsrc/server/t_items.qc @@ -1209,8 +1209,8 @@ void StartItemA (entity a) 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) @@ -1218,14 +1218,14 @@ void spawnfunc_item_rockets() 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; } @@ -1237,8 +1237,8 @@ void spawnfunc_item_bullets() 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) @@ -1246,8 +1246,8 @@ void spawnfunc_item_cells() 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) @@ -1255,14 +1255,14 @@ void spawnfunc_item_plasma() 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; } @@ -1274,8 +1274,8 @@ void spawnfunc_item_shells() 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) @@ -1285,8 +1285,8 @@ void spawnfunc_item_armor_small() 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) @@ -1296,8 +1296,8 @@ void spawnfunc_item_armor_medium() 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) @@ -1307,8 +1307,8 @@ void spawnfunc_item_armor_big() 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) @@ -1318,8 +1318,8 @@ void spawnfunc_item_armor_large() 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) @@ -1329,8 +1329,8 @@ void spawnfunc_item_health_small() 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) @@ -1340,8 +1340,8 @@ void spawnfunc_item_health_medium() 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) @@ -1351,8 +1351,8 @@ void spawnfunc_item_health_large() 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) @@ -1363,29 +1363,29 @@ void spawnfunc_item_health_mega() } // 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(); @@ -1411,8 +1411,8 @@ void target_items_use() centerprint(activator, self.message); } -void spawnfunc_target_items (void) -{SELFPARAM(); +spawnfunc(target_items) +{ float n, i, j; entity e; string s; @@ -1536,8 +1536,8 @@ void spawnfunc_target_items (void) } } -void spawnfunc_item_fuel(void) -{SELFPARAM(); +spawnfunc(item_fuel) +{ if(!self.ammo_fuel) self.ammo_fuel = g_pickup_fuel; if(!self.pickup_anyway) @@ -1545,23 +1545,23 @@ void spawnfunc_item_fuel(void) 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); diff --git a/qcsrc/server/t_items.qh b/qcsrc/server/t_items.qh index d93e28bb6..1dfe53749 100644 --- a/qcsrc/server/t_items.qh +++ b/qcsrc/server/t_items.qh @@ -86,12 +86,12 @@ void ItemRead(float _IsNew); #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); diff --git a/qcsrc/server/t_quake.qc b/qcsrc/server/t_quake.qc index 74a324b98..9e22b8d06 100644 --- a/qcsrc/server/t_quake.qc +++ b/qcsrc/server/t_quake.qc @@ -2,27 +2,27 @@ #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 diff --git a/qcsrc/server/t_quake3.qc b/qcsrc/server/t_quake3.qc index d20c90055..8eecc5ee3 100644 --- a/qcsrc/server/t_quake3.qc +++ b/qcsrc/server/t_quake3.qc @@ -3,27 +3,27 @@ #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 @@ -32,38 +32,38 @@ void spawnfunc_item_health_mega(); // 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() @@ -84,11 +84,11 @@ 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); } @@ -131,30 +131,30 @@ void target_give_init() targ.nextthink = time; } self.spawnflags = 2; - spawnfunc_target_items(); + spawnfunc_target_items(this); InitializeEntity(self, target_init_verify, INITPRIO_FINDTARGET); } -void spawnfunc_target_give() -{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); } diff --git a/qcsrc/warpzonelib/server.qc b/qcsrc/warpzonelib/server.qc index 5d0afc819..d34870ec0 100644 --- a/qcsrc/warpzonelib/server.qc +++ b/qcsrc/warpzonelib/server.qc @@ -680,18 +680,18 @@ float warpzone_initialized; 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 @@ -723,8 +723,8 @@ void spawnfunc_trigger_warpzone(void) 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) @@ -877,14 +877,14 @@ void trigger_warpzone_reconnect_use() 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)