]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Clean up Physics_UpdateStats a bit
authorMario <mario@smbclan.net>
Sun, 16 Jul 2017 22:27:20 +0000 (08:27 +1000)
committerMario <mario@smbclan.net>
Sun, 16 Jul 2017 22:27:20 +0000 (08:27 +1000)
qcsrc/common/physics/player.qc
qcsrc/common/physics/player.qh
qcsrc/ecs/systems/sv_physics.qc
qcsrc/server/client.qc

index 47249356bb564fb42504b4e0d6047fe71eec1512..ec255c8d3c66defdcee629cbfcd8f903529ffe44 100644 (file)
@@ -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)
index 5f43c2a5bec9fda0bf3c23966432a47dc4a8137f..a77a03b5860042b2100bca0b82fc49ab281350b3 100644 (file)
@@ -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);
 
index 1a69c75fc9a4ce45eed864caa15e8da243756ce4..87982b5d55f8ac0a8073c2b48cce992ff4fddf30 100644 (file)
@@ -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)
index 26cdbde2d3966cb68cc2208a45bb3c0f91d2e6a5..70b0455f249e6f44273ab972f1a3f1386e6703f8 100644 (file)
@@ -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);