This repository has been archived by the owner on Aug 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
underscore.cpp
153 lines (136 loc) · 3.32 KB
/
underscore.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
//
// Created by neo on 2019-08-15.
//
#include "pinball.h"
//----- (01003445) --------------------------------------------------------
HDC _GetDC(HWND hWnd)
{
HDC v1; // eax
HDC v2; // esi
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
v2 = BeginPaint(hWnd, lpPaint);
v3 = v2;
if (hWnd && GetLayout(v2) & 1)
SetLayout(v3, 0);
return v3;
}
//----- (01006498) --------------------------------------------------------
char lread_char(HFILE hFile)
{
char Buffer; // [esp+1h] [ebp-1h]
Buffer = 0;
lread(hFile, &Buffer, 1u);
return Buffer;
}
//----- (010064BD) --------------------------------------------------------
int lread_long(HFILE hFile)
{
int Buffer; // [esp+0h] [ebp-4h]
Buffer = 0;
lread(hFile, &Buffer, 4u);
return Buffer;
}
//----- (01003752) --------------------------------------------------------
CHAR* get_rc_string(int a1, int a2)
{
CHAR* v2; // esi
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 result; // eax
CHAR Buffer; // [esp+4h] [ebp-104h]
result = LoadStringA(hinst, a1, &Buffer, 255);
if (result)
{
*a2 = _atoi(&Buffer);
result = 1;
}
return result;
}
//----- (01012F2A) --------------------------------------------------------
void build_occlude_list()
{
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;
}
// 1024F04: using guessed type int memory_critical_allocation;
// 1025084: using guessed type struct render_sprite_type_struct **render_sprite_list;
// 10250B4: using guessed type int render_many_sprites;
//----- (010211B9) --------------------------------------------------------
unsigned int _setdefaultprecision()
{
return _controlfp(0x10000u, 0x30000u);
}