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 "TTableLayer.h"
TBall::TBall(TPinballTable* table) : TPinballComponent(table, -1, false)
TBall::TBall(TPinballTable* table) : TPinballComponent2(table, -1, false)
{
visualStruct visual{};
char ballGroupName[10]{"ball"};
@ -106,9 +106,9 @@ bool TBall::already_hit(TEdgeSegment* edge)
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);
Position.X = 0.0;

View File

@ -5,14 +5,14 @@
class TCollisionComponent;
class TEdgeSegment;
class TBall : public TPinballComponent
class TBall : public TPinballComponent2
{
public :
TBall(TPinballTable* table);
void Repaint();
void not_again(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;
void Disable();

View File

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

View File

@ -2,16 +2,16 @@
#include "TCollisionComponent.h"
class TBlocker :
public TCollisionComponent
public TCollisionComponent2
{
public:
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);
int TurnOnMsgValue;
int TurnOffMsgValue;
int InitialDuration;
int ExtendedDuration;
int Timer;
int SoundIndex4;
int SoundIndex3;

View File

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

View File

@ -8,12 +8,12 @@ struct TBumper_player_backup
};
class TBumper :
public TCollisionComponent
public TCollisionComponent2
{
public:
TBumper(TPinballTable* table, int groupIndex);
~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,
TEdgeSegment* edge) override;
void Fire();

View File

@ -7,7 +7,7 @@
#include "timer.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;
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)
{
@ -45,11 +45,12 @@ int TComponentGroup::Message(int code, float value)
if (value > 0.0f)
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)
{
component->Message(code, value);
component->Message2(code, value);
}
}
return 0;

View File

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

View File

@ -10,7 +10,7 @@
#include "TBall.h"
TDemo::TDemo(TPinballTable* table, int groupIndex)
: TCollisionComponent(table, groupIndex, false)
: TCollisionComponent2(table, groupIndex, false)
{
visualStruct visual{};
@ -56,23 +56,23 @@ TDemo::TDemo(TPinballTable* table, int groupIndex)
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)
{
case ~MessageCode::NewGame:
case MessageCode::NewGame:
if (RestartGameTimer)
timer::kill(RestartGameTimer);
RestartGameTimer = 0;
break;
case ~MessageCode::GameOver:
case MessageCode::GameOver:
if (RestartGameTimer)
timer::kill(RestartGameTimer);
RestartGameTimer = 0;
if (ActiveFlag != 0)
RestartGameTimer = timer::set(5.0, this, NewGameRestartTimer);
break;
case ~MessageCode::Reset:
case MessageCode::Reset:
if (FlipLeftTimer)
timer::kill(FlipLeftTimer);
FlipLeftTimer = 0;

View File

@ -2,11 +2,11 @@
#include "TCollisionComponent.h"
class TDemo :
public TCollisionComponent
public TCollisionComponent2
{
public:
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,
TEdgeSegment* edge) override;

View File

@ -8,15 +8,15 @@
#include "timer.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;
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)
{

View File

@ -2,11 +2,11 @@
#include "TCollisionComponent.h"
class TDrain :
public TCollisionComponent
public TCollisionComponent2
{
public:
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,
TEdgeSegment* edge) override;

View File

@ -10,7 +10,7 @@
#include "TLine.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{};
vector2 end{}, start{};
@ -50,9 +50,9 @@ TFlagSpinner::TFlagSpinner(TPinballTable* table, int groupIndex) : TCollisionCom
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)
{

View File

@ -2,11 +2,11 @@
#include "TCollisionComponent.h"
class TFlagSpinner :
public TCollisionComponent
public TCollisionComponent2
{
public:
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,
TEdgeSegment* edge) override;
void NextFrame();

View File

@ -6,7 +6,7 @@
#include "loader.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{};
@ -18,24 +18,25 @@ TGate::TGate(TPinballTable* table, int groupIndex) : TCollisionComponent(table,
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)
{
ActiveFlag = 0;
render::sprite_set_bitmap(RenderSprite, nullptr);
loader::play_sound(SoundIndex3, this, "TGate1");
}
else if (code == 54 || code == 1024)
{
ActiveFlag = 1;
render::sprite_set_bitmap(RenderSprite, ListBitmap->at(0));
if (code == 54)
loader::play_sound(SoundIndex4, this, "TGate2");
}
control::handler(code, this);
case MessageCode::TGateDisable:
ActiveFlag = 0;
render::sprite_set_bitmap(RenderSprite, nullptr);
loader::play_sound(SoundIndex3, this, "TGate1");
break;
case MessageCode::Reset:
case MessageCode::TGateEnable:
ActiveFlag = 1;
render::sprite_set_bitmap(RenderSprite, ListBitmap->at(0));
if (code == MessageCode::TGateEnable)
loader::play_sound(SoundIndex4, this, "TGate2");
break;
default: break;
}
control::handler(~code, this);
return 0;
}

View File

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

View File

@ -10,7 +10,7 @@
#include "TPinballTable.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{};
circle_type circle{};
@ -57,9 +57,9 @@ THole::THole(TPinballTable* table, int groupIndex) : TCollisionComponent(table,
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)
timer::kill(Timer);

View File

