]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'TimePath/spawnfunc' into 'master'
authorTimePath <andrew.hardaker1995@gmail.com>
Sat, 3 Oct 2015 08:10:34 +0000 (08:10 +0000)
committerTimePath <andrew.hardaker1995@gmail.com>
Sat, 3 Oct 2015 08:10:34 +0000 (08:10 +0000)
spawnfunc whitelist

So we know which entity fields are actually being used that we can't remove or rename.

When a field not listed is used, a warning is displayed. No official maps produce warnings. After enough community maps have been tested, can be changed to error instead.

For convenience, a cvar will be added as an additional whitelist.

See merge request !227

133 files changed:
qcsrc/common/buffs.qh
qcsrc/common/monsters/monster/mage.qc
qcsrc/common/monsters/monster/shambler.qc
qcsrc/common/monsters/monster/spider.qc
qcsrc/common/monsters/monster/wyvern.qc
qcsrc/common/monsters/monster/zombie.qc
qcsrc/common/monsters/sv_monsters.qc
qcsrc/common/triggers/func/bobbing.qc
qcsrc/common/triggers/func/breakable.qc
qcsrc/common/triggers/func/breakable.qh
qcsrc/common/triggers/func/button.qc
qcsrc/common/triggers/func/conveyor.qc
qcsrc/common/triggers/func/door.qc
qcsrc/common/triggers/func/door_rotating.qc
qcsrc/common/triggers/func/door_secret.qc
qcsrc/common/triggers/func/fourier.qc
qcsrc/common/triggers/func/ladder.qc
qcsrc/common/triggers/func/pendulum.qc
qcsrc/common/triggers/func/plat.qc
qcsrc/common/triggers/func/pointparticles.qc
qcsrc/common/triggers/func/rainsnow.qc
qcsrc/common/triggers/func/rotating.qc
qcsrc/common/triggers/func/stardust.qc
qcsrc/common/triggers/func/train.qc
qcsrc/common/triggers/func/vectormamamam.qc
qcsrc/common/triggers/misc/corner.qc
qcsrc/common/triggers/misc/follow.qc
qcsrc/common/triggers/misc/laser.qc
qcsrc/common/triggers/misc/teleport_dest.qc
qcsrc/common/triggers/target/changelevel.qc
qcsrc/common/triggers/target/location.qc
qcsrc/common/triggers/target/music.qc
qcsrc/common/triggers/target/spawn.qc
qcsrc/common/triggers/target/speaker.qc
qcsrc/common/triggers/target/voicescript.qc
qcsrc/common/triggers/trigger/counter.qc
qcsrc/common/triggers/trigger/delay.qc
qcsrc/common/triggers/trigger/disablerelay.qc
qcsrc/common/triggers/trigger/flipflop.qc
qcsrc/common/triggers/trigger/gamestart.qc
qcsrc/common/triggers/trigger/gravity.qc
qcsrc/common/triggers/trigger/heal.qc
qcsrc/common/triggers/trigger/hurt.qc
qcsrc/common/triggers/trigger/impulse.qc
qcsrc/common/triggers/trigger/jumppads.qc
qcsrc/common/triggers/trigger/jumppads.qh
qcsrc/common/triggers/trigger/keylock.qc
qcsrc/common/triggers/trigger/magicear.qc
qcsrc/common/triggers/trigger/monoflop.qc
qcsrc/common/triggers/trigger/multi.qc
qcsrc/common/triggers/trigger/multi.qh
qcsrc/common/triggers/trigger/multivibrator.qc
qcsrc/common/triggers/trigger/relay.qc
qcsrc/common/triggers/trigger/relay_activators.qc
qcsrc/common/triggers/trigger/relay_if.qc
qcsrc/common/triggers/trigger/relay_teamcheck.qc
qcsrc/common/triggers/trigger/secret.qc
qcsrc/common/triggers/trigger/swamp.qc
qcsrc/common/triggers/trigger/teleport.qc
qcsrc/common/triggers/trigger/viewloc.qc
qcsrc/common/turrets/checkpoint.qc
qcsrc/common/turrets/targettrigger.qc
qcsrc/common/turrets/unit/ewheel.qc
qcsrc/common/turrets/unit/flac.qc
qcsrc/common/turrets/unit/fusionreactor.qc
qcsrc/common/turrets/unit/hellion.qc
qcsrc/common/turrets/unit/hk.qc
qcsrc/common/turrets/unit/machinegun.qc
qcsrc/common/turrets/unit/mlrs.qc
qcsrc/common/turrets/unit/phaser.qc
qcsrc/common/turrets/unit/plasma.qc
qcsrc/common/turrets/unit/plasma_dual.qc
qcsrc/common/turrets/unit/tesla.qc
qcsrc/common/turrets/unit/walker.qc
qcsrc/common/vehicles/unit/bumblebee.qc
qcsrc/common/vehicles/unit/racer.qc
qcsrc/common/vehicles/unit/raptor.qc
qcsrc/common/vehicles/unit/spiderbot.qc
qcsrc/common/weapons/weapon/arc.qc
qcsrc/common/weapons/weapon/blaster.qc
qcsrc/common/weapons/weapon/crylink.qc
qcsrc/common/weapons/weapon/devastator.qc
qcsrc/common/weapons/weapon/electro.qc
qcsrc/common/weapons/weapon/fireball.qc
qcsrc/common/weapons/weapon/hagar.qc
qcsrc/common/weapons/weapon/hlac.qc
qcsrc/common/weapons/weapon/hmg.qc
qcsrc/common/weapons/weapon/hook.qc
qcsrc/common/weapons/weapon/machinegun.qc
qcsrc/common/weapons/weapon/minelayer.qc
qcsrc/common/weapons/weapon/mortar.qc
qcsrc/common/weapons/weapon/porto.qc
qcsrc/common/weapons/weapon/rifle.qc
qcsrc/common/weapons/weapon/rpc.qc
qcsrc/common/weapons/weapon/seeker.qc
qcsrc/common/weapons/weapon/shockwave.qc
qcsrc/common/weapons/weapon/shotgun.qc
qcsrc/common/weapons/weapon/tuba.qc
qcsrc/common/weapons/weapon/vaporizer.qc
qcsrc/common/weapons/weapon/vortex.qc
qcsrc/lib/_all.inc
qcsrc/lib/spawnfunc.qh [new file with mode: 0644]
qcsrc/server-testcase/framework.qc
qcsrc/server/bot/waypoints.qc
qcsrc/server/bot/waypoints.qh
qcsrc/server/cheats.qc
qcsrc/server/defs.qh
qcsrc/server/g_lights.qc
qcsrc/server/g_models.qc
qcsrc/server/g_subs.qc
qcsrc/server/g_subs.qh
qcsrc/server/g_world.qc
qcsrc/server/item_key.qc
qcsrc/server/mutators/events.qh
qcsrc/server/mutators/gamemode_assault.qc
qcsrc/server/mutators/gamemode_ctf.qc
qcsrc/server/mutators/gamemode_domination.qc
qcsrc/server/mutators/gamemode_invasion.qc
qcsrc/server/mutators/gamemode_nexball.qc
qcsrc/server/mutators/gamemode_onslaught.qc
qcsrc/server/mutators/gamemode_tdm.qc
qcsrc/server/mutators/mutator_instagib.qc
qcsrc/server/mutators/mutator_overkill.qc
qcsrc/server/race.qc
qcsrc/server/spawnpoints.qc
qcsrc/server/spawnpoints.qh
qcsrc/server/steerlib.qc
qcsrc/server/t_halflife.qc
qcsrc/server/t_items.qc
qcsrc/server/t_items.qh
qcsrc/server/t_quake.qc
qcsrc/server/t_quake3.qc
qcsrc/warpzonelib/server.qc

