Skip to content

Commit 9b5aac8

Browse files
committed
GolMath things
1 parent 57906c1 commit 9b5aac8

8 files changed

Lines changed: 293 additions & 116 deletions

File tree

GolDP/include/bronzefalcon0xc8770.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -274,12 +274,13 @@ class BronzeFalcon0xc8770 : public WhiteFalcon0x140 {
274274
LegoBool32 m_unk0xc83f8; // 0xc83f8
275275
LegoU32 m_unk0xc83fc; // 0xc83fc
276276
undefined4 m_unk0xc8400[4]; // 0xc8400
277-
D3DMATRIX m_unk0xc8410; // 0xc8410
278-
D3DMATRIX m_unk0xc8450; // 0xc8450
279-
LegoFloat* m_unk0xc8490; // 0xc8490
280-
LegoFloat* m_unk0xc8494; // 0xc8494
281-
LegoFloat m_unk0xc8498[(0xc8518 - 0xc8498) / sizeof(LegoFloat)]; // 0xc8498
282-
LegoFloat* m_unk0xc8518; // 0xc8518
277+
GolMatrix4 m_unk0xc8410; // 0xc8410
278+
GolMatrix4 m_unk0xc8450; // 0xc8450
279+
GolMatrix4* m_unk0xc8490; // 0xc8490
280+
GolMatrix4* m_unk0xc8494; // 0xc8494
281+
GolMatrix4 m_unk0xc8498[1]; // 0xc8498
282+
LegoFloat m_unk0xc84d8[(0xc8518 - 0xc84d8) / sizeof(LegoFloat)]; // 0xc84d8
283+
GolMatrix4* m_unk0xc8518; // 0xc8518
283284
undefined4 m_unk0xc851c; // 0xc851c
284285
undefined4 m_unk0xc8520; // 0xc8520
285286
undefined4 m_unk0xc8524; // 0xc8524

GolDP/include/floatypontoon0x4c.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class FloatyPontoon0x4c : public FloatyBoat0x28 {
2727
); // vtable+0x4c
2828
virtual void VTable0x50(); // vtable+0x50
2929

30-
LegoBool32 FUN_10014e50(const GolVec3* p_arg1, const GolVec3* p_arg2, D3DMATRIX* p_matrix);
30+
LegoBool32 FUN_10014e50(const GolVec3* p_arg1, const GolVec3* p_arg2, GolMatrix4* p_matrix);
3131
void FUN_10014ff0(BronzeFalcon0xc8770* p_renderer);
3232
undefined4 FUN_10026fa0(LegoFloat p_arg1);
3333
void FUN_10029e90(undefined4* p_arg1, LegoS32 p_arg2, undefined4 p_arg3, undefined4 p_arg4, undefined4 p_arg5);

GolDP/include/jadeorbit0x220.h

Lines changed: 49 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -31,53 +31,55 @@ class JadeOrbit0x220 : public JadeOrbitBase0x10 {
3131
void VTable0x44(GolVec3* p_unk0x04) override; // vtable+0x44
3232
void VTable0x48() override; // vtable+0x48
3333

34-
GolVec3 m_up; // 0x10
35-
LegoFloat m_unk0x1c; // 0x1c
36-
GolVec3 m_forward; // 0x20
37-
LegoFloat m_unk0x2c; // 0x2c
38-
GolVec3 m_right; // 0x30
39-
LegoFloat m_unk0x3c; // 0x3c
40-
GolVec3 m_position; // 0x40
41-
LegoFloat m_unk0x4c; // 0x4c
42-
LegoFloat m_unk0x50; // 0x50
43-
LegoFloat m_unk0x54; // 0x54
44-
LegoFloat m_unk0x58; // 0x58
45-
LegoFloat m_unk0x5c; // 0x5c
46-
LegoFloat m_unk0x60; // 0x60
47-
LegoFloat m_unk0x64; // 0x64
48-
LegoFloat m_unk0x68; // 0x68
49-
LegoFloat m_unk0x6c; // 0x6c
50-
LegoFloat m_unk0x70; // 0x70
51-
LegoFloat m_unk0x74; // 0x74
52-
LegoFloat m_unk0x78; // 0x78
53-
LegoFloat m_unk0x7c; // 0x7c
54-
LegoFloat m_unk0x80; // 0x80
55-
LegoFloat m_unk0x84; // 0x84
56-
LegoFloat m_unk0x88; // 0x88
57-
LegoFloat m_unk0x8c; // 0x8c
58-
LegoFloat m_unk0x90; // 0x90
59-
LegoFloat m_unk0x94; // 0x94
60-
LegoFloat m_unk0x98; // 0x98
61-
LegoFloat m_unk0x9c; // 0x9c
62-
LegoFloat m_unk0xa0; // 0xa0
63-
LegoFloat m_unk0xa4; // 0xa4
64-
LegoFloat m_unk0xa8; // 0xa8
65-
LegoFloat m_unk0xac; // 0xac
66-
LegoFloat m_unk0xb0; // 0xb0
67-
LegoFloat m_unk0xb4; // 0xb4
68-
LegoFloat m_unk0xb8; // 0xb8
69-
LegoFloat m_unk0xbc; // 0xbc
70-
LegoFloat m_unk0xc0; // 0xc0
71-
LegoFloat m_unk0xc4; // 0xc4
72-
LegoFloat m_unk0xc8; // 0xc8
73-
LegoFloat m_unk0xcc; // 0xcc
74-
undefined m_unk0xd0[0x190 - 0xd0]; // 0xd0
75-
LegoFloat m_unk0x190[0x10]; // 0x190
76-
LegoFloat m_unk0x1d0[0x10]; // 0x1d0
77-
LegoFloat m_unk0x210; // 0x210
78-
LegoFloat m_unk0x214; // 0x214
79-
LegoFloat m_unk0x218; // 0x218
80-
LegoFloat m_unk0x21c; // 0x21c
34+
GolVec3 m_up; // 0x10
35+
LegoFloat m_unk0x1c; // 0x1c
36+
GolVec3 m_forward; // 0x20
37+
LegoFloat m_unk0x2c; // 0x2c
38+
GolVec3 m_right; // 0x30
39+
LegoFloat m_unk0x3c; // 0x3c
40+
GolVec3 m_position; // 0x40
41+
LegoFloat m_unk0x4c; // 0x4c
42+
LegoFloat m_unk0x50; // 0x50
43+
LegoFloat m_unk0x54; // 0x54
44+
LegoFloat m_unk0x58; // 0x58
45+
LegoFloat m_unk0x5c; // 0x5c
46+
LegoFloat m_unk0x60; // 0x60
47+
LegoFloat m_unk0x64; // 0x64
48+
LegoFloat m_unk0x68; // 0x68
49+
LegoFloat m_unk0x6c; // 0x6c
50+
LegoFloat m_unk0x70; // 0x70
51+
LegoFloat m_unk0x74; // 0x74
52+
LegoFloat m_unk0x78; // 0x78
53+
LegoFloat m_unk0x7c; // 0x7c
54+
LegoFloat m_unk0x80; // 0x80
55+
LegoFloat m_unk0x84; // 0x84
56+
LegoFloat m_unk0x88; // 0x88
57+
LegoFloat m_unk0x8c; // 0x8c
58+
LegoFloat m_unk0x90; // 0x90
59+
LegoFloat m_unk0x94; // 0x94
60+
LegoFloat m_unk0x98; // 0x98
61+
LegoFloat m_unk0x9c; // 0x9c
62+
LegoFloat m_unk0xa0; // 0xa0
63+
LegoFloat m_unk0xa4; // 0xa4
64+
LegoFloat m_unk0xa8; // 0xa8
65+
LegoFloat m_unk0xac; // 0xac
66+
LegoFloat m_unk0xb0; // 0xb0
67+
LegoFloat m_unk0xb4; // 0xb4
68+
LegoFloat m_unk0xb8; // 0xb8
69+
LegoFloat m_unk0xbc; // 0xbc
70+
LegoFloat m_unk0xc0; // 0xc0
71+
LegoFloat m_unk0xc4; // 0xc4
72+
LegoFloat m_unk0xc8; // 0xc8
73+
LegoFloat m_unk0xcc; // 0xcc
74+
GolMatrix4 m_unk0xd0; // 0xd0
75+
GolMatrix4 m_unk0x110; // 0x110
76+
GolMatrix4 m_unk0x150; // 0x150
77+
GolMatrix4 m_unk0x190; // 0x190
78+
GolMatrix4 m_unk0x1d0; // 0x1d0
79+
LegoFloat m_unk0x210; // 0x210
80+
LegoFloat m_unk0x214; // 0x214
81+
LegoFloat m_unk0x218; // 0x218
82+
LegoFloat m_unk0x21c; // 0x21c
8183
};
8284

8385
#endif // JADEORBIT0X220_H

GolDP/src/amberlens0x344.cpp

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,29 @@ void AmberLens0x344::FUN_10001f60(BronzeFalcon0xc8770* p_renderer)
4747
}
4848
}
4949

