From b9aed6027e5b9204c955be6e221d9f95ded298af Mon Sep 17 00:00:00 2001 From: Miloslav Ciz Date: Mon, 7 Jul 2025 22:48:21 +0200 Subject: [PATCH] Add motion blur mod --- mods/motion_blur.diff | 51 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 mods/motion_blur.diff diff --git a/mods/motion_blur.diff b/mods/motion_blur.diff new file mode 100644 index 0000000..6431bf9 --- /dev/null +++ b/mods/motion_blur.diff @@ -0,0 +1,51 @@ +Simple dithered motion blur effect, applied to whole rendering. + +diff --git a/game.h b/game.h +index 1ad5131..d886e0b 100644 +--- a/game.h ++++ b/game.h +@@ -347,6 +347,8 @@ struct + char popupStr[LCR_POPUP_STR_SIZE]; + uint8_t popupCountdown; + ++ int_fast8_t frameCycle; ++ + struct + { + uint8_t selectedTab; +@@ -399,6 +401,9 @@ uint8_t LCR_gameMusicOn(void) + + void LCR_gameDrawPixel(unsigned long index, uint16_t color) + { ++ if ((index % LCR_SETTING_MOTION_BLUR_FRAMES) != LCR_game.frameCycle) ++ return; ++ + #if LCR_SETTING_RESOLUTION_SUBDIVIDE <= 1 + LCR_drawPixel(index,color); + #else +@@ -1899,6 +1904,8 @@ uint8_t LCR_gameStep(uint32_t time) + { + LCR_LOG2("rendering next frame"); + ++ LCR_game.frameCycle = LCR_renderer.frame % LCR_SETTING_MOTION_BLUR_FRAMES; ++ + while (time >= LCR_game.nextRenderFrameTime) + LCR_game.nextRenderFrameTime += 1000 / LCR_SETTING_FPS; + +diff --git a/settings.h b/settings.h +index 332df45..4c28e70 100644 +--- a/settings.h ++++ b/settings.h +@@ -222,6 +222,12 @@ + #define LCR_SETTING_TIME_MULTIPLIER 100 + #endif + ++#ifndef LCR_SETTING_MOTION_BLUR_FRAMES ++ #define LCR_SETTING_MOTION_BLUR_FRAMES 2 ++ /** Length of the motion blur rendering cycle. The longer, the more pronounced ++ the effect. Should be kept a power of two else performance suffers greatly. */ ++#endif ++ + #ifndef LCR_SETTING_GHOST_STEP + /** Step (in physics engine ticks) by which the samples for ghost car will be + spaced (positions inbetween will be interpolated). Lower step along with more