1
0
Fork 0
mirror of https://github.com/k4zmu2a/SpaceCadetPinball.git synced 2025-02-09 23:20:14 +01:00

Message code enum part 5: control codes.

This commit is contained in:
Muzychenko Andrey 2022-09-07 16:01:38 +03:00
parent dfe1665ba1
commit 22603aa126
29 changed files with 489 additions and 476 deletions

View file

@ -66,5 +66,5 @@ void TBlocker::TimerExpired(int timerId, void* caller)
{
auto blocker = static_cast<TBlocker*>(caller);
blocker->Timer = 0;
control::handler(60, blocker);
control::handler(MessageCode::ControlTimerExpired, blocker);
}

View file

@ -41,7 +41,7 @@ int TBumper::Message(MessageCode code, float value)
loader::play_sound(SoundIndex3, this, "TBumper2");
BmpIndex = nextBmp;
Fire();
control::handler(11, this);
control::handler(MessageCode::TBumperSetBmpIndex, this);
}
break;
}
@ -103,7 +103,7 @@ void TBumper::Collision(TBall* ball, vector2* nextPosition, vector2* direction,
if (DefaultCollision(ball, nextPosition, direction))
{
Fire();
control::handler(63, this);
control::handler(MessageCode::ControlCollision, this);
}
}

View file

@ -60,5 +60,5 @@ void TComponentGroup::NotifyTimerExpired(int timerId, void* caller)
{
auto compGroup = static_cast<TComponentGroup*>(caller);
compGroup->Timer = 0;
control::handler(61, compGroup);
control::handler(MessageCode::ControlNotifyTimerExpired, compGroup);
}

View file

@ -38,11 +38,11 @@ void TDrain::Collision(TBall* ball, vector2* nextPosition, vector2* direction, f
PinballTable->BallInDrainFlag = 1;
Timer = timer::set(TimerTime, this, TimerCallback);
}
control::handler(63, this);
control::handler(MessageCode::ControlCollision, this);
}
void TDrain::TimerCallback(int timerId, void* caller)
{
auto drain = static_cast<TDrain*>(caller);
control::handler(60, drain);
control::handler(MessageCode::ControlTimerExpired, drain);
}

View file

@ -104,11 +104,11 @@ void TFlagSpinner::NextFrame()
if (!PinballTable->TiltLockFlag)
{
control::handler(63, this);
control::handler(MessageCode::ControlCollision, this);
if (SoftHitSoundId)
loader::play_sound(SoftHitSoundId, this, "TFlagSpinner");
if (!BmpIndex)
control::handler(62, this);
control::handler(MessageCode::ControlSpinnerLoopReset, this);
}
auto bmp = ListBitmap->at(BmpIndex);

View file

@ -70,7 +70,7 @@ int TFlipper::Message(MessageCode code, float value)
case MessageCode::GameOver:
if (code == MessageCode::TFlipperExtend)
{
control::handler(1, this);
control::handler(MessageCode::TFlipperExtend, this);
loader::play_sound(HardHitSoundId, this, "TFlipper1");
}
else if (code == MessageCode::TFlipperRetract)

View file

@ -15,7 +15,7 @@ TGate::TGate(TPinballTable* table, int groupIndex) : TCollisionComponent(table,
SoundIndex3 = visual.SoundIndex3;
ActiveFlag = 1;
render::sprite_set_bitmap(RenderSprite, ListBitmap->at(0));
control::handler(1024, this);
control::handler(MessageCode::Reset, this);
}
int TGate::Message(MessageCode code, float value)
@ -37,6 +37,6 @@ int TGate::Message(MessageCode code, float value)
default: break;
}
control::handler(~code, this);
control::handler(code, this);
return 0;
}

View file

@ -88,7 +88,7 @@ void THole::Collision(TBall* ball, vector2* nextPosition, vector2* direction, fl
if (!PinballTable->TiltLockFlag)
{
loader::play_sound(HardHitSoundId, ball, "THole1");
control::handler(57, this);
control::handler(MessageCode::ControlBallCaptured, this);
}
}
}
@ -116,7 +116,7 @@ int THole::FieldEffect(TBall* ball, vector2* vecDst)
ball->Direction.X = 0.0;
ball->Speed = 0.0;
loader::play_sound(SoftHitSoundId, ball, "THole2");
control::handler(58, this);
control::handler(MessageCode::ControlBallReleased, this);
}
}
result = 0;

View file

@ -89,6 +89,6 @@ void TKickback::TimerExpired(int timerId, void* caller)
bmp->YPosition - kick->PinballTable->YOffset);
}
kick->Timer = 0;
control::handler(60, kick);
control::handler(MessageCode::ControlTimerExpired, kick);
}
}

View file

@ -112,7 +112,7 @@ void TKickout::Collision(TBall* ball, vector2* nextPosition, vector2* direction,
else
{
loader::play_sound(SoftHitSoundId, ball, "TKickout1");
control::handler(63, this);
control::handler(MessageCode::ControlCollision, this);
}
}
}

View file

@ -301,7 +301,7 @@ void TLight::TimerExpired(int timerId, void* caller)
light->Message(MessageCode::TLightResetAndTurnOff, 0.0);
}
if (light->Control)
control::handler(60, light);
control::handler(MessageCode::ControlTimerExpired, light);
}

