mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-07 07:22:56 +00:00
* Smooth Movement: Resurrection: Resurgence: Revengeance 4: The Return of Smooth Movement: Smooth Edition Director's Cut (#52515) Automatic glide size adjustment based on move delay. Essentially a port of https://github.com/yogstation13/Yogstation/pull/8132 but that was mostly my code with some fixes. Why again? well it turns out the recent byond fixes to glide size actually worked and solved the issues that were unsolvable. https://file.house/0B3u.mp4 Glide size no longer incorrectly scales at fps, so it works as intended at any framerate with the only stuttering being normal byond suck stuttering. * Smooth Movement: Resurrection: Resurgence: Revengeance 4: The Return of Smooth Movement: Smooth Edition Director's Cut Co-authored-by: Rob Bailey <actioninja@gmail.com>
17 lines
1.0 KiB
Plaintext
17 lines
1.0 KiB
Plaintext
/// The minimum for glide_size to be clamped to.
|
|
#define MIN_GLIDE_SIZE 1
|
|
/// The maximum for glide_size to be clamped to.
|
|
/// This shouldn't be higher than the icon size, and generally you shouldn't be changing this, but it's here just in case.
|
|
#define MAX_GLIDE_SIZE 32
|
|
|
|
/// Compensating for time dialation
|
|
GLOBAL_VAR_INIT(glide_size_multiplier, 1.0)
|
|
|
|
///Broken down, here's what this does:
|
|
/// divides the world icon_size (32) by delay divided by ticklag to get the number of pixels something should be moving each tick.
|
|
/// The division result is given a min value of 1 to prevent obscenely slow glide sizes from being set
|
|
/// Then that's multiplied by the global glide size multiplier. 1.25 by default feels pretty close to spot on. This is just to try to get byond to behave.
|
|
/// The whole result is then clamped to within the range above.
|
|
/// Not very readable but it works
|
|
#define DELAY_TO_GLIDE_SIZE(delay) (clamp(((32 / max((delay) / world.tick_lag, 1)) * GLOB.glide_size_multiplier), MIN_GLIDE_SIZE, MAX_GLIDE_SIZE))
|