Score, PinbalTable, PinballComponent v1

Placeholders for T piball component classes.
This commit is contained in:
oz 2020-11-01 18:45:29 +03:00
parent c55f6e5b98
commit 5e94b5b513
78 changed files with 1239 additions and 41 deletions

1
CompileForDrMemory.bat Normal file
View file

@ -0,0 +1 @@
cl /Zi /MT /EHsc /O y- /Ob0 /Femyapp.exe *.cpp user32.lib

View file

@ -60,7 +60,9 @@ int main2(int argc, const char* argv[])
printf("pbwdlist - 3D Pinball for Windows DAT file listing program\nby AdrienTD\n\n");
if (argc < 2) { printf("Usage: pbwdlist FILE.DAT\n"); return 1; }
ff = fopen(argv[1], "rb");
FILE *ff;
fopen_s(&ff,argv[1], "rb");
//ff = fopen(argv[1], "rb");
cerr(!ff, -1);
printf("File: %s\n\n", argv[1]);
fseek(ff, 0, SEEK_END);

View file

@ -8,6 +8,8 @@
#include "partman.h"
#include "DatParser.h"
#include "loader.h"
#include "score.h"
#include "TPinballTable.h"
int main()
{
@ -18,7 +20,7 @@ int main()
{
d.Add((void*)i);
}
d.Delete(3);
d.Delete((void*)3);
auto xx = sizeof(datFileHeader);
@ -41,17 +43,19 @@ int main()
//loader::error(25, 26);
loader::loadfrom(datFile);
loader::get_sound_id(18);
visualStruct visual1{};
loader::material(96, &visual1);
loader::query_visual(283, 0, &visual1);
visualKickerStruct kicker1{};
loader::kicker(509, &kicker1);
auto score1 = score::create("score1", 117);
auto pinballTable = new TPinballTable();
//DatParser::Parse(dataFileName);
std::cout << "Goodby World!\n";
}
// Run program: Ctrl + F5 or Debug > Start Without Debugging menu

View file

@ -0,0 +1,60 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "winres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (United States) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE 25, 1
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""winres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View file

@ -91,7 +91,7 @@
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<BufferSecurityCheck>false</BufferSecurityCheck>
<BufferSecurityCheck>true</BufferSecurityCheck>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@ -158,6 +158,39 @@
<ClInclude Include="partman.h" />
<ClInclude Include="pch.h" />
<ClInclude Include="pinball.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="score.h" />
<ClInclude Include="TBall.h" />
<ClInclude Include="TBlocker.h" />
<ClInclude Include="TBumper.h" />
<ClInclude Include="TComponentGroup.h" />
<ClInclude Include="TDemo.h" />
<ClInclude Include="TDrain.h" />
<ClInclude Include="TFlagSpinner.h" />
<ClInclude Include="TFlipper.h" />
<ClInclude Include="TGate.h" />
<ClInclude Include="THole.h" />
<ClInclude Include="TKickback.h" />
<ClInclude Include="TKickout.h" />
<ClInclude Include="TLight.h" />
<ClInclude Include="TLightBargraph.h" />
<ClInclude Include="TLightGroup.h" />
<ClInclude Include="TLightRollover.h" />
<ClInclude Include="TOneway.h" />
<ClInclude Include="TPinballComponent.h" />
<ClInclude Include="TPinballTable.h" />
<ClInclude Include="TPlunger.h" />
<ClInclude Include="TPopupTarget.h" />
<ClInclude Include="TRamp.h" />
<ClInclude Include="TRollover.h" />
<ClInclude Include="TSink.h" />
<ClInclude Include="TSoloTarget.h" />
<ClInclude Include="TSound.h" />
<ClInclude Include="TTableLayer.h" />
<ClInclude Include="TTextBox.h" />
<ClInclude Include="TTimer.h" />
<ClInclude Include="TTripwire.h" />
<ClInclude Include="TZmapList.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="DatParser.cpp" />
@ -171,11 +204,45 @@
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="pinball.cpp" />
<ClCompile Include="score.cpp" />
<ClCompile Include="SpaceCadetPinball.cpp" />
<ClCompile Include="TBall.cpp" />
<ClCompile Include="TBlocker.cpp" />
<ClCompile Include="TBumper.cpp" />
<ClCompile Include="TComponentGroup.cpp" />
<ClCompile Include="TDemo.cpp" />
<ClCompile Include="TDrain.cpp" />
<ClCompile Include="TFlagSpinner.cpp" />
<ClCompile Include="TFlipper.cpp" />
<ClCompile Include="TGate.cpp" />
<ClCompile Include="THole.cpp" />
<ClCompile Include="TKickback.cpp" />
<ClCompile Include="TKickout.cpp" />
<ClCompile Include="TLight.cpp" />
<ClCompile Include="TLightBargraph.cpp" />
<ClCompile Include="TLightGroup.cpp" />
<ClCompile Include="TLightRollover.cpp" />
<ClCompile Include="TOneway.cpp" />
<ClCompile Include="TPinballComponent.cpp" />
<ClCompile Include="TPinballTable.cpp" />
<ClCompile Include="TPlunger.cpp" />
<ClCompile Include="TPopupTarget.cpp" />
<ClCompile Include="TRamp.cpp" />
<ClCompile Include="TRollover.cpp" />
<ClCompile Include="TSink.cpp" />
<ClCompile Include="TSoloTarget.cpp" />
<ClCompile Include="TSound.cpp" />
<ClCompile Include="TTableLayer.cpp" />
<ClCompile Include="TTextBox.cpp" />
<ClCompile Include="TTimer.cpp" />
<ClCompile Include="TTripwire.cpp" />
</ItemGroup>
<ItemGroup>
<Natvis Include="NatvisFile.natvis" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="SpaceCadetPinball.rc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>