View file

@ -120,11 +120,11 @@ void TLightBargraph::BargraphTimerExpired(int timerId, void* caller)
if (bar->TimeIndex)
{
bar->Message(MessageCode::TLightGroupToggleSplitIndex, static_cast<float>(bar->TimeIndex - 1));
control::handler(60, bar);
control::handler(MessageCode::ControlTimerExpired, bar);
}
else
{
bar->Message(MessageCode::TLightResetAndTurnOff, 0.0);
control::handler(47, bar);
control::handler(MessageCode::TLightGroupCountdownEnded, bar);
}
}

View file

@ -351,7 +351,7 @@ int TLightGroup::Message(MessageCode code, float value)
}
case MessageCode::TLightGroupToggleSplitIndex:
{
control::handler(~code, this);
control::handler(code, this);
auto index = static_cast<int>(floor(value));
if (index >= 0 && index < count)
{
@ -460,5 +460,5 @@ void TLightGroup::NotifyTimerExpired(int timerId, void* caller)
{
auto group = static_cast<TLightGroup*>(caller);
group->NotifyTimer = 0;
control::handler(61, group);
control::handler(MessageCode::ControlNotifyTimerExpired, group);
}

View file

@ -54,7 +54,7 @@ void TLightRollover::Collision(TBall* ball, vector2* nextPosition, vector2* dire
else
{
loader::play_sound(SoftHitSoundId, this, "TLightRollover");
control::handler(63, this);
control::handler(MessageCode::ControlCollision, this);
RolloverFlag = RolloverFlag == 0;
if (ListBitmap)
render::sprite_set_bitmap(RenderSprite, ListBitmap->at(0));

View file

@ -52,7 +52,7 @@ void TOneway::Collision(TBall* ball, vector2* nextPosition, vector2* direction,
{
if (HardHitSoundId)
loader::play_sound(HardHitSoundId, ball, "TOneway1");
control::handler(63, this);
control::handler(MessageCode::ControlCollision, this);
}
}
else if (PinballTable->TiltLockFlag)

View file

@ -65,10 +65,7 @@ enum class MessageCode
TLightGroupFlashWhenOn = 44,
TLightGroupToggleSplitIndex = 45,
TLightGroupStartFlasher = 46,
TBlockerDisable = 51,
TBlockerEnable = 52,
TBlockerRestartTimeout = 59,
TLightGroupCountdownEnded = 47,
TBumperSetBmpIndex = 11,
TBumperIncBmpIndex = 12,
@ -76,14 +73,18 @@ enum class MessageCode
TComponentGroupResetNotifyTimer = 48,
TPopupTargetDisable = 49,
TPopupTargetEnable = 50,
TBlockerDisable = 51,
TBlockerEnable = 52,
TBlockerRestartTimeout = 59,
TGateDisable = 53,
TGateEnable = 54,
TKickoutRestartTimer = 55,
TPopupTargetDisable = 49,
TPopupTargetEnable = 50,
TSinkUnknown7 = 7,
TSinkResetTimer = 56,
@ -92,6 +93,17 @@ enum class MessageCode
TTimerResetTimer = 59,
ControlBallCaptured = 57,
ControlBallReleased = 58,
ControlTimerExpired = 60,
ControlNotifyTimerExpired = 61,
ControlSpinnerLoopReset = 62,
ControlCollision = 63,
ControlEnableMultiplier = 64,
ControlDisableMultiplier = 65,
ControlMissionComplete = 66,
ControlMissionStarted = 67,
// Public codes 1000+, apply to all components
LeftFlipperInputPressed = 1000,
LeftFlipperInputReleased = 1001,

View file

@ -301,7 +301,7 @@ void TPinballTable::tilt(float time)
}
LightGroup->Message(MessageCode::TLightTurnOffTimed, 0);
TiltLockFlag = 1;
control::table_control_handler(1011);
control::table_control_handler(MessageCode::SetTiltLock);
}
}
@ -589,7 +589,7 @@ int TPinballTable::Message(MessageCode code, float value)
default: break;
}
control::table_control_handler(~code);
control::table_control_handler(code);
return 0;
}
@ -662,7 +662,7 @@ void TPinballTable::EndGame_timeout(int timerId, void* caller)
}
if (table->Demo)
table->Demo->Message(MessageCode::GameOver, 0.0);
control::handler(67, pb::MissTextBox);
control::handler(MessageCode::ControlMissionStarted, pb::MissTextBox);
pb::InfoTextBox->Display(pb::get_rc_string(Msg::STRING125), -1.0);
}

View file

@ -168,7 +168,7 @@ int TPlunger::Message(MessageCode code, float value)
break;
}
control::handler(~code, this);
control::handler(code, this);
return 0;
}

View file

@ -70,7 +70,7 @@ void TPopupTarget::Collision(TBall* ball, vector2* nextPosition, vector2* direct
if (HardHitSoundId)
loader::play_sound(HardHitSoundId, this, "TPopupTarget1");
Message(MessageCode::TPopupTargetDisable, 0.0);
control::handler(63, this);
control::handler(MessageCode::ControlCollision, this);
}
}

View file

