Correct inheritance for TPinballComponent, TCollisionComponent.

This commit is contained in:
oz 2020-11-28 15:59:42 +03:00
parent a1678120f8
commit 62a63bbf2e
33 changed files with 282 additions and 252 deletions

View File

@ -26,6 +26,8 @@ int main()
auto dib = gdrv::DibCreate(8, 1, 1); auto dib = gdrv::DibCreate(8, 1, 1);
gdrv::DibSetUsage(dib, 0, 1); gdrv::DibSetUsage(dib, 0, 1);
render::init(0, 1, 2, 800, 600);
objlist_class d = objlist_class(2, 4); objlist_class d = objlist_class(2, 4);
for (int i = 0; i < 100; i++) for (int i = 0; i < 100; i++)
{ {

View File

@ -203,6 +203,7 @@
<ClInclude Include="TTextBox.h" /> <ClInclude Include="TTextBox.h" />
<ClInclude Include="TTimer.h" /> <ClInclude Include="TTimer.h" />
<ClInclude Include="TTripwire.h" /> <ClInclude Include="TTripwire.h" />
<ClInclude Include="TWall.h" />
<ClInclude Include="TZmapList.h" /> <ClInclude Include="TZmapList.h" />
<ClInclude Include="winmain.h" /> <ClInclude Include="winmain.h" />
<ClInclude Include="zdrv.h" /> <ClInclude Include="zdrv.h" />
@ -263,6 +264,7 @@
<ClCompile Include="TTextBox.cpp" /> <ClCompile Include="TTextBox.cpp" />
<ClCompile Include="TTimer.cpp" /> <ClCompile Include="TTimer.cpp" />
<ClCompile Include="TTripwire.cpp" /> <ClCompile Include="TTripwire.cpp" />
<ClCompile Include="TWall.cpp" />
<ClCompile Include="winmain.cpp" /> <ClCompile Include="winmain.cpp" />
<ClCompile Include="zdrv.cpp" /> <ClCompile Include="zdrv.cpp" />
</ItemGroup> </ItemGroup>

View File

@ -13,12 +13,6 @@
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter> </Filter>
<Filter Include="Header Files\PinballComponents">
<UniqueIdentifier>{9ee086c2-1a95-48fb-92d8-4b7e7f6682ff}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\PinballComponents">
<UniqueIdentifier>{33813da8-81ac-449c-b19a-9756272519b9}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\TEdgeSegment"> <Filter Include="Header Files\TEdgeSegment">
<UniqueIdentifier>{0aa40751-a44a-400e-8809-ee817161e8e0}</UniqueIdentifier> <UniqueIdentifier>{0aa40751-a44a-400e-8809-ee817161e8e0}</UniqueIdentifier>
</Filter> </Filter>
@ -31,6 +25,12 @@
<Filter Include="Header Files\TCollisionComponent"> <Filter Include="Header Files\TCollisionComponent">
<UniqueIdentifier>{7ed2796a-da4b-4edd-8783-53e45d8d1c88}</UniqueIdentifier> <UniqueIdentifier>{7ed2796a-da4b-4edd-8783-53e45d8d1c88}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Header Files\TPinballComponent">
<UniqueIdentifier>{9ee086c2-1a95-48fb-92d8-4b7e7f6682ff}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\TPinballComponent">
<UniqueIdentifier>{33813da8-81ac-449c-b19a-9756272519b9}</UniqueIdentifier>
</Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="pch.h"> <ClInclude Include="pch.h">
@ -54,101 +54,38 @@
<ClInclude Include="score.h"> <ClInclude Include="score.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="TDrain.h">
<Filter>Header Files\PinballComponents</Filter>
</ClInclude>
<ClInclude Include="TFlipper.h">
<Filter>Header Files\PinballComponents</Filter>
</ClInclude>
<ClInclude Include="TPinballComponent.h"> <ClInclude Include="TPinballComponent.h">
<Filter>Header Files\PinballComponents</Filter> <Filter>Header Files\TPinballComponent</Filter>
</ClInclude>
<ClInclude Include="TPinballTable.h">
<Filter>Header Files\PinballComponents</Filter>
</ClInclude>
<ClInclude Include="TPlunger.h">
<Filter>Header Files\PinballComponents</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="TBall.h"> <ClInclude Include="TBall.h">
<Filter>Header Files\PinballComponents</Filter> <Filter>Header Files\TPinballComponent</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="resource.h"> <ClInclude Include="resource.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="TBlocker.h">
<Filter>Header Files\PinballComponents</Filter>
</ClInclude>
<ClInclude Include="TBumper.h">
<Filter>Header Files\PinballComponents</Filter>
</ClInclude>
<ClInclude Include="TComponentGroup.h"> <ClInclude Include="TComponentGroup.h">
<Filter>Header Files\PinballComponents</Filter> <Filter>Header Files\TPinballComponent</Filter>
</ClInclude>
<ClInclude Include="TDemo.h">
<Filter>Header Files\PinballComponents</Filter>
</ClInclude>
<ClInclude Include="TFlagSpinner.h">
<Filter>Header Files\PinballComponents</Filter>
</ClInclude>
<ClInclude Include="TGate.h">
<Filter>Header Files\PinballComponents</Filter>
</ClInclude>
<ClInclude Include="THole.h">
<Filter>Header Files\PinballComponents</Filter>
</ClInclude>
<ClInclude Include="TKickback.h">
<Filter>Header Files\PinballComponents</Filter>
</ClInclude>
<ClInclude Include="TKickout.h">
<Filter>Header Files\PinballComponents</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="TLight.h"> <ClInclude Include="TLight.h">
<Filter>Header Files\PinballComponents</Filter> <Filter>Header Files\TPinballComponent</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="TLightBargraph.h"> <ClInclude Include="TLightBargraph.h">
<Filter>Header Files\PinballComponents</Filter> <Filter>Header Files\TPinballComponent</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="TLightGroup.h"> <ClInclude Include="TLightGroup.h">
<Filter>Header Files\PinballComponents</Filter> <Filter>Header Files\TPinballComponent</Filter>
</ClInclude>
<ClInclude Include="TLightRollover.h">
<Filter>Header Files\PinballComponents</Filter>
</ClInclude>
<ClInclude Include="TOneway.h">
<Filter>Header Files\PinballComponents</Filter>
</ClInclude>
<ClInclude Include="TPopupTarget.h">
<Filter>Header Files\PinballComponents</Filter>
</ClInclude>
<ClInclude Include="TRamp.h">
<Filter>Header Files\PinballComponents</Filter>
</ClInclude>
<ClInclude Include="TRollover.h">
<Filter>Header Files\PinballComponents</Filter>
</ClInclude>
<ClInclude Include="TSink.h">
<Filter>Header Files\PinballComponents</Filter>
</ClInclude>
<ClInclude Include="TSoloTarget.h">
<Filter>Header Files\PinballComponents</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="TSound.h"> <ClInclude Include="TSound.h">
<Filter>Header Files\PinballComponents</Filter> <Filter>Header Files\TPinballComponent</Filter>
</ClInclude>
<ClInclude Include="TTableLayer.h">
<Filter>Header Files\PinballComponents</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="TTextBox.h"> <ClInclude Include="TTextBox.h">
<Filter>Header Files\PinballComponents</Filter> <Filter>Header Files\TPinballComponent</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="TTimer.h"> <ClInclude Include="TTimer.h">
<Filter>Header Files\PinballComponents</Filter> <Filter>Header Files\TPinballComponent</Filter>
</ClInclude>
<ClInclude Include="TTripwire.h">
<Filter>Header Files\PinballComponents</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="TZmapList.h"> <ClInclude Include="TZmapList.h">
<Filter>Header Files\PinballComponents</Filter> <Filter>Header Files\TPinballComponent</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="memory.h"> <ClInclude Include="memory.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
@ -192,6 +129,72 @@
<ClInclude Include="TLine.h"> <ClInclude Include="TLine.h">
<Filter>Header Files\TEdgeSegment</Filter> <Filter>Header Files\TEdgeSegment</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="TWall.h">
<Filter>Header Files\TCollisionComponent</Filter>
</ClInclude>
<ClInclude Include="TBumper.h">
<Filter>Header Files\TCollisionComponent</Filter>
</ClInclude>
<ClInclude Include="TBlocker.h">
<Filter>Header Files\TCollisionComponent</Filter>
</ClInclude>
<ClInclude Include="TDemo.h">
<Filter>Header Files\TCollisionComponent</Filter>
</ClInclude>
<ClInclude Include="TDrain.h">
<Filter>Header Files\TCollisionComponent</Filter>
</ClInclude>
<ClInclude Include="TFlagSpinner.h">
<Filter>Header Files\TCollisionComponent</Filter>
</ClInclude>
<ClInclude Include="TFlipper.h">
<Filter>Header Files\TCollisionComponent</Filter>
</ClInclude>
<ClInclude Include="TGate.h">
<Filter>Header Files\TCollisionComponent</Filter>
</ClInclude>
<ClInclude Include="THole.h">
<Filter>Header Files\TCollisionComponent</Filter>
</ClInclude>
<ClInclude Include="TKickback.h">
<Filter>Header Files\TCollisionComponent</Filter>
</ClInclude>
<ClInclude Include="TKickout.h">
<Filter>Header Files\TCollisionComponent</Filter>
</ClInclude>
<ClInclude Include="TOneway.h">
<Filter>Header Files\TCollisionComponent</Filter>
</ClInclude>
<ClInclude Include="TPlunger.h">
<Filter>Header Files\TCollisionComponent</Filter>
</ClInclude>
<ClInclude Include="TPopupTarget.h">
<Filter>Header Files\TCollisionComponent</Filter>
</ClInclude>
<ClInclude Include="TRamp.h">
<Filter>Header Files\TCollisionComponent</Filter>
</ClInclude>
<ClInclude Include="TRollover.h">
<Filter>Header Files\TCollisionComponent</Filter>
</ClInclude>
<ClInclude Include="TSink.h">
<Filter>Header Files\TCollisionComponent</Filter>
</ClInclude>
<ClInclude Include="TSoloTarget.h">
<Filter>Header Files\TCollisionComponent</Filter>
</ClInclude>
<ClInclude Include="TTableLayer.h">
<Filter>Header Files\TCollisionComponent</Filter>
</ClInclude>
<ClInclude Include="TPinballTable.h">
<Filter>Header Files\TPinballComponent</Filter>
</ClInclude>
<ClInclude Include="TTripwire.h">
<Filter>Header Files\TCollisionComponent</Filter>
</ClInclude>
<ClInclude Include="TLightRollover.h">
<Filter>Header Files\TCollisionComponent</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="pch.cpp"> <ClCompile Include="pch.cpp">
@ -218,95 +221,35 @@
<ClCompile Include="score.cpp"> <ClCompile Include="score.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="TDrain.cpp">
<Filter>Source Files\PinballComponents</Filter>
</ClCompile>
<ClCompile Include="TFlipper.cpp">
<Filter>Source Files\PinballComponents</Filter>
</ClCompile>
<ClCompile Include="TPinballComponent.cpp"> <ClCompile Include="TPinballComponent.cpp">
<Filter>Source Files\PinballComponents</Filter> <Filter>Source Files\TPinballComponent</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="TPinballTable.cpp"> <ClCompile Include="TPinballTable.cpp">
<Filter>Source Files\PinballComponents</Filter> <Filter>Source Files\TPinballComponent</Filter>
</ClCompile>
<ClCompile Include="TPlunger.cpp">
<Filter>Source Files\PinballComponents</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="TBall.cpp"> <ClCompile Include="TBall.cpp">
<Filter>Source Files\PinballComponents</Filter> <Filter>Source Files\TPinballComponent</Filter>
</ClCompile>
<ClCompile Include="TBlocker.cpp">
<Filter>Source Files\PinballComponents</Filter>
</ClCompile>
<ClCompile Include="TBumper.cpp">
<Filter>Source Files\PinballComponents</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="TComponentGroup.cpp"> <ClCompile Include="TComponentGroup.cpp">
<Filter>Source Files\PinballComponents</Filter> <Filter>Source Files\TPinballComponent</Filter>
</ClCompile>
<ClCompile Include="TDemo.cpp">
<Filter>Source Files\PinballComponents</Filter>
</ClCompile>
<ClCompile Include="TFlagSpinner.cpp">
<Filter>Source Files\PinballComponents</Filter>
</ClCompile>
<ClCompile Include="TGate.cpp">
<Filter>Source Files\PinballComponents</Filter>
</ClCompile>
<ClCompile Include="THole.cpp">
<Filter>Source Files\PinballComponents</Filter>
</ClCompile>
<ClCompile Include="TKickback.cpp">
<Filter>Source Files\PinballComponents</Filter>
</ClCompile>
<ClCompile Include="TKickout.cpp">
<Filter>Source Files\PinballComponents</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="TLight.cpp"> <ClCompile Include="TLight.cpp">
<Filter>Source Files\PinballComponents</Filter> <Filter>Source Files\TPinballComponent</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="TLightBargraph.cpp"> <ClCompile Include="TLightBargraph.cpp">
<Filter>Source Files\PinballComponents</Filter> <Filter>Source Files\TPinballComponent</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="TLightGroup.cpp"> <ClCompile Include="TLightGroup.cpp">
<Filter>Source Files\PinballComponents</Filter> <Filter>Source Files\TPinballComponent</Filter>
</ClCompile>
<ClCompile Include="TLightRollover.cpp">
<Filter>Source Files\PinballComponents</Filter>
</ClCompile>
<ClCompile Include="TOneway.cpp">
<Filter>Source Files\PinballComponents</Filter>
</ClCompile>
<ClCompile Include="TPopupTarget.cpp">
<Filter>Source Files\PinballComponents</Filter>
</ClCompile>
<ClCompile Include="TRamp.cpp">
<Filter>Source Files\PinballComponents</Filter>
</ClCompile>
<ClCompile Include="TRollover.cpp">
<Filter>Source Files\PinballComponents</Filter>
</ClCompile>
<ClCompile Include="TSink.cpp">
<Filter>Source Files\PinballComponents</Filter>
</ClCompile>
<ClCompile Include="TSoloTarget.cpp">
<Filter>Source Files\PinballComponents</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="TSound.cpp"> <ClCompile Include="TSound.cpp">
<Filter>Source Files\PinballComponents</Filter> <Filter>Source Files\TPinballComponent</Filter>
</ClCompile>
<ClCompile Include="TTableLayer.cpp">
<Filter>Source Files\PinballComponents</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="TTextBox.cpp"> <ClCompile Include="TTextBox.cpp">
<Filter>Source Files\PinballComponents</Filter> <Filter>Source Files\TPinballComponent</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="TTimer.cpp"> <ClCompile Include="TTimer.cpp">
<Filter>Source Files\PinballComponents</Filter> <Filter>Source Files\TPinballComponent</Filter>
</ClCompile>
<ClCompile Include="TTripwire.cpp">
<Filter>Source Files\PinballComponents</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="memory.cpp"> <ClCompile Include="memory.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
@ -350,6 +293,69 @@
<ClCompile Include="TLine.cpp"> <ClCompile Include="TLine.cpp">
<Filter>Source Files\TEdgeSegment</Filter> <Filter>Source Files\TEdgeSegment</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="TWall.cpp">
<Filter>Source Files\TCollisionComponent</Filter>
</ClCompile>
<ClCompile Include="TBlocker.cpp">
<Filter>Source Files\TCollisionComponent</Filter>
</ClCompile>
<ClCompile Include="TBumper.cpp">
<Filter>Source Files\TCollisionComponent</Filter>
</ClCompile>
<ClCompile Include="TDemo.cpp">
<Filter>Source Files\TCollisionComponent</Filter>
</ClCompile>
<ClCompile Include="TDrain.cpp">
<Filter>Source Files\TCollisionComponent</Filter>
</ClCompile>
<ClCompile Include="TFlagSpinner.cpp">
<Filter>Source Files\TCollisionComponent</Filter>
</ClCompile>
<ClCompile Include="TFlipper.cpp">
<Filter>Source Files\TCollisionComponent</Filter>
</ClCompile>
<ClCompile Include="TGate.cpp">
<Filter>Source Files\TCollisionComponent</Filter>
</ClCompile>
<ClCompile Include="THole.cpp">
<Filter>Source Files\TCollisionComponent</Filter>
</ClCompile>
<ClCompile Include="TKickback.cpp">
<Filter>Source Files\TCollisionComponent</Filter>
</ClCompile>
<ClCompile Include="TKickout.cpp">
<Filter>Source Files\TCollisionComponent</Filter>
</ClCompile>
<ClCompile Include="TOneway.cpp">
<Filter>Source Files\TCollisionComponent</Filter>
</ClCompile>
<ClCompile Include="TPlunger.cpp">
<Filter>Source Files\TCollisionComponent</Filter>
</ClCompile>
<ClCompile Include="TPopupTarget.cpp">
<Filter>Source Files\TCollisionComponent</Filter>
</ClCompile>
<ClCompile Include="TRamp.cpp">
<Filter>Source Files\TCollisionComponent</Filter>
</ClCompile>
<ClCompile Include="TRollover.cpp">
<Filter>Source Files\TCollisionComponent</Filter>
</ClCompile>
<ClCompile Include="TSink.cpp">
<Filter>Source Files\TCollisionComponent</Filter>
</ClCompile>
<ClCompile Include="TSoloTarget.cpp">
<Filter>Source Files\TCollisionComponent</Filter>
</ClCompile>
<ClCompile Include="TTableLayer.cpp">
<Filter>Source Files\TCollisionComponent</Filter>
</ClCompile>
<ClCompile Include="TTripwire.cpp">
<Filter>Source Files\TCollisionComponent</Filter>
</ClCompile>
<ClCompile Include="TLightRollover.cpp">
<Filter>Source Files\TCollisionComponent</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Natvis Include="NatvisFile.natvis" /> <Natvis Include="NatvisFile.natvis" />

View File

@ -1,11 +1,11 @@
#pragma once #pragma once
#include "TPinballComponent.h" #include "TCollisionComponent.h"
class TBlocker : class TBlocker :
public TPinballComponent public TCollisionComponent
{ {
public: public:
TBlocker(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, false) TBlocker(TPinballTable* table, int groupIndex) : TCollisionComponent(table, groupIndex, true)
{ {
} }
}; };

View File

@ -1,11 +1,11 @@
#pragma once #pragma once
#include "TPinballComponent.h" #include "TCollisionComponent.h"
class TBumper : class TBumper :
public TPinballComponent public TCollisionComponent
{ {
public: public:
TBumper(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, false) TBumper(TPinballTable* table, int groupIndex) : TCollisionComponent(table, groupIndex, true)
{ {
} }
}; };

View File

@ -5,7 +5,7 @@
#include "TPinballTable.h" #include "TPinballTable.h"
TCollisionComponent::TCollisionComponent(TPinballTable* table, int groupIndex, int someFlag) : TPinballComponent( TCollisionComponent::TCollisionComponent(TPinballTable* table, int groupIndex, bool createWall) : TPinballComponent(
table, groupIndex, true) table, groupIndex, true)
{ {
visualStruct visual{}; visualStruct visual{};
@ -21,9 +21,9 @@ TCollisionComponent::TCollisionComponent(TPinballTable* table, int groupIndex, i
else else
{ {
loader::query_visual(groupIndex, 0, &visual); loader::query_visual(groupIndex, 0, &visual);
if (someFlag) if (createWall)
{ {
float offset = table->UnknownP61F; 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, &UnknownBaseFlag2, visual.Flag, offset, 0);
} }

View File

@ -15,6 +15,6 @@ public:
int SoundIndex2; int SoundIndex2;
int SoundIndex1; int SoundIndex1;
TCollisionComponent(TPinballTable* table, int groupIndex, int someFlag); TCollisionComponent(TPinballTable* table, int groupIndex, bool createWall);
~TCollisionComponent(); ~TCollisionComponent();
}; };

View File

@ -1,11 +1,11 @@
#pragma once #pragma once
#include "TPinballComponent.h" #include "TCollisionComponent.h"
class TDemo : class TDemo :
public TPinballComponent public TCollisionComponent
{ {
public: public:
TDemo(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, false) TDemo(TPinballTable* table, int groupIndex) : TCollisionComponent(table, groupIndex, false)
{ {
} }
}; };

View File

@ -1,11 +1,11 @@
#pragma once #pragma once
#include "TPinballComponent.h" #include "TCollisionComponent.h"
class TDrain : class TDrain :
public TPinballComponent public TCollisionComponent
{ {
public: public:
TDrain(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, false) TDrain(TPinballTable* table, int groupIndex) : TCollisionComponent(table, groupIndex, true)
{ {
} }
}; };

View File

@ -16,18 +16,18 @@ TEdgeSegment* TEdgeSegment::install_wall(float* floatArr, TCollisionComponent* c
float offset, int someValue) float offset, int someValue)
{ {
vector_type center{}, start{}, end{}, prevCenter{}, vec1{}, vec2{}, dstVec{}; vector_type center{}, start{}, end{}, prevCenter{}, vec1{}, vec2{}, dstVec{};
TEdgeSegment* edge1; TEdgeSegment* edge = nullptr;
wall_type wallType = static_cast<wall_type>(static_cast<int>(floor(*floatArr) - 1.0)); wall_type wallType = static_cast<wall_type>(static_cast<int>(floor(*floatArr) - 1.0f));
switch (wallType) switch (wallType)
{ {
case wall_type::Circle: case wall_type::Circle:
{ {
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, &center, radius); auto circle = new TCircle(collComp, flagPtr, visual_flag, &center, radius);
edge = circle;
if (circle) if (circle)
{ {
@ -36,7 +36,7 @@ TEdgeSegment* TEdgeSegment::install_wall(float* floatArr, TCollisionComponent* c
} }
collComp->EdgeList->Add(circle); collComp->EdgeList->Add(circle);
return circle; break;
} }
case wall_type::Line: case wall_type::Line:
{ {
@ -44,8 +44,8 @@ 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, flagPtr, visual_flag, &start, &end);
edge = line;
if (line) if (line)
{ {
@ -54,7 +54,7 @@ TEdgeSegment* TEdgeSegment::install_wall(float* floatArr, TCollisionComponent* c
line->place_in_grid(); line->place_in_grid();
collComp->EdgeList->Add(line); collComp->EdgeList->Add(line);
} }
return line; break;
} }
default: default:
{ {
@ -91,7 +91,7 @@ TEdgeSegment* TEdgeSegment::install_wall(float* floatArr, TCollisionComponent* c
if (dstVec.Z > 0.0 && offset > 0.0 || if (dstVec.Z > 0.0 && offset > 0.0 ||
dstVec.Z < 0.0 && offset < 0.0) dstVec.Z < 0.0 && offset < 0.0)
{ {
auto radius = offset * 1.001; float radius = offset * 1.001f;
auto circle = new TCircle(collComp, flagPtr, visual_flag, &center, radius); auto circle = new TCircle(collComp, flagPtr, visual_flag, &center, radius);
if (circle) if (circle)
@ -108,6 +108,8 @@ TEdgeSegment* TEdgeSegment::install_wall(float* floatArr, TCollisionComponent* c
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, flagPtr, visual_flag, &start, &end);
edge = line;
if (line) if (line)
{ {
line->WallValue = someValue; line->WallValue = someValue;
@ -121,5 +123,5 @@ TEdgeSegment* TEdgeSegment::install_wall(float* floatArr, TCollisionComponent* c
} }
} }
return nullptr; return edge;
} }

View File

@ -3,7 +3,7 @@
#include "maths.h" #include "maths.h"
#include "TBall.h" #include "TBall.h"
enum class wall_type enum class wall_type : int
{ {
Circle = 0, Circle = 0,
Line = 1, Line = 1,

View File

@ -1,11 +1,11 @@
#pragma once #pragma once
#include "TPinballComponent.h" #include "TCollisionComponent.h"
class TFlagSpinner : class TFlagSpinner :
public TPinballComponent public TCollisionComponent
{ {
public: public:
TFlagSpinner(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, false) TFlagSpinner(TPinballTable* table, int groupIndex) : TCollisionComponent(table, groupIndex, false)
{ {
} }
}; };

View File

@ -1,12 +1,11 @@
#pragma once #pragma once
#include "TPinballComponent.h" #include "TCollisionComponent.h"
class TFlipper : class TFlipper :
public TPinballComponent public TCollisionComponent
{ {
public: public:
TFlipper(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, false) TFlipper(TPinballTable* table, int groupIndex) : TCollisionComponent(table, groupIndex, false)
{ {
} }
}; };

View File

@ -1,11 +1,11 @@
#pragma once #pragma once
#include "TPinballComponent.h" #include "TCollisionComponent.h"
class TGate : class TGate :
public TPinballComponent public TCollisionComponent
{ {
public: public:
TGate(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, false) TGate(TPinballTable* table, int groupIndex) : TCollisionComponent(table, groupIndex, true)
{ {
} }
}; };

View File

@ -1,11 +1,11 @@
#pragma once #pragma once
#include "TPinballComponent.h" #include "TCollisionComponent.h"
class THole : class THole :
public TPinballComponent public TCollisionComponent
{ {
public: public:
THole(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, false) THole(TPinballTable* table, int groupIndex) : TCollisionComponent(table, groupIndex, false)
{ {
} }
}; };

View File

@ -1,11 +1,11 @@
#pragma once #pragma once
#include "TPinballComponent.h" #include "TCollisionComponent.h"
class TKickback : class TKickback :
public TPinballComponent public TCollisionComponent
{ {
public: public:
TKickback(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, false) TKickback(TPinballTable* table, int groupIndex) : TCollisionComponent(table, groupIndex, true)
{ {
} }
}; };

View File

@ -1,11 +1,11 @@
#pragma once #pragma once
#include "TPinballComponent.h" #include "TCollisionComponent.h"
class TKickout : class TKickout :
public TPinballComponent public TCollisionComponent
{ {
public: public:
TKickout(TPinballTable* table, int groupIndex,int vectorType) : TPinballComponent(table, groupIndex, false) TKickout(TPinballTable* table, int groupIndex, int vectorType) : TCollisionComponent(table, groupIndex, false)
{ {
} }
}; };

View File

@ -1,11 +1,11 @@
#pragma once #pragma once
#include "TPinballComponent.h" #include "TLightGroup.h"
class TLightBargraph : class TLightBargraph :
public TPinballComponent public TLightGroup
{ {
public: public:
TLightBargraph(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, false) TLightBargraph(TPinballTable* table, int groupIndex) : TLightGroup(table, groupIndex)
{ {
} }
}; };

View File

@ -1,11 +1,11 @@
#pragma once #pragma once
#include "TPinballComponent.h" #include "TRollover.h"
class TLightRollover : class TLightRollover :
public TPinballComponent public TRollover
{ {
public: public:
TLightRollover(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, false) TLightRollover(TPinballTable* table, int groupIndex) : TRollover(table, groupIndex)
{ {
} }
}; };

View File

@ -1,11 +1,11 @@
#pragma once #pragma once
#include "TPinballComponent.h" #include "TCollisionComponent.h"
class TOneway : class TOneway :
public TPinballComponent public TCollisionComponent
{ {
public: public:
TOneway(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, false) TOneway(TPinballTable* table, int groupIndex) : TCollisionComponent(table, groupIndex, false)
{ {
} }
}; };

View File

@ -30,6 +30,7 @@
#include "TTextBox.h" #include "TTextBox.h"
#include "TTimer.h" #include "TTimer.h"
#include "TTripwire.h" #include "TTripwire.h"
#include "TWall.h"
TPinballTable::TPinballTable(): TPinballComponent(nullptr, -1, false) TPinballTable::TPinballTable(): TPinballComponent(nullptr, -1, false)
{ {
@ -88,7 +89,7 @@ TPinballTable::TPinballTable(): TPinballComponent(nullptr, -1, false)
{ {
case 1000: case 1000:
case 1010: case 1010:
// auto wall = new TWall( this, groupIndex); new TWall( this, groupIndex);
break; break;
case 1001: case 1001:
this->Plunger = new TPlunger(this, groupIndex); this->Plunger = new TPlunger(this, groupIndex);

View File

@ -73,7 +73,7 @@ public:
int UnknownP58; int UnknownP58;
int UnknownP59; int UnknownP59;
int UnknownP60; int UnknownP60;
float UnknownP61F; float CollisionCompOffset;
int UnknownP62; int UnknownP62;
int UnknownP63; int UnknownP63;
int UnknownP64; int UnknownP64;

View File

@ -1,11 +1,11 @@
#pragma once #pragma once
#include "TPinballComponent.h" #include "TCollisionComponent.h"
class TPlunger : class TPlunger :
public TPinballComponent public TCollisionComponent
{ {
public: public:
TPlunger(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, false) TPlunger(TPinballTable* table, int groupIndex) : TCollisionComponent(table, groupIndex, true)
{ {
} }
}; };

View File

@ -1,11 +1,11 @@
#pragma once #pragma once
#include "TPinballComponent.h" #include "TCollisionComponent.h"
class TPopupTarget : class TPopupTarget :
public TPinballComponent public TCollisionComponent
{ {
public: public:
TPopupTarget(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, false) TPopupTarget(TPinballTable* table, int groupIndex) : TCollisionComponent(table, groupIndex, true)
{ {
} }
}; };

View File

@ -1,11 +1,11 @@
#pragma once #pragma once
#include "TPinballComponent.h" #include "TCollisionComponent.h"
class TRamp : class TRamp :
public TPinballComponent public TCollisionComponent
{ {
public: public:
TRamp(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, false) TRamp(TPinballTable* table, int groupIndex) : TCollisionComponent(table, groupIndex, false)
{ {
} }
}; };

View File

@ -1,11 +1,11 @@
#pragma once #pragma once
#include "TPinballComponent.h" #include "TCollisionComponent.h"
class TRollover : class TRollover :
public TPinballComponent public TCollisionComponent
{ {
public: public:
TRollover(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, false) TRollover(TPinballTable* table, int groupIndex) : TCollisionComponent(table, groupIndex, true)
{ {
} }
}; };

View File

@ -1,11 +1,11 @@
#pragma once #pragma once
#include "TPinballComponent.h" #include "TCollisionComponent.h"
class TSink : class TSink :
public TPinballComponent public TCollisionComponent
{ {
public: public:
TSink(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, false) TSink(TPinballTable* table, int groupIndex) : TCollisionComponent(table, groupIndex, true)
{ {
} }
}; };

View File

@ -1,11 +1,11 @@
#pragma once #pragma once
#include "TPinballComponent.h" #include "TCollisionComponent.h"
class TSoloTarget : class TSoloTarget :
public TPinballComponent public TCollisionComponent
{ {
public: public:
TSoloTarget(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, false) TSoloTarget(TPinballTable* table, int groupIndex) : TCollisionComponent(table, groupIndex, true)
{ {
} }
}; };

View File

@ -1,11 +1,11 @@
#pragma once #pragma once
#include "TPinballComponent.h" #include "TCollisionComponent.h"
class TTableLayer : class TTableLayer :
public TPinballComponent public TCollisionComponent
{ {
public: public:
TTableLayer(TPinballTable* table) : TPinballComponent(table, -1, false) TTableLayer(TPinballTable* table) : TCollisionComponent(table, -1, false)
{ {
} }
}; };

View File

@ -1,11 +1,11 @@
#pragma once #pragma once
#include "TPinballComponent.h" #include "TRollover.h"
class TTripwire : class TTripwire :
public TPinballComponent public TRollover
{ {
public: public:
TTripwire(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, false) TTripwire(TPinballTable* table, int groupIndex) : TRollover(table, groupIndex)
{ {
} }
}; };

View File

@ -0,0 +1,2 @@
#include "pch.h"
#include "TWall.h"

11
SpaceCadetPinball/TWall.h Normal file
View File

@ -0,0 +1,11 @@
#pragma once
#include "TCollisionComponent.h"
class TWall :
public TCollisionComponent
{
public:
TWall(TPinballTable* table, int groupIndex) : TCollisionComponent(table, groupIndex, true)
{
}
};

View File

@ -1,10 +1,15 @@
#pragma once #pragma once
#include "objlist_class.h" #include "objlist_class.h"
class TZmapList :
public objlist_class class TZmapList : // TImageList, template?
public objlist_class
{ {
public: public:
TZmapList(int SizeInt, int growSize):objlist_class(SizeInt,growSize){}; TZmapList(int SizeInt, int growSize): objlist_class(SizeInt, growSize)
~TZmapList(){}; {
}; };
~TZmapList()
{
};
};