diff options
| -rw-r--r-- | configure.py | 2 | ||||
| -rw-r--r-- | include/d/snd/d_snd_source_enemy.h | 4 | ||||
| -rw-r--r-- | src/d/snd/d_snd_rng.cpp | 19 | ||||
| -rw-r--r-- | src/d/snd/d_snd_source_enemy.cpp | 31 |
4 files changed, 35 insertions, 21 deletions
diff --git a/configure.py b/configure.py index 332b7d83..ddfc87ec 100644 --- a/configure.py +++ b/configure.py @@ -832,7 +832,7 @@ config.libs = [ Object(Matching, "d/snd/d_snd_rng_link_voice.cpp"), Object(NonMatching, "d/snd/d_snd_fi_vocal_mgr.cpp"), Object(NonMatching, "d/snd/d_snd_data.cpp"), - Object(NonMatching, "d/snd/d_snd_rng.cpp"), + Object(Matching, "d/snd/d_snd_rng.cpp"), Object(Matching, "d/snd/d_snd_rng_mgr.cpp"), Object(Matching, "d/snd/d_snd_rng_id.cpp"), Object(Matching, "d/snd/d_snd_rng_id_if.cpp"), diff --git a/include/d/snd/d_snd_source_enemy.h b/include/d/snd/d_snd_source_enemy.h index 8088765d..4277b7c4 100644 --- a/include/d/snd/d_snd_source_enemy.h +++ b/include/d/snd/d_snd_source_enemy.h @@ -30,13 +30,15 @@ public: return specializeBgHitSoundId(soundId, mPolyAttr0, mPolyAttr1); } +protected: + void unregisterEnemySource(); + private: // Probably not a problem for weak function order since getName is emitted // earlier through an explicit call bool isName(const char *name) const { return streq(name, getName()); } - void unregisterEnemySource(); /* 0x15C */ nw4r::ut::Node mMgrEnemyLink; /* 0x164 */ UNKWORD field_0x164; diff --git a/src/d/snd/d_snd_rng.cpp b/src/d/snd/d_snd_rng.cpp index b1a5994e..96f2f44b 100644 --- a/src/d/snd/d_snd_rng.cpp +++ b/src/d/snd/d_snd_rng.cpp @@ -13,23 +13,8 @@ void dSndRng_c::init() { } u32 dSndRng_c::rndInt(s32 max) { - // TODO - return 0; -/* - s32 temp_r0; - s32 temp_r11; - - temp_r11 = this->unkC; - this->unkC = (temp_r11 * 0xB2E3D431) + 0x508EBD; - temp_r0 = MULTU_HI(temp_r11, 0xB2E3D431) + (this->unk8 * 0xB2E3D431) + (temp_r11 * 0x690379B2) + M2C_CARRY; - this->unk8 = temp_r0; - return MULTU_HI(temp_r0, arg0) + (0 * arg0); -=> - - lo_1 = (lo_0 * 0xB2E3D431) + 0x508EBD; - hi_1 = MULTU_HI(lo_0, 0xB2E3D431) + (hi_0 * 0xB2E3D431) + (lo_0 * 0x690379B2) + M2C_CARRY; - return MULTU_HI(hi_1, arg0) + (0 * arg0); -*/ + field_0x08 = field_0x08 * 0x690379B2B2E3D431ULL + 0x508EBD; + return (u32)(((u64)(field_0x08 >> 32) * (u64)(u32)max) >> 32); } bool dSndRng_c::rndBool(s32 chance) { diff --git a/src/d/snd/d_snd_source_enemy.cpp b/src/d/snd/d_snd_source_enemy.cpp index 2b4c703d..37b54a1e 100644 --- a/src/d/snd/d_snd_source_enemy.cpp +++ b/src/d/snd/d_snd_source_enemy.cpp @@ -123,12 +123,39 @@ u32 dSndSourceEnemy_c::overrideHoldSoundId(u32 soundId, bool initial) { } u32 dSndSourceEnemyAnim_c::overrideStartSoundId(u32 soundId) { - // TODO + switch (mSourceType) { + case SND_SOURCE_MAGUPPO: + if (mSubtype == 1) { + switch (soundId) { + case SE_EMagupp_APPEAR: soundId = SE_EMagupp_APPEAR_SAND; break; + case SE_EMagupp_DISAPPEAR: soundId = SE_EMagupp_DISAPPEAR_SAND; break; + case SE_EMagupp_WATER0: soundId = SE_EMagupp_WATER0_SAND; break; + case SE_EMagupp_SWIM: soundId = SE_EMagupp_SWIM_SAND; break; + case SE_EMagupp_BLOWNUP_LV: soundId = SE_EMagupp_BLOWNUP_LV_SAND; break; + } + } + break; + case SND_SOURCE_LIZARUFOS: + if (mSubtype == 0 && soundId == SE_ELizaru_FIRE_LV) { + soundId = SE_ELizaru_FIRE_LV_MA; + } + if (soundId == SE_E_DISAPPEAR) { + unregisterEnemySource(); + } + break; + case SND_SOURCE_BC_Z: + if (soundId == SE_E_DISAPPEAR) { + unregisterEnemySource(); + } + break; + } return soundId; } u32 dSndSourceEnemyAnim_c::overrideHoldSoundId(u32 soundId, bool initial) { - // TODO + if (mSourceType == SND_SOURCE_MAGUPPO && mSubtype == 1 && soundId == SE_EMagupp_BLOWNUP_LV) { + soundId = SE_EMagupp_BLOWNUP_LV_SAND; + } return soundId; } |