@ -154,7 +154,7 @@ void TRamp::Collision(TBall* ball, vector2* nextPosition, vector2* direction, fl
if (!PinballTable->TiltLockFlag)
{
loader::play_sound(SoftHitSoundId, ball, "TRamp");
control::handler(63, this);
control::handler(MessageCode::ControlCollision, this);
}
}
else

View file

@ -55,7 +55,7 @@ void TRollover::Collision(TBall* ball, vector2* nextPosition, vector2* direction
else
{
loader::play_sound(SoftHitSoundId, ball, "TRollover");
control::handler(63, this);
control::handler(MessageCode::ControlCollision, this);
}
RolloverFlag = RolloverFlag == 0;
if (ListBitmap)

View file

@ -65,7 +65,7 @@ void TSink::Collision(TBall* ball, vector2* nextPosition, vector2* direction, fl
{
ball->Disable();
loader::play_sound(SoundIndex4, ball, "TSink1");
control::handler(63, this);
control::handler(MessageCode::ControlCollision, this);
}
}

View file

@ -60,7 +60,7 @@ void TSoloTarget::Collision(TBall* ball, vector2* nextPosition, vector2* directi
{
Message(MessageCode::TSoloTargetDisable, 0.0);
Timer = timer::set(TimerTime, this, TimerExpired);
control::handler(63, this);
control::handler(MessageCode::ControlCollision, this);
}
}

View file

@ -67,7 +67,7 @@ void TTextBox::TimerExpired(int timerId, void* caller)
delete message;
tb->CurrentMessage = nextMessage;
tb->Draw();
control::handler(60, tb);
control::handler(MessageCode::ControlTimerExpired, tb);
}
}

View file

@ -37,5 +37,5 @@ void TTimer::TimerExpired(int timerId, void* caller)
{
auto timer = static_cast<TTimer*>(caller);
timer->Timer = 0;
control::handler(60, timer);
control::handler(MessageCode::ControlTimerExpired, timer);
}

View file

@ -20,6 +20,6 @@ void TTripwire::Collision(TBall* ball, vector2* nextPosition, vector2* direction
if (!PinballTable->TiltLockFlag)
{
loader::play_sound(SoftHitSoundId, ball, "TTripwire");
control::handler(63, this);
control::handler(MessageCode::ControlCollision, this);
}
}

View file

@ -33,7 +33,7 @@ void TWall::Collision(TBall* ball, vector2* nextPosition, vector2* direction, fl
render::sprite_set_bitmap(RenderSprite, BmpPtr);
Timer = timer::set(0.1f, this, TimerExpired);
}
control::handler(63, this);
control::handler(MessageCode::ControlCollision, this);
}
}

View file

