]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Convert remaining calls
authorTimePath <andrew.hardaker1995@gmail.com>
Sat, 15 Aug 2015 10:00:31 +0000 (20:00 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Sat, 15 Aug 2015 10:00:31 +0000 (20:00 +1000)
qcsrc/server/bot/aim.qc
qcsrc/server/bot/havocbot/roles.qc
qcsrc/server/cheats.qc
qcsrc/server/cl_client.qc
qcsrc/server/cl_impulse.qc
qcsrc/server/mutators/base.qh
qcsrc/server/t_items.qc
qcsrc/server/vehicles/bumblebee.qc
qcsrc/server/vehicles/vehicle.qc
qcsrc/server/weapons/accuracy.qc

index c889a2f9aaf8a540af01cacd2ee588f83c9ae99a..e0dbdae26875b5537345ccd77ad359ec56998e45 100644 (file)
@@ -143,8 +143,7 @@ float bot_shouldattack(entity e)
        if(e.flags & FL_NOTARGET)
                return false;
 
-       checkentity = e;
-       if(MUTATOR_CALLHOOK(BotShouldAttack))
+       if(MUTATOR_CALLHOOK(BotShouldAttack, e))
                return false;
 
        return true;
index 65ea2a809b6be9d105d88ab5d1bd272952bf9028..df6b8de91201aaa1e12923de875f78b9b89378c3 100644 (file)
@@ -242,7 +242,7 @@ void havocbot_chooserole()
 {
        dprint("choosing a role...\n");
        self.bot_strategytime = 0;
-       if (MUTATOR_CALLHOOK(HavocBot_ChooseRole))
+       if (MUTATOR_CALLHOOK(HavocBot_ChooseRole, self))
                return;
        else if (g_keyhunt)
                havocbot_chooserole_kh();
index 0c6fc7f39d483e7b0b931e18f25360fbc4730392..eb5538319ab8c0ba9a2fa161bdab091c80aead79 100644 (file)
@@ -212,7 +212,7 @@ float CheatImpulse(float i)
                                        self.angles = self.personal.v_angle;
                                        self.fixangle = true;
 
-                                       MUTATOR_CALLHOOK(AbortSpeedrun);
+                                       MUTATOR_CALLHOOK(AbortSpeedrun, self);
                                }
 
                                self.ammo_rockets = self.personal.ammo_rockets;
index b2080b76d2b72cf57c873379bc2f937548507b01..aa02de5b0e8d6d30fe51daa46d205649b3869997 100644 (file)
@@ -1279,7 +1279,7 @@ void ClientConnect (void)
                self = oldself;
        }
 
-       MUTATOR_CALLHOOK(ClientConnect);
+       MUTATOR_CALLHOOK(ClientConnect, self);
 }
 /*
 =============
index bb4c171c87272a7ce10cba28b78a3654b17e01fc..f37e8a462a4a719a22e32a0b7d96d58ce292b0fe 100644 (file)
@@ -186,7 +186,7 @@ void ImpulseCommands (void)
                        case 33:
                                if(self.deadflag == DEAD_NO && teamplay)
                                {
-                                       if (!MUTATOR_CALLHOOK(HelpMePing))
+                                       if (!MUTATOR_CALLHOOK(HelpMePing, self))
                                        {
                                                wp = WaypointSprite_Attach("helpme", true, RADARICON_HELPME, '1 0.5 0');
                                                if(!wp)
index 9ffd08e8ca35e8842f48465afd3d575aa28a6b2c..c12050caf81a384984be47024dd4cd4bd8ef8d2e 100644 (file)
@@ -450,84 +450,117 @@ MUTATOR_HOOKABLE(Item_Spawn, EV_Item_Spawn);
 MUTATOR_HOOKABLE(SetWeaponreplace, EV_SetWeaponreplace);
 
 /** called when an item is about to respawn */
