From 367f4538a3b1c73253292593e31258955cde5a45 Mon Sep 17 00:00:00 2001 From: Alexis Murzeau Date: Tue, 9 Aug 2022 07:26:15 +0200 Subject: [PATCH 1/3] fix gui not responding when the game is paused (#151) --- SpaceCadetPinball/winmain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SpaceCadetPinball/winmain.cpp b/SpaceCadetPinball/winmain.cpp index 57792ab..860bd7c 100644 --- a/SpaceCadetPinball/winmain.cpp +++ b/SpaceCadetPinball/winmain.cpp @@ -898,7 +898,7 @@ int winmain::ProcessWindowMessages() { static auto idleWait = 0; SDL_Event event; - if (has_focus && !single_step) + if (has_focus) { idleWait = static_cast(TargetFrameTime.count()); while (SDL_PollEvent(&event)) From a2567c1feae05ea8e288b884978b07de35fbc3f7 Mon Sep 17 00:00:00 2001 From: Alexis Murzeau Date: Tue, 9 Aug 2022 09:04:51 +0200 Subject: [PATCH 2/3] Fix flipper animation and angle calculation (#150) Checked with a slowed down flipper (reduced retractTime and extendTime) to ensure the flipper position is correct even when not finished while pressing the flipper control. --- SpaceCadetPinball/TFlipper.cpp | 4 ++-- SpaceCadetPinball/TFlipperEdge.cpp | 21 +++++++++------------ 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/SpaceCadetPinball/TFlipper.cpp b/SpaceCadetPinball/TFlipper.cpp index 4fece3b..bd40e5a 100644 --- a/SpaceCadetPinball/TFlipper.cpp +++ b/SpaceCadetPinball/TFlipper.cpp @@ -137,7 +137,7 @@ void TFlipper::TimerExpired(int timerId, void* caller) auto flip = static_cast(caller); int bmpCountSub1 = flip->ListBitmap->size() - 1; - auto newBmpIndex = static_cast(floor((pb::time_now - flip->InputTime) / flip->TimerTime)); + auto newBmpIndex = static_cast(floor(flip->FlipperEdge->flipper_angle(pb::time_now) / flip->FlipperEdge->AngleMax * bmpCountSub1 + 0.5)); if (newBmpIndex > bmpCountSub1) newBmpIndex = bmpCountSub1; if (newBmpIndex < 0) @@ -155,7 +155,7 @@ void TFlipper::TimerExpired(int timerId, void* caller) } if (flip->MessageField == 2) { - flip->BmpIndex = bmpCountSub1 - newBmpIndex; + flip->BmpIndex = newBmpIndex; if (flip->BmpIndex <= 0) { flip->BmpIndex = 0; diff --git a/SpaceCadetPinball/TFlipperEdge.cpp b/SpaceCadetPinball/TFlipperEdge.cpp index aa8c63b..7d17567 100644 --- a/SpaceCadetPinball/TFlipperEdge.cpp +++ b/SpaceCadetPinball/TFlipperEdge.cpp @@ -418,19 +418,17 @@ float TFlipperEdge::flipper_angle(float timeNow) { if (!FlipperFlag) return Angle1; - float angle = (Angle1 - Angle2) / AngleMax * AngleMult; - if (angle < 0.0f) - angle = -angle; - if (angle >= 0.0000001f) - angle = (timeNow - InputTime) / angle; + float currentAngleDuration = fabsf((Angle1 - Angle2) / AngleMax * AngleMult); + float currentAngleRatio; + + if (currentAngleDuration >= 0.0000001f) + currentAngleRatio = (timeNow - InputTime) / currentAngleDuration; else - angle = 1.0; + currentAngleRatio = 1.0; - angle = std::min(1.0f, std::max(angle, 0.0f)); - if (FlipperFlag == 2) - angle = 1.0f - angle; - return angle * AngleMax; + currentAngleRatio = std::min(1.0f, std::max(currentAngleRatio, 0.0f)); + return currentAngleRatio * (Angle1 - Angle2) + Angle2; } int TFlipperEdge::is_ball_inside(float x, float y) @@ -482,8 +480,7 @@ void TFlipperEdge::SetMotion(int code, float value) default: break; } - if (!FlipperFlag) - InputTime = value; + InputTime = value; FlipperFlag = code; AngleStopTime = AngleMult + InputTime; } From e9a4791322fcf3f8f291f8dd5e1081c157983906 Mon Sep 17 00:00:00 2001 From: "stech11 (SoftOrange Tech)" <108250871+stech11845@users.noreply.github.com> Date: Tue, 9 Aug 2022 01:21:01 -0600 Subject: [PATCH 3/3] Update README.md (#147) --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index e31e610..bb6c4ca 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ Supports data files from Windows and Full Tilt versions of the game. | MorphOS | BeWorld | https://www.morphos-storage.net/?id=1688897 | | AmigaOS 4 | rjd324 | http://aminet.net/package/game/actio/spacecadetpinball-aos4 | | Android (WIP) | fexed | https://github.com/fexed/Pinball-on-Android | +| Web | stech11845 | https://github.com/stech11845/SpaceCadetPinball-web Platforms covered by this project: desktop Windows, Linux and macOS.