50-
// STUB: GOLDP 0x10002060
50+
// FUNCTION: GOLDP 0x10002060
5151
void AmberLens0x344::VTable0x28()
5252
{
53-
STUB(0x10002060);
53+
if (m_flags & (c_flagBit0 | c_flagBit1)) {
54+
if (m_flags & c_flagBit1) {
55+
if (!(m_flags & c_flagBit3)) {
56+
m_unk0x0c =
57+
static_cast<LegoFloat>(m_unk0x118 - m_unk0x110) / static_cast<LegoFloat>(m_unk0x11c - m_unk0x114);
58+
}
59+
m_unk0x120.m_unk0x210 = static_cast<LegoFloat>(m_unk0x118 - m_unk0x110);
60+
m_unk0x120.m_unk0x214 = static_cast<LegoFloat>(m_unk0x11c - m_unk0x114);
61+
m_unk0x120.m_unk0x218 = static_cast<LegoFloat>(m_unk0x110);
62+
m_unk0x120.m_unk0x21c = static_cast<LegoFloat>(m_unk0x114);
63+
}
64+
if (m_flags & c_flagBit0) {
65+
VTable0x00();
66+
}
67+
if (m_flags & c_flagBit1) {
68+
VTable0x04();
69+
}
70+
GolMath::FUN_1002f3a0(m_unk0x120.m_unk0xd0, m_unk0x120.m_unk0x110, &m_unk0x120.m_unk0x190);
71+
GolMath::FUN_1002f3a0(m_unk0x120.m_unk0xd0, m_unk0x120.m_unk0x150, &m_unk0x120.m_unk0x1d0);
72+
}
5473
}
5574

