mirror of
https://github.com/k4zmu2a/SpaceCadetPinball.git
synced 2024-11-24 19:52:30 +01:00
TPinballComponent: replaced calloc operator new with member initialization.
This commit is contained in:
parent
93de90b680
commit
261457a959
@ -17,21 +17,20 @@ public :
|
||||
static void throw_ball(TBall* ball, struct vector_type* acceleration, float angleMult, float speedMult1,
|
||||
float speedMult2);
|
||||
|
||||
vector_type Position;
|
||||
vector_type Acceleration;
|
||||
vector_type Position{};
|
||||
vector_type Acceleration{};
|
||||
float Speed;
|
||||
float RayMaxDistance;
|
||||
float TimeDelta;
|
||||
float TimeNow;
|
||||
vector_type InvAcceleration;
|
||||
vector_type RampFieldForce;
|
||||
vector_type InvAcceleration{};
|
||||
vector_type RampFieldForce{};
|
||||
TCollisionComponent* CollisionComp;
|
||||
int FieldFlag;
|
||||
TEdgeSegment* Collisions[5];
|
||||
TEdgeSegment* Collisions[5]{};
|
||||
int EdgeCollisionCount;
|
||||
vector_type CollisionOffset;
|
||||
vector_type CollisionOffset{};
|
||||
int CollisionFlag;
|
||||
float Offset;
|
||||
int Unknown29;
|
||||
float VisualZArray[50];
|
||||
float VisualZArray[50]{};
|
||||
};
|
||||
|
@ -28,6 +28,6 @@ public:
|
||||
float OriginalThreshold;
|
||||
int SoundIndex4;
|
||||
int SoundIndex3;
|
||||
int Scores[4];
|
||||
TBumper_player_backup PlayerData[4];
|
||||
int Scores[4]{};
|
||||
TBumper_player_backup PlayerData[4]{};
|
||||
};
|
||||
|
@ -6,7 +6,7 @@ class TCircle :
|
||||
public TEdgeSegment
|
||||
{
|
||||
public:
|
||||
circle_type Circle;
|
||||
circle_type Circle{};
|
||||
|
||||
TCircle(TCollisionComponent* collComp, char* activeFlag, unsigned int collisionGroup, vector_type* center,
|
||||
float radius);
|
||||
|
@ -35,5 +35,5 @@ public:
|
||||
float X;
|
||||
float Y;
|
||||
TEdgeBox* BoxArray;
|
||||
TEdgeSegment* EdgeArray[1000];
|
||||
TEdgeSegment* EdgeArray[1000]{};
|
||||
};
|
||||
|
@ -16,7 +16,7 @@ public:
|
||||
TCollisionComponent* CollisionComponent;
|
||||
char* ActiveFlag;
|
||||
char ProcessedFlag;
|
||||
void* WallValue;
|
||||
void* WallValue{};
|
||||
unsigned int CollisionGroup;
|
||||
|
||||
TEdgeSegment(TCollisionComponent* collComp, char* activeFlag, unsigned int collisionGroup);
|
||||
|
@ -15,14 +15,14 @@ public:
|
||||
|
||||
static void SpinTimer(int timerId, void* caller);
|
||||
|
||||
float Speed;
|
||||
float Speed{};
|
||||
float MaxSpeed;
|
||||
float MinSpeed;
|
||||
float SpeedDecrement;
|
||||
int SpinDirection;
|
||||
int BmpIndex;
|
||||
int SpinDirection{};
|
||||
int BmpIndex{};
|
||||
int Timer;
|
||||
TEdgeSegment* PrevCollider;
|
||||
int Scores[2];
|
||||
int Scores[2]{};
|
||||
};
|
||||
|
||||
|
@ -19,8 +19,8 @@ public:
|
||||
int BmpIndex;
|
||||
TFlipperEdge* FlipperEdge;
|
||||
int Timer;
|
||||
float BmpCoef1;
|
||||
float BmpCoef2;
|
||||
float TimerTime;
|
||||
float BmpCoef1{};
|
||||
float BmpCoef2{};
|
||||
float TimerTime{};
|
||||
float InputTime;
|
||||
};
|
||||
|
@ -23,7 +23,7 @@ public:
|
||||
int FlipperFlag;
|
||||
float Elasticity;
|
||||
float Smoothness;
|
||||
vector_type RotOrigin;
|
||||
vector_type RotOrigin{};
|
||||
float CirclebaseRadius;
|
||||
float CircleT1Radius;
|
||||
float CirclebaseRadiusSq;
|
||||
@ -31,28 +31,28 @@ public:
|
||||
float CirclebaseRadiusMSq;
|
||||
float CircleT1RadiusMSq;
|
||||
float AngleMax;
|
||||
float Angle2;
|
||||
float Angle2{};
|
||||
float Angle1;
|
||||
int CollisionFlag1;
|
||||
int CollisionFlag2;
|
||||
vector_type CollisionLinePerp;
|
||||
vector_type A1Src;
|
||||
vector_type A2Src;
|
||||
vector_type B1Src;
|
||||
vector_type B2Src;
|
||||
int CollisionFlag2{};
|
||||
vector_type CollisionLinePerp{};
|
||||
vector_type A1Src{};
|
||||
vector_type A2Src{};
|
||||
vector_type B1Src{};
|
||||
vector_type B2Src{};
|
||||
float CollisionMult;
|
||||
vector_type T1Src;
|
||||
vector_type T2Src;
|
||||
vector_type T1Src{};
|
||||
vector_type T2Src{};
|
||||
float DistanceDivSq;
|
||||
float CollisionTimeAdvance;
|
||||
vector_type CollisionDirection;
|
||||
vector_type CollisionDirection{};
|
||||
int EdgeCollisionFlag;
|
||||
float InputTime;
|
||||
float AngleStopTime;
|
||||
float AngleMult;
|
||||
float BmpCoef1;
|
||||
float BmpCoef2;
|
||||
vector_type NextBallPosition;
|
||||
vector_type NextBallPosition{};
|
||||
|
||||
static float flipper_sin_angle, flipper_cos_angle;
|
||||
static vector_type A1, A2, B1, B2, T1;
|
||||
|
@ -16,7 +16,7 @@ public:
|
||||
static void TimerExpired(int timerId, void* caller);
|
||||
|
||||
int BallCapturedFlag;
|
||||
int BallCapturedSecondStage;
|
||||
int BallCapturedSecondStage{};
|
||||
int Timer;
|
||||
float Unknown3;
|
||||
float Unknown4;
|
||||
@ -24,6 +24,6 @@ public:
|
||||
float ZSetValue;
|
||||
int FieldFlag;
|
||||
float GravityPull;
|
||||
circle_type Circle;
|
||||
field_effect_type Field;
|
||||
circle_type Circle{};
|
||||
field_effect_type Field{};
|
||||
};
|
||||
|
@ -13,8 +13,8 @@ TKickback::TKickback(TPinballTable* table, int groupIndex): TCollisionComponent(
|
||||
{
|
||||
MessageField = 0;
|
||||
Timer = 0;
|
||||
ActiveFlag = 0;
|
||||
TimerTime = 0.69999999f;
|
||||
KickActiveFlag = 0;
|
||||
TimerTime = 0.7f;
|
||||
TimerTime2 = 0.1f;
|
||||
Threshold = 1000000000.0f;
|
||||
}
|
||||
@ -27,7 +27,7 @@ int TKickback::Message(int code, float value)
|
||||
if (ListBitmap)
|
||||
render::sprite_set_bitmap(RenderSprite, nullptr);
|
||||
Timer = 0;
|
||||
ActiveFlag = 0;
|
||||
KickActiveFlag = 0;
|
||||
Threshold = 1000000000.0;
|
||||
}
|
||||
return 0;
|
||||
@ -43,14 +43,14 @@ void TKickback::Collision(TBall* ball, vector_type* nextPosition, vector_type* d
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!ActiveFlag)
|
||||
if (!KickActiveFlag)
|
||||
{
|
||||
Threshold = 1000000000.0;
|
||||
ActiveFlag = 1;
|
||||
KickActiveFlag = 1;
|
||||
Timer = timer::set(TimerTime, this, TimerExpired);
|
||||
}
|
||||
if (DefaultCollision(ball, nextPosition, direction))
|
||||
ActiveFlag = 0;
|
||||
KickActiveFlag = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -58,7 +58,7 @@ void TKickback::TimerExpired(int timerId, void* caller)
|
||||
{
|
||||
auto kick = static_cast<TKickback*>(caller);
|
||||
|
||||
if (kick->ActiveFlag)
|
||||
if (kick->KickActiveFlag)
|
||||
{
|
||||
kick->Threshold = 0.0;
|
||||
kick->Timer = timer::set(kick->TimerTime2, kick, TimerExpired);
|
||||
|
@ -15,5 +15,5 @@ public:
|
||||
float TimerTime;
|
||||
float TimerTime2;
|
||||
int Timer;
|
||||
int ActiveFlag;
|
||||
int KickActiveFlag;
|
||||
};
|
||||
|
@ -24,14 +24,14 @@ public:
|
||||
float TimerTime1;
|
||||
float TimerTime2;
|
||||
float CollisionBallSetZ;
|
||||
TBall* Ball;
|
||||
TBall* Ball{};
|
||||
float FieldMult;
|
||||
circle_type Circle;
|
||||
float OriginalBallZ;
|
||||
vector_type BallAcceleration;
|
||||
circle_type Circle{};
|
||||
float OriginalBallZ{};
|
||||
vector_type BallAcceleration{};
|
||||
float ThrowAngleMult;
|
||||
float ThrowSpeedMult1;
|
||||
float ThrowSpeedMult2;
|
||||
field_effect_type Field;
|
||||
int Scores[5];
|
||||
field_effect_type Field{};
|
||||
int Scores[5]{};
|
||||
};
|
||||
|
@ -40,17 +40,16 @@ public:
|
||||
static void flasher_start(struct flasher_type* flash, int bmpIndex);
|
||||
static void flasher_callback(int timerId, void* caller);
|
||||
|
||||
flasher_type Flasher;
|
||||
int BmpIndex1;
|
||||
flasher_type Flasher{};
|
||||
int BmpIndex1{};
|
||||
int FlasherActive;
|
||||
int FlasherFlag1;
|
||||
int FlasherFlag2;
|
||||
int TurnOffAfterFlashingFg;
|
||||
int BmpIndex2;
|
||||
float FlasherDelay[2];
|
||||
int FlasherFlag1{};
|
||||
int FlasherFlag2{};
|
||||
int TurnOffAfterFlashingFg{};
|
||||
int BmpIndex2{};
|
||||
float FlasherDelay[2]{};
|
||||
int Timer1;
|
||||
int Timer2;
|
||||
int Unknown19;
|
||||
float Unknown20F;
|
||||
TLight_player_backup PlayerData[4];
|
||||
float Unknown20F{};
|
||||
TLight_player_backup PlayerData[4]{};
|
||||
};
|
||||
|
@ -13,7 +13,7 @@ public:
|
||||
static void BargraphTimerExpired(int timerId, void* caller);
|
||||
|
||||
float* TimerTimeArray;
|
||||
int TimerBargraph;
|
||||
int TimeIndex;
|
||||
int PlayerTimerIndexBackup[4];
|
||||
int TimerBargraph{};
|
||||
int TimeIndex{};
|
||||
int PlayerTimerIndexBackup[4]{};
|
||||
};
|
||||
|
@ -28,10 +28,6 @@ TLightGroup::TLightGroup(TPinballTable* table, int groupIndex) : TPinballCompone
|
||||
}
|
||||
}
|
||||
|
||||
TLightGroup::~TLightGroup()
|
||||
{
|
||||
}
|
||||
|
||||
int TLightGroup::Message(int code, float value)
|
||||
{
|
||||
auto count = static_cast<int>(List.size());
|
||||
|
@ -18,7 +18,7 @@ class TLightGroup :
|
||||
{
|
||||
public:
|
||||
TLightGroup(TPinballTable* table, int groupIndex);
|
||||
~TLightGroup() override;
|
||||
~TLightGroup() override = default;
|
||||
int Message(int code, float value) override;
|
||||
virtual void Reset();
|
||||
void reschedule_animation(float time);
|
||||
@ -30,11 +30,11 @@ public:
|
||||
static void NotifyTimerExpired(int timerId, void* caller);
|
||||
|
||||
std::vector<TLight*> List;
|
||||
float Timer1Time;
|
||||
float Timer1Time{};
|
||||
float Timer1TimeDefault;
|
||||
int MessageField2;
|
||||
int AnimationFlag;
|
||||
int MessageField2{};
|
||||
int AnimationFlag{};
|
||||
int NotifyTimer;
|
||||
int Timer;
|
||||
TLightGroup_player_backup PlayerData[4];
|
||||
TLightGroup_player_backup PlayerData[4]{};
|
||||
};
|
||||
|
@ -6,7 +6,7 @@ class TLine :
|
||||
public TEdgeSegment
|
||||
{
|
||||
public:
|
||||
line_type Line;
|
||||
line_type Line{};
|
||||
float X0, Y0, X1, Y1;
|
||||
TLine(TCollisionComponent* collCmp, char* activeFlag, unsigned int collisionGroup, float x0, float y0, float x1, float y1);
|
||||
TLine(TCollisionComponent* collCmp, char* activeFlag, unsigned int collisionGroup, vector_type* start, vector_type* end);
|
||||
|
@ -14,5 +14,5 @@ public:
|
||||
int get_scoring(int index) override;
|
||||
|
||||
TLine* Line;
|
||||
int Scores[6];
|
||||
int Scores[6]{};
|
||||
};
|
||||
|
@ -111,13 +111,3 @@ int TPinballComponent::get_scoring(int index)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void* TPinballComponent::operator new(size_t Size)
|
||||
{
|
||||
return calloc(1u, Size);
|
||||
}
|
||||
|
||||
void TPinballComponent::operator delete(void* p)
|
||||
{
|
||||
free(p); /*Original does not have this*/
|
||||
}
|
||||
|
@ -24,9 +24,6 @@ public:
|
||||
virtual void put_scoring(int index, int score);
|
||||
virtual int get_scoring(int index);
|
||||
|
||||
void* operator new(size_t Size);
|
||||
void operator delete(void* p);
|
||||
|
||||
char UnusedBaseFlag;
|
||||
char ActiveFlag;
|
||||
int MessageField;
|
||||
|
@ -45,54 +45,54 @@ public:
|
||||
scoreStruct* CurScoreStruct;
|
||||
scoreStruct* ScoreBallcount;
|
||||
scoreStruct* ScorePlayerNumber1;
|
||||
int CheatsUsed;
|
||||
int SoundIndex1;
|
||||
int SoundIndex2;
|
||||
int SoundIndex3;
|
||||
int CheatsUsed{};
|
||||
int SoundIndex1{};
|
||||
int SoundIndex2{};
|
||||
int SoundIndex3{};
|
||||
int BallInSink;
|
||||
int CurScore;
|
||||
int CurScoreE9;
|
||||
int CurScore{};
|
||||
int CurScoreE9{};
|
||||
int LightShowTimer;
|
||||
int EndGameTimeoutTimer;
|
||||
int TiltTimeoutTimer;
|
||||
score_struct_super PlayerScores[4];
|
||||
score_struct_super PlayerScores[4]{};
|
||||
int PlayerCount;
|
||||
int CurrentPlayer;
|
||||
TPlunger* Plunger;
|
||||
TDrain* Drain;
|
||||
TDemo* Demo;
|
||||
int XOffset;
|
||||
int YOffset;
|
||||
int Width;
|
||||
int Height;
|
||||
TDemo* Demo{};
|
||||
int XOffset{};
|
||||
int YOffset{};
|
||||
int Width{};
|
||||
int Height{};
|
||||
std::vector<TPinballComponent*> ComponentList;
|
||||
std::vector<TBall*> BallList;
|
||||
TLightGroup* LightGroup;
|
||||
float GravityDirVectMult;
|
||||
float GravityAngleX;
|
||||
float GravityAnglY;
|
||||
float CollisionCompOffset;
|
||||
float PlungerPositionX;
|
||||
float PlungerPositionY;
|
||||
int ScoreMultiplier;
|
||||
int ScoreAdded;
|
||||
int ScoreSpecial1;
|
||||
int ScoreSpecial2;
|
||||
int ScoreSpecial2Flag;
|
||||
int ScoreSpecial3;
|
||||
int ScoreSpecial3Flag;
|
||||
int UnknownP71;
|
||||
int BallCount;
|
||||
float GravityDirVectMult{};
|
||||
float GravityAngleX{};
|
||||
float GravityAnglY{};
|
||||
float CollisionCompOffset{};
|
||||
float PlungerPositionX{};
|
||||
float PlungerPositionY{};
|
||||
int ScoreMultiplier{};
|
||||
int ScoreAdded{};
|
||||
int ScoreSpecial1{};
|
||||
int ScoreSpecial2{};
|
||||
int ScoreSpecial2Flag{};
|
||||
int ScoreSpecial3{};
|
||||
int ScoreSpecial3Flag{};
|
||||
int UnknownP71{};
|
||||
int BallCount{};
|
||||
int MaxBallCount;
|
||||
int ExtraBalls;
|
||||
int UnknownP75;
|
||||
int BallLockedCounter;
|
||||
int ExtraBalls{};
|
||||
int UnknownP75{};
|
||||
int BallLockedCounter{};
|
||||
int MultiballFlag;
|
||||
int UnknownP78;
|
||||
int ReplayActiveFlag;
|
||||
int UnknownP78{};
|
||||
int ReplayActiveFlag{};
|
||||
int ReplayTimer;
|
||||
int UnknownP81;
|
||||
int UnknownP82;
|
||||
int UnknownP81{};
|
||||
int UnknownP82{};
|
||||
int TiltLockFlag;
|
||||
|
||||
private:
|
||||
|
@ -16,6 +16,6 @@ public:
|
||||
|
||||
int Timer;
|
||||
float TimerTime;
|
||||
int Scores[3];
|
||||
int PlayerMessagefieldBackup[4];
|
||||
int Scores[3]{};
|
||||
int PlayerMessagefieldBackup[4]{};
|
||||
};
|
||||
|
@ -17,8 +17,8 @@ public:
|
||||
int FieldEffect(TBall* ball, vector_type* vecDst) override;
|
||||
void port_draw() override;
|
||||
|
||||
int Scores[4];
|
||||
field_effect_type Field;
|
||||
int Scores[4]{};
|
||||
field_effect_type Field{};
|
||||
int CollisionGroup;
|
||||
int RampFlag1;
|
||||
int RampPlaneCount;
|
||||
|
@ -19,7 +19,6 @@ TRollover::TRollover(TPinballTable* table, int groupIndex, bool createWall) : TC
|
||||
|
||||
TRollover::TRollover(TPinballTable* table, int groupIndex) : TCollisionComponent(table, groupIndex, false)
|
||||
{
|
||||
RolloverFlag = 0;
|
||||
if (ListBitmap)
|
||||
render::sprite_set_bitmap(RenderSprite, ListBitmap->at(0));
|
||||
build_walls(groupIndex);
|
||||
|
@ -18,6 +18,6 @@ public:
|
||||
|
||||
static void TimerExpired(int timerId, void* caller);
|
||||
|
||||
char RolloverFlag;
|
||||
int Scores[2];
|
||||
char RolloverFlag{};
|
||||
int Scores[2]{};
|
||||
};
|
||||
|
@ -17,13 +17,13 @@ public:
|
||||
|
||||
int Timer;
|
||||
float TimerTime;
|
||||
vector_type BallPosition;
|
||||
vector_type BallAcceleration;
|
||||
vector_type BallPosition{};
|
||||
vector_type BallAcceleration{};
|
||||
float ThrowAngleMult;
|
||||
float ThrowSpeedMult1;
|
||||
float ThrowSpeedMult2;
|
||||
int SoundIndex4;
|
||||
int SoundIndex3;
|
||||
int Scores[3];
|
||||
int PlayerMessagefieldBackup[4];
|
||||
int Scores[3]{};
|
||||
int PlayerMessagefieldBackup[4]{};
|
||||
};
|
||||
|
@ -13,10 +13,9 @@ public:
|
||||
TEdgeSegment* edge) override;
|
||||
|
||||
static void TimerExpired(int timerId, void* caller);
|
||||
|
||||
int Unknown0;
|
||||
|
||||
int Timer;
|
||||
float TimerTime;
|
||||
int SoundIndex4;
|
||||
int Scores[1];
|
||||
int Scores[1]{};
|
||||
};
|
||||
|
@ -27,9 +27,8 @@ public:
|
||||
float Unknown4F;
|
||||
float GraityDirX;
|
||||
float GraityDirY;
|
||||
int Unknown7;
|
||||
float GraityMult;
|
||||
field_effect_type Field;
|
||||
field_effect_type Field{};
|
||||
|
||||
static TEdgeManager* edge_manager;
|
||||
};
|
||||
|
@ -12,7 +12,6 @@ TWall::TWall(TPinballTable* table, int groupIndex) : TCollisionComponent(table,
|
||||
render::sprite_set_bitmap(RenderSprite, nullptr);
|
||||
if (ListBitmap)
|
||||
BmpPtr = ListBitmap->at(0);
|
||||
Timer = 0;
|
||||
}
|
||||
|
||||
int TWall::Message(int code, float value)
|
||||
|
@ -11,13 +11,13 @@ public:
|
||||
TWall(TPinballTable* table, int groupIndex);
|
||||
int Message(int code, float value) override;
|
||||
void Collision(TBall* ball, vector_type* nextPosition, vector_type* direction, float coef,
|
||||
TEdgeSegment* edge) override;
|
||||
TEdgeSegment* edge) override;
|
||||
void put_scoring(int index, int score) override;
|
||||
int get_scoring(int index) override;
|
||||
int get_scoring(int index) override;
|
||||
|
||||
static void TimerExpired(int timerId, void* caller);
|
||||
|
||||
int Timer;
|
||||
gdrv_bitmap8* BmpPtr;
|
||||
int Scores[1];
|
||||
int Timer{};
|
||||
gdrv_bitmap8* BmpPtr{};
|
||||
int Scores[1]{};
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user