add partman.h and parman.cpp, begin migrate to class. add sdl headers to cmake

This commit is contained in:
Sydney Biscuit committed 2019-08-19 13:03:13 -07:00
1 parent d0beb8d2a7
commit aa3c4078dd
7 files changed
+201 -466

No files matched your search

+36 -11
View File
@@ -3,11 +3,10 @@ project(3d_pinball_space_cadet)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_C_COMPILER, gcc)
set(CMAKE_CXX_COMPILER, g++)
set(SOURCE_FILES
Classes/Objlist/Objlist.cpp
Classes/classes.h
Classes/Objlist/Objlist_Class.cpp
Classes/Objlist/Objlist.cpp
Classes/Objlist/objlist.h
Classes/TBall/TBall.cpp
Classes/TBall/TBall.h
@@ -57,6 +56,11 @@ set(SOURCE_FILES
Classes/TTripwire/TTripwire.cpp
Classes/TWall/TWall.cpp
Classes/TZmapList/TZmapList.cpp
Forms/about.cpp
Forms/options.cpp
Forms/help.cpp
Forms/highscore.cpp
Forms/winmain.cpp
geometry/edges.cpp
geometry/geometry.cpp
graphics/flasher.cpp
@@ -69,23 +73,44 @@ set(SOURCE_FILES
partman/partman.cpp
sound/midi.cpp
sound/sound.cpp
about.cpp
sound/wavemix.cpp
control.cpp
exceptionhandling.cpp
help.cpp
highscore.cpp
guicon.cpp
lights.cpp
memory.cpp
missions.cpp
objlist.cpp
options.cpp
pinball.cpp
pinball.h
score.cpp
table.cpp
underscore.cpp
vectors.cpp
wavemix.cpp
windows.cpp)
add_library(SDL2 IMPORTED SHARED)
set_target_properties(SDL2 PROPERTIES
IMPORTED_LOCATION "/SDL/SDL2-2.0.10/lib/x64/SDL2.dll"
INTERFACE_INCLUDE_DIRECTORIES "/SDL/SDL2-2.0.10/include"
)
add_library(SDL2_IMAGE IMPORTED SHARED)
set_target_properties(SDL2_IMAGE PROPERTIES
IMPORTED_LOCATION "/SDL/SDL2_image-2.0.5/lib/x64/SDL2_image.dll"
INTERFACE_INCLUDE_DIRECTORIES "/SDL/SDL2_image-2.0.5/include"
)
add_library(SDL2_MIXER IMPORTED SHARED)
set_target_properties(SDL2_MIXER PROPERTIES
IMPORTED_LOCATION "/SDL/SDL2_mixer-2.0.4/lib/x64/SDL2_mixer.dll"
INTERFACE_INCLUDE_DIRECTORIES "/SDL/SDL2_mixer-2.0.4/include"
)
target_link_libraries(SDL2 INTERFACE
SDL2_IMAGE INTERFACE
SDL2_MIXER INTERFACE)
include_directories(/SDL/SDL2-2.0.10/include
/SDL/SDL2_image-2.0.5/include
/SDL/SDL2_mixer-2.0.4/include)
add_executable(3d_pinball_space_cadet ${SOURCE_FILES})
+27
View File
@@ -0,0 +1,27 @@
{
"configurations": [
{
"name": "x64-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"inheritEnvironments": [ "msvc_x64_x64" ],
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "-v",
"ctestCommandArgs": "",
"variables": [
{
"name": "CMAKE_BUILD_TYPE",
"value": "Debug",
"type": "STRING"
},
{
"name": "CMAKE_VERBOSE_MAKEFILE",
"value": "True",
"type": "BOOL"
}
]
}
]
}
View File
Whitespace-only changes.
+30
View File
@@ -0,0 +1,30 @@
//
// Created by neo on 2019-08-15.
//
#include "../../pinball.h"
#ifndef PINBALL_PARTMAN_H
#define PINBALL_PARTMAN_H
struct Partman {
signed int loader_error(int a1, int a2);
DWORD* loader_default_vsi(DWORD* a1);
signed int loader_get_sound_id(int a1);
void loader_unload();
int loader_loadfrom(WORD* a1);
int loader_query_handle(LPCSTR lpString);
signed int loader_query_visual_states(int a1);
signed int loader_material(int a1, DWORD* a2);
signed int loader_kicker(int a1, DWORD* a2);
signed int loader_state_id(int a1, signed int a2);
signed int loader_query_visual(int a1, signed int a2, DWORD* a3);
int loader_query_name(int a1);
int loader_query_float_attribute(int a1, signed int a2, int a3);
int loader_query_iattribute(int a1, int a2, DWORD* a3);
double loader_play_sound(int a1);
};
#endif //PINBALL_PARTMAN_H
@@ -48,10 +48,13 @@ TPinballComponent* TPinballComponent::TPinballComponent(TPinballTable* a2, int a
*((_BYTE*)this + 5) = 0;
*(DWORD*)((char*)this + 30) = a2;
*(DWORD*)((char*)this + 26) = 0;
if (a2)
objlist_class::Add((struct TPinballTable*)((char*)a2 + 250), (void*)this);
if (a3 >= 0)
* (DWORD*)((char*)this + 10) = loader_query_name(a3);
if (a4 && a3 >= 0)
{
this.v33 = loader_query_visual_states(a3);
+5 -354
View File
@@ -4,6 +4,7 @@
#include "Classes/classes.h"
#include <stdlib.h>
#include <SDL.h>
##ifdef _WIN32
#include <CommCtrl.h>
@@ -117,8 +118,8 @@ int partman_field_nth(int a1, int a2, int a3, int a4);
int partman_record_labeled(int, LPCSTR lpString); // idb
int partman_field_labeled(int, LPCSTR lpString, int); // idb
void partman_unload_records(WORD *a1);
char _lread_char(HFILE hFile);
int _lread_long(HFILE hFile); // idb
char lread_char(HFILE hFile);
int lread_long(HFILE hFile); // idb
signed int *partman_load_records(LPCSTR lpFileName);
int FindShiftKeys();
int nullsub_1(int, int, int); // weak
@@ -654,7 +655,7 @@ int dword_1023A24 = 0; // weak
int dword_1023A2C = 0; // weak
int dword_1023A34 = 0; // weak
int dword_1023A3C = 0; // weak
char **lites[9] =
char **some_parts[9] =
{
&off_10239E8,
&off_10239F0,
@@ -969,360 +970,10 @@ int word_10246EC[] = { 84 }; // weak
int word_1024708[] = { 91 }; // weak
int render_blit = 1; // weak
int dword_1024758[5] = { 1, 2, 3, 5, 10 }; // idb
int __security_cookie_complement = 4294919359; // weak
int __security_cookie = 47936; // weak
CHAR aWavemixV23ByAn[] = "WaveMix V 2.3 by Angel M. Diaz, Jr. (c) Microsoft 1993-1995"; // idb
int __defaultmatherr = 1; // weak
LPCSTR lpString2 = NULL; // idb
LPSTR lpString1 = NULL; // idb
CHAR byte_10248A8[1536] =
{
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
}; // idb
CHAR rc_strings[1536] = { '\0' }; // idb
int rc_string_slot; // weak
HWND hWnd; // idb
int dword_1024EC0; // weak
+100 -101
View File
@@ -7,141 +7,140 @@
//----- (01003445) --------------------------------------------------------
HDC _GetDC(HWND hWnd)
{
HDC v1; // eax
HDC v2; // esi
HDC v1; // eax
HDC v2; // esi
v1 = GetDC(hWnd);
v2 = v1;
if ( hWnd && GetLayout(v1) & 1 )
SetLayout(v2, 0);
return v2;
v1 = GetDC(hWnd);
v2 = v1;
if (hWnd && GetLayout(v1) & 1)
SetLayout(v2, 0);
return v2;
}
//----- (0100347C) --------------------------------------------------------
HDC _BeginPaint(HWND hWnd, LPPAINTSTRUCT lpPaint)
{
HDC v2; // eax
HDC v3; // esi
HDC v2; // eax
HDC v3; // esi
v2 = BeginPaint(hWnd, lpPaint);
v3 = v2;
if ( hWnd && GetLayout(v2) & 1 )
SetLayout(v3, 0);
return v3;
v2 = BeginPaint(hWnd, lpPaint);
v3 = v2;
if (hWnd && GetLayout(v2) & 1)
SetLayout(v3, 0);
return v3;
}
//----- (01006498) --------------------------------------------------------
char _lread_char(HFILE hFile)
char lread_char(HFILE hFile)
{
char Buffer; // [esp+1h] [ebp-1h]
char Buffer; // [esp+1h] [ebp-1h]
Buffer = 0;
_lread(hFile, &Buffer, 1u);
return Buffer;
Buffer = 0;
lread(hFile, &Buffer, 1u);
return Buffer;
}
//----- (010064BD) --------------------------------------------------------
int _lread_long(HFILE hFile)
int lread_long(HFILE hFile)
{
int Buffer; // [esp+0h] [ebp-4h]
int Buffer; // [esp+0h] [ebp-4h]
Buffer = 0;
_lread(hFile, &Buffer, 4u);
return Buffer;
Buffer = 0;
lread(hFile, &Buffer, 4u);
return Buffer;
}
//----- (01003752) --------------------------------------------------------
CHAR *get_rc_string(int a1, int a2)
CHAR* get_rc_string(int a1, int a2)
{
CHAR *v2; // esi
CHAR* v2; // esi
v2 = &byte_10248A8[256 * rc_string_slot];
if ( !LoadStringA(hinst, a1, &byte_10248A8[256 * rc_string_slot], 255) )
*v2 = 0;
if ( ++rc_string_slot >= 6 )
rc_string_slot = 0;
return v2;
v2 = &rc_strings[256 * rc_string_slot];
if (!LoadStringA(hinst, a1, &rc_strings[256 * rc_string_slot], 255))
* v2 = 0;
if (++rc_string_slot >= 6)
rc_string_slot = 0;
return v2;
}
// 1024EA8: using guessed type int rc_string_slot;
//----- (010037A6) --------------------------------------------------------
int get_rc_int(int a1, int *a2)
int get_rc_int(int a1, int* a2)
{
int result; // eax
CHAR Buffer; // [esp+4h] [ebp-104h]
int result; // eax
CHAR Buffer; // [esp+4h] [ebp-104h]
result = LoadStringA(hinst, a1, &Buffer, 255);
if ( result )
{
*a2 = _atoi(&Buffer);
result = 1;
}
return result;
result = LoadStringA(hinst, a1, &Buffer, 255);
if (result)
{
*a2 = _atoi(&Buffer);
result = 1;
}
return result;
}
//----- (01012F2A) --------------------------------------------------------
void build_occlude_list()
{
struct render_sprite_type_struct *v0; // esi
signed int v1; // edi
struct render_sprite_type_struct *v2; // ebx
int v3; // [esp+4h] [ebp-14h]
struct render_sprite_type_struct **v4; // [esp+8h] [ebp-10h]
int i; // [esp+Ch] [ebp-Ch]
struct render_sprite_type_struct **v6; // [esp+10h] [ebp-8h]
int v7; // [esp+14h] [ebp-4h]
render_sprite_type_struct* v0; // esi
signed int v1; // edi
render_sprite_type_struct* v2; // ebx
int v3; // [esp+4h] [ebp-14h]
render_sprite_type_struct** v4; // [esp+8h] [ebp-10h]
int i; // [esp+Ch] [ebp-Ch]
render_sprite_type_struct** v6; // [esp+10h] [ebp-8h]
int v7; // [esp+14h] [ebp-4h]
++memory_critical_allocation;
v7 = 0;
v4 = render_sprite_list;
v3 = 0;
if ( render_many_sprites > 0 )
{
do
{
v0 = *v4;
if ( *((DWORD *)*v4 + 17) )
{
memoryfree(*((DWORD *)*v4 + 17));
*((DWORD *)v0 + 17) = 0;
*((DWORD *)v0 + 18) = 0;
}
if ( !*((_BYTE *)v0 + 24) && *((DWORD *)v0 + 21) != -1 )
{
if ( !v7 )
v7 = memoryallocate(0xFA0u);
v1 = 0;
v6 = render_sprite_list;
for ( i = 0; i < render_many_sprites; ++v6 )
{
v2 = *v6;
if ( !*((_BYTE *)*v6 + 24)
&& *((DWORD *)v2 + 21) != -1
&& rectangle_clip((int *)v0 + 19, (int *)v2 + 19, 0)
&& v7 )
{
*(DWORD *)(v7 + 4 * v1++) = v2;
}
++i;
}
if ( !*((_BYTE *)v0 + 24) && *((DWORD *)v0 + 4) && v1 < 2 )
v1 = 0;
if ( v1 )
{
*((DWORD *)v0 + 17) = memoryrealloc(v7, 4 * v1);
*((DWORD *)v0 + 18) = v1;
v7 = 0;
}
}
++v3;
++v4;
}
while ( v3 < render_many_sprites );
if ( v7 )
memoryfree(v7);
}
--memory_critical_allocation;
++memory_critical_allocation;
v7 = 0;
v4 = render_sprite_list;
v3 = 0;
if (render_many_sprites > 0)
{
do
{
v0 = *v4;
if (*((DWORD*)* v4 + 17))
{
memoryfree(*((DWORD*)* v4 + 17));
*((DWORD*)v0 + 17) = 0;
*((DWORD*)v0 + 18) = 0;
}
if (!*((_BYTE*)v0 + 24) && *((DWORD*)v0 + 21) != -1)
{
if (!v7)
v7 = memoryallocate(0xFA0u);
v1 = 0;
v6 = render_sprite_list;
for (i = 0; i < render_many_sprites; ++v6)
{
v2 = *v6;
if (!*((_BYTE*)* v6 + 24)
&& *((DWORD*)v2 + 21) != -1
&& rectangle_clip((int*)v0 + 19, (int*)v2 + 19, 0)
&& v7)
{
*(DWORD*)(v7 + 4 * v1++) = v2;
}
++i;
}
if (!*((_BYTE*)v0 + 24) && *((DWORD*)v0 + 4) && v1 < 2)
v1 = 0;
if (v1)
{
*((DWORD*)v0 + 17) = memoryrealloc(v7, 4 * v1);
*((DWORD*)v0 + 18) = v1;
v7 = 0;
}
}
++v3;
++v4;
} while (v3 < render_many_sprites);
if (v7)
memoryfree(v7);
}
--memory_critical_allocation;
}
// 1024F04: using guessed type int memory_critical_allocation;
// 1025084: using guessed type struct render_sprite_type_struct **render_sprite_list;
@@ -150,5 +149,5 @@ memoryfree(v7);
//----- (010211B9) --------------------------------------------------------
unsigned int _setdefaultprecision()
{
return _controlfp(0x10000u, 0x30000u);
return _controlfp(0x10000u, 0x30000u);
}