]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Convert more calls
authorTimePath <andrew.hardaker1995@gmail.com>
Sat, 15 Aug 2015 06:58:25 +0000 (16:58 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Sat, 15 Aug 2015 06:58:25 +0000 (16:58 +1000)
qcsrc/server/cl_client.qc
qcsrc/server/g_world.qc
qcsrc/server/mutators/base.qh
qcsrc/server/teamplay.qc
qcsrc/server/waypointsprites.qc
qcsrc/server/weapons/weaponsystem.qc

index 06bed1fc0a4f424a5b0772de63d527d668dde7a2..d05f76c401e1f18393a65fdeb609acb5a44f803f 100644 (file)
@@ -1705,8 +1705,7 @@ spectate mode routines
 */
 
 void SpectateCopy(entity spectatee) {
-       other = spectatee;
-       MUTATOR_CALLHOOK(SpectateCopy);
+       MUTATOR_CALLHOOK(SpectateCopy, spectatee, self);
        self.armortype = spectatee.armortype;
        self.armorvalue = spectatee.armorvalue;
        self.ammo_cells = spectatee.ammo_cells;
index 881f8f071915aef1eaa5428cab0b143bca65b953..de29c9a25ead17663da538b39ab8e6f25f03e024 100644 (file)
@@ -692,8 +692,7 @@ void spawnfunc_worldspawn (void)
                GameLogEcho(strcat(":gamestart:", GetGametype(), "_", GetMapname(), ":", s));
                s = ":gameinfo:mutators:LIST";
 
-               ret_string = s;
-               MUTATOR_CALLHOOK(BuildMutatorsString);
+               MUTATOR_CALLHOOK(BuildMutatorsString, s);
                s = ret_string;
 
                // simple, probably not good in the mutator system
index 8f22ef2f53acc90243347da560acd8d0e3f92e3d..b999ce3d7d372cb1bfe073b217161aa856af95a7 100644 (file)
@@ -151,49 +151,66 @@ MUTATOR_HOOKABLE(PlayerJump, EV_PlayerJump);
 float frag_score;
 MUTATOR_HOOKABLE(GiveFragsForKill, EV_GiveFragsForKill);
 
+/** called when the match ends */
 MUTATOR_HOOKABLE(MatchEnd, EV_NO_ARGS);
-       // called when the match ends
 
-MUTATOR_HOOKABLE(GetTeamCount, EV_NO_ARGS);
-       // should adjust ret_float to contain the team count
-       // INPUT, OUTPUT:
-               float ret_float;
+/** should adjust ret_float to contain the team count */
+#define EV_GetTeamCount(i, o) \
+    /**/ i(float, ret_float) \
+    /**/ o(float, ret_float) \
+    /**/
+float ret_float;
+MUTATOR_HOOKABLE(GetTeamCount, EV_GetTeamCount);
 
-MUTATOR_HOOKABLE(SpectateCopy, EV_NO_ARGS);
-       // copies variables for spectating "other" to "self"
-       // INPUT:
-//             entity other;
+/** copies variables for spectating "other" to "self" */
+#define EV_SpectateCopy(i, o) \
+    /**/ i(entity, other) \
+    /**/ i(entity, self) \
+    /**/
+MUTATOR_HOOKABLE(SpectateCopy, EV_SpectateCopy);
 
+/** returns 1 if throwing the current weapon shall not be allowed */
 MUTATOR_HOOKABLE(ForbidThrowCurrentWeapon, EV_NO_ARGS);
-       // returns 1 if throwing the current weapon shall not be allowed
 
-MUTATOR_HOOKABLE(WeaponRateFactor, EV_NO_ARGS);
-       // allows changing attack rate
-       // INPUT, OUTPUT:
-               float weapon_rate;
+/** allows changing attack rate */
+#define EV_WeaponRateFactor(i, o) \
+    /**/ i(float, weapon_rate) \
+    /**/ o(float, weapon_rate) \
+    /**/
+float weapon_rate;
+MUTATOR_HOOKABLE(WeaponRateFactor, EV_WeaponRateFactor);
 
-MUTATOR_HOOKABLE(WeaponSpeedFactor, EV_NO_ARGS);
-       // allows changing weapon speed (projectiles mostly)
-       // INPUT, OUTPUT:
-               //float ret_float;
+/** allows changing weapon speed (projectiles mostly) */
+#define EV_WeaponSpeedFactor(i, o) \
+    /**/ i(float, ret_float) \
+    /**/ o(float, ret_float) \
+    /**/
+MUTATOR_HOOKABLE(WeaponSpeedFactor, EV_WeaponSpeedFactor);
 
+/** adjusts {warmup_}start_{items,weapons,ammo_{cells,plasma,rockets,nails,shells,fuel}} */
 MUTATOR_HOOKABLE(SetStartItems, EV_NO_ARGS);
-       // adjusts {warmup_}start_{items,weapons,ammo_{cells,plasma,rockets,nails,shells,fuel}}
 
-MUTATOR_HOOKABLE(BuildMutatorsString, EV_NO_ARGS);
-       // appends ":mutatorname" to ret_string for logging
-       // INPUT, OUTPUT:
-               string ret_string;
+/** appends ":mutatorname" to ret_string for logging */
+#define EV_BuildMutatorsString(i, o) \
+    /**/ i(string, ret_string) \
+    /**/ o(string, ret_string) \
+    /**/
+string ret_string;
+MUTATOR_HOOKABLE(BuildMutatorsString, EV_BuildMutatorsString);
 
-MUTATOR_HOOKABLE(BuildMutatorsPrettyString, EV_NO_ARGS);
-       // appends ", Mutator name" to ret_string for display
-       // INPUT, OUTPUT:
-//             string ret_string;
+/** appends ", Mutator name" to ret_string for display */
+#define EV_BuildMutatorsPrettyString(i, o) \
+    /**/ i(string, ret_string) \
+    /**/ o(string, ret_string) \
+    /**/
+MUTATOR_HOOKABLE(BuildMutatorsPrettyString, EV_BuildMutatorsPrettyString);
 
-MUTATOR_HOOKABLE(CustomizeWaypoint, EV_NO_ARGS);
-       // called every frame
-       // customizes the waypoint for spectators
-       // INPUT: self = waypoint, other = player, other.enemy = spectator
+/** called every frame. customizes the waypoint for spectators */
+#define EV_CustomizeWaypoint(i, o) \
+    /** waypoint */ i(entity, self) \
+    /** player; other.enemy = spectator */ i(entity, other) \
+    /**/
+MUTATOR_HOOKABLE(CustomizeWaypoint, EV_CustomizeWaypoint);
 
 MUTATOR_HOOKABLE(FilterItem, EV_NO_ARGS);
        // checks if the current item may be spawned (self.items and self.weapons may be read and written to, as well as the ammo_ fields)
index ec6f5afc3d16fc1fe1073452f467c6bbe3389a2a..b19597cdeb05c7c679bff8f537b64b94abc19ba9 100644 (file)
@@ -283,8 +283,7 @@ string getwelcomemessage(void)
 {
        string s, modifications, motd;
 
-       ret_string = "";
-       MUTATOR_CALLHOOK(BuildMutatorsPrettyString);
+       MUTATOR_CALLHOOK(BuildMutatorsPrettyString, "");
        modifications = ret_string;
 
        if(g_weaponarena)
@@ -432,8 +431,7 @@ void CheckAllowedTeams (entity for_whom)
                // cover anything else by treating it like tdm with no teams spawned
                dm = 2;
 
-               ret_float = dm;
-               MUTATOR_CALLHOOK(GetTeamCount);
+               MUTATOR_CALLHOOK(GetTeamCount, dm);
                dm = ret_float;
 
                if(dm >= 4)
index b0c8cb1226eaeda11f432629baabccf5dee87f33..6130b616547ec21e070e9183a429d592f2113a8c 100644 (file)
@@ -248,10 +248,9 @@ float WaypointSprite_Customize()
        // this is not in SendEntity because it shall run every frame, not just every update
 
        // make spectators see what the player would see
-       entity e;
-       e = WaypointSprite_getviewentity(other);
+       entity e = WaypointSprite_getviewentity(other);
 
-       if(MUTATOR_CALLHOOK(CustomizeWaypoint))
+       if(MUTATOR_CALLHOOK(CustomizeWaypoint, self, other))
                return false;
 
        return self.waypointsprite_visible_for_player(e);
index 4f072c4c085bb7e829c6355da495a14c0ad33888..d06d11cd97ad6909f25e300e7e48fe3566c78257 100644 (file)
 
 float W_WeaponRateFactor()
 {
-       float t;
-       t = 1.0 / g_weaponratefactor;
+       float t = 1.0 / g_weaponratefactor;
 
-       weapon_rate = t;
-       MUTATOR_CALLHOOK(WeaponRateFactor);
+       MUTATOR_CALLHOOK(WeaponRateFactor, t);
        t = weapon_rate;
 
        return t;
@@ -40,11 +38,9 @@ float W_WeaponRateFactor()
 
 float W_WeaponSpeedFactor()
 {
-       float t;
-       t = 1.0 * g_weaponspeedfactor;
+       float t = 1.0 * g_weaponspeedfactor;
 
-       ret_float = t;
-       MUTATOR_CALLHOOK(WeaponSpeedFactor);
+       MUTATOR_CALLHOOK(WeaponSpeedFactor, t);
        t = ret_float;
 
        return t;