diff --git a/config/ShieldD/symbols.txt b/config/ShieldD/symbols.txt index 8dd1951290..91a37aa732 100644 --- a/config/ShieldD/symbols.txt +++ b/config/ShieldD/symbols.txt @@ -64820,8 +64820,8 @@ sInstance__31JASGlobalInstance<10Z2EnvSeMgr> = .sbss:0x8074CDC0; // type:object lbl_8074CDC8 = .sbss:0x8074CDC8; // type:object size:0x1 data:byte hash:0x198E0249 dhash:0x5B608565 cNearFarRatio = .sbss:0x8074CDD0; // type:object size:0x4 scope:global align:4 data:float hash:0x3FC3124A lbl_8074CDD4 = .sbss:0x8074CDD4; // type:object size:0x1 data:byte hash:0x2FD5DAF8 dhash:0x9B6CD1E2 -lbl_8074CDD8 = .sbss:0x8074CDD8; // type:object size:0x1 data:byte hash:0xA31DF0B8 dhash:0x0646129E -lbl_8074CDD9 = .sbss:0x8074CDD9; // type:object size:0x1 data:byte hash:0xE4CA1432 dhash:0x0157E254 +data_80451358 = .sbss:0x8074CDD8; // type:object size:0x1 data:byte hash:0xA31DF0B8 dhash:0x0646129E +data_80451359 = .sbss:0x8074CDD9; // type:object size:0x1 data:byte hash:0xE4CA1432 dhash:0x0157E254 mLinkPtr__14Z2CreatureLink = .sbss:0x8074CDE0; // type:object size:0x4 scope:global data:4byte hash:0x696E3950 dhash:0xD016AAD5 mAudioMgrPtr__10Z2AudioMgr = .sbss:0x8074CDE8; // type:object size:0x4 scope:global data:4byte hash:0x54526A77 dhash:0x71D35736 lbl_8074CDF0 = .sbss:0x8074CDF0; // type:object size:0x1 data:byte hash:0xBB7CA6C8 diff --git a/src/Z2AudioLib/Z2Creature.cpp b/src/Z2AudioLib/Z2Creature.cpp index 14b0d31023..051e9a78e4 100644 --- a/src/Z2AudioLib/Z2Creature.cpp +++ b/src/Z2AudioLib/Z2Creature.cpp @@ -155,11 +155,12 @@ void Z2Creature::stopAnime() { } Z2SoundHandlePool* Z2Creature::startCreatureSound(JAISoundID soundID, u32 mapinfo, s8 reverb) { + Z2SoundHandlePool* handle; switch (soundID) { case Z2SE_KOSARU_V_KAGO_WAIT: return mSoundObjSimple1.startSound(soundID, mapinfo, 0); default: - Z2SoundHandlePool* handle = mSoundObjAnime.startSound(soundID, mapinfo, reverb); + handle = mSoundObjAnime.startSound(soundID, mapinfo, reverb); if (handle != NULL && *handle) { switch (soundID) { case Z2SE_FAIRY_S_FLY: @@ -176,12 +177,13 @@ Z2SoundHandlePool* Z2Creature::startCreatureSound(JAISoundID soundID, u32 mapinf } Z2SoundHandlePool* Z2Creature::startCreatureSoundLevel(JAISoundID soundID, u32 mapinfo, s8 reverb) { + Z2SoundHandlePool* handle; switch (soundID) { case Z2SE_FAIRY_S_LV: Z2GetAudioMgr()->seStartLevel(soundID, mpPos, 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0); return NULL; default: - Z2SoundHandlePool* handle = mSoundObjAnime.startLevelSound(soundID, mapinfo, reverb); + handle = mSoundObjAnime.startLevelSound(soundID, mapinfo, reverb); if (handle != NULL && *handle) { if (soundID == Z2SE_YM_SNOBO_RIDE || soundID == Z2SE_YW_SNOBO_RIDE) { f32 volume = 0.0f; @@ -242,7 +244,7 @@ Z2SoundHandlePool* Z2Creature::startCreatureVoiceLevel(JAISoundID soundID, s8 re } } - return mSoundObjSimple1.startLevelSound((u32)soundID, 0, reverb); + return mSoundObjSimple1.startLevelSound(soundID, 0, reverb); } Z2SoundHandlePool* Z2Creature::startCreatureExtraSound(JAISoundID soundID, u32 mapinfo, s8 reverb) { @@ -290,10 +292,10 @@ void Z2CreatureCitizen::setMdlType(s8 param_0, bool param_1, bool param_2) { if (param_0 == 0) { field_0xa1 = data_80451358; - data_80451358 = !data_80451358 ? 1 : 0; + data_80451358 = !data_80451358 ? (s8)1 : (s8)0; } else if (param_0 == 1) { field_0xa1 = data_80451359; - data_80451359 = !data_80451359 ? 1 : 0; + data_80451359 = !data_80451359 ? (s8)1 : (s8)0; } } @@ -445,8 +447,9 @@ Z2SoundHandlePool* Z2CreatureEnemy::startCreatureSoundLevel(JAISoundID soundID, switch (mEnemyID) { case Z2_ENEMY_FZ: + f32 volume; // force extra b instruction on debug by declaring this in the switch scope if (handle != NULL && *handle && soundID == Z2SE_EN_FZ_MOVE) { - f32 volume = Z2Calc::getParamByExp(mapinfo, 1.0f, 50.0f, 0.4f, 0.1f, 1.1f, + volume = Z2Calc::getParamByExp(mapinfo, 1.0f, 50.0f, 0.4f, 0.1f, 1.1f, Z2Calc::CURVE_POSITIVE); (*handle)->getAuxiliary().moveVolume(volume, 0); } @@ -599,7 +602,6 @@ Z2SoundHandlePool* Z2CreatureEnemy::startCreatureExtraSoundLevel(JAISoundID soun } Z2SoundHandlePool* Z2CreatureEnemy::startCollisionSE(u32 hitID, u32 mapinfo) { - u8 var1; switch (mEnemyID) { case Z2_ENEMY_WS: field_0xa3 = 1; @@ -627,7 +629,7 @@ Z2SoundHandlePool* Z2CreatureEnemy::startCollisionSE(u32 hitID, u32 mapinfo) { case 0x20: case 0x24: field_0xa3 = 1; - var1 = Z2Param::ENDING_BLOW_VOL_LOWER_TIME; + u8 var1 = Z2Param::ENDING_BLOW_VOL_LOWER_TIME; if (hitID == Z2SE_HIT_SWORD || hitID == Z2SE_HIT_SWORD_STAB || hitID == Z2SE_HIT_WOLFBITE) { var1 = 20; } @@ -715,7 +717,7 @@ void Z2SoundObjBeeGroup::playBeeGroupSound(JAISoundID soundID, u8 param_1) { break; } - Z2SoundHandlePool* handle1 = startLevelSound((u32)soundID, 0, -1); + Z2SoundHandlePool* handle1 = startLevelSound(soundID, 0, -1); Z2SoundHandlePool* handle2 = startLevelSound(sound_id2, 0, -1); if (handle1 != NULL && *handle1 != false) { @@ -782,18 +784,27 @@ Z2SoundHandlePool* Z2CreatureFM::startChainSound(JAISoundID soundID, u8 param_1, Z2SoundHandlePool* Z2CreatureFM::startChainSoundLevel(JAISoundID soundID, u8 param_1, f32 param_2, u32 mapinfo, s8 reverb) { - Z2SoundHandlePool* handle; f32 pitch; + f32 var_f30; + f32 var_f28; + f32 var_f27 = 0.7f; + f32 sp20 = 7.0f; + f32 sp1C = 5.0f; + var_f30 = 0.0f; + Z2SoundHandlePool* handle = NULL; switch (param_1) { case 0: handle = field_0xa4.startLevelSound(soundID, mapinfo, reverb); if (handle != NULL && *handle) { if (param_2 > 30.0f) { + var_f28 = 1.0f; pitch = 1.06f; } else { + var_f28 = (param_2 * 7.0f) / 100.0f; pitch = (param_2 * 5.0f) / 100.0f; } - pitch += Z2Calc::getRandom(0.03f, 1.0f, 0.5f) + 0.7f; + var_f30 = Z2Calc::getRandom(0.03f, 1.0f, 0.5f); + pitch += var_f27 + var_f30; if (pitch > 1.06f) { pitch = 1.06f; } @@ -805,11 +816,14 @@ Z2SoundHandlePool* Z2CreatureFM::startChainSoundLevel(JAISoundID soundID, u8 par handle = field_0xa4.startLevelSound(soundID, mapinfo, reverb); if (handle != NULL && *handle) { if (param_2 > 30.0f) { + var_f28 = 1.0f; pitch = 1.06f; } else { + var_f28 = (param_2 * 7.0f) / 100.0f; pitch = (param_2 * 5.0f) / 100.0f; } - pitch += Z2Calc::getRandom(0.03f, 1.0f, 0.5f) + 0.5f; + var_f30 = Z2Calc::getRandom(0.03f, 1.0f, 0.5f); + pitch += var_f27 - 0.2f + var_f30; if (pitch > 1.06f) { pitch = 1.06f; } @@ -821,9 +835,8 @@ Z2SoundHandlePool* Z2CreatureFM::startChainSoundLevel(JAISoundID soundID, u8 par return field_0xe4.startLevelSound(soundID, mapinfo, reverb); case 3: return field_0x104.startLevelSound(soundID, mapinfo, reverb); - default: - return NULL; } + return NULL; } void Z2CreatureGob::init(Vec* animePosPtr, Vec* simplePosPtr, Vec* simple2PosPtr, u8 animeHandleNum, u8 simpleHandleNum,