index 3eff9e26b8e39d3298000b3c77106a4525a3b2f4..31654ebf8095a9a9267eedd682b73b8b82314e5a 100644 (file)
@@ -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)
index 534005db93f558ea4bf25b9f80a53dc351b7f08a..433fed6830e23c050bb1a9aa69678cb4f420ba7a 100644 (file)
@@ -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
 
index 55e0f46e95413053bd525a6ce185437b17c06c88..fe6078303cb5cacd1b488e0bccb38d0b8f6e6490 100644 (file)
@@ -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)
index f6c3089ce358d0c45b64e985f04d507a674d29e5..ba2b12695d8d9a2eb85273814b162cc161a6ac00 100644 (file)
@@ -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)
index af174603d26b7e273aee653547c4bc2bf2d25755..d65bcf648da3ce62286f1d852f9ec2b858d87d01 100644 (file)
@@ -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)
index ed169c99d736058e8dce676d6bd2c7046b1f0c0b..6242a757d081af4610645932402fa44c1e703b8f 100644 (file)
@@ -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)
index 64c26447495a77b571322e40b68d169bec4ca47a..18bf6af2a9a64f238b39d94b3316337e56c862b6 100644 (file)
@@ -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;
index 298043bb573ae1b07e410ea3d3d8bac9c613cb20..8c7000d933ee1c8fd4418912dd8b7e0bbcc909d2 100644 (file)
@@ -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 != "")
        {
index b2a4894a5238a84f6cfa1dc7d901cc316860e7cf..af9a6b4233124190ad4ab1a417d8f6562739190b 100644 (file)
@@ -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
index b641d9446252890935a608795aff02c1ebb62829..75cfb94c690cf09d51c5ad8eaa1211bf5012043c 100644 (file)
@@ -2,7 +2,7 @@
 #define TRIGGERS_FUNC_BREAKABLE_H
 
 #ifdef SVQC
-void spawnfunc_func_breakable();
+spawnfunc(func_breakable);
 #endif
 
 #endif
index a55f02ef2fcc003852ef8aadde68dc799326f147..ab1cff538ef2e1bbbd6c020208578ce326ae7a03 100644 (file)
@@ -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())
index 4f5a7d6ea591f50b5ffbbf9bca9a3cb6874874a1..32c12299e08e7b58726be45d072f2760f4904a65 100644 (file)
@@ -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;
index 422295fa86397510b3230fb87912f490a39059ef..fed8e9fa424515b9c3aa8aa5aa3f5029e07b3529 100644 (file)
@@ -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);
index fbe579c1361805da9d34027a20040c9df64f59aa..e01a7e73e299e6288652471a283eb9a4cb03a25c 100644 (file)
@@ -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";
index 5b2cfc5ba05a4f620bc541279dbf59c6dc28d970..8686c671f7c097c3a5307ecca54e478ef2b3734b 100644 (file)
@@ -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";*/
 
