Skip to content

Commit 7808803

Browse files
authored
Implement/match BronzeFalcon0xc8770::VTable0x18 (isledecomp#209)
1 parent d006ec8 commit 7808803

5 files changed

Lines changed: 70 additions & 15 deletions

File tree

GolDP/include/amberlens0x344.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class AmberLens0x344 : public AmberLensBase0x120 {
1717
enum {
1818
c_flagBit0 = 1 << 0,
1919
c_flagBit1 = 1 << 1,
20+
c_flagBit3 = 1 << 3,
2021
};
2122

2223
AmberLens0x344();
@@ -38,7 +39,9 @@ class AmberLens0x344 : public AmberLensBase0x120 {
3839
JadeOrbit0x220* GetUnk0x04() { return (JadeOrbit0x220*) m_unk0x04; }
3940

4041
protected:
41-
void FUN_10001f60(undefined*);
42+
friend class BronzeFalcon0xc8770;
43+
44+
void FUN_10001f60(BronzeFalcon0xc8770*);
4245

4346
JadeOrbit0x220 m_unk0x120; // 0x120
4447
BronzeFalcon0xc8770* m_unk0x340; // 0x340

GolDP/include/amberlensbase0x120.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ class AmberLensBase0x120 {
3838
undefined4 m_unk0x2c; // 0x2c
3939
LegoU32 m_flags; // 0x30
4040
undefined m_unk0x34[0x110 - 0x34]; // 0x34
41-
undefined4 m_unk0x110; // 0x110
42-
undefined4 m_unk0x114; // 0x114
43-
undefined4 m_unk0x118; // 0x118
44-
undefined4 m_unk0x11c; // 0x11c
41+
LegoS32 m_unk0x110; // 0x110
42+
LegoS32 m_unk0x114; // 0x114
43+
LegoS32 m_unk0x118; // 0x118
44+
LegoS32 m_unk0x11c; // 0x11c
4545
};
4646

4747
#endif // AMBERLENSBASE0X120_H

GolDP/include/jadeorbit0x220.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,11 @@ class JadeOrbit0x220 : public JadeOrbitBase0x10 {
7878
LegoFloat m_unk0xc4; // 0xc4
7979
LegoFloat m_unk0xc8; // 0xc8
8080
LegoFloat m_unk0xcc; // 0xcc
81-
undefined m_unk0xd0[0x220 - 0xd0]; // 0xd0
81+
undefined m_unk0xd0[0x210 - 0xd0]; // 0xd0
82+
LegoFloat m_unk0x210; // 0x210
83+
LegoFloat m_unk0x214; // 0x214
84+
LegoFloat m_unk0x218; // 0x218
85+
LegoFloat m_unk0x21c; // 0x21c
8286
};
8387

8488
#endif // JADEORBIT0X220_H

GolDP/src/amberlens0x344.cpp

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

33
#include "bronzefalcon0xc8770.h"
4+
#include "slatepeak0x58.h"
45

56
DECOMP_SIZE_ASSERT(AmberLens0x344, 0x344)
67

@@ -19,11 +20,31 @@ AmberLens0x344::~AmberLens0x344()
1920
}
2021
}
2122

22-
// STUB: GOLDP 0x10001f60
23-
void AmberLens0x344::FUN_10001f60(undefined*)
23+
// FUNCTION: GOLDP 0x10001f60
24+
void AmberLens0x344::FUN_10001f60(BronzeFalcon0xc8770* p_renderer)
2425
{
25-
// TODO
26-
STUB(0x10001f60);
26+
m_unk0x340 = p_renderer;
27+
if (p_renderer != NULL) {
28+
const SlatePeak0x58* renderTargetInfo = p_renderer->GetRenderTargetInfo();
29+
if (m_unk0x11c == 0 || m_unk0x118 == 0) {
30+
m_unk0x110 = 0;
31+
m_unk0x114 = 0;
32+
m_unk0x118 = renderTargetInfo->GetWidth();
33+
m_unk0x11c = renderTargetInfo->GetHeight();
34+
}
35+
36+
if (!(m_flags & c_flagBit3)) {
37+
LegoFloat width = static_cast<LegoFloat>(m_unk0x118 - m_unk0x110);
38+
LegoFloat height = static_cast<LegoFloat>(m_unk0x11c - m_unk0x114);
39+
m_unk0x0c = width / height;
40+
}
41+
42+
m_unk0x120.m_unk0x210 = static_cast<LegoFloat>(m_unk0x118 - m_unk0x110);
43+
m_unk0x120.m_unk0x214 = static_cast<LegoFloat>(m_unk0x11c - m_unk0x114);
44+
m_unk0x120.m_unk0x218 = static_cast<LegoFloat>(m_unk0x110);
45+
m_unk0x120.m_unk0x21c = static_cast<LegoFloat>(m_unk0x114);
46+
m_flags |= c_flagBit0 | c_flagBit1;
47+
}
2748
}
2849

2950
// STUB: GOLDP 0x10002060

GolDP/src/bronzefalcon0xc8770.cpp

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "bronzefalcon0xc8770.h"
22

3+
#include "amberlens0x344.h"
34
#include "bronzefalconsurface0x5c.h"
45
#include "falcondunebag0x10.h"
56
#include "falcontextureformat.h"
@@ -290,16 +291,42 @@ void BronzeFalcon0xc8770::ReleaseResources()
290291
STUB(0x10008680);
291292
}
292293

293-
// STUB: GOLDP 0x10008740
294+
// FUNCTION: GOLDP 0x10008740
294295
void BronzeFalcon0xc8770::VTable0x18()
295296
{
296-
STUB(0x10008740);
297+
if (m_unk0x0c != NULL) {
298+
m_unk0x0c->FUN_10001f60(NULL);
299+
m_unk0x0c = NULL;
300+
}
301+
302+
WhiteFalcon0x140::Destroy();
303+
ReleaseResources();
304+
305+
BronzeFalconSurface0x5c* surface = m_unk0x30c;
306+
while (surface != NULL) {
307+
BronzeFalconSurface0x5c* next = surface->m_next;
308+
surface->VTable0x34();
309+
delete surface;
310+
surface = next;
311+
}
312+
313+
if (m_drawState != NULL) {
314+
m_drawState->RemoveRenderer(this);
315+
}
316+
317+
Reset();
318+
m_unk0x04 = 0;
297319
}
298320

299-
// STUB: GOLDP 0x100087b0
300-
void BronzeFalcon0xc8770::VTable0x20(AmberLens0x344*)
321+
// FUNCTION: GOLDP 0x100087b0
322+
void BronzeFalcon0xc8770::VTable0x20(AmberLens0x344* p_lens)
301323
{
302-
STUB(0x100087b0);
324+
if (m_unk0x0c != NULL) {
325+
m_unk0x0c->FUN_10001f60(NULL);
326+
}
327+
328+
m_unk0x0c = p_lens;
329+
p_lens->FUN_10001f60(this);
303330
}
304331

305332
// STUB: GOLDP 0x100087e0

0 commit comments

Comments
 (0)