@ -888,7 +888,7 @@ TPinballComponent* control::make_component_link(component_tag_base& tag)
return nullptr;
}
void control::handler(int code, TPinballComponent* cmp)
void control::handler(MessageCode code, TPinballComponent* cmp)
{
component_control* control = cmp->Control;
@ -927,7 +927,7 @@ void control::pbctrl_bdoor_controller(char key)
}
else if (strcmp(bufferEnd - 4, "gmax") == 0)
{
GravityWellKickoutControl(64, nullptr);
GravityWellKickoutControl(MessageCode::ControlEnableMultiplier, nullptr);
}
else if (strcmp(bufferEnd - 4, "1max") == 0)
{
@ -1133,9 +1133,9 @@ void control::AdvanceWormHoleDestination(int flag)
}
}
void control::FlipperRebounderControl1(int code, TPinballComponent* caller)
void control::FlipperRebounderControl1(MessageCode code, TPinballComponent* caller)
{
if (code == 63)
if (code == MessageCode::ControlCollision)
{
lite84->Message(MessageCode::TLightTurnOnTimed, 0.1f);
auto score = caller->get_scoring(0);
@ -1143,9 +1143,9 @@ void control::FlipperRebounderControl1(int code, TPinballComponent* caller)
}
}
void control::FlipperRebounderControl2(int code, TPinballComponent* caller)
void control::FlipperRebounderControl2(MessageCode code, TPinballComponent* caller)
{
if (code == 63)
if (code == MessageCode::ControlCollision)
{
lite85->Message(MessageCode::TLightTurnOnTimed, 0.1f);
int score = caller->get_scoring(0);
@ -1153,66 +1153,66 @@ void control::FlipperRebounderControl2(int code, TPinballComponent* caller)
}
}
void control::RebounderControl(int code, TPinballComponent* caller)
void control::RebounderControl(MessageCode code, TPinballComponent* caller)
{
if (code == 63)
if (code == MessageCode::ControlCollision)
{
TableG->AddScore(caller->get_scoring(0));
}
}
void control::BumperControl(int code, TPinballComponent* caller)
void control::BumperControl(MessageCode code, TPinballComponent* caller)
{
if (code == 63)
if (code == MessageCode::ControlCollision)
{
TableG->AddScore(caller->get_scoring(static_cast<TBumper*>(caller)->BmpIndex));
}
}
void control::LeftKickerControl(int code, TPinballComponent* caller)
void control::LeftKickerControl(MessageCode code, TPinballComponent* caller)
{
if (code == 60)
if (code == MessageCode::ControlTimerExpired)
gate1->Message(MessageCode::TGateEnable, 0.0);
}
void control::RightKickerControl(int code, TPinballComponent* caller)
void control::RightKickerControl(MessageCode code, TPinballComponent* caller)
{
if (code == 60)
if (code == MessageCode::ControlTimerExpired)
gate2->Message(MessageCode::TGateEnable, 0.0);
}
void control::LeftKickerGateControl(int code, TPinballComponent* caller)
void control::LeftKickerGateControl(MessageCode code, TPinballComponent* caller)
{
if (code == ~MessageCode::TGateDisable)
if (code == MessageCode::TGateDisable)
{
lite30->Message(MessageCode::TLightFlasherStartTimedThenStayOn, 5.0);
lite196->Message(MessageCode::TLightFlasherStartTimed, 5.0);
}
else if (code == ~MessageCode::TGateEnable)
else if (code == MessageCode::TGateEnable)
{
lite30->Message(MessageCode::TLightResetAndTurnOff, 0.0);
lite196->Message(MessageCode::TLightResetAndTurnOff, 0.0);
}
}
void control::RightKickerGateControl(int code, TPinballComponent* caller)
void control::RightKickerGateControl(MessageCode code, TPinballComponent* caller)
{
if (code == ~MessageCode::TGateDisable)
if (code == MessageCode::TGateDisable)
{
lite29->Message(MessageCode::TLightFlasherStartTimedThenStayOn, 5.0);
lite195->Message(MessageCode::TLightFlasherStartTimed, 5.0);
}
else if (code == ~MessageCode::TGateEnable)
else if (code == MessageCode::TGateEnable)
{
lite29->Message(MessageCode::TLightResetAndTurnOff, 0.0);
lite195->Message(MessageCode::TLightResetAndTurnOff, 0.0);
}
}
void control::DeploymentChuteToEscapeChuteOneWayControl(int code, TPinballComponent* caller)
void control::DeploymentChuteToEscapeChuteOneWayControl(MessageCode code, TPinballComponent* caller)
{
char Buffer[64];
if (code == 63)
if (code == MessageCode::ControlCollision)
{
int count = skill_shot_lights->Message(MessageCode::TLightGroupGetOnCount, 0.0);
if (count)
@ -1233,19 +1233,19 @@ void control::DeploymentChuteToEscapeChuteOneWayControl(int code, TPinballCompon
}
}
void control::DeploymentChuteToTableOneWayControl(int code, TPinballComponent* caller)
void control::DeploymentChuteToTableOneWayControl(MessageCode code, TPinballComponent* caller)
{
if (code == 63)
if (code == MessageCode::ControlCollision)
skill_shot_lights->Message(MessageCode::TLightResetAndTurnOff, 0.0);
}
void control::DrainBallBlockerControl(int code, TPinballComponent* caller)
void control::DrainBallBlockerControl(MessageCode code, TPinballComponent* caller)
{
MessageCode lightMessage;
float blockerDuration;
auto block = static_cast<TBlocker*>(caller);
if (code == 52)
if (code == MessageCode::TBlockerEnable)
{
block->MessageField = 1;
blockerDuration = static_cast<float>(block->InitialDuration);
@ -1254,7 +1254,7 @@ void control::DrainBallBlockerControl(int code, TPinballComponent* caller)
}
else
{
if (code != 60)
if (code != MessageCode::ControlTimerExpired)
return;
if (block->MessageField != 1)
{
@ -1270,12 +1270,12 @@ void control::DrainBallBlockerControl(int code, TPinballComponent* caller)
lite1->Message(lightMessage, blockerDuration);
}
void control::LaunchRampControl(int code, TPinballComponent* caller)
void control::LaunchRampControl(MessageCode code, TPinballComponent* caller)
{
TSound* sound;
char Buffer[64];
if (code == 63)
if (code == MessageCode::ControlCollision)
{
int someFlag = 0;
if (light_on(&control_lite54_tag))
@ -1313,24 +1313,24 @@ void control::LaunchRampControl(int code, TPinballComponent* caller)
}
}
void control::LaunchRampHoleControl(int code, TPinballComponent* caller)
void control::LaunchRampHoleControl(MessageCode code, TPinballComponent* caller)
{
if (code == 58)
if (code == MessageCode::ControlBallReleased)
lite54->Message(MessageCode::TLightFlasherStartTimed, 5.0);
}
void control::SpaceWarpRolloverControl(int code, TPinballComponent* caller)
void control::SpaceWarpRolloverControl(MessageCode code, TPinballComponent* caller)
{
if (code == 63)
if (code == MessageCode::ControlCollision)
{
lite27->Message(MessageCode::TLightResetAndTurnOn, 0.0);
lite28->Message(MessageCode::TLightResetAndTurnOn, 0.0);
}
}
void control::ReentryLanesRolloverControl(int code, TPinballComponent* caller)
void control::ReentryLanesRolloverControl(MessageCode code, TPinballComponent* caller)
{
if (code == 63)
if (code == MessageCode::ControlCollision)
{
if (!light_on(&control_lite56_tag) && l_trek_lights->Message(MessageCode::TLightGroupGetMessage2, 0.0))
{
@ -1378,20 +1378,20 @@ void control::ReentryLanesRolloverControl(int code, TPinballComponent* caller)
}
}
void control::BumperGroupControl(int code, TPinballComponent* caller)
void control::BumperGroupControl(MessageCode code, TPinballComponent* caller)
{
if (code == 61)
if (code == MessageCode::ControlNotifyTimerExpired)
{
caller->Message(MessageCode::TComponentGroupResetNotifyTimer, 60.0);
caller->Message(MessageCode::TBumperDecBmpIndex, 0.0);
}
}
void control::LaunchLanesRolloverControl(int code, TPinballComponent* caller)
void control::LaunchLanesRolloverControl(MessageCode code, TPinballComponent* caller)
{
TLight* light;
if (code == 63)
if (code == MessageCode::ControlCollision)
{
if (roll112 == caller)
{
@ -1430,9 +1430,9 @@ void control::LaunchLanesRolloverControl(int code, TPinballComponent* caller)
}
}
void control::OutLaneRolloverControl(int code, TPinballComponent* caller)
void control::OutLaneRolloverControl(MessageCode code, TPinballComponent* caller)
{
if (code == 63)
if (code == MessageCode::ControlCollision)
{
if (light_on(&control_lite17_tag) || light_on(&control_lite18_tag))
{
@ -1461,15 +1461,15 @@ void control::OutLaneRolloverControl(int code, TPinballComponent* caller)
}
}
void control::ExtraBallLightControl(int code, TPinballComponent* caller)
void control::ExtraBallLightControl(MessageCode code, TPinballComponent* caller)
{
if (code == 19)
if (code == MessageCode::TLightResetAndTurnOn)
{
lite17->Message(MessageCode::TLightTurnOnTimed, 55.0);
lite18->Message(MessageCode::TLightTurnOnTimed, 55.0);
extraball_light_flag = 1;
}
else if (code == 60)
else if (code == MessageCode::ControlTimerExpired)
{
if (extraball_light_flag)
{
@ -1480,9 +1480,9 @@ void control::ExtraBallLightControl(int code, TPinballComponent* caller)
}
}
void control::ReturnLaneRolloverControl(int code, TPinballComponent* caller)
void control::ReturnLaneRolloverControl(MessageCode code, TPinballComponent* caller)
{
if (code == 63)
if (code == MessageCode::ControlCollision)
{
if (roll6 == caller)
{
@ -1509,11 +1509,11 @@ void control::ReturnLaneRolloverControl(int code, TPinballComponent* caller)
}
}
void control::BonusLaneRolloverControl(int code, TPinballComponent* caller)
void control::BonusLaneRolloverControl(MessageCode code, TPinballComponent* caller)
{
char Buffer[64];
if (code == 63)
if (code == MessageCode::ControlCollision)
{
if (light_on(&control_lite16_tag))
{
@ -1533,9 +1533,9 @@ void control::BonusLaneRolloverControl(int code, TPinballComponent* caller)
}
}
void control::FuelRollover1Control(int code, TPinballComponent* caller)
void control::FuelRollover1Control(MessageCode code, TPinballComponent* caller)
{
if (code == 63)
if (code == MessageCode::ControlCollision)
{
if (fuel_bargraph->Message(MessageCode::TLightGroupGetOnCount, 0.0) > 1)
{
@ -1550,9 +1550,9 @@ void control::FuelRollover1Control(int code, TPinballComponent* caller)
}
}
void control::FuelRollover2Control(int code, TPinballComponent* caller)
void control::FuelRollover2Control(MessageCode code, TPinballComponent* caller)
{
if (code == 63)
if (code == MessageCode::ControlCollision)
{
if (fuel_bargraph->Message(MessageCode::TLightGroupGetOnCount, 0.0) > 3)
{
@ -1567,9 +1567,9 @@ void control::FuelRollover2Control(int code, TPinballComponent* caller)
}
}
void control::FuelRollover3Control(int code, TPinballComponent* caller)
void control::FuelRollover3Control(MessageCode code, TPinballComponent* caller)
{
if (code == 63)
if (code == MessageCode::ControlCollision)
{
if (fuel_bargraph->Message(MessageCode::TLightGroupGetOnCount, 0.0) > 5)
{
@ -1584,9 +1584,9 @@ void control::FuelRollover3Control(int code, TPinballComponent* caller)
}
}
void control::FuelRollover4Control(int code, TPinballComponent* caller)
void control::FuelRollover4Control(MessageCode code, TPinballComponent* caller)
{
if (code == 63)
if (code == MessageCode::ControlCollision)
{
if (fuel_bargraph->Message(MessageCode::TLightGroupGetOnCount, 0.0) > 7)
{
@ -1601,9 +1601,9 @@ void control::FuelRollover4Control(int code, TPinballComponent* caller)
}
}
void control::FuelRollover5Control(int code, TPinballComponent* caller)
void control::FuelRollover5Control(MessageCode code, TPinballComponent* caller)
{
if (code == 63)
if (code == MessageCode::ControlCollision)
{
if (fuel_bargraph->Message(MessageCode::TLightGroupGetOnCount, 0.0) > 9)
{
@ -1618,9 +1618,9 @@ void control::FuelRollover5Control(int code, TPinballComponent* caller)
}
}
void control::FuelRollover6Control(int code, TPinballComponent* caller)
void control::FuelRollover6Control(MessageCode code, TPinballComponent* caller)
{
if (code == 63)
if (code == MessageCode::ControlCollision)
{
if (fuel_bargraph->Message(MessageCode::TLightGroupGetOnCount, 0.0) > 11)
{
@ -1635,18 +1635,18 @@ void control::FuelRollover6Control(int code, TPinballComponent* caller)
}
}
void control::HyperspaceLightGroupControl(int code, TPinballComponent* caller)
void control::HyperspaceLightGroupControl(MessageCode code, TPinballComponent* caller)
{
switch (code)
{
case 0:
case MessageCode::TLightGroupNull:
caller->Message(MessageCode::TLightTurnOff, 0.0);
break;
case 41:
case MessageCode::TLightGroupResetAndTurnOn:
caller->Message(MessageCode::TLightGroupResetAndTurnOn, 2.0);
caller->Message(MessageCode::TLightGroupRestartNotifyTimer, 60.0);
break;
case 61:
case MessageCode::ControlNotifyTimerExpired:
caller->Message(MessageCode::TLightGroupOffsetAnimationBackward, 0.0);
if (caller->Message(MessageCode::TLightGroupGetOnCount, 0.0))
caller->Message(MessageCode::TLightGroupRestartNotifyTimer, 60.0);
@ -1655,12 +1655,12 @@ void control::HyperspaceLightGroupControl(int code, TPinballComponent* caller)
}
}
void control::WormHoleControl(int code, TPinballComponent* caller)
void control::WormHoleControl(MessageCode code, TPinballComponent* caller)
{
int sinkFlag2;
TSink* sink = static_cast<TSink*>(caller);
if (code == 63)
if (code == MessageCode::ControlCollision)
{
int sinkFlag = 0;
if (sink1 != sink)
@ -1723,41 +1723,41 @@ void control::WormHoleControl(int code, TPinballComponent* caller)
}
}
void control::LeftFlipperControl(int code, TPinballComponent* caller)
void control::LeftFlipperControl(MessageCode code, TPinballComponent* caller)
{
if (code == 1)
if (code == MessageCode::TLightTurnOn)
{
bmpr_inc_lights->Message(MessageCode::TLightGroupStepBackward, 0.0);
ramp_bmpr_inc_lights->Message(MessageCode::TLightGroupStepBackward, 0.0);
}
}
void control::RightFlipperControl(int code, TPinballComponent* caller)
void control::RightFlipperControl(MessageCode code, TPinballComponent* caller)
{
if (code == 1)
if (code == MessageCode::TLightTurnOn)
{
bmpr_inc_lights->Message(MessageCode::TLightGroupStepForward, 0.0);
ramp_bmpr_inc_lights->Message(MessageCode::TLightGroupStepForward, 0.0);
}
}
void control::JackpotLightControl(int code, TPinballComponent* caller)
void control::JackpotLightControl(MessageCode code, TPinballComponent* caller)
{
if (code == 60)
if (code == MessageCode::ControlTimerExpired)
TableG->ScoreSpecial3Flag = 0;
}
void control::BonusLightControl(int code, TPinballComponent* caller)
void control::BonusLightControl(MessageCode code, TPinballComponent* caller)
{
if (code == 60)
if (code == MessageCode::ControlTimerExpired)
TableG->ScoreSpecial2Flag = 0;
}
void control::BoosterTargetControl(int code, TPinballComponent* caller)
void control::BoosterTargetControl(MessageCode code, TPinballComponent* caller)
{
TSound* sound = nullptr;
if (code == 63 && !caller->MessageField)
if (code == MessageCode::ControlCollision && !caller->MessageField)
{
caller->MessageField = 1;
if (target1->MessageField
@ -1817,18 +1817,18 @@ void control::BoosterTargetControl(int code, TPinballComponent* caller)
}
}
void control::MedalLightGroupControl(int code, TPinballComponent* caller)
void control::MedalLightGroupControl(MessageCode code, TPinballComponent* caller)
{
switch (code)
{
case 0:
case MessageCode::TLightGroupNull:
caller->Message(MessageCode::TLightTurnOff, 0.0);
break;
case 41:
case MessageCode::TLightGroupResetAndTurnOn:
caller->Message(MessageCode::TLightGroupResetAndTurnOn, 2.0);
caller->Message(MessageCode::TLightGroupRestartNotifyTimer, 30.0);
break;
case 61:
case MessageCode::ControlNotifyTimerExpired:
caller->Message(MessageCode::TLightGroupOffsetAnimationBackward, 0.0);
if (caller->Message(MessageCode::TLightGroupGetOnCount, 0.0))
caller->Message(MessageCode::TLightGroupRestartNotifyTimer, 30.0);
@ -1837,31 +1837,31 @@ void control::MedalLightGroupControl(int code, TPinballComponent* caller)
}
}
void control::MultiplierLightGroupControl(int code, TPinballComponent* caller)
void control::MultiplierLightGroupControl(MessageCode code, TPinballComponent* caller)
{
switch (code)
{
case 0:
case MessageCode::TLightGroupNull:
caller->Message(MessageCode::TLightTurnOff, 0.0);
break;
case 41:
case MessageCode::TLightGroupResetAndTurnOn:
caller->Message(MessageCode::TLightGroupResetAndTurnOn, 2.0);
caller->Message(MessageCode::TLightGroupRestartNotifyTimer, 30.0);
break;
case 61:
case MessageCode::ControlNotifyTimerExpired:
if (TableG->ScoreMultiplier)
TableG->ScoreMultiplier = TableG->ScoreMultiplier - 1;
caller->Message(MessageCode::TLightGroupOffsetAnimationBackward, 0.0);
if (caller->Message(MessageCode::TLightGroupGetOnCount, 0.0))
caller->Message(MessageCode::TLightGroupRestartNotifyTimer, 30.0);
break;
case 64:
case MessageCode::ControlEnableMultiplier:
TableG->ScoreMultiplier = 4;
caller->Message(MessageCode::TLightResetAndTurnOn, 0.0);
caller->Message(MessageCode::TLightGroupRestartNotifyTimer, 30.0);
info_text_box->Display(pb::get_rc_string(Msg::STRING160), 2.0);
break;
case 65:
case MessageCode::ControlDisableMultiplier:
TableG->ScoreMultiplier = 0;
caller->Message(MessageCode::TLightResetAndTurnOff, 0.0);
caller->Message(MessageCode::TLightGroupRestartNotifyTimer, -1.0);
@ -1871,11 +1871,11 @@ void control::MultiplierLightGroupControl(int code, TPinballComponent* caller)
}
}
void control::FuelSpotTargetControl(int code, TPinballComponent* caller)
void control::FuelSpotTargetControl(MessageCode code, TPinballComponent* caller)
{
TPinballComponent* liteComp;
if (code == 63)
if (code == MessageCode::ControlCollision)
{
if (target10 == caller)
{
@ -1903,9 +1903,9 @@ void control::FuelSpotTargetControl(int code, TPinballComponent* caller)
}
}
void control::MissionSpotTargetControl(int code, TPinballComponent* caller)
void control::MissionSpotTargetControl(MessageCode code, TPinballComponent* caller)
{
if (code == 63)
if (code == MessageCode::ControlCollision)
{
TPinballComponent* lite;
if (target13 == caller)
@ -1939,11 +1939,11 @@ void control::MissionSpotTargetControl(int code, TPinballComponent* caller)
}
}
void control::LeftHazardSpotTargetControl(int code, TPinballComponent* caller)
void control::LeftHazardSpotTargetControl(MessageCode code, TPinballComponent* caller)
{
TPinballComponent* lite;
if (code == 63)
if (code == MessageCode::ControlCollision)
{
if (target16 == caller)
{
@ -1975,11 +1975,11 @@ void control::LeftHazardSpotTargetControl(int code, TPinballComponent* caller)
}
}
void control::RightHazardSpotTargetControl(int code, TPinballComponent* caller)
void control::RightHazardSpotTargetControl(MessageCode code, TPinballComponent* caller)
{
TPinballComponent* light;
if (code == 63)
if (code == MessageCode::ControlCollision)
{
if (target19 == caller)
{
@ -2011,9 +2011,9 @@ void control::RightHazardSpotTargetControl(int code, TPinballComponent* caller)
}
}
void control::WormHoleDestinationControl(int code, TPinballComponent* caller)
void control::WormHoleDestinationControl(MessageCode code, TPinballComponent* caller)
{
if (code == 63)
if (code == MessageCode::ControlCollision)
{
if (!light_on(&control_lite110_tag))
{
@ -2025,11 +2025,11 @@ void control::WormHoleDestinationControl(int code, TPinballComponent* caller)
}
}
void control::BlackHoleKickoutControl(int code, TPinballComponent* caller)
void control::BlackHoleKickoutControl(MessageCode code, TPinballComponent* caller)
{
char Buffer[64];
if (code == 63)
if (code == MessageCode::ControlCollision)
{
int addedScore = TableG->AddScore(caller->get_scoring(0));
snprintf(Buffer, sizeof Buffer, pb::get_rc_string(Msg::STRING181), addedScore);
@ -2038,26 +2038,26 @@ void control::BlackHoleKickoutControl(int code, TPinballComponent* caller)
}
}
void control::FlagControl(int code, TPinballComponent* caller)
void control::FlagControl(MessageCode code, TPinballComponent* caller)
{
if (code == 62)
if (code == MessageCode::ControlSpinnerLoopReset)
{
AdvanceWormHoleDestination(0);
}
else if (code == 63)
else if (code == MessageCode::ControlCollision)
{
int score = caller->get_scoring(light_on(&control_lite20_tag));
TableG->AddScore(score);
}
}
void control::GravityWellKickoutControl(int code, TPinballComponent* caller)
void control::GravityWellKickoutControl(MessageCode code, TPinballComponent* caller)
{
char Buffer[64];
switch (code)
{
case 63:
case MessageCode::ControlCollision:
{
auto addedScore = TableG->AddScore(caller->get_scoring(0));
snprintf(Buffer, sizeof Buffer, pb::get_rc_string(Msg::STRING182), addedScore);
@ -2068,7 +2068,7 @@ void control::GravityWellKickoutControl(int code, TPinballComponent* caller)
caller->Message(MessageCode::TKickoutRestartTimer, duration);
break;
}
case 64:
case MessageCode::ControlEnableMultiplier:
{
auto score = reinterpret_cast<size_t>(caller);
if (score)
@ -2084,15 +2084,15 @@ void control::GravityWellKickoutControl(int code, TPinballComponent* caller)
kickout1->ActiveFlag = 1;
break;
}
case ~MessageCode::Reset:
case MessageCode::Reset:
kickout1->ActiveFlag = 0;
break;
}
}
void control::SkillShotGate1Control(int code, TPinballComponent* caller)
void control::SkillShotGate1Control(MessageCode code, TPinballComponent* caller)
{
if (code == 63)
if (code == MessageCode::ControlCollision)
{
lite200->Message(MessageCode::TLightTurnOnTimed, 5.0);
if (light_on(&control_lite67_tag))
@ -2108,9 +2108,9 @@ void control::SkillShotGate1Control(int code, TPinballComponent* caller)
}
}
void control::SkillShotGate2Control(int code, TPinballComponent* caller)
void control::SkillShotGate2Control(MessageCode code, TPinballComponent* caller)
{
if (code == 63)
if (code == MessageCode::ControlCollision)
{
if (light_on(&control_lite67_tag))
{
@ -2120,9 +2120,9 @@ void control::SkillShotGate2Control(int code, TPinballComponent* caller)
}
}
void control::SkillShotGate3Control(int code, TPinballComponent* caller)
void control::SkillShotGate3Control(MessageCode code, TPinballComponent* caller)
{
if (code == 63)
if (code == MessageCode::ControlCollision)
{
if (light_on(&control_lite67_tag))
{
@ -2132,9 +2132,9 @@ void control::SkillShotGate3Control(int code, TPinballComponent* caller)
}
}
void control::SkillShotGate4Control(int code, TPinballComponent* caller)
void control::SkillShotGate4Control(MessageCode code, TPinballComponent* caller)
{
if (code == 63)
if (code == MessageCode::ControlCollision)
{
if (light_on(&control_lite67_tag))
{
@ -2144,9 +2144,9 @@ void control::SkillShotGate4Control(int code, TPinballComponent* caller)
}
}
void control::SkillShotGate5Control(int code, TPinballComponent* caller)
void control::SkillShotGate5Control(MessageCode code, TPinballComponent* caller)
{
if (code == 63)
if (code == MessageCode::ControlCollision)
{
if (light_on(&control_lite67_tag))
{
@ -2156,9 +2156,9 @@ void control::SkillShotGate5Control(int code, TPinballComponent* caller)
}
}
void control::SkillShotGate6Control(int code, TPinballComponent* caller)
void control::SkillShotGate6Control(MessageCode code, TPinballComponent* caller)
{
if (code == 63)
if (code == MessageCode::ControlCollision)
{
if (light_on(&control_lite67_tag))
{
@ -2168,9 +2168,9 @@ void control::SkillShotGate6Control(int code, TPinballComponent* caller)
}
}
void control::ShootAgainLightControl(int code, TPinballComponent* caller)
void control::ShootAgainLightControl(MessageCode code, TPinballComponent* caller)
{
if (code == 60)
if (code == MessageCode::ControlTimerExpired)
{
if (caller->MessageField)
{
@ -2184,15 +2184,15 @@ void control::ShootAgainLightControl(int code, TPinballComponent* caller)
}
}
void control::EscapeChuteSinkControl(int code, TPinballComponent* caller)
void control::EscapeChuteSinkControl(MessageCode code, TPinballComponent* caller)
{
if (code == 63)
if (code == MessageCode::ControlCollision)
{
caller->Message(MessageCode::TSinkResetTimer, -1.0f);
}
}
void control::MissionControl(int code, TPinballComponent* caller)
void control::MissionControl(MessageCode code, TPinballComponent* caller)
{
if (!lite198)
return;
@ -2200,7 +2200,7 @@ void control::MissionControl(int code, TPinballComponent* caller)
int lite198Msg = lite198->MessageField;
switch (code)
{
case 47:
case MessageCode::TLightGroupCountdownEnded:
if (fuel_bargraph == caller && lite198Msg > 1)
{
l_trek_lights->Message(MessageCode::TLightGroupReset, 0.0);
@ -2209,10 +2209,10 @@ void control::MissionControl(int code, TPinballComponent* caller)
r_trek_lights->Message(MessageCode::TLightResetAndTurnOff, 0.0);
mission_text_box->Display(pb::get_rc_string(Msg::STRING210), 4.0);
lite198->MessageField = 1;
MissionControl(66, nullptr);
MissionControl(MessageCode::ControlMissionComplete, nullptr);
}
break;
case 60:
case MessageCode::ControlTimerExpired:
if (fuel_bargraph == caller && lite198Msg)
{
if (fuel_bargraph->Message(MessageCode::TLightGroupGetOnCount, 0.0) == 1)
@ -2222,10 +2222,10 @@ void control::MissionControl(int code, TPinballComponent* caller)
break;
}
if (mission_text_box == caller)
code = 67;
code = MessageCode::ControlMissionStarted;
break;
case ~MessageCode::Resume:
code = 67;
case MessageCode::Resume:
code = MessageCode::ControlMissionStarted;
break;
default:
break;
@ -2335,15 +2335,15 @@ void control::MissionControl(int code, TPinballComponent* caller)
}
}
void control::HyperspaceKickOutControl(int code, TPinballComponent* caller)
void control::HyperspaceKickOutControl(MessageCode code, TPinballComponent* caller)
{
char Buffer[64];
if (code != 63)
if (code != <