index 552fffe5a11deae6142a74b2e82a71bd0a4fe72c..2b3d07f6ea41dbc57dc441861290f00895fb5502 100644 (file)
@@ -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 != "")
        {
index fc3d47210e7e3c76d4d43b42e50da36202d7484b..3785299e24444b361cf01bf23377e3a44fa5d94d 100644 (file)
@@ -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;
index b23541e03a479986afea7255282f5e0290b07103..d8bab869e2f743310b01163fb23c96c3e773c941 100644 (file)
@@ -21,8 +21,8 @@ void func_pendulum_controller_think()
        }
 }
 
-void spawnfunc_func_pendulum()
-{SELFPARAM();
+spawnfunc(func_pendulum)
+{
        entity controller;
        if (self.noise != "")
        {
index f2c57be21ec223e5d4ec12feed5a1abf73a878a9..de4c53cb53f69b6a0b265204bec44c5f79c8fec7 100644 (file)
@@ -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;
 
index 058f1199f405189a11e4026c43464c6535109a4d..04ab77f7fd70a4d3fd93f64b2cf26174416a7806 100644 (file)
@@ -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)
 
index 8c00f9ce21fc2c8c828fdee03e66370fd22b1cdb..25085ae4aa880e934304b9f96c8db1ee0533e041 100644 (file)
@@ -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)
index 2e3c7851a8f9090f926aa4d0cdc804e479d0a4b6..be2c7ed9c3d3828c972cfb592d764223f69c9d87 100644 (file)
@@ -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);
index 0c329cdb273eeb0e8166d41c36032ff436c774e0..859cdf53df00517d0f9c45cd56d5d6464dacc5d4 100644 (file)
@@ -1,6 +1,6 @@
 #ifdef SVQC
-void spawnfunc_func_stardust()
-{SELFPARAM();
+spawnfunc(func_stardust)
+{
        self.effects = EF_STARDUST;
 
        CSQCMODEL_AUTOINIT(self);
index 187fd3f1b97be9174c2bbdf962be42f507c0c104..4284d24031e6d609f16428e146707ce1d5366747 100644 (file)
@@ -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);
 
index 32355004bed1d33ba21648cbf62f2196ecaa0d99..57d3a0636fafefb5f7036c2c0ef2f5cfa1e235f8 100644 (file)
@@ -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);
index 390fd2c79c2949871b0e66a6b1aed731b098e922..ccac77b6c9c402b7340c68ad12263531a066a486 100644 (file)
@@ -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);
index 02c9dcc277c740dd41852ce16d69338cce7bd161..842248a4b31f0acc93a7b91f32a784dea7c1978c 100644 (file)
@@ -62,8 +62,8 @@ void follow_init()
        }
 }
 
-void spawnfunc_misc_follow()
-{SELFPARAM();
+spawnfunc(misc_follow)
+{
        InitializeEntity(self, follow_init, INITPRIO_FINDTARGET);
 }
 #endif
index 52d2caf65aada325c89e45404952dc4dde407b90..ec4a9e277a09e5bf5770180dc718bb6781541d90 100644 (file)
@@ -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")
index a3c9783537bb9632d691def050eeedb8bf8fa220..00752cfa59c5faa92a39756d31272ceec224e03a 100644 (file)
@@ -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
index 8dc694e621e918e8e5a8049736f608f02da3950b..51e360e0c587c277dfecfd56f4a88e7a5d32d70c 100644 (file)
@@ -3,8 +3,9 @@
 .entity chlevel_targ;
 
 
-void spawnfunc_target_changelevel_use()
-{SELFPARAM();
+void target_changelevel_use()
+{
+       SELFPARAM();
        if(self.spawnflags & 2)
        {
                // simply don't react if a non-player triggers it
@@ -35,9 +36,9 @@ void spawnfunc_target_changelevel_use()
                localcmd(strcat("changelevel ", self.chmap, "\n"));
 }
 
-void spawnfunc_target_changelevel()
-{SELFPARAM();
-       self.use = spawnfunc_target_changelevel_use;
+spawnfunc(target_changelevel)
+{
+       self.use = target_changelevel_use;
 
        if(!self.count) { self.count = 0.7; }
 }
index 554032ee60cc7221b129b36e7b880aaca60cc60a..14512c794cfc960d92555e9e327c4c25f6c71d40 100644 (file)
@@ -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;
 }
index 879c3042329c3898de0e252a1eddbd864181d9c1..2748ed6f63af351807fa7ce56d3911d7e7c2145f 100644 (file)
@@ -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)
index 591b971d504a58bf9bcdcff9d44c8e5d9a6fef30..554d382268869f79e413bc27112bb42a8d76c6d6 100644 (file)
@@ -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));
index 75f733c09eefa44d420a36c894beb88dfa05b791..0b3767ff654c856a13d9e6a515dc13020c5abd4f 100644 (file)
@@ -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)
index 35d84da8df64de4a95e82f2debc9847bec413764..1d1816a7741e988f46f9ee70f6773efc5843fe6f 100644 (file)
@@ -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
index 9eb7eb072bb3f2fa61d0048a12c127f8e7c34b2b..41f9f79ecc4d245d8c1f7790158a9efc11cfeb26 100644 (file)
@@ -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;
index a3e08e4d81f9f522a17008b82ee21e1a787c43aa..eb0c0af7754a252ce0ef5ac301f220314f345f34 100644 (file)
@@ -11,8 +11,8 @@ void delay_reset()
        self.nextthink = 0;
 }
 
