summaryrefslogtreecommitdiff
path: root/src/Z2AudioLib/Z2SoundObject.cpp
blob: 839b7730b614da94b0092ba5d623fde75f800155 (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
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
//
// Generated By: dol2asm
// Translation Unit: Z2SoundObject
//

#include "Z2AudioLib/Z2SoundObject.h"
#include "Z2AudioLib/Z2Calc.h"
#include "Z2AudioLib/Z2SeMgr.h"
#include "Z2AudioLib/Z2SoundInfo.h"
#include "Z2AudioLib/Z2SoundMgr.h"
#include "Z2AudioLib/Z2SoundStarter.h"
#include "Z2AudioLib/Z2Audience.h"
#include "JSystem/JAudio2/JAUSoundAnimator.h"

Z2SoundObjBase::Z2SoundObjBase() {
    //! @note initializer list doesn't work since fields were initialized out of
    //! structure layout order, indicating original code didn't use initializer list.
    mSoundPos = NULL;
    mIsInitialized = false;
    mSoundStarter = JASGlobalInstance<Z2SoundStarter>::getInstance();  // sInstance
    field_0x1c = 0;
    field_0x1e = 0;
}

Z2SoundObjBase::~Z2SoundObjBase() {
    deleteObject();
}

void Z2SoundObjBase::init(Vec* pSoundPos, u8 pNumHandles) {
    initHandlesPool(pNumHandles);
    mSoundPos = (JGeometry::TVec3<f32>*)pSoundPos;
    mIsInitialized = true;
}

/* 802BDFF8-802BE038 2B8938 0040+00 1/1 8/8 61/61 .text            deleteObject__14Z2SoundObjBaseFv
 */
void Z2SoundObjBase::deleteObject() {
    dispose();
    deleteHandlesPool();
}

void Z2SoundObjBase::framework(u32 p1, s8 reverb) {
    if (mIsInitialized) {
        field_0x1c = p1;
        field_0x1e = reverb;
        setPos(*mSoundPos);
    }
}

/* 802BE070-802BE104 2B89B0 0094+00 5/0 3/0 0/0 .text            dispose__14Z2SoundObjBaseFv */
void Z2SoundObjBase::dispose() {
    JAISoundHandle* handle;
    JSULink<Z2SoundHandlePool>* link;
    for (link = getFirst(); link != NULL; link = link->getNext()) {
        handle = link->getObject();
        if (handle != NULL && (bool)*handle) {
            u32 swBit = JASGlobalInstance<Z2SoundInfo>::sInstance->getSwBit((*handle)->getID());
            if ((swBit & 0x8000) != 0) {
                handle->releaseSound();
            } else {
                (*handle)->stop();
            }
        }
    }

    mIsInitialized = false;
}

/* 802BE104-802BE144 2B8A44 0040+00 5/0 3/0 0/0 .text
 * stopOK__14Z2SoundObjBaseFR17Z2SoundHandlePool                */
bool Z2SoundObjBase::stopOK(Z2SoundHandlePool& pSoundHandlePool) {
    return !(JASGlobalInstance<Z2SoundInfo>::sInstance->
                                             getSwBit(pSoundHandlePool->getID()) & 0x8000);
}

/* 802BE144-802BE2D4 2B8A84 0190+00 5/3 3/1 0/0 .text
 * startSound__14Z2SoundObjBaseF10JAISoundIDUlSc                */
Z2SoundHandlePool* Z2SoundObjBase::startSound(JAISoundID pSoundId, u32 param_1, s8 param_2) {
    if (!mIsInitialized) {
        return NULL;
    }
    if (JASGlobalInstance<Z2SeMgr>::getInstance()->isSoundCulling(pSoundId)) {
        return NULL;
    }
    if (param_1 == 0) {
        param_1 = (u32)field_0x1c;
    }
    if (param_2 < 0) {
        param_2 = field_0x1e;
    }
    f32 local_0 = (f32)param_2 / 127.0f;
    Z2SoundHandlePool* handle = getHandleSoundID(pSoundId);
    if (handle != NULL) {
        if ((JASGlobalInstance<Z2SoundInfo>::getInstance()->getSwBit(pSoundId) & 0x4000) != 0) {
            handle = NULL;
        } else {
            return NULL;
        }
    }
    if (handle == NULL) {
        handle = getFreeHandle();
    }
    if (handle == NULL) {
        handle = getLowPrioSound(pSoundId);
    }
    if (handle != NULL) {
        mSoundStarter->startSound(pSoundId, handle, mSoundPos, param_1, local_0,
                                  1.0f, 1.0f, -1.0f, -1.0f, 0);
    }
    return handle;
}

/* 802BE2D4-802BE4A4 2B8C14 01D0+00 4/2 3/0 0/0 .text
 * startLevelSound__14Z2SoundObjBaseF10JAISoundIDUlSc           */
Z2SoundHandlePool* Z2SoundObjBase::startLevelSound(JAISoundID pSoundId, u32 param_1, s8 param_2) {
    if (!mIsInitialized) {
        return NULL;
    }
    if (param_1 == 0) {
        param_1 = (u32)field_0x1c;
    }
    if (param_2 < 0) {
        param_2 = field_0x1e;
    }
    f32 local_0 = (f32)param_2 / 127.0f;
    Z2SoundHandlePool* handle = getHandleSoundID(pSoundId);
    if (handle != NULL) {
        handle->getSound()->updateLifeTime(1);
        mSoundStarter->setPortData(handle, 6, (u16)param_1, -1);
        handle->getSound()->getAuxiliary().moveFxMix(local_0, 0);
    } else {
        if (JASGlobalInstance<Z2SeMgr>::getInstance()->isSoundCulling(pSoundId)) {
            return NULL;
        }
        handle = getFreeHandle();
        if (handle == NULL) {
            handle = getLowPrioSound(pSoundId);
        }
        if (handle != NULL) {
            mSoundStarter->startSound(pSoundId, handle, mSoundPos, param_1, local_0,
                                      1.0f, 1.0f, -1.0f, -1.0f, 0);
            if (handle != NULL && handle->getSound() != NULL) {
                handle->getSound()->setLifeTime(1, false);
            }
        }
    }
    return handle;
}

/* 802BE4A4-802BE5A0 2B8DE4 00FC+00 0/0 5/5 21/21 .text
 * startCollisionSE__14Z2SoundObjBaseFUlUlP14Z2SoundObjBase     */
Z2SoundHandlePool* Z2SoundObjBase::startCollisionSE(u32 pId, u32 pUserData, Z2SoundObjBase* pOther) {
    if (pOther != NULL) {
        return pOther->startCollisionSE(pId, pUserData, NULL);
    }
    if (53 < pUserData) {
        pUserData = 0;
    }
    for (JSULink<JAISe>* link =
                Z2GetSoundMgr()->getSeMgr()->getCategory(4)->getSeList()->getFirst();
                link != NULL; link = link->getNext()) {
        if (pId == link->getObject()->getID() && pUserData == link->getObject()->getUserData()) {
            link->getObject()->stop();
        }
    }
    Z2SoundHandlePool* handle = Z2SoundObjBase::startSound(JAISoundID(pId), pUserData, -1);
    if (handle != NULL && handle->getSound() != NULL) {
        handle->getSound()->setUserData(pUserData);
        if (30 <= pUserData && pUserData <= 52) {
            Z2Audible* audible = (Z2Audible*)handle->getSound()->getAudible();
            if (audible != NULL) {
                JAUAudibleParam* param = audible->getAudibleParam();
                param->field_0x0.bytes.b1_2_7 = 8;
            }
        }
    }
    return handle;
}

/* 802BE5A0-802BE5FC 2B8EE0 005C+00 1/1 0/0 0/0 .text            __ct__21Z2DopplerSoundObjBaseFv */
Z2DopplerSoundObjBase::Z2DopplerSoundObjBase() : Z2SoundObjBase() {
    field_0x20 = Z2Calc::cNullVec;
    field_0x2c = Z2Calc::cNullVec;
}

/* 802BE5FC-802BE65C 2B8F3C 0060+00 0/0 0/0 1/1 .text            __dt__21Z2DopplerSoundObjBaseFv */
Z2DopplerSoundObjBase::~Z2DopplerSoundObjBase() {}

/* 802BE65C-802BE6B8 2B8F9C 005C+00 1/0 0/0 0/0 .text init__21Z2DopplerSoundObjBaseFP3VecUc */
void Z2DopplerSoundObjBase::init(Vec* param_0, u8 param_1) {
    Z2SoundObjBase::init(param_0, param_1);
    if (mSoundPos != NULL) {
        // field_0x20 = *mSoundPos;
        JGeometry::setTVec3f(&mSoundPos->x, &field_0x20.x);
        // field_0x2c = *mSoundPos;
        JGeometry::setTVec3f(&mSoundPos->x, &field_0x2c.x);
    }
}

/* 802BE6B8-802BE714 2B8FF8 005C+00 2/0 0/0 0/0 .text framework__21Z2DopplerSoundObjBaseFUlSc */
void Z2DopplerSoundObjBase::framework(u32 param_0, s8 param_1) {
    Z2SoundObjBase::framework(param_0, param_1);
    if (mSoundPos != NULL) {
        // field_0x20 = field_0x2c;
        JGeometry::setTVec3f(&field_0x2c.x, &field_0x20.x);
        // field_0x2c = *mSoundPos;
        JGeometry::setTVec3f(&mSoundPos->x, &field_0x2c.x);
    }
}

/* 802BE714-802BE7AC 2B9054 0098+00 2/0 0/0 0/0 .text
 * startSound__21Z2DopplerSoundObjBaseF10JAISoundIDUlSc         */
Z2SoundHandlePool* Z2DopplerSoundObjBase::startSound(JAISoundID pSoundId, u32 param_1, s8 param_2) {
    JGeometry::TVec3<f32>* pos = mSoundPos;
    mSoundPos = NULL;
    Z2SoundHandlePool* handle = Z2SoundObjBase::startSound(pSoundId, param_1, param_2);
    if (pos != NULL && handle != NULL && handle->getSound() != NULL) {
        if (handle->getSound()->acceptsNewAudible()) {
            handle->getSound()->newAudible(*pos, &field_0x20, 0, NULL);
        }
    }
    mSoundPos = pos;
    return handle;
}

/* 802BE7AC-802BE844 2B90EC 0098+00 2/0 0/0 0/0 .text
 * startLevelSound__21Z2DopplerSoundObjBaseF10JAISoundIDUlSc    */
Z2SoundHandlePool* Z2DopplerSoundObjBase::startLevelSound(JAISoundID pSoundId,
                                                       u32 param_1, s8 param_2) {
    JGeometry::TVec3<f32>* pos = mSoundPos;
    mSoundPos = NULL;
    Z2SoundHandlePool* handle = Z2SoundObjBase::startLevelSound(pSoundId, param_1, param_2);
    if (pos != NULL && handle != NULL && handle->getSound() != NULL) {
        if (handle->getSound()->acceptsNewAudible()) {
            handle->getSound()->newAudible(*pos, &field_0x20, 0, NULL);
        }
    }
    mSoundPos = pos;
    return handle;
}

/* 802BE844-802BE880 2B9184 003C+00 0/0 8/8 65/65 .text            __ct__16Z2SoundObjSimpleFv */
Z2SoundObjSimple::Z2SoundObjSimple() : Z2SoundObjBase() {}

void Z2SoundObjSimple::init(Vec* pSoundPos, u8 pNumHandles) {
    Z2SoundObjBase::init(pSoundPos, pNumHandles);
}

/* 802BE8A0-802BE9B0 2B91E0 0110+00 1/0 0/0 0/0 .text
 * startSound__16Z2SoundObjSimpleF10JAISoundIDUlSc              */
Z2SoundHandlePool* Z2SoundObjSimple::startSound(JAISoundID pSoundId, u32 param_1, s8 param_2) {
    Z2SoundHandlePool* handle = Z2SoundObjBase::startSound(pSoundId, param_1, param_2);
    if (pSoundId == 0x200c7 && handle != NULL && handle->getSound() != NULL) {
        f32 local_0 = Z2Calc::getParamByExp((f32)param_1, 0.0f, 127.0f, 0.2f, 0.4f, 1.0f,
                                            Z2Calc::CURVE_SIGN_1);
        f32 local_1 = Z2Calc::getParamByExp((f32)param_1, 0.0f, 127.0f, 0.2f, 0.6f, 1.2f,
                                            Z2Calc::CURVE_SIGN_1);
        handle->getSound()->getAuxiliary().movePitch(local_1, 0);
        handle->getSound()->getAuxiliary().moveVolume(local_0, 0);
    }
    return handle;
}

/* 802BE9B0-802BEB38 2B92F0 0188+00 1/0 0/0 0/0 .text
 * startLevelSound__16Z2SoundObjSimpleF10JAISoundIDUlSc         */
Z2SoundHandlePool* Z2SoundObjSimple::startLevelSound(JAISoundID pSoundId, u32 param_1, s8 param_2) {
    Z2SoundHandlePool* handle = Z2SoundObjBase::startLevelSound(pSoundId, param_1, param_2);
    if (handle != NULL && handle->getSound() != NULL) {
        f32 local_0 = 1.0f;
        f32 local_1 = 1.0f;
        switch (pSoundId) {
            case 0x200c6:
                local_1 = Z2Calc::getParamByExp((f32)param_1, 0.0f, 127.0f, 0.2f, 0.4f, 1.0f,
                                                Z2Calc::CURVE_SIGN_1);
                local_0 = Z2Calc::getParamByExp((f32)param_1, 0.0f, 127.0f, 0.2f, 0.6f, 1.2f,
                                                Z2Calc::CURVE_SIGN_1);
                break;
            case 0x8025c:
                if (param_1 > 100) {
                    local_0 = 2.0f;
                } else if (param_1 > 21) {
                    local_0 = Z2Calc::getParamByExp((f32)param_1, 22.0f, 50.0f, 0.4f, 1.0f, 1.5f,
                                                    Z2Calc::CURVE_SIGN_0);
                }
                break;
        }
        handle->getSound()->getAuxiliary().movePitch(local_0, 0);
        handle->getSound()->getAuxiliary().moveVolume(local_1, 0);
    }
    return handle;
}

/* 802BEB38-802BEB74 2B9478 003C+00 0/0 0/0 2/2 .text            __ct__15Z2SoundObjArrowFv */
Z2SoundObjArrow::Z2SoundObjArrow() : Z2DopplerSoundObjBase() {}

/* 802BEB74-802BEB94 2B94B4 0020+00 1/0 0/0 0/0 .text            init__15Z2SoundObjArrowFP3VecUc */
void Z2SoundObjArrow::init(Vec* param_0, u8 param_1) {
    Z2SoundObjBase::init(param_0, param_1);
}

/* 802BEB94-802BEBDC 2B94D4 0048+00 0/0 2/2 0/0 .text            __ct__15Z2SoundObjAnimeFv */
Z2SoundObjAnime::Z2SoundObjAnime() : Z2SoundObjBase() {
    mpAnimation = NULL;
    mReverse = false;
}

/* 802BEBDC-802BEBFC 2B951C 0020+00 1/0 1/0 0/0 .text            init__15Z2SoundObjAnimeFP3VecUc */
void Z2SoundObjAnime::init(Vec* param_0, u8 param_1) {
    Z2SoundObjBase::init(param_0, param_1);
}

/* 802BEBFC-802BED68 2B953C 016C+00 0/0 2/2 0/0 .text            initAnime__15Z2SoundObjAnimeFPvbff
 */
void Z2SoundObjAnime::initAnime(void* param_0, bool param_1, f32 param_2, f32 param_3) {
    ageSounds_();
    mpAnimation = (JAUSoundAnimation*)param_0;
    if (mpAnimation != NULL) {
        mReverse = !param_1;
        field_0x3c = 0;
        if (mReverse) {
            mCurSoundIndex = mpAnimation->getNumSounds() - 1;
            mCurSoundFrame = FLT_MAX;
            setLoopFrame(0.0f, param_2);
        } else {
            mCurSoundIndex = 0;
            mCurSoundFrame = 0.0f;
            setLoopFrame(param_2, 0.0f);
        }
        mCurSoundFrame = param_3;
        mCurSoundIndex = mpAnimation->getStartSoundIndex(param_3);
        if (mReverse && mCurSoundIndex > 0) {
            mCurSoundIndex--;
        }
    }
}

/* 802BED68-802BEED4 2B96A8 016C+00 1/1 0/0 0/0 .text            ageSounds___15Z2SoundObjAnimeFv */
void Z2SoundObjAnime::ageSounds_() {
    for (int i = 0; i < getNumHandles(); i++) {
        if (getHandle(i)->getSound() != NULL) {
            switch (getHandle(i)->getSound()->getAnimationState()) {
                case 0:
                    break;
                case 1:
                    if (getHandle(i)->getSound()->hasLifeTime()) {
                        getHandle(i)->getSound()->stop();
                    } else {
                        JAUSoundAnimationSound* sound =
                            (JAUSoundAnimationSound*)getHandle(i)->getSound()->getUserData();
                        if (sound->stopsWhenAnimationChanges()) {
                            getHandle(i)->getSound()->stop();
                        } else {
                            getHandle(i)->getSound()->setAnimationState(2);
                        }
                    }
                    break;
                case 2:
                    break;
            }
        }
    }
}

/* 802BEED4-802BF304 2B9814 0430+00 0/0 2/2 0/0 .text            updateAnime__15Z2SoundObjAnimeFff
 */
void Z2SoundObjAnime::updateAnime(f32 param_0, f32 param_1) {
    for (int i = 0; i < getNumHandles(); i++) {
        if (getHandle(i)->getSound() != NULL && getHandle(i)->getSound()->isAnimated()) {
            getHandle(i)->getSound()->setPos(*mSoundPos);
        }
    }

    if (mpAnimation == NULL || mpAnimation->getNumSounds() == 0) {
        return;
    }

    if (!mReverse) {
        if (param_0 < mCurSoundFrame) {
            while (mCurSoundIndex < mEndSoundIndex) {
                startSoundInner(*mSoundPos, param_1, mSoundStarter, field_0x1c, field_0x1e);
            }
            mCurSoundIndex = mStartSoundIndex;
            mCurSoundFrame = param_0;
            if (field_0x3c < 0xffff) {
                field_0x3c++;
            }
        }
        updateSoundLifeTime_(param_0, param_1);
        while (mCurSoundIndex < mpAnimation->getNumSounds() &&
                    mpAnimation->getSound(mCurSoundIndex)->isNotingOn(param_0, false)) {
            startSoundInner(*mSoundPos, param_1, mSoundStarter, field_0x1c, field_0x1e);
        }
    } else {
        if (param_0 > mCurSoundFrame) {
            while (mCurSoundIndex >= mStartSoundIndex) {
                startSoundInner(*mSoundPos, param_1, mSoundStarter, field_0x1c, field_0x1e);
            }
            mCurSoundIndex = mEndSoundIndex - 1;
            mCurSoundFrame = param_0;
            if (field_0x3c < 0xffff) {
                field_0x3c++;
            }
        }
        updateSoundLifeTime_(param_0, param_1);
        while (mCurSoundIndex >= 0 &&
                    mpAnimation->getSound(mCurSoundIndex)->isNotingOn(param_0, true)) {
            startSoundInner(*mSoundPos, param_1, mSoundStarter, field_0x1c, field_0x1e);
        }
    }

    mCurSoundFrame = param_0;
}

/* 802BF304-802BF660 2B9C44 035C+00 1/1 0/0 0/0 .text updateSoundLifeTime___15Z2SoundObjAnimeFff
 */
void Z2SoundObjAnime::updateSoundLifeTime_(f32 param_0, f32 param_1) {
    if (mpAnimation == NULL) {
        return;
    }
    for (int i = 0; i < getNumHandles(); i++) {
        if (getHandle(i)->getSound() != NULL) {
            switch (getHandle(i)->getSound()->getAnimationState()) {
                case 0:
                    break;
                case 1:
                    JAUSoundAnimationSound* sound =
                        (JAUSoundAnimationSound*)getHandle(i)->getSound()->getUserData();
                    bool bvar1 = param_1 == 0.0f && sound->stopsWhenSpeedIsZero();
                    if (sound->setsLifeTime()) {
                        if (bvar1) {
                            getHandle(i)->getSound()->pause(true);
                        } else {
                            if (sound->isNoting(param_0)) {
                                getHandle(i)->getSound()->updateLifeTime(1);
                                getHandle(i)->getSound()->pause(false);
                            } else {
                                getHandle(i)->getSound()->stop();
                            }
                        }
                    } else {
                        if (bvar1) {
                            getHandle(i)->getSound()->stop();
                        } else if (sound->stopsWhenNoteOff() &&
                                   sound->isNotingOff(param_0, mReverse)) {
                            getHandle(i)->getSound()->stop();
                        }
                    }
                    break;
                case 2:
                    break;
            }
        }
    }
}

/* 802BF660-802BF890 2B9FA0 0230+00 1/1 0/0 0/0 .text
 * startSoundInner__15Z2SoundObjAnimeFRCQ29JGeometry8TVec3<f>fP14Z2SoundStarterUlSc */
void Z2SoundObjAnime::startSoundInner(JGeometry::TVec3<f32> const& param_0, f32 param_1,
                                      Z2SoundStarter* param_2, u32 param_3, s8 param_4) {
    const JAUSoundAnimationSound* sound = mpAnimation->getSound(mCurSoundIndex);
    u32 user_data = (u32)sound;
    if (mReverse) {
        mCurSoundIndex--;
    } else {
        mCurSoundIndex++;
    }
    if (sound->field_0x1a > 0) {
        param_3 = sound->field_0x1a;
    }
    if (playsSound(sound, param_0, param_1)) {
        u32 id = getSoundID(sound, param_0, param_1);
        if (!Z2GetSeMgr()->isSoundCulling(id)) {
            JAISoundHandle* handle = getHandleUserData(user_data);
            if (handle != NULL && handle->getSound() != NULL &&
                                  handle->getSound()->getAnimationState() != 1) {
                handle = NULL;
            }
            if (handle == NULL) {
                handle = getFreeHandle();
            }
            if (handle != NULL) {
                param_2->startSound(id, handle, &param_0, param_3, (f32)param_4 / 127.0f,
                                    sound->field_0x0c, (f32)sound->field_0x14 / 127.0f,
                                    -1.0f, -1.0f, 0);
                if (handle->getSound() != NULL) {
                    handle->getSound()->setAnimationState(1);
                    handle->getSound()->setUserData(user_data);
                    if (sound->setsLifeTime()) {
                        handle->getSound()->setLifeTime(1, false);
                    }
                }
            }
        }
    }
}

/* 802BF890-802BF898 2BA1D0 0008+00 1/1 0/0 0/0 .text
 * getSoundID__15Z2SoundObjAnimeFPC22JAUSoundAnimationSoundRCQ29JGeometry8TVec3<f>f */
u32 Z2SoundObjAnime::getSoundID(JAUSoundAnimationSound const* i_sound,
                                     JGeometry::TVec3<f32> const& param_1, f32 param_2) {
    return i_sound->mSoundId;
}

/* 802BF898-802BF920 2BA1D8 0088+00 1/1 0/0 0/0 .text
 * playsSound__15Z2SoundObjAnimeFPC22JAUSoundAnimationSoundRCQ29JGeometry8TVec3<f>f */
bool Z2SoundObjAnime::playsSound(JAUSoundAnimationSound const* i_sound,
                                 JGeometry::TVec3<f32> const& param_1, f32 param_2) {
    if (i_sound->playsOnlyOnce()) {
        if (field_0x3c != i_sound->field_0x16) {
            return false;
        }
    } else {
        if (i_sound->playsAtIntervals() &&
                    i_sound->field_0x16 != field_0x3c % i_sound->field_0x19) {
            return false;
        }
    }

    if (mReverse) {
        if (i_sound->playsOnlyForward()) {
            return false;
        }
    } else {
        if (i_sound->playsOnlyReverse()) {
            return false;
        }
    }

    return true;
}