View file

@ -13,6 +13,12 @@
<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>
</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>
</ItemGroup>
<ItemGroup>
<ClInclude Include="pch.h">
@ -33,6 +39,105 @@
<ClInclude Include="pinball.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="score.h">
<Filter>Header Files</Filter>
</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">
<Filter>Header Files\PinballComponents</Filter>
</ClInclude>
<ClInclude Include="TPinballTable.h">
<Filter>Header Files\PinballComponents</Filter>
</ClInclude>
<ClInclude Include="TPlunger.h">
<Filter>Header Files\PinballComponents</Filter>
</ClInclude>
<ClInclude Include="TBall.h">
<Filter>Header Files\PinballComponents</Filter>
</ClInclude>
<ClInclude Include="resource.h">
<Filter>Header Files</Filter>
</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">
<Filter>Header Files\PinballComponents</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 Include="TLight.h">
<Filter>Header Files\PinballComponents</Filter>
</ClInclude>
<ClInclude Include="TLightBargraph.h">
<Filter>Header Files\PinballComponents</Filter>
</ClInclude>
<ClInclude Include="TLightGroup.h">
<Filter>Header Files\PinballComponents</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 Include="TSound.h">
<Filter>Header Files\PinballComponents</Filter>
</ClInclude>
<ClInclude Include="TTableLayer.h">
<Filter>Header Files\PinballComponents</Filter>
</ClInclude>
<ClInclude Include="TTextBox.h">
<Filter>Header Files\PinballComponents</Filter>
</ClInclude>
<ClInclude Include="TTimer.h">
<Filter>Header Files\PinballComponents</Filter>
</ClInclude>
<ClInclude Include="TTripwire.h">
<Filter>Header Files\PinballComponents</Filter>
</ClInclude>
<ClInclude Include="TZmapList.h">
<Filter>Header Files\PinballComponents</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="pch.cpp">
@ -56,8 +161,106 @@
<ClCompile Include="pinball.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="score.cpp">
<Filter>Source Files</Filter>
</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">
<Filter>Source Files\PinballComponents</Filter>
</ClCompile>
<ClCompile Include="TPinballTable.cpp">
<Filter>Source Files\PinballComponents</Filter>
</ClCompile>
<ClCompile Include="TPlunger.cpp">
<Filter>Source Files\PinballComponents</Filter>
</ClCompile>
<ClCompile Include="TBall.cpp">
<Filter>Source Files\PinballComponents</Filter>
</ClCompile>
<ClCompile Include="TBlocker.cpp">
<Filter>Source Files\PinballComponents</Filter>
</ClCompile>
<ClCompile Include="TBumper.cpp">
<Filter>Source Files\PinballComponents</Filter>
</ClCompile>
<ClCompile Include="TComponentGroup.cpp">
<Filter>Source Files\PinballComponents</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 Include="TLight.cpp">
<Filter>Source Files\PinballComponents</Filter>
</ClCompile>
<ClCompile Include="TLightBargraph.cpp">
<Filter>Source Files\PinballComponents</Filter>
</ClCompile>
<ClCompile Include="TLightGroup.cpp">
<Filter>Source Files\PinballComponents</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 Include="TSound.cpp">
<Filter>Source Files\PinballComponents</Filter>
</ClCompile>
<ClCompile Include="TTableLayer.cpp">
<Filter>Source Files\PinballComponents</Filter>
</ClCompile>
<ClCompile Include="TTextBox.cpp">
<Filter>Source Files\PinballComponents</Filter>
</ClCompile>
<ClCompile Include="TTimer.cpp">
<Filter>Source Files\PinballComponents</Filter>
</ClCompile>
<ClCompile Include="TTripwire.cpp">
<Filter>Source Files\PinballComponents</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Natvis Include="NatvisFile.natvis" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="SpaceCadetPinball.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
</Project>

