Compare commits

..

No commits in common. "e9a4791322fcf3f8f291f8dd5e1081c157983906" and "54a217c27b6f8d4483a00c6bc4520037b7a09ba0" have entirely different histories.

4 changed files with 15 additions and 13 deletions

View File

@ -26,7 +26,6 @@ Supports data files from Windows and Full Tilt versions of the game.
| MorphOS | BeWorld | https://www.morphos-storage.net/?id=1688897 | | MorphOS | BeWorld | https://www.morphos-storage.net/?id=1688897 |
| AmigaOS 4 | rjd324 | http://aminet.net/package/game/actio/spacecadetpinball-aos4 | | AmigaOS 4 | rjd324 | http://aminet.net/package/game/actio/spacecadetpinball-aos4 |
| Android (WIP) | fexed | https://github.com/fexed/Pinball-on-Android | | 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. Platforms covered by this project: desktop Windows, Linux and macOS.

View File

@ -137,7 +137,7 @@ void TFlipper::TimerExpired(int timerId, void* caller)
auto flip = static_cast<TFlipper*>(caller); auto flip = static_cast<TFlipper*>(caller);
int bmpCountSub1 = flip->ListBitmap->size() - 1; int bmpCountSub1 = flip->ListBitmap->size() - 1;
auto newBmpIndex = static_cast<int>(floor(flip->FlipperEdge->flipper_angle(pb::time_now) / flip->FlipperEdge->AngleMax * bmpCountSub1 + 0.5)); auto newBmpIndex = static_cast<int>(floor((pb::time_now - flip->InputTime) / flip->TimerTime));
if (newBmpIndex > bmpCountSub1) if (newBmpIndex > bmpCountSub1)
newBmpIndex = bmpCountSub1; newBmpIndex = bmpCountSub1;
if (newBmpIndex < 0) if (newBmpIndex < 0)
@ -155,7 +155,7 @@ void TFlipper::TimerExpired(int timerId, void* caller)
} }
if (flip->MessageField == 2) if (flip->MessageField == 2)
{ {
flip->BmpIndex = newBmpIndex; flip->BmpIndex = bmpCountSub1 - newBmpIndex;
if (flip->BmpIndex <= 0) if (flip->BmpIndex <= 0)
{ {
flip->BmpIndex = 0; flip->BmpIndex = 0;

View File

@ -418,17 +418,19 @@ float TFlipperEdge::flipper_angle(float timeNow)
{ {
if (!FlipperFlag) if (!FlipperFlag)
return Angle1; return Angle1;
float angle = (Angle1 - Angle2) / AngleMax * AngleMult;
if (angle < 0.0f)
angle = -angle;
float currentAngleDuration = fabsf((Angle1 - Angle2) / AngleMax * AngleMult); if (angle >= 0.0000001f)
float currentAngleRatio; angle = (timeNow - InputTime) / angle;
if (currentAngleDuration >= 0.0000001f)
currentAngleRatio = (timeNow - InputTime) / currentAngleDuration;
else else
currentAngleRatio = 1.0; angle = 1.0;
currentAngleRatio = std::min(1.0f, std::max(currentAngleRatio, 0.0f)); angle = std::min(1.0f, std::max(angle, 0.0f));
return currentAngleRatio * (Angle1 - Angle2) + Angle2; if (FlipperFlag == 2)
angle = 1.0f - angle;
return angle * AngleMax;
} }
int TFlipperEdge::is_ball_inside(float x, float y) int TFlipperEdge::is_ball_inside(float x, float y)
@ -480,6 +482,7 @@ void TFlipperEdge::SetMotion(int code, float value)
default: break; default: break;
} }
if (!FlipperFlag)
InputTime = value; InputTime = value;
FlipperFlag = code; FlipperFlag = code;
AngleStopTime = AngleMult + InputTime; AngleStopTime = AngleMult + InputTime;

View File

@ -898,7 +898,7 @@ int winmain::ProcessWindowMessages()
{ {
static auto idleWait = 0; static auto idleWait = 0;
SDL_Event event; SDL_Event event;
if (has_focus) if (has_focus && !single_step)
{ {
idleWait = static_cast<int>(TargetFrameTime.count()); idleWait = static_cast<int>(TargetFrameTime.count());
while (SDL_PollEvent(&event)) while (SDL_PollEvent(&event))