From 685dfe78c261f2949c2903e7c8656112bdd37561 Mon Sep 17 00:00:00 2001 From: Muzychenko Andrey <33288308+k4zmu2a@users.noreply.github.com> Date: Mon, 18 Oct 2021 10:52:13 +0300 Subject: [PATCH] TPlunger: removed duplicated code. Ref PR#52. --- SpaceCadetPinball/TPlunger.cpp | 35 ++++++++++------------------------ 1 file changed, 10 insertions(+), 25 deletions(-) diff --git a/SpaceCadetPinball/TPlunger.cpp b/SpaceCadetPinball/TPlunger.cpp index dcbf324..eb289a3 100644 --- a/SpaceCadetPinball/TPlunger.cpp +++ b/SpaceCadetPinball/TPlunger.cpp @@ -54,28 +54,6 @@ int TPlunger::Message(int code, float value) PullbackTimer(0, this); } return 0; - case 1005: - case 1009: - case 1010: - { - Threshold = 0.0; - if (PullbackTimer_) - timer::kill(PullbackTimer_); - PullbackTimer_ = 0; - if (code == 1005) - loader::play_sound(SoundIndexP2); - auto bmp = ListBitmap->at(0); - auto zMap = ListZMap->at(0); - render::sprite_set( - RenderSprite, - bmp, - zMap, - bmp->XPosition - PinballTable->XOffset, - bmp->YPosition - PinballTable->YOffset); - - timer::set(Unknown4F, this, PlungerReleasedTimer); - break; - } case 1015: { auto ball = PinballTable->BallList.at(0); @@ -100,11 +78,18 @@ int TPlunger::Message(int code, float value) Boost = static_cast(MaxPullback); timer::set(0.2f, this, PlungerReleasedTimer); break; + case 1005: + case 1009: + case 1010: case 1024: { - if (BallFeedTimer_) - timer::kill(BallFeedTimer_); - BallFeedTimer_ = 0; + if (code == 1024) + { + if (BallFeedTimer_) + timer::kill(BallFeedTimer_); + BallFeedTimer_ = 0; + } + Threshold = 0.0; if (PullbackTimer_) timer::kill(PullbackTimer_);