5675
// STUB: GOLDP 0x10002160

GolDP/src/bronzefalcon0xc8770.cpp

Lines changed: 36 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -187,38 +187,38 @@ void BronzeFalcon0xc8770::Reset()
187187
m_unk0xc8538 = NULL;
188188
m_unk0xc854c[0] = this;
189189
m_unk0xc854c[3] = m_unk0xc428c;
190-
m_unk0xc8410._11 = 1.0f;
191-
m_unk0xc8450._11 = 1.0f;
192-
m_unk0xc8410._12 = 0.0f;
193-
m_unk0xc8450._12 = 0.0f;
194-
m_unk0xc8410._13 = 0.0f;
195-
m_unk0xc8450._13 = 0.0f;
196-
m_unk0xc8410._14 = 0.0f;
197-
m_unk0xc8450._14 = 0.0f;
198-
m_unk0xc8410._21 = 0.0f;
199-
m_unk0xc8450._21 = 0.0f;
200-
m_unk0xc8410._22 = 1.0f;
201-
m_unk0xc8450._22 = 1.0f;
202-
m_unk0xc8410._23 = 0.0f;
203-
m_unk0xc8450._23 = 0.0f;
204-
m_unk0xc8410._24 = 0.0f;
205-
m_unk0xc8450._24 = 0.0f;
206-
m_unk0xc8410._31 = 0.0f;
207-
m_unk0xc8450._31 = 0.0f;
208-
m_unk0xc8410._32 = 0.0f;
209-
m_unk0xc8450._32 = 0.0f;
210-
m_unk0xc8410._33 = 1.0f;
211-
m_unk0xc8450._33 = 1.0f;
212-
m_unk0xc8410._34 = 0.0f;
213-
m_unk0xc8450._34 = 0.0f;
214-
m_unk0xc8410._41 = 0.0f;
215-
m_unk0xc8450._41 = 0.0f;
216-
m_unk0xc8410._42 = 0.0f;
217-
m_unk0xc8450._42 = 0.0f;
218-
m_unk0xc8410._43 = 0.0f;
219-
m_unk0xc8450._43 = 0.0f;
220-
m_unk0xc8410._44 = 1.0f;
221-
m_unk0xc8450._44 = 1.0f;
190+
m_unk0xc8410.m_m[0][0] = 1.0f;
191+
m_unk0xc8450.m_m[0][0] = 1.0f;
192+
m_unk0xc8410.m_m[0][1] = 0.0f;
193+
m_unk0xc8450.m_m[0][1] = 0.0f;
194+
m_unk0xc8410.m_m[0][2] = 0.0f;
195+
m_unk0xc8450.m_m[0][2] = 0.0f;
196+
m_unk0xc8410.m_m[0][3] = 0.0f;
197+
m_unk0xc8450.m_m[0][3] = 0.0f;
198+
m_unk0xc8410.m_m[1][0] = 0.0f;
199+
m_unk0xc8450.m_m[1][0] = 0.0f;
200+
m_unk0xc8410.m_m[1][1] = 1.0f;
201+
m_unk0xc8450.m_m[1][1] = 1.0f;
202+
m_unk0xc8410.m_m[1][2] = 0.0f;
203+
m_unk0xc8450.m_m[1][2] = 0.0f;
204+
m_unk0xc8410.m_m[1][3] = 0.0f;
205+
m_unk0xc8450.m_m[1][3] = 0.0f;
206+
m_unk0xc8410.m_m[2][0] = 0.0f;
207+
m_unk0xc8450.m_m[2][0] = 0.0f;
208+
m_unk0xc8410.m_m[2][1] = 0.0f;
209+
m_unk0xc8450.m_m[2][1] = 0.0f;
210+
m_unk0xc8410.m_m[2][2] = 1.0f;
211+
m_unk0xc8450.m_m[2][2] = 1.0f;
212+
m_unk0xc8410.m_m[2][3] = 0.0f;
213+
m_unk0xc8450.m_m[2][3] = 0.0f;
214+
m_unk0xc8410.m_m[3][0] = 0.0f;
215+
m_unk0xc8450.m_m[3][0] = 0.0f;
216+
m_unk0xc8410.m_m[3][1] = 0.0f;
217+
m_unk0xc8450.m_m[3][1] = 0.0f;
218+
m_unk0xc8410.m_m[3][2] = 0.0f;
219+
m_unk0xc8450.m_m[3][2] = 0.0f;
220+
m_unk0xc8410.m_m[3][3] = 1.0f;
221+
m_unk0xc8450.m_m[3][3] = 1.0f;
222222
m_unk0xc8764 = &BronzeFalcon0xc8770::FUN_1000c630;
223223
m_unk0xc8768 = &BronzeFalcon0xc8770::FUN_1000edf0;
224224