View file

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

11
SpaceCadetPinball/TBall.h Normal file
View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

11
SpaceCadetPinball/TDemo.h Normal file
View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

11
SpaceCadetPinball/TGate.h Normal file
View file

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

View file

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

11
SpaceCadetPinball/THole.h Normal file
View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -0,0 +1,81 @@
#include "pch.h"
#include "TPinballComponent.h"
#include "loader.h"
#include "objlist_class.h"
#include "TZmapList.h"
#include "TPinballTable.h"
TPinballComponent::TPinballComponent(TPinballTable* table, int groupIndex, bool loadVisuals)
{
visualStruct visual{}; // [esp+Ch] [ebp-6Ch]
// this->VfTable = (int)&TPinballComponent::`vftable';
this->Unknown2 = 0;
this->UnknownBaseFlag1 = 0;
this->UnknownBaseFlag2 = 0;
this->PinballTable = table;
this->Unknown7 = 0;
this->List1Bitmap8 = nullptr;
this->List2Bitmap16 = nullptr;
if (table)
table->ListP1->Add(this);
if (groupIndex >= 0)
this->GroupName = loader::query_name(groupIndex);
if (loadVisuals && groupIndex >= 0)
{
int visualCount = loader::query_visual_states(groupIndex);
for (int index = 0; index < visualCount; ++index)
{
loader::query_visual(groupIndex, index, &visual);
if (visual.Bitmap8)
{
if (!this->List1Bitmap8)
this->List1Bitmap8 = new TZmapList(visualCount, 4);
if (this->List1Bitmap8)
this->List1Bitmap8->Add(visual.Bitmap8);
}
if (visual.Bitmap16)
{
if (!this->List2Bitmap16)
this->List2Bitmap16 = new TZmapList(visualCount, 4);
if (this->List2Bitmap16)
this->List2Bitmap16->Add(visual.Bitmap16);
}
}
if (this->List2Bitmap16)
int listVal0 = (int)this->List2Bitmap16->Get(0);
if (this->List1Bitmap8)
{
/*listVal0_2 = (int*)this->List1Bitmap8->Get(0);
v24 = *(int*)((char*)listVal0_2 + 29) - table->UnknownP49;
v15 = 1;
v25 = *(int*)((char*)listVal0_2 + 33) - table->UnknownP50;
v26 = listVal0_2[3];
v27 = listVal0_2[4];
if (List1Bitmap8->Count() > 1)
{
index = 12;
do
{
v16 = *(int**)((char*)&this->List1Bitmap8->ListPtr->Size + index);
v20 = *(int*)((char*)v16 + 29) - table->UnknownP49;
v21 = *(int*)((char*)v16 + 33) - table->UnknownP50;
v22 = v16[3];
v23 = v16[4];
enclosing_box(&v24, &v20, &v24);
index += 4;
++v15;
} while (v15 < this->List1Bitmap8->ListPtr->Count);
}
v17 = this->List1Bitmap8->ListPtr->Array[0];
this->Unknown7 = (int)render_create_sprite(
visualCount > 0,
this->List1Bitmap8->ListPtr->Array[0],
listVal0,
*(int*)(v17 + 29) - table->UnknownP49,
*(int*)(v17 + 33) - table->UnknownP50,
&v24);*/
}
}
this->GroupIndex = groupIndex;
}

