1
0
mirror of https://github.com/k4zmu2a/SpaceCadetPinball.git synced 2024-11-22 10:42:38 +01:00

Message code enum part 4: finalized transition of Message to enum class.

This commit is contained in:
Muzychenko Andrey 2022-09-06 16:57:56 +03:00
parent e80010e3c6
commit dfe1665ba1
55 changed files with 751 additions and 792 deletions

View File

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

View File

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

View File

@ -7,7 +7,7 @@
#include "render.h"
#include "timer.h"
TBlocker::TBlocker(TPinballTable* table, int groupIndex) : TCollisionComponent2(table, groupIndex, true)
TBlocker::TBlocker(TPinballTable* table, int groupIndex) : TCollisionComponent(table, groupIndex, true)
{
visualStruct visual{};
@ -23,7 +23,7 @@ TBlocker::TBlocker(TPinballTable* table, int groupIndex) : TCollisionComponent2(
render::sprite_set_bitmap(RenderSprite, nullptr);
}
int TBlocker::Message2(MessageCode code, float value)
int TBlocker::Message(MessageCode code, float value)
{
switch (code)
{

View File

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

View File

@ -8,7 +8,7 @@
#include "timer.h"
#include "TPinballTable.h"
TBumper::TBumper(TPinballTable* table, int groupIndex) : TCollisionComponent2(table, groupIndex, true)
TBumper::TBumper(TPinballTable* table, int groupIndex) : TCollisionComponent(table, groupIndex, true)
{
visualStruct visual{};
@ -21,7 +21,7 @@ TBumper::TBumper(TPinballTable* table, int groupIndex) : TCollisionComponent2(ta
OriginalThreshold = Threshold;
}
int TBumper::Message2(MessageCode code, float value)
int TBumper::Message(MessageCode code, float value)
{
switch (code)
{
@ -51,7 +51,7 @@ int TBumper::Message2(MessageCode code, float value)
auto maxBmp = static_cast<int>(ListBitmap->size()) - 1;
if (2 * nextBmp > maxBmp)
nextBmp = maxBmp / 2;
TBumper::Message2(MessageCode::TBumperSetBmpIndex, static_cast<float>(nextBmp));
TBumper::Message(MessageCode::TBumperSetBmpIndex, static_cast<float>(nextBmp));
break;
}
case MessageCode::TBumperDecBmpIndex:
@ -59,7 +59,7 @@ int TBumper::Message2(MessageCode code, float value)
auto nextBmp = BmpIndex - 1;
if (nextBmp < 0)
nextBmp = 0;
TBumper::Message2(MessageCode::TBumperSetBmpIndex, static_cast<float>(nextBmp));
TBumper::Message(MessageCode::TBumperSetBmpIndex, static_cast<float>(nextBmp));
break;
}
case MessageCode::PlayerChanged:
@ -71,7 +71,7 @@ int TBumper::Message2(MessageCode code, float value)
playerPtr = &PlayerData[static_cast<int>(floor(value))];
BmpIndex = playerPtr->BmpIndex;
MessageField = playerPtr->MessageField;
TBumper::Message2(MessageCode::TBumperSetBmpIndex, static_cast<float>(BmpIndex));
TBumper::Message(MessageCode::TBumperSetBmpIndex, static_cast<float>(BmpIndex));
break;
}
case MessageCode::Reset:

View File

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

View File

@ -24,18 +24,3 @@ public:
virtual int FieldEffect(TBall* ball, vector2* vecDst);
bool DefaultCollision(TBall* ball, vector2* nextPosition, vector2* direction);
};
class TCollisionComponent2 : public TCollisionComponent
{
public:
TCollisionComponent2(TPinballTable* table, int group_index, bool create_wall)
: TCollisionComponent(table, group_index, create_wall)
{
}
DEPRECATED int Message(int code, float value) override
{
return Message2(static_cast<MessageCode>(code), value);
}
};

View File

@ -7,7 +7,7 @@
#include "timer.h"
#include "TPinballTable.h"
TComponentGroup::TComponentGroup(TPinballTable* table, int groupIndex) : TPinballComponent2(table, groupIndex, false)
TComponentGroup::TComponentGroup(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, false)
{
Timer = 0;
if (groupIndex > 0)
@ -33,7 +33,7 @@ TComponentGroup::~TComponentGroup()
}
}
int TComponentGroup::Message2(MessageCode code, float value)
int TComponentGroup::Message(MessageCode code, float value)
{
if (code == MessageCode::TComponentGroupResetNotifyTimer)
{
@ -50,7 +50,7 @@ int TComponentGroup::Message2(MessageCode code, float value)
{
for (auto component : List)
{
component->Message2(code, value);
component->Message(code, value);
}
}
return 0;

View File

@ -3,12 +3,12 @@
class TComponentGroup :
public TPinballComponent2
public TPinballComponent
{
public:
TComponentGroup(TPinballTable* table, int groupIndex);
~TComponentGroup() override;
int Message2(MessageCode code, float value) override;
int Message(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)
: TCollisionComponent2(table, groupIndex, false)
: TCollisionComponent(table, groupIndex, false)
{
visualStruct visual{};
@ -56,7 +56,7 @@ TDemo::TDemo(TPinballTable* table, int groupIndex)
Edge3 = TEdgeSegment::install_wall(v9, this, &ActiveFlag, visual.CollisionGroup, table->CollisionCompOffset, 1404);
}
int TDemo::Message2(MessageCode code, float value)
int TDemo::Message(MessageCode code, float value)
{
switch (code)
{
@ -125,7 +125,7 @@ void TDemo::Collision(TBall* ball, vector2* nextPosition, vector2* direction, fl
case 1404:
if (!PlungerFlag)
{
PinballTable->Message2(MessageCode::PlungerInputPressed, ball->TimeNow);
PinballTable->Message(MessageCode::PlungerInputPressed, ball->TimeNow);
float time = RandFloat() + 2.0f;
PlungerFlag = timer::set(time, this, PlungerRelease);
}
@ -139,14 +139,14 @@ void TDemo::PlungerRelease(int timerId, void* caller)
{
auto demo = static_cast<TDemo*>(caller);
demo->PlungerFlag = 0;
demo->PinballTable->Message2(MessageCode::PlungerInputReleased, pb::time_next);
demo->PinballTable->Message(MessageCode::PlungerInputReleased, pb::time_next);
}
void TDemo::UnFlipRight(int timerId, void* caller)
{
auto demo = static_cast<TDemo*>(caller);
if (demo->FlipRightFlag)
demo->PinballTable->Message2(MessageCode::RightFlipperInputReleased, pb::time_next);
demo->PinballTable->Message(MessageCode::RightFlipperInputReleased, pb::time_next);
demo->FlipRightFlag = 0;
}
@ -154,7 +154,7 @@ void TDemo::UnFlipLeft(int timerId, void* caller)
{
auto demo = static_cast<TDemo*>(caller);
if (demo->FlipLeftFlag)
demo->PinballTable->Message2(MessageCode::LeftFlipperInputReleased, pb::time_next);
demo->PinballTable->Message(MessageCode::LeftFlipperInputReleased, pb::time_next);
demo->FlipLeftFlag = 0;
}
@ -168,7 +168,7 @@ void TDemo::FlipRight(int timerId, void* caller)
timer::kill(demo->FlipRightTimer);
demo->FlipRightTimer = 0;
}
demo->PinballTable->Message2(MessageCode::RightFlipperInputPressed, pb::time_next);
demo->PinballTable->Message(MessageCode::RightFlipperInputPressed, pb::time_next);
demo->FlipRightFlag = 1;
float time = demo->UnFlipTimerTime1 + demo->UnFlipTimerTime2 - RandFloat() *
(demo->UnFlipTimerTime2 + demo->UnFlipTimerTime2);
@ -186,7 +186,7 @@ void TDemo::FlipLeft(int timerId, void* caller)
timer::kill(demo->FlipLeftTimer);
demo->FlipLeftTimer = 0;
}
demo->PinballTable->Message2(MessageCode::LeftFlipperInputPressed, pb::time_next);
demo->PinballTable->Message(MessageCode::LeftFlipperInputPressed, pb::time_next);
demo->FlipLeftFlag = 1;
float time = demo->UnFlipTimerTime1 + demo->UnFlipTimerTime2 - RandFloat() *
(demo->UnFlipTimerTime2 + demo->UnFlipTimerTime2);
@ -198,6 +198,6 @@ void TDemo::NewGameRestartTimer(int timerId, void* caller)
{
auto demo = static_cast<TDemo*>(caller);
pb::replay_level(true);
demo->PinballTable->Message2(MessageCode::NewGame, static_cast<float>(demo->PinballTable->PlayerCount));
demo->PinballTable->Message(MessageCode::NewGame, static_cast<float>(demo->PinballTable->PlayerCount));
demo->RestartGameTimer = 0;
}

View File

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

View File

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

View File

@ -2,11 +2,11 @@
#include "TCollisionComponent.h"
class TDrain :
public TCollisionComponent2
public TCollisionComponent
{
public:
TDrain(TPinballTable* table, int groupIndex);
int Message2(MessageCode code, float value) override;
int Message(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) : TCollisionComponent2(table, groupIndex, false)
TFlagSpinner::TFlagSpinner(TPinballTable* table, int groupIndex) : TCollisionComponent(table, groupIndex, false)
{
visualStruct visual{};
vector2 end{}, start{};
@ -50,7 +50,7 @@ TFlagSpinner::TFlagSpinner(TPinballTable* table, int groupIndex) : TCollisionCom
MinSpeed = *minSpeed;
}
int TFlagSpinner::Message2(MessageCode code, float value)
int TFlagSpinner::Message(MessageCode code, float value)
{
if (code == MessageCode::Reset)
{

View File

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

View File

@ -10,7 +10,7 @@
#include "timer.h"
#include "TPinballTable.h"
TFlipper::TFlipper(TPinballTable* table, int groupIndex) : TCollisionComponent2(table, groupIndex, false)
TFlipper::TFlipper(TPinballTable* table, int groupIndex) : TCollisionComponent(table, groupIndex, false)
{
visualStruct visual{};
@ -58,7 +58,7 @@ TFlipper::~TFlipper()
}
}
int TFlipper::Message2(MessageCode code, float value)
int TFlipper::Message(MessageCode code, float value)
{
switch (code)
{

View File

@ -4,12 +4,12 @@
class TFlipperEdge;
class TFlipper :
public TCollisionComponent2
public TCollisionComponent
{
public:
TFlipper(TPinballTable* table, int groupIndex);
~TFlipper() override;
int Message2(MessageCode code, float value) override;
int Message(MessageCode code, float value) override;
void port_draw() override;
void Collision(TBall* ball, vector2* nextPosition, vector2* direction, float distance,
TEdgeSegment* edge) override;

View File

@ -6,7 +6,7 @@
#include "loader.h"
#include "render.h"
TGate::TGate(TPinballTable* table, int groupIndex) : TCollisionComponent2(table, groupIndex, true)
TGate::TGate(TPinballTable* table, int groupIndex) : TCollisionComponent(table, groupIndex, true)
{
visualStruct visual{};
@ -18,7 +18,7 @@ TGate::TGate(TPinballTable* table, int groupIndex) : TCollisionComponent2(table,
control::handler(1024, this);
}
int TGate::Message2(MessageCode code, float value)
int TGate::Message(MessageCode code, float value)
{
switch (code)
{

View File

@ -2,11 +2,11 @@
#include "TCollisionComponent.h"
class TGate :
public TCollisionComponent2
public TCollisionComponent
{
public:
TGate(TPinballTable* table, int groupIndex);
int Message2(MessageCode code, float value) override;
int Message(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) : TCollisionComponent2(table, groupIndex, false)
THole::THole(TPinballTable* table, int groupIndex) : TCollisionComponent(table, groupIndex, false)
{
visualStruct visual{};
circle_type circle{};
@ -57,7 +57,7 @@ THole::THole(TPinballTable* table, int groupIndex) : TCollisionComponent2(table,
TTableLayer::edges_insert_circle(&circle, nullptr, &Field);
}
int THole::Message2(MessageCode code, float value)
int THole::Message(MessageCode code, float value)
{
if (code == MessageCode::Reset && BallCapturedFlag)
{

View File

@ -4,11 +4,11 @@
#include "TEdgeManager.h"
class THole :
public TCollisionComponent2
public TCollisionComponent
{
public:
THole(TPinballTable* table, int groupIndex);
int Message2(MessageCode code, float value) override;
int Message(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): TCollisionComponent2(table, groupIndex, true)
TKickback::TKickback(TPinballTable* table, int groupIndex): TCollisionComponent(table, groupIndex, true)
{
MessageField = 0;
Timer = 0;
@ -19,7 +19,7 @@ TKickback::TKickback(TPinballTable* table, int groupIndex): TCollisionComponent2
Threshold = 1000000000.0f;
}
int TKickback::Message2(MessageCode code, float value)
int TKickback::Message(MessageCode code, float value)
{
if ((code == MessageCode::SetTiltLock || code == MessageCode::Reset) && Timer)
{

View File

@ -2,11 +2,11 @@
#include "TCollisionComponent.h"
class TKickback :
public TCollisionComponent2
public TCollisionComponent
{
public:
TKickback(TPinballTable* table, int groupIndex);
int Message2(MessageCode code, float value) override;
int Message(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): TCollisionComponent2(
TKickout::TKickout(TPinballTable* table, int groupIndex, bool someFlag): TCollisionComponent(
table, groupIndex, false)
{
visualStruct visual{};
@ -60,7 +60,7 @@ TKickout::TKickout(TPinballTable* table, int groupIndex, bool someFlag): TCollis
TTableLayer::edges_insert_circle(&circle, nullptr, &Field);
}
int TKickout::Message2(MessageCode code, float value)
int TKickout::Message(MessageCode code, float value)
{
switch (code)
{
@ -107,7 +107,7 @@ void TKickout::Collision(TBall* ball, vector2* nextPosition, vector2* direction,
ball->Position.Z = CollisionBallSetZ;
if (PinballTable->TiltLockFlag)
{
Message2(MessageCode::TKickoutRestartTimer, 0.1f);
Message(MessageCode::TKickoutRestartTimer, 0.1f);
}
else
{

View File

@ -4,11 +4,11 @@
#include "TEdgeManager.h"
class TKickout :
public TCollisionComponent2
public TCollisionComponent
{
public:
TKickout(TPinballTable* table, int groupIndex, bool someFlag);
int Message2(MessageCode code, float value) override;
int Message(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

@ -8,7 +8,7 @@
#include "timer.h"
#include "TPinballTable.h"
TLight::TLight(TPinballTable* table, int groupIndex) : TPinballComponent2(table, groupIndex, true)
TLight::TLight(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, true)
{
TimeoutTimer = 0;
FlasherOnFlag = false;
@ -23,7 +23,7 @@ TLight::TLight(TPinballTable* table, int groupIndex) : TPinballComponent2(table,
SourceDelay[1] = *floatArr2;
}
int TLight::Message2(MessageCode code, float value)
int TLight::Message(MessageCode code, float value)
{
int bmpIndex;
@ -57,12 +57,12 @@ int TLight::Message2(MessageCode code, float value)
MessageField = playerPtr->MessageField;
if (LightOnBmpIndex)
{
Message2(MessageCode::TLightSetOnStateBmpIndex, static_cast<float>(LightOnBmpIndex));
Message(MessageCode::TLightSetOnStateBmpIndex, static_cast<float>(LightOnBmpIndex));
}
if (LightOnFlag)
Message2(MessageCode::TLightTurnOn, 0.0);
Message(MessageCode::TLightTurnOn, 0.0);
if (FlasherOnFlag)
Message2(MessageCode::TLightFlasherStart, 0.0);
Message(MessageCode::TLightFlasherStart, 0.0);
break;
}
case MessageCode::TLightTurnOff:
@ -164,13 +164,13 @@ int TLight::Message2(MessageCode code, float value)
bmpIndex = LightOnBmpIndex + 1;
if (bmpIndex >= static_cast<int>(ListBitmap->size()))
bmpIndex = static_cast<int>(ListBitmap->size()) - 1;
Message2(MessageCode::TLightSetOnStateBmpIndex, static_cast<float>(bmpIndex));
Message(MessageCode::TLightSetOnStateBmpIndex, static_cast<float>(bmpIndex));
break;
case MessageCode::TLightDecOnStateBmpIndex:
bmpIndex = LightOnBmpIndex - 1;
if (bmpIndex < 0)
bmpIndex = 0;
Message2(MessageCode::TLightSetOnStateBmpIndex, static_cast<float>(bmpIndex));
Message(MessageCode::TLightSetOnStateBmpIndex, static_cast<float>(bmpIndex));
break;
case MessageCode::TLightResetTimed:
if (TimeoutTimer)
@ -188,36 +188,36 @@ int TLight::Message2(MessageCode code, float value)
if (UndoOverrideTimer)
timer::kill(UndoOverrideTimer);
UndoOverrideTimer = 0;
Message2(MessageCode::TLightTurnOn, 0.0);
Message2(MessageCode::TLightFlasherStartTimed, value);
Message(MessageCode::TLightTurnOn, 0.0);
Message(MessageCode::TLightFlasherStartTimed, value);
break;
case MessageCode::TLightFlasherStartTimedThenStayOff:
if (UndoOverrideTimer)
timer::kill(UndoOverrideTimer);
UndoOverrideTimer = 0;
Message2(MessageCode::TLightFlasherStartTimed, value);
Message(MessageCode::TLightFlasherStartTimed, value);
TurnOffAfterFlashingFg = true;
break;
case MessageCode::TLightToggleValue:
Message2(static_cast<int>(floor(value)) ? MessageCode::TLightTurnOn : MessageCode::TLightTurnOff, 0.0);
Message(static_cast<int>(floor(value)) ? MessageCode::TLightTurnOn : MessageCode::TLightTurnOff, 0.0);
return LightOnFlag;
case MessageCode::TLightResetAndToggleValue:
Message2(MessageCode::TLightToggleValue, value);
Message2(MessageCode::TLightResetTimed, 0.0);
Message(MessageCode::TLightToggleValue, value);
Message(MessageCode::TLightResetTimed, 0.0);
return LightOnFlag;
case MessageCode::TLightResetAndTurnOn:
Message2(MessageCode::TLightTurnOn, 0.0);
Message2(MessageCode::TLightResetTimed, 0.0);
Message(MessageCode::TLightTurnOn, 0.0);
Message(MessageCode::TLightResetTimed, 0.0);
break;
case MessageCode::TLightResetAndTurnOff:
Message2(MessageCode::TLightTurnOff, 0.0);
Message2(MessageCode::TLightResetTimed, 0.0);
Message(MessageCode::TLightTurnOff, 0.0);
Message(MessageCode::TLightResetTimed, 0.0);
break;
case MessageCode::TLightToggle:
Message2(MessageCode::TLightToggleValue, !LightOnFlag);
Message(MessageCode::TLightToggleValue, !LightOnFlag);
return LightOnFlag;
case MessageCode::TLightResetAndToggle:
Message2(MessageCode::TLightResetAndToggleValue, !LightOnFlag);
Message(MessageCode::TLightResetAndToggleValue, !LightOnFlag);
return LightOnFlag;
case MessageCode::TLightSetMessageField:
MessageField = static_cast<int>(floor(value));
@ -298,7 +298,7 @@ void TLight::TimerExpired(int timerId, void* caller)
if (light->TurnOffAfterFlashingFg)
{
light->TurnOffAfterFlashingFg = false;
light->Message2(MessageCode::TLightResetAndTurnOff, 0.0);
light->Message(MessageCode::TLightResetAndTurnOff, 0.0);
}
if (light->Control)
control::handler(60, light);
@ -341,5 +341,5 @@ void TLight::flasher_callback(int timerId, void* caller)
void TLight::UndoTmpOverride(int timerId, void* caller)
{
auto light = static_cast<TLight*>(caller);
light->Message2(MessageCode::TLightFtResetOverride, 0.0f);
light->Message(MessageCode::TLightFtResetOverride, 0.0f);
}

View File

@ -13,11 +13,11 @@ struct TLight_player_backup
class TLight :
public TPinballComponent2
public TPinballComponent
{
public:
TLight(TPinballTable* table, int groupIndex);
int Message2(MessageCode code, float value) override;
int Message(MessageCode code, float value) override;
void Reset();
void schedule_timeout(float time);
void flasher_stop(int bmpIndex);

View File

@ -32,7 +32,7 @@ TLightBargraph::~TLightBargraph()
delete[] TimerTimeArray;
}
int TLightBargraph::Message2(MessageCode code, float value)
int TLightBargraph::Message(MessageCode code, float value)
{
switch (code)
{
@ -51,16 +51,16 @@ int TLightBargraph::Message2(MessageCode code, float value)
timeIndex = maxCount - 1;
if (timeIndex >= 0)
{
TLightGroup::Message2(MessageCode::TLightGroupToggleSplitIndex, static_cast<float>(timeIndex / 2));
TLightGroup::Message(MessageCode::TLightGroupToggleSplitIndex, static_cast<float>(timeIndex / 2));
if (!(timeIndex & 1))
TLightGroup::Message2(MessageCode::TLightGroupStartFlasher, 0.0);
TLightGroup::Message(MessageCode::TLightGroupStartFlasher, 0.0);
if (TimerTimeArray)
TimerBargraph = timer::set(TimerTimeArray[timeIndex], this, BargraphTimerExpired);
TimeIndex = timeIndex;
}
else
{
TLightGroup::Message2(MessageCode::TLightResetAndTurnOff, 0.0);
TLightGroup::Message(MessageCode::TLightResetAndTurnOff, 0.0);
TimeIndex = 0;
}
break;
@ -79,7 +79,7 @@ int TLightBargraph::Message2(MessageCode code, float value)
TimeIndex = PlayerTimerIndexBackup[static_cast<int>(floor(value))];
if (TimeIndex)
{
TLightBargraph::Message2(MessageCode::TLightGroupToggleSplitIndex, static_cast<float>(TimeIndex));
TLightBargraph::Message(MessageCode::TLightGroupToggleSplitIndex, static_cast<float>(TimeIndex));
}
break;
case MessageCode::Reset:
@ -92,11 +92,11 @@ int TLightBargraph::Message2(MessageCode code, float value)
++playerPtr;
}
TLightGroup::Message2(MessageCode::Reset, value);
TLightGroup::Message(MessageCode::Reset, value);
break;
}
default:
TLightGroup::Message2(code, value);
TLightGroup::Message(code, value);
break;
}
return 0;
@ -119,12 +119,12 @@ void TLightBargraph::BargraphTimerExpired(int timerId, void* caller)
bar->TimerBargraph = 0;
if (bar->TimeIndex)
{
bar->Message2(MessageCode::TLightGroupToggleSplitIndex, static_cast<float>(bar->TimeIndex - 1));
bar->Message(MessageCode::TLightGroupToggleSplitIndex, static_cast<float>(bar->TimeIndex - 1));
control::handler(60, bar);
}
else
{
bar->Message2(MessageCode::TLightResetAndTurnOff, 0.0);
bar->Message(MessageCode::TLightResetAndTurnOff, 0.0);
control::handler(47, bar);
}
}

View File

@ -7,7 +7,7 @@ class TLightBargraph :
public:
TLightBargraph(TPinballTable* table, int groupIndex);
~TLightBargraph() override;
int Message2(MessageCode code, float value) override;
int Message(MessageCode code, float value) override;
void Reset() override;
static void BargraphTimerExpired(int timerId, void* caller);

View File

@ -8,7 +8,7 @@
#include "TLight.h"
#include "TPinballTable.h"
TLightGroup::TLightGroup(TPinballTable* table, int groupIndex) : TPinballComponent2(table, groupIndex, false)
TLightGroup::TLightGroup(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, false)
{
Timer = 0;
NotifyTimer = 0;
@ -28,7 +28,7 @@ TLightGroup::TLightGroup(TPinballTable* table, int groupIndex) : TPinballCompone
}
}
int TLightGroup::Message2(MessageCode code, float value)
int TLightGroup::Message(MessageCode code, float value)
{
auto const count = static_cast<int>(List.size());
switch (code)
@ -70,7 +70,7 @@ int TLightGroup::Message2(MessageCode code, float value)
break;
if (MessageField2 != MessageCode::TLightGroupNull)
{
TLightGroup::Message2(MessageCode::TLightGroupReset, 0.0);
TLightGroup::Message(MessageCode::TLightGroupReset, 0.0);
}
AnimationFlag = 1;
MessageField2 = code;
@ -80,11 +80,11 @@ int TLightGroup::Message2(MessageCode code, float value)
{
auto lightCur = List.at(index);
auto lightPrev = List.at(index - 1);
lightCur->Message2(lightPrev->LightOnFlag ? MessageCode::TLightTurnOn : MessageCode::TLightTurnOff, 0.0);
lightCur->Message(lightPrev->LightOnFlag ? MessageCode::TLightTurnOn : MessageCode::TLightTurnOff, 0.0);
lightCur->MessageField = lightPrev->MessageField;
}
auto firstLight = List.at(0);
firstLight->Message2(lastStatus ? MessageCode::TLightTurnOn : MessageCode::TLightTurnOff, 0.0);
firstLight->Message(lastStatus ? MessageCode::TLightTurnOn : MessageCode::TLightTurnOff, 0.0);
firstLight->MessageField = lastMessage;
reschedule_animation(value);
break;
@ -96,7 +96,7 @@ int TLightGroup::Message2(MessageCode code, float value)
break;
if (MessageField2 != MessageCode::TLightGroupNull)
{
TLightGroup::Message2(MessageCode::TLightGroupReset, 0.0);
TLightGroup::Message(MessageCode::TLightGroupReset, 0.0);
}
auto firstLight = List.at(0);
AnimationFlag = 1;
@ -107,10 +107,10 @@ int TLightGroup::Message2(MessageCode code, float value)
{
auto lightCur = List.at(index);
auto lightNext = List.at(index + 1);
lightCur->Message2(lightNext->LightOnFlag ? MessageCode::TLightTurnOn : MessageCode::TLightTurnOff, 0.0);
lightCur->Message(lightNext->LightOnFlag ? MessageCode::TLightTurnOn : MessageCode::TLightTurnOff, 0.0);
lightCur->MessageField = lightNext->MessageField;
}
lastLight->Message2(firstStatus ? MessageCode::TLightTurnOn : MessageCode::TLightTurnOff, 0.0);
lastLight->Message(firstStatus ? MessageCode::TLightTurnOn : MessageCode::TLightTurnOff, 0.0);
lastLight->MessageField = firstMessage;
reschedule_animation(value);
break;
@ -127,10 +127,10 @@ int TLightGroup::Message2(MessageCode code, float value)
{
auto lightCur = List.at(i);
auto lightPrev = List.at(i - 1);
lightCur->Message2(lightPrev->ToggledOnFlag ? MessageCode::TLightTurnOnTimed : MessageCode::TLightTurnOffTimed, 0.0);
lightCur->Message(lightPrev->ToggledOnFlag ? MessageCode::TLightTurnOnTimed : MessageCode::TLightTurnOffTimed, 0.0);
}
auto firstLight = List.at(0);
firstLight->Message2(lastStatus ? MessageCode::TLightTurnOnTimed : MessageCode::TLightTurnOffTimed, 0);
firstLight->Message(lastStatus ? MessageCode::TLightTurnOnTimed : MessageCode::TLightTurnOffTimed, 0);
reschedule_animation(value);
break;
}
@ -146,10 +146,10 @@ int TLightGroup::Message2(MessageCode code, float value)
{
auto lightCur = List.at(i);
auto lightNext = List.at(i + 1);
lightCur->Message2(lightNext->ToggledOnFlag ? MessageCode::TLightTurnOnTimed : MessageCode::TLightTurnOffTimed, 0.0);
lightCur->Message(lightNext->ToggledOnFlag ? MessageCode::TLightTurnOnTimed : MessageCode::TLightTurnOffTimed, 0.0);
}
auto lastLight = List.at(count - 1);
lastLight->Message2(firstStatus ? MessageCode::TLightTurnOnTimed : MessageCode::TLightTurnOffTimed, 0);
lastLight->Message(firstStatus ? MessageCode::TLightTurnOnTimed : MessageCode::TLightTurnOffTimed, 0);
reschedule_animation(value);
break;
}
@ -164,7 +164,7 @@ int TLightGroup::Message2(MessageCode code, float value)
if (rand() % 100 > 70)
{
auto randVal = RandFloat() * value * 3.0f + 0.1f;
light->Message2(MessageCode::TLightTurnOnTimed, randVal);
light->Message(MessageCode::TLightTurnOnTimed, randVal);
}
}
reschedule_animation(value);
@ -179,7 +179,7 @@ int TLightGroup::Message2(MessageCode code, float value)
for (auto light : List)
{
auto randVal = static_cast<float>(rand() % 100 > 70);
light->Message2(MessageCode::TLightResetAndToggleValue, randVal);
light->Message(MessageCode::TLightResetAndToggleValue, randVal);
}
reschedule_animation(value);
break;
@ -201,7 +201,7 @@ int TLightGroup::Message2(MessageCode code, float value)
auto light = *it;
if (!light->LightOnFlag && randModCount-- == 0)
{
light->Message2(MessageCode::TLightTurnOn, 0.0);
light->Message(MessageCode::TLightTurnOn, 0.0);
break;
}
}
@ -227,7 +227,7 @@ int TLightGroup::Message2(MessageCode code, float value)
auto light = *it;
if (light->LightOnFlag && randModCount-- == 0)
{
light->Message2(MessageCode::TLightTurnOff, 0.0);
light->Message(MessageCode::TLightTurnOff, 0.0);
break;
}
}
@ -241,7 +241,7 @@ int TLightGroup::Message2(MessageCode code, float value)
auto index = next_light_up();
if (index < 0)
break;
List.at(index)->Message2(MessageCode::TLightTurnOn, 0.0);
List.at(index)->Message(MessageCode::TLightTurnOn, 0.0);
if (MessageField2 != MessageCode::TLightGroupNull)
start_animation();
return 1;
@ -251,7 +251,7 @@ int TLightGroup::Message2(MessageCode code, float value)
auto index = next_light_down();
if (index < 0)
break;
List.at(index)->Message2(MessageCode::TLightTurnOff, 0.0);
List.at(index)->Message(MessageCode::TLightTurnOff, 0.0);
if (MessageField2 != MessageCode::TLightGroupNull)
start_animation();
return 1;
@ -263,7 +263,7 @@ int TLightGroup::Message2(MessageCode code, float value)
Timer = 0;
if (MessageField2 == MessageCode::TLightGroupAnimationBackward ||
MessageField2 == MessageCode::TLightGroupAnimationForward || MessageField2 == MessageCode::TLightGroupLightShowAnimation)
TLightGroup::Message2(MessageCode::TLightResetTimed, 0.0);
TLightGroup::Message(MessageCode::TLightResetTimed, 0.0);
MessageField2 = MessageCode::TLightGroupNull;
AnimationFlag = 0;
break;
@ -275,7 +275,7 @@ int TLightGroup::Message2(MessageCode code, float value)
break;
auto light = List.at(index);
light->Message2(MessageCode::TLightTurnOn, 0.0);
light->Message(MessageCode::TLightTurnOn, 0.0);
if (MessageField2 != MessageCode::TLightGroupNull)
start_animation();
break;
@ -287,7 +287,7 @@ int TLightGroup::Message2(MessageCode code, float value)
break;
auto light = List.at(index);
light->Message2(MessageCode::TLightTurnOff, 0.0);
light->Message(MessageCode::TLightTurnOff, 0.0);
if (MessageField2 != MessageCode::TLightGroupNull)
start_animation();
break;
@ -314,8 +314,8 @@ int TLightGroup::Message2(MessageCode code, float value)
if (index < 0)
break;
if (MessageField2 != MessageCode::TLightGroupNull || AnimationFlag)
TLightGroup::Message2(MessageCode::TLightGroupReset, 0.0);
List.at(index)->Message2(MessageCode::TLightFlasherStartTimedThenStayOn, value);
TLightGroup::Message(MessageCode::TLightGroupReset, 0.0);
List.at(index)->Message(MessageCode::TLightFlasherStartTimedThenStayOn, value);
return 1;
}
case MessageCode::TLightGroupResetAndTurnOff:
@ -324,8 +324,8 @@ int TLightGroup::Message2(MessageCode code, float value)
if (index < 0)
break;
if (MessageField2 != MessageCode::TLightGroupNull || AnimationFlag)
TLightGroup::Message2(MessageCode::TLightGroupReset, 0.0);
List.at(index)->Message2(MessageCode::TLightFlasherStartTimedThenStayOff, value);
TLightGroup::Message(MessageCode::TLightGroupReset, 0.0);
List.at(index)->Message(MessageCode::TLightFlasherStartTimedThenStayOff, value);
return 1;
}
case MessageCode::TLightGroupRestartNotifyTimer:
@ -342,8 +342,8 @@ int TLightGroup::Message2(MessageCode code, float value)
auto light = *it;
if (light->LightOnFlag)
{
light->Message2(MessageCode::TLightTurnOff, 0.0);
light->Message2(MessageCode::TLightFlasherStartTimedThenStayOff, value);
light->Message(MessageCode::TLightTurnOff, 0.0);
light->Message(MessageCode::TLightFlasherStartTimedThenStayOff, value);
}
}
@ -358,13 +358,13 @@ int TLightGroup::Message2(MessageCode code, float value)
// Turn off lights (index, end]
for (auto i = count - 1; i > index; i--)
{
List.at(i)->Message2(MessageCode::TLightResetAndTurnOff, 0.0);
List.at(i)->Message(MessageCode::TLightResetAndTurnOff, 0.0);
}
// Turn on lights [begin, index]
for (auto i = index; i >= 0; i--)
{
List.at(i)->Message2(MessageCode::TLightResetAndTurnOn, 0.0);
List.at(i)->Message(MessageCode::TLightResetAndTurnOn, 0.0);
}
}
break;
@ -374,14 +374,14 @@ int TLightGroup::Message2(MessageCode code, float value)
auto index = next_light_down();
if (index >= 0)
{
List.at(index)->Message2(MessageCode::TLightFlasherStart, 0.0);
List.at(index)->Message(MessageCode::TLightFlasherStart, 0.0);
}
break;
}
default:
for (auto it = List.rbegin(); it != List.rend(); ++it)
{
(*it)->Message2(code, value);
(*it)->Message(code, value);
}
break;
}
@ -423,9 +423,9 @@ void TLightGroup::start_animation()
{
auto light = *it;
if (light->LightOnFlag)
light->Message2(MessageCode::TLightTurnOnTimed, 0.0);
light->Message(MessageCode::TLightTurnOnTimed, 0.0);
else
light->Message2(MessageCode::TLightTurnOffTimed, 0.0);
light->Message(MessageCode::TLightTurnOffTimed, 0.0);
}
}
@ -453,7 +453,7 @@ void TLightGroup::TimerExpired(int timerId, void* caller)
{
auto group = static_cast<TLightGroup*>(caller);
group->Timer = 0;
group->Message2(group->MessageField2, group->Timer1Time);
group->Message(group->MessageField2, group->Timer1Time);
}
void TLightGroup::NotifyTimerExpired(int timerId, void* caller)

View File

@ -14,12 +14,12 @@ struct TLightGroup_player_backup
class TLightGroup :
public TPinballComponent2
public TPinballComponent
{
public:
TLightGroup(TPinballTable* table, int groupIndex);
~TLightGroup() override = default;
int Message2(MessageCode code, float value) override;
int Message(MessageCode code, float value) override;
virtual void Reset();
void reschedule_animation(float time);
void start_animation();

View File

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

View File

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

View File

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

View File

@ -122,13 +122,6 @@ constexpr typename std::enable_if<std::is_enum<T>::value, X>::type operator~(T v
{
return static_cast<X>(value);
}
#if defined(__GNUC__) || defined(__clang__)
#define DEPRECATED __attribute__((deprecated))
#elif defined(_MSC_VER)
#define DEPRECATED __declspec(deprecated)
#else
#define DEPRECATED
#endif
class TPinballComponent
@ -136,11 +129,7 @@ class TPinballComponent
public:
TPinballComponent(TPinballTable* table, int groupIndex, bool loadVisuals);
virtual ~TPinballComponent();
virtual int Message(int code, float value);
virtual int Message2(MessageCode code, float value)
{
return Message(~code, value);
}
virtual int Message(MessageCode code, float value);
virtual void port_draw();
int get_scoring(unsigned int index) const;
virtual vector2 get_coordinates();
@ -159,18 +148,3 @@ private:
float VisualPosNormX;
float VisualPosNormY;
};
class TPinballComponent2 : public TPinballComponent
{
public:
TPinballComponent2(TPinballTable* table, int group_index, bool load_visuals)
: TPinballComponent(table, group_index, load_visuals)
{
}
DEPRECATED int Message(int code, float value) override
{
return Message2(static_cast<MessageCode>(code), value);
}
};

View File

@ -42,7 +42,7 @@
int TPinballTable::score_multipliers[5] = {1, 2, 3, 5, 10};
TPinballTable::TPinballTable(): TPinballComponent2(nullptr, -1, false)
TPinballTable::TPinballTable(): TPinballComponent(nullptr, -1, false)
{
int shortArrLength;
@ -297,9 +297,9 @@ void TPinballTable::tilt(float time)
for (auto component : ComponentList)
{
component->Message2(MessageCode::SetTiltLock, time);
component->Message(MessageCode::SetTiltLock, time);
}
LightGroup->Message2(MessageCode::TLightTurnOffTimed, 0);
LightGroup->Message(MessageCode::TLightTurnOffTimed, 0);
TiltLockFlag = 1;
control::table_control_handler(1011);
}
@ -314,7 +314,7 @@ void TPinballTable::port_draw()
}
}
int TPinballTable::Message2(MessageCode code, float value)
int TPinballTable::Message(MessageCode code, float value)
{
const char* rc_text;
@ -323,41 +323,41 @@ int TPinballTable::Message2(MessageCode code, float value)
case MessageCode::LeftFlipperInputPressed:
if (!TiltLockFlag)
{
FlipperL->Message2(MessageCode::TFlipperExtend, value);
FlipperL->Message(MessageCode::TFlipperExtend, value);
}
break;
case MessageCode::LeftFlipperInputReleased:
if (!TiltLockFlag)
{
FlipperL->Message2(MessageCode::TFlipperRetract, value);
FlipperL->Message(MessageCode::TFlipperRetract, value);
}
break;
case MessageCode::RightFlipperInputPressed:
if (!TiltLockFlag)
{
FlipperR->Message2(MessageCode::TFlipperExtend, value);
FlipperR->Message(MessageCode::TFlipperExtend, value);
}
break;
case MessageCode::RightFlipperInputReleased:
if (!TiltLockFlag)
{
FlipperR->Message2(MessageCode::TFlipperRetract, value);
FlipperR->Message(MessageCode::TFlipperRetract, value);
}
break;
case MessageCode::PlungerInputPressed:
case MessageCode::PlungerInputReleased:
Plunger->Message2(code, value);
Plunger->Message(code, value);
break;
case MessageCode::Pause:
case MessageCode::Resume:
case MessageCode::LooseFocus:
for (auto component : ComponentList)
{
component->Message2(code, value);
component->Message(code, value);
}
break;
case MessageCode::ClearTiltLock:
LightGroup->Message2(MessageCode::TLightResetTimed, 0.0);
LightGroup->Message(MessageCode::TLightResetTimed, 0.0);
if (TiltLockFlag)
{
TiltLockFlag = 0;
@ -367,16 +367,16 @@ int TPinballTable::Message2(MessageCode code, float value)
}
break;
case MessageCode::StartGamePlayer1:
LightGroup->Message2(MessageCode::TLightGroupReset, 0.0);
LightGroup->Message2(MessageCode::TLightResetAndTurnOff, 0.0);
Plunger->Message2(MessageCode::PlungerStartFeedTimer, 0.0);
LightGroup->Message(MessageCode::TLightGroupReset, 0.0);
LightGroup->Message(MessageCode::TLightResetAndTurnOff, 0.0);
Plunger->Message(MessageCode::PlungerStartFeedTimer, 0.0);
if (Demo && Demo->ActiveFlag)
rc_text = pb::get_rc_string(Msg::STRING131);
else
rc_text = pb::get_rc_string(Msg::STRING127);
pb::InfoTextBox->Display(rc_text, -1.0);
if (Demo)
Demo->Message2(MessageCode::NewGame, 0.0);
Demo->Message(MessageCode::NewGame, 0.0);
break;
case MessageCode::NewGame:
if (EndGameTimeoutTimer)
@ -389,12 +389,12 @@ int TPinballTable::Message2(MessageCode code, float value)
{
timer::kill(LightShowTimer);
LightShowTimer = 0;
Message2(MessageCode::StartGamePlayer1, 0.0);
Message(MessageCode::StartGamePlayer1, 0.0);
}
else
{
CheatsUsed = 0;
Message2(MessageCode::Reset, 0.0);
Message(MessageCode::Reset, 0.0);
auto ball = BallList[0];
ball->Position.Y = 0.0;
ball->Position.X = 0.0;
@ -446,7 +446,7 @@ int TPinballTable::Message2(MessageCode code, float value)
UnknownP71 = 0;
pb::InfoTextBox->Clear();
pb::MissTextBox->Clear();
LightGroup->Message2(MessageCode::TLightGroupLightShowAnimation, 0.2f);
LightGroup->Message(MessageCode::TLightGroupLightShowAnimation, 0.2f);
auto time = loader::play_sound(SoundIndex1, nullptr, "TPinballTable2");
if (time < 0)
time = 5.0f;
@ -506,7 +506,7 @@ int TPinballTable::Message2(MessageCode code, float value)
for (auto component : ComponentList)
{
component->Message2(MessageCode::PlayerChanged, static_cast<float>(nextPlayer));
component->Message(MessageCode::PlayerChanged, static_cast<float>(nextPlayer));
}
const char* textboxText = nullptr;
@ -557,7 +557,7 @@ int TPinballTable::Message2(MessageCode code, float value)
case MessageCode::Reset:
for (auto component : ComponentList)
{
component->Message2(MessageCode::Reset, 0);
component->Message(MessageCode::Reset, 0);
}
if (ReplayTimer)
timer::kill(ReplayTimer);
@ -565,7 +565,7 @@ int TPinballTable::Message2(MessageCode code, float value)
if (LightShowTimer)
{
timer::kill(LightShowTimer);
LightGroup->Message2(MessageCode::TLightGroupReset, 0.0);
LightGroup->Message(MessageCode::TLightGroupReset, 0.0);
}
LightShowTimer = 0;
ScoreMultiplier = 0;
@ -658,10 +658,10 @@ void TPinballTable::EndGame_timeout(int timerId, void* caller)
for (auto component : table->ComponentList)
{
component->Message2(MessageCode::GameOver, 0);
component->Message(MessageCode::GameOver, 0);
}
if (table->Demo)
table->Demo->Message2(MessageCode::GameOver, 0.0);
table->Demo->Message(MessageCode::GameOver, 0.0);
control::handler(67, pb::MissTextBox);
pb::InfoTextBox->Display(pb::get_rc_string(Msg::STRING125), -1.0);
}
@ -670,7 +670,7 @@ void TPinballTable::LightShow_timeout(int timerId, void* caller)
{
auto table = static_cast<TPinballTable*>(caller);
table->LightShowTimer = 0;
table->Message2(MessageCode::StartGamePlayer1, 0.0);
table->Message(MessageCode::StartGamePlayer1, 0.0);
}
void TPinballTable::replay_timer_callback(int timerId, void* caller)

View File

@ -23,7 +23,7 @@ struct score_struct_super
};
class TPinballTable : public TPinballComponent2
class TPinballTable : public TPinballComponent
{
public:
TPinballTable();
@ -34,7 +34,7 @@ public:
void ChangeBallCount(int count);
void tilt(float time);
void port_draw() override;
int Message2(MessageCode code, float value) override;
int Message(MessageCode code, float value) override;
TBall* AddBall(float x, float y);
int BallCountInRect(const RectF& rect);

View File

@ -11,7 +11,7 @@
#include "timer.h"
#include "TPinballTable.h"
TPlunger::TPlunger(TPinballTable* table, int groupIndex) : TCollisionComponent2(table, groupIndex, true)
TPlunger::TPlunger(TPinballTable* table, int groupIndex) : TCollisionComponent(table, groupIndex, true)
{
visualStruct visual{};
@ -47,7 +47,7 @@ void TPlunger::Collision(TBall* ball, vector2* nextPosition, vector2* direction,
maths::basic_collision(ball, nextPosition, direction, Elasticity, Smoothness, 0, boost);
if (SomeCounter)
SomeCounter--;
Message2(MessageCode::PlungerInputReleased, 0.0);
Message(MessageCode::PlungerInputReleased, 0.0);
}
else
{
@ -56,7 +56,7 @@ void TPlunger::Collision(TBall* ball, vector2* nextPosition, vector2* direction,
}
}
int TPlunger::Message2(MessageCode code, float value)
int TPlunger::Message(MessageCode code, float value)
{
switch (code)
{
@ -98,7 +98,7 @@ int TPlunger::Message2(MessageCode code, float value)
case MessageCode::PlungerLaunchBall:
PullbackStartedFlag = true;
Boost = MaxPullback;
Message2(MessageCode::PlungerInputReleased, 0.0f);
Message(MessageCode::PlungerInputReleased, 0.0f);
break;
case MessageCode::PlungerRelaunchBall:
SomeCounter++;
@ -175,7 +175,7 @@ int TPlunger::Message2(MessageCode code, float value)
void TPlunger::BallFeedTimer(int timerId, void* caller)
{
auto plunger = static_cast<TPlunger*>(caller);
plunger->Message2(MessageCode::PlungerFeedBall, 0.0);
plunger->Message(MessageCode::PlungerFeedBall, 0.0);
}
void TPlunger::PullbackTimer(int timerId, void* caller)

View File

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

View File

@ -8,13 +8,13 @@
#include "timer.h"
#include "TPinballTable.h"
TPopupTarget::TPopupTarget(TPinballTable* table, int groupIndex) : TCollisionComponent2(table, groupIndex, true)
TPopupTarget::TPopupTarget(TPinballTable* table, int groupIndex) : TCollisionComponent(table, groupIndex, true)
{
Timer = 0;
TimerTime = *loader::query_float_attribute(groupIndex, 0, 407);
}
int TPopupTarget::Message2(MessageCode code, float value)
int TPopupTarget::Message(MessageCode code, float value)
{
switch (code)
{
@ -28,7 +28,7 @@ int TPopupTarget::Message2(MessageCode code, float value)
case MessageCode::PlayerChanged:
PlayerMessagefieldBackup[PinballTable->CurrentPlayer] = MessageField;
MessageField = PlayerMessagefieldBackup[static_cast<int>(floor(value))];
TPopupTarget::Message2(MessageField ? MessageCode::TPopupTargetDisable : MessageCode::TPopupTargetEnable, 0.0);
TPopupTarget::Message(MessageField ? MessageCode::TPopupTargetDisable : MessageCode::TPopupTargetEnable, 0.0);
break;
case MessageCode::Reset:
{
@ -69,7 +69,7 @@ void TPopupTarget::Collision(TBall* ball, vector2* nextPosition, vector2* direct
{
if (HardHitSoundId)
loader::play_sound(HardHitSoundId, this, "TPopupTarget1");
Message2(MessageCode::TPopupTargetDisable, 0.0);
Message(MessageCode::TPopupTargetDisable, 0.0);
control::handler(63, this);
}
}

View File

@ -2,11 +2,11 @@
#include "TCollisionComponent.h"
class TPopupTarget :
public TCollisionComponent2
public TCollisionComponent
{
public:
TPopupTarget(TPinballTable* table, int groupIndex);
int Message2(MessageCode code, float value) override;
int Message(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) : TCollisionComponent2(
TRollover::TRollover(TPinballTable* table, int groupIndex, bool createWall) : TCollisionComponent(
table, groupIndex, createWall)
{
}
TRollover::TRollover(TPinballTable* table, int groupIndex) : TCollisionComponent2(table, groupIndex, false)
TRollover::TRollover(TPinballTable* table, int groupIndex) : TCollisionComponent(table, groupIndex, false)
{
if (ListBitmap)
render::sprite_set_bitmap(RenderSprite, ListBitmap->at(0));
@ -25,7 +25,7 @@ TRollover::TRollover(TPinballTable* table, int groupIndex) : TCollisionComponent
}
int TRollover::Message2(MessageCode code, float value)
int TRollover::Message(MessageCode code, float value)
{
if (code == MessageCode::Reset)
{

View File

@ -2,14 +2,14 @@
#include "TCollisionComponent.h"
class TRollover :
public TCollisionComponent2
public TCollisionComponent
{
protected:
TRollover(TPinballTable* table, int groupIndex, bool createWall);
public:
TRollover(TPinballTable* table, int groupIndex);
~TRollover() override = default;
int Message2(MessageCode code, float value) override;
int Message(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) : TCollisionComponent2(table, groupIndex, true)
TSink::TSink(TPinballTable* table, int groupIndex) : TCollisionComponent(table, groupIndex, true)
{
visualStruct visual{};
@ -27,7 +27,7 @@ TSink::TSink(TPinballTable* table, int groupIndex) : TCollisionComponent2(table,
TimerTime = *loader::query_float_attribute(groupIndex, 0, 407);
}
int TSink::Message2(MessageCode code, float value)
int TSink::Message(MessageCode code, float value)
{
switch (code)
{

View File

@ -3,11 +3,11 @@
#include "TCollisionComponent.h"
class TSink :
public TCollisionComponent2
public TCollisionComponent
{
public:
TSink(TPinballTable* table, int groupIndex);
int Message2(MessageCode code, float value) override;
int Message(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) : TCollisionComponent2(table, groupIndex, true)
TSoloTarget::TSoloTarget(TPinballTable* table, int groupIndex) : TCollisionComponent(table, groupIndex, true)
{
visualStruct visual{};
@ -16,10 +16,10 @@ TSoloTarget::TSoloTarget(TPinballTable* table, int groupIndex) : TCollisionCompo
TimerTime = 0.1f;
loader::query_visual(groupIndex, 0, &visual);
SoundIndex4 = visual.SoundIndex4;
TSoloTarget::Message2(MessageCode::TSoloTargetEnable, 0.0);
TSoloTarget::Message(MessageCode::TSoloTargetEnable, 0.0);
}
int TSoloTarget::Message2(MessageCode code, float value)
int TSoloTarget::Message(MessageCode code, float value)
{
switch (code)
{
@ -58,7 +58,7 @@ void TSoloTarget::Collision(TBall* ball, vector2* nextPosition, vector2* directi
{
if (DefaultCollision(ball, nextPosition, direction))
{
Message2(MessageCode::TSoloTargetDisable, 0.0);
Message(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->Message2(MessageCode::TSoloTargetEnable, 0.0);
target->Message(MessageCode::TSoloTargetEnable, 0.0);
target->Timer = 0;
}

View File

@ -2,11 +2,11 @@
#include "TCollisionComponent.h"
class TSoloTarget :
public TCollisionComponent2
public TCollisionComponent
{
public:
TSoloTarget(TPinballTable* table, int groupIndex);
int Message2(MessageCode code, float value) override;
int Message(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) : TPinballComponent2(table, groupIndex, true)
TTextBox::TTextBox(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, true)
{
OffsetX = 0;
OffsetY = 0;
@ -51,7 +51,7 @@ TTextBox::~TTextBox()
}
}
int TTextBox::Message2(MessageCode code, float value)
int TTextBox::Message(MessageCode code, float value)
{
return 0;
}

View File

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

View File

@ -4,12 +4,12 @@
#include "control.h"
#include "timer.h"
TTimer::TTimer(TPinballTable* table, int groupIndex) : TPinballComponent2(table, groupIndex, true)
TTimer::TTimer(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, true)
{
Timer = 0;
}
int TTimer::Message2(MessageCode code, float value)
int TTimer::Message(MessageCode code, float value)
{
switch (code)
{

View File

@ -2,11 +2,11 @@
#include "TPinballComponent.h"
class TTimer :
public TPinballComponent2
public TPinballComponent
{
public:
TTimer(TPinballTable* table, int groupIndex);
int Message2(MessageCode code, float value) override;
int Message(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) : TCollisionComponent2(table, groupIndex, true)
TWall::TWall(TPinballTable* table, int groupIndex) : TCollisionComponent(table, groupIndex, true)
{
if (RenderSprite)
render::sprite_set_bitmap(RenderSprite, nullptr);
@ -14,7 +14,7 @@ TWall::TWall(TPinballTable* table, int groupIndex) : TCollisionComponent2(table,
BmpPtr = ListBitmap->at(0);
}
int TWall::Message2(MessageCode code, float value)
int TWall::Message(MessageCode code, float value)
{
if (code == MessageCode::Reset && Timer)
{

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -170,7 +170,7 @@ void pb::SelectDatFile(const std::vector<const char*>& dataSearchPaths)
void pb::reset_table()
{
if (MainTable)
MainTable->Message2(MessageCode::Reset, 0.0);
MainTable->Message(MessageCode::Reset, 0.0);
}
@ -215,7 +215,7 @@ void pb::mode_change(GameModes mode)
winmain::DemoActive = false;
}
if (MainTable && MainTable->LightGroup)
MainTable->LightGroup->Message2(MessageCode::TLightGroupGameOverAnimation, 1.4f);
MainTable->LightGroup->Message(MessageCode::TLightGroupGameOverAnimation, 1.4f);
break;
}
game_mode = mode;
@ -226,7 +226,7 @@ void pb::toggle_demo()
if (demo_mode)
{
demo_mode = false;
MainTable->Message2(MessageCode::Reset, 0.0);
MainTable->Message(MessageCode::Reset, 0.0);
mode_change(GameModes::GameOver);
MissTextBox->Clear();
InfoTextBox->Display(get_rc_string(Msg::STRING125), -1.0);
@ -243,7 +243,7 @@ void pb::replay_level(bool demoMode)
mode_change(GameModes::InGame);
if (options::Options.Music)
midi::music_play();
MainTable->Message2(MessageCode::NewGame, static_cast<float>(options::Options.Players));
MainTable->Message(MessageCode::NewGame, static_cast<float>(options::Options.Players));
}
void pb::ballset(float dx, float dy)
@ -374,7 +374,7 @@ void pb::pause_continue()
if (winmain::single_step)
{
if (MainTable)
MainTable->Message2(MessageCode::Pause, time_now);
MainTable->Message(MessageCode::Pause, time_now);
InfoTextBox->Display(get_rc_string(Msg::STRING123), -1.0);
midi::music_stop();
Sound::Deactivate();
@ -382,7 +382,7 @@ void pb::pause_continue()
else
{
if (MainTable)
MainTable->Message2(MessageCode::Resume, 0.0);
MainTable->Message(MessageCode::Resume, 0.0);
if (!demo_mode)
{
const char* text;
@ -408,7 +408,7 @@ void pb::pause_continue()
void pb::loose_focus()
{
if (MainTable)
MainTable->Message2(MessageCode::LooseFocus, time_now);
MainTable->Message(MessageCode::LooseFocus, time_now);
}
void pb::InputUp(GameInput input)
@ -418,15 +418,15 @@ void pb::InputUp(GameInput input)
if (AnyBindingMatchesInput(options::Options.Key.LeftFlipper, input))
{
MainTable->Message2(MessageCode::LeftFlipperInputReleased, time_now);
MainTable->Message(MessageCode::LeftFlipperInputReleased, time_now);
}
if (AnyBindingMatchesInput(options::Options.Key.RightFlipper, input))
{
MainTable->Message2(MessageCode::RightFlipperInputReleased, time_now);
MainTable->Message(MessageCode::RightFlipperInputReleased, time_now);
}
if (AnyBindingMatchesInput(options::Options.Key.Plunger, input))
{
MainTable->Message2(MessageCode::PlungerInputReleased, time_now);
MainTable->Message(MessageCode::PlungerInputReleased, time_now);
}
if (AnyBindingMatchesInput(options::Options.Key.LeftTableBump, input))
{
@ -453,15 +453,15 @@ void pb::InputDown(GameInput input)
if (AnyBindingMatchesInput(options::Options.Key.LeftFlipper, input))
{
MainTable->Message2(MessageCode::LeftFlipperInputPressed, time_now);
MainTable->Message(MessageCode::LeftFlipperInputPressed, time_now);
}
if (AnyBindingMatchesInput(options::Options.Key.RightFlipper, input))
{
MainTable->Message2(MessageCode::RightFlipperInputPressed, time_now);
MainTable->Message(MessageCode::RightFlipperInputPressed, time_now);
}
if (AnyBindingMatchesInput(options::Options.Key.Plunger, input))
{
MainTable->Message2(MessageCode::PlungerInputPressed, time_now);
MainTable->Message(MessageCode::PlungerInputPressed, time_now);
}
if (AnyBindingMatchesInput(options::Options.Key.LeftTableBump, input))
{
@ -504,10 +504,10 @@ void pb::InputDown(GameInput input)
MainTable->port_draw();
break;
case 'i':
MainTable->LightGroup->Message2(MessageCode::TLightFtTmpOverrideOn, 1.0f);
MainTable->LightGroup->Message(MessageCode::TLightFtTmpOverrideOn, 1.0f);
break;
case 'j':
MainTable->LightGroup->Message2(MessageCode::TLightFtTmpOverrideOff, 1.0f);
MainTable->LightGroup->Message(MessageCode::TLightFtTmpOverrideOff, 1.0f);
break;
}
}
@ -515,7 +515,7 @@ void pb::InputDown(GameInput input)
void pb::launch_ball()
{
MainTable->Plunger->Message2(MessageCode::PlungerLaunchBall, 0.0f);
MainTable->Plunger->Message(MessageCode::PlungerLaunchBall, 0.0f);
}
void pb::end_game()