diff --git a/src/game/client/prediction/entities/character.cpp b/src/game/client/prediction/entities/character.cpp index afdc366cb86..5ffbe75768e 100644 --- a/src/game/client/prediction/entities/character.cpp +++ b/src/game/client/prediction/entities/character.cpp @@ -700,15 +700,21 @@ void CCharacter::HandleSkippableTiles(int Index) } else if(Type == TILE_SPEED_BOOST) { + constexpr float MaxSpeedScale = 5.0f; + if(GetTuning(GetOverriddenTuneZone())->m_SpeedBoostMaxSpeed > 0 && MaxSpeed == 0) + { + MaxSpeed = GetTuning(GetOverriddenTuneZone())->m_SpeedBoostMaxSpeed * MaxSpeedScale; + } + if(MaxSpeed == 0) { TempVel += Direction * Force; } else { - // hardest to understand + // (signed) length of projection float CurrentDirectionalSpeed = dot(Direction, m_Core.m_Vel); - float TempMaxSpeed = MaxSpeed / 5.0f; + float TempMaxSpeed = MaxSpeed / MaxSpeedScale; if(CurrentDirectionalSpeed + Force > TempMaxSpeed) TempVel += Direction * (TempMaxSpeed - CurrentDirectionalSpeed); else diff --git a/src/game/server/entities/character.cpp b/src/game/server/entities/character.cpp index b213f0fecc0..9964149f08f 100644 --- a/src/game/server/entities/character.cpp +++ b/src/game/server/entities/character.cpp @@ -1476,6 +1476,12 @@ void CCharacter::HandleSkippableTiles(int Index) } else if(Type == TILE_SPEED_BOOST) { + constexpr float MaxSpeedScale = 5.0f; + if(m_Core.m_Tuning->m_SpeedBoostMaxSpeed > 0 && MaxSpeed == 0) + { + MaxSpeed = m_Core.m_Tuning->m_SpeedBoostMaxSpeed * MaxSpeedScale; + } + if(MaxSpeed == 0) { TempVel += Direction * Force; @@ -1484,7 +1490,7 @@ void CCharacter::HandleSkippableTiles(int Index) { // hardest to understand float CurrentDirectionalSpeed = dot(Direction, m_Core.m_Vel); - float TempMaxSpeed = MaxSpeed / 5.0f; + float TempMaxSpeed = MaxSpeed / MaxSpeedScale; if(CurrentDirectionalSpeed + Force > TempMaxSpeed) TempVel += Direction * (TempMaxSpeed - CurrentDirectionalSpeed); else diff --git a/src/game/tuning.h b/src/game/tuning.h index ac6340012e1..926dcd5fbee 100644 --- a/src/game/tuning.h +++ b/src/game/tuning.h @@ -62,3 +62,5 @@ MACRO_TUNING_PARAM(HammerHitFireDelay, hammer_hit_fire_delay, 320, "Delay of ham MACRO_TUNING_PARAM(GroundElasticityX, ground_elasticity_x, 0, "Wall elasticity") MACRO_TUNING_PARAM(GroundElasticityY, ground_elasticity_y, 0, "Ground/ceiling elasticity") + +MACRO_TUNING_PARAM(SpeedBoostMaxSpeed, speed_boost_max_speed, 128, "Max speed a speedtile can give you, 0 = unlimited (Does not apply to old speed boosts)")