-void spawnfunc_trigger_delay()
-{SELFPARAM();
+spawnfunc(trigger_delay)
+{
     if(!self.wait)
         self.wait = 1;
 
index 4545df19575afe5e4c17015c7feedc258e1908b7..a1f13d277e5f87e68d3391323596d0d9072cc659 100644 (file)
@@ -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
index b5a2eb8b292d2120abe5dfc798ebd0b81b567c04..e039173fb01ea752cbfae4361181cb65895282c4 100644 (file)
@@ -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
index 1b72780e51c9f5cec6245a8dac5e456856153913..30e6ebae7015e6a25af19d7f8b82335b6571cec4 100644 (file)
@@ -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
index f329c71b0da0d79f6415472d454b1c5f1dcd272d..a6b3eedde651521db1a84c409b00940cec16c6a3 100644 (file)
@@ -85,8 +85,8 @@ void trigger_gravity_touch()
        }
 }
 
-void spawnfunc_trigger_gravity()
-{SELFPARAM();
+spawnfunc(trigger_gravity)
+{
        if(self.gravity == 1)
                return;
 
index 49042427e61fa261f5d98f0fc05edf398fdc5cba..5d4f2d0b3a2cf26a15508c630cc47bb19f90cc38 100644 (file)
@@ -25,8 +25,8 @@ void trigger_heal_touch()
        }
 }
 
-void spawnfunc_trigger_heal()
-{SELFPARAM();
+spawnfunc(trigger_heal)
+{
        self.active = ACTIVE_ACTIVE;
 
        EXACTTRIGGER_INIT;
index 7a12011931497bb4c141cecb0c7e7f1152aa1c5e..535ba8500d29743d138a27aca5ea980132110644 100644 (file)
@@ -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;
index 2b3bb5729a1461dae21a775b71a87f64ae9e0189..c40fed3a8387bc1da25a54f180de0efdafa3c197 100644 (file)
@@ -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;
index cdc181ceb6513a769157756bd26e0e12c22cdbf7..0695811e0f4143cb95567923700fd3719825b771 100644 (file)
@@ -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
 
index bb0f4750eebbc2af005c12a86123bb02470270d7..efce0df62d95600473019f016e4ac656ad0699f9 100644 (file)
@@ -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
index f792185bc01eff4e608f176be13d8f4004be87b4..365c6f5a908d01a7ea8a3f7f76a51ce2545e0b70 100644 (file)
@@ -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
index 0c8a7d359decbc8299181ea208087fea26761c82..c20514e1a61f8e9cff3b0355c77bee16d10fce4f 100644 (file)
@@ -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;
 
index 5129ce35cdf11d20dfd2b567ca2b6f1efbb9d26c..d81f6e371958c9d3b8680567cf6817af849eefe7 100644 (file)
@@ -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)
index 2aa8f5c1ddf1ed8e101cf78466106d6c96c2dc9b..3261520d7a19e951ebdd198c7293facdf38a1de0 100644 (file)
@@ -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)
        {
@@ -201,9 +201,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
index df14a518e61fb73faecab94a6bb58eb52dadc03b..5e72a96a2fe478d74523c3c53183524b873dda27 100644 (file)
@@ -2,5 +2,5 @@
 void multi_trigger();
 void multi_reset();
 
-void spawnfunc_trigger_once();
+spawnfunc(trigger_once);
 #endif
index d9c6c2e60c582fd18fce1ea67234e5af840cb074..78b3383fc0422f787fa68c075bd6bdd9c5514dd9 100644 (file)
@@ -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)
index 20962cd495d9de4cc3ce25eb4a30e396db6e16f3..178daad90e06b78904abc187d5e60f3f3aeda720 100644 (file)
@@ -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
index b765151fd123faa685786bb3f3f66b1b4730ecab..147b6178a1e15abdeef8c6e924e295ce2137cfa1 100644 (file)
@@ -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;
 }