-MUTATOR_HOOKABLE(Item_RespawnCountdown, EV_NO_ARGS);
-       // INPUT+OUTPUT:
-       string item_name;
-       vector item_color;
+#define EV_Item_RespawnCountdown(i, o) \
+    /**/ i(string, item_name) \
+    /**/ o(string, item_name) \
+    /**/ i(vector, item_color) \
+    /**/ o(vector, item_color) \
+    /**/
+string item_name;
+vector item_color;
+MUTATOR_HOOKABLE(Item_RespawnCountdown, EV_Item_RespawnCountdown);
 
 /** called when a bot checks a target to attack */
-MUTATOR_HOOKABLE(BotShouldAttack, EV_NO_ARGS);
-       // INPUT
-       entity checkentity;
+#define EV_BotShouldAttack(i, o) \
+    /**/ i(entity, checkentity) \
+    /**/
+entity checkentity;
+MUTATOR_HOOKABLE(BotShouldAttack, EV_BotShouldAttack);
 
 /**
  * called whenever a player goes through a portal gun teleport
  * allows you to strip a player of an item if they go through the teleporter to help prevent cheating
  */
- #define EV_PortalTeleport(i, o) \
-     /**/ i(entity, self) \
-     /**/
+#define EV_PortalTeleport(i, o) \
+    /**/ i(entity, self) \
+    /**/
 MUTATOR_HOOKABLE(PortalTeleport, EV_PortalTeleport);
 
-MUTATOR_HOOKABLE(HelpMePing, EV_NO_ARGS);
-       // called whenever a player uses impulse 33 (help me) in cl_impulse.qc
-       // normally help me ping uses self.waypointsprite_attachedforcarrier,
-       // but if your mutator uses something different then you can handle it
-       // in a special manner using this hook
-       // INPUT
-//     entity self; // the player who pressed impulse 33
+/**
+ * called whenever a player uses impulse 33 (help me) in cl_impulse.qc
+ * normally help me ping uses self.waypointsprite_attachedforcarrier,
+ * but if your mutator uses something different then you can handle it
+ * in a special manner using this hook
+ */
+#define EV_HelpMePing(i, o) \
+    /** the player who pressed impulse 33 */ i(entity, self) \
+    /**/
+MUTATOR_HOOKABLE(HelpMePing, EV_HelpMePing);
 
+/**
+ * called when a vehicle initializes
+ * return true to remove the vehicle
+ */
 MUTATOR_HOOKABLE(VehicleSpawn, EV_NO_ARGS);
