From 14a8d64b67145274b44071f12190f51103534255 Mon Sep 17 00:00:00 2001 From: Muzychenko Andrey <33288308+k4zmu2a@users.noreply.github.com> Date: Wed, 24 Aug 2022 13:32:35 +0300 Subject: [PATCH] TLight: cleanup, code from FT, new test commands. --- SpaceCadetPinball/TLight.cpp | 330 ++++++++++++++++-------------- SpaceCadetPinball/TLight.h | 52 ++--- SpaceCadetPinball/TLightGroup.cpp | 42 ++-- SpaceCadetPinball/control.cpp | 12 +- SpaceCadetPinball/pb.cpp | 6 + 5 files changed, 232 insertions(+), 210 deletions(-) diff --git a/SpaceCadetPinball/TLight.cpp b/SpaceCadetPinball/TLight.cpp index 6903eaa..a59fe47 100644 --- a/SpaceCadetPinball/TLight.cpp +++ b/SpaceCadetPinball/TLight.cpp @@ -10,17 +10,17 @@ TLight::TLight(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, true) { - Timer1 = 0; - FlasherActive = 0; - Timer2 = 0; - Flasher.Timer = 0; + TimeoutTimer = 0; + FlasherOnFlag = false; + UndoOverrideTimer = 0; + FlashTimer = 0; Reset(); float* floatArr1 = loader::query_float_attribute(groupIndex, 0, 900); - Flasher.TimerDelay[0] = *floatArr1; - FlasherDelay[0] = *floatArr1; + FlashDelay[0] = *floatArr1; + SourceDelay[0] = *floatArr1; float* floatArr2 = loader::query_float_attribute(groupIndex, 0, 901); - Flasher.TimerDelay[1] = *floatArr2; - FlasherDelay[1] = *floatArr2; + FlashDelay[1] = *floatArr2; + SourceDelay[1] = *floatArr2; } int TLight::Message(int code, float value) @@ -34,183 +34,177 @@ int TLight::Message(int code, float value) for (auto index = 0; index < PinballTable->PlayerCount; ++index) { auto playerPtr = &PlayerData[index]; - playerPtr->FlasherActive = FlasherActive; - playerPtr->BmpIndex2 = BmpIndex2; - playerPtr->BmpIndex1 = BmpIndex1; + playerPtr->FlasherOnFlag = FlasherOnFlag; + playerPtr->LightOnBmpIndex = LightOnBmpIndex; + playerPtr->LightOnFlag = LightOnFlag; playerPtr->MessageField = MessageField; } break; case 1020: { auto playerPtr = &PlayerData[PinballTable->CurrentPlayer]; - playerPtr->FlasherActive = FlasherActive; - playerPtr->BmpIndex2 = BmpIndex2; - playerPtr->BmpIndex1 = BmpIndex1; + playerPtr->FlasherOnFlag = FlasherOnFlag; + playerPtr->LightOnBmpIndex = LightOnBmpIndex; + playerPtr->LightOnFlag = LightOnFlag; playerPtr->MessageField = MessageField; Reset(); playerPtr = &PlayerData[static_cast(floor(value))]; - FlasherActive = playerPtr->FlasherActive; - BmpIndex2 = playerPtr->BmpIndex2; - BmpIndex1 = playerPtr->BmpIndex1; + FlasherOnFlag = playerPtr->FlasherOnFlag; + LightOnBmpIndex = playerPtr->LightOnBmpIndex; + LightOnFlag = playerPtr->LightOnFlag; MessageField = playerPtr->MessageField; - if (BmpIndex2) + if (LightOnBmpIndex) { - Message(11, static_cast(BmpIndex2)); + Message(11, static_cast(LightOnBmpIndex)); } - if (BmpIndex1) + if (LightOnFlag) Message(1, 0.0); - if (FlasherActive) + if (FlasherOnFlag) Message(4, 0.0); break; } case 0: - BmpIndex1 = 0; - if (FlasherActive == 0 && !FlasherFlag1 && !FlasherFlag2) - render::sprite_set_bitmap(RenderSprite, Flasher.BmpArr[0]); + LightOnFlag = false; + if (!FlasherOnFlag && !ToggledOffFlag && !ToggledOnFlag) + SetSpriteBmp(BmpArr[0]); break; case 1: - BmpIndex1 = 1; - if (FlasherActive == 0 && !FlasherFlag1 && !FlasherFlag2) - render::sprite_set_bitmap(RenderSprite, Flasher.BmpArr[1]); + LightOnFlag = true; + if (!FlasherOnFlag && !ToggledOffFlag && !ToggledOnFlag) + SetSpriteBmp(BmpArr[1]); break; case 2: - return BmpIndex1; + return LightOnFlag; case 3: - return FlasherActive; + return FlasherOnFlag; case 4: schedule_timeout(0.0); - if (!FlasherActive || !Flasher.Timer) + if (!FlasherOnFlag || !FlashTimer) { - FlasherActive = 1; - FlasherFlag2 = 0; - FlasherFlag1 = 0; - TurnOffAfterFlashingFg = 0; - flasher_start(&Flasher, BmpIndex1); + FlasherOnFlag = true; + ToggledOnFlag = false; + ToggledOffFlag = false; + TurnOffAfterFlashingFg = false; + flasher_start(LightOnFlag); } break; case 5: - Flasher.TimerDelay[0] = value * FlasherDelay[0]; - Flasher.TimerDelay[1] = value * FlasherDelay[1]; + FlashDelay[0] = value * SourceDelay[0]; + FlashDelay[1] = value * SourceDelay[1]; break; case 6: - Flasher.TimerDelay[0] = FlasherDelay[0]; - Flasher.TimerDelay[1] = FlasherDelay[1]; + FlashDelay[0] = SourceDelay[0]; + FlashDelay[1] = SourceDelay[1]; break; case 7: - if (!FlasherActive) - flasher_start(&Flasher, BmpIndex1); - FlasherActive = 1; - FlasherFlag2 = 0; - TurnOffAfterFlashingFg = 0; - FlasherFlag1 = 0; + if (!FlasherOnFlag) + flasher_start(LightOnFlag); + FlasherOnFlag = true; + ToggledOnFlag = false; + TurnOffAfterFlashingFg = false; + ToggledOffFlag = false; schedule_timeout(value); break; case 8: - if (!FlasherFlag1) + if (!ToggledOffFlag) { - if (FlasherActive) + if (FlasherOnFlag) { - flasher_stop(&Flasher, 0); - FlasherActive = 0; + flasher_stop(0); + FlasherOnFlag = false; } else { - render::sprite_set_bitmap(RenderSprite, Flasher.BmpArr[0]); + SetSpriteBmp(BmpArr[0]); } - FlasherFlag1 = 1; - FlasherFlag2 = 0; + ToggledOffFlag = true; + ToggledOnFlag = false; } schedule_timeout(value); break; case 9: - if (!FlasherFlag2) + if (!ToggledOnFlag) { - if (FlasherActive) + if (FlasherOnFlag) { - flasher_stop(&Flasher, 1); - FlasherActive = 0; + flasher_stop(1); + FlasherOnFlag = false; } else { - render::sprite_set_bitmap(RenderSprite, Flasher.BmpArr[1]); + SetSpriteBmp(BmpArr[1]); } - FlasherFlag2 = 1; - FlasherFlag1 = 0; + ToggledOnFlag = true; + ToggledOffFlag = false; } schedule_timeout(value); break; case 11: - bmpIndex = 0; - BmpIndex2 = static_cast(floor(value)); - if (BmpIndex2 > static_cast(ListBitmap->size())) - BmpIndex2 = ListBitmap->size(); - if (BmpIndex2 < 0) - BmpIndex2 = 0; - Flasher.BmpArr[0] = nullptr; - Flasher.BmpArr[1] = ListBitmap->at(BmpIndex2); - if (FlasherActive == 0) + LightOnBmpIndex = Clamp(static_cast(floor(value)), 0, static_cast(ListBitmap->size()) - 1); + BmpArr[0] = nullptr; + BmpArr[1] = ListBitmap->at(LightOnBmpIndex); + if (!FlasherOnFlag) { - if (!FlasherFlag1) - { - if (FlasherFlag2) - bmpIndex = 1; - else - bmpIndex = BmpIndex1; - } + if (ToggledOffFlag) + bmpIndex = 0; + else if (ToggledOnFlag) + bmpIndex = 1; + else + bmpIndex = LightOnFlag; } else { - bmpIndex = Flasher.BmpIndex; + bmpIndex = FlashLightOnFlag; } - render::sprite_set_bitmap(RenderSprite, Flasher.BmpArr[bmpIndex]); + SetSpriteBmp(BmpArr[bmpIndex]); break; case 12: - bmpIndex = BmpIndex2 + 1; - if (bmpIndex > static_cast(ListBitmap->size())) - bmpIndex = ListBitmap->size(); + bmpIndex = LightOnBmpIndex + 1; + if (bmpIndex >= static_cast(ListBitmap->size())) + bmpIndex = static_cast(ListBitmap->size()) - 1; Message(11, static_cast(bmpIndex)); break; case 13: - bmpIndex = BmpIndex2 - 1; + bmpIndex = LightOnBmpIndex - 1; if (bmpIndex < 0) bmpIndex = 0; Message(11, static_cast(bmpIndex)); break; case 14: - if (Timer1) - timer::kill(Timer1); - Timer1 = 0; - if (FlasherActive != 0) - flasher_stop(&Flasher, -1); - FlasherActive = 0; - FlasherFlag1 = 0; - FlasherFlag2 = 0; - render::sprite_set_bitmap(RenderSprite, Flasher.BmpArr[BmpIndex1]); + if (TimeoutTimer) + timer::kill(TimeoutTimer); + TimeoutTimer = 0; + if (FlasherOnFlag) + flasher_stop(-1); + FlasherOnFlag = false; + ToggledOffFlag = false; + ToggledOnFlag = false; + SetSpriteBmp(BmpArr[LightOnFlag]); break; case 15: - TurnOffAfterFlashingFg = 0; - if (Timer2) - timer::kill(Timer2); - Timer2 = 0; + TurnOffAfterFlashingFg = false; + if (UndoOverrideTimer) + timer::kill(UndoOverrideTimer); + UndoOverrideTimer = 0; Message(1, 0.0); Message(7, value); break; case 16: - if (Timer2) - timer::kill(Timer2); - Timer2 = 0; + if (UndoOverrideTimer) + timer::kill(UndoOverrideTimer); + UndoOverrideTimer = 0; Message(7, value); - TurnOffAfterFlashingFg = 1; + TurnOffAfterFlashingFg = true; break; case 17: Message(static_cast(floor(value)) != 0, 0.0); - return BmpIndex1; + return LightOnFlag; case 18: Message(17, value); Message(14, 0.0); - return BmpIndex1; + return LightOnFlag; case 19: Message(1, 0.0); Message(14, 0.0); @@ -220,14 +214,34 @@ int TLight::Message(int code, float value) Message(14, 0.0); break; case 21: - Message(17, static_cast(BmpIndex1 == 0)); - return BmpIndex1; + Message(17, !LightOnFlag); + return LightOnFlag; case 22: - Message(18, static_cast(BmpIndex1 == 0)); - return BmpIndex1; + Message(18, !LightOnFlag); + return LightOnFlag; case 23: MessageField = static_cast(floor(value)); break; + case -24: + case -25: + // FT codes in negative to avoid overlap with 3DPB TLightGroup codes + render::sprite_set_bitmap(RenderSprite, BmpArr[code == -24]); + if (UndoOverrideTimer) + timer::kill(UndoOverrideTimer); + UndoOverrideTimer = 0; + if (value > 0) + { + TemporaryOverrideFlag = true; + UndoOverrideTimer = timer::set(value, this, UndoTmpOverride); + } + break; + case -26: + if (UndoOverrideTimer) + timer::kill(UndoOverrideTimer); + UndoOverrideTimer = 0; + TemporaryOverrideFlag = false; + render::sprite_set_bitmap(RenderSprite, PreviousBitmap); + break; default: break; } @@ -237,55 +251,53 @@ int TLight::Message(int code, float value) void TLight::Reset() { - if (Timer1) - timer::kill(Timer1); - if (Timer2) - timer::kill(Timer2); - if (FlasherActive) - flasher_stop(&Flasher, -1); - Unknown20F = 1.0; - Timer1 = 0; - Timer2 = 0; - BmpIndex1 = 0; - BmpIndex2 = 0; - FlasherFlag1 = 0; - FlasherFlag2 = 0; - FlasherActive = 0; - TurnOffAfterFlashingFg = 0; + if (TimeoutTimer) + timer::kill(TimeoutTimer); + if (UndoOverrideTimer) + timer::kill(UndoOverrideTimer); + if (FlasherOnFlag) + flasher_stop(-1); + TimeoutTimer = 0; + UndoOverrideTimer = 0; + LightOnFlag = false; + LightOnBmpIndex = 0; + ToggledOffFlag = false; + ToggledOnFlag = false; + FlasherOnFlag = false; + TemporaryOverrideFlag = false; + TurnOffAfterFlashingFg = false; + PreviousBitmap = nullptr; render::sprite_set_bitmap(RenderSprite, nullptr); - Flasher.Sprite = RenderSprite; - Flasher.BmpArr[0] = nullptr; + BmpArr[0] = nullptr; if (ListBitmap) - Flasher.BmpArr[1] = ListBitmap->at(0); - Flasher.Unknown4 = 0; - Flasher.Unknown3 = 0; + BmpArr[1] = ListBitmap->at(0); MessageField = 0; } void TLight::schedule_timeout(float time) { - Flasher.TimerDelay[0] = FlasherDelay[0]; - Flasher.TimerDelay[1] = FlasherDelay[1]; - if (Timer1) - timer::kill(Timer1); - Timer1 = 0; + FlashDelay[0] = SourceDelay[0]; + FlashDelay[1] = SourceDelay[1]; + if (TimeoutTimer) + timer::kill(TimeoutTimer); + TimeoutTimer = 0; if (time > 0.0f) - Timer1 = timer::set(time, this, TimerExpired); + TimeoutTimer = timer::set(time, this, TimerExpired); } void TLight::TimerExpired(int timerId, void* caller) { auto light = static_cast(caller); - if (light->FlasherActive) - flasher_stop(&light->Flasher, -1); - render::sprite_set_bitmap(light->RenderSprite, light->Flasher.BmpArr[light->BmpIndex1]); - light->FlasherFlag1 = 0; - light->FlasherFlag2 = 0; - light->FlasherActive = 0; - light->Timer1 = 0; - if (light->TurnOffAfterFlashingFg != 0) + if (light->FlasherOnFlag) + light->flasher_stop(-1); + light->SetSpriteBmp(light->BmpArr[light->LightOnFlag]); + light->ToggledOffFlag = false; + light->ToggledOnFlag = false; + light->FlasherOnFlag = false; + light->TimeoutTimer = 0; + if (light->TurnOffAfterFlashingFg) { - light->TurnOffAfterFlashingFg = 0; + light->TurnOffAfterFlashingFg = false; light->Message(20, 0.0); } if (light->Control) @@ -293,29 +305,41 @@ void TLight::TimerExpired(int timerId, void* caller) } -void TLight::flasher_stop(flasher_type* flash, int bmpIndex) +void TLight::flasher_stop(int bmpIndex) { - if (flash->Timer) - timer::kill(flash->Timer); - flash->Timer = 0; + if (FlashTimer) + timer::kill(FlashTimer); + FlashTimer = 0; if (bmpIndex >= 0) { - flash->BmpIndex = bmpIndex; - render::sprite_set_bitmap(flash->Sprite, flash->BmpArr[bmpIndex]); + FlashLightOnFlag = bmpIndex; + SetSpriteBmp(BmpArr[FlashLightOnFlag]); } } -void TLight::flasher_start(flasher_type* flash, int bmpIndex) +void TLight::flasher_start(bool bmpIndex) { - flash->BmpIndex = bmpIndex; - flasher_callback(0, flash); + FlashLightOnFlag = bmpIndex; + flasher_callback(0, this); +} + +void TLight::SetSpriteBmp(gdrv_bitmap8* bmp) +{ + PreviousBitmap = bmp; + if (!TemporaryOverrideFlag) + render::sprite_set_bitmap(RenderSprite, bmp); } void TLight::flasher_callback(int timerId, void* caller) { - auto flash = static_cast(caller); - auto index = 1 - flash->BmpIndex; - flash->BmpIndex = index; - render::sprite_set_bitmap(flash->Sprite, flash->BmpArr[index]); - flash->Timer = timer::set(flash->TimerDelay[flash->BmpIndex], flash, flasher_callback); + auto light = static_cast(caller); + light->FlashLightOnFlag ^= true; + light->SetSpriteBmp(light->BmpArr[light->FlashLightOnFlag]); + light->FlashTimer = timer::set(light->FlashDelay[light->FlashLightOnFlag], light, flasher_callback); +} + +void TLight::UndoTmpOverride(int timerId, void* caller) +{ + auto light = static_cast(caller); + light->Message(-26, 0.0f); } diff --git a/SpaceCadetPinball/TLight.h b/SpaceCadetPinball/TLight.h index 7ea2280..3990b3d 100644 --- a/SpaceCadetPinball/TLight.h +++ b/SpaceCadetPinball/TLight.h @@ -3,26 +3,12 @@ struct gdrv_bitmap8; -struct flasher_type -{ - render_sprite_type_struct* Sprite; - gdrv_bitmap8* BmpArr[2]; - int Unknown3; - int Unknown4; - float TimerDelay[2]; - int Timer; - int BmpIndex; -}; - - struct TLight_player_backup { int MessageField; - int BmpIndex1; - int FlasherActive; - int Unknown3; - int Unknown4; - int BmpIndex2; + bool LightOnFlag; + int LightOnBmpIndex; + bool FlasherOnFlag; }; @@ -34,22 +20,28 @@ public: int Message(int code, float value) override; void Reset(); void schedule_timeout(float time); + void flasher_stop(int bmpIndex); + void flasher_start(bool bmpIndex); + void SetSpriteBmp(gdrv_bitmap8* bmp); static void TimerExpired(int timerId, void* caller); - static void flasher_stop(flasher_type* flash, int bmpIndex); - static void flasher_start(struct flasher_type* flash, int bmpIndex); static void flasher_callback(int timerId, void* caller); + static void UndoTmpOverride(int timerId, void* caller); - flasher_type Flasher{}; - int BmpIndex1{}; - int FlasherActive; - int FlasherFlag1{}; - int FlasherFlag2{}; - int TurnOffAfterFlashingFg{}; - int BmpIndex2{}; - float FlasherDelay[2]{}; - int Timer1; - int Timer2; - float Unknown20F{}; + gdrv_bitmap8* BmpArr[2]; + float FlashDelay[2]; + int FlashTimer; + bool FlashLightOnFlag; + bool LightOnFlag{}; + bool FlasherOnFlag; + bool ToggledOffFlag{}; + bool ToggledOnFlag{}; + bool TurnOffAfterFlashingFg{}; + int LightOnBmpIndex{}; + float SourceDelay[2]{}; + int TimeoutTimer; + int UndoOverrideTimer; + bool TemporaryOverrideFlag{}; + gdrv_bitmap8* PreviousBitmap{}; TLight_player_backup PlayerData[4]{}; }; diff --git a/SpaceCadetPinball/TLightGroup.cpp b/SpaceCadetPinball/TLightGroup.cpp index 616a906..3ef62d1 100644 --- a/SpaceCadetPinball/TLightGroup.cpp +++ b/SpaceCadetPinball/TLightGroup.cpp @@ -66,7 +66,7 @@ int TLightGroup::Message(int code, float value) case 24: { auto lastLight = List.at(count - 1); - if (lastLight->FlasherActive || lastLight->FlasherFlag2 || lastLight->FlasherFlag1) + if (lastLight->FlasherOnFlag || lastLight->ToggledOnFlag || lastLight->ToggledOffFlag) break; if (MessageField2) { @@ -75,16 +75,16 @@ int TLightGroup::Message(int code, float value) AnimationFlag = 1; MessageField2 = code; auto lightMessageField = lastLight->MessageField; - auto bmpIndex1 = lastLight->BmpIndex1; + auto lightStatusBefore = lastLight->LightOnFlag; for (auto index = count - 1; index > 0; --index) { auto lightCur = List.at(index); auto lightPrev = List.at(index - 1); - lightCur->Message(lightPrev->BmpIndex1 != 0, 0.0); + lightCur->Message(lightPrev->LightOnFlag, 0.0); lightCur->MessageField = lightPrev->MessageField; } auto firstLight = List.at(0); - firstLight->Message(bmpIndex1 != 0, 0.0); + firstLight->Message(lightStatusBefore, 0.0); firstLight->MessageField = lightMessageField; reschedule_animation(value); break; @@ -92,7 +92,7 @@ int TLightGroup::Message(int code, float value) case 25: { auto lastLight = List.at(count - 1); - if (lastLight->FlasherActive || lastLight->FlasherFlag2 || lastLight->FlasherFlag1) + if (lastLight->FlasherOnFlag || lastLight->ToggledOnFlag || lastLight->ToggledOffFlag) break; if (MessageField2) { @@ -102,15 +102,15 @@ int TLightGroup::Message(int code, float value) AnimationFlag = 1; MessageField2 = code; auto lightMessageField = firstLight->MessageField; - auto bmpIndex1 = firstLight->BmpIndex1; + auto lightStatusBefore = firstLight->LightOnFlag; for (auto index = 0; index < count - 1; index++) { auto lightCur = List.at(index); auto lightNext = List.at(index + 1); - lightCur->Message(lightNext->BmpIndex1 != 0, 0.0); + lightCur->Message(lightNext->LightOnFlag, 0.0); lightCur->MessageField = lightNext->MessageField; } - lastLight->Message(bmpIndex1 != 0, 0.0); + lastLight->Message(lightStatusBefore, 0.0); lastLight->MessageField = lightMessageField; reschedule_animation(value); break; @@ -122,12 +122,12 @@ int TLightGroup::Message(int code, float value) MessageField2 = code; AnimationFlag = 0; auto lastLight = List.at(count - 1); - auto flasherFlag2 = lastLight->FlasherFlag2; + auto flasherFlag2 = lastLight->ToggledOnFlag; for (auto i = count - 1; i > 0; --i) { auto lightCur = List.at(i); auto lightPrev = List.at(i - 1); - lightCur->Message((lightPrev->FlasherFlag2 != 0) + 8, 0.0); + lightCur->Message(lightPrev->ToggledOnFlag + 8, 0.0); } auto firstLight = List.at(0); firstLight->Message((flasherFlag2 != 0) + 8, 0); @@ -141,12 +141,12 @@ int TLightGroup::Message(int code, float value) MessageField2 = code; AnimationFlag = 0; auto firstLight = List.at(0); - auto flasherFlag2 = firstLight->FlasherFlag2; + auto flasherFlag2 = firstLight->ToggledOnFlag; for (auto i = 0; i < count - 1; i++) { auto lightCur = List.at(i); auto lightNext = List.at(i + 1); - lightCur->Message((lightNext->FlasherFlag2 != 0) + 8, 0.0); + lightCur->Message(lightNext->ToggledOnFlag + 8, 0.0); } auto lastLight = List.at(count - 1); lastLight->Message((flasherFlag2 != 0) + 8, 0); @@ -189,7 +189,7 @@ int TLightGroup::Message(int code, float value) auto noBmpInd1Count = 0; for (auto light : List) { - if (!light->BmpIndex1) + if (!light->LightOnFlag) ++noBmpInd1Count; } if (!noBmpInd1Count) @@ -199,7 +199,7 @@ int TLightGroup::Message(int code, float value) for (auto it = List.rbegin(); it != List.rend(); ++it) { auto light = *it; - if (!light->BmpIndex1 && randModCount-- == 0) + if (!light->LightOnFlag && randModCount-- == 0) { light->Message(1, 0.0); break; @@ -215,7 +215,7 @@ int TLightGroup::Message(int code, float value) auto bmpInd1Count = 0; for (auto light : List) { - if (light->BmpIndex1) + if (light->LightOnFlag) ++bmpInd1Count; } if (!bmpInd1Count) @@ -225,7 +225,7 @@ int TLightGroup::Message(int code, float value) for (auto it = List.rbegin(); it != List.rend(); ++it) { auto light = *it; - if (light->BmpIndex1 && randModCount-- == 0) + if (light->LightOnFlag && randModCount-- == 0) { light->Message(0, 0.0); break; @@ -296,7 +296,7 @@ int TLightGroup::Message(int code, float value) auto bmp1Count = 0; for (auto light : List) { - if (light->BmpIndex1) + if (light->LightOnFlag) ++bmp1Count; } return bmp1Count; @@ -339,7 +339,7 @@ int TLightGroup::Message(int code, float value) for (auto it = List.rbegin(); it != List.rend(); ++it) { auto light = *it; - if (light->BmpIndex1) + if (light->LightOnFlag) { light->Message(0, 0.0); light->Message(16, value); @@ -421,7 +421,7 @@ void TLightGroup::start_animation() for (auto it = List.rbegin(); it != List.rend(); ++it) { auto light = *it; - if (light->BmpIndex1) + if (light->LightOnFlag) light->Message(9, 0.0); else light->Message(8, 0.0); @@ -432,7 +432,7 @@ int TLightGroup::next_light_up() { for (auto index = 0u; index < List.size(); ++index) { - if (!List[index]->BmpIndex1) + if (!List[index]->LightOnFlag) return static_cast(index); } return -1; @@ -442,7 +442,7 @@ int TLightGroup::next_light_down() { for (auto index = static_cast(List.size()) - 1; index >= 0; --index) { - if (List.at(index)->BmpIndex1) + if (List.at(index)->LightOnFlag) return index; } return -1; diff --git a/SpaceCadetPinball/control.cpp b/SpaceCadetPinball/control.cpp index 8881e19..0492164 100644 --- a/SpaceCadetPinball/control.cpp +++ b/SpaceCadetPinball/control.cpp @@ -999,7 +999,7 @@ void control::cheat_bump_rank() bool control::light_on(component_tag* tag) { auto light = tag->Component; - return light->BmpIndex1 || light->FlasherFlag2 || light->FlasherActive; + return light->LightOnFlag || light->ToggledOnFlag || light->FlasherOnFlag; } int control::SpecialAddScore(int score) @@ -1297,9 +1297,9 @@ void control::ReentryLanesRolloverControl(int code, TPinballComponent* caller) if (roll2 != caller) light = lite10; } - if (!light->FlasherActive) + if (!light->FlasherOnFlag) { - if (light->BmpIndex1) + if (light->LightOnFlag) { light->Message(20, 0.0); } @@ -1353,9 +1353,9 @@ void control::LaunchLanesRolloverControl(int code, TPinballComponent* caller) if (roll111 != caller) light = lite169; } - if (!light->FlasherActive) + if (!light->FlasherOnFlag) { - if (light->BmpIndex1) + if (light->LightOnFlag) { light->Message(20, 0.0); } @@ -1865,7 +1865,7 @@ void control::MissionSpotTargetControl(int code, TPinballComponent* caller) lite->Message(15, 2.0); TSound* sound; - if (!light_on(&control_lite198_tag) || lite198->FlasherActive) + if (!light_on(&control_lite198_tag) || lite198->FlasherOnFlag) { sound = soundwave52; } diff --git a/SpaceCadetPinball/pb.cpp b/SpaceCadetPinball/pb.cpp index 02f1d72..87670ab 100644 --- a/SpaceCadetPinball/pb.cpp +++ b/SpaceCadetPinball/pb.cpp @@ -513,6 +513,12 @@ void pb::InputDown(GameInput input) case SDLK_F12: MainTable->port_draw(); break; + case 'i': + MainTable->LightGroup->Message(-24, 1.0f); + break; + case 'j': + MainTable->LightGroup->Message(-25, 1.0f); + break; } } }