summaryrefslogtreecommitdiff
path: root/src/JSystem/J3DGraphAnimator/J3DAnimation.cpp
blob: 0d3269537340dbf27ab26facf4c4c1956c6feb81 (plain)
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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
//
// Generated by dtk
// Translation Unit: J3DAnimation.cpp
//

#include "JSystem/J3DGraphAnimator/J3DAnimation.h"
#include "dolphin/types.h"

/* 802EF5D8-802EF608       .text init__12J3DFrameCtrlFs */
void J3DFrameCtrl::init(s16 end) {
    mAttribute = 2;
    mState = 0;
    mStart = 0;
    mEnd = end;
    mLoop = 0;
    mRate = 1.0f;
    mFrame = 0.0f;
}

/* 802EF608-802EFBA8       .text checkPass__12J3DFrameCtrlFf */
BOOL J3DFrameCtrl::checkPass(f32 pass_frame) {
    f32 cur_frame = mFrame;
    f32 next_frame = cur_frame + mRate;

    switch (mAttribute) {
    case LOOP_ONCE_e:
    case LOOP_ONCE_RESET_e:
        if (next_frame < mStart) {
            next_frame = mStart;
        }

        if (next_frame >= mEnd) {
            next_frame = mEnd - 0.001f;
        }

        if (cur_frame <= next_frame) {
            if (cur_frame <= pass_frame && pass_frame < next_frame) {
                return true;
            } else {
                return false;
            }
        }

        if (next_frame <= pass_frame && pass_frame < cur_frame) {
            return true;
        }
        return false;
    case LOOP_REPEAT_e:
        if (cur_frame < mStart) {
            while (next_frame < mStart) {
                if (mLoop - mStart <= 0.0f) {
                    break;
                }
                next_frame += mLoop - mStart;
            }

            if (next_frame <= pass_frame && pass_frame < mLoop) {
                return true;
            } else {
                return false;
            }
        } else if (mEnd <= cur_frame) {
            while (next_frame >= mEnd) {            
                if (mEnd - mLoop <= 0.0f) {
                    break;
                }
                next_frame -= mEnd - mLoop;
            }

            if (mLoop <= pass_frame && pass_frame < next_frame) {
                return true;
            } else {
                return false;
            }
        } else if (next_frame < mStart) {
            while (next_frame < mStart) {            
                if (mLoop - mStart <= 0.0f) {
                    break;
                }
                next_frame += mLoop - mStart;
            }

            if ((mStart <= pass_frame && pass_frame < cur_frame) || (next_frame <= pass_frame && pass_frame < mLoop)) {
                return true;
            } else {
                return false;
            }
        } else if (mEnd <= next_frame) {
            while (next_frame >= mEnd) {            
                if (mEnd - mLoop <= 0.0f) {
                    break;
                }

                next_frame -= mEnd - mLoop;
            }

            if ((cur_frame <= pass_frame && pass_frame < mEnd) || (mLoop <= pass_frame && pass_frame < next_frame)) {
                return true;
            } else {
                return false;
            }
        } else if (cur_frame <= next_frame) {
            if (cur_frame <= pass_frame && pass_frame < next_frame) {
                return true;
            } else {
                return false;
            }
        } else if (next_frame <= pass_frame && pass_frame < cur_frame) {
            return true;
        }
        return false;
    case LOOP_MIRROR_ONCE_e:
    case LOOP_MIRROR_REPEAT_e:
        if (next_frame >= mEnd) {
            next_frame = mEnd - 0.001f;
        }

        if (next_frame < mStart) {
            next_frame = mStart;
        }

        if (cur_frame <= next_frame) {
            if (cur_frame <= pass_frame && pass_frame < next_frame) {
                return true;
            } else {
                return false;
            }
        }

        if (next_frame <= pass_frame && pass_frame < cur_frame) {
            return true;
        }
        return false;
    default:
        return false;
    }
}

/* 802EFBA8-802EFFE4       .text update__12J3DFrameCtrlFv */
void J3DFrameCtrl::update() {
    mState = 0;
    mFrame += mRate;
    switch (mAttribute) {
    case LOOP_ONCE_e:
        if (mFrame < mStart) {
            mFrame = mStart;
            mRate = 0.0f;
            mState |= 1;
        }
        if (mFrame >= mEnd) {
            mFrame = mEnd - 0.001f;
            mRate = 0.0f;
            mState |= 1;
        }
        break;
    case LOOP_ONCE_RESET_e:
        if (mFrame < mStart) {
            mFrame = mStart;
            mRate = 0.0f;
            mState |= 1;
        }
        if (mFrame >= mEnd) {
            mFrame = mStart;
            mRate = 0.0f;
            mState |= 1;
        }
        break;
    case LOOP_REPEAT_e:
        while (mFrame < mStart) {
            mState |= 2;
            if (mLoop - mStart <= 0.0f) {
                break;
            }
            mFrame += mLoop - mStart;
        }
        while (mFrame >= mEnd) {
            mState |= 2;
            if (mEnd - mLoop <= 0.0f) {
                break;
            }
            mFrame -= mEnd - mLoop;
        }
        break;
    case LOOP_MIRROR_ONCE_e:
        if (mFrame >= mEnd) {
            mFrame = mEnd - 0.001f;
            mRate = -mRate;
        }
        if (mFrame < mStart) {
            mFrame = mStart;
            mRate = 0.0f;
            mState |= 1;
        }
        break;
    case LOOP_MIRROR_REPEAT_e:
        if (mFrame >= mEnd) {
            mFrame = mEnd - 0.001f;
            mRate = -mRate;
        }
        if (mFrame < mStart) {
            mFrame = mStart;
            mRate = -mRate;
            mState |= 2;
        }
        break;
    }
}

