diff --git a/CompileForDrMemory.bat b/CompileForDrMemory.bat
new file mode 100644
index 0000000..13ab55b
--- /dev/null
+++ b/CompileForDrMemory.bat
@@ -0,0 +1 @@
+cl /Zi /MT /EHsc /O y- /Ob0 /Femyapp.exe *.cpp user32.lib
\ No newline at end of file
diff --git a/SpaceCadetPinball/DatParser.cpp b/SpaceCadetPinball/DatParser.cpp
index d43bc91..6926527 100644
--- a/SpaceCadetPinball/DatParser.cpp
+++ b/SpaceCadetPinball/DatParser.cpp
@@ -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);
diff --git a/SpaceCadetPinball/SpaceCadetPinball.cpp b/SpaceCadetPinball/SpaceCadetPinball.cpp
index 29faee9..ff7e48d 100644
--- a/SpaceCadetPinball/SpaceCadetPinball.cpp
+++ b/SpaceCadetPinball/SpaceCadetPinball.cpp
@@ -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);
@@ -36,22 +38,24 @@ int main()
assert(partman::record_labeled(datFile, "background") == 2);
assert(partman::record_labeled(datFile, "a_bump1") == 372);
-
+
assert(memcmp(partman::field_labeled(datFile, "table_size", ShortArray), new short[2]{ 600, 416 }, 2 * 2) == 0);
//loader::error(25, 26);
loader::loadfrom(datFile);
-
loader::get_sound_id(18);
-
visualStruct visual1{};
loader::material(96, &visual1);
- loader::query_visual(283,0, &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
diff --git a/SpaceCadetPinball/SpaceCadetPinball.rc b/SpaceCadetPinball/SpaceCadetPinball.rc
new file mode 100644
index 0000000..129cc14
--- /dev/null
+++ b/SpaceCadetPinball/SpaceCadetPinball.rc
@@ -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
diff --git a/SpaceCadetPinball/SpaceCadetPinball.vcxproj b/SpaceCadetPinball/SpaceCadetPinball.vcxproj
index fcb8490..e07fc42 100644
--- a/SpaceCadetPinball/SpaceCadetPinball.vcxproj
+++ b/SpaceCadetPinball/SpaceCadetPinball.vcxproj
@@ -91,7 +91,7 @@
WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
true
pch.h
- false
+ true
Console
@@ -158,6 +158,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -171,11 +204,45 @@
Create
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/SpaceCadetPinball/SpaceCadetPinball.vcxproj.filters b/SpaceCadetPinball/SpaceCadetPinball.vcxproj.filters
index 1cc0941..515e5d8 100644
--- a/SpaceCadetPinball/SpaceCadetPinball.vcxproj.filters
+++ b/SpaceCadetPinball/SpaceCadetPinball.vcxproj.filters
@@ -13,6 +13,12 @@
{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
+
+ {9ee086c2-1a95-48fb-92d8-4b7e7f6682ff}
+
+
+ {33813da8-81ac-449c-b19a-9756272519b9}
+
@@ -33,6 +39,105 @@
Header Files
+
+ Header Files
+
+
+ Header Files\PinballComponents
+
+
+ Header Files\PinballComponents
+
+
+ Header Files\PinballComponents
+
+
+ Header Files\PinballComponents
+
+
+ Header Files\PinballComponents
+
+
+ Header Files\PinballComponents
+
+
+ Header Files
+
+
+ Header Files\PinballComponents
+
+
+ Header Files\PinballComponents
+
+
+ Header Files\PinballComponents
+
+
+ Header Files\PinballComponents
+
+
+ Header Files\PinballComponents
+
+
+ Header Files\PinballComponents
+
+
+ Header Files\PinballComponents
+
+
+ Header Files\PinballComponents
+
+
+ Header Files\PinballComponents
+
+
+ Header Files\PinballComponents
+
+
+ Header Files\PinballComponents
+
+
+ Header Files\PinballComponents
+
+
+ Header Files\PinballComponents
+
+
+ Header Files\PinballComponents
+
+
+ Header Files\PinballComponents
+
+
+ Header Files\PinballComponents
+
+
+ Header Files\PinballComponents
+
+
+ Header Files\PinballComponents
+
+
+ Header Files\PinballComponents
+
+
+ Header Files\PinballComponents
+
+
+ Header Files\PinballComponents
+
+
+ Header Files\PinballComponents
+
+
+ Header Files\PinballComponents
+
+
+ Header Files\PinballComponents
+
+
+ Header Files\PinballComponents
+
@@ -56,8 +161,106 @@
Source Files
+
+ Source Files
+
+
+ Source Files\PinballComponents
+
+
+ Source Files\PinballComponents
+
+
+ Source Files\PinballComponents
+
+
+ Source Files\PinballComponents
+
+
+ Source Files\PinballComponents
+
+
+ Source Files\PinballComponents
+
+
+ Source Files\PinballComponents
+
+
+ Source Files\PinballComponents
+
+
+ Source Files\PinballComponents
+
+
+ Source Files\PinballComponents
+
+
+ Source Files\PinballComponents
+
+
+ Source Files\PinballComponents
+
+
+ Source Files\PinballComponents
+
+
+ Source Files\PinballComponents
+
+
+ Source Files\PinballComponents
+
+
+ Source Files\PinballComponents
+
+
+ Source Files\PinballComponents
+
+
+ Source Files\PinballComponents
+
+
+ Source Files\PinballComponents
+
+
+ Source Files\PinballComponents
+
+
+ Source Files\PinballComponents
+
+
+ Source Files\PinballComponents
+
+
+ Source Files\PinballComponents
+
+
+ Source Files\PinballComponents
+
+
+ Source Files\PinballComponents
+
+
+ Source Files\PinballComponents
+
+
+ Source Files\PinballComponents
+
+
+ Source Files\PinballComponents
+
+
+ Source Files\PinballComponents
+
+
+ Source Files\PinballComponents
+
+
+
+ Resource Files
+
+
\ No newline at end of file
diff --git a/SpaceCadetPinball/TBall.cpp b/SpaceCadetPinball/TBall.cpp
new file mode 100644
index 0000000..356ab02
--- /dev/null
+++ b/SpaceCadetPinball/TBall.cpp
@@ -0,0 +1,2 @@
+#include "pch.h"
+#include "TBall.h"
diff --git a/SpaceCadetPinball/TBall.h b/SpaceCadetPinball/TBall.h
new file mode 100644
index 0000000..190750f
--- /dev/null
+++ b/SpaceCadetPinball/TBall.h
@@ -0,0 +1,11 @@
+#pragma once
+#include "TPinballComponent.h"
+
+class TBall :
+ public TPinballComponent
+{
+public :
+ TBall(TPinballTable* table): TPinballComponent(table, -1, false)
+ {
+ }
+};
diff --git a/SpaceCadetPinball/TBlocker.cpp b/SpaceCadetPinball/TBlocker.cpp
new file mode 100644
index 0000000..fec1903
--- /dev/null
+++ b/SpaceCadetPinball/TBlocker.cpp
@@ -0,0 +1,2 @@
+#include "pch.h"
+#include "TBlocker.h"
diff --git a/SpaceCadetPinball/TBlocker.h b/SpaceCadetPinball/TBlocker.h
new file mode 100644
index 0000000..ba82ab9
--- /dev/null
+++ b/SpaceCadetPinball/TBlocker.h
@@ -0,0 +1,11 @@
+#pragma once
+#include "TPinballComponent.h"
+class TBlocker :
+ public TPinballComponent
+{
+public:
+ TBlocker(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, false)
+ {
+ }
+};
+
diff --git a/SpaceCadetPinball/TBumper.cpp b/SpaceCadetPinball/TBumper.cpp
new file mode 100644
index 0000000..a1fbd91
--- /dev/null
+++ b/SpaceCadetPinball/TBumper.cpp
@@ -0,0 +1,2 @@
+#include "pch.h"
+#include "TBumper.h"
diff --git a/SpaceCadetPinball/TBumper.h b/SpaceCadetPinball/TBumper.h
new file mode 100644
index 0000000..4667158
--- /dev/null
+++ b/SpaceCadetPinball/TBumper.h
@@ -0,0 +1,11 @@
+#pragma once
+#include "TPinballComponent.h"
+class TBumper :
+ public TPinballComponent
+{
+public:
+ TBumper(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, false)
+ {
+ }
+};
+
diff --git a/SpaceCadetPinball/TComponentGroup.cpp b/SpaceCadetPinball/TComponentGroup.cpp
new file mode 100644
index 0000000..eda558b
--- /dev/null
+++ b/SpaceCadetPinball/TComponentGroup.cpp
@@ -0,0 +1,2 @@
+#include "pch.h"
+#include "TComponentGroup.h"
diff --git a/SpaceCadetPinball/TComponentGroup.h b/SpaceCadetPinball/TComponentGroup.h
new file mode 100644
index 0000000..7e7ba81
--- /dev/null
+++ b/SpaceCadetPinball/TComponentGroup.h
@@ -0,0 +1,11 @@
+#pragma once
+#include "TPinballComponent.h"
+class TComponentGroup :
+ public TPinballComponent
+{
+public:
+ TComponentGroup(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, false)
+ {
+ }
+};
+
diff --git a/SpaceCadetPinball/TDemo.cpp b/SpaceCadetPinball/TDemo.cpp
new file mode 100644
index 0000000..2f5c9b1
--- /dev/null
+++ b/SpaceCadetPinball/TDemo.cpp
@@ -0,0 +1,2 @@
+#include "pch.h"
+#include "TDemo.h"
diff --git a/SpaceCadetPinball/TDemo.h b/SpaceCadetPinball/TDemo.h
new file mode 100644
index 0000000..8e79156
--- /dev/null
+++ b/SpaceCadetPinball/TDemo.h
@@ -0,0 +1,11 @@
+#pragma once
+#include "TPinballComponent.h"
+class TDemo :
+ public TPinballComponent
+{
+public:
+ TDemo(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, false)
+ {
+ }
+};
+
diff --git a/SpaceCadetPinball/TDrain.cpp b/SpaceCadetPinball/TDrain.cpp
new file mode 100644
index 0000000..7d0207d
--- /dev/null
+++ b/SpaceCadetPinball/TDrain.cpp
@@ -0,0 +1,2 @@
+#include "pch.h"
+#include "TDrain.h"
diff --git a/SpaceCadetPinball/TDrain.h b/SpaceCadetPinball/TDrain.h
new file mode 100644
index 0000000..f8885a0
--- /dev/null
+++ b/SpaceCadetPinball/TDrain.h
@@ -0,0 +1,11 @@
+#pragma once
+#include "TPinballComponent.h"
+class TDrain :
+ public TPinballComponent
+{
+public:
+ TDrain(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, false)
+ {
+ }
+};
+
diff --git a/SpaceCadetPinball/TFlagSpinner.cpp b/SpaceCadetPinball/TFlagSpinner.cpp
new file mode 100644
index 0000000..880c15c
--- /dev/null
+++ b/SpaceCadetPinball/TFlagSpinner.cpp
@@ -0,0 +1,2 @@
+#include "pch.h"
+#include "TFlagSpinner.h"
diff --git a/SpaceCadetPinball/TFlagSpinner.h b/SpaceCadetPinball/TFlagSpinner.h
new file mode 100644
index 0000000..f9a52f6
--- /dev/null
+++ b/SpaceCadetPinball/TFlagSpinner.h
@@ -0,0 +1,11 @@
+#pragma once
+#include "TPinballComponent.h"
+class TFlagSpinner :
+ public TPinballComponent
+{
+public:
+ TFlagSpinner(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, false)
+ {
+ }
+};
+
diff --git a/SpaceCadetPinball/TFlipper.cpp b/SpaceCadetPinball/TFlipper.cpp
new file mode 100644
index 0000000..d515cd4
--- /dev/null
+++ b/SpaceCadetPinball/TFlipper.cpp
@@ -0,0 +1,2 @@
+#include "pch.h"
+#include "TFlipper.h"
diff --git a/SpaceCadetPinball/TFlipper.h b/SpaceCadetPinball/TFlipper.h
new file mode 100644
index 0000000..067f285
--- /dev/null
+++ b/SpaceCadetPinball/TFlipper.h
@@ -0,0 +1,11 @@
+#pragma once
+#include "TPinballComponent.h"
+class TFlipper :
+ public TPinballComponent
+{
+public:
+ TFlipper(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, false)
+ {
+ }
+};
+
diff --git a/SpaceCadetPinball/TGate.cpp b/SpaceCadetPinball/TGate.cpp
new file mode 100644
index 0000000..658a405
--- /dev/null
+++ b/SpaceCadetPinball/TGate.cpp
@@ -0,0 +1,2 @@
+#include "pch.h"
+#include "TGate.h"
diff --git a/SpaceCadetPinball/TGate.h b/SpaceCadetPinball/TGate.h
new file mode 100644
index 0000000..b89f084
--- /dev/null
+++ b/SpaceCadetPinball/TGate.h
@@ -0,0 +1,11 @@
+#pragma once
+#include "TPinballComponent.h"
+class TGate :
+ public TPinballComponent
+{
+public:
+ TGate(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, false)
+ {
+ }
+};
+
diff --git a/SpaceCadetPinball/THole.cpp b/SpaceCadetPinball/THole.cpp
new file mode 100644
index 0000000..c3a5722
--- /dev/null
+++ b/SpaceCadetPinball/THole.cpp
@@ -0,0 +1,2 @@
+#include "pch.h"
+#include "THole.h"
diff --git a/SpaceCadetPinball/THole.h b/SpaceCadetPinball/THole.h
new file mode 100644
index 0000000..7d34ab9
--- /dev/null
+++ b/SpaceCadetPinball/THole.h
@@ -0,0 +1,11 @@
+#pragma once
+#include "TPinballComponent.h"
+class THole :
+ public TPinballComponent
+{
+public:
+ THole(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, false)
+ {
+ }
+};
+
diff --git a/SpaceCadetPinball/TKickback.cpp b/SpaceCadetPinball/TKickback.cpp
new file mode 100644
index 0000000..c8d7c6d
--- /dev/null
+++ b/SpaceCadetPinball/TKickback.cpp
@@ -0,0 +1,2 @@
+#include "pch.h"
+#include "TKickback.h"
diff --git a/SpaceCadetPinball/TKickback.h b/SpaceCadetPinball/TKickback.h
new file mode 100644
index 0000000..25c8a99
--- /dev/null
+++ b/SpaceCadetPinball/TKickback.h
@@ -0,0 +1,11 @@
+#pragma once
+#include "TPinballComponent.h"
+class TKickback :
+ public TPinballComponent
+{
+public:
+ TKickback(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, false)
+ {
+ }
+};
+
diff --git a/SpaceCadetPinball/TKickout.cpp b/SpaceCadetPinball/TKickout.cpp
new file mode 100644
index 0000000..1900a17
--- /dev/null
+++ b/SpaceCadetPinball/TKickout.cpp
@@ -0,0 +1,2 @@
+#include "pch.h"
+#include "TKickout.h"
diff --git a/SpaceCadetPinball/TKickout.h b/SpaceCadetPinball/TKickout.h
new file mode 100644
index 0000000..04b4d95
--- /dev/null
+++ b/SpaceCadetPinball/TKickout.h
@@ -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)
+ {
+ }
+};
+
diff --git a/SpaceCadetPinball/TLight.cpp b/SpaceCadetPinball/TLight.cpp
new file mode 100644
index 0000000..9e0ecdd
--- /dev/null
+++ b/SpaceCadetPinball/TLight.cpp
@@ -0,0 +1,2 @@
+#include "pch.h"
+#include "TLight.h"
diff --git a/SpaceCadetPinball/TLight.h b/SpaceCadetPinball/TLight.h
new file mode 100644
index 0000000..b824302
--- /dev/null
+++ b/SpaceCadetPinball/TLight.h
@@ -0,0 +1,11 @@
+#pragma once
+#include "TPinballComponent.h"
+class TLight :
+ public TPinballComponent
+{
+public:
+ TLight(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, false)
+ {
+ }
+};
+
diff --git a/SpaceCadetPinball/TLightBargraph.cpp b/SpaceCadetPinball/TLightBargraph.cpp
new file mode 100644
index 0000000..5b38f87
--- /dev/null
+++ b/SpaceCadetPinball/TLightBargraph.cpp
@@ -0,0 +1,2 @@
+#include "pch.h"
+#include "TLightBargraph.h"
diff --git a/SpaceCadetPinball/TLightBargraph.h b/SpaceCadetPinball/TLightBargraph.h
new file mode 100644
index 0000000..e042eb2
--- /dev/null
+++ b/SpaceCadetPinball/TLightBargraph.h
@@ -0,0 +1,11 @@
+#pragma once
+#include "TPinballComponent.h"
+class TLightBargraph :
+ public TPinballComponent
+{
+public:
+ TLightBargraph(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, false)
+ {
+ }
+};
+
diff --git a/SpaceCadetPinball/TLightGroup.cpp b/SpaceCadetPinball/TLightGroup.cpp
new file mode 100644
index 0000000..a0bb06f
--- /dev/null
+++ b/SpaceCadetPinball/TLightGroup.cpp
@@ -0,0 +1,2 @@
+#include "pch.h"
+#include "TLightGroup.h"
diff --git a/SpaceCadetPinball/TLightGroup.h b/SpaceCadetPinball/TLightGroup.h
new file mode 100644
index 0000000..1d78ae8
--- /dev/null
+++ b/SpaceCadetPinball/TLightGroup.h
@@ -0,0 +1,11 @@
+#pragma once
+#include "TPinballComponent.h"
+class TLightGroup :
+ public TPinballComponent
+{
+public:
+ TLightGroup(TPinballTable* table,int ind) : TPinballComponent(table, -1, false)
+ {
+ }
+};
+
diff --git a/SpaceCadetPinball/TLightRollover.cpp b/SpaceCadetPinball/TLightRollover.cpp
new file mode 100644
index 0000000..71e40f3
--- /dev/null
+++ b/SpaceCadetPinball/TLightRollover.cpp
@@ -0,0 +1,2 @@
+#include "pch.h"
+#include "TLightRollover.h"
diff --git a/SpaceCadetPinball/TLightRollover.h b/SpaceCadetPinball/TLightRollover.h
new file mode 100644
index 0000000..07c21a3
--- /dev/null
+++ b/SpaceCadetPinball/TLightRollover.h
@@ -0,0 +1,11 @@
+#pragma once
+#include "TPinballComponent.h"
+class TLightRollover :
+ public TPinballComponent
+{
+public:
+ TLightRollover(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, false)
+ {
+ }
+};
+
diff --git a/SpaceCadetPinball/TOneway.cpp b/SpaceCadetPinball/TOneway.cpp
new file mode 100644
index 0000000..6ead957
--- /dev/null
+++ b/SpaceCadetPinball/TOneway.cpp
@@ -0,0 +1,2 @@
+#include "pch.h"
+#include "TOneway.h"
diff --git a/SpaceCadetPinball/TOneway.h b/SpaceCadetPinball/TOneway.h
new file mode 100644
index 0000000..75884af
--- /dev/null
+++ b/SpaceCadetPinball/TOneway.h
@@ -0,0 +1,11 @@
+#pragma once
+#include "TPinballComponent.h"
+class TOneway :
+ public TPinballComponent
+{
+public:
+ TOneway(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, false)
+ {
+ }
+};
+
diff --git a/SpaceCadetPinball/TPinballComponent.cpp b/SpaceCadetPinball/TPinballComponent.cpp
new file mode 100644
index 0000000..1ce8268
--- /dev/null
+++ b/SpaceCadetPinball/TPinballComponent.cpp
@@ -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;
+}
diff --git a/SpaceCadetPinball/TPinballComponent.h b/SpaceCadetPinball/TPinballComponent.h
new file mode 100644
index 0000000..9fe34e0
--- /dev/null
+++ b/SpaceCadetPinball/TPinballComponent.h
@@ -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;
+};
+
diff --git a/SpaceCadetPinball/TPinballTable.cpp b/SpaceCadetPinball/TPinballTable.cpp
new file mode 100644
index 0000000..af6ae64
--- /dev/null
+++ b/SpaceCadetPinball/TPinballTable.cpp
@@ -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);*/
+}
diff --git a/SpaceCadetPinball/TPinballTable.h b/SpaceCadetPinball/TPinballTable.h
new file mode 100644
index 0000000..71c08e0
--- /dev/null
+++ b/SpaceCadetPinball/TPinballTable.h
@@ -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;
+};
+
diff --git a/SpaceCadetPinball/TPlunger.cpp b/SpaceCadetPinball/TPlunger.cpp
new file mode 100644
index 0000000..f32574c
--- /dev/null
+++ b/SpaceCadetPinball/TPlunger.cpp
@@ -0,0 +1,2 @@
+#include "pch.h"
+#include "TPlunger.h"
diff --git a/SpaceCadetPinball/TPlunger.h b/SpaceCadetPinball/TPlunger.h
new file mode 100644
index 0000000..3d917de
--- /dev/null
+++ b/SpaceCadetPinball/TPlunger.h
@@ -0,0 +1,11 @@
+#pragma once
+#include "TPinballComponent.h"
+
+class TPlunger :
+ public TPinballComponent
+{
+public:
+ TPlunger(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, false)
+ {
+ }
+};
diff --git a/SpaceCadetPinball/TPopupTarget.cpp b/SpaceCadetPinball/TPopupTarget.cpp
new file mode 100644
index 0000000..9b250ab
--- /dev/null
+++ b/SpaceCadetPinball/TPopupTarget.cpp
@@ -0,0 +1,2 @@
+#include "pch.h"
+#include "TPopupTarget.h"
diff --git a/SpaceCadetPinball/TPopupTarget.h b/SpaceCadetPinball/TPopupTarget.h
new file mode 100644
index 0000000..3793d4f
--- /dev/null
+++ b/SpaceCadetPinball/TPopupTarget.h
@@ -0,0 +1,11 @@
+#pragma once
+#include "TPinballComponent.h"
+class TPopupTarget :
+ public TPinballComponent
+{
+public:
+ TPopupTarget(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, false)
+ {
+ }
+};
+
diff --git a/SpaceCadetPinball/TRamp.cpp b/SpaceCadetPinball/TRamp.cpp
new file mode 100644
index 0000000..5143142
--- /dev/null
+++ b/SpaceCadetPinball/TRamp.cpp
@@ -0,0 +1,2 @@
+#include "pch.h"
+#include "TRamp.h"
diff --git a/SpaceCadetPinball/TRamp.h b/SpaceCadetPinball/TRamp.h
new file mode 100644
index 0000000..29c9249
--- /dev/null
+++ b/SpaceCadetPinball/TRamp.h
@@ -0,0 +1,11 @@
+#pragma once
+#include "TPinballComponent.h"
+class TRamp :
+ public TPinballComponent
+{
+public:
+ TRamp(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, false)
+ {
+ }
+};
+
diff --git a/SpaceCadetPinball/TRollover.cpp b/SpaceCadetPinball/TRollover.cpp
new file mode 100644
index 0000000..2dd2273
--- /dev/null
+++ b/SpaceCadetPinball/TRollover.cpp
@@ -0,0 +1,2 @@
+#include "pch.h"
+#include "TRollover.h"
diff --git a/SpaceCadetPinball/TRollover.h b/SpaceCadetPinball/TRollover.h
new file mode 100644
index 0000000..b2e5859
--- /dev/null
+++ b/SpaceCadetPinball/TRollover.h
@@ -0,0 +1,11 @@
+#pragma once
+#include "TPinballComponent.h"
+class TRollover :
+ public TPinballComponent
+{
+public:
+ TRollover(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, false)
+ {
+ }
+};
+
diff --git a/SpaceCadetPinball/TSink.cpp b/SpaceCadetPinball/TSink.cpp
new file mode 100644
index 0000000..8f76394
--- /dev/null
+++ b/SpaceCadetPinball/TSink.cpp
@@ -0,0 +1,2 @@
+#include "pch.h"
+#include "TSink.h"
diff --git a/SpaceCadetPinball/TSink.h b/SpaceCadetPinball/TSink.h
new file mode 100644
index 0000000..c4b007a
--- /dev/null
+++ b/SpaceCadetPinball/TSink.h
@@ -0,0 +1,11 @@
+#pragma once
+#include "TPinballComponent.h"
+class TSink :
+ public TPinballComponent
+{
+public:
+ TSink(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, false)
+ {
+ }
+};
+
diff --git a/SpaceCadetPinball/TSoloTarget.cpp b/SpaceCadetPinball/TSoloTarget.cpp
new file mode 100644
index 0000000..2c3036d
--- /dev/null
+++ b/SpaceCadetPinball/TSoloTarget.cpp
@@ -0,0 +1,2 @@
+#include "pch.h"
+#include "TSoloTarget.h"
diff --git a/SpaceCadetPinball/TSoloTarget.h b/SpaceCadetPinball/TSoloTarget.h
new file mode 100644
index 0000000..c290ef6
--- /dev/null
+++ b/SpaceCadetPinball/TSoloTarget.h
@@ -0,0 +1,11 @@
+#pragma once
+#include "TPinballComponent.h"
+class TSoloTarget :
+ public TPinballComponent
+{
+public:
+ TSoloTarget(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, false)
+ {
+ }
+};
+
diff --git a/SpaceCadetPinball/TSound.cpp b/SpaceCadetPinball/TSound.cpp
new file mode 100644
index 0000000..5c30db5
--- /dev/null
+++ b/SpaceCadetPinball/TSound.cpp
@@ -0,0 +1,2 @@
+#include "pch.h"
+#include "TSound.h"
diff --git a/SpaceCadetPinball/TSound.h b/SpaceCadetPinball/TSound.h
new file mode 100644
index 0000000..9f8074b
--- /dev/null
+++ b/SpaceCadetPinball/TSound.h
@@ -0,0 +1,11 @@
+#pragma once
+#include "TPinballComponent.h"
+class TSound :
+ public TPinballComponent
+{
+public:
+ TSound(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, false)
+ {
+ }
+};
+
diff --git a/SpaceCadetPinball/TTableLayer.cpp b/SpaceCadetPinball/TTableLayer.cpp
new file mode 100644
index 0000000..eaa0981
--- /dev/null
+++ b/SpaceCadetPinball/TTableLayer.cpp
@@ -0,0 +1,2 @@
+#include "pch.h"
+#include "TTableLayer.h"
diff --git a/SpaceCadetPinball/TTableLayer.h b/SpaceCadetPinball/TTableLayer.h
new file mode 100644
index 0000000..7ed6e70
--- /dev/null
+++ b/SpaceCadetPinball/TTableLayer.h
@@ -0,0 +1,11 @@
+#pragma once
+#include "TPinballComponent.h"
+class TTableLayer :
+ public TPinballComponent
+{
+public:
+ TTableLayer(TPinballTable* table) : TPinballComponent(table, -1, false)
+ {
+ }
+};
+
diff --git a/SpaceCadetPinball/TTextBox.cpp b/SpaceCadetPinball/TTextBox.cpp
new file mode 100644
index 0000000..14b2a3d
--- /dev/null
+++ b/SpaceCadetPinball/TTextBox.cpp
@@ -0,0 +1,2 @@
+#include "pch.h"
+#include "TTextBox.h"
diff --git a/SpaceCadetPinball/TTextBox.h b/SpaceCadetPinball/TTextBox.h
new file mode 100644
index 0000000..978814c
--- /dev/null
+++ b/SpaceCadetPinball/TTextBox.h
@@ -0,0 +1,11 @@
+#pragma once
+#include "TPinballComponent.h"
+class TTextBox :
+ public TPinballComponent
+{
+public:
+ TTextBox(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, false)
+ {
+ }
+};
+
diff --git a/SpaceCadetPinball/TTimer.cpp b/SpaceCadetPinball/TTimer.cpp
new file mode 100644
index 0000000..6821d49
--- /dev/null
+++ b/SpaceCadetPinball/TTimer.cpp
@@ -0,0 +1,2 @@
+#include "pch.h"
+#include "TTimer.h"
diff --git a/SpaceCadetPinball/TTimer.h b/SpaceCadetPinball/TTimer.h
new file mode 100644
index 0000000..985e43b
--- /dev/null
+++ b/SpaceCadetPinball/TTimer.h
@@ -0,0 +1,11 @@
+#pragma once
+#include "TPinballComponent.h"
+class TTimer :
+ public TPinballComponent
+{
+public:
+ TTimer(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, false)
+ {
+ }
+};
+
diff --git a/SpaceCadetPinball/TTripwire.cpp b/SpaceCadetPinball/TTripwire.cpp
new file mode 100644
index 0000000..ae80677
--- /dev/null
+++ b/SpaceCadetPinball/TTripwire.cpp
@@ -0,0 +1,2 @@
+#include "pch.h"
+#include "TTripwire.h"
diff --git a/SpaceCadetPinball/TTripwire.h b/SpaceCadetPinball/TTripwire.h
new file mode 100644
index 0000000..f000939
--- /dev/null
+++ b/SpaceCadetPinball/TTripwire.h
@@ -0,0 +1,11 @@
+#pragma once
+#include "TPinballComponent.h"
+class TTripwire :
+ public TPinballComponent
+{
+public:
+ TTripwire(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, false)
+ {
+ }
+};
+
diff --git a/SpaceCadetPinball/TZmapList.h b/SpaceCadetPinball/TZmapList.h
new file mode 100644
index 0000000..fdb970d
--- /dev/null
+++ b/SpaceCadetPinball/TZmapList.h
@@ -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(){};
+};
+
diff --git a/SpaceCadetPinball/loader.cpp b/SpaceCadetPinball/loader.cpp
index 4df8158..d25e4f4 100644
--- a/SpaceCadetPinball/loader.cpp
+++ b/SpaceCadetPinball/loader.cpp
@@ -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(_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);
diff --git a/SpaceCadetPinball/loader.h b/SpaceCadetPinball/loader.h
index 519ed4d..0b0f966 100644
--- a/SpaceCadetPinball/loader.h
+++ b/SpaceCadetPinball/loader.h
@@ -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);
-private:
- static errorMsg loader_errors[];
static datFileStruct* loader_table;
+private:
+ static errorMsg loader_errors[];
static datFileStruct* sound_record_table;
static int sound_count;
static int loader_sound_count;
diff --git a/SpaceCadetPinball/objlist_class.cpp b/SpaceCadetPinball/objlist_class.cpp
index d293102..7a3d0f1 100644
--- a/SpaceCadetPinball/objlist_class.cpp
+++ b/SpaceCadetPinball/objlist_class.cpp
@@ -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)
@@ -53,14 +60,14 @@ int objlist_class::objlist_add_object(objlist_struct1* ptrToStruct, int value)
}
objlist_struct1* objlist_class::objlist_grow(objlist_struct1* ptrToStruct, int growSize)
-{
+{
objlist_struct1* resultPtr = ptrToStruct;
if (!ptrToStruct)
return resultPtr;
int newSizeInt = growSize + ptrToStruct->Count;
if (newSizeInt <= ptrToStruct->Size)
- return resultPtr;
- objlist_struct1* resultPtr2 = (objlist_struct1 *)realloc(ptrToStruct, 4 * newSizeInt + 12);
+ return resultPtr;
+ 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;
diff --git a/SpaceCadetPinball/objlist_class.h b/SpaceCadetPinball/objlist_class.h
index d471ace..53b07d2 100644
--- a/SpaceCadetPinball/objlist_class.h
+++ b/SpaceCadetPinball/objlist_class.h
@@ -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);
-};
\ No newline at end of file
+ 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);
+};
diff --git a/SpaceCadetPinball/partman.cpp b/SpaceCadetPinball/partman.cpp
index 6200bd2..43e6a96 100644
--- a/SpaceCadetPinball/partman.cpp
+++ b/SpaceCadetPinball/partman.cpp
@@ -115,11 +115,11 @@ 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
- {
+ {
char* entryBuffer = (char*)memoryallocate(fieldSize);
entryData->Buffer = entryBuffer;
if (!entryBuffer)
diff --git a/SpaceCadetPinball/pch.h b/SpaceCadetPinball/pch.h
index ee65bcc..7388b49 100644
--- a/SpaceCadetPinball/pch.h
+++ b/SpaceCadetPinball/pch.h
@@ -14,6 +14,7 @@
#include
#include
#include
+//#include
#define memoryallocate(x) malloc(x);
#define memoryfree(x) free(x);
diff --git a/SpaceCadetPinball/pinball.cpp b/SpaceCadetPinball/pinball.cpp
index 5b10c53..b671a9d 100644
--- a/SpaceCadetPinball/pinball.cpp
+++ b/SpaceCadetPinball/pinball.cpp
@@ -2,4 +2,5 @@
#include "pinball.h"
-int pinball::quickFlag = 0;
\ No newline at end of file
+int pinball::quickFlag = 0;
+int pinball::render_background_bitmap = 0;
\ No newline at end of file
diff --git a/SpaceCadetPinball/pinball.h b/SpaceCadetPinball/pinball.h
index 38f56fd..569d1e2 100644
--- a/SpaceCadetPinball/pinball.h
+++ b/SpaceCadetPinball/pinball.h
@@ -3,6 +3,7 @@ class pinball
{
public:
static int quickFlag;
+ static int render_background_bitmap;
private:
};
diff --git a/SpaceCadetPinball/resource.h b/SpaceCadetPinball/resource.h
new file mode 100644
index 0000000..6f8a5f7
--- /dev/null
+++ b/SpaceCadetPinball/resource.h
@@ -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
diff --git a/SpaceCadetPinball/score.cpp b/SpaceCadetPinball/score.cpp
new file mode 100644
index 0000000..539ac42
--- /dev/null
+++ b/SpaceCadetPinball/score.cpp
@@ -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;
+}
diff --git a/SpaceCadetPinball/score.h b/SpaceCadetPinball/score.h
new file mode 100644
index 0000000..10ed909
--- /dev/null
+++ b/SpaceCadetPinball/score.h
@@ -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);
+};
+