Skip to content

Commit acea12a

Browse files
committed
Matches
1 parent 4ca3891 commit acea12a

2 files changed

Lines changed: 115 additions & 82 deletions

File tree

GolDP/include/floatybuoy0x58.h

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,33 @@ class FloatyBuoy0x58 : public FloatyBoat0x28 {
2222
void VTable0x44(GolMatrix3*) const override; // vtable+0x44
2323
void VTable0x48(GolVec3* p_dest1, GolVec3* p_dest2) const override; // vtable+0x48
2424

25-
void FUN_10026b10();
25+
void Reset();
2626
void FUN_10026c50(GolMatrix4* p_dest);
2727
void FUN_10026f70(const GolVec3& p_v);
2828
void FUN_10026fa0(LegoFloat p_scalar);
2929
void FUN_10026fc0(GolMatrix4* p_dest, float p_scale) const;
3030

3131
protected:
32-
GolMatrix34 m_unk0x28;
32+
void Initialize()
33+
{
34+
m_v2.m_x = 0.0f;
35+
m_v2.m_y = 0.0f;
36+
m_v2.m_z = 0.0f;
37+
m_unk0x28.m_m[0][0] = 1.0f;
38+
m_unk0x28.m_m[0][1] = 0.0f;
39+
m_unk0x28.m_m[0][2] = 0.0f;
40+
m_unk0x28.m_m[1][0] = 0.0f;
41+
m_unk0x28.m_m[1][1] = 1.0f;
42+
m_unk0x28.m_m[1][2] = 0.0f;
43+
m_unk0x28.m_m[2][0] = 0.0f;
44+
m_unk0x28.m_m[2][1] = 0.0f;
45+
m_unk0x28.m_m[2][2] = 1.0f;
46+
m_unk0x28.m_m[3][0] = 0.0f;
47+
m_unk0x28.m_m[3][1] = 0.0f;
48+
m_unk0x28.m_m[3][2] = 0.0f;
49+
}
50+
51+
GolMatrix34 m_unk0x28; // 0x28
3352
};
3453

3554
#endif // FLOATYBUOY0X58_H

GolDP/src/floatybuoy0x58.cpp

Lines changed: 94 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -3,67 +3,52 @@
33
// FUNCTION: GOLDP 0x10026ac0
44
FloatyBuoy0x58::FloatyBuoy0x58()
55
{
6-
m_v2.m_x = 0.0f;
7-
m_v2.m_y = 0.0f;
8-
m_v2.m_z = 0.0f;
9-
m_unk0x28.m_m[0][1] = 0.0f;
10-
m_unk0x28.m_m[0][2] = 0.0f;
11-
m_unk0x28.m_m[1][0] = 0.0f;
12-
m_unk0x28.m_m[1][2] = 0.0f;
13-
m_unk0x28.m_m[2][0] = 0.0f;
14-
m_unk0x28.m_m[2][1] = 0.0f;
15-
m_unk0x28.m_m[3][0] = 0.0f;
16-
m_unk0x28.m_m[3][1] = 0.0f;
17-
m_unk0x28.m_m[3][2] = 0.0f;
18-
m_unk0x28.m_m[0][0] = 1.0f;
19-
m_unk0x28.m_m[1][1] = 1.0f;
20-
m_unk0x28.m_m[2][2] = 1.0f;
6+
Initialize();
217
}
228