-       // called when a vehicle initializes
-       // return true to remove the vehicle
-
-MUTATOR_HOOKABLE(VehicleEnter, EV_NO_ARGS);
-       // called when a player enters a vehicle
-       // allows mutators to set special settings in this event
-       // INPUT
-       entity vh_player; // player
-       entity vh_vehicle; // vehicle
-
-MUTATOR_HOOKABLE(VehicleTouch, EV_NO_ARGS);
-       // called when a player touches a vehicle
-       // return true to stop player from entering the vehicle
-       // INPUT
-//     entity self; // vehicle
-//     entity other; // player
-
-MUTATOR_HOOKABLE(VehicleExit, EV_NO_ARGS);
-       // called when a player exits a vehicle
-       // allows mutators to set special settings in this event
-       // INPUT
-//     entity vh_player; // player
-//     entity vh_vehicle; // vehicle
-
-MUTATOR_HOOKABLE(AbortSpeedrun, EV_NO_ARGS);
-       // called when a speedrun is aborted and the player is teleported back to start position
-       // INPUT
-//     entity self; // player
-
-MUTATOR_HOOKABLE(ItemTouch, EV_NO_ARGS);
-       // called at when a item is touched. Called early, can edit item properties.
-//     entity self;    // item
-//     entity other;   // player
+
+/**
+ * called when a player enters a vehicle
+ * allows mutators to set special settings in this event
+ */
+#define EV_VehicleEnter(i, o) \
+    /** player */ i(entity, vh_player) \
+    /** vehicle */ i(entity, vh_vehicle) \
+    /**/
+entity vh_player;
+entity vh_vehicle;
+MUTATOR_HOOKABLE(VehicleEnter, EV_VehicleEnter);
+
+/**
+ * called when a player touches a vehicle
+ * return true to stop player from entering the vehicle
+ */
+#define EV_VehicleTouch(i, o) \
+    /** vehicle */ i(entity, self) \
+    /** player */ i(entity, other) \
+    /**/
+MUTATOR_HOOKABLE(VehicleTouch, EV_VehicleTouch);
+
+/**
+ * called when a player exits a vehicle
+ * allows mutators to set special settings in this event
+ */
+#define EV_VehicleExit(i, o) \
+    /** player */ i(entity, vh_player) \
+    /** vehicle */ i(entity, vh_vehicle) \
+    /**/
+MUTATOR_HOOKABLE(VehicleExit, EV_VehicleExit);
+
+/** called when a speedrun is aborted and the player is teleported back to start position */
+#define EV_AbortSpeedrun(i, o) \
+    /** player */ i(entity, self) \
+    /**/
+MUTATOR_HOOKABLE(AbortSpeedrun, EV_AbortSpeedrun);
+
+/** called at when a item is touched. Called early, can edit item properties. */
+#define EV_ItemTouch(i, o) \
+    /** item */ i(entity, self) \
+    /** player */ i(entity, other) \
+    /**/
+MUTATOR_HOOKABLE(ItemTouch, EV_ItemTouch);
+
 enum {
        MUT_ITEMTOUCH_CONTINUE, // return this flag to make the function continue as normal
        MUT_ITEMTOUCH_RETURN, // return this flag to make the function return (handled entirely by mutator)
        MUT_ITEMTOUCH_PICKUP // return this flag to have the item "picked up" and taken even after mutator handled it
 };
 
-MUTATOR_HOOKABLE(ClientConnect, EV_NO_ARGS);
-       // called at when a player connect
-//     entity self;    // player
+/** called at when a player connect */
+#define EV_ClientConnect(i, o) \
+    /** player */ i(entity, self) \
+    /**/
+MUTATOR_HOOKABLE(ClientConnect, EV_ClientConnect);
 
-MUTATOR_HOOKABLE(HavocBot_ChooseRole, EV_NO_ARGS);
-//     entity self;
+#define EV_HavocBot_ChooseRole(i, o) \
+    /**/ i(entity, self) \
+    /**/
+MUTATOR_HOOKABLE(HavocBot_ChooseRole, EV_HavocBot_ChooseRole);
 
-MUTATOR_HOOKABLE(AccuracyTargetValid, EV_NO_ARGS);
-       // called when a target is checked for accuracy
-//     entity frag_attacker; // attacker
-//     entity frag_target; // target
+/** called when a target is checked for accuracy */
+#define EV_AccuracyTargetValid(i, o) \
+    /** attacker */ i(entity, frag_attacker) \
+    /** target */ i(entity, frag_target) \
+    /**/
+MUTATOR_HOOKABLE(AccuracyTargetValid, EV_AccuracyTargetValid);
 enum {
        MUT_ACCADD_VALID, // return this flag to make the function continue if target is a client
        MUT_ACCADD_INVALID, // return this flag to make the function always continue
index ffcf7624d70ff551384288eb967c1a4925e63e6e..37af9ee8618077742338ccdbdd6fa4b8becd1e8c 100644 (file)
@@ -644,9 +644,7 @@ void Item_RespawnCountdown (void)
                                                {name = "item_armor_large"; rgb = '0 1 0';}
                                        break;
                        }
-                       item_name = name;
-                       item_color = rgb;
-                       MUTATOR_CALLHOOK(Item_RespawnCountdown);
+                       MUTATOR_CALLHOOK(Item_RespawnCountdown, name, rgb);
                        name = item_name;
                        rgb = item_color;
                        if(self.flags & FL_WEAPON)