View file

@ -0,0 +1,22 @@
#pragma once
#include "TZmapList.h"
class TPinballComponent
{public:
TPinballComponent(class TPinballTable* table, int groupIndex, bool loadVisuals);
int VfTable;
__int8 UnknownBaseFlag1;
__int8 UnknownBaseFlag2;
int Unknown2;
char* GroupName;
int Unknown4;
int Unknown5;
int GroupIndex;
int Unknown7;
TPinballTable* PinballTable;
TZmapList* List1Bitmap8;
TZmapList* List2Bitmap16;
};

View file

@ -0,0 +1,187 @@
#include "pch.h"
#include "TPinballTable.h"
#include "loader.h"
#include "pinball.h"
#include "TBall.h"
#include "TBlocker.h"
#include "TBumper.h"
#include "TComponentGroup.h"
#include "TDemo.h"
#include "TFlagSpinner.h"
#include "TGate.h"
#include "THole.h"
#include "TKickback.h"
#include "TKickout.h"
#include "TLight.h"
#include "TLightBargraph.h"
#include "TLightGroup.h"
#include "TLightRollover.h"
#include "TOneway.h"
#include "TPopupTarget.h"
#include "TRamp.h"
#include "TRollover.h"
#include "TSink.h"
#include "TSoloTarget.h"
#include "TSound.h"
#include "TTableLayer.h"
#include "TTextBox.h"
#include "TTimer.h"
#include "TTripwire.h"
TPinballTable::TPinballTable(): TPinballComponent(nullptr, -1, false)
{
int shortArrLength;
//this->VfTable = (int)&TPinballTable::`vftable';
ListP1 = new objlist_class(32, 16);
ListP2 = new objlist_class(3, 1);
this->Score1 = nullptr;
this->ScoreBallcount = nullptr;
this->ScorePlayerNumber1 = nullptr;
this->UnknownP10 = 0;
this->UnknownBaseFlag2 = 1;
this->UnknownP83 = 0;
this->UnknownP14 = 0;
this->UnknownP13 = 0;
this->UnknownP80 = 0;
this->UnknownP15 = 0;
this->UnknownP77 = 0;
TBall* ballObj = new TBall(this);
ListP2->Add(ballObj);
if (ballObj)
ballObj->UnknownBaseFlag2 = 0;
TTableLayer* tableLayerObj = new TTableLayer(this);
TLightGroup* lightGroupObj = new TLightGroup(this, 0);
this->LightGroup = lightGroupObj;
auto score1 = score::create("score1", pinball::render_background_bitmap);
this->Score1 = score1;
this->Score2 = score1;
int scoreIndex = 1;
auto scorePtr = &this->Score3_x3_at7;
do
{
*scorePtr = score::dup(this->Score1, scoreIndex++);
scorePtr += 7;
}
while (scoreIndex < 4);
this->UnknownP45 = 0;
this->UnknownP73 = 3;
this->ScoreBallcount = (int*)score::create("ballcount1", pinball::render_background_bitmap);
this->ScorePlayerNumber1 = (int*)score::create("player_number1", pinball::render_background_bitmap);
int groupIndexObjects = loader::query_handle("table_objects");
short* shortArr = loader::query_iattribute(groupIndexObjects, 1025, &shortArrLength);
if (shortArrLength > 0)
{
for (int i = 0; i < shortArrLength / 2; ++i)
{
int objectType = *shortArr;
short* shortArrPlus1 = shortArr + 1;
int groupIndex = *shortArrPlus1;
shortArr = shortArrPlus1 + 1;
switch (objectType)
{
case 1000:
case 1010:
// auto wall = new TWall( this, groupIndex);
break;
case 1001:
this->Plunger = new TPlunger(this, groupIndex);
break;
case 1002:
new TLight(this, groupIndex);
//((objlist_class*)(this->LightGroup + 42))->Add(light);
break;
case 1003:
this->FlipperL = new TFlipper(this, groupIndex);
break;
case 1004:
this->FlipperR = new TFlipper(this, groupIndex);
break;
case 1005:
new TBumper(this, groupIndex);
break;
case 1006:
new TPopupTarget(this, groupIndex);
break;
case 1007:
this->Drain = new TDrain(this, groupIndex);
break;
case 1011:
new TBlocker(this, groupIndex);
break;
case 1012:
new TKickout(this, groupIndex, 1);
break;
case 1013:
new TGate(this, groupIndex);
break;
case 1014:
new TKickback(this, groupIndex);
break;
case 1015:
new TRollover(this, groupIndex);
break;
case 1016:
new TOneway(this, groupIndex);
break;
case 1017:
new TSink(this, groupIndex);
break;
case 1018:
new TFlagSpinner(this, groupIndex);
break;
case 1019:
new TSoloTarget(this, groupIndex);
break;
case 1020:
new TLightRollover(this, groupIndex);
break;
case 1021:
new TRamp(this, groupIndex);
break;
case 1022:
new THole(this, groupIndex);
break;
case 1023:
new TDemo(this, groupIndex);
break;
case 1024:
new TTripwire(this, groupIndex);
break;
case 1026:
new TLightGroup(this, groupIndex);
break;
case 1028:
new TComponentGroup(this, groupIndex);
break;
case 1029:
new TKickout(this, groupIndex, 0);
break;
case 1030:
new TLightBargraph(this, groupIndex);
break;
case 1031:
new TSound(this, groupIndex);
break;
case 1032:
new TTimer(this, groupIndex);
break;
case 1033:
new TTextBox(this, groupIndex);
break;
default:
continue;
}
}
}
/* build_occlude_list();
InfoTextBox = (TTextBox*)TPinballTable::find_component(this, "info_text_box");
MissTextBox = (TTextBox*)TPinballTable::find_component(this, "mission_text_box");
control_make_links(this);*/
}