/* 802EFFE4-802F06D8       .text getTransform__19J3DAnmTransformFullCFUsP16J3DTransformInfo */
void J3DAnmTransformFull::getTransform(u16, J3DTransformInfo*) const {
    /* Nonmatching */
}

/* 802F06D8-802F072C       .text J3DHermiteInterpolationS__FfPsPsPsPsPsPs */
f32 J3DHermiteInterpolationS(f32 t, s16* time0, s16* value0, s16* tangent0, s16* time1, s16* value1, s16* tangent1) {
    /* Nonmatching */
}

/* 802F072C-802F0954       .text J3DGetKeyFrameInterpolationS__FfP18J3DAnmKeyTableBasePs */
void J3DGetKeyFrameInterpolationS(f32, J3DAnmKeyTableBase*, s16*) {
    /* Nonmatching */
}

/* 802F0954-802F0E20       .text calcTransform__18J3DAnmTransformKeyCFfUsP16J3DTransformInfo */
void J3DAnmTransformKey::calcTransform(f32, u16, J3DTransformInfo*) const {
    /* Nonmatching */
}

/* 802F0E20-802F10D4       .text calcTransform__19J3DAnmTextureSRTKeyCFfUsP17J3DTextureSRTInfo */
void J3DAnmTextureSRTKey::calcTransform(f32, u16, J3DTextureSRTInfo*) const {
    /* Nonmatching */
}

/* 802F10D4-802F1188       .text getWeight__17J3DAnmClusterFullCFUs */
f32 J3DAnmClusterFull::getWeight(u16) const {
    /* Nonmatching */
}

/* 802F1188-802F120C       .text getWeight__16J3DAnmClusterKeyCFUs */
f32 J3DAnmClusterKey::getWeight(u16) const {
    /* Nonmatching */
}

/* 802F120C-802F14B4       .text getColor__18J3DAnmVtxColorFullCFUcUsP8_GXColor */
void J3DAnmVtxColorFull::getColor(unsigned char, u16, _GXColor*) const {
    /* Nonmatching */
}

/* 802F14B4-802F17D0       .text getColor__17J3DAnmVtxColorKeyCFUcUsP8_GXColor */
void J3DAnmVtxColorKey::getColor(unsigned char, u16, _GXColor*) const {
    /* Nonmatching */
}

/* 802F17D0-802F1868       .text searchUpdateMaterialID__11J3DAnmColorFP16J3DMaterialTable */
void J3DAnmColor::searchUpdateMaterialID(J3DMaterialTable*) {
    /* Nonmatching */
}

/* 802F1868-802F188C       .text searchUpdateMaterialID__11J3DAnmColorFP12J3DModelData */
void J3DAnmColor::searchUpdateMaterialID(J3DModelData*) {
    /* Nonmatching */
}

/* 802F188C-802F1BDC       .text getColor__15J3DAnmColorFullCFUsP8_GXColor */
void J3DAnmColorFull::getColor(u16, _GXColor*) const {
    /* Nonmatching */
}

/* 802F1BDC-802F1F20       .text getColor__14J3DAnmColorKeyCFUsP8_GXColor */
void J3DAnmColorKey::getColor(u16, _GXColor*) const {
    /* Nonmatching */
}

/* 802F1F20-802F200C       .text getTexNo__16J3DAnmTexPatternCFUsPUs */
void J3DAnmTexPattern::getTexNo(u16, u16*) const {
    /* Nonmatching */
}

/* 802F200C-802F20EC       .text getVisibility__20J3DAnmVisibilityFullCFUsPUc */
bool J3DAnmVisibilityFull::getVisibility(u16, u8*) const {
    /* Nonmatching */
}

/* 802F20EC-802F2184       .text searchUpdateMaterialID__16J3DAnmTexPatternFP16J3DMaterialTable */
void J3DAnmTexPattern::searchUpdateMaterialID(J3DMaterialTable*) {
    /* Nonmatching */
}

/* 802F2184-802F21A8       .text searchUpdateMaterialID__16J3DAnmTexPatternFP12J3DModelData */
void J3DAnmTexPattern::searchUpdateMaterialID(J3DModelData*) {
    /* Nonmatching */
}

/* 802F21A8-802F22BC       .text searchUpdateMaterialID__19J3DAnmTextureSRTKeyFP16J3DMaterialTable */
void J3DAnmTextureSRTKey::searchUpdateMaterialID(J3DMaterialTable*) {
    /* Nonmatching */
}

/* 802F22BC-802F22E0       .text searchUpdateMaterialID__19J3DAnmTextureSRTKeyFP12J3DModelData */
void J3DAnmTextureSRTKey::searchUpdateMaterialID(J3DModelData*) {
    /* Nonmatching */
}

/* 802F22E0-802F2624       .text getTevColorReg__15J3DAnmTevRegKeyCFUsP11_GXColorS10 */
void J3DAnmTevRegKey::getTevColorReg(u16, _GXColorS10*) const {
    /* Nonmatching */
}

/* 802F2624-802F2968       .text getTevKonstReg__15J3DAnmTevRegKeyCFUsP8_GXColor */
void J3DAnmTevRegKey::getTevKonstReg(u16, _GXColor*) const {
    /* Nonmatching */
}

/* 802F2968-802F2A64       .text searchUpdateMaterialID__15J3DAnmTevRegKeyFP16J3DMaterialTable */
void J3DAnmTevRegKey::searchUpdateMaterialID(J3DMaterialTable*) {
    /* Nonmatching */
}

/* 802F2A64-802F2A88       .text searchUpdateMaterialID__15J3DAnmTevRegKeyFP12J3DModelData */
void J3DAnmTevRegKey::searchUpdateMaterialID(J3DModelData*) {
    /* Nonmatching */
}