From: TimePath Date: Sat, 15 Aug 2015 06:58:25 +0000 (+1000) Subject: Convert more calls X-Git-Tag: xonotic-v0.8.2~2071^2~5 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=17538e02268c29cc7c19a1b2c621fb16a6deaa63;p=xonotic%2Fxonotic-data.pk3dir.git Convert more calls --- diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 06bed1fc0..d05f76c40 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -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; diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index 881f8f071..de29c9a25 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -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 diff --git a/qcsrc/server/mutators/base.qh b/qcsrc/server/mutators/base.qh index 8f22ef2f5..b999ce3d7 100644 --- a/qcsrc/server/mutators/base.qh +++ b/qcsrc/server/mutators/base.qh @@ -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) diff --git a/qcsrc/server/teamplay.qc b/qcsrc/server/teamplay.qc index ec6f5afc3..b19597cde 100644 --- a/qcsrc/server/teamplay.qc +++ b/qcsrc/server/teamplay.qc @@ -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) diff --git a/qcsrc/server/waypointsprites.qc b/qcsrc/server/waypointsprites.qc index b0c8cb122..6130b6165 100644 --- a/qcsrc/server/waypointsprites.qc +++ b/qcsrc/server/waypointsprites.qc @@ -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); diff --git a/qcsrc/server/weapons/weaponsystem.qc b/qcsrc/server/weapons/weaponsystem.qc index 4f072c4c0..d06d11cd9 100644 --- a/qcsrc/server/weapons/weaponsystem.qc +++ b/qcsrc/server/weapons/weaponsystem.qc @@ -28,11 +28,9 @@ 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;