index cadd95e5840abd319b53af727505d19a05cc9cc4..e45996bd855695593b1717e83e8b7f7551c700ad 100644 (file)
@@ -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
index f93287a920f4ad2c5a5187d17a03fad951e4b361..ab2b87aaa0da62276a72ed52f0cc74e81a119d1d 100644 (file)
@@ -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;
index 27347d9e83ea1e63d2138446e1e4b4031329cc4a..d16d2773c193442fe04b83943e47b7c9ad8a5652 100644 (file)
@@ -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;
index b9a4acd1a411934b3a90500afdff44dbeafd77c5..2ae068d824f648bd3a98c776a708fbd23e1c018a 100644 (file)
@@ -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;
index 129f4e387cbab7ca43b3e9ec93e3fca1b0ff4973..95bd7fbbd4ff0ab788035aff177c7e0d52d47e95 100644 (file)
@@ -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;
index de2d3aac287ef32783b120cd57a28ea49f0211aa..73d722cf0079a6490b52f8eb4d95da9c395b6ecf 100644 (file)
@@ -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)
 
index 2b0bd6f6763b338b8a3144f960c54348e7310b29..bb2bff22c8bf3179befb6610f7240773693126fe 100644 (file)
@@ -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);
 }
index 98c23c4584df4e98a4707c33f3121aee48ad55a5..625746341750754f0f6336550a1eff867aaf1430 100644 (file)
@@ -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 ();
index cd111b258e6851a2d2b5450dd6ed396b7b7d98c8..117e3478324c79a96864a30688a6ddeec925d192 100644 (file)
@@ -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.m_id)) remove(self); }
+spawnfunc(turret_ewheel) { if(!turret_initialize(TUR_EWHEEL.m_id)) remove(self); }
 
 float t_ewheel(float req)
 {SELFPARAM();
index e19116067ee037cb4d12aff94ec2c9f982095fe2..3b9330f7e445f2df9791059cd5fc1df06f5c6af5 100644 (file)
@@ -28,7 +28,7 @@ void turret_flac_projectile_think_explode()
     remove(self);
 }
 
-void spawnfunc_turret_flac() { SELFPARAM(); if(!turret_initialize(TUR_FLAC.m_id)) remove(self); }
+spawnfunc(turret_flac) { if(!turret_initialize(TUR_FLAC.m_id)) remove(self); }
 
 float t_flac(float req)
 {SELFPARAM();
index 5a8df2aad16a20e40e1a0177cf91ca599f26aa26..3b6389a96428a66be641f4012987dd652db9ef1f 100644 (file)
@@ -40,7 +40,7 @@ bool turret_fusionreactor_firecheck()
     return true;
 }
 
-void spawnfunc_turret_fusionreactor() { SELFPARAM(); if(!turret_initialize(TUR_FUSIONREACTOR.m_id)) remove(self); }
+spawnfunc(turret_fusionreactor) { if(!turret_initialize(TUR_FUSIONREACTOR.m_id)) remove(self); }
 
 float t_fusionreactor(float req)
 {SELFPARAM();
index 56f5da90a3d70b72d9e407c2923c72f6f84aa792..a253d20ed102ee1aaba5fa06c21333d98373e5f5 100644 (file)
@@ -76,7 +76,7 @@ void turret_hellion_missile_think()
     UpdateCSQCProjectile(self);
 }
 