View file

@ -0,0 +1,97 @@
#pragma once
#include "objlist_class.h"
#include "score.h"
#include "TDrain.h"
#include "TFlipper.h"
#include "TLightGroup.h"
#include "TPinballComponent.h"
#include "TPlunger.h"
class TPinballTable:TPinballComponent
{
public:
TPinballTable();
TFlipper* FlipperL;
TFlipper* FlipperR;
scoreStruct* Score1;
int* ScoreBallcount;
int* ScorePlayerNumber1;
int UnknownP6;
int UnknownP7;
int UnknownP8;
int UnknownP9;
int UnknownP10;
int UnknownP11;
int UnknownP12;
int UnknownP13;
int UnknownP14;
int UnknownP15;
scoreStruct* Score2;
int UnknownP17;
int UnknownP18;
int UnknownP19;
int UnknownP20;
int UnknownP21;
int UnknownP22;
scoreStruct* Score3_x3_at7;
int UnknownP24;
int UnknownP25;
int UnknownP26;
int UnknownP27;
int UnknownP28;
int UnknownP29;
int UnknownP30;
int UnknownP31;
int UnknownP32;
int UnknownP33;
int UnknownP34;
int UnknownP35;
int UnknownP36;
int UnknownP37;
int UnknownP38;
int UnknownP39;
int UnknownP40;
int UnknownP41;
int UnknownP42;
int UnknownP43;
int UnknownP44;
int UnknownP45;
TPlunger* Plunger;
TDrain* Drain;
int UnknownP48;
int UnknownP49;
int UnknownP50;
int UnknownP51;
int UnknownP52;
objlist_class* ListP1;
objlist_class* ListP2;
TLightGroup* LightGroup;
int UnknownP58;
int UnknownP59;
int UnknownP60;
int UnknownP61;
int UnknownP62;
int UnknownP63;
int UnknownP64;
int UnknownP65;
int UnknownP66;
int UnknownP67;
int UnknownP68;
int UnknownP69;
int UnknownP70;
int UnknownP71;
int UnknownP72;
int UnknownP73;
int UnknownP74;
int UnknownP75;
int UnknownP76;
int UnknownP77;
int UnknownP78;
int UnknownP79;
int UnknownP80;
int UnknownP81;
int UnknownP82;
int UnknownP83;
};