@@ -634,8 +634,8 @@ void BronzeFalcon0xc8770::VTable0x5c()
634634
GOL_FATALERROR_MESSAGE("Unable to set viewport");
635635
}
636636

637-
m_unk0xc8490 = lens->m_unk0x120.m_unk0x190;
638-
m_unk0xc8494 = lens->m_unk0x120.m_unk0x1d0;
637+
m_unk0xc8490 = &lens->m_unk0x120.m_unk0x190;
638+
m_unk0xc8494 = &lens->m_unk0x120.m_unk0x1d0;
639639
::memcpy(&m_unk0x4c, lens->m_unk0x34, sizeof(m_unk0x4c));
640640
::memcpy(m_unk0xc8400, &lens->m_unk0x120.m_unk0x210, sizeof(m_unk0xc8400));
641641
}
@@ -1001,10 +1001,9 @@ void BronzeFalcon0xc8770::VTable0xb4(FloatyPontoon0x4c& p_param)
10011001
forward.m_y = -forward.m_y;
10021002
forward.m_z = -forward.m_z;
10031003

1004-
D3DMATRIX* matrix = &m_unk0xc8410;
1005-
LegoBool32 builtMatrix = p_param.FUN_10014e50(&right, &forward, matrix);
1004+
LegoBool32 builtMatrix = p_param.FUN_10014e50(&right, &forward, &m_unk0xc8410);
10061005
if (builtMatrix) {
1007-
GolMath::FUN_1002f3a0(matrix, m_unk0xc8490, m_unk0xc8498);
1006+
GolMath::FUN_1002f3a0(m_unk0xc8410, *m_unk0xc8490, m_unk0xc8498);
10081007
m_unk0xc8568 = 0;
10091008
m_unk0xc83e4 = 1;
10101009
m_unk0xc8518 = m_unk0xc8498;

GolDP/src/floatybarge0x4c.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "floatybarge0x4c.h"
22

33
// STUB: GOLDP 0x10014e50
4-
LegoBool32 FloatyPontoon0x4c::FUN_10014e50(const GolVec3*, const GolVec3*, D3DMATRIX*)
4+
LegoBool32 FloatyPontoon0x4c::FUN_10014e50(const GolVec3*, const GolVec3*, GolMatrix4*)
55
{
66
STUB(0x10014e50);
77
return FALSE;

common/include/golmath.h

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,18 +79,30 @@ struct GolQuat {
7979
LegoFloat m_w;
8080
};
8181

82+
// SIZE 0x40
83+
struct GolMatrix4 {
84+
LegoFloat m_m[4][4];
85+
};
86+
8287
class GolMath {
8388
public:
84-
static void FUN_1002f3a0(const D3DMATRIX* p_left, const LegoFloat* p_right, LegoFloat* p_dest);
85-
static void FUN_1002f450(const LegoFloat* p_left, const LegoFloat* p_right, LegoFloat* p_dest);
89+
static LegoFloat QuatDot(const GolQuat& p_left, const GolQuat& p_right)
90+
{
91+
return p_left.m_x * p_right.m_x + p_left.m_y * p_right.m_y + p_left.m_z * p_right.m_z +
92+
p_left.m_w * p_right.m_w;
93+
}
94+
95+
static void FUN_1002f3a0(const GolMatrix4& p_left, const GolMatrix4& p_right, GolMatrix4* p_dest);
96+
static void FUN_1002f450(const GolMatrix4& p_left, const GolMatrix4& p_right, GolMatrix4* p_dest);
97+
static void __fastcall FUN_1002f4e0(const GolVec2& p_src, GolVec2* p_dst);
8698
static void FUN_00449170(LegoFloat p_angle, LegoFloat* p_sin, LegoFloat* p_cos);
8799
static void FUN_00449190(const LegoFloat* p_left, const LegoFloat* p_right, LegoFloat* p_dest);
88100
static void __fastcall NormalizeVector2(const GolVec2& p_src, GolVec2& p_dest);
89101
static void __fastcall NormalizeVector3(const GolVec3& p_src, GolVec3& p_dest);
90102
static void FUN_00449340(const GolQuat* p_quat, LegoFloat* p_dest);
91-
static void FUN_1002f5a0(const LegoFloat* p_matrix, GolQuat* p_dest);
92-
static void FUN_1002f720(const LegoFloat* p_matrix, GolQuat* p_dest);
93-
static void FUN_1002f890(const GolQuat* p_from, const GolQuat* p_to, LegoFloat p_amount, GolQuat* p_dest);
103+
static void FUN_1002f5a0(const GolMatrix4& p_matrix, GolQuat* p_dest);
104+
static void FUN_1002f720(const GolMatrix4& p_matrix, GolQuat* p_dest);
105+
static void FUN_1002f890(const GolQuat& p_from, const GolQuat& p_to, LegoFloat p_amount, GolQuat* p_dest);
94106
static void FUN_004496a0(const GolVec3* p_src, GolVec3* p_dest, const GolVec3* p_axis, LegoFloat p_angle);
95107
static LegoBool32 FUN_004497f0(const GolVec3* p_point, const LegoFloat* p_triangle);
96108
static LegoBool32 FUN_00449a90(

0 commit comments

Comments
 (0)