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