1
0
Fork 0
mirror of https://github.com/k4zmu2a/SpaceCadetPinball.git synced 2024-11-24 01:40:18 +01:00

Message code enum part 2: all components except for lights.

This commit is contained in:
Muzychenko Andrey 2022-09-06 11:58:35 +03:00
parent 44d5fd5097
commit 803ca14ef2
42 changed files with 329 additions and 303 deletions

View file

@ -11,7 +11,7 @@
#include "TPinballTable.h" #include "TPinballTable.h"
#include "TTableLayer.h" #include "TTableLayer.h"
TBall::TBall(TPinballTable* table) : TPinballComponent(table, -1, false) TBall::TBall(TPinballTable* table) : TPinballComponent2(table, -1, false)
{ {
visualStruct visual{}; visualStruct visual{};
char ballGroupName[10]{"ball"}; char ballGroupName[10]{"ball"};
@ -106,9 +106,9 @@ bool TBall::already_hit(TEdgeSegment* edge)
return false; return false;
} }
int TBall::Message(int code, float value) int TBall::Message2(MessageCode code, float value)
{ {
if (code == 1024) if (code == MessageCode::Reset)
{ {
render::ball_set(RenderSprite, nullptr, 0.0, 0, 0); render::ball_set(RenderSprite, nullptr, 0.0, 0, 0);
Position.X = 0.0; Position.X = 0.0;

View file

@ -5,14 +5,14 @@
class TCollisionComponent; class TCollisionComponent;
class TEdgeSegment; class TEdgeSegment;
class TBall : public TPinballComponent class TBall : public TPinballComponent2
{ {
public : public :
TBall(TPinballTable* table); TBall(TPinballTable* table);
void Repaint(); void Repaint();
void not_again(TEdgeSegment* edge); void not_again(TEdgeSegment* edge);
bool already_hit(TEdgeSegment* edge); bool already_hit(TEdgeSegment* edge);
int Message(int code, float value) override; int Message2(MessageCode code, float value) override;
vector2 get_coordinates() override; vector2 get_coordinates() override;
void Disable(); void Disable();

View file

@ -7,15 +7,15 @@
#include "render.h" #include "render.h"
#include "timer.h" #include "timer.h"
TBlocker::TBlocker(TPinballTable* table, int groupIndex) : TCollisionComponent(table, groupIndex, true) TBlocker::TBlocker(TPinballTable* table, int groupIndex) : TCollisionComponent2(table, groupIndex, true)
{ {
visualStruct visual{}; visualStruct visual{};
loader::query_visual(groupIndex, 0, &visual); loader::query_visual(groupIndex, 0, &visual);
SoundIndex4 = visual.SoundIndex4; SoundIndex4 = visual.SoundIndex4;
SoundIndex3 = visual.SoundIndex3; SoundIndex3 = visual.SoundIndex3;
TurnOnMsgValue = 55; InitialDuration = 55;
TurnOffMsgValue = 5; ExtendedDuration = 5;
Threshold = 1000000000.0f; Threshold = 1000000000.0f;
Timer = 0; Timer = 0;
MessageField = 0; MessageField = 0;
@ -23,14 +23,14 @@ TBlocker::TBlocker(TPinballTable* table, int groupIndex) : TCollisionComponent(t
render::sprite_set_bitmap(RenderSprite, nullptr); render::sprite_set_bitmap(RenderSprite, nullptr);
} }
int TBlocker::Message(int code, float value) int TBlocker::Message2(MessageCode code, float value)
{ {
switch (code) switch (code)
{ {
case ~MessageCode::SetTiltLock: case MessageCode::SetTiltLock:
case ~MessageCode::PlayerChanged: case MessageCode::PlayerChanged:
case ~MessageCode::Reset: case MessageCode::Reset:
case 51: case MessageCode::TBlockerDisable:
if (Timer) if (Timer)
{ {
timer::kill(Timer); timer::kill(Timer);
@ -39,28 +39,26 @@ int TBlocker::Message(int code, float value)
MessageField = 0; MessageField = 0;
ActiveFlag = 0; ActiveFlag = 0;
render::sprite_set_bitmap(RenderSprite, nullptr); render::sprite_set_bitmap(RenderSprite, nullptr);
if (code == 51) if (code == MessageCode::TBlockerDisable)
loader::play_sound(SoundIndex3, this, "TBlocker1"); loader::play_sound(SoundIndex3, this, "TBlocker1");
return 0; break;
case 52: case MessageCode::TBlockerEnable:
ActiveFlag = 1; ActiveFlag = 1;
loader::play_sound(SoundIndex4, this, "TBlocker2"); loader::play_sound(SoundIndex4, this, "TBlocker2");
render::sprite_set_bitmap(RenderSprite, ListBitmap->at(0)); render::sprite_set_bitmap(RenderSprite, ListBitmap->at(0));
if (Timer)
timer::kill(Timer);
Timer = timer::set(std::max(value, 0.0f), this, TimerExpired);
break; break;
case 59: case MessageCode::TBlockerRestartTimeout:
if (Timer)
timer::kill(Timer);
Timer = timer::set(std::max(value, 0.0f), this, TimerExpired);
break; break;
default: default:
return 0; break;
} }
if (Timer)
timer::kill(Timer);
float timerTime;
if (value <= 0.0f)
timerTime = 0.0;
else
timerTime = value;
Timer = timer::set(timerTime, this, TimerExpired);
return 0; return 0;
} }

View file

@ -2,16 +2,16 @@
#include "TCollisionComponent.h" #include "TCollisionComponent.h"
class TBlocker : class TBlocker :
public TCollisionComponent public TCollisionComponent2
{ {
public: public:
TBlocker(TPinballTable* table, int groupIndex); TBlocker(TPinballTable* table, int groupIndex);
int Message(int code, float value) override; int Message2(MessageCode code, float value) override;
static void TimerExpired(int timerId, void* caller); static void TimerExpired(int timerId, void* caller);
int TurnOnMsgValue; int InitialDuration;
int TurnOffMsgValue; int ExtendedDuration;
int Timer; int Timer;
int SoundIndex4; int SoundIndex4;
int SoundIndex3; int SoundIndex3;

View file

@ -8,7 +8,7 @@
#include "timer.h" #include "timer.h"
#include "TPinballTable.h" #include "TPinballTable.h"
TBumper::TBumper(TPinballTable* table, int groupIndex) : TCollisionComponent(table, groupIndex, true) TBumper::TBumper(TPinballTable* table, int groupIndex) : TCollisionComponent2(table, groupIndex, true)
{ {
visualStruct visual{}; visualStruct visual{};
@ -21,11 +21,11 @@ TBumper::TBumper(TPinballTable* table, int groupIndex) : TCollisionComponent(tab
OriginalThreshold = Threshold; OriginalThreshold = Threshold;
} }
int TBumper::Message(int code, float value) int TBumper::Message2(MessageCode code, float value)
{ {
switch (code) switch (code)
{ {
case 11: case MessageCode::TBumperSetBmpIndex:
{ {
auto nextBmp = static_cast<int>(floor(value)); auto nextBmp = static_cast<int>(floor(value));
auto maxBmp = static_cast<int>(ListBitmap->size()) - 1; auto maxBmp = static_cast<int>(ListBitmap->size()) - 1;
@ -45,24 +45,24 @@ int TBumper::Message(int code, float value)
} }
break; break;
} }
case 12: case MessageCode::TBumperIncBmpIndex:
{ {
auto nextBmp = BmpIndex + 1; auto nextBmp = BmpIndex + 1;
auto maxBmp = static_cast<int>(ListBitmap->size()) - 1; auto maxBmp = static_cast<int>(ListBitmap->size()) - 1;
if (2 * nextBmp > maxBmp) if (2 * nextBmp > maxBmp)
nextBmp = maxBmp / 2; nextBmp = maxBmp / 2;
TBumper::Message(11, static_cast<float>(nextBmp)); TBumper::Message2(MessageCode::TBumperSetBmpIndex, static_cast<float>(nextBmp));
break; break;
} }
case 13: case MessageCode::TBumperDecBmpIndex:
{ {
auto nextBmp = BmpIndex - 1; auto nextBmp = BmpIndex - 1;
if (nextBmp < 0) if (nextBmp < 0)
nextBmp = 0; nextBmp = 0;
TBumper::Message(11, static_cast<float>(nextBmp)); TBumper::Message2(MessageCode::TBumperSetBmpIndex, static_cast<float>(nextBmp));
break; break;
} }
case ~MessageCode::PlayerChanged: case MessageCode::PlayerChanged:
{ {
auto playerPtr = &PlayerData[PinballTable->CurrentPlayer]; auto playerPtr = &PlayerData[PinballTable->CurrentPlayer];
playerPtr->BmpIndex = BmpIndex; playerPtr->BmpIndex = BmpIndex;
@ -71,10 +71,10 @@ int TBumper::Message(int code, float value)
playerPtr = &PlayerData[static_cast<int>(floor(value))]; playerPtr = &PlayerData[static_cast<int>(floor(value))];
BmpIndex = playerPtr->BmpIndex; BmpIndex = playerPtr->BmpIndex;
MessageField = playerPtr->MessageField; MessageField = playerPtr->MessageField;
TBumper::Message(11, static_cast<float>(BmpIndex)); TBumper::Message2(MessageCode::TBumperSetBmpIndex, static_cast<float>(BmpIndex));
break; break;
} }
case ~MessageCode::Reset: case MessageCode::Reset:
{ {
if (Timer) if (Timer)
{ {
@ -83,12 +83,10 @@ int TBumper::Message(int code, float value)
} }
BmpIndex = 0; BmpIndex = 0;
MessageField = 0; MessageField = 0;
auto playerPtr = PlayerData; for (auto& playerPtr : PlayerData)
for (auto index = 0; index < PinballTable->PlayerCount; ++index)
{ {
playerPtr->BmpIndex = 0; playerPtr.BmpIndex = 0;
playerPtr->MessageField = 0; playerPtr.MessageField = 0;
++playerPtr;
} }
TimerExpired(0, this); TimerExpired(0, this);
break; break;

View file

@ -8,12 +8,12 @@ struct TBumper_player_backup
}; };
class TBumper : class TBumper :
public TCollisionComponent public TCollisionComponent2
{ {
public: public:
TBumper(TPinballTable* table, int groupIndex); TBumper(TPinballTable* table, int groupIndex);
~TBumper() override = default; ~TBumper() override = default;
int Message(int code, float value) override; int Message2(MessageCode code, float value) override;
void Collision(TBall* ball, vector2* nextPosition, vector2* direction, float distance, void Collision(TBall* ball, vector2* nextPosition, vector2* direction, float distance,
TEdgeSegment* edge) override; TEdgeSegment* edge) override;
void Fire(); void Fire();

View file

@ -7,7 +7,7 @@
#include "timer.h" #include "timer.h"
#include "TPinballTable.h" #include "TPinballTable.h"
TComponentGroup::TComponentGroup(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, false) TComponentGroup::TComponentGroup(TPinballTable* table, int groupIndex) : TPinballComponent2(table, groupIndex, false)
{ {
Timer = 0; Timer = 0;
if (groupIndex > 0) if (groupIndex > 0)
@ -33,9 +33,9 @@ TComponentGroup::~TComponentGroup()
} }
} }
int TComponentGroup::Message(int code, float value) int TComponentGroup::Message2(MessageCode code, float value)
{ {
if (code == 48) if (code == MessageCode::TComponentGroupResetNotifyTimer)
{ {
if (this->Timer) if (this->Timer)
{ {
@ -45,11 +45,12 @@ int TComponentGroup::Message(int code, float value)
if (value > 0.0f) if (value > 0.0f)
this->Timer = timer::set(value, this, NotifyTimerExpired); this->Timer = timer::set(value, this, NotifyTimerExpired);
} }
else if (code <= 1007 || (code > 1011 && code != 1020 && code != 1022)) else if (code < MessageCode::Pause || (code > MessageCode::SetTiltLock &&
code != MessageCode::PlayerChanged && code != MessageCode::GameOver))
{ {
for (auto component : List) for (auto component : List)
{ {
component->Message(code, value); component->Message2(code, value);
} }
} }
return 0; return 0;

View file

@ -3,12 +3,12 @@
class TComponentGroup : class TComponentGroup :
public TPinballComponent public TPinballComponent2
{ {
public: public:
TComponentGroup(TPinballTable* table, int groupIndex); TComponentGroup(TPinballTable* table, int groupIndex);
~TComponentGroup() override; ~TComponentGroup() override;
int Message(int code, float value) override; int Message2(MessageCode code, float value) override;
static void NotifyTimerExpired(int timerId, void* caller); static void NotifyTimerExpired(int timerId, void* caller);
std::vector<TPinballComponent*> List; std::vector<TPinballComponent*> List;

View file

@ -10,7 +10,7 @@
#include "TBall.h" #include "TBall.h"
TDemo::TDemo(TPinballTable* table, int groupIndex) TDemo::TDemo(TPinballTable* table, int groupIndex)
: TCollisionComponent(table, groupIndex, false) : TCollisionComponent2(table, groupIndex, false)
{ {
visualStruct visual{}; visualStruct visual{};
@ -56,23 +56,23 @@ TDemo::TDemo(TPinballTable* table, int groupIndex)
Edge3 = TEdgeSegment::install_wall(v9, this, &ActiveFlag, visual.CollisionGroup, table->CollisionCompOffset, 1404); Edge3 = TEdgeSegment::install_wall(v9, this, &ActiveFlag, visual.CollisionGroup, table->CollisionCompOffset, 1404);
} }
int TDemo::Message(int code, float value) int TDemo::Message2(MessageCode code, float value)
{ {
switch (code) switch (code)
{ {
case ~MessageCode::NewGame: case MessageCode::NewGame:
if (RestartGameTimer) if (RestartGameTimer)
timer::kill(RestartGameTimer); timer::kill(RestartGameTimer);
RestartGameTimer = 0; RestartGameTimer = 0;
break; break;
case ~MessageCode::GameOver: case MessageCode::GameOver:
if (RestartGameTimer) if (RestartGameTimer)
timer::kill(RestartGameTimer); timer::kill(RestartGameTimer);
RestartGameTimer = 0; RestartGameTimer = 0;
if (ActiveFlag != 0) if (ActiveFlag != 0)
RestartGameTimer = timer::set(5.0, this, NewGameRestartTimer); RestartGameTimer = timer::set(5.0, this, NewGameRestartTimer);
break; break;
case ~MessageCode::Reset: case MessageCode::Reset:
if (FlipLeftTimer) if (FlipLeftTimer)
timer::kill(FlipLeftTimer); timer::kill(FlipLeftTimer);
FlipLeftTimer = 0; FlipLeftTimer = 0;

View file

@ -2,11 +2,11 @@
#include "TCollisionComponent.h" #include "TCollisionComponent.h"
class TDemo : class TDemo :
public TCollisionComponent public TCollisionComponent2
{ {
public: public:
TDemo(TPinballTable* table, int groupIndex); TDemo(TPinballTable* table, int groupIndex);
int Message(int code, float value) override; int Message2(MessageCode code, float value) override;
void Collision(TBall* ball, vector2* nextPosition, vector2* direction, float distance, void Collision(TBall* ball, vector2* nextPosition, vector2* direction, float distance,
TEdgeSegment* edge) override; TEdgeSegment* edge) override;

View file

@ -8,15 +8,15 @@
#include "timer.h" #include "timer.h"
#include "TPinballTable.h" #include "TPinballTable.h"
TDrain::TDrain(TPinballTable* table, int groupIndex) : TCollisionComponent(table, groupIndex, true) TDrain::TDrain(TPinballTable* table, int groupIndex) : TCollisionComponent2(table, groupIndex, true)
{ {
Timer = 0; Timer = 0;
TimerTime = *loader::query_float_attribute(groupIndex, 0, 407); TimerTime = *loader::query_float_attribute(groupIndex, 0, 407);
} }
int TDrain::Message(int code, float value) int TDrain::Message2(MessageCode code, float value)
{ {
if (code == 1024) if (code == MessageCode::Reset)
{ {
if (Timer) if (Timer)
{ {

View file

@ -2,11 +2,11 @@
#include "TCollisionComponent.h" #include "TCollisionComponent.h"
class TDrain : class TDrain :
public TCollisionComponent public TCollisionComponent2
{ {
public: public:
TDrain(TPinballTable* table, int groupIndex); TDrain(TPinballTable* table, int groupIndex);
int Message(int code, float value) override; int Message2(MessageCode code, float value) override;
void Collision(TBall* ball, vector2* nextPosition, vector2* direction, float distance, void Collision(TBall* ball, vector2* nextPosition, vector2* direction, float distance,
TEdgeSegment* edge) override; TEdgeSegment* edge) override;

View file

@ -10,7 +10,7 @@
#include "TLine.h" #include "TLine.h"
#include "TPinballTable.h" #include "TPinballTable.h"
TFlagSpinner::TFlagSpinner(TPinballTable* table, int groupIndex) : TCollisionComponent(table, groupIndex, false) TFlagSpinner::TFlagSpinner(TPinballTable* table, int groupIndex) : TCollisionComponent2(table, groupIndex, false)
{ {
visualStruct visual{}; visualStruct visual{};
vector2 end{}, start{}; vector2 end{}, start{};
@ -50,9 +50,9 @@ TFlagSpinner::TFlagSpinner(TPinballTable* table, int groupIndex) : TCollisionCom
MinSpeed = *minSpeed; MinSpeed = *minSpeed;
} }
int TFlagSpinner::Message(int code, float value) int TFlagSpinner::Message2(MessageCode code, float value)
{ {
if (code == 1024) if (code == MessageCode::Reset)
{ {
if (Timer) if (Timer)
{ {

View file

@ -2,11 +2,11 @@
#include "TCollisionComponent.h" #include "TCollisionComponent.h"
class TFlagSpinner : class TFlagSpinner :
public TCollisionComponent public TCollisionComponent2
{ {
public: public:
TFlagSpinner(TPinballTable* table, int groupIndex); TFlagSpinner(TPinballTable* table, int groupIndex);
int Message(int code, float value) override; int Message2(MessageCode code, float value) override;
void Collision(TBall* ball, vector2* nextPosition, vector2* direction, float distance, void Collision(TBall* ball, vector2* nextPosition, vector2* direction, float distance,
TEdgeSegment* edge) override; TEdgeSegment* edge) override;
void NextFrame(); void NextFrame();

View file

@ -6,7 +6,7 @@
#include "loader.h" #include "loader.h"
#include "render.h" #include "render.h"
TGate::TGate(TPinballTable* table, int groupIndex) : TCollisionComponent(table, groupIndex, true) TGate::TGate(TPinballTable* table, int groupIndex) : TCollisionComponent2(table, groupIndex, true)
{ {
visualStruct visual{}; visualStruct visual{};
@ -18,24 +18,25 @@ TGate::TGate(TPinballTable* table, int groupIndex) : TCollisionComponent(table,
control::handler(1024, this); control::handler(1024, this);
} }
int TGate::Message(int code, float value) int TGate::Message2(MessageCode code, float value)
{ {
if (code != 1020) switch (code)
{ {
if (code == 53) case MessageCode::TGateDisable:
{ ActiveFlag = 0;
ActiveFlag = 0; render::sprite_set_bitmap(RenderSprite, nullptr);
render::sprite_set_bitmap(RenderSprite, nullptr); loader::play_sound(SoundIndex3, this, "TGate1");
loader::play_sound(SoundIndex3, this, "TGate1"); break;
} case MessageCode::Reset:
else if (code == 54 || code == 1024) case MessageCode::TGateEnable:
{ ActiveFlag = 1;
ActiveFlag = 1; render::sprite_set_bitmap(RenderSprite, ListBitmap->at(0));
render::sprite_set_bitmap(RenderSprite, ListBitmap->at(0)); if (code == MessageCode::TGateEnable)
if (code == 54) loader::play_sound(SoundIndex4, this, "TGate2");
loader::play_sound(SoundIndex4, this, "TGate2"); break;
} default: break;
control::handler(code, this);
} }
control::handler(~code, this);
return 0; return 0;
} }

View file

@ -2,11 +2,11 @@
#include "TCollisionComponent.h" #include "TCollisionComponent.h"
class TGate : class TGate :
public TCollisionComponent public TCollisionComponent2
{ {
public: public:
TGate(TPinballTable* table, int groupIndex); TGate(TPinballTable* table, int groupIndex);
int Message(int code, float value) override; int Message2(MessageCode code, float value) override;
int SoundIndex4; int SoundIndex4;
int SoundIndex3; int SoundIndex3;

View file

@ -10,7 +10,7 @@
#include "TPinballTable.h" #include "TPinballTable.h"
#include "TTableLayer.h" #include "TTableLayer.h"
THole::THole(TPinballTable* table, int groupIndex) : TCollisionComponent(table, groupIndex, false) THole::THole(TPinballTable* table, int groupIndex) : TCollisionComponent2(table, groupIndex, false)
{ {
visualStruct visual{}; visualStruct visual{};
circle_type circle{}; circle_type circle{};
@ -57,9 +57,9 @@ THole::THole(TPinballTable* table, int groupIndex) : TCollisionComponent(table,
TTableLayer::edges_insert_circle(&circle, nullptr, &Field); TTableLayer::edges_insert_circle(&circle, nullptr, &Field);
} }
int THole::Message(int code, float value) int THole::Message2(MessageCode code, float value)
{ {
if (code == 1024 && BallCapturedFlag) if (code == MessageCode::Reset && BallCapturedFlag)
{ {
if (Timer) if (Timer)
timer::kill(Timer); timer::kill(Timer);

View file

@ -4,11 +4,11 @@
#include "TEdgeManager.h" #include "TEdgeManager.h"
class THole : class THole :
public TCollisionComponent public TCollisionComponent2
{ {
public: public:
THole(TPinballTable* table, int groupIndex); THole(TPinballTable* table, int groupIndex);
int Message(int code, float value) override; int Message2(MessageCode code, float value) override;
void Collision(TBall* ball, vector2* nextPosition, vector2* direction, float distance, void Collision(TBall* ball, vector2* nextPosition, vector2* direction, float distance,
TEdgeSegment* edge) override; TEdgeSegment* edge) override;
int FieldEffect(TBall* ball, vector2* vecDst) override; int FieldEffect(TBall* ball, vector2* vecDst) override;

View file

@ -9,7 +9,7 @@
#include "timer.h" #include "timer.h"
#include "TPinballTable.h" #include "TPinballTable.h"
TKickback::TKickback(TPinballTable* table, int groupIndex): TCollisionComponent(table, groupIndex, true) TKickback::TKickback(TPinballTable* table, int groupIndex): TCollisionComponent2(table, groupIndex, true)
{ {
MessageField = 0; MessageField = 0;
Timer = 0; Timer = 0;
@ -19,9 +19,9 @@ TKickback::TKickback(TPinballTable* table, int groupIndex): TCollisionComponent(
Threshold = 1000000000.0f; Threshold = 1000000000.0f;
} }
int TKickback::Message(int code, float value) int TKickback::Message2(MessageCode code, float value)
{ {
if ((code == 1011 || code == 1024) && Timer) if ((code == MessageCode::SetTiltLock || code == MessageCode::Reset) && Timer)
{ {
timer::kill(Timer); timer::kill(Timer);
if (ListBitmap) if (ListBitmap)

View file

@ -2,11 +2,11 @@
#include "TCollisionComponent.h" #include "TCollisionComponent.h"
class TKickback : class TKickback :
public TCollisionComponent public TCollisionComponent2
{ {
public: public:
TKickback(TPinballTable* table, int groupIndex); TKickback(TPinballTable* table, int groupIndex);
int Message(int code, float value) override; int Message2(MessageCode code, float value) override;
void Collision(TBall* ball, vector2* nextPosition, vector2* direction, float distance, void Collision(TBall* ball, vector2* nextPosition, vector2* direction, float distance,
TEdgeSegment* edge) override; TEdgeSegment* edge) override;

View file

@ -11,7 +11,7 @@
#include "TPinballTable.h" #include "TPinballTable.h"
#include "TTableLayer.h" #include "TTableLayer.h"
TKickout::TKickout(TPinballTable* table, int groupIndex, bool someFlag): TCollisionComponent( TKickout::TKickout(TPinballTable* table, int groupIndex, bool someFlag): TCollisionComponent2(
table, groupIndex, false) table, groupIndex, false)
{ {
visualStruct visual{}; visualStruct visual{};
@ -24,7 +24,7 @@ TKickout::TKickout(TPinballTable* table, int groupIndex, bool someFlag): TCollis
TimerTime2 = 0.05f; TimerTime2 = 0.05f;
MessageField = 0; MessageField = 0;
Timer = 0; Timer = 0;
KickFlag1 = 0; BallCaputeredFlag = 0;
FieldMult = *loader::query_float_attribute(groupIndex, 0, 305); FieldMult = *loader::query_float_attribute(groupIndex, 0, 305);
loader::query_visual(groupIndex, 0, &visual); loader::query_visual(groupIndex, 0, &visual);
SoftHitSoundId = visual.SoftHitSoundId; SoftHitSoundId = visual.SoftHitSoundId;
@ -60,24 +60,24 @@ TKickout::TKickout(TPinballTable* table, int groupIndex, bool someFlag): TCollis
TTableLayer::edges_insert_circle(&circle, nullptr, &Field); TTableLayer::edges_insert_circle(&circle, nullptr, &Field);
} }
int TKickout::Message(int code, float value) int TKickout::Message2(MessageCode code, float value)
{ {
switch (code) switch (code)
{ {
case 55: case MessageCode::TKickoutRestartTimer:
if (KickFlag1) if (BallCaputeredFlag)
{ {
if (value < 0.0f) if (value < 0.0f)
value = TimerTime1; value = TimerTime1;
Timer = timer::set(value, this, TimerExpired); Timer = timer::set(value, this, TimerExpired);
} }
break; break;
case ~MessageCode::SetTiltLock: case MessageCode::SetTiltLock:
if (NotSomeFlag) if (NotSomeFlag)
ActiveFlag = 0; ActiveFlag = 0;
break; break;
case ~MessageCode::Reset: case MessageCode::Reset:
if (KickFlag1) if (BallCaputeredFlag)
{ {
if (Timer) if (Timer)
timer::kill(Timer); timer::kill(Timer);
@ -95,11 +95,11 @@ int TKickout::Message(int code, float value)
void TKickout::Collision(TBall* ball, vector2* nextPosition, vector2* direction, float distance, TEdgeSegment* edge) void TKickout::Collision(TBall* ball, vector2* nextPosition, vector2* direction, float distance, TEdgeSegment* edge)
{ {
if (!KickFlag1) if (!BallCaputeredFlag)
{ {
Ball = ball; Ball = ball;
Threshold = 1000000000.0; Threshold = 1000000000.0;
KickFlag1 = 1; BallCaputeredFlag = 1;
ball->CollisionComp = this; ball->CollisionComp = this;
ball->Position.X = Circle.Center.X; ball->Position.X = Circle.Center.X;
ball->Position.Y = Circle.Center.Y; ball->Position.Y = Circle.Center.Y;
@ -107,7 +107,7 @@ void TKickout::Collision(TBall* ball, vector2* nextPosition, vector2* direction,
ball->Position.Z = CollisionBallSetZ; ball->Position.Z = CollisionBallSetZ;
if (PinballTable->TiltLockFlag) if (PinballTable->TiltLockFlag)
{ {
Message(55, 0.1f); Message2(MessageCode::TKickoutRestartTimer, 0.1f);
} }
else else
{ {
@ -121,7 +121,7 @@ int TKickout::FieldEffect(TBall* ball, vector2* dstVec)
{ {
vector2 direction{}; vector2 direction{};
if (KickFlag1) if (BallCaputeredFlag)
return 0; return 0;
direction.X = Circle.Center.X - ball->Position.X; direction.X = Circle.Center.X - ball->Position.X;
direction.Y = Circle.Center.Y - ball->Position.Y; direction.Y = Circle.Center.Y - ball->Position.Y;
@ -136,9 +136,9 @@ int TKickout::FieldEffect(TBall* ball, vector2* dstVec)
void TKickout::TimerExpired(int timerId, void* caller) void TKickout::TimerExpired(int timerId, void* caller)
{ {
auto kick = static_cast<TKickout*>(caller); auto kick = static_cast<TKickout*>(caller);
if (kick->KickFlag1) if (kick->BallCaputeredFlag)
{ {
kick->KickFlag1 = 0; kick->BallCaputeredFlag = 0;
kick->Timer = timer::set(kick->TimerTime2, kick, ResetTimerExpired); kick->Timer = timer::set(kick->TimerTime2, kick, ResetTimerExpired);
if (kick->Ball) if (kick->Ball)
{ {

View file

@ -4,11 +4,11 @@
#include "TEdgeManager.h" #include "TEdgeManager.h"
class TKickout : class TKickout :
public TCollisionComponent public TCollisionComponent2
{ {
public: public:
TKickout(TPinballTable* table, int groupIndex, bool someFlag); TKickout(TPinballTable* table, int groupIndex, bool someFlag);
int Message(int code, float value) override; int Message2(MessageCode code, float value) override;
void Collision(TBall* ball, vector2* nextPosition, vector2* direction, float distance, void Collision(TBall* ball, vector2* nextPosition, vector2* direction, float distance,
TEdgeSegment* edge) override; TEdgeSegment* edge) override;
int FieldEffect(TBall* ball, vector2* vecDst) override; int FieldEffect(TBall* ball, vector2* vecDst) override;
@ -16,7 +16,7 @@ public:
static void TimerExpired(int timerId, void* caller); static void TimerExpired(int timerId, void* caller);
static void ResetTimerExpired(int timerId, void* caller); static void ResetTimerExpired(int timerId, void* caller);
int KickFlag1; int BallCaputeredFlag;
int NotSomeFlag; int NotSomeFlag;
int Timer; int Timer;
float TimerTime1; float TimerTime1;

View file

@ -19,9 +19,9 @@ TLightRollover::TLightRollover(TPinballTable* table, int groupIndex) : TRollover
FloatArr = *loader::query_float_attribute(groupIndex, 0, 407); FloatArr = *loader::query_float_attribute(groupIndex, 0, 407);
} }
int TLightRollover::Message(int code, float value) int TLightRollover::Message2(MessageCode code, float value)
{ {
if (code == 1024) if (code == MessageCode::Reset)
{ {
ActiveFlag = 1; ActiveFlag = 1;
RolloverFlag = 0; RolloverFlag = 0;

View file

@ -7,7 +7,7 @@ class TLightRollover :
public: public:
TLightRollover(TPinballTable* table, int groupIndex); TLightRollover(TPinballTable* table, int groupIndex);
~TLightRollover() override = default; ~TLightRollover() override = default;
int Message(int code, float value) override; int Message2(MessageCode code, float value) override;
void Collision(TBall* ball, vector2* nextPosition, vector2* direction, float distance, void Collision(TBall* ball, vector2* nextPosition, vector2* direction, float distance,
TEdgeSegment* edge) override; TEdgeSegment* edge) override;

View file

@ -108,7 +108,7 @@ TPinballComponent::~TPinballComponent()
int TPinballComponent::Message(int code, float value) int TPinballComponent::Message(int code, float value)
{ {
MessageField = code; MessageField = code;
if (code == 1024) if (code == ~MessageCode::Reset)
MessageField = 0; MessageField = 0;
return 0; return 0;
} }

View file

@ -65,6 +65,32 @@ enum class MessageCode
TLightGroupToggleSplitIndex = 45, TLightGroupToggleSplitIndex = 45,
TLightGroupStartFlasher = 46, TLightGroupStartFlasher = 46,
TBlockerDisable = 51,
TBlockerEnable = 52,
TBlockerRestartTimeout = 59,
TBumperSetBmpIndex = 11,
TBumperIncBmpIndex = 12,
TBumperDecBmpIndex = 13,
TComponentGroupResetNotifyTimer = 48,
TGateDisable = 53,
TGateEnable = 54,
TKickoutRestartTimer = 55,
TPopupTargetDisable = 49,
TPopupTargetEnable = 50,
TSinkUnknown7 = 7,
TSinkResetTimer = 56,
TSoloTargetDisable = 49,
TSoloTargetEnable = 50,
TTimerResetTimer = 59,
// Public codes 1000+, apply to all components // Public codes 1000+, apply to all components
LeftFlipperInputPressed = 1000, LeftFlipperInputPressed = 1000,
LeftFlipperInputReleased = 1001, LeftFlipperInputReleased = 1001,
@ -76,7 +102,7 @@ enum class MessageCode
Resume = 1009, Resume = 1009,
LooseFocus = 1010, LooseFocus = 1010,
SetTiltLock = 1011, SetTiltLock = 1011,
ResetTiltLock = 1012, ClearTiltLock = 1012,
StartGamePlayer1 = 1013, StartGamePlayer1 = 1013,
NewGame = 1014, NewGame = 1014,
PlungerFeedBall = 1015, PlungerFeedBall = 1015,

View file

@ -356,7 +356,7 @@ int TPinballTable::Message2(MessageCode code, float value)
component->Message2(code, value); component->Message2(code, value);
} }
break; break;
case MessageCode::ResetTiltLock: case MessageCode::ClearTiltLock:
LightGroup->Message(14, 0.0); LightGroup->Message(14, 0.0);
if (TiltLockFlag) if (TiltLockFlag)
{ {

View file

@ -8,40 +8,40 @@
#include "timer.h" #include "timer.h"
#include "TPinballTable.h" #include "TPinballTable.h"
TPopupTarget::TPopupTarget(TPinballTable* table, int groupIndex) : TCollisionComponent(table, groupIndex, true) TPopupTarget::TPopupTarget(TPinballTable* table, int groupIndex) : TCollisionComponent2(table, groupIndex, true)
{ {
this->Timer = 0; Timer = 0;
this->TimerTime = *loader::query_float_attribute(groupIndex, 0, 407); TimerTime = *loader::query_float_attribute(groupIndex, 0, 407);
} }
int TPopupTarget::Message(int code, float value) int TPopupTarget::Message2(MessageCode code, float value)
{ {
switch (code) switch (code)
{ {
case 49: case MessageCode::TPopupTargetDisable:
this->ActiveFlag = 0; ActiveFlag = 0;
render::sprite_set_bitmap(this->RenderSprite, nullptr); render::sprite_set_bitmap(RenderSprite, nullptr);
break; break;
case 50: case MessageCode::TPopupTargetEnable:
this->Timer = timer::set(this->TimerTime, this, TimerExpired); Timer = timer::set(TimerTime, this, TimerExpired);
break; break;
case ~MessageCode::PlayerChanged: case MessageCode::PlayerChanged:
this->PlayerMessagefieldBackup[this->PinballTable->CurrentPlayer] = this->MessageField; PlayerMessagefieldBackup[PinballTable->CurrentPlayer] = MessageField;
this->MessageField = this->PlayerMessagefieldBackup[static_cast<int>(floor(value))]; MessageField = PlayerMessagefieldBackup[static_cast<int>(floor(value))];
TPopupTarget::Message(50 - (MessageField != 0), 0.0); TPopupTarget::Message2(MessageField ? MessageCode::TPopupTargetDisable : MessageCode::TPopupTargetEnable, 0.0);
break; break;
case ~MessageCode::Reset: case MessageCode::Reset:
{ {
this->MessageField = 0; MessageField = 0;
int* playerPtr = this->PlayerMessagefieldBackup; int* playerPtr = PlayerMessagefieldBackup;
for (auto index = 0; index < this->PinballTable->PlayerCount; ++index) for (auto index = 0; index < PinballTable->PlayerCount; ++index)
{ {
*playerPtr = 0; *playerPtr = 0;
++playerPtr; ++playerPtr;
} }
if (this->Timer) if (Timer)
timer::kill(this->Timer); timer::kill(Timer);
TimerExpired(0, this); TimerExpired(0, this);
break; break;
} }
@ -54,22 +54,22 @@ int TPopupTarget::Message(int code, float value)
void TPopupTarget::Collision(TBall* ball, vector2* nextPosition, vector2* direction, float distance, void TPopupTarget::Collision(TBall* ball, vector2* nextPosition, vector2* direction, float distance,
TEdgeSegment* edge) TEdgeSegment* edge)
{ {
if (this->PinballTable->TiltLockFlag) if (PinballTable->TiltLockFlag)
{ {
maths::basic_collision(ball, nextPosition, direction, this->Elasticity, this->Smoothness, 1000000000.0, 0.0); maths::basic_collision(ball, nextPosition, direction, Elasticity, Smoothness, 1000000000.0, 0.0);
} }
else if (maths::basic_collision( else if (maths::basic_collision(
ball, ball,
nextPosition, nextPosition,
direction, direction,
this->Elasticity, Elasticity,
this->Smoothness, Smoothness,
this->Threshold, Threshold,
this->Boost) > this->Threshold) Boost) > Threshold)
{ {
if (this->HardHitSoundId) if (HardHitSoundId)
loader::play_sound(this->HardHitSoundId, this, "TPopupTarget1"); loader::play_sound(HardHitSoundId, this, "TPopupTarget1");
this->Message(49, 0.0); Message2(MessageCode::TPopupTargetDisable, 0.0);
control::handler(63, this); control::handler(63, this);
} }
} }

View file

@ -2,11 +2,11 @@
#include "TCollisionComponent.h" #include "TCollisionComponent.h"
class TPopupTarget : class TPopupTarget :
public TCollisionComponent public TCollisionComponent2
{ {
public: public:
TPopupTarget(TPinballTable* table, int groupIndex); TPopupTarget(TPinballTable* table, int groupIndex);
int Message(int code, float value) override; int Message2(MessageCode code, float value) override;
void Collision(TBall* ball, vector2* nextPosition, vector2* direction, float distance, void Collision(TBall* ball, vector2* nextPosition, vector2* direction, float distance,
TEdgeSegment* edge) override; TEdgeSegment* edge) override;

View file

@ -11,13 +11,13 @@
#include "timer.h" #include "timer.h"
#include "TPinballTable.h" #include "TPinballTable.h"
TRollover::TRollover(TPinballTable* table, int groupIndex, bool createWall) : TCollisionComponent( TRollover::TRollover(TPinballTable* table, int groupIndex, bool createWall) : TCollisionComponent2(
table, groupIndex, createWall) table, groupIndex, createWall)
{ {
} }
TRollover::TRollover(TPinballTable* table, int groupIndex) : TCollisionComponent(table, groupIndex, false) TRollover::TRollover(TPinballTable* table, int groupIndex) : TCollisionComponent2(table, groupIndex, false)
{ {
if (ListBitmap) if (ListBitmap)
render::sprite_set_bitmap(RenderSprite, ListBitmap->at(0)); render::sprite_set_bitmap(RenderSprite, ListBitmap->at(0));
@ -25,9 +25,9 @@ TRollover::TRollover(TPinballTable* table, int groupIndex) : TCollisionComponent
} }
int TRollover::Message(int code, float value) int TRollover::Message2(MessageCode code, float value)
{ {
if (code == 1024) if (code == MessageCode::Reset)
{ {
this->ActiveFlag = 1; this->ActiveFlag = 1;
this->RolloverFlag = 0; this->RolloverFlag = 0;

View file

@ -2,14 +2,14 @@
#include "TCollisionComponent.h" #include "TCollisionComponent.h"
class TRollover : class TRollover :
public TCollisionComponent public TCollisionComponent2
{ {
protected: protected:
TRollover(TPinballTable* table, int groupIndex, bool createWall); TRollover(TPinballTable* table, int groupIndex, bool createWall);
public: public:
TRollover(TPinballTable* table, int groupIndex); TRollover(TPinballTable* table, int groupIndex);
~TRollover() override = default; ~TRollover() override = default;
int Message(int code, float value) override; int Message2(MessageCode code, float value) override;
void Collision(TBall* ball, vector2* nextPosition, vector2* direction, float distance, void Collision(TBall* ball, vector2* nextPosition, vector2* direction, float distance,
TEdgeSegment* edge) override; TEdgeSegment* edge) override;
void build_walls(int groupIndex); void build_walls(int groupIndex);

View file

@ -9,7 +9,7 @@
#include "TBall.h" #include "TBall.h"
#include "timer.h" #include "timer.h"
TSink::TSink(TPinballTable* table, int groupIndex) : TCollisionComponent(table, groupIndex, true) TSink::TSink(TPinballTable* table, int groupIndex) : TCollisionComponent2(table, groupIndex, true)
{ {
visualStruct visual{}; visualStruct visual{};
@ -27,21 +27,21 @@ TSink::TSink(TPinballTable* table, int groupIndex) : TCollisionComponent(table,
TimerTime = *loader::query_float_attribute(groupIndex, 0, 407); TimerTime = *loader::query_float_attribute(groupIndex, 0, 407);
} }
int TSink::Message(int code, float value) int TSink::Message2(MessageCode code, float value)
{ {
switch (code) switch (code)
{ {
case 56: case MessageCode::TSinkResetTimer:
if (value < 0.0f) if (value < 0.0f)
value = TimerTime; value = TimerTime;
timer::set(value, this, TimerExpired); timer::set(value, this, TimerExpired);
break; break;
case ~MessageCode::PlayerChanged: case MessageCode::PlayerChanged:
timer::kill(TimerExpired); timer::kill(TimerExpired);
PlayerMessagefieldBackup[PinballTable->CurrentPlayer] = MessageField; PlayerMessagefieldBackup[PinballTable->CurrentPlayer] = MessageField;
MessageField = PlayerMessagefieldBackup[static_cast<int>(floor(value))]; MessageField = PlayerMessagefieldBackup[static_cast<int>(floor(value))];
break; break;
case ~MessageCode::Reset: case MessageCode::Reset:
{ {
timer::kill(TimerExpired); timer::kill(TimerExpired);
MessageField = 0; MessageField = 0;

View file

@ -3,11 +3,11 @@
#include "TCollisionComponent.h" #include "TCollisionComponent.h"
class TSink : class TSink :
public TCollisionComponent public TCollisionComponent2
{ {
public: public:
TSink(TPinballTable* table, int groupIndex); TSink(TPinballTable* table, int groupIndex);
int Message(int code, float value) override; int Message2(MessageCode code, float value) override;
void Collision(TBall* ball, vector2* nextPosition, vector2* direction, float distance, void Collision(TBall* ball, vector2* nextPosition, vector2* direction, float distance,
TEdgeSegment* edge) override; TEdgeSegment* edge) override;

View file

@ -8,7 +8,7 @@
#include "timer.h" #include "timer.h"
#include "TPinballTable.h" #include "TPinballTable.h"
TSoloTarget::TSoloTarget(TPinballTable* table, int groupIndex) : TCollisionComponent(table, groupIndex, true) TSoloTarget::TSoloTarget(TPinballTable* table, int groupIndex) : TCollisionComponent2(table, groupIndex, true)
{ {
visualStruct visual{}; visualStruct visual{};
@ -16,18 +16,18 @@ TSoloTarget::TSoloTarget(TPinballTable* table, int groupIndex) : TCollisionCompo
TimerTime = 0.1f; TimerTime = 0.1f;
loader::query_visual(groupIndex, 0, &visual); loader::query_visual(groupIndex, 0, &visual);
SoundIndex4 = visual.SoundIndex4; SoundIndex4 = visual.SoundIndex4;
TSoloTarget::Message(50, 0.0); TSoloTarget::Message2(MessageCode::TSoloTargetEnable, 0.0);
} }
int TSoloTarget::Message(int code, float value) int TSoloTarget::Message2(MessageCode code, float value)
{ {
switch (code) switch (code)
{ {
case 49: case MessageCode::TSoloTargetDisable:
case 50: case MessageCode::TSoloTargetEnable:
ActiveFlag = code == 50; ActiveFlag = code == MessageCode::TSoloTargetEnable;
break; break;
case ~MessageCode::Reset: case MessageCode::Reset:
if (Timer) if (Timer)
timer::kill(Timer); timer::kill(Timer);
Timer = 0; Timer = 0;
@ -58,7 +58,7 @@ void TSoloTarget::Collision(TBall* ball, vector2* nextPosition, vector2* directi
{ {
if (DefaultCollision(ball, nextPosition, direction)) if (DefaultCollision(ball, nextPosition, direction))
{ {
Message(49, 0.0); Message2(MessageCode::TSoloTargetDisable, 0.0);
Timer = timer::set(TimerTime, this, TimerExpired); Timer = timer::set(TimerTime, this, TimerExpired);
control::handler(63, this); control::handler(63, this);
} }
@ -67,6 +67,6 @@ void TSoloTarget::Collision(TBall* ball, vector2* nextPosition, vector2* directi
void TSoloTarget::TimerExpired(int timerId, void* caller) void TSoloTarget::TimerExpired(int timerId, void* caller)
{ {
auto target = static_cast<TSoloTarget*>(caller); auto target = static_cast<TSoloTarget*>(caller);
target->Message(50, 0.0); target->Message2(MessageCode::TSoloTargetEnable, 0.0);
target->Timer = 0; target->Timer = 0;
} }

View file

@ -2,11 +2,11 @@
#include "TCollisionComponent.h" #include "TCollisionComponent.h"
class TSoloTarget : class TSoloTarget :
public TCollisionComponent public TCollisionComponent2
{ {
public: public:
TSoloTarget(TPinballTable* table, int groupIndex); TSoloTarget(TPinballTable* table, int groupIndex);
int Message(int code, float value) override; int Message2(MessageCode code, float value) override;
void Collision(TBall* ball, vector2* nextPosition, vector2* direction, float distance, void Collision(TBall* ball, vector2* nextPosition, vector2* direction, float distance,
TEdgeSegment* edge) override; TEdgeSegment* edge) override;

View file

@ -10,7 +10,7 @@
#include "timer.h" #include "timer.h"
TTextBox::TTextBox(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, true) TTextBox::TTextBox(TPinballTable* table, int groupIndex) : TPinballComponent2(table, groupIndex, true)
{ {
OffsetX = 0; OffsetX = 0;
OffsetY = 0; OffsetY = 0;
@ -18,8 +18,8 @@ TTextBox::TTextBox(TPinballTable* table, int groupIndex) : TPinballComponent(tab
Height = 0; Height = 0;
BgBmp = render::background_bitmap; BgBmp = render::background_bitmap;
Font = score::msg_fontp; Font = score::msg_fontp;
Message1 = nullptr; CurrentMessage = nullptr;
Message2 = nullptr; PreviousMessage = nullptr;
Timer = 0; Timer = 0;
if (groupIndex > 0) if (groupIndex > 0)
@ -42,16 +42,16 @@ TTextBox::~TTextBox()
timer::kill(Timer); timer::kill(Timer);
Timer = 0; Timer = 0;
} }
while (Message1) while (CurrentMessage)
{ {
TTextBoxMessage* message = Message1; TTextBoxMessage* message = CurrentMessage;
TTextBoxMessage* nextMessage = message->NextMessage; TTextBoxMessage* nextMessage = message->NextMessage;
delete message; delete message;
Message1 = nextMessage; CurrentMessage = nextMessage;
} }
} }
int TTextBox::Message(int code, float value) int TTextBox::Message2(MessageCode code, float value)
{ {
return 0; return 0;
} }
@ -59,13 +59,13 @@ int TTextBox::Message(int code, float value)
void TTextBox::TimerExpired(int timerId, void* caller) void TTextBox::TimerExpired(int timerId, void* caller)
{ {
auto tb = static_cast<TTextBox*>(caller); auto tb = static_cast<TTextBox*>(caller);
TTextBoxMessage* message = tb->Message1; TTextBoxMessage* message = tb->CurrentMessage;
tb->Timer = 0; tb->Timer = 0;
if (message) if (message)
{ {
TTextBoxMessage* nextMessage = message->NextMessage; TTextBoxMessage* nextMessage = message->NextMessage;
delete message; delete message;
tb->Message1 = nextMessage; tb->CurrentMessage = nextMessage;
tb->Draw(); tb->Draw();
control::handler(60, tb); control::handler(60, tb);
} }
@ -92,12 +92,12 @@ void TTextBox::Clear()
timer::kill(Timer); timer::kill(Timer);
Timer = 0; Timer = 0;
} }
while (Message1) while (CurrentMessage)
{ {
TTextBoxMessage* message = Message1; TTextBoxMessage* message = CurrentMessage;
TTextBoxMessage* nextMessage = message->NextMessage; TTextBoxMessage* nextMessage = message->NextMessage;
delete message; delete message;
Message1 = nextMessage; CurrentMessage = nextMessage;
} }
} }
@ -106,10 +106,10 @@ void TTextBox::Display(const char* text, float time)
if (!text) if (!text)
return; return;
if (Message1 && !strcmp(text, Message2->Text)) if (CurrentMessage && !strcmp(text, PreviousMessage->Text))
{ {
Message2->Refresh(time); PreviousMessage->Refresh(time);
if (Message2 == Message1) if (PreviousMessage == CurrentMessage)
{ {
if (Timer && Timer != -1) if (Timer && Timer != -1)
timer::kill(Timer); timer::kill(Timer);
@ -129,11 +129,11 @@ void TTextBox::Display(const char* text, float time)
{ {
if (message->Text) if (message->Text)
{ {
if (Message1) if (CurrentMessage)
Message2->NextMessage = message; PreviousMessage->NextMessage = message;
else else
Message1 = message; CurrentMessage = message;
Message2 = message; PreviousMessage = message;
if (Timer == 0) if (Timer == 0)
Draw(); Draw();
} }
@ -148,7 +148,7 @@ void TTextBox::Display(const char* text, float time)
void TTextBox::DrawImGui() void TTextBox::DrawImGui()
{ {
// Do nothing when using a font (the text will be rendered to VScreen in TTextBox::Draw) // Do nothing when using a font (the text will be rendered to VScreen in TTextBox::Draw)
if (Font || !Message1) if (Font || !CurrentMessage)
return; return;
char windowName[64]; char windowName[64];
@ -167,18 +167,18 @@ void TTextBox::DrawImGui()
rect = fullscrn::GetScreenRectFromPinballRect(rect); rect = fullscrn::GetScreenRectFromPinballRect(rect);
ImGui::SetNextWindowPos(ImVec2(rect.x, rect.y)); ImGui::SetNextWindowPos(ImVec2(static_cast<float>(rect.x), static_cast<float>(rect.y)));
ImGui::SetNextWindowSize(ImVec2(rect.w, rect.h)); ImGui::SetNextWindowSize(ImVec2(static_cast<float>(rect.w), static_cast<float>(rect.h)));
// Use the pointer to generate a window unique name per text box // Use the pointer to generate a window unique name per text box
snprintf(windowName, sizeof(windowName), "TTextBox_%p", this); snprintf(windowName, sizeof(windowName), "TTextBox_%p", static_cast<void*>(this));
if (ImGui::Begin(windowName, nullptr, window_flags)) if (ImGui::Begin(windowName, nullptr, window_flags))
{ {
ImGui::SetWindowFontScale(fullscrn::GetScreenToPinballRatio()); ImGui::SetWindowFontScale(fullscrn::GetScreenToPinballRatio());
// ToDo: centered text in FT // ToDo: centered text in FT
ImGui::PushStyleColor(ImGuiCol_Text, pb::TextBoxColor); ImGui::PushStyleColor(ImGuiCol_Text, pb::TextBoxColor);
ImGui::TextWrapped("%s", Message1->Text); ImGui::TextWrapped("%s", CurrentMessage->Text);
ImGui::PopStyleColor(); ImGui::PopStyleColor();
} }
ImGui::End(); ImGui::End();
@ -201,26 +201,26 @@ void TTextBox::Draw()
gdrv::fill_bitmap(render::vscreen, Width, Height, OffsetX, OffsetY, 0); gdrv::fill_bitmap(render::vscreen, Width, Height, OffsetX, OffsetY, 0);
bool display = false; bool display = false;
while (Message1) while (CurrentMessage)
{ {
if (Message1->Time == -1.0f) if (CurrentMessage->Time == -1.0f)
{ {
if (!Message1->NextMessage) if (!CurrentMessage->NextMessage)
{ {
Timer = -1; Timer = -1;
display = true; display = true;
break; break;
} }
} }
else if (Message1->TimeLeft() >= -2.0f) else if (CurrentMessage->TimeLeft() >= -2.0f)
{ {
Timer = timer::set(std::max(Message1->TimeLeft(), 0.25f), this, TimerExpired); Timer = timer::set(std::max(CurrentMessage->TimeLeft(), 0.25f), this, TimerExpired);
display = true; display = true;
break; break;
} }
auto tmp = Message1; auto tmp = CurrentMessage;
Message1 = Message1->NextMessage; CurrentMessage = CurrentMessage->NextMessage;
delete tmp; delete tmp;
} }
@ -234,7 +234,7 @@ void TTextBox::Draw()
std::vector<LayoutResult> lines{}; std::vector<LayoutResult> lines{};
auto textHeight = 0; auto textHeight = 0;
for (auto text = Message1->Text; ; textHeight += Font->Height) for (auto text = CurrentMessage->Text; ; textHeight += Font->Height)
{ {
if (!text[0] || textHeight + Font->Height > Height) if (!text[0] || textHeight + Font->Height > Height)
break; break;

View file

@ -4,7 +4,7 @@
#include "TTextBoxMessage.h" #include "TTextBoxMessage.h"
class TTextBox : class TTextBox :
public TPinballComponent public TPinballComponent2
{ {
public: public:
int OffsetX; int OffsetX;
@ -14,12 +14,12 @@ public:
int Timer; int Timer;
gdrv_bitmap8* BgBmp; gdrv_bitmap8* BgBmp;
score_msg_font_type* Font; score_msg_font_type* Font;
TTextBoxMessage* Message1; TTextBoxMessage* CurrentMessage;
TTextBoxMessage* Message2; TTextBoxMessage* PreviousMessage;
TTextBox(TPinballTable* table, int groupIndex); TTextBox(TPinballTable* table, int groupIndex);
~TTextBox() override; ~TTextBox() override;
int Message(int code, float value) override; int Message2(MessageCode code, float value) override;
void Clear(); void Clear();
void Display(const char* text, float time); void Display(const char* text, float time);
void DrawImGui(); void DrawImGui();

View file

@ -4,26 +4,30 @@
#include "control.h" #include "control.h"
#include "timer.h" #include "timer.h"
TTimer::TTimer(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, true) TTimer::TTimer(TPinballTable* table, int groupIndex) : TPinballComponent2(table, groupIndex, true)
{ {
Timer = 0; Timer = 0;
} }
int TTimer::Message(int code, float value) int TTimer::Message2(MessageCode code, float value)
{ {
if (code == 59) switch (code)
{ {
case MessageCode::TTimerResetTimer:
if (Timer) if (Timer)
timer::kill(Timer); timer::kill(Timer);
Timer = timer::set(value, this, TimerExpired); Timer = timer::set(value, this, TimerExpired);
} break;
else if (code == 1011 || code == 1022 || code == 1024) case MessageCode::SetTiltLock:
{ case MessageCode::GameOver:
case MessageCode::Reset:
if (Timer) if (Timer)
{ {
timer::kill(Timer); timer::kill(Timer);
Timer = 0; Timer = 0;
} }
break;
default: break;
} }
return 0; return 0;
} }

View file

@ -2,11 +2,11 @@
#include "TPinballComponent.h" #include "TPinballComponent.h"
class TTimer : class TTimer :
public TPinballComponent public TPinballComponent2
{ {
public: public:
TTimer(TPinballTable* table, int groupIndex); TTimer(TPinballTable* table, int groupIndex);
int Message(int code, float value) override; int Message2(MessageCode code, float value) override;
static void TimerExpired(int timerId, void* caller); static void TimerExpired(int timerId, void* caller);
int Timer; int Timer;

View file

@ -6,7 +6,7 @@
#include "render.h" #include "render.h"
#include "timer.h" #include "timer.h"
TWall::TWall(TPinballTable* table, int groupIndex) : TCollisionComponent(table, groupIndex, true) TWall::TWall(TPinballTable* table, int groupIndex) : TCollisionComponent2(table, groupIndex, true)
{ {
if (RenderSprite) if (RenderSprite)
render::sprite_set_bitmap(RenderSprite, nullptr); render::sprite_set_bitmap(RenderSprite, nullptr);
@ -14,9 +14,9 @@ TWall::TWall(TPinballTable* table, int groupIndex) : TCollisionComponent(table,
BmpPtr = ListBitmap->at(0); BmpPtr = ListBitmap->at(0);
} }
int TWall::Message(int code, float value) int TWall::Message2(MessageCode code, float value)
{ {
if (code == 1024 && Timer) if (code == MessageCode::Reset && Timer)
{ {
timer::kill(Timer); timer::kill(Timer);
TimerExpired(Timer, this); TimerExpired(Timer, this);

View file

@ -5,11 +5,11 @@
struct gdrv_bitmap8; struct gdrv_bitmap8;
class TWall : class TWall :
public TCollisionComponent public TCollisionComponent2
{ {
public: public:
TWall(TPinballTable* table, int groupIndex); TWall(TPinballTable* table, int groupIndex);
int Message(int code, float value) override; int Message2(MessageCode code, float value) override;
void Collision(TBall* ball, vector2* nextPosition, vector2* direction, float distance, void Collision(TBall* ball, vector2* nextPosition, vector2* direction, float distance,
TEdgeSegment* edge) override; TEdgeSegment* edge) override;

View file

@ -996,9 +996,9 @@ void control::table_set_multiball(float time)
if (TableG->MultiballCount <= 1) if (TableG->MultiballCount <= 1)
{ {
TableG->MultiballCount += 3; TableG->MultiballCount += 3;
sink1->Message(56, time); sink1->Message2(MessageCode::TSinkResetTimer, time);
sink2->Message(56, time); sink2->Message2(MessageCode::TSinkResetTimer, time);
sink3->Message(56, time); sink3->Message2(MessageCode::TSinkResetTimer, time);
lite38->Message(7, -1.0f); lite38->Message(7, -1.0f);
lite39->Message(7, -1.0f); lite39->Message(7, -1.0f);
lite40->Message(7, -1.0f); lite40->Message(7, -1.0f);
@ -1171,23 +1171,23 @@ void control::BumperControl(int code, TPinballComponent* caller)
void control::LeftKickerControl(int code, TPinballComponent* caller) void control::LeftKickerControl(int code, TPinballComponent* caller)
{ {
if (code == 60) if (code == 60)
gate1->Message(54, 0.0); gate1->Message2(MessageCode::TGateEnable, 0.0);
} }
void control::RightKickerControl(int code, TPinballComponent* caller) void control::RightKickerControl(int code, TPinballComponent* caller)
{ {
if (code == 60) if (code == 60)
gate2->Message(54, 0.0); gate2->Message2(MessageCode::TGateEnable, 0.0);
} }
void control::LeftKickerGateControl(int code, TPinballComponent* caller) void control::LeftKickerGateControl(int code, TPinballComponent* caller)
{ {
if (code == 53) if (code == ~MessageCode::TGateDisable)
{ {
lite30->Message(15, 5.0); lite30->Message(15, 5.0);
lite196->Message(7, 5.0); lite196->Message(7, 5.0);
} }
else if (code == 54) else if (code == ~MessageCode::TGateEnable)
{ {
lite30->Message(20, 0.0); lite30->Message(20, 0.0);
lite196->Message(20, 0.0); lite196->Message(20, 0.0);
@ -1196,12 +1196,12 @@ void control::LeftKickerGateControl(int code, TPinballComponent* caller)
void control::RightKickerGateControl(int code, TPinballComponent* caller) void control::RightKickerGateControl(int code, TPinballComponent* caller)
{ {
if (code == 53) if (code == ~MessageCode::TGateDisable)
{ {
lite29->Message(15, 5.0); lite29->Message(15, 5.0);
lite195->Message(7, 5.0); lite195->Message(7, 5.0);
} }
else if (code == 54) else if (code == ~MessageCode::TGateEnable)
{ {
lite29->Message(20, 0.0); lite29->Message(20, 0.0);
lite195->Message(20, 0.0); lite195->Message(20, 0.0);
@ -1240,16 +1240,16 @@ void control::DeploymentChuteToTableOneWayControl(int code, TPinballComponent* c
void control::DrainBallBlockerControl(int code, TPinballComponent* caller) void control::DrainBallBlockerControl(int code, TPinballComponent* caller)
{ {
int msgCode; int lightMessage;
float msgValue; float blockerDuration;
auto block = static_cast<TBlocker*>(caller); auto block = static_cast<TBlocker*>(caller);
if (code == 52) if (code == 52)
{ {
block->MessageField = 1; block->MessageField = 1;
block->Message(52, static_cast<float>(block->TurnOnMsgValue)); blockerDuration = static_cast<float>(block->InitialDuration);
msgValue = static_cast<float>(block->TurnOnMsgValue); block->Message2(MessageCode::TBlockerEnable, blockerDuration);
msgCode = 9; lightMessage = 9;
} }
else else
{ {
@ -1258,15 +1258,15 @@ void control::DrainBallBlockerControl(int code, TPinballComponent* caller)
if (block->MessageField != 1) if (block->MessageField != 1)
{ {
block->MessageField = 0; block->MessageField = 0;
block->Message(51, 0.0); block->Message2(MessageCode::TBlockerDisable, 0.0);
return; return;
} }
block->MessageField = 2; block->MessageField = 2;
block->Message(59, static_cast<float>(block->TurnOffMsgValue)); blockerDuration = static_cast<float>(block->ExtendedDuration);
msgValue = static_cast<float>(block->TurnOffMsgValue); block->Message2(MessageCode::TBlockerRestartTimeout, blockerDuration);
msgCode = 7; lightMessage = 7;
} }
lite1->Message(msgCode, msgValue); lite1->Message(lightMessage, blockerDuration);
} }
void control::LaunchRampControl(int code, TPinballComponent* caller) void control::LaunchRampControl(int code, TPinballComponent* caller)
@ -1366,10 +1366,10 @@ void control::ReentryLanesRolloverControl(int code, TPinballComponent* caller)
bmpr_inc_lights->Message(0, 0.0); bmpr_inc_lights->Message(0, 0.0);
if (bump1->BmpIndex < 3) if (bump1->BmpIndex < 3)
{ {
attack_bump->Message(12, 0.0); attack_bump->Message2(MessageCode::TBumperIncBmpIndex, 0.0);
info_text_box->Display(pb::get_rc_string(Msg::STRING106), 2.0); info_text_box->Display(pb::get_rc_string(Msg::STRING106), 2.0);
} }
attack_bump->Message(48, 60.0); attack_bump->Message2(MessageCode::TComponentGroupResetNotifyTimer, 60.0);
} }
} }
} }
@ -1381,12 +1381,8 @@ void control::BumperGroupControl(int code, TPinballComponent* caller)
{ {
if (code == 61) if (code == 61)
{ {
/*Bug in the original. Caller (TComponentGroup) is accessed beyond bounds at 0x4E*/ caller->Message2(MessageCode::TComponentGroupResetNotifyTimer, 60.0);
if (static_cast<TBumper*>(caller)->BmpIndex) caller->Message2(MessageCode::TBumperDecBmpIndex, 0.0);
{
caller->Message(48, 60.0);
caller->Message(13, 0.0);
}
} }
} }
@ -1422,10 +1418,10 @@ void control::LaunchLanesRolloverControl(int code, TPinballComponent* caller)
ramp_bmpr_inc_lights->Message(0, 0.0); ramp_bmpr_inc_lights->Message(0, 0.0);
if (bump5->BmpIndex < 3) if (bump5->BmpIndex < 3)
{ {
launch_bump->Message(12, 0.0); launch_bump->Message2(MessageCode::TBumperIncBmpIndex, 0.0);
info_text_box->Display(pb::get_rc_string(Msg::STRING107), 2.0); info_text_box->Display(pb::get_rc_string(Msg::STRING107), 2.0);
} }
launch_bump->Message(48, 60.0); launch_bump->Message2(MessageCode::TComponentGroupResetNotifyTimer, 60.0);
} }
} }
} }
@ -1706,7 +1702,7 @@ void control::WormHoleControl(int code, TPinballComponent* caller)
wormhole_tag_array2[sinkFlag]->GetComponent()->Message(16, sink->TimerTime); wormhole_tag_array2[sinkFlag]->GetComponent()->Message(16, sink->TimerTime);
wormhole_tag_array3[sinkFlag]->GetComponent()->Message(11, static_cast<float>(2 - sinkFlag)); wormhole_tag_array3[sinkFlag]->GetComponent()->Message(11, static_cast<float>(2 - sinkFlag));
wormhole_tag_array3[sinkFlag]->GetComponent()->Message(16, sink->TimerTime); wormhole_tag_array3[sinkFlag]->GetComponent()->Message(16, sink->TimerTime);
wormhole_tag_array1[sinkFlag]->GetComponent()->Message(56, sink->TimerTime); wormhole_tag_array1[sinkFlag]->GetComponent()->Message2(MessageCode::TSinkResetTimer, sink->TimerTime);
return; return;
} }
TableG->AddScore(sink->get_scoring(2)); TableG->AddScore(sink->get_scoring(2));
@ -1721,7 +1717,7 @@ void control::WormHoleControl(int code, TPinballComponent* caller)
wormhole_tag_array2[sinkFlag2]->GetComponent()->Message(16, sink->TimerTime); wormhole_tag_array2[sinkFlag2]->GetComponent()->Message(16, sink->TimerTime);
wormhole_tag_array3[sinkFlag2]->GetComponent()->Message(11, static_cast<float>(2 - sinkFlag2)); wormhole_tag_array3[sinkFlag2]->GetComponent()->Message(11, static_cast<float>(2 - sinkFlag2));
wormhole_tag_array3[sinkFlag2]->GetComponent()->Message(16, sink->TimerTime); wormhole_tag_array3[sinkFlag2]->GetComponent()->Message(16, sink->TimerTime);
wormhole_tag_array1[sinkFlag2]->GetComponent()->Message(56, sink->TimerTime); wormhole_tag_array1[sinkFlag2]->GetComponent()->Message2(MessageCode::TSinkResetTimer, sink->TimerTime);
info_text_box->Display(pb::get_rc_string(Msg::STRING150), 2.0); info_text_box->Display(pb::get_rc_string(Msg::STRING150), 2.0);
} }
} }
@ -1811,11 +1807,11 @@ void control::BoosterTargetControl(int code, TPinballComponent* caller)
sound->Play(caller, "BoosterTargetControl"); sound->Play(caller, "BoosterTargetControl");
target1->MessageField = 0; target1->MessageField = 0;
target1->Message(50, 0.0); target1->Message2(MessageCode::TPopupTargetEnable, 0.0);
target2->MessageField = 0; target2->MessageField = 0;
target2->Message(50, 0.0); target2->Message2(MessageCode::TPopupTargetEnable, 0.0);
target3->MessageField = 0; target3->MessageField = 0;
target3->Message(50, 0.0); target3->Message2(MessageCode::TPopupTargetEnable, 0.0);
TableG->AddScore(caller->get_scoring(1)); TableG->AddScore(caller->get_scoring(1));
} }
} }
@ -1968,7 +1964,7 @@ void control::LeftHazardSpotTargetControl(int code, TPinballComponent* caller)
if (lchute_tgt_lights->Message(37, 0.0) == 3) if (lchute_tgt_lights->Message(37, 0.0) == 3)
{ {
soundwave14_1->Play(caller, "LeftHazardSpotTargetControl1"); soundwave14_1->Play(caller, "LeftHazardSpotTargetControl1");
gate1->Message(53, 0.0); gate1->Message2(MessageCode::TGateDisable, 0.0);
lchute_tgt_lights->Message(16, 2.0); lchute_tgt_lights->Message(16, 2.0);
} }
else else
@ -2004,7 +2000,7 @@ void control::RightHazardSpotTargetControl(int code, TPinballComponent* caller)
if (bpr_solotgt_lights->Message(37, 0.0) == 3) if (bpr_solotgt_lights->Message(37, 0.0) == 3)
{ {
soundwave14_1->Play(caller, "RightHazardSpotTargetControl1"); soundwave14_1->Play(caller, "RightHazardSpotTargetControl1");
gate2->Message(53, 0.0); gate2->Message2(MessageCode::TGateDisable, 0.0);
bpr_solotgt_lights->Message(16, 2.0); bpr_solotgt_lights->Message(16, 2.0);
} }
else else
@ -2037,7 +2033,7 @@ void control::BlackHoleKickoutControl(int code, TPinballComponent* caller)
int addedScore = TableG->AddScore(caller->get_scoring(0)); int addedScore = TableG->AddScore(caller->get_scoring(0));
snprintf(Buffer, sizeof Buffer, pb::get_rc_string(Msg::STRING181), addedScore); snprintf(Buffer, sizeof Buffer, pb::get_rc_string(Msg::STRING181), addedScore);
info_text_box->Display(Buffer, 2.0); info_text_box->Display(Buffer, 2.0);
caller->Message(55, -1.0); caller->Message2(MessageCode::TKickoutRestartTimer, -1.0);
} }
} }
@ -2068,7 +2064,7 @@ void control::GravityWellKickoutControl(int code, TPinballComponent* caller)
lite62->Message(20, 0.0); lite62->Message(20, 0.0);
caller->ActiveFlag = 0; caller->ActiveFlag = 0;
auto duration = soundwave7->Play(lite62, "GravityWellKickoutControl"); auto duration = soundwave7->Play(lite62, "GravityWellKickoutControl");
caller->Message(55, duration); caller->Message2(MessageCode::TKickoutRestartTimer, duration);
break; break;
} }
case 64: case 64:
@ -2190,7 +2186,9 @@ void control::ShootAgainLightControl(int code, TPinballComponent* caller)
void control::EscapeChuteSinkControl(int code, TPinballComponent* caller) void control::EscapeChuteSinkControl(int code, TPinballComponent* caller)
{ {
if (code == 63) if (code == 63)
caller->Message(56, static_cast<TSink*>(caller)->TimerTime); {
caller->Message2(MessageCode::TSinkResetTimer, -1.0f);
}
} }
void control::MissionControl(int code, TPinballComponent* caller) void control::MissionControl(int code, TPinballComponent* caller)
@ -2441,7 +2439,7 @@ void control::HyperspaceKickOutControl(int code, TPinballComponent* caller)
soundwave36_1->Play(lite24, "HyperspaceKickOutControl2"); soundwave36_1->Play(lite24, "HyperspaceKickOutControl2");
soundwave50_2->Play(lite24, "HyperspaceKickOutControl3"); soundwave50_2->Play(lite24, "HyperspaceKickOutControl3");
lite25->Message(7, 5.0); lite25->Message(7, 5.0);
caller->Message(55, duration); caller->Message2(MessageCode::TKickoutRestartTimer, duration);
return; return;
} }
sound = soundwave40; sound = soundwave40;
@ -2470,7 +2468,7 @@ void control::HyperspaceKickOutControl(int code, TPinballComponent* caller)
} }
auto duration = sound->Play(lite24, "HyperspaceKickOutControl4"); auto duration = sound->Play(lite24, "HyperspaceKickOutControl4");
lite25->Message(7, 5.0); lite25->Message(7, 5.0);
caller->Message(55, duration); caller->Message2(MessageCode::TKickoutRestartTimer, duration);
} }
void control::PlungerControl(int code, TPinballComponent* caller) void control::PlungerControl(int code, TPinballComponent* caller)
@ -2499,8 +2497,8 @@ void control::PlungerControl(int code, TPinballComponent* caller)
MultiplierLightGroupControl(65, top_target_lights); MultiplierLightGroupControl(65, top_target_lights);
fuel_bargraph->Message(19, 0.0); fuel_bargraph->Message(19, 0.0);
lite200->Message(19, 0.0); lite200->Message(19, 0.0);
gate1->Message(53, 0.0); gate1->Message2(MessageCode::TGateDisable, 0.0);
gate2->Message(53, 0.0); gate2->Message2(MessageCode::TGateDisable, 0.0);
} }
lite200->MessageField = 0; lite200->MessageField = 0;
} }
@ -2535,11 +2533,11 @@ void control::MedalTargetControl(int code, TPinballComponent* caller)
} }
info_text_box->Display(text, 2.0); info_text_box->Display(text, 2.0);
target6->MessageField = 0; target6->MessageField = 0;
target6->Message(50, 0.0); target6->Message2(MessageCode::TPopupTargetEnable, 0.0);
target5->MessageField = 0; target5->MessageField = 0;
target5->Message(50, 0.0); target5->Message2(MessageCode::TPopupTargetEnable, 0.0);
target4->MessageField = 0; target4->MessageField = 0;
target4->Message(50, 0.0); target4->Message2(MessageCode::TPopupTargetEnable, 0.0);
return; return;
} }
TableG->AddScore(caller->get_scoring(0)); TableG->AddScore(caller->get_scoring(0));
@ -2579,11 +2577,11 @@ void control::MultiplierTargetControl(int code, TPinballComponent* caller)
info_text_box->Display(text, 2.0); info_text_box->Display(text, 2.0);
target9->MessageField = 0; target9->MessageField = 0;
target9->Message(50, 0.0); target9->Message2(MessageCode::TPopupTargetEnable, 0.0);
target8->MessageField = 0; target8->MessageField = 0;
target8->Message(50, 0.0); target8->Message2(MessageCode::TPopupTargetEnable, 0.0);
target7->MessageField = 0; target7->MessageField = 0;
target7->Message(50, 0.0); target7->Message2(MessageCode::TPopupTargetEnable, 0.0);
} }
else else
{ {
@ -2618,7 +2616,7 @@ void control::BallDrainControl(int code, TPinballComponent* caller)
if (table_unlimited_balls) if (table_unlimited_balls)
{ {
drain->Message2(MessageCode::Reset, 0.0); drain->Message2(MessageCode::Reset, 0.0);
sink3->Message(56, 0.0); sink3->Message2(MessageCode::TSinkResetTimer, 0.0);
} }
else else
{ {
@ -2771,7 +2769,7 @@ void control::BallDrainControl(int code, TPinballComponent* caller)
else else
lite198->MessageField = 0; lite198->MessageField = 0;
MissionControl(66, nullptr); MissionControl(66, nullptr);
TableG->Message2(MessageCode::ResetTiltLock, 0.0); TableG->Message2(MessageCode::ClearTiltLock, 0.0);
if (light_on(&control_lite58_tag)) if (light_on(&control_lite58_tag))
lite58->Message(20, 0.0); lite58->Message(20, 0.0);
else else
@ -2798,7 +2796,7 @@ void control::AlienMenaceController(int code, TPinballComponent* caller)
{ {
if (code == 66) if (code == 66)
{ {
attack_bump->Message(11, 0.0); attack_bump->Message2(MessageCode::TBumperSetBmpIndex, 0.0);
l_trek_lights->Message(20, 0.0); l_trek_lights->Message(20, 0.0);
l_trek_lights->Message(32, 0.2f); l_trek_lights->Message(32, 0.2f);
l_trek_lights->Message(26, 0.2f); l_trek_lights->Message(26, 0.2f);
@ -2912,7 +2910,7 @@ void control::BlackHoleThreatController(int code, TPinballComponent* caller)
{ {
if (code == 66) if (code == 66)
{ {
launch_bump->Message(11, 0.0); launch_bump->Message2(MessageCode::TBumperSetBmpIndex, 0.0);
} }
else if (code != 67) else if (code != 67)
{ {
@ -2951,23 +2949,23 @@ void control::BugHuntController(int code, TPinballComponent* caller)
{ {
lite56->MessageField = 15; lite56->MessageField = 15;
target1->MessageField = 0; target1->MessageField = 0;
target1->Message(50, 0.0); target1->Message2(MessageCode::TPopupTargetEnable, 0.0);
target2->MessageField = 0; target2->MessageField = 0;
target2->Message(50, 0.0); target2->Message2(MessageCode::TPopupTargetEnable, 0.0);
target3->MessageField = 0; target3->MessageField = 0;
target3->Message(50, 0.0); target3->Message2(MessageCode::TPopupTargetEnable, 0.0);
target6->MessageField = 0; target6->MessageField = 0;
target6->Message(50, 0.0); target6->Message2(MessageCode::TPopupTargetEnable, 0.0);
target5->MessageField = 0; target5->MessageField = 0;
target5->Message(50, 0.0); target5->Message2(MessageCode::TPopupTargetEnable, 0.0);
target4->MessageField = 0; target4->MessageField = 0;
target4->Message(50, 0.0); target4->Message2(MessageCode::TPopupTargetEnable, 0.0);
target9->MessageField = 0; target9->MessageField = 0;
target9->Message(50, 0.0); target9->Message2(MessageCode::TPopupTargetEnable, 0.0);
target8->MessageField = 0; target8->MessageField = 0;
target8->Message(50, 0.0); target8->Message2(MessageCode::TPopupTargetEnable, 0.0);
target7->MessageField = 0; target7->MessageField = 0;
target7->Message(50, 0.0); target7->Message2(MessageCode::TPopupTargetEnable, 0.0);
top_circle_tgt_lights->Message(20, 0.0); top_circle_tgt_lights->Message(20, 0.0);
ramp_tgt_lights->Message(20, 0.0); ramp_tgt_lights->Message(20, 0.0);
lchute_tgt_lights->Message(20, 0.0); lchute_tgt_lights->Message(20, 0.0);
@ -3431,9 +3429,9 @@ void control::MaelstromPartSevenController(int code, TPinballComponent* caller)
if (code == 66) if (code == 66)
{ {
AdvanceWormHoleDestination(1); AdvanceWormHoleDestination(1);
sink1->Message(7, 0.0); sink1->Message2(MessageCode::TSinkUnknown7, 0.0);
sink2->Message(7, 0.0); sink2->Message2(MessageCode::TSinkUnknown7, 0.0);
sink3->Message(7, 0.0); sink3->Message2(MessageCode::TSinkUnknown7, 0.0);
} }
else if (code != 67) else if (code != 67)
{ {
@ -3877,23 +3875,23 @@ void control::ScienceMissionController(int code, TPinballComponent* caller)
{ {
lite56->MessageField = 9; lite56->MessageField = 9;
target1->MessageField = 0; target1->MessageField = 0;
target1->Message(50, 0.0); target1->Message2(MessageCode::TPopupTargetEnable, 0.0);
target2->MessageField = 0; target2->MessageField = 0;
target2->Message(50, 0.0); target2->Message2(MessageCode::TPopupTargetEnable, 0.0);
target3->MessageField = 0; target3->MessageField = 0;
target3->Message(50, 0.0); target3->Message2(MessageCode::TPopupTargetEnable, 0.0);
target6->MessageField = 0; target6->MessageField = 0;
target6->Message(50, 0.0); target6->Message2(MessageCode::TPopupTargetEnable, 0.0);
target5->MessageField = 0; target5->MessageField = 0;
target5->Message(50, 0.0); target5->Message2(MessageCode::TPopupTargetEnable, 0.0);
target4->MessageField = 0; target4->MessageField = 0;
target4->Message(50, 0.0); target4->Message2(MessageCode::TPopupTargetEnable, 0.0);
target9->MessageField = 0; target9->MessageField = 0;
target9->Message(50, 0.0); target9->Message2(MessageCode::TPopupTargetEnable, 0.0);
target8->MessageField = 0; target8->MessageField = 0;
target8->Message(50, 0.0); target8->Message2(MessageCode::TPopupTargetEnable, 0.0);
target7->MessageField = 0; target7->MessageField = 0;
target7->Message(50, 0.0); target7->Message2(MessageCode::TPopupTargetEnable, 0.0);
lite303->Message(7, 0.0); lite303->Message(7, 0.0);
lite309->Message(7, 0.0); lite309->Message(7, 0.0);
lite315->Message(7, 0.0); lite315->Message(7, 0.0);