-void spawnfunc_turret_hellion() { SELFPARAM(); if(!turret_initialize(TUR_HELLION.m_id)) remove(self); }
+spawnfunc(turret_hellion) { if(!turret_initialize(TUR_HELLION.m_id)) remove(self); }
 
 float t_hellion(float req)
 {SELFPARAM();
index 106c982ae8cfa8d8b5d2832f9891740cf086241f..25235734badd158eeb3ff3f46a5e43d9b93cff94 100644 (file)
@@ -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.m_id)) remove(self); }
+spawnfunc(turret_hk) { if(!turret_initialize(TUR_HK.m_id)) remove(self); }
 
 float t_hk(float req)
 {SELFPARAM();
index 35f1921edae621cca8681943bb5d8c80fdd73651..eeb889022b1610fb32c18d85bdea1a2a27dff18f 100644 (file)
@@ -11,7 +11,7 @@ REGISTER_TURRET(
 );
 #else
 #ifdef SVQC
-void spawnfunc_turret_machinegun() { SELFPARAM(); if(!turret_initialize(TUR_MACHINEGUN.m_id)) remove(self); }
+spawnfunc(turret_machinegun) { if(!turret_initialize(TUR_MACHINEGUN.m_id)) remove(self); }
 
 void W_MachineGun_MuzzleFlash(void);
 
index 21e0a435d7a951619029d085a63d12fc113196a7..7e130c6e18907d57182f8427525f332eb9b54c82 100644 (file)
@@ -11,7 +11,7 @@ REGISTER_TURRET(
 );
 #else
 #ifdef SVQC
-void spawnfunc_turret_mlrs() { SELFPARAM(); if(!turret_initialize(TUR_MLRS.m_id)) remove(self); }
+spawnfunc(turret_mlrs) { if(!turret_initialize(TUR_MLRS.m_id)) remove(self); }
 
 float t_mlrs(float req)
 {SELFPARAM();
index 04e226448405b58acfa9786be112c38918887616..6eec37ab4d6532abaaa5e20d9b49480e18e11f25 100644 (file)
@@ -57,7 +57,7 @@ void beam_think()
 
 }
 
-void spawnfunc_turret_phaser() { SELFPARAM(); if(!turret_initialize(TUR_PHASER.m_id)) remove(self); }
+spawnfunc(turret_phaser) { if(!turret_initialize(TUR_PHASER.m_id)) remove(self); }
 
 float t_phaser(float req)
 {SELFPARAM();
index baafa51c66b5c1a596f68c9d0337121a75a1d073..59c0f850a76f5663cc81de0ffa53416d8da0400f 100644 (file)
@@ -11,7 +11,7 @@ REGISTER_TURRET(
 );
 #else
 #ifdef SVQC
-void spawnfunc_turret_plasma() { SELFPARAM(); if(!turret_initialize(TUR_PLASMA.m_id)) remove(self); }
+spawnfunc(turret_plasma) { if(!turret_initialize(TUR_PLASMA.m_id)) remove(self); }
 
 float t_plasma(float req)
 {SELFPARAM();
index bf3362ab897593149faff730c372e3b6653fff9f..edcf7ed21fd4c75ff6bda5c676617b4e56d04fd7 100644 (file)
@@ -11,7 +11,7 @@ REGISTER_TURRET(
 );
 #else
 #ifdef SVQC
-void spawnfunc_turret_plasma_dual() { SELFPARAM(); if(!turret_initialize(TUR_PLASMA_DUAL.m_id)) remove(self); }
+spawnfunc(turret_plasma_dual) { if(!turret_initialize(TUR_PLASMA_DUAL.m_id)) remove(self); }
 
 float t_plasma_dual(float req)
 {SELFPARAM();
index d3c894b96edfe548bbbd2f1b9c9ac8c4d8641267..ebcc4e997767cd3870cb2f6e007d7d40c0db02fb 100644 (file)
@@ -89,7 +89,7 @@ float turret_tesla_firecheck()
     return 0;
 }
 
-void spawnfunc_turret_tesla() { SELFPARAM(); if(!turret_initialize(TUR_TESLA.m_id)) remove(self); }
+spawnfunc(turret_tesla) { if(!turret_initialize(TUR_TESLA.m_id)) remove(self); }
 
 float t_tesla(float req)
 {SELFPARAM();
index 792e7a338d0b080a16d4dcb4a1d0a7f69d936f4f..a2927cfbf29765be6ff5122c8525f39a34db0cca 100644 (file)
@@ -334,7 +334,7 @@ void walker_move_path()
 #endif
 }
 
-void spawnfunc_turret_walker() { SELFPARAM(); if(!turret_initialize(TUR_WALKER.m_id)) remove(self); }
+spawnfunc(turret_walker) { if(!turret_initialize(TUR_WALKER.m_id)) remove(self); }
 
 float t_walker(float req)
 {SELFPARAM();
index 6f8a2bf8f5e7bf56c357aef6b805ba5c043fd523..d36392e207734c062c41887389909d89f2efaf33 100644 (file)
@@ -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; }
 }
index a1dc7ced65c78c9a69637ad6702bc66dd8dc9456..4d62249f47abcde8e9f63e5581a4cd4ffb47c8c3 100644 (file)
@@ -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; }
 }
index 742ef7b9b2a990eac309fe7ec1922c3ecc5b6047..a1c058fb00ef3015c1402959da2afc723a636427 100644 (file)
@@ -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; }
 }
index f8efe528dd28614cfa301063a8663e1f51d94d8a..6e1fffe7a70c3cecd6f49175f8bac3e9d16744fe 100644 (file)
@@ -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; }
 }
