From: Mario Date: Sun, 16 Jul 2017 22:27:20 +0000 (+1000) Subject: Clean up Physics_UpdateStats a bit X-Git-Tag: xonotic-v0.8.5~2586 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=5172811ca1681144cddd447c3ae9c5a0acef9912;p=xonotic%2Fxonotic-data.pk3dir.git Clean up Physics_UpdateStats a bit --- diff --git a/qcsrc/common/physics/player.qc b/qcsrc/common/physics/player.qc index 47249356b..ec255c8d3 100644 --- a/qcsrc/common/physics/player.qc +++ b/qcsrc/common/physics/player.qc @@ -30,8 +30,14 @@ float Physics_ClientOption(entity this, string option, float defaultval) return defaultval; } -void Physics_UpdateStats(entity this, float maxspd_mod) +void Physics_UpdateStats(entity this) { + // update this first, as it's used on all stats (wouldn't want to update them all manually from a mutator hook now, would we?) + STAT(MOVEVARS_HIGHSPEED, this) = autocvar_g_movement_highspeed; + + MUTATOR_CALLHOOK(PlayerPhysics_UpdateStats, this); + float maxspd_mod = PHYS_HIGHSPEED(this); + STAT(MOVEVARS_AIRACCEL_QW, this) = AdjustAirAccelQW(Physics_ClientOption(this, "airaccel_qw", autocvar_sv_airaccel_qw), maxspd_mod); STAT(MOVEVARS_AIRSTRAFEACCEL_QW, this) = (Physics_ClientOption(this, "airstrafeaccel_qw", autocvar_sv_airstrafeaccel_qw)) ? AdjustAirAccelQW(Physics_ClientOption(this, "airstrafeaccel_qw", autocvar_sv_airstrafeaccel_qw), maxspd_mod) diff --git a/qcsrc/common/physics/player.qh b/qcsrc/common/physics/player.qh index 5f43c2a5b..a77a03b58 100644 --- a/qcsrc/common/physics/player.qh +++ b/qcsrc/common/physics/player.qh @@ -247,7 +247,7 @@ STATIC_INIT(PHYS_INPUT_BUTTON_DODGE) bool Physics_Valid(string thecvar); - void Physics_UpdateStats(entity this, float maxspd_mod); + void Physics_UpdateStats(entity this); void PM_UpdateButtons(entity this, entity store); diff --git a/qcsrc/ecs/systems/sv_physics.qc b/qcsrc/ecs/systems/sv_physics.qc index 1a69c75fc..87982b5d5 100644 --- a/qcsrc/ecs/systems/sv_physics.qc +++ b/qcsrc/ecs/systems/sv_physics.qc @@ -3,9 +3,7 @@ void sys_phys_fix(entity this, float dt) { WarpZone_PlayerPhysics_FixVAngle(this); - STAT(MOVEVARS_HIGHSPEED, this) = autocvar_g_movement_highspeed; - MUTATOR_CALLHOOK(PlayerPhysics_UpdateStats, this); // do it BEFORE the function so we can modify highspeed! - Physics_UpdateStats(this, PHYS_HIGHSPEED(this)); + Physics_UpdateStats(this); } bool sys_phys_override(entity this, float dt) diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index 26cdbde2d..70b0455f2 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -1253,9 +1253,7 @@ void ClientConnect(entity this) sv_notice_join(this); // update physics stats (players can spawn before physics runs) - STAT(MOVEVARS_HIGHSPEED, this) = autocvar_g_movement_highspeed; - MUTATOR_CALLHOOK(PlayerPhysics_UpdateStats, this); // do it BEFORE the function so we can modify highspeed! - Physics_UpdateStats(this, PHYS_HIGHSPEED(this)); + Physics_UpdateStats(this); IL_EACH(g_initforplayer, it.init_for_player, { it.init_for_player(it, this);