Some renames, cleanup partman, loader.
This commit is contained in:
@@ -16,7 +16,7 @@ TBall::TBall(TPinballTable* table) : TPinballComponent(table, -1, false)
|
||||
|
||||
TimeNow = 0.0;
|
||||
RayMaxDistance = 0.0;
|
||||
UnknownBaseFlag2 = 1;
|
||||
ActiveFlag = 1;
|
||||
CollisionComp = nullptr;
|
||||
EdgeCollisionCount = 0;
|
||||
TimeDelta = 0.0;
|
||||
@@ -115,7 +115,7 @@ int TBall::Message(int code, float value)
|
||||
Position.X = 0.0;
|
||||
CollisionComp = nullptr;
|
||||
Position.Y = 0.0;
|
||||
UnknownBaseFlag2 = 0;
|
||||
ActiveFlag = 0;
|
||||
CollisionFlag = 0;
|
||||
FieldFlag = 1;
|
||||
Acceleration.Y = 0.0;
|
||||
|
||||
@@ -20,7 +20,7 @@ TBlocker::TBlocker(TPinballTable* table, int groupIndex) : TCollisionComponent(t
|
||||
Threshold = 1000000000.0f;
|
||||
Timer = 0;
|
||||
MessageField = 0;
|
||||
UnknownBaseFlag2 = 0;
|
||||
ActiveFlag = 0;
|
||||
render::sprite_set_bitmap(RenderSprite, nullptr);
|
||||
}
|
||||
|
||||
@@ -38,13 +38,13 @@ int TBlocker::Message(int code, float value)
|
||||
Timer = 0;
|
||||
}
|
||||
MessageField = 0;
|
||||
UnknownBaseFlag2 = 0;
|
||||
ActiveFlag = 0;
|
||||
render::sprite_set_bitmap(RenderSprite, nullptr);
|
||||
if (code == 51)
|
||||
loader::play_sound(SoundIndex3);
|
||||
return 0;
|
||||
case 52:
|
||||
UnknownBaseFlag2 = 1;
|
||||
ActiveFlag = 1;
|
||||
loader::play_sound(SoundIndex4);
|
||||
render::sprite_set_bitmap(RenderSprite, static_cast<gdrv_bitmap8*>(ListBitmap->Get(0)));
|
||||
break;
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
#include "TCollisionComponent.h"
|
||||
#include "TTableLayer.h"
|
||||
|
||||
TCircle::TCircle(TCollisionComponent* collComp, char* someFlagPtr, unsigned visualFlag, vector_type* center,
|
||||
float radius): TEdgeSegment(collComp, someFlagPtr, visualFlag)
|
||||
TCircle::TCircle(TCollisionComponent* collComp, char* activeFlag, unsigned collisionGroup, vector_type* center,
|
||||
float radius): TEdgeSegment(collComp, activeFlag, collisionGroup)
|
||||
{
|
||||
Circle.RadiusSq = radius * radius;
|
||||
Circle.Center = *center;
|
||||
|
||||
@@ -8,7 +8,7 @@ class TCircle :
|
||||
public:
|
||||
circle_type Circle;
|
||||
|
||||
TCircle(TCollisionComponent* collComp, char* someFlagPtr, unsigned int visualFlag, vector_type* center,
|
||||
TCircle(TCollisionComponent* collComp, char* activeFlag, unsigned int collisionGroup, vector_type* center,
|
||||
float radius);
|
||||
float FindCollisionDistance(ray_type* ray) override;
|
||||
void EdgeCollision(TBall* ball, float coef) override;
|
||||
|
||||
@@ -13,9 +13,9 @@ TCollisionComponent::TCollisionComponent(TPinballTable* table, int groupIndex, b
|
||||
visualStruct visual{};
|
||||
|
||||
EdgeList = new objlist_class(4, 4);
|
||||
UnknownBaseFlag2 = 1;
|
||||
ActiveFlag = 1;
|
||||
if (GroupName != nullptr)
|
||||
UnknownBaseFlag1 = 1;
|
||||
UnusedBaseFlag = 1;
|
||||
if (groupIndex <= 0)
|
||||
{
|
||||
loader::default_vsi(&visual);
|
||||
@@ -27,7 +27,7 @@ TCollisionComponent::TCollisionComponent(TPinballTable* table, int groupIndex, b
|
||||
{
|
||||
float offset = table->CollisionCompOffset;
|
||||
float* floatArr = loader::query_float_attribute(groupIndex, 0, 600);
|
||||
TEdgeSegment::install_wall(floatArr, this, &UnknownBaseFlag2, visual.Flag, offset, 0);
|
||||
TEdgeSegment::install_wall(floatArr, this, &ActiveFlag, visual.CollisionGroup, offset, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@ TDemo::TDemo(TPinballTable* table, int groupIndex)
|
||||
FlipLeftTimer = 0;
|
||||
FlipRightTimer = 0;
|
||||
MessageField = 0;
|
||||
UnknownBaseFlag1 = 0;
|
||||
UnknownBaseFlag2 = 0;
|
||||
UnusedBaseFlag = 0;
|
||||
ActiveFlag = 0;
|
||||
FlipRightFlag = 0;
|
||||
FlipLeftFlag = 0;
|
||||
table->Demo = this;
|
||||
@@ -41,19 +41,19 @@ TDemo::TDemo(TPinballTable* table, int groupIndex)
|
||||
}
|
||||
loader::query_visual(groupIndex, 0, &visual);
|
||||
auto v5 = loader::query_float_attribute(groupIndex, 0, 1400);
|
||||
Edge1 = TEdgeSegment::install_wall(v5, this, &UnknownBaseFlag2, visual.Flag, 0.0, 1400);
|
||||
Edge1 = TEdgeSegment::install_wall(v5, this, &ActiveFlag, visual.CollisionGroup, 0.0, 1400);
|
||||
|
||||
auto v6 = loader::query_float_attribute(groupIndex, 0, 1401);
|
||||
TEdgeSegment::install_wall(v6, this, &UnknownBaseFlag2, visual.Flag, 0.0, 1401);
|
||||
TEdgeSegment::install_wall(v6, this, &ActiveFlag, visual.CollisionGroup, 0.0, 1401);
|
||||
|
||||
auto v7 = loader::query_float_attribute(groupIndex, 0, 1402);
|
||||
Edge2 = TEdgeSegment::install_wall(v7, this, &UnknownBaseFlag2, visual.Flag, 0.0, 1402);
|
||||
Edge2 = TEdgeSegment::install_wall(v7, this, &ActiveFlag, visual.CollisionGroup, 0.0, 1402);
|
||||
|
||||
auto v8 = loader::query_float_attribute(groupIndex, 0, 1403);
|
||||
TEdgeSegment::install_wall(v8, this, &UnknownBaseFlag2, visual.Flag, 0.0, 1403);
|
||||
TEdgeSegment::install_wall(v8, this, &ActiveFlag, visual.CollisionGroup, 0.0, 1403);
|
||||
|
||||
auto v9 = loader::query_float_attribute(groupIndex, 0, 1404);
|
||||
Edge3 = TEdgeSegment::install_wall(v9, this, &UnknownBaseFlag2, visual.Flag, table->CollisionCompOffset, 1404);
|
||||
Edge3 = TEdgeSegment::install_wall(v9, this, &ActiveFlag, visual.CollisionGroup, table->CollisionCompOffset, 1404);
|
||||
}
|
||||
|
||||
int TDemo::Message(int code, float value)
|
||||
@@ -69,7 +69,7 @@ int TDemo::Message(int code, float value)
|
||||
if (RestartGameTimer)
|
||||
timer::kill(RestartGameTimer);
|
||||
RestartGameTimer = 0;
|
||||
if (UnknownBaseFlag2 != 0)
|
||||
if (ActiveFlag != 0)
|
||||
RestartGameTimer = timer::set(5.0, this, NewGameRestartTimer);
|
||||
break;
|
||||
case 1024:
|
||||
|
||||
@@ -67,7 +67,7 @@ int TEdgeManager::TestGridBox(int x, int y, float* distPtr, TEdgeSegment** edgeD
|
||||
for (auto index = edgeBox->EdgeList->Count() - 1; index >= 0; --index)
|
||||
{
|
||||
auto edge = static_cast<TEdgeSegment*>(edgeBox->EdgeList->Get(index));
|
||||
if (!edge->ProcessedFlag && *edge->PinbCompFlag2Ptr && (edge->VisualFlag & ray->FieldFlag))
|
||||
if (!edge->ProcessedFlag && *edge->ActiveFlag && (edge->CollisionGroup & ray->FieldFlag))
|
||||
{
|
||||
if (!ball->already_hit(edge))
|
||||
{
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
#include "TCollisionComponent.h"
|
||||
#include "TLine.h"
|
||||
|
||||
TEdgeSegment::TEdgeSegment(TCollisionComponent* collComp, char* someFlag, unsigned visualFlag)
|
||||
TEdgeSegment::TEdgeSegment(TCollisionComponent* collComp, char* activeFlag, unsigned collisionGroup)
|
||||
{
|
||||
CollisionComponent = collComp;
|
||||
PinbCompFlag2Ptr = someFlag;
|
||||
VisualFlag = visualFlag;
|
||||
ActiveFlag = activeFlag;
|
||||
CollisionGroup = collisionGroup;
|
||||
ProcessedFlag = 0;
|
||||
}
|
||||
|
||||
@@ -18,9 +18,8 @@ void TEdgeSegment::port_draw()
|
||||
{
|
||||
}
|
||||
|
||||
TEdgeSegment* TEdgeSegment::install_wall(float* floatArr, TCollisionComponent* collComp, char* flagPtr,
|
||||
unsigned int visual_flag,
|
||||
float offset, int wallValue)
|
||||
TEdgeSegment* TEdgeSegment::install_wall(float* floatArr, TCollisionComponent* collComp, char* activeFlagPtr,
|
||||
unsigned int collisionGroup, float offset, int wallValue)
|
||||
{
|
||||
vector_type center{}, start{}, end{}, prevCenter{}, vec1{}, vec2{}, dstVec{};
|
||||
TEdgeSegment* edge = nullptr;
|
||||
@@ -33,7 +32,7 @@ TEdgeSegment* TEdgeSegment::install_wall(float* floatArr, TCollisionComponent* c
|
||||
center.X = floatArr[1];
|
||||
center.Y = floatArr[2];
|
||||
auto radius = offset + floatArr[3];
|
||||
auto circle = new TCircle(collComp, flagPtr, visual_flag, ¢er, radius);
|
||||
auto circle = new TCircle(collComp, activeFlagPtr, collisionGroup, ¢er, radius);
|
||||
edge = circle;
|
||||
|
||||
if (circle)
|
||||
@@ -51,7 +50,7 @@ TEdgeSegment* TEdgeSegment::install_wall(float* floatArr, TCollisionComponent* c
|
||||
start.Y = floatArr[2];
|
||||
end.X = floatArr[3];
|
||||
end.Y = floatArr[4];
|
||||
auto line = new TLine(collComp, flagPtr, visual_flag, &start, &end);
|
||||
auto line = new TLine(collComp, activeFlagPtr, collisionGroup, &start, &end);
|
||||
edge = line;
|
||||
|
||||
if (line)
|
||||
@@ -99,7 +98,7 @@ TEdgeSegment* TEdgeSegment::install_wall(float* floatArr, TCollisionComponent* c
|
||||
dstVec.Z < 0.0 && offset < 0.0)
|
||||
{
|
||||
float radius = offset * 1.001f;
|
||||
auto circle = new TCircle(collComp, flagPtr, visual_flag, ¢er, radius);
|
||||
auto circle = new TCircle(collComp, activeFlagPtr, collisionGroup, ¢er, radius);
|
||||
|
||||
if (circle)
|
||||
{
|
||||
@@ -114,7 +113,7 @@ TEdgeSegment* TEdgeSegment::install_wall(float* floatArr, TCollisionComponent* c
|
||||
start.Y = floatArrPtr[1];
|
||||
end.X = floatArrPtr[2];
|
||||
end.Y = floatArrPtr[3];
|
||||
auto line = new TLine(collComp, flagPtr, visual_flag, &start, &end);
|
||||
auto line = new TLine(collComp, activeFlagPtr, collisionGroup, &start, &end);
|
||||
edge = line;
|
||||
|
||||
if (line)
|
||||
|
||||
@@ -14,12 +14,12 @@ class TEdgeSegment
|
||||
{
|
||||
public:
|
||||
TCollisionComponent* CollisionComponent;
|
||||
char* PinbCompFlag2Ptr;
|
||||
char* ActiveFlag;
|
||||
char ProcessedFlag;
|
||||
void* WallValue;
|
||||
int VisualFlag;
|
||||
unsigned int CollisionGroup;
|
||||
|
||||
TEdgeSegment(TCollisionComponent* collComp, char* someFlag, unsigned int visualFlag);
|
||||
TEdgeSegment(TCollisionComponent* collComp, char* activeFlag, unsigned int collisionGroup);
|
||||
virtual ~TEdgeSegment() = default;
|
||||
|
||||
virtual void EdgeCollision(TBall* ball, float coef) = 0;
|
||||
@@ -27,6 +27,6 @@ public:
|
||||
virtual void place_in_grid() = 0;
|
||||
virtual float FindCollisionDistance(ray_type* ray) = 0;
|
||||
|
||||
static TEdgeSegment* install_wall(float* floatArr, TCollisionComponent* collComp, char* flagPtr,
|
||||
unsigned int visual_flag, float offset, int wallValue);
|
||||
static TEdgeSegment* install_wall(float* floatArr, TCollisionComponent* collComp, char* activeFlagPtr,
|
||||
unsigned int collisionGroup, float offset, int wallValue);
|
||||
};
|
||||
|
||||
@@ -23,14 +23,14 @@ TFlagSpinner::TFlagSpinner(TPinballTable* table, int groupIndex) : TCollisionCom
|
||||
end.Y = visual.FloatArr[1];
|
||||
start.X = visual.FloatArr[2];
|
||||
start.Y = visual.FloatArr[3];
|
||||
auto line = new TLine(this, &UnknownBaseFlag2, visual.Flag, &start, &end);
|
||||
auto line = new TLine(this, &ActiveFlag, visual.CollisionGroup, &start, &end);
|
||||
if (line)
|
||||
{
|
||||
line->place_in_grid();
|
||||
EdgeList->Add(line);
|
||||
}
|
||||
|
||||
line = new TLine(this, &UnknownBaseFlag2, visual.Flag, &end, &start);
|
||||
line = new TLine(this, &ActiveFlag, visual.CollisionGroup, &end, &start);
|
||||
PrevCollider = line;
|
||||
if (line)
|
||||
{
|
||||
|
||||
@@ -32,8 +32,8 @@ TFlipper::TFlipper(TPinballTable* table, int groupIndex) : TCollisionComponent(t
|
||||
auto origin = reinterpret_cast<vector_type*>(loader::query_float_attribute(groupIndex, 0, 800));
|
||||
auto flipperEdge = new TFlipperEdge(
|
||||
this,
|
||||
&UnknownBaseFlag2,
|
||||
visual.Flag,
|
||||
&ActiveFlag,
|
||||
visual.CollisionGroup,
|
||||
table,
|
||||
origin,
|
||||
vecT1,
|
||||
|
||||
@@ -11,9 +11,9 @@ vector_type TFlipperEdge::A1, TFlipperEdge::A2, TFlipperEdge::B1, TFlipperEdge::
|
||||
line_type TFlipperEdge::lineA, TFlipperEdge::lineB;
|
||||
circle_type TFlipperEdge::circlebase, TFlipperEdge::circleT1;
|
||||
|
||||
TFlipperEdge::TFlipperEdge(TCollisionComponent* collComp, char* someFlag, unsigned int visualFlag, TPinballTable* table,
|
||||
TFlipperEdge::TFlipperEdge(TCollisionComponent* collComp, char* activeFlag, unsigned int collisionGroup, TPinballTable* table,
|
||||
vector_type* origin, vector_type* vecT1, vector_type* vecT2, float bmpCoef1, float bmpCoef2,
|
||||
float collMult, float elasticity, float smoothness): TEdgeSegment(collComp, someFlag, visualFlag)
|
||||
float collMult, float elasticity, float smoothness): TEdgeSegment(collComp, activeFlag, collisionGroup)
|
||||
{
|
||||
vector_type crossProd{}, vecDir1{}, vecDir2{};
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ class TPinballTable;
|
||||
class TFlipperEdge : public TEdgeSegment
|
||||
{
|
||||
public:
|
||||
TFlipperEdge(TCollisionComponent* collComp, char* someFlag, unsigned int visualFlag, TPinballTable* table,
|
||||
TFlipperEdge(TCollisionComponent* collComp, char* activeFlag, unsigned int collisionGroup, TPinballTable* table,
|
||||
vector_type* origin, vector_type* vecT1, vector_type* vecT2, float bmpCoef1, float bmpCoef2, float collMult,
|
||||
float elasticity, float smoothness);
|
||||
void port_draw() override;
|
||||
|
||||
@@ -14,7 +14,7 @@ TGate::TGate(TPinballTable* table, int groupIndex) : TCollisionComponent(table,
|
||||
loader::query_visual(groupIndex, 0, &visual);
|
||||
SoundIndex4 = visual.SoundIndex4;
|
||||
SoundIndex3 = visual.SoundIndex3;
|
||||
UnknownBaseFlag2 = 1;
|
||||
ActiveFlag = 1;
|
||||
render::sprite_set_bitmap(RenderSprite, static_cast<gdrv_bitmap8*>(ListBitmap->Get(0)));
|
||||
control::handler(1024, this);
|
||||
}
|
||||
@@ -25,13 +25,13 @@ int TGate::Message(int code, float value)
|
||||
{
|
||||
if (code == 53)
|
||||
{
|
||||
UnknownBaseFlag2 = 0;
|
||||
ActiveFlag = 0;
|
||||
render::sprite_set_bitmap(RenderSprite, nullptr);
|
||||
loader::play_sound(SoundIndex3);
|
||||
}
|
||||
else if (code == 54 || code == 1024)
|
||||
{
|
||||
UnknownBaseFlag2 = 1;
|
||||
ActiveFlag = 1;
|
||||
render::sprite_set_bitmap(RenderSprite, static_cast<gdrv_bitmap8*>(ListBitmap->Get(0)));
|
||||
if (code == 54)
|
||||
loader::play_sound(SoundIndex4);
|
||||
|
||||
@@ -38,7 +38,7 @@ THole::THole(TPinballTable* table, int groupIndex) : TCollisionComponent(table,
|
||||
if (Circle.RadiusSq == 0.0)
|
||||
Circle.RadiusSq = 0.001f;
|
||||
|
||||
auto tCircle = new TCircle(this, &UnknownBaseFlag2, visual.Flag, reinterpret_cast<vector_type*>(visual.FloatArr),
|
||||
auto tCircle = new TCircle(this, &ActiveFlag, visual.CollisionGroup, reinterpret_cast<vector_type*>(visual.FloatArr),
|
||||
Circle.RadiusSq);
|
||||
if (tCircle)
|
||||
{
|
||||
@@ -55,9 +55,9 @@ THole::THole(TPinballTable* table, int groupIndex) : TCollisionComponent(table,
|
||||
circle.Center.Y = Circle.Center.Y;
|
||||
circle.Center.Z = Circle.Center.Z;
|
||||
|
||||
Field.Flag2Ptr = &UnknownBaseFlag2;
|
||||
Field.Flag2Ptr = &ActiveFlag;
|
||||
Field.CollisionComp = this;
|
||||
Field.Mask = visual.Flag;
|
||||
Field.Mask = visual.CollisionGroup;
|
||||
TTableLayer::edges_insert_circle(&circle, nullptr, &Field);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ TKickout::TKickout(TPinballTable* table, int groupIndex, bool someFlag): TCollis
|
||||
|
||||
NotSomeFlag = !someFlag;
|
||||
if (!someFlag)
|
||||
UnknownBaseFlag2 = 0;
|
||||
ActiveFlag = 0;
|
||||
TimerTime1 = 1.5;
|
||||
TimerTime2 = 0.05f;
|
||||
MessageField = 0;
|
||||
@@ -35,7 +35,7 @@ TKickout::TKickout(TPinballTable* table, int groupIndex, bool someFlag): TCollis
|
||||
Circle.RadiusSq = *loader::query_float_attribute(groupIndex, 0, 306) * visual.FloatArr[2];
|
||||
if (Circle.RadiusSq == 0.0)
|
||||
Circle.RadiusSq = 0.001f;
|
||||
auto tCircle = new TCircle(this, &UnknownBaseFlag2, visual.Flag,
|
||||
auto tCircle = new TCircle(this, &ActiveFlag, visual.CollisionGroup,
|
||||
reinterpret_cast<vector_type*>(visual.FloatArr), Circle.RadiusSq);
|
||||
if (tCircle)
|
||||
{
|
||||
@@ -54,9 +54,9 @@ TKickout::TKickout(TPinballTable* table, int groupIndex, bool someFlag): TCollis
|
||||
circle.Center.X = Circle.Center.X;
|
||||
circle.Center.Y = Circle.Center.Y;
|
||||
circle.Center.Z = Circle.Center.Z;
|
||||
Field.Flag2Ptr = &UnknownBaseFlag2;
|
||||
Field.Flag2Ptr = &ActiveFlag;
|
||||
Field.CollisionComp = this;
|
||||
Field.Mask = visual.Flag;
|
||||
Field.Mask = visual.CollisionGroup;
|
||||
TTableLayer::edges_insert_circle(&circle, nullptr, &Field);
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ int TKickout::Message(int code, float value)
|
||||
break;
|
||||
case 1011:
|
||||
if (NotSomeFlag)
|
||||
UnknownBaseFlag2 = 0;
|
||||
ActiveFlag = 0;
|
||||
break;
|
||||
case 1024:
|
||||
if (KickFlag1)
|
||||
@@ -84,7 +84,7 @@ int TKickout::Message(int code, float value)
|
||||
TimerExpired(0, this);
|
||||
}
|
||||
if (NotSomeFlag)
|
||||
UnknownBaseFlag2 = 0;
|
||||
ActiveFlag = 0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -156,7 +156,7 @@ void TKickout::TimerExpired(int timerId, void* caller)
|
||||
kick->Ball->Position.Z = kick->OriginalBallZ;
|
||||
TBall::throw_ball(kick->Ball, &kick->BallAcceleration, kick->ThrowAngleMult, kick->ThrowSpeedMult1,
|
||||
kick->ThrowSpeedMult2);
|
||||
kick->UnknownBaseFlag2 = 0;
|
||||
kick->ActiveFlag = 0;
|
||||
kick->Ball = nullptr;
|
||||
loader::play_sound(kick->HardHitSoundId);
|
||||
}
|
||||
@@ -167,6 +167,6 @@ void TKickout::ResetTimerExpired(int timerId, void* caller)
|
||||
{
|
||||
auto kick = static_cast<TKickout*>(caller);
|
||||
if (!kick->NotSomeFlag)
|
||||
kick->UnknownBaseFlag2 = 1;
|
||||
kick->ActiveFlag = 1;
|
||||
kick->Timer = 0;
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ int TLight::Message(int code, float value)
|
||||
FlasherActive = 1;
|
||||
FlasherFlag2 = 0;
|
||||
FlasherFlag1 = 0;
|
||||
Unknown13 = 0;
|
||||
TurnOffAfterFlashingFg = 0;
|
||||
flasher_start(&Flasher, BmpIndex1);
|
||||
}
|
||||
break;
|
||||
@@ -104,7 +104,7 @@ int TLight::Message(int code, float value)
|
||||
flasher_start(&Flasher, BmpIndex1);
|
||||
FlasherActive = 1;
|
||||
FlasherFlag2 = 0;
|
||||
Unknown13 = 0;
|
||||
TurnOffAfterFlashingFg = 0;
|
||||
FlasherFlag1 = 0;
|
||||
schedule_timeout(value);
|
||||
break;
|
||||
@@ -191,7 +191,7 @@ int TLight::Message(int code, float value)
|
||||
render::sprite_set_bitmap(RenderSprite, Flasher.BmpArr[BmpIndex1]);
|
||||
break;
|
||||
case 15:
|
||||
Unknown13 = 0;
|
||||
TurnOffAfterFlashingFg = 0;
|
||||
if (Timer2)
|
||||
timer::kill(Timer2);
|
||||
Timer2 = 0;
|
||||
@@ -203,7 +203,7 @@ int TLight::Message(int code, float value)
|
||||
timer::kill(Timer2);
|
||||
Timer2 = 0;
|
||||
Message(7, value);
|
||||
Unknown13 = 1;
|
||||
TurnOffAfterFlashingFg = 1;
|
||||
break;
|
||||
case 17:
|
||||
Message(static_cast<int>(floor(value)) != 0, 0.0);
|
||||
@@ -252,7 +252,7 @@ void TLight::Reset()
|
||||
FlasherFlag1 = 0;
|
||||
FlasherFlag2 = 0;
|
||||
FlasherActive = 0;
|
||||
Unknown13 = 0;
|
||||
TurnOffAfterFlashingFg = 0;
|
||||
render::sprite_set_bitmap(RenderSprite, nullptr);
|
||||
Flasher.Sprite = RenderSprite;
|
||||
Flasher.BmpArr[0] = nullptr;
|
||||
@@ -284,9 +284,9 @@ void TLight::TimerExpired(int timerId, void* caller)
|
||||
light->FlasherFlag2 = 0;
|
||||
light->FlasherActive = 0;
|
||||
light->Timer1 = 0;
|
||||
if (light->Unknown13 != 0)
|
||||
if (light->TurnOffAfterFlashingFg != 0)
|
||||
{
|
||||
light->Unknown13 = 0;
|
||||
light->TurnOffAfterFlashingFg = 0;
|
||||
light->Message(20, 0.0);
|
||||
}
|
||||
if (light->Control)
|
||||
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
int FlasherActive;
|
||||
int FlasherFlag1;
|
||||
int FlasherFlag2;
|
||||
int Unknown13;
|
||||
int TurnOffAfterFlashingFg;
|
||||
int BmpIndex2;
|
||||
float FlasherDelay[2];
|
||||
int Timer1;
|
||||
|
||||
@@ -24,7 +24,7 @@ int TLightRollover::Message(int code, float value)
|
||||
{
|
||||
if (code == 1024)
|
||||
{
|
||||
UnknownBaseFlag2 = 1;
|
||||
ActiveFlag = 1;
|
||||
RolloverFlag = 0;
|
||||
if (Timer)
|
||||
timer::kill(Timer);
|
||||
@@ -47,7 +47,7 @@ void TLightRollover::Collision(TBall* ball, vector_type* nextPosition, vector_ty
|
||||
if (RolloverFlag)
|
||||
{
|
||||
timer::set(0.1f, this, TimerExpired);
|
||||
UnknownBaseFlag2 = 0;
|
||||
ActiveFlag = 0;
|
||||
RolloverFlag = RolloverFlag == 0;
|
||||
if (Timer == 0)
|
||||
Timer = timer::set(FloatArr, this, delay_expired);
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
#include "TTableLayer.h"
|
||||
|
||||
|
||||
TLine::TLine(TCollisionComponent* collCmp, char* flagPtr, unsigned int visualFlag, float x0, float y0, float x1,
|
||||
float y1): TEdgeSegment(collCmp, flagPtr, visualFlag)
|
||||
TLine::TLine(TCollisionComponent* collCmp, char* activeFlag, unsigned int collisionGroup, float x0, float y0, float x1,
|
||||
float y1): TEdgeSegment(collCmp, activeFlag, collisionGroup)
|
||||
{
|
||||
X0 = x0;
|
||||
Y0 = y0;
|
||||
@@ -14,8 +14,8 @@ TLine::TLine(TCollisionComponent* collCmp, char* flagPtr, unsigned int visualFla
|
||||
maths::line_init(&Line, x0, y0, x1, y1);
|
||||
}
|
||||
|
||||
TLine::TLine(TCollisionComponent* collCmp, char* flagPtr, unsigned int visualFlag, struct vector_type* start,
|
||||
struct vector_type* end) : TEdgeSegment(collCmp, flagPtr, visualFlag)
|
||||
TLine::TLine(TCollisionComponent* collCmp, char* activeFlag, unsigned int collisionGroup, struct vector_type* start,
|
||||
struct vector_type* end) : TEdgeSegment(collCmp, activeFlag, collisionGroup)
|
||||
{
|
||||
X0 = start->X;
|
||||
Y0 = start->Y;
|
||||
|
||||
@@ -8,8 +8,8 @@ class TLine :
|
||||
public:
|
||||
line_type Line;
|
||||
float X0, Y0, X1, Y1;
|
||||
TLine(TCollisionComponent* collCmp, char* flagPtr, unsigned int visualFlag, float x0, float y0, float x1, float y1);
|
||||
TLine(TCollisionComponent* collCmp, char* flagPtr, unsigned int visualFlag, vector_type* start, vector_type* end);
|
||||
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);
|
||||
void Offset(float offset);
|
||||
float FindCollisionDistance(ray_type* ray) override;
|
||||
void EdgeCollision(TBall* ball, float coef) override;
|
||||
|
||||
@@ -22,7 +22,7 @@ TOneway::TOneway(TPinballTable* table, int groupIndex) : TCollisionComponent(tab
|
||||
linePt1.X = visual.FloatArr[2];
|
||||
linePt1.Y = visual.FloatArr[3];
|
||||
|
||||
auto line = new TLine(this, &UnknownBaseFlag2, visual.Flag, &linePt2, &linePt1);
|
||||
auto line = new TLine(this, &ActiveFlag, visual.CollisionGroup, &linePt2, &linePt1);
|
||||
if (line)
|
||||
{
|
||||
line->Offset(table->CollisionCompOffset);
|
||||
@@ -30,7 +30,7 @@ TOneway::TOneway(TPinballTable* table, int groupIndex) : TCollisionComponent(tab
|
||||
EdgeList->Add(line);
|
||||
}
|
||||
|
||||
line = new TLine(this, &UnknownBaseFlag2, visual.Flag, &linePt1, &linePt2);
|
||||
line = new TLine(this, &ActiveFlag, visual.CollisionGroup, &linePt1, &linePt2);
|
||||
Line = line;
|
||||
if (line)
|
||||
{
|
||||
|
||||
@@ -11,8 +11,8 @@ TPinballComponent::TPinballComponent(TPinballTable* table, int groupIndex, bool
|
||||
visualStruct visual{};
|
||||
|
||||
MessageField = 0;
|
||||
UnknownBaseFlag1 = 0;
|
||||
UnknownBaseFlag2 = 0;
|
||||
UnusedBaseFlag = 0;
|
||||
ActiveFlag = 0;
|
||||
PinballTable = table;
|
||||
RenderSprite = nullptr;
|
||||
ListBitmap = nullptr;
|
||||
|
||||
@@ -26,8 +26,8 @@ public:
|
||||
void* operator new(size_t Size);
|
||||
void operator delete(void* p);
|
||||
|
||||
__int8 UnknownBaseFlag1;
|
||||
__int8 UnknownBaseFlag2;
|
||||
__int8 UnusedBaseFlag;
|
||||
__int8 ActiveFlag;
|
||||
int MessageField;
|
||||
char* GroupName;
|
||||
int Unknown4;
|
||||
|
||||
@@ -54,7 +54,7 @@ TPinballTable::TPinballTable(): TPinballComponent(nullptr, -1, false)
|
||||
ScoreBallcount = nullptr;
|
||||
ScorePlayerNumber1 = nullptr;
|
||||
BallInSink = 0;
|
||||
UnknownBaseFlag2 = 1;
|
||||
ActiveFlag = 1;
|
||||
TiltLockFlag = 0;
|
||||
EndGameTimeoutTimer = 0;
|
||||
LightShowTimer = 0;
|
||||
@@ -66,7 +66,7 @@ TPinballTable::TPinballTable(): TPinballComponent(nullptr, -1, false)
|
||||
auto ballObj = new TBall(this);
|
||||
BallList->Add(ballObj);
|
||||
if (ballObj)
|
||||
ballObj->UnknownBaseFlag2 = 0;
|
||||
ballObj->ActiveFlag = 0;
|
||||
new TTableLayer(this);
|
||||
LightGroup = new TLightGroup(this, 0);
|
||||
|
||||
@@ -381,7 +381,7 @@ int TPinballTable::Message(int code, float value)
|
||||
LightGroup->Message(34, 0.0);
|
||||
LightGroup->Message(20, 0.0);
|
||||
Plunger->Message(1016, 0.0);
|
||||
if (Demo->UnknownBaseFlag2)
|
||||
if (Demo->ActiveFlag)
|
||||
rc_text = pinball::get_rc_string(30, 0);
|
||||
else
|
||||
rc_text = pinball::get_rc_string(26, 0);
|
||||
@@ -478,7 +478,7 @@ int TPinballTable::Message(int code, float value)
|
||||
if (PlayerCount <= 1)
|
||||
{
|
||||
char* textboxText;
|
||||
if (Demo->UnknownBaseFlag2)
|
||||
if (Demo->ActiveFlag)
|
||||
textboxText = pinball::get_rc_string(30, 0);
|
||||
else
|
||||
textboxText = pinball::get_rc_string(26, 0);
|
||||
@@ -522,25 +522,25 @@ int TPinballTable::Message(int code, float value)
|
||||
switch (nextPlayer)
|
||||
{
|
||||
case 0:
|
||||
if (Demo->UnknownBaseFlag2)
|
||||
if (Demo->ActiveFlag)
|
||||
textboxText = pinball::get_rc_string(30, 0);
|
||||
else
|
||||
textboxText = pinball::get_rc_string(26, 0);
|
||||
break;
|
||||
case 1:
|
||||
if (Demo->UnknownBaseFlag2)
|
||||
if (Demo->ActiveFlag)
|
||||
textboxText = pinball::get_rc_string(31, 0);
|
||||
else
|
||||
textboxText = pinball::get_rc_string(27, 0);
|
||||
break;
|
||||
case 2:
|
||||
if (Demo->UnknownBaseFlag2)
|
||||
if (Demo->ActiveFlag)
|
||||
textboxText = pinball::get_rc_string(32, 0);
|
||||
else
|
||||
textboxText = pinball::get_rc_string(28, 0);
|
||||
break;
|
||||
case 3:
|
||||
if (Demo->UnknownBaseFlag2)
|
||||
if (Demo->ActiveFlag)
|
||||
textboxText = pinball::get_rc_string(33, 0);
|
||||
else
|
||||
textboxText = pinball::get_rc_string(29, 0);
|
||||
|
||||
@@ -83,7 +83,7 @@ int TPlunger::Message(int code, float value)
|
||||
ball->Message(1024, 0.0);
|
||||
ball->Position.X = PinballTable->PlungerPositionX;
|
||||
ball->Position.Y = PinballTable->PlungerPositionY;
|
||||
ball->UnknownBaseFlag2 = 1;
|
||||
ball->ActiveFlag = 1;
|
||||
PinballTable->BallInSink = 0;
|
||||
pb::tilt_no_more();
|
||||
control::handler(code, this);
|
||||
|
||||
@@ -20,7 +20,7 @@ int TPopupTarget::Message(int code, float value)
|
||||
switch (code)
|
||||
{
|
||||
case 49:
|
||||
this->UnknownBaseFlag2 = 0;
|
||||
this->ActiveFlag = 0;
|
||||
render::sprite_set_bitmap(this->RenderSprite, nullptr);
|
||||
break;
|
||||
case 50:
|
||||
@@ -90,7 +90,7 @@ void TPopupTarget::TimerExpired(int timerId, void* caller)
|
||||
{
|
||||
auto target = static_cast<TPopupTarget*>(caller);
|
||||
target->Timer = 0;
|
||||
target->UnknownBaseFlag2 = 1;
|
||||
target->ActiveFlag = 1;
|
||||
render::sprite_set_bitmap(target->RenderSprite, static_cast<gdrv_bitmap8*>(target->ListBitmap->Get(0)));
|
||||
if (timerId)
|
||||
{
|
||||
|
||||
@@ -18,9 +18,9 @@ TRamp::TRamp(TPinballTable* table, int groupIndex) : TCollisionComponent(table,
|
||||
vector_type end{}, start{}, *end2, *start2, *start3, *end3;
|
||||
|
||||
MessageField = 0;
|
||||
UnknownBaseFlag1 = 1;
|
||||
UnusedBaseFlag = 1;
|
||||
loader::query_visual(groupIndex, 0, &visual);
|
||||
VisualFlag = visual.Flag;
|
||||
CollisionGroup = visual.CollisionGroup;
|
||||
|
||||
auto floatArr1 = loader::query_float_attribute(groupIndex, 0, 701);
|
||||
if (floatArr1)
|
||||
@@ -42,7 +42,7 @@ TRamp::TRamp(TPinballTable* table, int groupIndex) : TCollisionComponent(table,
|
||||
end.Y = floatArr4[3];
|
||||
start.X = floatArr4[4];
|
||||
start.Y = floatArr4[5];
|
||||
Line1 = new TLine(this, &UnknownBaseFlag2, 1 << static_cast<int>(floor(floatArr4[0])), &start, &end);
|
||||
Line1 = new TLine(this, &ActiveFlag, 1 << static_cast<int>(floor(floatArr4[0])), &start, &end);
|
||||
EdgeList->Add(Line1);
|
||||
if (Line1)
|
||||
{
|
||||
@@ -60,7 +60,7 @@ TRamp::TRamp(TPinballTable* table, int groupIndex) : TCollisionComponent(table,
|
||||
reinterpret_cast<wall_point_type*>(floatArr5WallPoint + 3),
|
||||
&end2,
|
||||
&start2);
|
||||
Line2 = new TLine(this, &UnknownBaseFlag2, VisualFlag, start2, end2);
|
||||
Line2 = new TLine(this, &ActiveFlag, CollisionGroup, start2, end2);
|
||||
EdgeList->Add(Line2);
|
||||
if (Line2)
|
||||
{
|
||||
@@ -78,7 +78,7 @@ TRamp::TRamp(TPinballTable* table, int groupIndex) : TCollisionComponent(table,
|
||||
reinterpret_cast<wall_point_type*>(floatArr6WallPoint + 3),
|
||||
&end3,
|
||||
&start3);
|
||||
Line3 = new TLine(this, &UnknownBaseFlag2, VisualFlag, start3, end3);
|
||||
Line3 = new TLine(this, &ActiveFlag, CollisionGroup, start3, end3);
|
||||
EdgeList->Add(Line3);
|
||||
if (Line3)
|
||||
{
|
||||
@@ -107,25 +107,25 @@ TRamp::TRamp(TPinballTable* table, int groupIndex) : TCollisionComponent(table,
|
||||
for (auto pt = 0; pt < 3; pt++)
|
||||
{
|
||||
auto point1 = pointOrder[pt], point2 = pointOrder[pt + 1];
|
||||
auto lineFlag = 0;
|
||||
auto collisionGroup = 0;
|
||||
if (point1 != end2 || point2 != start2)
|
||||
{
|
||||
if (point1 != end3 || point2 != start3)
|
||||
{
|
||||
lineFlag = visual.Flag;
|
||||
collisionGroup = visual.CollisionGroup;
|
||||
}
|
||||
else if (wall2Pt1_2)
|
||||
{
|
||||
lineFlag = Wall2PointFirst;
|
||||
collisionGroup = Wall2PointFirst;
|
||||
}
|
||||
}
|
||||
else if (wallPt1_2)
|
||||
{
|
||||
lineFlag = Wall1PointFirst;
|
||||
collisionGroup = Wall1PointFirst;
|
||||
}
|
||||
if (lineFlag)
|
||||
if (collisionGroup)
|
||||
{
|
||||
auto line = new TLine(this, &UnknownBaseFlag2, lineFlag, point1, point2);
|
||||
auto line = new TLine(this, &ActiveFlag, collisionGroup, point1, point2);
|
||||
EdgeList->Add(line);
|
||||
if (line)
|
||||
{
|
||||
@@ -141,9 +141,9 @@ TRamp::TRamp(TPinballTable* table, int groupIndex) : TCollisionComponent(table,
|
||||
PinballTable->GravityDirVectMult;
|
||||
}
|
||||
|
||||
Field.Flag2Ptr = &UnknownBaseFlag2;
|
||||
Field.Flag2Ptr = &ActiveFlag;
|
||||
Field.CollisionComp = this;
|
||||
Field.Mask = visual.Flag;
|
||||
Field.Mask = visual.CollisionGroup;
|
||||
|
||||
auto x1 = xMax;
|
||||
auto y1 = yMax;
|
||||
@@ -181,7 +181,7 @@ void TRamp::Collision(TBall* ball, vector_type* nextPosition, vector_type* direc
|
||||
ball->RampFieldForce.Y = plane->FieldForce.Y;
|
||||
ball->Position.Z = ball->Position.X * ball->CollisionOffset.X + ball->Position.Y * ball->CollisionOffset.Y +
|
||||
ball->Offset + ball->CollisionOffset.Z;
|
||||
ball->FieldFlag = VisualFlag;
|
||||
ball->FieldFlag = CollisionGroup;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ public:
|
||||
|
||||
int Scores[4];
|
||||
field_effect_type Field;
|
||||
int VisualFlag;
|
||||
int CollisionGroup;
|
||||
int RampFlag1;
|
||||
int RampPlaneCount;
|
||||
float BallFieldMult;
|
||||
|
||||
@@ -31,7 +31,7 @@ int TRollover::Message(int code, float value)
|
||||
{
|
||||
if (code == 1024)
|
||||
{
|
||||
this->UnknownBaseFlag2 = 1;
|
||||
this->ActiveFlag = 1;
|
||||
this->RolloverFlag = 0;
|
||||
if (this->ListBitmap)
|
||||
render::sprite_set_bitmap(this->RenderSprite, static_cast<gdrv_bitmap8*>(this->ListBitmap->Get(0)));
|
||||
@@ -52,7 +52,7 @@ void TRollover::Collision(TBall* ball, vector_type* nextPosition, vector_type* d
|
||||
if (RolloverFlag)
|
||||
{
|
||||
timer::set(0.1f, this, TimerExpired);
|
||||
UnknownBaseFlag2 = 0;
|
||||
ActiveFlag = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -87,13 +87,13 @@ void TRollover::build_walls(int groupIndex)
|
||||
|
||||
loader::query_visual(groupIndex, 0, &visual);
|
||||
float* arr1 = loader::query_float_attribute(groupIndex, 0, 600);
|
||||
TEdgeSegment::install_wall(arr1, this, &UnknownBaseFlag2, visual.Flag, 0.0, 600);
|
||||
TEdgeSegment::install_wall(arr1, this, &ActiveFlag, visual.CollisionGroup, 0.0, 600);
|
||||
float* arr2 = loader::query_float_attribute(groupIndex, 0, 603);
|
||||
TEdgeSegment::install_wall(arr2, this, &RolloverFlag, visual.Flag, 0.0, 603);
|
||||
TEdgeSegment::install_wall(arr2, this, &RolloverFlag, visual.CollisionGroup, 0.0, 603);
|
||||
}
|
||||
|
||||
void TRollover::TimerExpired(int timerId, void* caller)
|
||||
{
|
||||
auto roll = static_cast<TRollover*>(caller);
|
||||
roll->UnknownBaseFlag2 = 1;
|
||||
roll->ActiveFlag = 1;
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ void TSink::Collision(TBall* ball, vector_type* nextPosition, vector_type* direc
|
||||
}
|
||||
else
|
||||
{
|
||||
ball->UnknownBaseFlag2 = 0;
|
||||
ball->ActiveFlag = 0;
|
||||
render::sprite_set_bitmap(ball->RenderSprite, nullptr);
|
||||
loader::play_sound(SoundIndex4);
|
||||
control::handler(63, this);
|
||||
@@ -97,7 +97,7 @@ void TSink::TimerExpired(int timerId, void* caller)
|
||||
auto sink = static_cast<TSink*>(caller);
|
||||
auto ball = static_cast<TBall*>(sink->PinballTable->BallList->Get(0));
|
||||
ball->CollisionComp = nullptr;
|
||||
ball->UnknownBaseFlag2 = 1;
|
||||
ball->ActiveFlag = 1;
|
||||
ball->Position.X = sink->BallPosition.X;
|
||||
ball->Position.Y = sink->BallPosition.Y;
|
||||
TBall::throw_ball(ball, &sink->BallAcceleration, sink->ThrowAngleMult, sink->ThrowSpeedMult1,
|
||||
|
||||
@@ -26,13 +26,13 @@ int TSoloTarget::Message(int code, float value)
|
||||
{
|
||||
case 49:
|
||||
case 50:
|
||||
UnknownBaseFlag2 = code == 50;
|
||||
ActiveFlag = code == 50;
|
||||
break;
|
||||
case 1024:
|
||||
if (Timer)
|
||||
timer::kill(Timer);
|
||||
Timer = 0;
|
||||
UnknownBaseFlag2 = 1;
|
||||
ActiveFlag = 1;
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
@@ -40,7 +40,7 @@ int TSoloTarget::Message(int code, float value)
|
||||
|
||||
if (ListBitmap)
|
||||
{
|
||||
auto index = 1 - UnknownBaseFlag2;
|
||||
auto index = 1 - ActiveFlag;
|
||||
auto bmp = static_cast<gdrv_bitmap8*>(ListBitmap->Get(index));
|
||||
auto zMap = static_cast<zmap_header_type*>(ListZMap->Get(index));
|
||||
render::sprite_set(
|
||||
|
||||
@@ -77,8 +77,8 @@ TTableLayer::TTableLayer(TPinballTable* table): TCollisionComponent(table, -1, f
|
||||
for (auto visFloatArrCount = visual.FloatArrCount; visFloatArrCount > 0; visFloatArrCount--)
|
||||
{
|
||||
auto line = new TLine(this,
|
||||
&UnknownBaseFlag2,
|
||||
visual.Flag,
|
||||
&ActiveFlag,
|
||||
visual.CollisionGroup,
|
||||
visArrPtr[2],
|
||||
visArrPtr[3],
|
||||
visArrPtr[0],
|
||||
@@ -93,7 +93,7 @@ TTableLayer::TTableLayer(TPinballTable* table): TCollisionComponent(table, -1, f
|
||||
}
|
||||
|
||||
Field.Mask = -1;
|
||||
Field.Flag2Ptr = &UnknownBaseFlag2;
|
||||
Field.Flag2Ptr = &ActiveFlag;
|
||||
Field.CollisionComp = this;
|
||||
edges_insert_square(Unknown2F, Unknown1F, Unknown4F, Unknown3F, nullptr,
|
||||
&Field);
|
||||
|
||||
@@ -1917,7 +1917,7 @@ void control::GravityWellKickoutControl(int code, TPinballComponent* caller)
|
||||
sprintf_s(Buffer, pinball::get_rc_string(81, 0), addedScore);
|
||||
control_info_text_box_tag.Component->Display(Buffer, 2.0);
|
||||
control_lite62_tag.Component->Message(20, 0.0);
|
||||
caller->UnknownBaseFlag2 = 0;
|
||||
caller->ActiveFlag = 0;
|
||||
auto duration = control_soundwave7_tag.Component->Play();
|
||||
caller->Message(55, duration);
|
||||
break;
|
||||
@@ -1935,11 +1935,11 @@ void control::GravityWellKickoutControl(int code, TPinballComponent* caller)
|
||||
}
|
||||
control_info_text_box_tag.Component->Display(Buffer, 2.0);
|
||||
control_lite62_tag.Component->Message(4, 0.0);
|
||||
control_kickout1_tag.Component->UnknownBaseFlag2 = 1;
|
||||
control_kickout1_tag.Component->ActiveFlag = 1;
|
||||
break;
|
||||
}
|
||||
case 1024:
|
||||
control_kickout1_tag.Component->UnknownBaseFlag2 = 0;
|
||||
control_kickout1_tag.Component->ActiveFlag = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -41,7 +41,7 @@ struct __declspec(align(4)) visualStruct
|
||||
float* FloatArr;
|
||||
int SoftHitSoundId;
|
||||
visualKickerStruct Kicker;
|
||||
int Flag;
|
||||
int CollisionGroup;
|
||||
int SoundIndex4;
|
||||
int SoundIndex3;
|
||||
gdrv_bitmap8* Bitmap;
|
||||
|
||||
@@ -74,7 +74,7 @@ void nudge::_nudge(float xDiff, float yDiff)
|
||||
for (auto index = 0; index < ballList->Count(); index++)
|
||||
{
|
||||
auto ball = static_cast<TBall*>(ballList->Get(index));
|
||||
if (ball->UnknownBaseFlag2 && !ball->CollisionComp)
|
||||
if (ball->ActiveFlag && !ball->CollisionComp)
|
||||
{
|
||||
ball->Acceleration.X = ball->Acceleration.X * ball->Speed;
|
||||
ball->Acceleration.Y = ball->Acceleration.Y * ball->Speed;
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
#include "gdrv.h"
|
||||
#include "memory.h"
|
||||
|
||||
short partman::_field_size[] = {
|
||||
short partman::_field_size[] =
|
||||
{
|
||||
2, -1, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0
|
||||
};
|
||||
|
||||
@@ -11,34 +12,31 @@ short partman::_field_size[] = {
|
||||
datFileStruct* partman::load_records(LPCSTR lpFileName)
|
||||
{
|
||||
_OFSTRUCT ReOpenBuff{};
|
||||
datFileHeader Buffer{};
|
||||
datFileHeader header{};
|
||||
dat8BitBmpHeader bmpHeader{};
|
||||
datFileStruct* datFile;
|
||||
int groupIndex, groupDataSize;
|
||||
datGroupData** groupDataBuf;
|
||||
|
||||
const HFILE fileHandle = OpenFile(lpFileName, &ReOpenBuff, 0);
|
||||
if (fileHandle == -1)
|
||||
return nullptr;
|
||||
_lread(fileHandle, &Buffer, 183u);
|
||||
if (lstrcmpA("PARTOUT(4.0)RESOURCE", Buffer.FileSignature))
|
||||
_lread(fileHandle, &header, 183u);
|
||||
if (lstrcmpA("PARTOUT(4.0)RESOURCE", header.FileSignature))
|
||||
{
|
||||
_lclose(fileHandle);
|
||||
return nullptr;
|
||||
}
|
||||
datFile = (datFileStruct*)memory::allocate(sizeof(datFileStruct));
|
||||
auto datFile = (datFileStruct*)memory::allocate(sizeof(datFileStruct));
|
||||
if (!datFile)
|
||||
{
|
||||
_lclose(fileHandle);
|
||||
return nullptr;
|
||||
}
|
||||
if (lstrlenA(Buffer.Description) <= 0)
|
||||
if (lstrlenA(header.Description) <= 0)
|
||||
{
|
||||
datFile->Description = nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
int lenOfStr = lstrlenA(Buffer.Description);
|
||||
int lenOfStr = lstrlenA(header.Description);
|
||||
auto descriptionBuf = static_cast<char*>(memory::allocate(lenOfStr + 1));
|
||||
datFile->Description = descriptionBuf;
|
||||
if (!descriptionBuf)
|
||||
@@ -47,12 +45,12 @@ datFileStruct* partman::load_records(LPCSTR lpFileName)
|
||||
memory::free(datFile);
|
||||
return nullptr;
|
||||
}
|
||||
lstrcpyA(descriptionBuf, Buffer.Description);
|
||||
lstrcpyA(descriptionBuf, header.Description);
|
||||
}
|
||||
|
||||
if (Buffer.Unknown)
|
||||
if (header.Unknown)
|
||||
{
|
||||
auto unknownBuf = static_cast<char*>(memory::allocate(Buffer.Unknown));
|
||||
auto unknownBuf = static_cast<char*>(memory::allocate(header.Unknown));
|
||||
if (!unknownBuf)
|
||||
{
|
||||
_lclose(fileHandle);
|
||||
@@ -61,11 +59,11 @@ datFileStruct* partman::load_records(LPCSTR lpFileName)
|
||||
memory::free(datFile);
|
||||
return nullptr;
|
||||
}
|
||||
_lread(fileHandle, static_cast<void*>(unknownBuf), Buffer.Unknown);
|
||||
_lread(fileHandle, static_cast<void*>(unknownBuf), header.Unknown);
|
||||
memory::free(unknownBuf);
|
||||
}
|
||||
|
||||
groupDataBuf = (datGroupData**)memory::allocate(sizeof(void*) * Buffer.NumberOfGroups);
|
||||
auto groupDataBuf = (datGroupData**)memory::allocate(sizeof(void*) * header.NumberOfGroups);
|
||||
datFile->GroupData = groupDataBuf;
|
||||
if (!groupDataBuf)
|
||||
{
|
||||
@@ -75,75 +73,70 @@ datFileStruct* partman::load_records(LPCSTR lpFileName)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
groupIndex = 0;
|
||||
if (Buffer.NumberOfGroups)
|
||||
bool abort = false;
|
||||
for (auto groupIndex = 0; !abort && groupIndex < header.NumberOfGroups; ++groupIndex)
|
||||
{
|
||||
do
|
||||
{
|
||||
char entryCount = _lread_char(fileHandle);
|
||||
if (entryCount <= 0)
|
||||
groupDataSize = 0;
|
||||
else
|
||||
groupDataSize = entryCount - 1;
|
||||
datFile->GroupData[groupIndex] = (datGroupData*)memory::allocate(
|
||||
sizeof(datEntryData) * groupDataSize + sizeof(datGroupData));
|
||||
datGroupData* groupData = datFile->GroupData[groupIndex];
|
||||
if (!groupData)
|
||||
break;
|
||||
int entryIndex = 0;
|
||||
groupData->EntryCount = entryCount;
|
||||
if (entryCount > 0)
|
||||
{
|
||||
datEntryData* entryData = groupData->Entries;
|
||||
do
|
||||
{
|
||||
auto entryType = static_cast<datFieldTypes>(_lread_char(fileHandle));
|
||||
entryData->EntryType = entryType;
|
||||
int fieldSize = _field_size[static_cast<int>(entryType)];
|
||||
if (fieldSize < 0)
|
||||
{
|
||||
fieldSize = _lread_long(fileHandle);
|
||||
}
|
||||
if (entryType == datFieldTypes::Bitmap8bit)
|
||||
{
|
||||
_hread(fileHandle, &bmpHeader, 14);
|
||||
auto bmp = (gdrv_bitmap8*)memory::allocate(sizeof(gdrv_bitmap8));
|
||||
entryData->Buffer = (char*)bmp;
|
||||
if (!bmp)
|
||||
goto LABEL_41;
|
||||
if (bmpHeader.Unknown2 & 2
|
||||
? gdrv::create_bitmap(bmp, bmpHeader.Width, bmpHeader.Height)
|
||||
: gdrv::create_raw_bitmap(bmp, bmpHeader.Width, bmpHeader.Height,
|
||||
bmpHeader.Unknown2 & 1))
|
||||
goto LABEL_41;
|
||||
_hread(fileHandle, bmp->BmpBufPtr1, bmpHeader.Size);
|
||||
bmp->XPosition = bmpHeader.XPosition;
|
||||
bmp->YPosition = bmpHeader.YPosition;
|
||||
}
|
||||
else
|
||||
{
|
||||
char* entryBuffer = static_cast<char*>(memory::allocate(fieldSize));
|
||||
entryData->Buffer = entryBuffer;
|
||||
if (!entryBuffer)
|
||||
goto LABEL_41;
|
||||
_hread(fileHandle, entryBuffer, fieldSize);
|
||||
}
|
||||
auto entryCount = _lread_char(fileHandle);
|
||||
auto groupDataSize = entryCount <= 0 ? 0 : entryCount - 1;
|
||||
auto groupData = reinterpret_cast<datGroupData*>(memory::allocate(
|
||||
sizeof(datEntryData) * groupDataSize + sizeof(datGroupData)));
|
||||
datFile->GroupData[groupIndex] = groupData;
|
||||
if (!groupData)
|
||||
break;
|
||||
|
||||
++entryIndex;
|
||||
entryData->FieldSize = fieldSize;
|
||||
datFile->NumberOfGroups = groupIndex + 1;
|
||||
++entryData;
|
||||
}
|
||||
while (entryIndex < entryCount);
|
||||
groupData->EntryCount = entryCount;
|
||||
datEntryData* entryData = groupData->Entries;
|
||||
for (auto entryIndex = 0; entryIndex < entryCount; ++entryIndex)
|
||||
{
|
||||
auto entryType = static_cast<datFieldTypes>(_lread_char(fileHandle));
|
||||
entryData->EntryType = entryType;
|
||||
int fieldSize = _field_size[static_cast<int>(entryType)];
|
||||
if (fieldSize < 0)
|
||||
{
|
||||
fieldSize = _lread_long(fileHandle);
|
||||
}
|
||||
++groupIndex;
|
||||
if (entryType == datFieldTypes::Bitmap8bit)
|
||||
{
|
||||
_hread(fileHandle, &bmpHeader, sizeof(dat8BitBmpHeader));
|
||||
auto bmp = reinterpret_cast<gdrv_bitmap8*>(memory::allocate(sizeof(gdrv_bitmap8)));
|
||||
entryData->Buffer = reinterpret_cast<char*>(bmp);
|
||||
if (!bmp)
|
||||
{
|
||||
abort = true;
|
||||
break;
|
||||
}
|
||||
if (bmpHeader.IsFlagSet(bmp8Flags::DibBitmap)
|
||||
? gdrv::create_bitmap(bmp, bmpHeader.Width, bmpHeader.Height)
|
||||
: gdrv::create_raw_bitmap(bmp, bmpHeader.Width, bmpHeader.Height,
|
||||
bmpHeader.IsFlagSet(bmp8Flags::RawBmpUnaligned)))
|
||||
{
|
||||
abort = true;
|
||||
break;
|
||||
}
|
||||
_hread(fileHandle, bmp->BmpBufPtr1, bmpHeader.Size);
|
||||
bmp->XPosition = bmpHeader.XPosition;
|
||||
bmp->YPosition = bmpHeader.YPosition;
|
||||
}
|
||||
else
|
||||
{
|
||||
char* entryBuffer = static_cast<char*>(memory::allocate(fieldSize));
|
||||
entryData->Buffer = entryBuffer;
|
||||
if (!entryBuffer)
|
||||
{
|
||||
abort = true;
|
||||
break;
|
||||
}
|
||||
_hread(fileHandle, entryBuffer, fieldSize);
|
||||
}
|
||||
|
||||
entryData->FieldSize = fieldSize;
|
||||
datFile->NumberOfGroups = groupIndex + 1;
|
||||
++entryData;
|
||||
}
|
||||
while (groupIndex < Buffer.NumberOfGroups);
|
||||
}
|
||||
|
||||
LABEL_41:
|
||||
_lclose(fileHandle);
|
||||
if (datFile->NumberOfGroups == Buffer.NumberOfGroups)
|
||||
if (datFile->NumberOfGroups == header.NumberOfGroups)
|
||||
return datFile;
|
||||
unload_records(datFile);
|
||||
return nullptr;
|
||||
|
||||
@@ -25,6 +25,13 @@ enum class datFieldTypes : __int16
|
||||
// 16 bpp bitmap(Heightmap ? )
|
||||
};
|
||||
|
||||
enum class bmp8Flags : unsigned char
|
||||
{
|
||||
RawBmpUnaligned = 1 << 0,
|
||||
DibBitmap = 1 << 1,
|
||||
};
|
||||
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
struct datFileHeader
|
||||
@@ -70,7 +77,12 @@ struct dat8BitBmpHeader
|
||||
__int16 XPosition;
|
||||
__int16 YPosition;
|
||||
int Size;
|
||||
char Unknown2;
|
||||
bmp8Flags Flags;
|
||||
|
||||
bool IsFlagSet(bmp8Flags flag)
|
||||
{
|
||||
return static_cast<char>(Flags) & static_cast<char>(flag);
|
||||
}
|
||||
};
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
@@ -146,7 +146,7 @@ void pb::mode_change(int mode)
|
||||
if (MainTable)
|
||||
{
|
||||
if (MainTable->Demo)
|
||||
MainTable->Demo->UnknownBaseFlag2 = 1;
|
||||
MainTable->Demo->ActiveFlag = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -157,7 +157,7 @@ void pb::mode_change(int mode)
|
||||
if (MainTable)
|
||||
{
|
||||
if (MainTable->Demo)
|
||||
MainTable->Demo->UnknownBaseFlag2 = 0;
|
||||
MainTable->Demo->ActiveFlag = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -260,7 +260,7 @@ void pb::timed_frame(float timeNow, float timeDelta, bool drawBalls)
|
||||
for (int i = 0; i < MainTable->BallList->Count(); i++)
|
||||
{
|
||||
auto ball = static_cast<TBall*>(MainTable->BallList->Get(i));
|
||||
if (ball->UnknownBaseFlag2 != 0)
|
||||
if (ball->ActiveFlag != 0)
|
||||
{
|
||||
auto collComp = ball->CollisionComp;
|
||||
if (collComp)
|
||||
@@ -270,7 +270,7 @@ void pb::timed_frame(float timeNow, float timeDelta, bool drawBalls)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (MainTable->UnknownBaseFlag2)
|
||||
if (MainTable->ActiveFlag)
|
||||
{
|
||||
vec2.X = 0.0;
|
||||
vec2.Y = 0.0;
|
||||
@@ -303,7 +303,7 @@ void pb::timed_frame(float timeNow, float timeDelta, bool drawBalls)
|
||||
for (int i = 0; i < MainTable->BallList->Count(); i++)
|
||||
{
|
||||
auto ball = static_cast<TBall*>(MainTable->BallList->Get(i));
|
||||
if (ball->UnknownBaseFlag2)
|
||||
if (ball->ActiveFlag)
|
||||
ball->Repaint();
|
||||
}
|
||||
}
|
||||
@@ -449,7 +449,7 @@ void pb::keydown(int key)
|
||||
for (auto index = 0; ;)
|
||||
{
|
||||
ball = static_cast<TBall*>(MainTable->BallList->Get(index));
|
||||
if (!ball->UnknownBaseFlag2)
|
||||
if (!ball->ActiveFlag)
|
||||
break;
|
||||
++index;
|
||||
if (index >= MainTable->BallList->Count())
|
||||
@@ -460,7 +460,7 @@ void pb::keydown(int key)
|
||||
}
|
||||
}
|
||||
ball->Position.X = 1.0;
|
||||
ball->UnknownBaseFlag2 = 1;
|
||||
ball->ActiveFlag = 1;
|
||||
ball->Position.Z = ball->Offset;
|
||||
ball->Position.Y = 1.0;
|
||||
ball->Acceleration.Z = 0.0;
|
||||
@@ -601,7 +601,7 @@ float pb::collide(float timeNow, float timeDelta, TBall* ball)
|
||||
ray_type ray{};
|
||||
vector_type positionMod{};
|
||||
|
||||
if (ball->UnknownBaseFlag2 && !ball->CollisionComp)
|
||||
if (ball->ActiveFlag && !ball->CollisionComp)
|
||||
{
|
||||
if (ball_speed_limit < ball->Speed)
|
||||
ball->Speed = ball_speed_limit;
|
||||
|
||||
Reference in New Issue
Block a user