mirror of https://github.com/zeldaret/tp.git
540 lines
20 KiB
C++
540 lines
20 KiB
C++
//
|
|
// 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/JASGadget.h"
|
|
#include "JSystem/JAudio2/JAUSoundAnimator.h"
|
|
|
|
inline JAISoundID JAISound::getID() const {
|
|
return JAISoundID((u32)soundID);
|
|
}
|
|
|
|
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 p2) {
|
|
if (mIsInitialized) {
|
|
field_0x1c = p1;
|
|
field_0x1e = p2;
|
|
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 */
|
|
JAISoundHandle* 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;
|
|
JAISoundHandle* 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 */
|
|
JAISoundHandle* 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;
|
|
JAISoundHandle* 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 */
|
|
JAISoundHandle* 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();
|
|
}
|
|
}
|
|
JAISoundHandle* 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;
|
|
}
|
|
|
|
/* ############################################################################################## */
|
|
/* 8039C230-8039C240 028890 000C+04 1/1 0/0 0/0 .rodata cNullVec__6Z2Calc */
|
|
static Vec const cNullVec__6Z2Calc = {0.0f, 0.0f, 0.0f};
|
|
|
|
/* 802BE5A0-802BE5FC 2B8EE0 005C+00 1/1 0/0 0/0 .text __ct__21Z2DopplerSoundObjBaseFv */
|
|
Z2DopplerSoundObjBase::Z2DopplerSoundObjBase() : Z2SoundObjBase() {
|
|
field_0x20 = cNullVec__6Z2Calc;
|
|
field_0x2c = cNullVec__6Z2Calc;
|
|
}
|
|
|
|
/* 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 */
|
|
JAISoundHandle* Z2DopplerSoundObjBase::startSound(JAISoundID pSoundId, u32 param_1, s8 param_2) {
|
|
JGeometry::TVec3<f32>* pos = mSoundPos;
|
|
mSoundPos = NULL;
|
|
JAISoundHandle* 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 */
|
|
JAISoundHandle* Z2DopplerSoundObjBase::startLevelSound(JAISoundID pSoundId,
|
|
u32 param_1, s8 param_2) {
|
|
JGeometry::TVec3<f32>* pos = mSoundPos;
|
|
mSoundPos = NULL;
|
|
JAISoundHandle* 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 */
|
|
JAISoundHandle* Z2SoundObjSimple::startSound(JAISoundID pSoundId, u32 param_1, s8 param_2) {
|
|
JAISoundHandle* 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 */
|
|
JAISoundHandle* Z2SoundObjSimple::startLevelSound(JAISoundID pSoundId, u32 param_1, s8 param_2) {
|
|
JAISoundHandle* 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, ¶m_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;
|
|
}
|