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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
|
//
// Generated By: dol2asm
// Translation Unit: JPAMath
//
#include "JSystem/JParticle/JPAMath.h"
#include "JSystem/JMath/JMATrigonometric.h"
#include "JSystem/J2DGraph/J2DAnimation.h"
//
// Types:
//
//
// Forward References:
//
extern "C" void func_80280588();
extern "C" void JPAGetYZRotateMtx__FssPA4_f();
extern "C" void JPAGetXYZRotateMtx__FsssPA4_f();
extern "C" void func_802807E0();
extern "C" void func_80280808();
extern "C" void JPACalcKeyAnmValue__FfUsPCf();
//
// External References:
//
extern "C" void _savegpr_28();
extern "C" void _restgpr_28();
extern "C" u8 sincosTable___5JMath[65536];
//
// Declarations:
//
/* ############################################################################################## */
// Probably some local function needed to change float literal order
static f32 floatDummyFunc() {
return 1.0f;
}
/* 80280588-802806C0 27AEC8 0138+00 0/0 1/1 0/0 .text JPAGetDirMtx__FRCQ29JGeometry8TVec3<f>PA4_f
*/
void JPAGetDirMtx(JGeometry::TVec3<f32> const& param_0, f32 (*param_1)[4]) {
JGeometry::TVec3<float> local_78;
f32 minusx = -param_0.x;
local_78.x = param_0.y;
local_78.y = minusx;
local_78.z = 0.0f;
f32 len = local_78.length();
if (len <= 32.0f * FLT_EPSILON) {
local_78.zero();
} else {
local_78.scale(1.0f / len);
}
f32 xsquared = local_78.x * local_78.x;
f32 ysquared = local_78.y * local_78.y;
f32 xlen = local_78.x * len;
f32 ylen = local_78.y * len;
f32 fVar5 = (1.0f - param_0.z) * (local_78.x * local_78.y);
param_1[0][0] = xsquared + param_0.z * (1.0f - xsquared);
param_1[0][1] = fVar5;
param_1[0][2] = -ylen;
param_1[0][3] = 0.0f;
param_1[1][0] = fVar5;
param_1[1][1] = ysquared + param_0.z * (1.0f - ysquared);
param_1[1][2] = xlen;
param_1[1][3] = 0.0f;
param_1[2][0] = ylen;
param_1[2][1] = -xlen;
param_1[2][2] = param_0.z;
param_1[2][3] = 0.0f;
}
/* 802806C0-80280734 27B000 0074+00 0/0 1/1 0/0 .text JPAGetYZRotateMtx__FssPA4_f */
void JPAGetYZRotateMtx(s16 angleY, s16 angleZ, f32 (*param_2)[4]) {
f32 cosy = JMASCos(angleY);
f32 cosz = JMASCos(angleZ);
f32 siny = JMASSin(angleY);
f32 sinz = JMASSin(angleZ);
param_2[0][0] = (cosy * cosz);
param_2[0][1] = -sinz;
param_2[0][2] = (siny * cosz);
param_2[1][0] = (cosy * sinz);
param_2[1][1] = cosz;
param_2[1][2] = (siny * sinz);
param_2[2][0] = -siny;
param_2[2][2] = cosy;
param_2[2][3] = 0.0f;
param_2[2][1] = 0.0f;
param_2[1][3] = 0.0f;
param_2[0][3] = 0.0f;
}
/* 80280734-802807E0 27B074 00AC+00 0/0 6/6 11/11 .text JPAGetXYZRotateMtx__FsssPA4_f */
void JPAGetXYZRotateMtx(s16 x, s16 y, s16 z, Mtx mtx) {
f32 cosx = JMASCos(x);
f32 cosy = JMASCos(y);
f32 cosz = JMASCos(z);
f32 sinx = JMASSin(x);
f32 siny = JMASSin(y);
f32 sinz = JMASSin(z);
mtx[0][0] = cosy * cosz;
mtx[1][0] = cosy * sinz;
mtx[2][0] = -siny;
mtx[2][1] = sinx * cosy;
mtx[2][2] = cosx * cosy;
f32 cosxsinz = cosx * sinz;
f32 sinxcosz = sinx * cosz;
mtx[0][1] = sinxcosz * siny - cosxsinz;
mtx[1][2] = cosxsinz * siny - sinxcosz;
f32 sinxsinz = sinx * sinz;
f32 cosxcosz = cosx * cosz;
mtx[0][2] = sinxsinz + cosxcosz * siny;
mtx[1][1] = cosxcosz + sinxsinz * siny;
mtx[2][3] = 0.0f;
mtx[1][3] = 0.0f;
mtx[0][3] = 0.0f;
}
/* 802807E0-80280808 27B120 0028+00 0/0 11/11 71/71 .text
* JPASetRMtxTVecfromMtx__FPA4_CfPA4_fPQ29JGeometry8TVec3<f> */
void JPASetRMtxTVecfromMtx(f32 const (*param_0)[4], f32 (*param_1)[4],
JGeometry::TVec3<f32>* param_2) {
JGeometry::TVec3<f32> dummy;
JPASetRMtxSTVecfromMtx(param_0, param_1, &dummy, param_2);
}
/* 80280808-80280984 27B148 017C+00 1/1 1/1 53/53 .text
* JPASetRMtxSTVecfromMtx__FPA4_CfPA4_fPQ29JGeometry8TVec3<f>PQ29JGeometry8TVec3<f> */
void JPASetRMtxSTVecfromMtx(f32 const (*param_0)[4], f32 (*param_1)[4],
JGeometry::TVec3<f32>* param_2, JGeometry::TVec3<f32>* param_3) {
JGeometry::TVec3<float> aTStack_54;
aTStack_54.set(param_0[0][0], param_0[1][0], param_0[2][0]);
param_2->x = aTStack_54.length();
aTStack_54.set(param_0[0][1], param_0[1][1], param_0[2][1]);
param_2->y = aTStack_54.length();
aTStack_54.set(param_0[0][2], param_0[1][2], param_0[2][2]);
param_2->z = aTStack_54.length();
MTXIdentity(param_1);
if (param_2->x != 0.0f) {
f32 fVar5 = 1.0f / param_2->x;
param_1[0][0] = param_0[0][0] * fVar5;
param_1[1][0] = param_0[1][0] * fVar5;
param_1[2][0] = param_0[2][0] * fVar5;
}
if (param_2->y != 0.0f) {
f32 fVar5 = 1.0f / param_2->y;
param_1[0][1] = param_0[0][1] * fVar5;
param_1[1][1] = param_0[1][1] * fVar5;
param_1[2][1] = param_0[2][1] * fVar5;
}
if (param_2->z != 0.0f) {
f32 fVar5 = 1.0f / param_2->z;
param_1[0][2] = param_0[0][2] * fVar5;
param_1[1][2] = param_0[1][2] * fVar5;
param_1[2][2] = param_0[2][2] * fVar5;
}
param_3->set(param_0[0][3], param_0[1][3], param_0[2][3]);
}
/* 80280984-80280A48 27B2C4 00C4+00 0/0 2/1 0/0 .text JPACalcKeyAnmValue__FfUsPCf */
f32 JPACalcKeyAnmValue(f32 param_0, u16 param_1, f32 const* param_2) {
if (param_0 < param_2[0]) {
return param_2[1];
}
int ind = param_1 - 1;
if (param_2[ind * 4] <= param_0) {
return param_2[ind * 4 + 1];
}
int x = param_1;
while (x > 1) {
u32 uVar3 = x / 2;
if (param_0 >= param_2[uVar3 * 4]) {
param_2 += uVar3 * 4;
x -= uVar3;
} else {
x = uVar3;
}
}
return JMAHermiteInterpolation(param_0, param_2[0], param_2[1],
param_2[3], param_2[4],
param_2[5], param_2[6]);
}
|