From 0ad39d8fb86842d80cd19a4993ef34fa2b5c6651 Mon Sep 17 00:00:00 2001 From: Martin Janiczek Date: Wed, 19 Oct 2022 00:08:06 +0200 Subject: [PATCH] Fix usages of getTicks() once the condition is done --- src/animation.cc | 2 +- src/input.cc | 18 ++++++------------ src/input.h | 1 - src/main.cc | 2 +- 4 files changed, 8 insertions(+), 15 deletions(-) diff --git a/src/animation.cc b/src/animation.cc index bbfa628..36b27d2 100644 --- a/src/animation.cc +++ b/src/animation.cc @@ -2787,7 +2787,7 @@ void _object_animate() Object* object = sad->obj; - unsigned int time = getMultipliedTicks(); + unsigned int time = getTicks(); if (getTicksBetween(time, sad->animationTimestamp) < sad->ticksPerFrame) { continue; } diff --git a/src/input.cc b/src/input.cc index 1bda5c7..8fc65a8 100644 --- a/src/input.cc +++ b/src/input.cc @@ -328,7 +328,7 @@ void tickersExecute() return; } - gTickerLastTimestamp = SDL_GetTicks(); + gTickerLastTimestamp = getTicks(); TickerListNode* curr = gTickerListHead; TickerListNode** currPtr = &(gTickerListHead); @@ -630,15 +630,9 @@ void screenshotHandlerConfigure(int keyCode, ScreenshotHandler* handler) } // 0x4C9370 -// Returns the original tick count (unaffected by the sfall speed patch). +// Since implementing sfall SpeedPatch, this returns a potentially sped up +// (multiplied) tick count. For the original tick count, call SDL_GetTicks(); unsigned int getTicks() -{ - return SDL_GetTicks(); -} - -// sfall SpeedPatch.cpp -// Returns the potentially sped up (multiplied) tick count. -unsigned int getMultipliedTicks() { unsigned int newTickCount = SDL_GetTicks(); if (newTickCount == gLastTickCount) return gStoredTickCount; @@ -684,7 +678,7 @@ time_t getLocalTimeAfterSpeedup() void inputPauseForTocks(unsigned int delay) { // NOTE: Uninline. - unsigned int start = getMultipliedTicks(); + unsigned int start = getTicks(); unsigned int end = getTicks(); // NOTE: Uninline. @@ -702,7 +696,7 @@ void inputPauseForTocks(unsigned int delay) // 0x4C93B8 void inputBlockForTocks(unsigned int ms) { - unsigned int start = SDL_GetTicks(); + unsigned int start = getTicks(); unsigned int diff; do { // NOTE: Uninline @@ -713,7 +707,7 @@ void inputBlockForTocks(unsigned int ms) // 0x4C93E0 unsigned int getTicksSince(unsigned int start) { - unsigned int end = getMultipliedTicks(); + unsigned int end = getTicks(); // NOTE: Uninline. return getTicksBetween(end, start); diff --git a/src/input.h b/src/input.h index 8344b6d..8288687 100644 --- a/src/input.h +++ b/src/input.h @@ -28,7 +28,6 @@ void takeScreenshot(); int screenshotHandlerDefaultImpl(int width, int height, unsigned char* data, unsigned char* palette); void screenshotHandlerConfigure(int keyCode, ScreenshotHandler* handler); unsigned int getTicks(); -unsigned int getMultipliedTicks(); time_t getLocalTimeAfterSpeedup(); void inputPauseForTocks(unsigned int ms); void inputBlockForTocks(unsigned int ms); diff --git a/src/main.cc b/src/main.cc index 84e996a..93ba861 100644 --- a/src/main.cc +++ b/src/main.cc @@ -1026,7 +1026,7 @@ static int mainMenuWindowHandleEvents() mouseShowCursor(); } - unsigned int tick = getMultipliedTicks(); + unsigned int tick = getTicks(); int rc = -1; while (rc == -1) {