index 400c950c8cf904b76534d599991e5aa7e5761a4c..6e1e2c7cb6ebdec188eab9e383154d5bbb825822 100644 (file)
@@ -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();
index 6b6d207bfada68b1d3a526c601b18f66c7290e45..10e55990a5594f645aeec8859e357905cf8d6135 100644 (file)
@@ -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();
index 43771079e2b50814d896bb11ec9b6cb4980f12ce..bf6c0795f5985b9f1ae274bf94f76019929e4fd2 100644 (file)
@@ -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)
 {
index a011846315b81c4ecbc75633e351e59591b29fb9..0735f79ab4eda876d2da26f947a37ebbb3c1aba2 100644 (file)
@@ -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();
index fbc07338808e01a22dc1b10daad005a437f61f5c..85a75ed9c5b9f483ba6d45a3fd5f3fef45feae9f 100644 (file)
@@ -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)
 {
index 2bf2a6267abb63cc03ad7b508fc524bdfe10f51d..c334932f165f74fb96e7b120522584337460bbc3 100644 (file)
@@ -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();
index 8001ce15e82a041cefc4f68cc29d54be3b7bb3dd..21755eac69a07005a2a8a24d58efab0d3f2b7c72 100644 (file)
@@ -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!
 
index a0408d6b9eb26d261f65ad80f93e1068564a795a..ac300fe540b416b632cfd2f89702dacf30f80669 100644 (file)
@@ -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();
index 03196daf6760cad6d0fa86ea6dfbc5db7b07296c..f4c6a3c752a075b1a743c372b69b127150aa8457 100644 (file)
@@ -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();
index af52ec15bb01c71601e5aeec50be58f4bdebfc55..6c1f82fdf8561a6ed83387731cbbbb89bbe64343 100644 (file)
@@ -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;
index 6db6d1633d4f2ad295473b295206e02fc6a18d4c..e9a50ab4393d34c6eb976ea1dbae2c77bb211f8c 100644 (file)
@@ -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();
index 05dde9852737836bf8b193944b2ffcc8947e89f0..40866970fb3438d3fd2fcd83cdc0bfeaccc05b76 100644 (file)
@@ -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();
index 665367fd78ad836ddc4408133455f0125c53b803..1276cca5d9347bbcd45d4142014a2793aa9c703f 100644 (file)
@@ -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();
index d764286b705dd099154a55c2c9e286576fc636f2..66cdb21228b099c4d240a9b14ed12a0c5393cbf8 100644 (file)
@@ -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();
index 6d4a58f272d123ea7abba15e306fda9af89e1c73..c156d84b46e9285841f055fffc78282f0a19e859 100644 (file)
@@ -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();
index 5fe7552ccb60fdd6c2620b2d2609f6b789c8086c..4286ce433746a366bc78cebda4f4ffc43d7c2113 100644 (file)
@@ -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();
index b79bb081e25e76a26fc98b2e2ed6e4459e54b823..1686ff5290fec13b21f13b7c773a598ca75a15d5 100644 (file)
@@ -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
index 0ef52fbd9d69051b328ab0b4008c8802f8329af6..a067110b7285af22ea359248ab43981093786834 100644 (file)
@@ -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")
index 9a8d9d0db706e1453573151d895aa10acd7c1081..05f4cf6ab0bec6d3cdf88b381714882cfbc382b8 100644 (file)
@@ -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();
index 20100bf39f0db4694419540ce41262f82fc9ae7c..6d1cf3a6f043562c888e3cb9da1213b5257ff787 100644 (file)
@@ -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)
 {
index d27f99180f2b0964a840944fd6af12dd8622ddb5..8cdeb61accad228365716bf78c1f03baafaa1111 100644 (file)
@@ -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();
index 8584b8ab91147db1932d3648ff354e22e685348d..8238ac22c83d87b9e7ab70242921185753bbe5bd 100644 (file)
@@ -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)
index cda9b3a8804e3a3ac6b7f13cf815036c528c9ea3..e7ee2746f553f5e06dbec8c491ca1982ad0e479c 100644 (file)
@@ -22,6 +22,7 @@
 #include "registry.qh"
 #include "replicate.qh"
 #include "sortlist.qc"
+#include "spawnfunc.qh"
 #include "static.qh"
 #include "string.qh"
 #include "struct.qh"
diff --git a/qcsrc/lib/spawnfunc.qh b/qcsrc/lib/spawnfunc.qh
new file mode 100644 (file)
index 0000000..c474104
--- /dev/null
@@ -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"), #id, fieldname, 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
index f874b616b25a8045311c028bf9abde739d1f84e7..1ec7115ef27c503b55cd6c723a2a14e97a77afba 100644 (file)
@@ -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");
index b34af78bbc07c0fa52658205fcb05e964ba13130..8f50d0276a6efb67158ba9164649edbdec387c70 100644 (file)
@@ -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);
index 87141c4bc35a48e26efb00468edc748aaf74d620..fde524bb94821ae89bd4ced22ecebed7e3d47e66 100644 (file)
@@ -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);
index 361afadee6d1dce14f016c3022f8ac06425046c1..9912174dd8d17a5a024fd8ac9e77f5340e839b49 100644 (file)
@@ -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)
                                        {
index 02e80845b778c91fb58ed24b1f4ab26674cb39ef..723b137a1366c54d7480eea6a8ee1523ced2ca1e 100644 (file)
@@ -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
index f7382d1666b15b6c295903b3fa90260be3c720a2..bd5232a1c93338c5de9e164531cd5296798b0730 100644 (file)
@@ -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;
index 8bb2b1b6afd5d4688a4d781d90aa89c9d02303e6..3a94d6f1abeb1dff1ee6a6bea05ded66c77d0e1e 100644 (file)
@@ -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)
index 723087a96380634bb539a613145338aa2c96d571..585ac42e085b56852be47ac023d9d11976e92404 100644 (file)
@@ -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.
 }
index d62bbb6124e57bd014b2976bde0d5532990b5f98..77f49ae5a9930d1b75911377490437ce48bcd10b 100644 (file)
@@ -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);
 
index e17e7adbcff7dd162f345a89a84e2b0b4e9bf8ad..53990fb21392f0b22c64d91ab93e8cc49e39e526 100644 (file)
@@ -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;
 
@@ -918,8 +918,8 @@ void spawnfunc_worldspawn (void)
        world_initialized = 1;
 }
 
-void spawnfunc_light (void)
-{SELFPARAM();
+spawnfunc(light)
+{
        //makestatic (self); // Who the f___ did that?
        remove(self);
 }
index 780607871fe96173d15cab6759579deae08c86db..713fbf6c3df57e87a8c704e7916da1ba11e562b0 100644 (file)
@@ -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);
 };