@@ -903,7 +901,7 @@ void Item_Touch (void)
        if (time < self.item_spawnshieldtime)
                return;
 
-       switch(MUTATOR_CALLHOOK(ItemTouch))
+       switch(MUTATOR_CALLHOOK(ItemTouch, self, other))
        {
                case MUT_ITEMTOUCH_RETURN: { return; }
                case MUT_ITEMTOUCH_PICKUP: { goto pickup; }
index 79eac74bb393c8d38c839ac1c1d0f136c1405396..5f124ff3ba390834249f1ffba83f65e36392079d 100644 (file)
@@ -162,11 +162,7 @@ void bumb_gunner_exit(float _exitflag)
        self.hud            = HUD_NORMAL;
        self.switchweapon   = self.vehicle.switchweapon;
 
-    vh_player = self;
-    vh_vehicle = self.vehicle;
-    MUTATOR_CALLHOOK(VehicleExit);
-    self = vh_player;
-    self.vehicle = vh_vehicle;
+    MUTATOR_CALLHOOK(VehicleExit, self, self.vehicle);
 
        self.vehicle.vehicle_hudmodel.viewmodelforclient = self.vehicle;
 
@@ -250,11 +246,7 @@ float bumb_gunner_enter()
 
        CSQCVehicleSetup(other, other.hud);
 
-    vh_player = other;
-    vh_vehicle = _gun;
-    MUTATOR_CALLHOOK(VehicleEnter);
-    other = vh_player;
-    _gun = vh_vehicle;
+    MUTATOR_CALLHOOK(VehicleEnter, other, _gun);
 
        return true;
 }
index e6a0f9c0e4887ef1e37971d7a142b33aa3ea9ab0..50f355d73ddb34f167d2f53c9c606ae5f4c17d8a 100644 (file)
@@ -550,7 +550,7 @@ void vehicles_impact(float _minspeed, float _speedfac, float _maxpain)
 
 void vehicles_touch()
 {
-       if(MUTATOR_CALLHOOK(VehicleTouch))
+       if(MUTATOR_CALLHOOK(VehicleTouch, self, other))
                return;
 
     // Vehicle currently in use
@@ -683,11 +683,7 @@ void vehicles_enter()
 
     CSQCVehicleSetup(self.owner, self.hud);
 
-    vh_player = other;
-    vh_vehicle = self;
-    MUTATOR_CALLHOOK(VehicleEnter);
-    other = vh_player;
-    self = vh_vehicle;
+    MUTATOR_CALLHOOK(VehicleEnter, other, self);
 
     self.vehicle_enter();
     antilag_clear(other);
@@ -823,11 +819,7 @@ void vehicles_exit(float eject)
     if(!teamplay)
         _vehicle.team = 0;
 
-    vh_player = _player;
-    vh_vehicle = _vehicle;
-    MUTATOR_CALLHOOK(VehicleExit);
-    _player = vh_player;
-    _vehicle = vh_vehicle;
+    MUTATOR_CALLHOOK(VehicleExit, _player, _vehicle);
 
     _vehicle.team = _vehicle.tur_head.team;
 
index 1ef81a409eaae283ed2a456deb748a7d851e24eb..d0dda35af10cc979ca3296adc0b6883d8ac6c746 100644 (file)
@@ -113,9 +113,7 @@ void accuracy_add(entity e, int w, float fired, float hit)
 
 float accuracy_isgooddamage(entity attacker, entity targ)
 {
-       frag_attacker = attacker;
-       frag_target = targ;
-       float mutator_check = MUTATOR_CALLHOOK(AccuracyTargetValid);
+       float mutator_check = MUTATOR_CALLHOOK(AccuracyTargetValid, attacker, targ);
 
        if(!warmup_stage)
        if(targ.deadflag == DEAD_NO)