]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Spawnfunc whitelist
authorTimePath <andrew.hardaker1995@gmail.com>
Thu, 24 Sep 2015 02:48:07 +0000 (12:48 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Thu, 24 Sep 2015 02:48:07 +0000 (12:48 +1000)
134 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/log.qh
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 d2881e9ba98d8d1ff5336af4a656d5e0143ba4c0..f30c62e21696150ff2267bcbb3030a640ef77cb8 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 ea7fbbf7cc7fb17346ca57bc0a7ba4ed6e8c46a7..3354d2f2007bc7d5a062b7ff2410cb7682a66284 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 fb71c2f22279b199fa8f0f1c518f6de506f88ca5..f2bc7d789514f09e9e7f8ca4fd4770f316beb074 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 8eab200a6d9748d37269910dd06603ec2e1690a3..519a5322e02b0ca9a6235bd0893659477d99d7bc 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 0430db2d4104e49901f32b80549e144f8fcba45c..09ae8002b237211302031b806266bd8388b68ef9 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 228b3f810aa5c3b62b91a8508cbd9a545ddcfcf4..17a30cfd03c61984b984a871fb35ac6120f50fe3 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 8d19a740c26dbd6b6c89dccd0fab7b874abc454b..7abbe08809da076c37610254e03f125a22f7f47d 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 b793228784822068ec579e1b29924c95c5c5a789..10536fd943d7a2a5da40d2f407f536ed1484b9f0 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 3c11b2a5b675cef977ed8a0764871c5bc9c41694..25764f38700dc1524ed40f661ed8cc39125834ac 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 4149b538dcf9b24626e0b5afa279fd5b83e2586b..60c8730eb68bb258c378eba2a9230eb18680dc9d 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..259acab9a551c5a24e129b5d4d8a2dfb28fc0932 100644 (file)
@@ -3,8 +3,8 @@
 .entity chlevel_targ;
 
 
-void spawnfunc_target_changelevel_use()
-{SELFPARAM();
+spawnfunc(target_changelevel_use)
+{
        if(self.spawnflags & 2)
        {
                // simply don't react if a non-player triggers it
@@ -35,9 +35,11 @@ void spawnfunc_target_changelevel_use()
                localcmd(strcat("changelevel ", self.chmap, "\n"));
 }
 
-void spawnfunc_target_changelevel()
-{SELFPARAM();
-       self.use = spawnfunc_target_changelevel_use;
+void _spawnfunc_target_changelevel_use() { SELFPARAM(); spawnfunc_target_changelevel_use(this); }
+
+spawnfunc(target_changelevel)
+{
+       self.use = _spawnfunc_target_changelevel_use;
 
        if(!self.count) { self.count = 0.7; }
 }
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 33261eabdbefc82206a2165da4d382053acddf4b..2c5262885a58c69a7240de4a184eae947199134a 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 e0701dc14f3273487baec91a8d19543f0b1d1e08..42cfe3200565b8b09a3e9d05212bcc1e534241d0 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 659a336901e26665bb0ce56e14e1ee04327a252f..7ce15c2e2f05f579423e872554e29ff3189cc1c3 100644 (file)
@@ -85,8 +85,8 @@ void trigger_gravity_touch()
        }
 }
 
-void spawnfunc_trigger_gravity()
-{SELFPARAM();
+spawnfunc(trigger_gravity)
+{
        if(self.gravity == 1)
                return;
 
index 323a4a160d2fb64cf36523fdfd58f3a624259219..af307a29927f4e596fd78425a402b5d0c026a803 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 5eb25221821def3f73fb5b13d22994f3fb337cd8..dfdcd7b3ae491a52658c0848cfd2d5c1bdabb607 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 17313f0aa85de43dda806660633a4055dcf10a73..7ee7773851ec061789c1b1fb01d8543310af2c7e 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 007e6da2f5e980cfc89a807b338e907edeeba296..ca26d214a9a4a72507861ef9c20f95bd88e77dd0 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)
        {
@@ -202,9 +202,9 @@ sounds
 4)
 set "message" to text string
 */
-void spawnfunc_trigger_once()
-{SELFPARAM();
-       self.wait = -1;
-       spawnfunc_trigger_multiple();
+spawnfunc(trigger_once)
+{
+       this.wait = -1;
+       spawnfunc_trigger_multiple(this);
 }
 #endif
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 e61897cdd8d876d0841076d7443fa782e5518b7e..d4e632c4c18e2ebf41b6852f379e40fbee937563 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)) remove(self); }
+spawnfunc(turret_ewheel) { if(!turret_initialize(TUR_EWHEEL)) remove(self); }
 
 float t_ewheel(float req)
 {SELFPARAM();
index 228049f4114bd6551aec8fdf1fb4073926a0c126..b819ae9507d47e547f00abd538d5a8079eade54c 100644 (file)
@@ -28,7 +28,7 @@ void turret_flac_projectile_think_explode()
     remove(self);
 }
 
-void spawnfunc_turret_flac() { SELFPARAM(); if(!turret_initialize(TUR_FLAC)) remove(self); }
+spawnfunc(turret_flac) { if(!turret_initialize(TUR_FLAC)) remove(self); }
 
 float t_flac(float req)
 {SELFPARAM();
index 3ba1ff07476a9e03e568f395eeb7561b5bfbdc88..c1e2f5d4558220a32955efedb6546f2bb4d4563b 100644 (file)
@@ -40,7 +40,7 @@ bool turret_fusionreactor_firecheck()
     return true;
 }
 
-void spawnfunc_turret_fusionreactor() { SELFPARAM(); if(!turret_initialize(TUR_FUSIONREACTOR)) remove(self); }
+spawnfunc(turret_fusionreactor) { if(!turret_initialize(TUR_FUSIONREACTOR)) remove(self); }
 
 float t_fusionreactor(float req)
 {SELFPARAM();
index f785f4e953e8c9121844dba663a5b88f68a40e76..1b798bbaafce8e764ca05287b946e58c7d7fdfdb 100644 (file)
@@ -76,7 +76,7 @@ void turret_hellion_missile_think()
     UpdateCSQCProjectile(self);
 }
 
-void spawnfunc_turret_hellion() { SELFPARAM(); if(!turret_initialize(TUR_HELLION)) remove(self); }
+spawnfunc(turret_hellion) { if(!turret_initialize(TUR_HELLION)) remove(self); }
 
 float t_hellion(float req)
 {SELFPARAM();
index f01275187db0ab496065187ff155d4713b38fd32..4dcbe9592dff0820d7389f4418bb59df96da32bd 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)) remove(self); }
+spawnfunc(turret_hk) { if(!turret_initialize(TUR_HK)) remove(self); }
 
 float t_hk(float req)
 {SELFPARAM();
index afecb7fa56a377d33f49c9df7ea03e8a799f702c..bde4f560b4b3aa45aa0a04b9a1475d109ce8c0a3 100644 (file)
@@ -11,7 +11,7 @@ REGISTER_TURRET(
 );
 #else
 #ifdef SVQC
-void spawnfunc_turret_machinegun() { SELFPARAM(); if(!turret_initialize(TUR_MACHINEGUN)) remove(self); }
+spawnfunc(turret_machinegun) { if(!turret_initialize(TUR_MACHINEGUN)) remove(self); }
 
 void W_MachineGun_MuzzleFlash(void);
 
index 1a3c9220b84ca48b6fb75d0c9c986901a73955d4..9ae66630756b32c99872a702bb610847ccbddb72 100644 (file)
@@ -11,7 +11,7 @@ REGISTER_TURRET(
 );
 #else
 #ifdef SVQC
-void spawnfunc_turret_mlrs() { SELFPARAM(); if(!turret_initialize(TUR_MLRS)) remove(self); }
+spawnfunc(turret_mlrs) { if(!turret_initialize(TUR_MLRS)) remove(self); }
 
 float t_mlrs(float req)
 {SELFPARAM();
index e1ddef3a9d359292e2e0ff09508e3b1e04681070..ca947623e106afaf76421c8112feb109ac5db04c 100644 (file)
@@ -57,7 +57,7 @@ void beam_think()
 
 }
 
-void spawnfunc_turret_phaser() { SELFPARAM(); if(!turret_initialize(TUR_PHASER)) remove(self); }
+spawnfunc(turret_phaser) { if(!turret_initialize(TUR_PHASER)) remove(self); }
 
 float t_phaser(float req)
 {SELFPARAM();
index df986d79e04b8bd1ffab31babf101ad596f2abdb..36966a1ae2f68e6741d39540e03ff6c63ce4cf1b 100644 (file)
@@ -11,7 +11,7 @@ REGISTER_TURRET(
 );
 #else
 #ifdef SVQC
-void spawnfunc_turret_plasma() { SELFPARAM(); if(!turret_initialize(TUR_PLASMA)) remove(self); }
+spawnfunc(turret_plasma) { if(!turret_initialize(TUR_PLASMA)) remove(self); }
 
 float t_plasma(float req)
 {SELFPARAM();
index f3bd32448f40538a94fc72243b95c118453e4aeb..6469c0591d3d1a16d1fdb769f2479e86b82b3252 100644 (file)
@@ -11,7 +11,7 @@ REGISTER_TURRET(
 );
 #else
 #ifdef SVQC
-void spawnfunc_turret_plasma_dual() { SELFPARAM(); if(!turret_initialize(TUR_PLASMA_DUAL)) remove(self); }
+spawnfunc(turret_plasma_dual) { if(!turret_initialize(TUR_PLASMA_DUAL)) remove(self); }
 
 float t_plasma_dual(float req)
 {SELFPARAM();
index 50e37182c3a6ce0a143b6fc8975bd2f89a9fce84..76f8083a9a82312bbe0b1e833daa4c949b04a1a7 100644 (file)
@@ -89,7 +89,7 @@ float turret_tesla_firecheck()
     return 0;
 }
 
-void spawnfunc_turret_tesla() { SELFPARAM(); if(!turret_initialize(TUR_TESLA)) remove(self); }
+spawnfunc(turret_tesla) { if(!turret_initialize(TUR_TESLA)) remove(self); }
 
 float t_tesla(float req)
 {SELFPARAM();
index 9e7b0cbe136255a0fd4a9a86c8a24d2db8165732..ceacde8c2a62d7d021f9413eea59d1e107cdfd1b 100644 (file)
@@ -334,7 +334,7 @@ void walker_move_path()
 #endif
 }
 
-void spawnfunc_turret_walker() { SELFPARAM(); if(!turret_initialize(TUR_WALKER)) remove(self); }
+spawnfunc(turret_walker) { if(!turret_initialize(TUR_WALKER)) remove(self); }
 
 float t_walker(float req)
 {SELFPARAM();
index 96fef6c05c2cafb02f25be443b6803c84e95fbac..fb06eabf517cde511955f8b9df82368e738fa1ce 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 62a6e850fdb2c4bcc1c2b7f5bb029b39d6451889..1422ab83af47141da0c9741c41d0ac7e1a64de18 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 96a84892cfb43cb02aabf6778df63f718729e5f4..0108a3e707560d502d0bc54938263032daeca9c8 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 7d03c7736f9547e99f18710a55b52ecd19581901..d2d99e1e6707f3543afe95915f9d68c7244ffb31 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 a6a073099664a9afd8a5aef2ceefdc445faf78b9..cf117c823f2fb25468ee2bac11c9191109b9558a 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 b20713c029d0f2464133a96a031a7002edb90d14..e91f424c16a684850c2bc03eb35a5513662401bb 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 6821d5a0e1adbf98999c7542fd26aafccf6857e7..3801b0b53c9cd57073a9704873083bf29479913d 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 cb2d16659c4b2e71fd518e4d58261beb580cfd22..149dbe4dd2f1a063e81678bf7d4b684c46e1c2cb 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 7f02a00ce2013542972aae39d2674b564ed53a09..6ff7229d403f7d0e2ca5e1602350d3fda88607e2 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 a37ae8f0997c4bc825ec7a7b01f99d4cbf5110e0..f2c8c64acf6eb3a4e02c5257930d57f5b4a310f0 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 d55a1b6072e3943369e5b64d71715f56da4e83a3..29ec6b78df99b259557526ee2af33e463549c90b 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 074b76053882051306d3daac23a1f78f127537d1..034a2502d422b18605069cc97faf55c4148a61cc 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 c55304118b678a4e9f1e60fb8f4e209d9efb8e2f..18e07204af65e820b1931e7f85896a8faca5b6ef 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 b7f51b54c4319c66590ef942576399b2a898ddd4..3828bdb1eb84263ff867e078e3f83ee58246106c 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 01efced0f5b1f1bca56f31ff70cb674d2d8f44aa..61f9210d902cfa56ddfa576292d8f11211d6e4ca 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 1c7e89fde2924574374d1399b4df8ab8763f973f..d1212d6a124fa4c90e4bfdb442d3fd07a23d2bec 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 d03eb8e565d4080cdf16200dc467ee5f7acff880..b766b1c3392025573230ae98e0b4444fdbf6f14b 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 58c28716aebc025c15edfb5656beb79f4eca7879..4438c5d83954c9ef61ae6537f585ed189055373d 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 66be38175f19fbabf8e57fde0e58ae93860411ae..69e325d8ef636fa9c9ec1e8f833ab907038fdb50 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 51c0404405eef0a110ffc40376189f11dc848808..a8509c15e2b137640355378cc85efa3823fe84db 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 0687437afb10ad9e685c1a280d9f59c4a3a33073..d3d8ac3c7328c91fc842e8f3323f335b8c5b0060 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 b56a41fbbf25151c3275b9c6b5d80383f3367ac7..de8f34777b4e0185ac068f36b62d305da5f68c04 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 814d5730368d3ec40c1bb3c405efee9a492d001e..ce93321a94709cfb0ff19d443fa687d978b75e6c 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 13c3fef8c691c228a1d55cbc5e6784df94d157b4..edc7079d9aad13d33a0b3ab51e9aafe01754b6e9 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 2e515137c59ab5ff64eacf07775c3b4465469f0d..5e7cc479c267047e938e34dc8d738960f2a97397 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 aa541bd69e28204a0c0c074a3c298ace20fcd38c..2b15e8acb4b0d60f5e5457953aca656295e1716c 100644 (file)
@@ -20,6 +20,7 @@
 #include "progname.qh"
 #include "registry.qh"
 #include "sortlist.qc"
+#include "spawnfunc.qh"
 #include "static.qh"
 #include "string.qh"
 #include "struct.qh"
index f74dd4aa2ed49a252583d4a9a4fc42c5471819ac..3d186e38945ea267fe4fac3456aa1f3c690eb6de 100644 (file)
@@ -59,4 +59,6 @@ noref bool autocvar_prvm_backtraceforwarnings;
     cvar_set("prvm_backtraceforwarnings", ftos(war)); \
 } while (0)
 
+#define ASSERT(expr) do { if (!(expr)) LOG_FATAL("assertion failed: " #expr "\n"); } while (0)
+
 #endif
diff --git a/qcsrc/lib/spawnfunc.qh b/qcsrc/lib/spawnfunc.qh
new file mode 100644 (file)
index 0000000..e443552
--- /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"), fieldname, #id, value); \
+        } \
+        this.spawnfunc_checked = true; \
+    } \
+} \
+[[accumulate]] void spawnfunc_##id(entity this)
+
+#define FIELD_SCALAR(fld, n) \
+    fld(n)
+#define FIELD_VEC(fld, n) \
+    fld(n) \
+    fld(n##_x) \
+    fld(n##_y) \
+    fld(n##_z)
+
+#define FIELDS_NONE(fld)
+#define FIELDS_ALL(fld) if (false)
+
+#define FIELDS_COMMON(fld) \
+    FIELD_SCALAR(fld, classname) \
+    FIELD_SCALAR(fld, spawnfunc_checked) \
+    /**/
+
+#define FIELDS_UNION(fld) \
+    FIELD_SCALAR(fld, Version) \
+    FIELD_SCALAR(fld, ammo_cells) \
+    FIELD_SCALAR(fld, ammo_nails) \
+    FIELD_SCALAR(fld, ammo_rockets) \
+    FIELD_SCALAR(fld, armorvalue) \
+    FIELD_SCALAR(fld, atten) \
+    FIELD_SCALAR(fld, bgmscriptdecay) \
+    FIELD_SCALAR(fld, bgmscriptsustain) \
+    FIELD_SCALAR(fld, bgmscript) \
+    FIELD_SCALAR(fld, button0) \
+    FIELD_SCALAR(fld, cnt) \
+    FIELD_SCALAR(fld, colormap) \
+    FIELD_SCALAR(fld, count) \
+    FIELD_SCALAR(fld, debrisdamageforcescale) \
+    FIELD_SCALAR(fld, debrisfadetime) \
+    FIELD_SCALAR(fld, debristimejitter) \
+    FIELD_SCALAR(fld, debristime) \
+    FIELD_SCALAR(fld, debris) \
+    FIELD_SCALAR(fld, delay) \
+    FIELD_SCALAR(fld, dmg) \
+    FIELD_SCALAR(fld, dmg_edge) \
+    FIELD_SCALAR(fld, dmg_force) \
+    FIELD_SCALAR(fld, dmg_radius) \
+    FIELD_SCALAR(fld, effects) \
+    FIELD_SCALAR(fld, flags) \
+    FIELD_SCALAR(fld, fog) \
+    FIELD_SCALAR(fld, frame) \
+    FIELD_SCALAR(fld, gametypefilter) \
+    FIELD_SCALAR(fld, gravity) \
+    FIELD_SCALAR(fld, health) \
+    FIELD_SCALAR(fld, height) \
+    FIELD_SCALAR(fld, impulse) \
+    FIELD_SCALAR(fld, killtarget) \
+    FIELD_SCALAR(fld, lerpfrac) \
+    FIELD_SCALAR(fld, light_lev) \
+    FIELD_SCALAR(fld, lip) \
+    FIELD_SCALAR(fld, loddistance1) \
+    FIELD_SCALAR(fld, lodmodel1) \
+    FIELD_SCALAR(fld, ltime) \
+    FIELD_SCALAR(fld, mdl) \
+    FIELD_SCALAR(fld, message2) \
+    FIELD_SCALAR(fld, message) \
+    FIELD_SCALAR(fld, modelindex) \
+    FIELD_SCALAR(fld, modelscale) \
+    FIELD_SCALAR(fld, model) \
+    FIELD_SCALAR(fld, movetype) \
+    FIELD_SCALAR(fld, netname) \
+    FIELD_SCALAR(fld, nextthink) \
+    FIELD_SCALAR(fld, noalign) \
+    FIELD_SCALAR(fld, noise1) \
+    FIELD_SCALAR(fld, noise2) \
+    FIELD_SCALAR(fld, noise) \
+    FIELD_SCALAR(fld, phase) \
+    FIELD_SCALAR(fld, race_place) \
+    FIELD_SCALAR(fld, radius) \
+    FIELD_SCALAR(fld, respawntimejitter) \
+    FIELD_SCALAR(fld, respawntime) \
+    FIELD_SCALAR(fld, restriction) \
+    FIELD_SCALAR(fld, scale) \
+    FIELD_SCALAR(fld, skin) \
+    FIELD_SCALAR(fld, solid) \
+    FIELD_SCALAR(fld, sound1) \
+    FIELD_SCALAR(fld, sounds) \
+    FIELD_SCALAR(fld, spawnflags) \
+    FIELD_SCALAR(fld, speed) \
+    FIELD_SCALAR(fld, strength) \
+    FIELD_SCALAR(fld, target2) \
+    FIELD_SCALAR(fld, target3) \
+    FIELD_SCALAR(fld, target4) \
+    FIELD_SCALAR(fld, targetname) \
+    FIELD_SCALAR(fld, target) \
+    FIELD_SCALAR(fld, target_random) \
+    FIELD_SCALAR(fld, team) \
+    FIELD_SCALAR(fld, turret_scale_health) \
+    FIELD_SCALAR(fld, turret_scale_range) \
+    FIELD_SCALAR(fld, turret_scale_respawn) \
+    FIELD_SCALAR(fld, volume) \
+    FIELD_SCALAR(fld, wait) \
+    FIELD_SCALAR(fld, warpzone_fadeend) \
+    FIELD_SCALAR(fld, warpzone_fadestart) \
+    FIELD_VEC(fld, absmax) \
+    FIELD_VEC(fld, absmin) \
+    FIELD_VEC(fld, angles) \
+    FIELD_VEC(fld, avelocity) \
+    FIELD_VEC(fld, maxs) \
+    FIELD_VEC(fld, maxs) \
+    FIELD_VEC(fld, mins) \
+    FIELD_VEC(fld, modelscale_vec) \
+    FIELD_VEC(fld, origin) \
+    FIELD_VEC(fld, velocity) \
+    /**/
+
+#define spawnfunc(...) EVAL(OVERLOAD(spawnfunc, __VA_ARGS__, FIELDS_UNION))
+
+#endif
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 26af000d2d52f0d5bcc4a1050c235585a1d883c5..0721d05fc20f76d97e881a3508ea3b4a2e9ee11e 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 5072e49002be11ab6a1dd845cbfacce27a75ed58..82d6e7b6bc14647d7a94cd17604cc78e7c093f6b 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 b5a2806d76d7a5756ad55a656c29951f8dd23514..635b0d8e8fd0ae9071a18f347d1c1798a801929b 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;
 
@@ -920,8 +920,8 @@ void spawnfunc_worldspawn (void)
        world_initialized = 1;
 }
 
-void spawnfunc_light (void)
-{SELFPARAM();
+spawnfunc(light)
+{
        //makestatic (self); // Who the f___ did that?
        remove(self);
 }
index 6a1527745e3f368eab3c35715790dffbf216bff7..f25879c8828fd4ca04144728153242c5395dac66 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 060752c111d93d7e353ca6b265408cf71f474283..db93a4321d53ad107a8a8a5a725ce61237332889 100644 (file)
@@ -2251,8 +2251,8 @@ Keys:
 "noise3" sound played when flag is lost in the field and respawns itself...
 "noise4" sound played when flag is dropped by a player...
 "noise5" sound played when flag touches the ground... */
-void spawnfunc_item_flag_team1()
-{SELFPARAM();
+spawnfunc(item_flag_team1)
+{
        if(!g_ctf) { remove(self); return; }
 
        ctf_FlagSetup(NUM_TEAM_1, self);
@@ -2269,8 +2269,8 @@ Keys:
 "noise3" sound played when flag is lost in the field and respawns itself...
 "noise4" sound played when flag is dropped by a player...
 "noise5" sound played when flag touches the ground... */
-void spawnfunc_item_flag_team2()
-{SELFPARAM();
+spawnfunc(item_flag_team2)
+{
        if(!g_ctf) { remove(self); return; }
 
        ctf_FlagSetup(NUM_TEAM_2, self);
@@ -2287,8 +2287,8 @@ Keys:
 "noise3" sound played when flag is lost in the field and respawns itself...
 "noise4" sound played when flag is dropped by a player...
 "noise5" sound played when flag touches the ground... */
-void spawnfunc_item_flag_team3()
-{SELFPARAM();
+spawnfunc(item_flag_team3)
+{
        if(!g_ctf) { remove(self); return; }
 
        ctf_FlagSetup(NUM_TEAM_3, self);
@@ -2305,8 +2305,8 @@ Keys:
 "noise3" sound played when flag is lost in the field and respawns itself...
 "noise4" sound played when flag is dropped by a player...
 "noise5" sound played when flag touches the ground... */
-void spawnfunc_item_flag_team4()
-{SELFPARAM();
+spawnfunc(item_flag_team4)
+{
        if(!g_ctf) { remove(self); return; }
 
        ctf_FlagSetup(NUM_TEAM_4, self);
@@ -2323,8 +2323,8 @@ Keys:
 "noise3" sound played when flag is lost in the field and respawns itself...
 "noise4" sound played when flag is dropped by a player...
 "noise5" sound played when flag touches the ground... */
-void spawnfunc_item_flag_neutral()
-{SELFPARAM();
+spawnfunc(item_flag_neutral)
+{
        if(!g_ctf) { remove(self); return; }
        if(!cvar("g_ctf_oneflag")) { remove(self); return; }
 
@@ -2337,8 +2337,8 @@ Note: If you use spawnfunc_ctf_team entities you must define at least 2!  Howeve
 Keys:
 "netname" Name of the team (for example Red, Blue, Green, Yellow, Life, Death, Offense, Defense, etc)...
 "cnt" Scoreboard color of the team (for example 4 is red and 13 is blue)... */
-void spawnfunc_ctf_team()
-{SELFPARAM();
+spawnfunc(ctf_team)
+{
        if(!g_ctf) { remove(self); return; }
 
        self.classname = "ctf_team";
@@ -2346,15 +2346,15 @@ void spawnfunc_ctf_team()
 }
 
 // compatibility for quake maps
-void spawnfunc_team_CTF_redflag()    { spawnfunc_item_flag_team1();    }
-void spawnfunc_team_CTF_blueflag()   { spawnfunc_item_flag_team2();    }
-void spawnfunc_team_CTF_redplayer()  { spawnfunc_info_player_team1();  }
-void spawnfunc_team_CTF_blueplayer() { spawnfunc_info_player_team2();  }
-void spawnfunc_team_CTF_redspawn()   { spawnfunc_info_player_team1();  }
-void spawnfunc_team_CTF_bluespawn()  { spawnfunc_info_player_team2();  }
+spawnfunc(team_CTF_redflag)    { spawnfunc_item_flag_team1(this);    }
+spawnfunc(team_CTF_blueflag)   { spawnfunc_item_flag_team2(this);    }
+spawnfunc(team_CTF_redplayer)  { spawnfunc_info_player_team1(this);  }
+spawnfunc(team_CTF_blueplayer) { spawnfunc_info_player_team2(this);  }
+spawnfunc(team_CTF_redspawn)   { spawnfunc_info_player_team1(this);  }
+spawnfunc(team_CTF_bluespawn)  { spawnfunc_info_player_team2(this);  }
 
-void team_CTF_neutralflag()                     { spawnfunc_item_flag_neutral();  }
-void team_neutralobelisk()                      { spawnfunc_item_flag_neutral();  }
+void team_CTF_neutralflag()                     { SELFPARAM(); spawnfunc_item_flag_neutral(self);  }
+void team_neutralobelisk()                      { SELFPARAM(); spawnfunc_item_flag_neutral(self);  }
 
 
 // ==============
@@ -2378,15 +2378,12 @@ void ctf_ScoreRules(int teams)
 
 // code from here on is just to support maps that don't have flag and team entities
 void ctf_SpawnTeam (string teamname, int teamcolor)
-{SELFPARAM();
-       setself(spawn());
-       self.classname = "ctf_team";
-       self.netname = teamname;
-       self.cnt = teamcolor;
-
-       spawnfunc_ctf_team();
-
-       setself(this);
+{
+       entity this = new(ctf_team);
+       this.netname = teamname;
+       this.cnt = teamcolor;
+       this.spawnfunc_checked = true;
+       WITH(entity, self, this, spawnfunc_ctf_team(this));
 }
 
 void ctf_DelayedInit() // Do this check with a delay so we can wait for teams to be set up.
index 6fa778309f44f1b22a09bf55a844f1a773248a2e..50d644836c46cc9a865fbaef32cc75168cd893aa 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 e3480a42e037dcdbf956b58e3daa2ab2eac893c9..0227f96875cb3ce35a1939f09c92cf15016c7625 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 = "misc/typehit.wav";
        SpawnGoal();
 }
 
-void spawnfunc_nexball_out(void)
-{SELFPARAM();
+spawnfunc(nexball_out)
+{
        self.team = GOAL_OUT;
        if(self.noise == "")
                self.noise = "misc/typehit.wav";
@@ -639,34 +639,34 @@ void spawnfunc_nexball_out(void)
 //Spawnfuncs preserved for compatibility
 //
 
-void spawnfunc_ball(void)
+spawnfunc(ball)
 {
-       spawnfunc_nexball_football();
+       spawnfunc_nexball_football(this);
 }
-void spawnfunc_ball_football(void)
+spawnfunc(ball_football)
 {
-       spawnfunc_nexball_football();
+       spawnfunc_nexball_football(this);
 }
-void spawnfunc_ball_basketball(void)
+spawnfunc(ball_basketball)
 {
-       spawnfunc_nexball_basketball();
+       spawnfunc_nexball_basketball(this);
 }
 // The "red goal" is defended by blue team. A ball in there counts as a point for red.
-void spawnfunc_ball_redgoal(void)
+spawnfunc(ball_redgoal)
 {
-       spawnfunc_nexball_bluegoal();   // I blame Revenant
+       spawnfunc_nexball_bluegoal(this);       // I blame Revenant
 }
-void spawnfunc_ball_bluegoal(void)
+spawnfunc(ball_bluegoal)
 {
-       spawnfunc_nexball_redgoal();    // but he didn't mean to cause trouble :p
+       spawnfunc_nexball_redgoal(this);        // but he didn't mean to cause trouble :p
 }
-void spawnfunc_ball_fault(void)
+spawnfunc(ball_fault)
 {
-       spawnfunc_nexball_fault();
+       spawnfunc_nexball_fault(this);
 }
-void spawnfunc_ball_bound(void)
+spawnfunc(ball_bound)
 {
-       spawnfunc_nexball_out();
+       spawnfunc_nexball_out(this);
 }
 
 //=======================//
index e5d127748bb33edf212a67f98100865c698d1c38..9d88f70698796e6928de7890f56388bf2a9c8440 100644 (file)
@@ -2044,8 +2044,8 @@ keys:
 "target" - first control point.
 "target2" - second control point.
  */
-void spawnfunc_onslaught_link()
-{SELFPARAM();
+spawnfunc(onslaught_link)
+{
        if(!g_onslaught) { remove(self); return; }
 
        if (self.target == "" || self.target2 == "")
@@ -2069,8 +2069,8 @@ keys:
 "message" - name of this control point (should reflect the location in the map, such as "center bridge", "north tower", etc)
  */
 
-void spawnfunc_onslaught_controlpoint()
-{SELFPARAM();
+spawnfunc(onslaught_controlpoint)
+{
        if(!g_onslaught) { remove(self); return; }
 
        ons_ControlPoint_Setup(self);
@@ -2085,8 +2085,8 @@ keys:
 "team" - team that owns this generator (5 = red, 14 = blue, etc), MUST BE SET.
 "targetname" - name that spawnfunc_onslaught_link entities will use to target this.
  */
-void spawnfunc_onslaught_generator()
-{SELFPARAM();
+spawnfunc(onslaught_generator)
+{
        if(!g_onslaught) { remove(self); return; }
        if(!self.team) { objerror("team must be set"); }
 
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 7488fd29547f63a580db12efa28753aff847c9e8..938b9873513fa71701930f05b558810868fc5a6c 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 5b7018b303c595be7813fe4e666625c34030346c..33df11312ca2a0552de865af256de10844270db3 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 0fbbf2732ed8545401b320a2fc00ec39c74ee1a5..c256d4df9022dc6a9fa7b8de864f2506737603fb 100644 (file)
@@ -1209,8 +1209,8 @@ void StartItemA (entity a)
     StartItem(Item_Model(a.m_model), a.m_sound, a.m_respawntime(), a.m_respawntimejitter(), a.m_name, a.m_itemid, 0, a.m_itemflags, a.m_pickupevalfunc, a.m_botvalue);
 }
 
-void spawnfunc_item_rockets()
-{SELFPARAM();
+spawnfunc(item_rockets)
+{
        if(!self.ammo_rockets)
                self.ammo_rockets = g_pickup_rockets;
        if(!self.pickup_anyway)
@@ -1218,14 +1218,14 @@ void spawnfunc_item_rockets()
     StartItemA (ITEM_Rockets);
 }
 
-void spawnfunc_item_bullets()
-{SELFPARAM();
+spawnfunc(item_bullets)
+{
        if(!weaponswapping)
        if(autocvar_sv_q3acompat_machineshotgunswap)
        if(self.classname != "droppedweapon")
        {
                weaponswapping = true;
-               spawnfunc_item_shells();
+               spawnfunc_item_shells(this);
                weaponswapping = false;
                return;
        }
@@ -1237,8 +1237,8 @@ void spawnfunc_item_bullets()
     StartItemA (ITEM_Bullets);
 }
 
-void spawnfunc_item_cells()
-{SELFPARAM();
+spawnfunc(item_cells)
+{
        if(!self.ammo_cells)
                self.ammo_cells = g_pickup_cells;
        if(!self.pickup_anyway)
@@ -1246,8 +1246,8 @@ void spawnfunc_item_cells()
        StartItemA (ITEM_Cells);
 }
 
-void spawnfunc_item_plasma()
-{SELFPARAM();
+spawnfunc(item_plasma)
+{
        if(!self.ammo_plasma)
                self.ammo_plasma = g_pickup_plasma;
        if(!self.pickup_anyway)
@@ -1255,14 +1255,14 @@ void spawnfunc_item_plasma()
        StartItemA (ITEM_Plasma);
 }
 
-void spawnfunc_item_shells()
-{SELFPARAM();
+spawnfunc(item_shells)
+{
        if(!weaponswapping)
        if(autocvar_sv_q3acompat_machineshotgunswap)
        if(self.classname != "droppedweapon")
        {
                weaponswapping = true;
-               spawnfunc_item_bullets();
+               spawnfunc_item_bullets(this);
                weaponswapping = false;
                return;
        }
@@ -1274,8 +1274,8 @@ void spawnfunc_item_shells()
        StartItemA (ITEM_Shells);
 }
 
-void spawnfunc_item_armor_small()
-{SELFPARAM();
+spawnfunc(item_armor_small)
+{
        if(!self.armorvalue)
                self.armorvalue = g_pickup_armorsmall;
        if(!self.max_armorvalue)
@@ -1285,8 +1285,8 @@ void spawnfunc_item_armor_small()
        StartItemA (ITEM_ArmorSmall);
 }
 
-void spawnfunc_item_armor_medium()
-{SELFPARAM();
+spawnfunc(item_armor_medium)
+{
        if(!self.armorvalue)
                self.armorvalue = g_pickup_armormedium;
        if(!self.max_armorvalue)
@@ -1296,8 +1296,8 @@ void spawnfunc_item_armor_medium()
        StartItemA (ITEM_ArmorMedium);
 }
 
-void spawnfunc_item_armor_big()
-{SELFPARAM();
+spawnfunc(item_armor_big)
+{
        if(!self.armorvalue)
                self.armorvalue = g_pickup_armorbig;
        if(!self.max_armorvalue)
@@ -1307,8 +1307,8 @@ void spawnfunc_item_armor_big()
        StartItemA (ITEM_ArmorLarge);
 }
 
-void spawnfunc_item_armor_large()
-{SELFPARAM();
+spawnfunc(item_armor_large)
+{
        if(!self.armorvalue)
                self.armorvalue = g_pickup_armorlarge;
        if(!self.max_armorvalue)
@@ -1318,8 +1318,8 @@ void spawnfunc_item_armor_large()
        StartItemA (ITEM_ArmorMega);
 }
 
-void spawnfunc_item_health_small()
-{SELFPARAM();
+spawnfunc(item_health_small)
+{
        if(!self.max_health)
                self.max_health = g_pickup_healthsmall_max;
        if(!self.health)
@@ -1329,8 +1329,8 @@ void spawnfunc_item_health_small()
        StartItemA (ITEM_HealthSmall);
 }
 
-void spawnfunc_item_health_medium()
-{SELFPARAM();
+spawnfunc(item_health_medium)
+{
        if(!self.max_health)
                self.max_health = g_pickup_healthmedium_max;
        if(!self.health)
@@ -1340,8 +1340,8 @@ void spawnfunc_item_health_medium()
     StartItemA (ITEM_HealthMedium);
 }
 
-void spawnfunc_item_health_large()
-{SELFPARAM();
+spawnfunc(item_health_large)
+{
        if(!self.max_health)
                self.max_health = g_pickup_healthlarge_max;
        if(!self.health)
@@ -1351,8 +1351,8 @@ void spawnfunc_item_health_large()
        StartItemA (ITEM_HealthLarge);
 }
 
-void spawnfunc_item_health_mega()
-{SELFPARAM();
+spawnfunc(item_health_mega)
+{
     if(!self.max_health)
         self.max_health = g_pickup_healthmega_max;
     if(!self.health)
@@ -1363,29 +1363,29 @@ void spawnfunc_item_health_mega()
 }
 
 // support old misnamed entities
-void spawnfunc_item_armor1() { spawnfunc_item_armor_small(); }  // FIXME: in Quake this is green armor, in Xonotic maps it is an armor shard
-void spawnfunc_item_armor25() { spawnfunc_item_armor_large(); }
-void spawnfunc_item_health1() { spawnfunc_item_health_small(); }
-void spawnfunc_item_health25() { spawnfunc_item_health_medium(); }
-void spawnfunc_item_health100() { spawnfunc_item_health_mega(); }
+spawnfunc(item_armor1) { spawnfunc_item_armor_small(this); }  // FIXME: in Quake this is green armor, in Xonotic maps it is an armor shard
+spawnfunc(item_armor25) { spawnfunc_item_armor_large(this); }
+spawnfunc(item_health1) { spawnfunc_item_health_small(this); }
+spawnfunc(item_health25) { spawnfunc_item_health_medium(this); }
+spawnfunc(item_health100) { spawnfunc_item_health_mega(this); }
 
-void spawnfunc_item_strength()
-{SELFPARAM();
+spawnfunc(item_strength)
+{
                precache_sound("weapons/strength_fire.wav");
                if(!self.strength_finished)
                        self.strength_finished = autocvar_g_balance_powerup_strength_time;
                StartItemA (ITEM_Strength);
 }
 
-void spawnfunc_item_invincible()
-{SELFPARAM();
+spawnfunc(item_invincible)
+{
                if(!self.invincible_finished)
                        self.invincible_finished = autocvar_g_balance_powerup_invincible_time;
                StartItemA (ITEM_Shield);
 }
 
 // compatibility:
-void spawnfunc_item_quad() {SELFPARAM(); self.classname = "item_strength";spawnfunc_item_strength();}
+spawnfunc(item_quad) { self.classname = "item_strength";spawnfunc_item_strength(this);}
 
 void target_items_use()
 {SELFPARAM();
@@ -1411,8 +1411,8 @@ void target_items_use()
                centerprint(activator, self.message);
 }
 
-void spawnfunc_target_items (void)
-{SELFPARAM();
+spawnfunc(target_items)
+{
        float n, i, j;
        entity e;
        string s;
@@ -1536,8 +1536,8 @@ void spawnfunc_target_items (void)
        }
 }
 
-void spawnfunc_item_fuel(void)
-{SELFPARAM();
+spawnfunc(item_fuel)
+{
        if(!self.ammo_fuel)
                self.ammo_fuel = g_pickup_fuel;
        if(!self.pickup_anyway)
@@ -1545,23 +1545,23 @@ void spawnfunc_item_fuel(void)
        StartItemA (ITEM_JetpackFuel);
 }
 
-void spawnfunc_item_fuel_regen(void)
+spawnfunc(item_fuel_regen)
 {
        if(start_items & ITEM_JetpackRegen.m_itemid)
        {
-               spawnfunc_item_fuel();
+               spawnfunc_item_fuel(this);
                return;
        }
        StartItemA (ITEM_JetpackRegen);
 }
 
-void spawnfunc_item_jetpack(void)
-{SELFPARAM();
+spawnfunc(item_jetpack)
+{
        if(!self.ammo_fuel)
                self.ammo_fuel = g_pickup_fuel_jetpack;
        if(start_items & ITEM_Jetpack.m_itemid)
        {
-               spawnfunc_item_fuel();
+               spawnfunc_item_fuel(this);
                return;
        }
        StartItemA (ITEM_Jetpack);
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)