index 881938f06809030eb83eb4c28aa10241de785165..1492b9f6af3d07a06aa8a782a8d4a846ea60bea0 100644 (file)
@@ -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);
 
 /**
index 844043222a71e7e43de8a6eb030c2fcbc044fe33..1a10e3c6c9c789107fc0b80901f63bc7d941230f 100644 (file)
@@ -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;
index c0dd9b84ebe8c391c458329bd4f5b90c9099effb..108b8dda6f369b10163cdc376d968e90e6d65a49 100644 (file)
@@ -2247,8 +2247,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);
@@ -2265,8 +2265,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);
@@ -2283,8 +2283,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);
@@ -2301,8 +2301,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);
@@ -2319,8 +2319,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; }
 
@@ -2333,8 +2333,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";
@@ -2342,15 +2342,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);  }
 
 
 // ==============
@@ -2374,15 +2374,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.
index 66f4c8da316fafdfda252ca9ec48203d9d5baf33..34b2875105a6f404588ad6d05477c2920230c369 100644 (file)
@@ -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);
 }
 
index 412e7bd5405caa28832a5edc54ad8dcd4f01c652..5dbe12d22d9c7701f042591b7d04e677509ec34f 100644 (file)
@@ -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";
index a318748fda952e97f28aebe85c4b9977e82a8a22..3675831acc915ff9961e7eba121a77230707acf9 100644 (file)
@@ -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 = SND(TYPEHIT);
        SpawnGoal();
 }
 
-void spawnfunc_nexball_out(void)
-{SELFPARAM();
+spawnfunc(nexball_out)
+{
        self.team = GOAL_OUT;
        if(self.noise == "")
                self.noise = SND(TYPEHIT);
@@ -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);
 }
 
 //=======================//
index 32dcaf556f4df867df989a757bfc0e634032b470..35a8e7bdc76c92f9eb04356f197c02b73d762cbe 100644 (file)
@@ -2025,8 +2025,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 == "")
@@ -2050,8 +2050,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);
@@ -2066,8 +2066,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"); }
 
index 27cc19b0ab8d029f17092ac75a8ad1e903263a84..451e4a55c32536d35ac84ec33b1b0add8dde0bec 100644 (file)
@@ -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()
index 67be0829099d6ceb60955fa36a9426e538b4ebf3..cbe57ca2ac5f671c5c99325a5a2ca196e89a335c 100644 (file)
@@ -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;
        }
 
index 3bc1e79589355e376e712199ee3925e1105cff8d..2114efc92d56cc0c1773e3b74a8c42a1e38d3875 100644 (file)
@@ -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;
                }
index 1638dc9855d6bc012cc48490a5cbbb0afbc684d3..fbf1eaa185af29a2b6a5d3ab61b72410e6763e6c 100644 (file)
@@ -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;
index 3a574b28b2bfead37bf5a6eb73380f6f5af382ca..3c2851b91fe4d1da15a9abce1c9e473328d94610 100644 (file)
@@ -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:
index e697001c18145e96233de28a8bfba1e436f59503..c6ed28a4c71f86ca94045029f40127023234d22f 100644 (file)
@@ -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
index 6ebfc8ad3159409c661cfe8305adbbc9033b2216..fbf84da32be0b06fb2a16d0ae2f790bdc5fcb9da 100644 (file)
@@ -640,7 +640,7 @@ void flocker_hunter_think()
 
 
 float globflockcnt;
-void spawnfunc_flockerspawn()
+spawnfunc(flockerspawn)
 {SELFPARAM();
     ++globflockcnt;
 
index f041dd39659aebd31a8b375b6e14d1fd51820f1c..0438282006c22a072255fb75142b4ee63eaf8b9f 100644 (file)
@@ -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) {}
index 7d3e59836b9ebb80f85769d2de5a45130942d5d5..015d4aeb2cae9d50b22bd734a824a48e150b2e34 100644 (file)
@@ -1203,8 +1203,8 @@ void StartItemA (entity a)
     StartItem(strzone(a.m_model.model_str()), 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)
@@ -1212,14 +1212,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;
        }
@@ -1231,8 +1231,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)
@@ -1240,8 +1240,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)
@@ -1249,14 +1249,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;
        }
@@ -1268,8 +1268,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)
@@ -1279,8 +1279,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)
@@ -1290,8 +1290,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)
@@ -1301,8 +1301,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)
@@ -1312,8 +1312,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)
@@ -1323,8 +1323,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)
@@ -1334,8 +1334,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)
@@ -1345,8 +1345,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)
@@ -1357,28 +1357,28 @@ 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)
+{
                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();
@@ -1404,8 +1404,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;
@@ -1522,8 +1522,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)
@@ -1531,23 +1531,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);
index d93e28bb611053773784fb08612df1f16ba83fdb..1dfe537494cba522feed45f332f8d909486a3c89 100644 (file)
@@ -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);
index 74a324b98193ad4918fbab1d853d6528e2a9ddcd..9e22b8d06542ddf2236c4cb2a5ba57dbbbe9e546 100644 (file)
@@ -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
index d20c90055dfcdd91024d68d9a2ee5f6cc3270588..8eecc5ee3ba67d16d14204ca3776eee16adcd6b1 100644 (file)
@@ -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);
 }
index 5d0afc819e903212b4eb9354558ff141b96333d1..d34870ec0110f5a953320a4fcbb5256d3735c82e 100644 (file)
@@ -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)