239
// FUNCTION: GOLDP 0x10026b10
24-
void FloatyBuoy0x58::FUN_10026b10()
25-
{
26-
m_v2.m_x = 0.0f;
27-
m_v2.m_y = 0.0f;
28-
m_v2.m_z = 0.0f;
29-
m_unk0x28.m_m[0][0] = 1.0f;
30-
m_unk0x28.m_m[0][1] = 0.0f;
31-
m_unk0x28.m_m[0][2] = 0.0f;
32-
m_unk0x28.m_m[1][0] = 0.0f;
33-
m_unk0x28.m_m[1][1] = 1.0f;
34-
m_unk0x28.m_m[1][2] = 0.0f;
35-
m_unk0x28.m_m[2][0] = 0.0f;
36-
m_unk0x28.m_m[2][1] = 0.0f;
37-
m_unk0x28.m_m[2][2] = 1.0f;
38-
m_unk0x28.m_m[3][0] = 0.0f;
39-
m_unk0x28.m_m[3][1] = 0.0f;
40-
m_unk0x28.m_m[3][2] = 0.0f;
10+
void FloatyBuoy0x58::Reset()
11+
{
12+
Initialize();
4113
}
4214

4315
// FUNCTION: GOLDP 0x10026b50
4416
void FloatyBuoy0x58::VTable0x40(const GolVec3& p_v1, const GolVec3& p_v2)
4517
{
46-
GolVec3 v1Unit;
47-
GolMath::NormalizeVector3(p_v1, &v1Unit);
48-
LegoFloat dot = GOLVECTOR3_DOT(v1Unit, p_v2);
49-
GolVec3 mult = dot * v1Unit;
50-
GolVec3 v1Perp = p_v2;
51-
v1Perp -= mult;
52-
GolMath::NormalizeVector3(v1Perp, &v1Perp);
53-
m_unk0x28.m_m[0][0] = v1Unit.m_x;
54-
m_unk0x28.m_m[0][1] = v1Unit.m_y;
55-
m_unk0x28.m_m[0][2] = v1Unit.m_z;
56-
m_unk0x28.m_m[1][0] = v1Perp.m_y * v1Unit.m_z - v1Perp.m_z * v1Unit.m_y;
57-
m_unk0x28.m_m[1][1] = v1Perp.m_z * v1Unit.m_x - v1Perp.m_x * v1Unit.m_z;
58-
m_unk0x28.m_m[1][2] = v1Perp.m_x * v1Unit.m_y - v1Perp.m_y * v1Unit.m_x;
59-
m_unk0x28.m_m[2][0] = v1Perp.m_x;
60-
m_unk0x28.m_m[2][1] = v1Perp.m_y;
61-
m_unk0x28.m_m[2][2] = v1Perp.m_z;
18+
GolVec3 unit;
19+
GolMath::NormalizeVector3(p_v1, &unit);
20+
21+
LegoFloat dot = p_v2.m_y;
22+
dot *= unit.m_y;
23+
dot += unit.m_z * p_v2.m_z;
24+
dot += unit.m_x * p_v2.m_x;
25+
GolVec3 mult = dot * unit;
26+
GolVec3 perp;
27+
perp.m_x = p_v2.m_x - mult.m_x;
28+
perp.m_y = p_v2.m_y - mult.m_y;
29+
perp.m_z = p_v2.m_z - mult.m_z;
30+
GolMath::NormalizeVector3(perp, &perp);
31+
32+
GolVec3 cross;
33+
cross.m_x = perp.m_y * unit.m_z - perp.m_z * unit.m_y;
34+
cross.m_y = perp.m_z * unit.m_x - perp.m_x * unit.m_z;
35+
cross.m_z = perp.m_x * unit.m_y - perp.m_y * unit.m_x;
36+
LegoFloat* row0 = &m_unk0x28.m_m[0][0];
37+
LegoFloat* row1 = &m_unk0x28.m_m[1][0];
38+
LegoFloat* row2 = &m_unk0x28.m_m[2][0];
39+
row0[0] = unit.m_x;
40+
row0[1] = unit.m_y;
41+
row1[0] = cross.m_x;
42+
row0[2] = unit.m_z;
43+
row1[1] = cross.m_y;
44+
row1[2] = cross.m_z;
45+
row2[0] = perp.m_x;
46+
row2[1] = perp.m_y;
47+
row2[2] = perp.m_z;
6248
}
6349

6450
// FUNCTION: GOLDP 0x10026c50
6551
void FloatyBuoy0x58::FUN_10026c50(GolMatrix4* p_dest)
66-
6752
{
6853
p_dest->m_m[0][0] = m_unk0x28.m_m[0][0];
6954
p_dest->m_m[0][1] = m_unk0x28.m_m[0][1];
@@ -78,7 +63,6 @@ void FloatyBuoy0x58::FUN_10026c50(GolMatrix4* p_dest)
7863

7964
// FUNCTION: GOLDP 0x10026c90
8065
void FloatyBuoy0x58::VTable0x44(GolMatrix3* p_dest) const
81-
8266
{
8367
p_dest->m_m[0][0] = m_unk0x28.m_m[0][0];
8468
p_dest->m_m[0][1] = m_unk0x28.m_m[0][1];
@@ -107,7 +91,6 @@ void FloatyBuoy0x58::VTable0x3c(const GolMatrix34& p_matrix)
10791

10892
// FUNCTION: GOLDP 0x10026d10
10993
void FloatyBuoy0x58::VTable0x34(const GolVec3& p_src, GolVec3* p_dest)
110-
11194
{
11295
p_dest->m_x = m_unk0x28.m_m[0][0] * p_src.m_x;
11396
p_dest->m_y = m_unk0x28.m_m[0][1] * p_src.m_x;
@@ -154,22 +137,48 @@ void FloatyBuoy0x58::VTable0x2c(const GolVec3& p_src, GolVec3* p_dest) const
154137
// FUNCTION: GOLDP 0x10026e70
155138
void FloatyBuoy0x58::VTable0x30(const GolVec3& p_src, GolVec3* p_dest) const
156139
{
157-
p_dest->m_x = m_unk0x28.m_m[0][0] * p_src.m_x;
158-
p_dest->m_y = m_unk0x28.m_m[1][0] * p_src.m_x;
159-
p_dest->m_z = m_unk0x28.m_m[2][0] * p_src.m_x;
160-
p_dest->m_x += m_unk0x28.m_m[0][1] * p_src.m_y;
161-
p_dest->m_y += m_unk0x28.m_m[1][1] * p_src.m_y;
162-
p_dest->m_z += m_unk0x28.m_m[2][1] * p_src.m_y;
163-
p_dest->m_x += m_unk0x28.m_m[0][2] * p_src.m_z;
164-
p_dest->m_y += m_unk0x28.m_m[1][2] * p_src.m_z;
165-
p_dest->m_z += m_unk0x28.m_m[2][2] * p_src.m_z;
166-
167-
p_dest->m_x = p_dest->m_x - (m_unk0x28.m_m[3][0] * m_unk0x28.m_m[0][0] + m_unk0x28.m_m[3][1] * m_unk0x28.m_m[0][1] +
168-
m_unk0x28.m_m[3][2] * m_unk0x28.m_m[0][2]);
169-
p_dest->m_y = p_dest->m_y - (m_unk0x28.m_m[3][0] * m_unk0x28.m_m[1][0] + m_unk0x28.m_m[3][1] * m_unk0x28.m_m[1][1] +
170-
m_unk0x28.m_m[3][2] * m_unk0x28.m_m[1][2]);
171-
p_dest->m_z = p_dest->m_z - (m_unk0x28.m_m[3][0] * m_unk0x28.m_m[2][0] + m_unk0x28.m_m[3][1] * m_unk0x28.m_m[2][1] +
172-
m_unk0x28.m_m[2][2] * m_unk0x28.m_m[3][2]);
140+
LegoFloat x = m_unk0x28.m_m[0][0];
141+
x *= p_src.m_x;
142+
p_dest->m_x = x;
143+
LegoFloat y = m_unk0x28.m_m[1][0];
144+
y *= p_src.m_x;
145+
p_dest->m_y = y;
146+
LegoFloat z = m_unk0x28.m_m[2][0];
147+
z *= p_src.m_x;
148+
p_dest->m_z = z;
149+
150+
x = m_unk0x28.m_m[0][1];
151+
x *= p_src.m_y;
152+
p_dest->m_x += x;
153+
y = m_unk0x28.m_m[1][1];
154+
y *= p_src.m_y;
155+
p_dest->m_y += y;
156+
z = m_unk0x28.m_m[2][1];
157+
z *= p_src.m_y;
158+
p_dest->m_z += z;
159+
160+
x = m_unk0x28.m_m[0][2];
161+
x *= p_src.m_z;
162+
p_dest->m_x += x;
163+
y = m_unk0x28.m_m[1][2];
164+
y *= p_src.m_z;
165+
p_dest->m_y += y;
166+
z = m_unk0x28.m_m[2][2];
167+
z *= p_src.m_z;
168+
p_dest->m_z += z;
169+
170+
x = m_unk0x28.m_m[3][0] * m_unk0x28.m_m[0][0];
171+
x += m_unk0x28.m_m[0][1] * m_unk0x28.m_m[3][1];
172+
x += m_unk0x28.m_m[3][2] * m_unk0x28.m_m[0][2];
173+
p_dest->m_x -= x;
174+
y = m_unk0x28.m_m[3][2] * m_unk0x28.m_m[1][2];
175+
y += m_unk0x28.m_m[1][1] * m_unk0x28.m_m[3][1];
176+
y += m_unk0x28.m_m[3][0] * m_unk0x28.m_m[1][0];
177+
p_dest->m_y -= y;
178+
z = m_unk0x28.m_m[2][2] * m_unk0x28.m_m[3][2];
179+
z += m_unk0x28.m_m[2][1] * m_unk0x28.m_m[3][1];
180+
z += m_unk0x28.m_m[3][0] * m_unk0x28.m_m[2][0];
181+
p_dest->m_z -= z;
173182
}
174183

175184
// FUNCTION: GOLDP 0x10026f30
@@ -182,7 +191,6 @@ void FloatyBuoy0x58::VTable0x04(GolVec3* p_dest) const
182191

183192
// FUNCTION: GOLDP 0x10026f50
184193
void FloatyBuoy0x58::VTable0x08(const GolVec3& p_pos)
185-
186194
{
187195
m_unk0x28.m_m[3][0] = p_pos.m_x;
188196
m_unk0x28.m_m[3][1] = p_pos.m_y;
@@ -193,7 +201,6 @@ void FloatyBuoy0x58::VTable0x08(const GolVec3& p_pos)
193201
// FUNCTION: GOLDP 0x10026f70
194202
void FloatyBuoy0x58::FUN_10026f70(const GolVec3& p_v)
195203
{
196-
197204
m_v0 = p_v;
198205
m_v1.m_y = m_v0.m_x - m_v1.m_x;
199206
m_v1.m_z = m_v0.m_x + m_v1.m_x;
@@ -211,22 +218,29 @@ void FloatyBuoy0x58::FUN_10026fa0(float p_scalar)
211218

212219
// FUNCTION: GOLDP 0x10026fc0
213220
void FloatyBuoy0x58::FUN_10026fc0(GolMatrix4* p_dest, float p_scale) const
214-
215221
{
216-
p_dest->m_m[0][0] = m_unk0x28.m_m[0][0] * p_scale;
217-
p_dest->m_m[0][1] = m_unk0x28.m_m[0][1] * p_scale;
218-
p_dest->m_m[0][2] = m_unk0x28.m_m[0][2] * p_scale;
219-
p_dest->m_m[1][0] = m_unk0x28.m_m[1][0] * p_scale;
220-
p_dest->m_m[1][1] = m_unk0x28.m_m[1][1] * p_scale;
221-
p_dest->m_m[1][2] = m_unk0x28.m_m[1][2] * p_scale;
222-
p_dest->m_m[2][0] = m_unk0x28.m_m[2][0] * p_scale;
223-
p_dest->m_m[2][1] = m_unk0x28.m_m[2][1] * p_scale;
224-
p_dest->m_m[2][2] = m_unk0x28.m_m[2][2] * p_scale;
222+
LegoFloat value = m_unk0x28.m_m[0][0];
223+
p_dest->m_m[0][0] = value * p_scale;
224+
value = m_unk0x28.m_m[0][1];
225+
p_dest->m_m[0][1] = value * p_scale;
226+
value = m_unk0x28.m_m[0][2];
227+
p_dest->m_m[0][2] = value * p_scale;
228+
value = m_unk0x28.m_m[1][0];
229+
p_dest->m_m[1][0] = value * p_scale;
230+
value = m_unk0x28.m_m[1][1];
231+
p_dest->m_m[1][1] = value * p_scale;
232+
value = m_unk0x28.m_m[1][2];
233+
p_dest->m_m[1][2] = value * p_scale;
234+
value = m_unk0x28.m_m[2][0];
235+
p_dest->m_m[2][0] = value * p_scale;
236+
value = m_unk0x28.m_m[2][1];
237+
p_dest->m_m[2][1] = value * p_scale;
238+
value = m_unk0x28.m_m[2][2];
239+
p_dest->m_m[2][2] = value * p_scale;
225240
}
226241

227242
// FUNCTION: GOLDP 0x1001ad90 FOLDED
228243
void FloatyBuoy0x58::VTable0x48(GolVec3* p_dest1, GolVec3* p_dest2) const
229-
230244
{
231245
p_dest1->m_x = m_unk0x28.m_m[0][0];
232246
p_dest1->m_y = m_unk0x28.m_m[0][1];

0 commit comments

Comments
 (0)