这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions SpaceCadetPinball/TFlipper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ void TFlipper::TimerExpired(int timerId, void* caller)
auto flip = static_cast<TFlipper*>(caller);
int bmpCountSub1 = flip->ListBitmap->size() - 1;

auto newBmpIndex = static_cast<int>(floor((pb::time_now - flip->InputTime) / flip->TimerTime));
auto newBmpIndex = static_cast<int>(floor(flip->FlipperEdge->flipper_angle(pb::time_now) / flip->FlipperEdge->AngleMax * bmpCountSub1 + 0.5));
if (newBmpIndex > bmpCountSub1)
newBmpIndex = bmpCountSub1;
if (newBmpIndex < 0)
Expand All @@ -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;
Expand Down
21 changes: 9 additions & 12 deletions SpaceCadetPinball/TFlipperEdge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -482,8 +480,7 @@ void TFlipperEdge::SetMotion(int code, float value)
default: break;
}

if (!FlipperFlag)
InputTime = value;
InputTime = value;
FlipperFlag = code;
AngleStopTime = AngleMult + InputTime;
}