@ -4,11 +4,11 @@
#include "TEdgeManager.h"
class THole :
public TCollisionComponent
public TCollisionComponent2
{
public:
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,
TEdgeSegment* edge) override;
int FieldEffect(TBall* ball, vector2* vecDst) override;

View File

@ -9,7 +9,7 @@
#include "timer.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;
Timer = 0;
@ -19,9 +19,9 @@ TKickback::TKickback(TPinballTable* table, int groupIndex): TCollisionComponent(
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);
if (ListBitmap)

View File

@ -2,11 +2,11 @@
#include "TCollisionComponent.h"
class TKickback :
public TCollisionComponent
public TCollisionComponent2
{
public:
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,
TEdgeSegment* edge) override;

View File

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

View File

@ -4,11 +4,11 @@
#include "TEdgeManager.h"
class TKickout :
public TCollisionComponent
public TCollisionComponent2
{
public:
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,
TEdgeSegment* edge) override;
int FieldEffect(TBall* ball, vector2* vecDst) override;
@ -16,7 +16,7 @@ public:
static void TimerExpired(int timerId, void* caller);
static void ResetTimerExpired(int timerId, void* caller);
int KickFlag1;
int BallCaputeredFlag;
int NotSomeFlag;
int Timer;
float TimerTime1;

View File

@ -19,9 +19,9 @@ TLightRollover::TLightRollover(TPinballTable* table, int groupIndex) : TRollover
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;
RolloverFlag = 0;

View File

@ -7,7 +7,7 @@ class TLightRollover :
public:
TLightRollover(TPinballTable* table, int groupIndex);
~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,
TEdgeSegment* edge) override;

View File

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

View File

@ -13,7 +13,7 @@ enum class MessageCode
// Private codes <1000, different meaning for each component
TFlipperExtend = 1,
TFlipperRetract = 2,
TLightTurnOff = 0,
TLightTurnOn = 1,
TLightGetLightOnFlag = 2,
@ -65,6 +65,32 @@ enum class MessageCode
TLightGroupToggleSplitIndex = 45,
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
LeftFlipperInputPressed = 1000,
LeftFlipperInputReleased = 1001,
@ -76,7 +102,7 @@ enum class MessageCode
Resume = 1009,
LooseFocus = 1010,
SetTiltLock = 1011,
ResetTiltLock = 1012,
ClearTiltLock = 1012,
StartGamePlayer1 = 1013,
NewGame = 1014,
PlungerFeedBall = 1015,

View File

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

View File

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

View File

@ -2,11 +2,11 @@
#include "TCollisionComponent.h"
class TPopupTarget :
public TCollisionComponent
public TCollisionComponent2
{
public:
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,
TEdgeSegment* edge) override;

View File

@ -11,13 +11,13 @@
#include "timer.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)
{
}
TRollover::TRollover(TPinballTable* table, int groupIndex) : TCollisionComponent(table, groupIndex, false)
TRollover::TRollover(TPinballTable* table, int groupIndex) : TCollisionComponent2(table, groupIndex, false)
{
if (ListBitmap)
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->RolloverFlag = 0;

View File

@ -2,14 +2,14 @@
#include "TCollisionComponent.h"
class TRollover :
public TCollisionComponent
public TCollisionComponent2
{
protected:
TRollover(TPinballTable* table, int groupIndex, bool createWall);
public:
TRollover(TPinballTable* table, int groupIndex);
~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,
TEdgeSegment* edge) override;
void build_walls(int groupIndex);

View File

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

View File

@ -3,11 +3,11 @@
#include "TCollisionComponent.h"
class TSink :
public TCollisionComponent
public TCollisionComponent2
{
public:
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,
TEdgeSegment* edge) override;

View File

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

View File

@ -2,11 +2,11 @@
#include "TCollisionComponent.h"
class TSoloTarget :
public TCollisionComponent
public TCollisionComponent2
{
public:
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,
TEdgeSegment* edge) override;

View File

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

View File

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

View File

@ -4,26 +4,30 @@
#include "control.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;
}
int TTimer::Message(int code, float value)
int TTimer::Message2(MessageCode code, float value)
{
if (code == 59)
switch (code)
{
case MessageCode::TTimerResetTimer:
if (Timer)
timer::kill(Timer);
Timer = timer::set(value, this, TimerExpired);
}
else if (code == 1011 || code == 1022 || code == 1024)
{
break;
case MessageCode::SetTiltLock:
case MessageCode::GameOver:
case MessageCode::Reset:
if (Timer)
{
timer::kill(Timer);
Timer = 0;
}
break;
default: break;
}
return 0;
}

View File

@ -2,11 +2,11 @@
#include "TPinballComponent.h"
class TTimer :
public TPinballComponent
public TPinballComponent2
{
public:
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);
int Timer;

View File

@ -6,7 +6,7 @@
#include "render.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)
render::sprite_set_bitmap(RenderSprite, nullptr);
@ -14,9 +14,9 @@ TWall::TWall(TPinballTable* table, int groupIndex) : TCollisionComponent(table,
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);
TimerExpired(Timer, this);

View File

@ -5,11 +5,11 @@
struct gdrv_bitmap8;
class TWall :
public TCollisionComponent
public TCollisionComponent2
{
public:
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,
TEdgeSegment* edge) override;

View File

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