]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Convert some calls
authorTimePath <andrew.hardaker1995@gmail.com>
Sat, 15 Aug 2015 06:38:11 +0000 (16:38 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Sat, 15 Aug 2015 06:38:11 +0000 (16:38 +1000)
qcsrc/common/physics.qc
qcsrc/server/cl_client.qc
qcsrc/server/cl_player.qc
qcsrc/server/g_damage.qc
qcsrc/server/mutators/base.qh

index 6153d80ae7f3efb2b750979c6758741b63d5194a..0cac08bb0c0fab1c7ac93ccdb160863753907c56 100644 (file)
@@ -553,12 +553,12 @@ bool PlayerJump (void)
        bool doublejump = false;
        float mjumpheight = PHYS_JUMPVELOCITY;
 
-       player_multijump = doublejump;
-       player_jumpheight = mjumpheight;
 #ifdef SVQC
-       if (MUTATOR_CALLHOOK(PlayerJump))
+       if (MUTATOR_CALLHOOK(PlayerJump, doublejump, mjumpheight))
 #elif defined(CSQC)
-       if(PM_multijump_checkjump())
+       player_multijump = doublejump;
+       player_jumpheight = mjumpheight;
+       if (PM_multijump_checkjump())
 #endif
                return true;
 
index 6d3d786aecda1de1a1b2c70c697bcb3c3cc3b7a8..06bed1fc0a4f424a5b0772de63d527d668dde7a2 100644 (file)
@@ -422,7 +422,7 @@ void PutClientInServer (void)
        // reset player keys
        self.itemkeys = 0;
 
-       MUTATOR_CALLHOOK(PutClientInServer);
+       MUTATOR_CALLHOOK(PutClientInServer, self);
 
        if(gameover)
                self.classname = "observer";
@@ -644,8 +644,7 @@ void PutClientInServer (void)
 
                Unfreeze(self);
 
-               spawn_spot = spot;
-               MUTATOR_CALLHOOK(PlayerSpawn);
+               MUTATOR_CALLHOOK(PlayerSpawn, spot);
 
                if(autocvar_spawn_debug)
                {
index aae39ea66eccbc9e9190e1797fedcabee3e366de..1411ea3393226090d8fe44a1136f49507e79ce2a 100644 (file)
@@ -549,11 +549,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, int deathtyp
        if(accuracy_isgooddamage(attacker, self))
         attacker.accuracy.(accuracy_frags[w-1]) += 1;
 
-               frag_attacker = attacker;
-               frag_inflictor = inflictor;
-               frag_target = self;
-               frag_deathtype = deathtype;
-               MUTATOR_CALLHOOK(PlayerDies);
+               MUTATOR_CALLHOOK(PlayerDies, inflictor, attacker, self, deathtype);
 
                WEP_ACTION(self.weapon, WR_PLAYERDEATH);
 
index c5bbfcab55ed0f132ece9d8e55d517afac328338..49dbae90a8adc7c3fcf8e63b859f82cbdac9c77e 100644 (file)
@@ -147,10 +147,7 @@ void GiveFrags (entity attacker, entity targ, float f, int deathtype)
        entity oldself;
        oldself = self;
        self = attacker;
-       frag_attacker = attacker;
-       frag_target = targ;
-       frag_score = f;
-       if(MUTATOR_CALLHOOK(GiveFragsForKill))
+       if(MUTATOR_CALLHOOK(GiveFragsForKill, attacker, targ, f))
        {
                f = frag_score;
                self = oldself;
index 4aea08447243b3f870b7006ad6c2be446c4552f0..8f22ef2f53acc90243347da560acd8d0e3f92e3d 100644 (file)
@@ -62,7 +62,7 @@ void Mutator_Remove(mutatorfunc_t func, string name); // calls error() on fail
 #define HANDLE_POPOUT(type, id) id = out_##id;
 
 #define MUTATOR_HOOKABLE(id, params) \
-       _MUTATOR_HOOKABLE(id, int params(HANDLE_PARAMS, HANDLE_PARAMS)) { \
+       _MUTATOR_HOOKABLE(id, int params(HANDLE_PARAMS, HANDLE_NOP)) { \
                params(HANDLE_PUSHTMP, HANDLE_NOP) \
                params(HANDLE_PREPARE, HANDLE_NOP) \
                bool ret = CallbackChain_Call(HOOK_##id); \
@@ -79,49 +79,77 @@ void Mutator_Remove(mutatorfunc_t func, string name); // calls error() on fail
 
 #define EV_NO_ARGS(i, o)
 
-MUTATOR_HOOKABLE(MakePlayerObserver, EV_NO_ARGS)
-       // called when a player becomes observer, after shared setup
-
-MUTATOR_HOOKABLE(PutClientInServer, EV_NO_ARGS);
-//     entity self; // client wanting to spawn
-
-MUTATOR_HOOKABLE(PlayerSpawn, EV_NO_ARGS);
-       entity spawn_spot; // spot that was used, or world
-       // called when a player spawns as player, after shared setup, before his weapon is chosen (so items may be changed in here)
-
-MUTATOR_HOOKABLE(reset_map_global, EV_NO_ARGS);
-       // called in reset_map
-
-MUTATOR_HOOKABLE(reset_map_players, EV_NO_ARGS);
-       // called in reset_map
-
-MUTATOR_HOOKABLE(ForbidPlayerScore_Clear, EV_NO_ARGS);
-       // returns 1 if clearing player score shall not be allowed
-
-MUTATOR_HOOKABLE(ClientDisconnect, EV_NO_ARGS);
-       // called when a player disconnects
-
-MUTATOR_HOOKABLE(PlayerDies, EV_NO_ARGS);
-       // called when a player dies to e.g. remove stuff he was carrying.
-       // INPUT:
-               entity frag_inflictor;
-               entity frag_attacker;
-               entity frag_target; // same as self
-               int frag_deathtype;
-
-MUTATOR_HOOKABLE(PlayerJump, EV_NO_ARGS);
-       // called when a player presses the jump key
-       // INPUT, OUTPUT:
-               float player_multijump;
-               float player_jumpheight;
-
-MUTATOR_HOOKABLE(GiveFragsForKill, EV_NO_ARGS);
-       // called when someone was fragged by "self", and is expected to change frag_score to adjust scoring for the kill
-       // INPUT:
-//             entity frag_attacker; // same as self
-//             entity frag_target;
-       // INPUT, OUTPUT:
-               float frag_score;
+/** called when a player becomes observer, after shared setup */
+#define EV_MakePlayerObserver(i, o) \
+    /**/
+MUTATOR_HOOKABLE(MakePlayerObserver, EV_MakePlayerObserver)
+
+/** */
+#define EV_PutClientInServer(i, o) \
+    /** client wanting to spawn */ i(entity, self) \
+    /**/
+MUTATOR_HOOKABLE(PutClientInServer, EV_PutClientInServer);
+
+/** called when a player spawns as player, after shared setup, before his weapon is chosen (so items may be changed in here) */
+#define EV_PlayerSpawn(i, o) \
+    /** spot that was used, or world */ i(entity, spawn_spot) \
+    /**/
+entity spawn_spot;
+MUTATOR_HOOKABLE(PlayerSpawn, EV_PlayerSpawn);
+
+/** called in reset_map */
+#define EV_reset_map_global(i, o) \
+    /**/
+MUTATOR_HOOKABLE(reset_map_global, EV_reset_map_global);
+
+/** called in reset_map */
+#define EV_reset_map_players(i, o) \
+    /**/
+MUTATOR_HOOKABLE(reset_map_players, EV_reset_map_players);
+
+/** returns 1 if clearing player score shall not be allowed */
+#define EV_ForbidPlayerScore_Clear(i, o) \
+    /**/
+MUTATOR_HOOKABLE(ForbidPlayerScore_Clear, EV_ForbidPlayerScore_Clear);
+
+/** called when a player disconnects */
+#define EV_ClientDisconnect(i, o) \
+    /**/
+MUTATOR_HOOKABLE(ClientDisconnect, EV_ClientDisconnect);
+
+/** called when a player dies to e.g. remove stuff he was carrying. */
+#define EV_PlayerDies(i, o) \
+    /**/ i(entity, frag_inflictor) \
+    /**/ i(entity, frag_attacker) \
+    /** same as self */ i(entity, frag_target) \
+    /**/ i(int, frag_deathtype) \
+    /**/
+entity frag_inflictor;
+entity frag_attacker;
+entity frag_target;
+int frag_deathtype;
+MUTATOR_HOOKABLE(PlayerDies, EV_PlayerDies);
+
+/** called when a player presses the jump key */
+#define EV_PlayerJump(i, o) \
+    /**/ i(float, player_multijump) \
+    /**/ i(float, player_jumpheight) \
+    /**/ o(float, player_multijump) \
+    /**/ o(float, player_jumpheight) \
+    /**/
+float player_multijump;
+float player_jumpheight;
+MUTATOR_HOOKABLE(PlayerJump, EV_PlayerJump);
+
+/** called when someone was fragged by "self", and is expected to change frag_score to adjust scoring for the kill */
+#define EV_GiveFragsForKill(i, o) \
+    /** same as self */ i(entity, frag_attacker) \
+    /**/ i(entity, frag_target) \
+    /**/ i(float, frag_score) \
+    /**/ o(float, frag_score) \
+    /**/
+float frag_score;
+MUTATOR_HOOKABLE(GiveFragsForKill, EV_GiveFragsForKill);
 
 MUTATOR_HOOKABLE(MatchEnd, EV_NO_ARGS);
        // called when the match ends