Skip to content

Commit 8f6392a

Browse files
authored
Implement some ObscureVantage functions (isledecomp#205)
1 parent 36dab7f commit 8f6392a

11 files changed

Lines changed: 137 additions & 61 deletions

LEGORacers/include/imaginaryinterface.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ class ImaginaryInterface {
1414
public:
1515
virtual void VTable0x00(undefined4) = 0; // vtable+0x00
1616
virtual void VTable0x04(ObscureVantage0x58*) = 0; // vtable+0x04
17-
virtual void VTable0x08(undefined4) = 0; // vtable+0x08
18-
virtual void VTable0x0c(undefined4) = 0; // vtable+0x0c
17+
virtual void VTable0x08(ObscureVantage0x58*) = 0; // vtable+0x08
18+
virtual void VTable0x0c(ObscureVantage0x58*) = 0; // vtable+0x0c
1919
virtual void VTable0x10(undefined4) = 0; // vtable+0x10
2020
virtual undefined4 VTable0x14(ObscureIcon0x1a8*, void*, undefined4, undefined4) = 0; // vtable+0x14
2121
virtual undefined4 VTable0x18(

LEGORacers/include/imaginarynotion0x290.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ class ImaginaryNotion0x290 : public ImaginaryInterface {
3939

4040
void VTable0x00(undefined4) override; // vtable+0x00
4141
void VTable0x04(ObscureVantage0x58*) override; // vtable+0x04
42-
void VTable0x08(undefined4) override; // vtable+0x08
43-
void VTable0x0c(undefined4) override; // vtable+0x0c
42+
void VTable0x08(ObscureVantage0x58*) override; // vtable+0x08
43+
void VTable0x0c(ObscureVantage0x58*) override; // vtable+0x0c
4444
void VTable0x10(undefined4) override; // vtable+0x10
4545
undefined4 VTable0x14(ObscureIcon0x1a8*, void*, undefined4, undefined4) override; // vtable+0x14
4646
undefined4 VTable0x18(

LEGORacers/include/obscureicon0x1a8.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "compat.h"
55
#include "decomp.h"
66
#include "obscurevantage0x58.h"
7+
#include "rectangle.h"
78
#include "types.h"
89

910
class BronzeFalcon0xc8770;
@@ -39,7 +40,7 @@ class ObscureIcon0x1a8 : public ObscureVantage0x58 {
3940
void VTable0x00() override; // vtable+0x00
4041
~ObscureIcon0x1a8() override; // vtable+0x04
4142
undefined4 VTable0x08() override; // vtable+0x08
42-
void VTable0x10(undefined4) override; // vtable+0x10
43+
void VTable0x10(IntRectangle0x10*) override; // vtable+0x10
4344
undefined4 VTable0x2c(void*, undefined4, undefined4) override; // vtable+0x2c
4445
undefined4 VTable0x30(OnyxCircularBuffer0x1c::Item*, undefined4, undefined4) override; // vtable+0x30
4546
undefined4 VTable0x34(OnyxCircularBuffer0x1c::Item*, undefined4, undefined4) override; // vtable+0x34

LEGORacers/include/obscuretome0x3dc.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@
66
#include "obscureanchor0x5c.h"
77
#include "obscureanthem0x58.h"
88
#include "obscurezebra0xa4.h"
9+
#include "rectangle.h"
910

1011
// VTABLE: LEGORACERS 0x004b267c
1112
// SIZE 0x3dc
1213
class ObscureTome0x3dc : public ObscureAnthem0x58 {
1314
public:
1415
ObscureTome0x3dc();
15-
~ObscureTome0x3dc() override; // vtable+0x04
16-
void VTable0x10(undefined4) override; // vtable+0x10
16+
~ObscureTome0x3dc() override; // vtable+0x04
17+
void VTable0x10(IntRectangle0x10*) override; // vtable+0x10
1718

1819
// SYNTHETIC: LEGORACERS 0x0046ec30
1920
// ObscureTome0x3dc::`scalar deleting destructor'

LEGORacers/include/obscurevantage0x58.h

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,28 @@
22
#define OBSCUREVANTAGE0X58_H
33

44
#include "compat.h"
5+
#include "coppercrest0x40.h"
56
#include "decomp.h"
67
#include "imaginaryinterface.h"
78
#include "onyxcircularbuffer0x1c.h"
9+
#include "rectangle.h"
810
#include "silverdune0x30.h"
911
#include "types.h"
1012

1113
// VTABLE: LEGORACERS 0x004b29b4
1214
// SIZE 0x58
1315
class ObscureVantage0x58 {
1416
public:
15-
// SIZE 0x10
16-
class Struct0x34 {
17-
public:
18-
undefined4 m_unk0x00; // 0x00
19-
undefined4 m_unk0x04; // 0x04
20-
undefined4 m_unk0x08; // 0x08
21-
undefined4 m_unk0x0c; // 0x0c
22-
};
23-
2417
ObscureVantage0x58();
2518
virtual void VTable0x00(); // vtable+0x00
2619
virtual ~ObscureVantage0x58(); // vtable+0x04
2720
virtual undefined4 VTable0x08(); // vtable+0x08
2821
virtual void VTable0x0c(ObscureVantage0x58*); // vtable+0x0c
29-
virtual void VTable0x10(undefined4); // vtable+0x10
30-
virtual void VTable0x14(undefined4); // vtable+0x14
22+
virtual void VTable0x10(IntRectangle0x10*); // vtable+0x10
23+
virtual void VTable0x14(undefined4*); // vtable+0x14
3124
virtual undefined4 VTable0x18(undefined4); // vtable+0x18
3225
virtual undefined4 VTable0x1c(SilverDune0x30::Rect*, SilverDune0x30::Rect*); // vtable+0x1c
33-
virtual undefined4 VTable0x20(void*, undefined4, undefined4); // vtable+0x20
26+
virtual undefined4 VTable0x20(CopperCrest0x40::Helper0x44*, undefined4, undefined4); // vtable+0x20
3427
virtual undefined4 VTable0x24(OnyxCircularBuffer0x1c::Item*, undefined4, undefined4); // vtable+0x24
3528
virtual undefined4 VTable0x28(OnyxCircularBuffer0x1c::Item*, undefined4, undefined4); // vtable+0x28
3629
virtual undefined4 VTable0x2c(void*, undefined4, undefined4); // vtable+0x2c
@@ -40,6 +33,7 @@ class ObscureVantage0x58 {
4033
virtual undefined4 VTable0x3c(undefined4); // vtable+0x3c
4134

4235
void FUN_00472b50();
36+
undefined4 FUN_00472c40(LegoS32, LegoS32);
4337
ObscureVantage0x58* FUN_00472e40();
4438
ObscureVantage0x58* FUN_00472e60();
4539
SilverDune0x30::Rect* FUN_00472e90();
@@ -62,7 +56,7 @@ class ObscureVantage0x58 {
6256
ImaginaryInterface* m_unk0x28; // 0x28
6357
undefined4 m_unk0x2c; // 0x2c
6458
undefined2 m_unk0x30; // 0x30
65-
Struct0x34 m_unk0x34; // 0x34
59+
IntRectangle0x10 m_unk0x34; // 0x34
6660
LegoFloat m_unk0x44; // 0x44
6761
LegoFloat m_unk0x48; // 0x48
6862
undefined4 m_unk0x4c; // 0x4c

LEGORacers/include/obscurezebra0xa4.h

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,29 @@ class ObscureZebra0xa4 : public ObscureVantage0x58 {
1212
ObscureZebra0xa4();
1313
void VTable0x00() override; // vtable+0x00
1414
~ObscureZebra0xa4() override; // vtable+0x04
15-
void VTable0x14(undefined4) override; // vtable+0x14
15+
void VTable0x14(undefined4*) override; // vtable+0x14
1616
undefined4 VTable0x38(undefined4, undefined4) override; // vtable+0x38
1717

1818
// SYNTHETIC: LEGORACERS 0x004734f0
1919
// ObscureZebra0xa4::`scalar deleting destructor'
2020

2121
protected:
22-
undefined m_unk0x58[0xa4 - 0x58]; // 0x58
22+
undefined m_unk0x58[0x60 - 0x58]; // 0x58
23+
undefined4 m_unk0x60; // 0x60
24+
undefined4 m_unk0x64; // 0x64
25+
undefined4 m_unk0x68; // 0x68
26+
undefined4 m_unk0x6c; // 0x6c
27+
undefined m_unk0x70[0x78 - 0x70]; // 0x6c
28+
undefined4 m_unk0x78; // 0x78
29+
undefined4 m_unk0x7c; // 0x7c
30+
undefined4 m_unk0x80; // 0x80
31+
undefined4 m_unk0x84; // 0x84
32+
undefined m_unk0x88[0x90 - 0x88]; // 0x88
33+
undefined4 m_unk0x90; // 0x90
34+
undefined4 m_unk0x94; // 0x94
35+
undefined4 m_unk0x98; // 0x98
36+
undefined4 m_unk0x9c; // 0x9c
37+
undefined4 m_unk0xa0; // 0xa0
2338
};
2439

2540
#endif // OBSCUREZEBRA0XA4

LEGORacers/src/imaginarynotion0x290.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ void ImaginaryNotion0x290::VTable0x04(ObscureVantage0x58*)
4444
}
4545

4646
// STUB: LEGORACERS 0x0044f590 FOLDED
47-
void ImaginaryNotion0x290::VTable0x08(undefined4)
47+
void ImaginaryNotion0x290::VTable0x08(ObscureVantage0x58*)
4848
{
4949
// TODO
5050
STUB(0x0044f590);
5151
}
5252

5353
// STUB: LEGORACERS 0x0044f590 FOLDED
54-
void ImaginaryNotion0x290::VTable0x0c(undefined4)
54+
void ImaginaryNotion0x290::VTable0x0c(ObscureVantage0x58*)
5555
{
5656
// TODO
5757
STUB(0x0044f590);

LEGORacers/src/obscureicon0x1a8.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ undefined4 ObscureIcon0x1a8::VTable0x34(OnyxCircularBuffer0x1c::Item*, undefined
148148
}
149149

150150
// STUB: LEGORACERS 0x00472950
151-
void ObscureIcon0x1a8::VTable0x10(undefined4)
151+
void ObscureIcon0x1a8::VTable0x10(IntRectangle0x10*)
152152
{
153153
STUB(0x00472950);
154154
}

LEGORacers/src/obscuretome0x3dc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ ObscureTome0x3dc::~ObscureTome0x3dc()
1515
}
1616

1717
// STUB: LEGORACERS 0x0046ee40
18-
void ObscureTome0x3dc::VTable0x10(undefined4)
18+
void ObscureTome0x3dc::VTable0x10(IntRectangle0x10*)
1919
{
2020
STUB(0x0046ee40);
2121
}

LEGORacers/src/obscurevantage0x58.cpp

Lines changed: 80 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#include "obscurevantage0x58.h"
22

33
DECOMP_SIZE_ASSERT(ObscureVantage0x58, 0x58)
4-
DECOMP_SIZE_ASSERT(ObscureVantage0x58::Struct0x34, 0x10)
54

65
// GLOBAL: LEGORACERS 0x004c7650
76
SilverDune0x30::Rect g_unk0x4c7650;
@@ -37,10 +36,10 @@ void ObscureVantage0x58::VTable0x00()
3736
m_unk0x44 = 1.0;
3837
m_unk0x50 = 0;
3938
m_unk0x4c = 0;
40-
m_unk0x34.m_unk0x00 = 0;
41-
m_unk0x34.m_unk0x04 = 0;
42-
m_unk0x34.m_unk0x08 = 0;
43-
m_unk0x34.m_unk0x0c = 0;
39+
m_unk0x34.m_left = 0;
40+
m_unk0x34.m_top = 0;
41+
m_unk0x34.m_right = 0;
42+
m_unk0x34.m_bottom = 0;
4443
}
4544

4645
// FUNCTION: LEGORACERS 0x00472ad0
@@ -128,6 +127,13 @@ void ObscureVantage0x58::FUN_00472b50()
128127
m_unk0x1c &= 0xfb;
129128
}
130129

130+
// FUNCTION: LEGORACERS 0x00472c40
131+
undefined4 ObscureVantage0x58::FUN_00472c40(LegoS32 p_x, LegoS32 p_y)
132+
{
133+
return p_x >= 0 && p_x <= (m_unk0x34.m_right - m_unk0x34.m_left) && p_y >= 0 &&
134+
p_y <= (m_unk0x34.m_bottom - m_unk0x34.m_top);
135+
}
136+
131137
// FUNCTION: LEGORACERS 0x00472e40
132138
ObscureVantage0x58* ObscureVantage0x58::FUN_00472e40()
133139
{
@@ -167,36 +173,46 @@ SilverDune0x30::Rect* ObscureVantage0x58::FUN_00472e90()
167173
g_unk0x4c7650.m_left = 0;
168174

169175
while (node) {
170-
g_unk0x4c7650.m_left += node->m_unk0x34.m_unk0x00;
171-
g_unk0x4c7650.m_top += node->m_unk0x34.m_unk0x04;
176+
g_unk0x4c7650.m_left += node->m_unk0x34.m_left;
177+
g_unk0x4c7650.m_top += node->m_unk0x34.m_top;
172178
node = node->m_unk0x04;
173179
}
174180

175-
g_unk0x4c7650.m_right = (m_unk0x34.m_unk0x08 - m_unk0x34.m_unk0x00) + g_unk0x4c7650.m_left;
176-
g_unk0x4c7650.m_bottom = (m_unk0x34.m_unk0x0c - m_unk0x34.m_unk0x04) + g_unk0x4c7650.m_top;
181+
g_unk0x4c7650.m_right = (m_unk0x34.m_right - m_unk0x34.m_left) + g_unk0x4c7650.m_left;
182+
g_unk0x4c7650.m_bottom = (m_unk0x34.m_bottom - m_unk0x34.m_top) + g_unk0x4c7650.m_top;
177183

178184
return &g_unk0x4c7650;
179185
}
180186

181-
// STUB: LEGORACERS 0x00472f40
182-
void ObscureVantage0x58::VTable0x10(undefined4)
187+
// FUNCTION: LEGORACERS 0x00472f40
188+
void ObscureVantage0x58::VTable0x10(IntRectangle0x10* p_rect)
183189
{
184-
// TODO
185-
STUB(0x00472f40);
190+
if (m_unk0x28) {
191+
if ((((m_unk0x34.m_right - p_rect->m_right) - m_unk0x34.m_left) + p_rect->m_left != 0) ||
192+
(((m_unk0x34.m_bottom - m_unk0x34.m_top) - p_rect->m_bottom) + p_rect->m_top != 0)) {
193+
m_unk0x28->VTable0x0c(this);
194+
}
195+
196+
if ((m_unk0x34.m_left - p_rect->m_left) || (m_unk0x34.m_top - p_rect->m_top)) {
197+
m_unk0x28->VTable0x08(this);
198+
}
199+
}
200+
201+
m_unk0x34 = *p_rect;
202+
return;
186203
}
187204

188-
// STUB: LEGORACERS 0x00472fc0
189-
void ObscureVantage0x58::VTable0x14(undefined4)
205+
// FUNCTION: LEGORACERS 0x00472fc0
206+
void ObscureVantage0x58::VTable0x14(undefined4* p_param)
190207
{
191-
// TODO
192-
STUB(0x00472fc0);
208+
m_unk0x2c = *p_param;
193209
}
194210

195211
// FUNCTION: LEGORACERS 0x004731b0
196-
void ObscureVantage0x58::FUN_004731b0(undefined4& p_param1, undefined4& p_param2)
212+
void ObscureVantage0x58::FUN_004731b0(undefined4& p_x, undefined4& p_y)
197213
{
198-
p_param1 -= m_unk0x34.m_unk0x00;
199-
p_param2 -= m_unk0x34.m_unk0x04;
214+
p_x -= m_unk0x34.m_left;
215+
p_y -= m_unk0x34.m_top;
200216
}
201217

202218
// FUNCTION: LEGORACERS 0x004731d0
@@ -226,20 +242,54 @@ undefined4 ObscureVantage0x58::VTable0x1c(SilverDune0x30::Rect*, SilverDune0x30:
226242
return 0;
227243
}
228244

229-
// STUB: LEGORACERS 0x004732d0
230-
undefined4 ObscureVantage0x58::VTable0x20(void*, undefined4, undefined4)
245+
// FUNCTION: LEGORACERS 0x004732d0
246+
undefined4 ObscureVantage0x58::VTable0x20(CopperCrest0x40::Helper0x44* p_param1, undefined4 p_x, undefined4 p_y)
231247
{
232-
// TODO
233-
STUB(0x004732d0);
234-
return 0;
248+
ObscureVantage0x58* child = m_unk0x08;
249+
undefined4 x = p_x;
250+
undefined4 y = p_y;
251+
252+
FUN_004731b0(x, y);
253+
254+
if ((m_unk0x1c & 2) && FUN_00472c40(x, y)) {
255+
while (child) {
256+
if (child->VTable0x20(p_param1, x, y)) {
257+
return TRUE;
258+
}
259+
260+
child = child->m_unk0x14;
261+
}
262+
263+
if (VTable0x2c(p_param1, x, y)) {
264+
return TRUE;
265+
}
266+
}
267+
268+
return FALSE;
235269
}
236270

237-
// STUB: LEGORACERS 0x00473370
238-
undefined4 ObscureVantage0x58::VTable0x24(OnyxCircularBuffer0x1c::Item*, undefined4, undefined4)
271+
// FUNCTION: LEGORACERS 0x00473370
272+
undefined4 ObscureVantage0x58::VTable0x24(OnyxCircularBuffer0x1c::Item* p_param1, undefined4 p_x, undefined4 p_y)
239273
{
240-
// TODO
241-
STUB(0x00473370);
242-
return 0;
274+
ObscureVantage0x58* child = m_unk0x08;
275+
undefined4 x = p_x;
276+
undefined4 y = p_y;
277+
278+
if (!(m_unk0x1c & 2)) {
279+
return FALSE;
280+
}
281+
282+
FUN_004731b0(x, y);
283+
284+
while (child) {
285+
if (child->VTable0x24(p_param1, x, y)) {
286+
return TRUE;
287+
}
288+
289+
child = child->m_unk0x14;
290+
}
291+
292+
return VTable0x30(p_param1, x, y);
243293
}
244294

245295
// STUB: LEGORACERS 0x00473400

0 commit comments

Comments
 (0)