View file

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

View file

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

View file

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

View file

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

View file

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

11
SpaceCadetPinball/TRamp.h Normal file
View file

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

View file

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

View file

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

View file

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

11
SpaceCadetPinball/TSink.h Normal file
View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -83,10 +83,10 @@ int loader::error(int errorCode, int captionCode)
void loader::default_vsi(visualStruct* visual)
{
visual->Unknown14Flag = 0;
visual->Kicker.Unknown1F = 8.9999999e10;
visual->Kicker.Unknown1F = 8.9999999e10f;
visual->Kicker.SoundIndex = 0;
visual->Unknown1F = 0.94999999;
visual->Unknown2F = 0.60000002;
visual->Unknown1F = 0.94999999f;
visual->Unknown2F = 0.60000002f;
visual->FloatArrSizeDiv8Sub2 = 0;
visual->SoundIndex2 = 0;
visual->Bitmap8 = 0;
@ -173,7 +173,7 @@ int loader::get_sound_id(int groupIndex)
{
const CHAR* fileName = partman::field(loader_table, soundGroupId, String);
HFILE hFile = _lopen(fileName, 0);
sound_list[soundIndex].Volume = static_cast<double>(_llseek(hFile, 0, 2)) * 0.0000909090909090909;
sound_list[soundIndex].Volume = (float)((double)(_llseek(hFile, 0, 2)) * 0.0000909090909090909);
_lclose(hFile);
//sound_list[soundIndex4].WavePtr = Sound_LoadWaveFile(lpName);
}
@ -305,7 +305,7 @@ int loader::material(int groupIndex, visualStruct* visual)
visual->Unknown2F = *nextFloatVal;
break;
case 304:
visual->SoundIndex2 = get_sound_id(floor(*nextFloatVal));
visual->SoundIndex2 = get_sound_id((int)floor(*nextFloatVal));
break;
default:
return error(9, 21);
@ -434,7 +434,7 @@ int loader::query_visual(int groupIndex, int groupIndexOffset, visualStruct* vi
__int64 floatVal; // rax
float* floatArrPtr; // esi
int groupIndexSum3; // [esp+1Ch] [ebp+8h]
int* shortArrLength; // [esp+24h] [ebp+10h]
int shortArrLength; // [esp+24h] [ebp+10h]
visual2 = visual;
default_vsi(visual);
@ -458,7 +458,7 @@ int loader::query_visual(int groupIndex, int groupIndexOffset, visualStruct* vi
{
shortArrSize = partman::field_size(loader_table, groupIndexSum2, ShortArray);
index = 0;
shortArrLength = (int*)(shortArrSize >> 1);
shortArrLength = shortArrSize >> 1;
if ((__int16)(shortArrSize >> 1) > 0)
{
while (1)
@ -528,7 +528,7 @@ int loader::query_visual(int groupIndex, int groupIndexOffset, visualStruct* vi
shortArr = nextShortVal + 8;
index = nextIndex + 8;
LABEL_32:
if ((__int16)index >= (__int16)shortArrLength)
if (index >= shortArrLength)
goto LABEL_33;
}
visual2->SoundIndex4 = get_sound_id(*nextShortVal);

View file

@ -65,9 +65,9 @@ public:
static float* query_float_attribute(int groupIndex, int groupIndexOffset, int firstValue);
static __int16* query_iattribute(int groupIndex, int firstValue, int* arraySize);
static double play_sound(int soundIndex);
static datFileStruct* loader_table;
private:
static errorMsg loader_errors[];
static datFileStruct* loader_table;
static datFileStruct* sound_record_table;
static int sound_count;
static int loader_sound_count;

View file

@ -19,7 +19,7 @@ void objlist_class::Add(void* value)
{
if (this->ListPtr->Count == this->ListPtr->Size)
Grow();
objlist_add_object(ListPtr, (int)value);
objlist_add_object(ListPtr, value);
}
void objlist_class::Grow()
@ -27,15 +27,22 @@ void objlist_class::Grow()
this->ListPtr = objlist_grow(this->ListPtr, this->GrowSize);
}
int objlist_class::Delete(int value)
int objlist_class::Delete(void* value)
{
return objlist_delete_object(ListPtr, value);
}
void* objlist_class::Get(int index)
{
if (index >= ListPtr->Count)
return nullptr;
return this->ListPtr->Array[index];
}
objlist_struct1* objlist_class::objlist_new(int sizeInt)
{
objlist_struct1* result = (objlist_struct1 *)malloc(4 * sizeInt + 12);
objlist_struct1* result = (objlist_struct1 *)malloc(sizeof(void*) * sizeInt + sizeof(objlist_struct1));
if (!result)
return result;
result->Count = 0;
@ -43,7 +50,7 @@ objlist_struct1* objlist_class::objlist_new(int sizeInt)
return result;
}
int objlist_class::objlist_add_object(objlist_struct1* ptrToStruct, int value)
int objlist_class::objlist_add_object(objlist_struct1* ptrToStruct, void* value)
{
int addIndex = ptrToStruct->Count;
if (addIndex >= ptrToStruct->Size)
@ -60,7 +67,7 @@ objlist_struct1* objlist_class::objlist_grow(objlist_struct1* ptrToStruct, int g
int newSizeInt = growSize + ptrToStruct->Count;
if (newSizeInt <= ptrToStruct->Size)
return resultPtr;
objlist_struct1* resultPtr2 = (objlist_struct1 *)realloc(ptrToStruct, 4 * newSizeInt + 12);
objlist_struct1* resultPtr2 = (objlist_struct1*)realloc(ptrToStruct, sizeof(void*) * newSizeInt + sizeof(objlist_struct1));
if (!resultPtr2)
return resultPtr;
resultPtr = resultPtr2;
@ -68,13 +75,13 @@ objlist_struct1* objlist_class::objlist_grow(objlist_struct1* ptrToStruct, int g
return resultPtr;
}
int objlist_class::objlist_delete_object(objlist_struct1* ptrToStruct, int value)
int objlist_class::objlist_delete_object(objlist_struct1* ptrToStruct, void* value)
{
int count = ptrToStruct->Count;
int index = count - 1;
if (count - 1 < 0)
return 0;
for (int* i = &ptrToStruct->Array[index]; *i != value; --i)
for (void** i = &ptrToStruct->Array[index]; *i != value; --i)
{
if (--index < 0)
return 0;

View file

@ -1,12 +1,12 @@
#pragma once
struct __declspec(align(4)) objlist_struct1
struct objlist_struct1
{
int Size;
int Count;
int Array[1];
void* Array[1];
};
static_assert(sizeof(objlist_struct1) == 12, "Wrong size of objlist_struct1");
class objlist_class
{
@ -15,13 +15,15 @@ public:
~objlist_class();
void Add(void* value);
void Grow();
int Delete(int value);
int Delete(void* value);
void* Get(int index);
int Count() const { return !ListPtr ? 0 : ListPtr->Count; }
int Size() const { return !ListPtr ? 0 : ListPtr->Size; }
private:
objlist_struct1* ListPtr;
int GrowSize;
objlist_struct1* objlist_new(int sizeInt);
int objlist_add_object(objlist_struct1 *ptrToStruct, int value);
objlist_struct1* objlist_grow(objlist_struct1 *ptrToStruct, int growSize);
int objlist_delete_object(objlist_struct1 *ptrToStruct, int value);
static objlist_struct1* objlist_new(int sizeInt);
static int objlist_add_object(objlist_struct1* ptrToStruct, void* value);
static objlist_struct1* objlist_grow(objlist_struct1* ptrToStruct, int growSize);
static int objlist_delete_object(objlist_struct1* ptrToStruct, void* value);
};

View file

@ -115,8 +115,8 @@ datFileStruct* partman::load_records(LPCSTR lpFileName)
char* tempBuff = (char*)memoryallocate(bmpHeader.Size);
_hread(fileHandle, tempBuff, bmpHeader.Size);
memoryfree(tempBuff);
*((int*)entryData->Buffer + 29) = bmpHeader.XPosition;
*((int*)entryData->Buffer + 33) = bmpHeader.YPosition;
//*((int*)entryData->Buffer + 29) = bmpHeader.XPosition;
//*((int*)entryData->Buffer + 33) = bmpHeader.YPosition;
}
else
{

View file

@ -14,6 +14,7 @@
#include <cstdio>
#include <cassert>
#include <cmath>
//#include <cstdlib>
#define memoryallocate(x) malloc(x);
#define memoryfree(x) free(x);

View file

@ -3,3 +3,4 @@
int pinball::quickFlag = 0;
int pinball::render_background_bitmap = 0;

View file

@ -3,6 +3,7 @@ class pinball
{
public:
static int quickFlag;
static int render_background_bitmap;
private:
};

View file

@ -0,0 +1,14 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by SpaceCadetPinball.rc
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View file

@ -0,0 +1,44 @@
#include "pch.h"
#include "score.h"
#include "loader.h"
#include "partman.h"
scoreStruct* score::create(LPCSTR fieldName, int renderBgBmp)
{
scoreStruct* score = (scoreStruct*)memoryallocate(sizeof(scoreStruct));
if (!score)
return nullptr;
score->Unknown1 = -9999;
score->RenderBgBmp = renderBgBmp;
__int16* shortArr = (__int16*)partman::field_labeled(loader::loader_table, fieldName, ShortArray);
if (!shortArr)
{
memoryfree(score);
return nullptr;
}
int groupIndex = *shortArr++;
score->Short1 = *shortArr++;
score->Short2 = *shortArr++;
score->Short3 = *shortArr++;
score->Short4 = *shortArr;
char** bmpPtr = &score->Bitmap8Bit1;
int index = 10;
do
{
*bmpPtr = partman::field(loader::loader_table, groupIndex, Bitmap8bit);
++bmpPtr;
++groupIndex;
--index;
}
while (index);
return score;
}
scoreStruct* score::dup(scoreStruct* score, int scoreIndex)
{
scoreStruct* result = (scoreStruct*)memoryallocate(0x44u);
if (result)
memcpy(result, score, sizeof(scoreStruct));
return result;
}

30
SpaceCadetPinball/score.h Normal file
View file

@ -0,0 +1,30 @@
#pragma once
struct scoreStruct
{
int Unknown1;
int Unknown2;
int RenderBgBmp;
int Short1;
int Short2;
int Short3;
int Short4;
char* Bitmap8Bit1;
char* Bitmap8Bit2;
char* Bitmap8Bit3;
char* Bitmap8Bit4;
char* Bitmap8Bit5;
char* Bitmap8Bit6;
char* Bitmap8Bit7;
char* Bitmap8Bit8;
char* Bitmap8Bit9;
char* Bitmap8Bit10;
};
class score
{
public:
static scoreStruct* create(LPCSTR fieldName, int renderBgBmp);
static scoreStruct* dup(scoreStruct* score, int scoreIndex);
};