diff --git a/.clangd b/.clangd index 93bb9851738..0b01309a9ea 100644 --- a/.clangd +++ b/.clangd @@ -3,6 +3,7 @@ CompileFlags: Diagnostics: Suppress: - "warn_char_constant_too_large" + - "illegal_union_or_anon_struct_member" --- If: PathMatch: .*/*.inc diff --git a/config/GZ2E01/splits.txt b/config/GZ2E01/splits.txt index da4102553b6..b9268eb6160 100644 --- a/config/GZ2E01/splits.txt +++ b/config/GZ2E01/splits.txt @@ -2067,7 +2067,7 @@ JSystem/JAudio2/osdsp.cpp: JSystem/JAudio2/osdsp_task.cpp: .text start:0x8029EB20 end:0x8029EFAC .bss start:0x80434060 end:0x80434078 - .sbss start:0x80451308 end:0x80451330 + .sbss start:0x80451308 end:0x80451310 JSystem/JAudio2/JAIAudible.cpp: .text start:0x8029EFAC end:0x8029EFF4 @@ -2087,6 +2087,7 @@ JSystem/JAudio2/JAISeMgr.cpp: .rodata start:0x8039B8F8 end:0x8039B910 .data start:0x803C98B0 end:0x803C98D8 .bss start:0x80434078 end:0x80434098 + .sbss start:0x80451310 end:0x80451320 .sdata2 start:0x80455788 end:0x80455798 JSystem/JAudio2/JAISeq.cpp: @@ -2103,6 +2104,7 @@ JSystem/JAudio2/JAISeqMgr.cpp: .text start:0x802A1804 end:0x802A2184 .data start:0x803C9958 end:0x803C9970 .bss start:0x804340C0 end:0x804340E0 + .sbss start:0x80451320 end:0x80451328 .sdata2 start:0x804557A8 end:0x804557B8 JSystem/JAudio2/JAISound.cpp: @@ -2143,6 +2145,7 @@ JSystem/JAudio2/JAIStreamDataMgr.cpp: JSystem/JAudio2/JAIStreamMgr.cpp: .text start:0x802A3B68 end:0x802A4244 .bss start:0x804340F0 end:0x80434110 + .sbss start:0x80451328 end:0x80451330 .sdata2 start:0x80455800 end:0x80455810 JSystem/JAudio2/JAUAudioArcInterpreter.cpp: @@ -2216,7 +2219,7 @@ Z2AudioLib/Z2Calc.cpp: Z2AudioLib/Z2Param.cpp: .sdata start:0x804507D8 end:0x80450870 - .sbss start:0x80451338 end:0x80451350 + .sbss start:0x80451338 end:0x80451348 Z2AudioLib/Z2AudioArcLoader.cpp: .text start:0x802A9A34 end:0x802A9B58 @@ -2238,6 +2241,7 @@ Z2AudioLib/Z2SoundStarter.cpp: Z2AudioLib/Z2SoundHandles.cpp: .text start:0x802AB07C end:0x802AB64C .bss start:0x804341B8 end:0x804341D8 + .sbss start:0x80451348 end:0x80451350 Z2AudioLib/Z2SeMgr.cpp: .text start:0x802AB64C end:0x802AEEA0 diff --git a/config/GZ2E01/symbols.txt b/config/GZ2E01/symbols.txt index 0a3d60988c7..ae78591daff 100644 --- a/config/GZ2E01/symbols.txt +++ b/config/GZ2E01/symbols.txt @@ -21177,10 +21177,10 @@ memPool_$localstatic3$getMemPool___26JASPoolAllocObject<5JAISe>Fv = .bss:0x80434 @896 = .bss:0x804340A4; // type:object size:0xC scope:local align:4 memPool_$localstatic3$getMemPool___35JASPoolAllocObject<13JAISoundChild>Fv = .bss:0x804340B0; // type:object size:0x10 scope:local align:4 @715 = .bss:0x804340C0; // type:object size:0xC scope:local align:4 -memPool_$localstatic3$getMemPool___27JASPoolAllocObject<6JAISeq>Fv = .bss:0x804340CC; // type:object size:0x10 scope:local align:4 +memPool_$localstatic3$getMemPool___27JASPoolAllocObject<6JAISeq>Fv = .bss:0x804340CC; // type:object size:0x10 scope:weak align:4 @881 = .bss:0x804340E0; // type:object size:0xC scope:local align:4 @745 = .bss:0x804340F0; // type:object size:0xC scope:local align:4 -memPool_$localstatic3$getMemPool___30JASPoolAllocObject<9JAIStream>Fv = .bss:0x804340FC; // type:object size:0x10 scope:local align:4 +memPool_$localstatic3$getMemPool___30JASPoolAllocObject<9JAIStream>Fv = .bss:0x804340FC; // type:object size:0x10 scope:weak align:4 ...bss.0 = .bss:0x80434110; // type:label scope:local @757 = .bss:0x80434110; // type:object size:0xC scope:local align:4 @763 = .bss:0x8043411C; // type:object size:0xC scope:local align:4 @@ -21189,7 +21189,7 @@ memPool_$localstatic3$getMemPool___30JASPoolAllocObject<9JAIStream>Fv = .bss:0x8 @863 = .bss:0x80434140; // type:object size:0xC scope:local align:4 @867 = .bss:0x8043414C; // type:object size:0xC scope:local align:4 @632 = .bss:0x804341B8; // type:object size:0xC scope:local align:4 -memPool_$localstatic3$getMemPool___39JASPoolAllocObject<17Z2SoundHandlePool>Fv = .bss:0x804341C4; // type:object size:0x10 scope:local align:4 +memPool_$localstatic3$getMemPool___39JASPoolAllocObject<17Z2SoundHandlePool>Fv = .bss:0x804341C4; // type:object size:0x10 scope:weak align:4 @1539 = .bss:0x804341D8; // type:object size:0xC scope:local align:4 memPool_$localstatic3$getMemPool___30JASPoolAllocObject<9Z2Audible>Fv = .bss:0x804341E4; // type:object size:0x10 scope:local align:4 ...bss.0 = .bss:0x804341F8; // type:label scope:local @@ -21509,7 +21509,7 @@ sStickHigh = .sdata:0x80450898; // type:object size:0x4 scope:global align:4 dat sStickCenter = .sdata:0x8045089C; // type:object size:0x4 scope:global align:4 data:float sHowlTobikusa = .sdata:0x804508A0; // type:object size:0x8 scope:global align:4 cm2hw$539 = .sdata:0x804508A8; // type:object size:0x4 scope:local align:4 -data_804508B0 = .sdata:0x804508B0; // type:object size:0x8 scope:global align:4 data:byte +data_804508B0 = .sdata:0x804508B0; // type:object size:0x1 scope:global align:4 data:byte sSZSBufferSize__7JKRAram = .sdata:0x804508B8; // type:object size:0x4 scope:global align:4 data:4byte rootPath$2498 = .sdata:0x804508C0; // type:object size:0x2 scope:local align:4 data:string errorRetry = .sdata:0x804508C8; // type:object size:0x1 scope:local align:1 data:byte @@ -22087,8 +22087,8 @@ struct_80451309 = .sbss:0x80451309; // type:object size:0x1 scope:local align:1 DSP_prior_task = .sbss:0x8045130C; // type:object size:0x4 scope:global align:4 data:4byte data_80451310 = .sbss:0x80451310; // type:object size:0x8 scope:global align:4 data:byte data_80451318 = .sbss:0x80451318; // type:object size:0x8 scope:global align:4 data:byte -data_80451320 = .sbss:0x80451320; // type:object size:0x8 scope:global align:4 data:byte -data_80451328 = .sbss:0x80451328; // type:object size:0x8 scope:global align:4 data:byte +init$localstatic4$getMemPool___27JASPoolAllocObject<6JAISeq>Fv = .sbss:0x80451320; // type:object size:0x1 scope:global align:1 data:byte +init$localstatic4$getMemPool___30JASPoolAllocObject<9JAIStream>Fv = .sbss:0x80451328; // type:object size:0x1 scope:global align:1 data:byte init$80 = .sbss:0x80451330; // type:object size:0x1 scope:local align:1 data:byte oRandom$401 = .sbss:0x80451334; // type:object size:0x4 scope:local align:4 data:4byte MIN_DISTANCE_VOLUME__7Z2Param = .sbss:0x80451338; // type:object size:0x4 scope:global align:4 data:float @@ -22097,7 +22097,7 @@ struct_80451340 = .sbss:0x80451340; // type:object size:0x1 scope:global align:1 struct_80451341 = .sbss:0x80451341; // type:object size:0x1 scope:global align:1 data:byte struct_80451342 = .sbss:0x80451342; // type:object size:0x1 scope:global align:1 data:byte pad_80451344 = .sbss:0x80451344; // type:object size:0x4 scope:global align:4 -data_80451348 = .sbss:0x80451348; // type:object size:0x8 scope:global align:4 data:byte +init$localstatic4$getMemPool___39JASPoolAllocObject<17Z2SoundHandlePool>Fv = .sbss:0x80451348; // type:object size:0x1 scope:global align:1 data:byte cNearFarRatio = .sbss:0x80451350; // type:object size:0x4 scope:local align:4 data:float data_80451354 = .sbss:0x80451354; // type:object size:0x4 scope:global align:4 data:byte data_80451358 = .sbss:0x80451358; // type:object size:0x1 scope:global align:1 data:byte diff --git a/configure.py b/configure.py index ba73ea260ec..72782adb7c3 100755 --- a/configure.py +++ b/configure.py @@ -823,7 +823,7 @@ config.libs = [ Object(MatchingFor("GZ2E01"), "JSystem/JAudio2/JASProbe.cpp"), Object(MatchingFor("GZ2E01"), "JSystem/JAudio2/JASReport.cpp"), Object(MatchingFor("GZ2E01"), "JSystem/JAudio2/JASCmdStack.cpp"), - Object(NonMatching, "JSystem/JAudio2/JASTrack.cpp"), + Object(NonMatching, "JSystem/JAudio2/JASTrack.cpp", extra_cflags=['-pragma "nosyminline off"']), Object(MatchingFor("GZ2E01"), "JSystem/JAudio2/JASTrackPort.cpp"), Object(MatchingFor("GZ2E01"), "JSystem/JAudio2/JASRegisterParam.cpp"), Object(MatchingFor("GZ2E01"), "JSystem/JAudio2/JASSeqCtrl.cpp"), @@ -840,7 +840,7 @@ config.libs = [ Object(MatchingFor("GZ2E01"), "JSystem/JAudio2/JASWSParser.cpp"), Object(NonMatching, "JSystem/JAudio2/JASBNKParser.cpp"), Object(MatchingFor("GZ2E01"), "JSystem/JAudio2/JASWaveArcLoader.cpp", extra_cflags=['-pragma "nosyminline off"']), - Object(NonMatching, "JSystem/JAudio2/JASChannel.cpp", extra_cflags=['-pragma "nosyminline off"']), + Object(Equivalent, "JSystem/JAudio2/JASChannel.cpp", extra_cflags=['-pragma "nosyminline off"']), # bss locations Object(MatchingFor("GZ2E01"), "JSystem/JAudio2/JASLfo.cpp"), Object(MatchingFor("GZ2E01"), "JSystem/JAudio2/JASOscillator.cpp"), Object(NonMatching, "JSystem/JAudio2/JASAiCtrl.cpp"), @@ -857,25 +857,25 @@ config.libs = [ Object(MatchingFor("GZ2E01"), "JSystem/JAudio2/JAIAudible.cpp"), Object(MatchingFor("GZ2E01"), "JSystem/JAudio2/JAIAudience.cpp"), Object(MatchingFor("GZ2E01"), "JSystem/JAudio2/JAISe.cpp"), - Object(NonMatching, "JSystem/JAudio2/JAISeMgr.cpp"), - Object(NonMatching, "JSystem/JAudio2/JAISeq.cpp"), + Object(Equivalent, "JSystem/JAudio2/JAISeMgr.cpp", extra_cflags=['-pragma "nosyminline off"']), # weak function order + Object(Equivalent, "JSystem/JAudio2/JAISeq.cpp", extra_cflags=['-pragma "nosyminline off"']), # bss locations Object(MatchingFor("GZ2E01"), "JSystem/JAudio2/JAISeqDataMgr.cpp"), - Object(NonMatching, "JSystem/JAudio2/JAISeqMgr.cpp"), + Object(MatchingFor("GZ2E01"), "JSystem/JAudio2/JAISeqMgr.cpp", extra_cflags=['-pragma "nosyminline off"']), Object(MatchingFor("GZ2E01"), "JSystem/JAudio2/JAISound.cpp"), Object(MatchingFor("GZ2E01"), "JSystem/JAudio2/JAISoundChild.cpp"), Object(MatchingFor("GZ2E01"), "JSystem/JAudio2/JAISoundHandles.cpp"), Object(MatchingFor("GZ2E01"), "JSystem/JAudio2/JAISoundInfo.cpp"), Object(MatchingFor("GZ2E01"), "JSystem/JAudio2/JAISoundParams.cpp"), Object(MatchingFor("GZ2E01"), "JSystem/JAudio2/JAISoundStarter.cpp"), - Object(NonMatching, "JSystem/JAudio2/JAIStream.cpp", extra_cflags=["-sym off"]), + Object(Equivalent, "JSystem/JAudio2/JAIStream.cpp", extra_cflags=['-pragma "nosyminline off"']), # bss locations Object(MatchingFor("GZ2E01"), "JSystem/JAudio2/JAIStreamDataMgr.cpp"), - Object(NonMatching, "JSystem/JAudio2/JAIStreamMgr.cpp"), + Object(MatchingFor("GZ2E01"), "JSystem/JAudio2/JAIStreamMgr.cpp", extra_cflags=['-pragma "nosyminline off"']), Object(MatchingFor("GZ2E01"), "JSystem/JAudio2/JAUAudioArcInterpreter.cpp"), Object(MatchingFor("GZ2E01"), "JSystem/JAudio2/JAUAudioArcLoader.cpp"), Object(MatchingFor("GZ2E01"), "JSystem/JAudio2/JAUAudioMgr.cpp"), Object(MatchingFor("GZ2E01"), "JSystem/JAudio2/JAUBankTable.cpp"), Object(MatchingFor("GZ2E01"), "JSystem/JAudio2/JAUClusterSound.cpp"), - Object(NonMatching, "JSystem/JAudio2/JAUInitializer.cpp"), + Object(Equivalent, "JSystem/JAudio2/JAUInitializer.cpp", extra_cflags=['-pragma "nosyminline off"']), # bss locations Object(NonMatching, "JSystem/JAudio2/JAUSectionHeap.cpp"), Object(MatchingFor("GZ2E01"), "JSystem/JAudio2/JAUSeqCollection.cpp"), Object(MatchingFor("GZ2E01"), "JSystem/JAudio2/JAUSeqDataBlockMgr.cpp"), @@ -902,12 +902,12 @@ config.libs = [ "host": True, "objects": [ Object(MatchingFor("GZ2E01"), "Z2AudioLib/Z2Calc.cpp"), - Object(NonMatching, "Z2AudioLib/Z2AudioArcLoader.cpp"), + Object(MatchingFor("GZ2E01"), "Z2AudioLib/Z2AudioArcLoader.cpp"), Object(MatchingFor("GZ2E01"), "Z2AudioLib/Z2Param.cpp"), Object(MatchingFor("GZ2E01"), "Z2AudioLib/Z2SoundMgr.cpp"), Object(MatchingFor("GZ2E01"), "Z2AudioLib/Z2SoundStarter.cpp"), - Object(NonMatching, "Z2AudioLib/Z2SoundHandles.cpp"), - Object(NonMatching, "Z2AudioLib/Z2SeMgr.cpp"), + Object(MatchingFor("GZ2E01"), "Z2AudioLib/Z2SoundHandles.cpp"), + Object(MatchingFor("GZ2E01"), "Z2AudioLib/Z2SeMgr.cpp"), Object(NonMatching, "Z2AudioLib/Z2SeqMgr.cpp"), Object(MatchingFor("GZ2E01"), "Z2AudioLib/Z2StatusMgr.cpp"), Object(NonMatching, "Z2AudioLib/Z2SceneMgr.cpp"), @@ -917,7 +917,7 @@ config.libs = [ Object(MatchingFor("GZ2E01"), "Z2AudioLib/Z2SoundObject.cpp"), Object(MatchingFor("GZ2E01"), "Z2AudioLib/Z2SoundObjMgr.cpp"), Object(MatchingFor("GZ2E01"), "Z2AudioLib/Z2Creature.cpp"), - Object(NonMatching, "Z2AudioLib/Z2LinkMgr.cpp"), + Object(NonMatching, "Z2AudioLib/Z2LinkMgr.cpp", extra_cflags=['-pragma "nosyminline on"']), Object(NonMatching, "Z2AudioLib/Z2EnvSeMgr.cpp"), Object(MatchingFor("GZ2E01"), "Z2AudioLib/Z2WolfHowlMgr.cpp"), Object(NonMatching, "Z2AudioLib/Z2SpeechMgr2.cpp"), diff --git a/include/JSystem/JAudio2/JAISeMgr.h b/include/JSystem/JAudio2/JAISeMgr.h index 45a6f388a99..147218e8981 100644 --- a/include/JSystem/JAudio2/JAISeMgr.h +++ b/include/JSystem/JAudio2/JAISeMgr.h @@ -49,7 +49,12 @@ public: /* 8029FE78 */ void stopSoundID(JAISoundID); /* 8029FEEC */ void pause(bool); /* 8029FF18 */ void JAISeMgr_mixOut_(JAISoundParamsMove const&, JAISoundActivity); - /* 802A0994 */ JAISeCategoryMgr(); + /* 802A0994 */ JAISeCategoryMgr() { + mParams.init(); + mMaxActiveSe = 0; + mMaxInactiveSe = 0; + field_0x4.field_0x0 = 0; + } /* 800078DC */ virtual ~JAISeCategoryMgr() {} /* 8029F8B0 */ virtual bool isUsingSeqData(JAISeqDataRegion const&); diff --git a/include/JSystem/JAudio2/JASHeapCtrl.h b/include/JSystem/JAudio2/JASHeapCtrl.h index a2bd2d056a5..18a5a627d86 100644 --- a/include/JSystem/JAudio2/JASHeapCtrl.h +++ b/include/JSystem/JAudio2/JASHeapCtrl.h @@ -241,23 +241,23 @@ template class JASPoolAllocObject { public: static void* operator new(size_t n) { - JASMemPool* memPool = getMemPool(); + JASMemPool* memPool = getMemPool_(); return memPool->alloc(sizeof(T)); } static void* operator new(size_t n, void* ptr) { return ptr; } static void operator delete(void* ptr, size_t n) { - JASMemPool* memPool_ = getMemPool(); + JASMemPool* memPool_ = getMemPool_(); memPool_->free(ptr, sizeof(T)); } static void newMemPool(int param_0) { - JASMemPool* memPool_ = getMemPool(); + JASMemPool* memPool_ = getMemPool_(); memPool_->newMemPool(param_0); } private: - static JASMemPool* getMemPool() { + static JASMemPool* getMemPool_() { static JASMemPool memPool_; return &memPool_; } diff --git a/include/JSystem/JAudio2/JASTrack.h b/include/JSystem/JAudio2/JASTrack.h index 71a6b9a89b8..8afadf3e2e1 100644 --- a/include/JSystem/JAudio2/JASTrack.h +++ b/include/JSystem/JAudio2/JASTrack.h @@ -169,7 +169,17 @@ struct JASTrack : public JASPoolAllocObject_MultiThreaded { /* 0x000 */ JASSeqCtrl mSeqCtrl; /* 0x05C */ JASTrackPort mTrackPort; /* 0x080 */ JASRegisterParam mRegisterParam; - /* 0x09C */ MoveParam_ mMoveParam[6]; // volume, pitch, fxmix, pan, dolby, distFilter + /* 0x09C */ union { + struct { + MoveParam_ volume; + MoveParam_ pitch; + MoveParam_ fxmix; + MoveParam_ pan; + MoveParam_ dolby; + MoveParam_ distFilter; + } params; + MoveParam_ array[6]; + } mMoveParam; /* 0x0e4 */ JASOscillator::Data mOscParam[2]; /* 0x114 */ JASOscillator::Point mOscPoint[4]; /* 0x12C */ JASTrack* mParent; diff --git a/include/JSystem/JGadget/linklist.h b/include/JSystem/JGadget/linklist.h index 5d0575f0dbf..a64c92733f6 100644 --- a/include/JSystem/JGadget/linklist.h +++ b/include/JSystem/JGadget/linklist.h @@ -22,7 +22,9 @@ public: struct TNodeLinkList { struct iterator { + iterator() { node = NULL; } explicit iterator(TLinkListNode* pNode) { node = pNode; } + iterator& operator=(const iterator& other) { node = other.node; return *this; } iterator& operator++() { node = node->getNext(); return *this; } iterator& operator--() { node = node->getPrev(); return *this; } @@ -117,6 +119,7 @@ struct TLinkList : public TNodeLinkList { TLinkList() : TNodeLinkList() {} struct iterator { + iterator() {} explicit iterator(TNodeLinkList::iterator iter) : base(iter) {} iterator& operator++() { diff --git a/include/JSystem/JKernel/JKRArchive.h b/include/JSystem/JKernel/JKRArchive.h index 86532e4045c..3b6a5959d71 100644 --- a/include/JSystem/JKernel/JKRArchive.h +++ b/include/JSystem/JKernel/JKRArchive.h @@ -238,6 +238,11 @@ inline bool JKRRemoveResource(void* resource, JKRFileLoader* fileLoader) { return JKRFileLoader::removeResource(resource, fileLoader); } +inline JKRArchive* JKRMountArchive(void* ptr, JKRHeap* heap, + JKRArchive::EMountDirection mountDirection) { + return JKRArchive::mount(ptr, heap, mountDirection); +} + inline void JKRUnmountArchive(JKRArchive* arc) { arc->unmount(); } @@ -246,4 +251,4 @@ inline void JKRReadIdxResource(void* param_1, u32 param_2, u32 param_3, JKRArchi param_4->readIdxResource(param_1, param_2, param_3); } -#endif \ No newline at end of file +#endif diff --git a/include/JSystem/JMath/JMath.h b/include/JSystem/JMath/JMath.h index 2c4cd35b29e..8298d44481a 100644 --- a/include/JSystem/JMath/JMath.h +++ b/include/JSystem/JMath/JMath.h @@ -12,7 +12,7 @@ void JMAVECScaleAdd(register const Vec* vec1, register const Vec* vec2, register register f32 scale); inline int JMAAbs(int value) { - return (value >> 0x1f ^ value) - (value >> 0x1f); + return value > 0 ? value : -value; } inline f32 JMAFastReciprocal(f32 value) { diff --git a/include/JSystem/JMath/random.h b/include/JSystem/JMath/random.h index c6794aaaede..4b4babb2f79 100644 --- a/include/JSystem/JMath/random.h +++ b/include/JSystem/JMath/random.h @@ -20,7 +20,7 @@ struct TRandom_fast_ { u32 get_bit32(void) { return this->get(); } - s8 get_uint8(u8 param_0) { + u8 get_uint8(u8 param_0) { return get_ufloat_1() * param_0; } diff --git a/include/Z2AudioLib/Z2Creature.h b/include/Z2AudioLib/Z2Creature.h index 54e26ddad02..d71a4e3e989 100644 --- a/include/Z2AudioLib/Z2Creature.h +++ b/include/Z2AudioLib/Z2Creature.h @@ -1,7 +1,6 @@ #ifndef Z2CREATURE_H #define Z2CREATURE_H -#include "SSystem/SComponent/c_xyz.h" #include "Z2AudioLib/Z2SoundObject.h" #include "Z2AudioLib/Z2SoundStarter.h" @@ -35,122 +34,6 @@ public: /* 0x70 */ Z2SoundObjSimple mSoundObjSimple2; }; // Size: 0x90 -struct Z2LinkSoundStarter : public Z2SoundStarter { - Z2LinkSoundStarter(); - - inline virtual ~Z2LinkSoundStarter(); - virtual bool startSound(JAISoundID, JAISoundHandle*, JGeometry::TVec3 const*, u32, f32, - f32, f32, f32, f32, u32); -}; - -class Z2CreatureLink : public Z2Creature, public Z2LinkSoundStarter { -public: - Z2CreatureLink(); - ~Z2CreatureLink(); - - void setLinkState(u8); - void setLinkGroupInfo(u8); - void setLinkHp(s32, s32); - void setLinkSwordType(s32, s32); - void setLinkShieldType(s32, s32); - void setLinkBootsType(s32); - virtual void deleteObject(); - void init(Vec*, Vec*, Vec*); - void initKantera(Vec*); - void deleteKantera(void); - void setKanteraState(u8); - virtual void framework(u32, s8); - void setSinkDepth(s8); - void setRiding(bool); - void setMagnetized(bool); - void setWolfEyeOpen(bool); - Z2SoundHandlePool* startLinkSound(JAISoundID, u32, s8); - JAISoundHandle* startLinkSoundLevel(JAISoundID, u32, s8); - void startLinkVoice(JAISoundID, s8); - void startLinkVoiceLevel(JAISoundID, s8); - void startLinkSwordSound(JAISoundID, u32, s8); - virtual Z2SoundHandlePool* startCollisionSE(u32, u32); - int startHitItemSE(u32, u32, Z2SoundObjBase*, float); - void setResumeAttack(bool); - - void setInWater(bool status) { mInWater = status; } - bool isInWater() { return mInWater; } - u8 getLinkState() const { return mLinkState; } - u8 getMoveSpeed() const { return mMoveSpeed; } - bool isRiding() const { return mRiding; } - void i_setLinkState(u8 i_state) { mLinkState = i_state; } - Z2SoundObjSimple& getKantera() { return mKantera; } - u8 getLinkHp() const { return mLinkHp; } - u8 getMovingTime() { return mMovingTime; } - u8 isWolfSmellOpen() const { return mWolfEyeOpen; } - void setUsingIronBall(bool i_using) { mUsingIronBall = i_using; } - void setMarkState(u8 i_state) { mMarkState = i_state; } - - static Z2CreatureLink* mLinkPtr; - -private: - /* 0x90 Z2LinkSoundStarter */ - /* 0x94 */ Z2SoundObjSimple mKantera; - /* 0xB4 */ cXyz field_0xb4; - /* 0xC0 */ u8 mLinkState; - /* 0xC1 */ u8 field_0xc1; - /* 0xC2 */ u8 mMarkState; - /* 0xC3 */ u8 mLinkHp; - /* 0xC4 */ u8 mLinkBootsType; - /* 0xC5 */ u8 mKanteraState; - /* 0xC6 */ u8 mLinkSwordType; - /* 0xC7 */ u8 mLinkShieldType; - /* 0xC8 */ u8 mMoveSpeed; - /* 0xC9 */ u8 mMovingTime; - /* 0xCA */ s8 mSinkDepth; - /* 0xCB */ bool mWolfEyeOpen : 1; - /* 0xCB */ bool mInWater : 1; - /* 0xCB */ bool mResumeAttack : 1; - /* 0xCB */ bool mFlag3 : 1; - /* 0xCB */ bool mFlag4 : 1; - /* 0xCB */ bool mFlag5 : 1; - /* 0xCB */ bool mRiding : 1; - /* 0xCB */ bool mMagnetized : 1; - /* 0xCC */ bool mFlag8 : 1; - /* 0xCC */ bool mUsingIronBall : 1; - /* 0xCC */ bool mFlag10 : 1; - /* 0xCC */ bool mFlag11 : 1; - /* 0xCC */ bool mFlag12 : 1; - /* 0xCC */ bool mFlag13 : 1; - /* 0xCC */ bool mFlag14 : 1; - /* 0xCC */ bool mFlag15 : 1; -}; // Size: 0xD0 - -inline Z2CreatureLink* Z2GetLink() { - return Z2CreatureLink::mLinkPtr; -} - -class Z2CreatureRide; -struct Z2RideSoundStarter : public Z2SoundStarter { - /* 802C5234 */ Z2RideSoundStarter(Z2CreatureRide*); - - /* 802C5078 */ inline virtual ~Z2RideSoundStarter(); - /* 802C5284 */ virtual bool startSound(JAISoundID, JAISoundHandle*, - JGeometry::TVec3 const*, u32, f32, f32, f32, f32, - f32, u32); - - /* 0x4 */ Z2CreatureRide* mRide; -}; - -class Z2CreatureRide : public Z2Creature, public Z2RideSoundStarter { -public: - Z2CreatureRide(); - ~Z2CreatureRide(); - void init(Vec*, Vec*, u8, u8); - void setLinkRiding(bool); - - virtual void deleteObject(); - -private: - /* 0x90 */ // Z2RideSoundStarter mSoundStarter; - /* 0x98 */ bool mLinkRiding; -}; // Size: 0x9C - class Z2CreatureEnemy : public Z2Creature, public JSULink { public: /* 802C0F64 */ Z2CreatureEnemy(); diff --git a/include/Z2AudioLib/Z2LinkMgr.h b/include/Z2AudioLib/Z2LinkMgr.h index 0c3c9e93c4a..21c0509c13e 100644 --- a/include/Z2AudioLib/Z2LinkMgr.h +++ b/include/Z2AudioLib/Z2LinkMgr.h @@ -1,5 +1,141 @@ #ifndef Z2LINKMGR_H #define Z2LINKMGR_H +#include "SSystem/SComponent/c_xyz.h" +#include "Z2AudioLib/Z2Creature.h" + +class Z2LinkSoundStarter : public Z2SoundStarter { +public: + Z2LinkSoundStarter(); + + inline virtual ~Z2LinkSoundStarter(); + virtual bool startSound(JAISoundID, JAISoundHandle*, JGeometry::TVec3 const*, u32, f32, + f32, f32, f32, f32, u32); +}; + +class Z2CreatureLink : public Z2Creature, public Z2LinkSoundStarter { +public: + Z2CreatureLink(); + ~Z2CreatureLink(); + + void setLinkState(u8); + void setLinkGroupInfo(u8); + void setLinkHp(s32, s32); + void setLinkSwordType(s32, s32); + void setLinkShieldType(s32, s32); + void setLinkBootsType(s32); + virtual void deleteObject(); + void init(Vec*, Vec*, Vec*); + void initKantera(Vec*); + void deleteKantera(void); + void setKanteraState(u8); + virtual void framework(u32, s8); + void setSinkDepth(s8); + void setRiding(bool); + void setMagnetized(bool); + void setWolfEyeOpen(bool); + Z2SoundHandlePool* startLinkSound(JAISoundID, u32, s8); + JAISoundHandle* startLinkSoundLevel(JAISoundID, u32, s8); + Z2SoundHandlePool* startLinkVoice(JAISoundID, s8); + Z2SoundHandlePool* startLinkVoiceLevel(JAISoundID, s8); + void startLinkSwordSound(JAISoundID, u32, s8); + virtual Z2SoundHandlePool* startCollisionSE(u32, u32); + Z2SoundHandlePool* startHitItemSE(u32, u32, Z2SoundObjBase*, float); + void setResumeAttack(bool); + + void setInWater(bool status) { mInWater = status; } + bool isInWater() { return mInWater; } + u8 getLinkState() const { return mLinkState; } + u8 getMoveSpeed() const { return mMoveSpeed; } + bool isRiding() const { return mRiding; } + void i_setLinkState(u8 i_state) { mLinkState = i_state; } + Z2SoundObjSimple& getKantera() { return mKantera; } + u8 getLinkHp() const { return mLinkHp; } + u8 getMovingTime() { return mMovingTime; } + u8 isWolfSmellOpen() const { return mWolfEyeOpen; } + void setUsingIronBall(bool i_using) { mUsingIronBall = i_using; } + void setMarkState(u8 i_state) { mMarkState = i_state; } + + static Z2CreatureLink* mLinkPtr; + + friend class Z2LinkSoundStarter; + friend class Z2RideSoundStarter; + +private: + /* 0x90 Z2LinkSoundStarter */ + /* 0x94 */ Z2SoundObjSimple mKantera; + /* 0xB4 */ cXyz field_0xb4; + /* 0xC0 */ u8 mLinkState; + /* 0xC1 */ u8 field_0xc1; + /* 0xC2 */ u8 mMarkState; + /* 0xC3 */ u8 mLinkHp; + /* 0xC4 */ u8 mLinkBootsType; + /* 0xC5 */ u8 mKanteraState; + /* 0xC6 */ u8 mLinkSwordType; + /* 0xC7 */ u8 mLinkShieldType; + /* 0xC8 */ u8 mMoveSpeed; + /* 0xC9 */ u8 mMovingTime; + /* 0xCA */ s8 mSinkDepth; + /* 0xCB */ bool mWolfEyeOpen : 1; + /* 0xCB */ bool mInWater : 1; + /* 0xCB */ bool mResumeAttack : 1; + /* 0xCB */ bool mFlag3 : 1; + /* 0xCB */ bool mFlag4 : 1; + /* 0xCB */ bool mFlag5 : 1; + /* 0xCB */ bool mRiding : 1; + /* 0xCB */ bool mMagnetized : 1; + /* 0xCC */ bool mFlag8 : 1; + /* 0xCC */ bool mUsingIronBall : 1; + /* 0xCC */ bool mFlag10 : 1; + /* 0xCC */ bool mFlag11 : 1; + /* 0xCC */ bool mFlag12 : 1; + /* 0xCC */ bool mFlag13 : 1; + /* 0xCC */ bool mFlag14 : 1; + /* 0xCC */ bool mFlag15 : 1; +}; // Size: 0xD0 + +inline Z2CreatureLink* Z2GetLink() { + return Z2CreatureLink::mLinkPtr; +} + +class Z2CreatureRide; +struct Z2RideSoundStarter : public Z2SoundStarter { + /* 802C5234 */ Z2RideSoundStarter(Z2CreatureRide*); + + /* 802C5078 */ virtual ~Z2RideSoundStarter() {} + /* 802C5284 */ virtual bool startSound(JAISoundID, JAISoundHandle*, + JGeometry::TVec3 const*, u32, f32, f32, f32, f32, + f32, u32); + + /* 0x4 */ Z2CreatureRide* mRide; +}; + +class Z2CreatureRide : public Z2Creature, public Z2RideSoundStarter { +public: + Z2CreatureRide(); + ~Z2CreatureRide(); + void init(Vec*, Vec*, u8, u8); + void setLinkRiding(bool); + + bool isLinkRiding() { return mLinkRiding; } + + virtual void deleteObject(); + +private: + /* 0x90 */ // Z2RideSoundStarter mSoundStarter; + /* 0x98 */ bool mLinkRiding; +}; // Size: 0x9C + +class Z2SoundObjCoach : public Z2SoundObjBase { +public: + /* 802C54B8 */ Z2SoundObjCoach(); + /* 802C54FC */ void init(Vec*, u8); + /* 802C551C */ Z2SoundHandlePool* startWheelSound(f32); + /* 802C56C0 */ Z2SoundHandlePool* startFireSound(u16); + /* 802C57C0 */ Z2SoundHandlePool* startSound(JAISoundID, u32, s8); + +private: + /* 0x20 */ f32 field_0x20; +}; #endif /* Z2LINKMGR_H */ diff --git a/include/Z2AudioLib/Z2SceneMgr.h b/include/Z2AudioLib/Z2SceneMgr.h index 31381b9f141..da2db509b0f 100644 --- a/include/Z2AudioLib/Z2SceneMgr.h +++ b/include/Z2AudioLib/Z2SceneMgr.h @@ -40,6 +40,7 @@ public: bool isMovieDemo() { return sceneNum == 2 || sceneNum == 8 || sceneNum == 9; } s32 getSeLoadStatus(u32 wave) { return getWaveLoadStatus(wave, 0); } s32 getBgmLoadStatus(u32 wave) { return getWaveLoadStatus(wave, 1); } + u8 getDemoSeWaveNum() { return loadedDemoWave; } private: /* 0x00 */ JAISoundID BGM_ID; diff --git a/include/Z2AudioLib/Z2SoundHandles.h b/include/Z2AudioLib/Z2SoundHandles.h index 117661fb792..a39b56df4b6 100644 --- a/include/Z2AudioLib/Z2SoundHandles.h +++ b/include/Z2AudioLib/Z2SoundHandles.h @@ -4,13 +4,9 @@ #include "JSystem/JAudio2/JAISoundHandles.h" #include "JSystem/JAudio2/JASHeapCtrl.h" -// This should inherit JASPoolAllocObject (without which some functions in Z2SoundHandles.cpp badly mismatch) -// but this inheritance causes the memPool_ to be generated in the first file that includes this header. -// Perhaps this class definition should belong to a different header. -class Z2SoundHandlePool : public JAISoundHandle, public JSULink { // , public JASPoolAllocObject { +class Z2SoundHandlePool : public JAISoundHandle, public JSULink, public JASPoolAllocObject { public: Z2SoundHandlePool() : JAISoundHandle(), JSULink(this) {} - ~Z2SoundHandlePool() {} }; class Z2SoundHandles : protected JSUList { diff --git a/include/Z2AudioLib/Z2SoundObjMgr.h b/include/Z2AudioLib/Z2SoundObjMgr.h index ef084604ecd..0d1ead5e06a 100644 --- a/include/Z2AudioLib/Z2SoundObjMgr.h +++ b/include/Z2AudioLib/Z2SoundObjMgr.h @@ -93,6 +93,7 @@ public: bool removeEnemy(JSULink*); u8 isTwilightBattle(); + u8 getEnemyNumNear() { return mEnemyNumNear; } u8 getEnemyNumVeryFar() { return mEnemyNumVeryFar; } bool isForceBattle() { return mForceBattle; } JSUList* getEnemyList() { return this; } diff --git a/include/Z2AudioLib/Z2SpeechMgr2.h b/include/Z2AudioLib/Z2SpeechMgr2.h index 780e8151247..cf5cf9514fd 100644 --- a/include/Z2AudioLib/Z2SpeechMgr2.h +++ b/include/Z2AudioLib/Z2SpeechMgr2.h @@ -35,11 +35,11 @@ struct Z2SpeechMgr2 : public JASGlobalInstance { /* 0x004 */ JAISoundHandle field_0x4; /* 0x008 */ JMath::TRandom_fast_ random; /* 0x00C */ Z2SpeechStarter mSpeech; - /* 0x010 */ u16 field_0x10[500]; - /* 0x3F8 */ s16 field_0x3f8; - /* 0x3FA */ s16 field_0x3fa; - /* 0x3FC */ u16 field_0x3fc; - /* 0x3FE */ u8 field_0x3fe; + /* 0x010 */ u16 mText[500]; + /* 0x3F8 */ s16 mTextNum; + /* 0x3FA */ s16 mTextCount; + /* 0x3FC */ u16 mMood; + /* 0x3FE */ u8 mVoice; /* 0x3FF */ u8 field_0x3ff; /* 0x400 */ u8 field_0x400; /* 0x401 */ u8 field_0x401; diff --git a/include/m_Do/m_Do_audio.h b/include/m_Do/m_Do_audio.h index ab34cbf0835..f6058a1d5d4 100644 --- a/include/m_Do/m_Do_audio.h +++ b/include/m_Do/m_Do_audio.h @@ -3,7 +3,7 @@ #include "Z2AudioLib/Z2AudioMgr.h" #include "Z2AudioLib/Z2EnvSeMgr.h" -#include "Z2AudioLib/Z2Creature.h" +#include "Z2AudioLib/Z2LinkMgr.h" class mDoAud_zelAudio_c : public Z2AudioMgr { public: diff --git a/src/JSystem/JAudio2/JAISeMgr.cpp b/src/JSystem/JAudio2/JAISeMgr.cpp index 12a170baed9..23ba565c93d 100644 --- a/src/JSystem/JAudio2/JAISeMgr.cpp +++ b/src/JSystem/JAudio2/JAISeMgr.cpp @@ -258,7 +258,6 @@ void JAISeMgr::resetSeqDataMgr() { } /* 802A0484-802A0574 29ADC4 00F0+00 1/1 0/0 0/0 .text newSe___8JAISeMgrFiUl */ -// NONMATCHING JASPollAllocObject<_> locations JAISe* JAISeMgr::newSe_(int i_category, u32 param_1) { if (i_category < 0) { i_category = 0; @@ -338,10 +337,7 @@ int JAISeMgr::getNumActiveSe() const { return sum; } -/* 802A0994-802A0A6C 29B2D4 00D8+00 1/1 0/0 0/0 .text __ct__16JAISeCategoryMgrFv */ -JAISeCategoryMgr::JAISeCategoryMgr() { - mParams.init(); - mMaxActiveSe = 0; - mMaxInactiveSe = 0; - field_0x4.field_0x0 = 0; -} +u8 data_80451310[8]; + +/* 80451318-80451320 000818 0008+00 0/0 7/7 0/0 .sbss None */ +u8 data_80451318[8]; diff --git a/src/JSystem/JAudio2/JAISeqMgr.cpp b/src/JSystem/JAudio2/JAISeqMgr.cpp index 99168c69823..11f85e19c3c 100644 --- a/src/JSystem/JAudio2/JAISeqMgr.cpp +++ b/src/JSystem/JAudio2/JAISeqMgr.cpp @@ -48,7 +48,6 @@ JAISeqMgr::JAISeqMgr(bool param_1) : JASGlobalInstance(param_1), mAud } /* 802A1A08-802A1AF4 29C348 00EC+00 1/1 0/0 0/0 .text freeDeadSeq___9JAISeqMgrFv */ -// NONMATCHING JASPoolAllocObject<_> locations void JAISeqMgr::freeDeadSeq_() { JSULink* link = mSeqList.getFirst(); while (link != NULL) { @@ -132,7 +131,6 @@ void JAISeqMgr::mixOut() { } /* 802A1F58-802A1FE8 29C898 0090+00 1/1 0/0 0/0 .text beginStartSeq___9JAISeqMgrFv */ -// NONMATCHING JASPoolAllocObject<_> locations JAISeq* JAISeqMgr::beginStartSeq_() { JAISeq* seq = new JAISeq(this, field_0x10); if (seq == NULL) { @@ -143,7 +141,6 @@ JAISeq* JAISeqMgr::beginStartSeq_() { /* 802A1FE8-802A20F0 29C928 0108+00 1/1 0/0 0/0 .text * endStartSeq___9JAISeqMgrFP6JAISeqP14JAISoundHandle */ -// NONMATCHING JASPoolAllocObject<_> locations bool JAISeqMgr::endStartSeq_(JAISeq* param_1, JAISoundHandle* param_2) { JAISeq* sound = param_1->getObject(); if (sound != NULL) { diff --git a/src/JSystem/JAudio2/JAIStreamMgr.cpp b/src/JSystem/JAudio2/JAIStreamMgr.cpp index f8157b22e0e..f80b3f6a155 100644 --- a/src/JSystem/JAudio2/JAIStreamMgr.cpp +++ b/src/JSystem/JAudio2/JAIStreamMgr.cpp @@ -52,7 +52,6 @@ bool JAIStreamMgr::startSound(JAISoundID param_1, JAISoundHandle* param_2, /* 802A3D70-802A3E68 29E6B0 00F8+00 1/1 0/0 0/0 .text freeDeadStream___12JAIStreamMgrFv */ -// NONMATCHING JASPoolAllocObject<_> locations void JAIStreamMgr::freeDeadStream_() { JSULink* link = mStreamList.getFirst(); while (link != NULL) { @@ -111,7 +110,6 @@ void JAIStreamMgr::mixOut() { } /* 802A4174-802A4244 29EAB4 00D0+00 1/1 0/0 0/0 .text newStream___12JAIStreamMgrFv */ -// NONMATCHING JASPoolAllocObject<_> locations JAIStream* JAIStreamMgr::newStream_() { if (mStreamAramMgr == NULL) { JUT_WARN(229, "JAIStreamAramMgr must be set.\n"); diff --git a/src/JSystem/JAudio2/JASTrack.cpp b/src/JSystem/JAudio2/JASTrack.cpp index 8bbef78ac84..591dbf2e582 100644 --- a/src/JSystem/JAudio2/JASTrack.cpp +++ b/src/JSystem/JAudio2/JASTrack.cpp @@ -9,163 +9,6 @@ #include "JSystem/JAudio2/JASBank.h" #include "JSystem/JAudio2/JASAiCtrl.h" #include "JSystem/JAudio2/JASDSPInterface.h" -#include "dol2asm.h" - -// -// Types: -// - -/* JASMemPool_MultiThreaded */ -struct JASMemPool_MultiThreaded__template0 { - /* 802932E0 */ void func_802932E0(void* _this); -}; - -/* JASMemPool_MultiThreaded */ -struct JASMemPool_MultiThreaded__template1 { - /* 80293334 */ void func_80293334(void* _this); -}; - -struct JASBankTable__template0 { - /* 80293528 */ void func_80293528(void* _this, u32) /* const */; -}; - -// -// Forward References: -// - -extern "C" void __ct__8JASTrackFv(); -extern "C" void __dt__8JASTrackFv(); -extern "C" void setChannelMgrCount__8JASTrackFUl(); -extern "C" void init__8JASTrackFv(); -extern "C" void initTimed__8JASTrackFv(); -extern "C" void inherit__8JASTrackFRC8JASTrack(); -extern "C" void assignExtBuffer__8JASTrackFUlP14JASSoundParams(); -extern "C" void setSeqData__8JASTrackFPvUl(); -extern "C" void startSeq__8JASTrackFv(); -extern "C" void stopSeq__8JASTrackFv(); -extern "C" void start__8JASTrackFv(); -extern "C" void close__8JASTrackFv(); -extern "C" void connectChild__8JASTrackFUlP8JASTrack(); -extern "C" void closeChild__8JASTrackFUl(); -extern "C" void openChild__8JASTrackFUl(); -extern "C" void connectBus__8JASTrackFii(); -extern "C" void setLatestKey__8JASTrackFUc(); -extern "C" void channelStart__8JASTrackFPQ28JASTrack11TChannelMgrUlUlUl(); -extern "C" void noteOn__8JASTrackFUlUlUl(); -extern "C" void gateOn__8JASTrackFUlUlfUl(); -extern "C" void noteOff__8JASTrackFUlUs(); -extern "C" void checkNoteStop__8JASTrackCFUl(); -extern "C" void overwriteOsc__8JASTrackFP10JASChannel(); -extern "C" void updateTimedParam__8JASTrackFv(); -extern "C" void updateTrack__8JASTrackFf(); -extern "C" void updateTempo__8JASTrackFv(); -extern "C" void updateSeq__8JASTrackFbf(); -extern "C" void seqTimeToDspTime__8JASTrackFf(); -extern "C" void setParam__8JASTrackFUlfUl(); -extern "C" void noteOffAll__8JASTrackFUs(); -extern "C" void mute__8JASTrackFb(); -extern "C" void setOscScale__8JASTrackFUlf(); -extern "C" void setOscTable__8JASTrackFUlPCQ213JASOscillator5Point(); -extern "C" void setOscAdsr__8JASTrackFssssUs(); -extern "C" void setFIR__8JASTrackFPCs(); -extern "C" void setIIR__8JASTrackFPCs(); -extern "C" void readPortSelf__8JASTrackFUl(); -extern "C" void writePortSelf__8JASTrackFUlUs(); -extern "C" void writePort__8JASTrackFUlUs(); -extern "C" void readPort__8JASTrackFUl(); -extern "C" void setChannelPauseFlag__8JASTrackFb(); -extern "C" void pause__8JASTrackFb(); -extern "C" void getTransposeTotal__8JASTrackCFv(); -extern "C" void isMute__8JASTrackCFv(); -extern "C" void setTempo__8JASTrackFUs(); -extern "C" void setTempoRate__8JASTrackFf(); -extern "C" void setTimebase__8JASTrackFUs(); -extern "C" void updateChannel__8JASTrackFP10JASChannelPQ26JASDsp8TChannel(); -extern "C" void channelUpdateCallback__8JASTrackFUlP10JASChannelPQ26JASDsp8TChannelPv(); -extern "C" void getRootTrack__8JASTrackFv(); -extern "C" void tickProc__8JASTrackFv(); -extern "C" void seqMain__8JASTrackFv(); -extern "C" void cbSeqMain__Q28JASTrack5TListFPv(); -extern "C" void append__Q28JASTrack5TListFP8JASTrack(); -extern "C" void seqMain__Q28JASTrack5TListFv(); -extern "C" void __ct__Q28JASTrack11TChannelMgrFP8JASTrack(); -extern "C" void init__Q28JASTrack11TChannelMgrFv(); -extern "C" void releaseAll__Q28JASTrack11TChannelMgrFv(); -extern "C" void noteOff__Q28JASTrack11TChannelMgrFUlUs(); -extern "C" void setPauseFlag__Q28JASTrack11TChannelMgrFb(); -extern "C" void __ct__Q28JASTrack10MoveParam_Fv(); -extern "C" void func_802932E0(void* _this); -extern "C" void func_80293334(void* _this); -extern "C" void __sinit_JASTrack_cpp(); -extern "C" void __dt__Q28JASTrack5TListFv(); -extern "C" void __dt__19JASDefaultBankTableFv(); -extern "C" void func_80293528(void* _this, u32); -extern "C" u8 const sAdsTable__8JASTrack[24]; -extern "C" u8 const sEnvOsc__8JASTrack[24]; -extern "C" u8 const sPitchEnvOsc__8JASTrack[24]; -extern "C" u8 sDefaultBankTable__8JASTrack[1036]; -extern "C" u8 sTrackList__8JASTrack[16]; -extern "C" u32 FILTER_MODE_IIR__6JASDsp; - -// -// External References: -// - -extern "C" void __ct__17JASGenericMemPoolFv(); -extern "C" void __dt__17JASGenericMemPoolFv(); -extern "C" void alloc__17JASGenericMemPoolFUl(); -extern "C" void free__17JASGenericMemPoolFPvUl(); -extern "C" void init__12JASTrackPortFv(); -extern "C" void readImport__12JASTrackPortFUl(); -extern "C" void readExport__12JASTrackPortFUl(); -extern "C" void writeImport__12JASTrackPortFUlUs(); -extern "C" void writeExport__12JASTrackPortFUlUs(); -extern "C" void __ct__16JASRegisterParamFv(); -extern "C" void init__16JASRegisterParamFv(); -extern "C" void __ct__10JASSeqCtrlFv(); -extern "C" void init__10JASSeqCtrlFv(); -extern "C" void start__10JASSeqCtrlFPvUl(); -extern "C" void tickProc__10JASSeqCtrlFP8JASTrack(); -extern "C" void interrupt__10JASSeqCtrlFQ210JASSeqCtrl8IntrType(); -extern "C" void noteOn__7JASBankFPC7JASBankiUcUcUsPFUlP10JASChannelPQ26JASDsp8TChannelPv_vPv(); -extern "C" void release__10JASChannelFUs(); -extern "C" void setOscInit__10JASChannelFUlPCQ213JASOscillator4Data(); -extern "C" void setMixConfig__10JASChannelFUlUs(); -extern "C" void setKeySweepTarget__10JASChannelFlUl(); -extern "C" void free__10JASChannelFv(); -extern "C" void getDacRate__9JASDriverFv(); -extern "C" void getSubFrames__9JASDriverFv(); -extern "C" void setFilterMode__Q26JASDsp8TChannelFUs(); -extern "C" void setIIRFilterParam__Q26JASDsp8TChannelFPs(); -extern "C" void setFIR8FilterParam__Q26JASDsp8TChannelFPs(); -extern "C" void setDistFilter__Q26JASDsp8TChannelFs(); -extern "C" void registerSubFrameCallback__9JASDriverFPFPv_lPv(); -extern "C" void __dl__FPv(); -extern "C" void __dt__Q27JGadget13TNodeLinkListFv(); -extern "C" void -Insert__Q27JGadget13TNodeLinkListFQ37JGadget13TNodeLinkList8iteratorPQ27JGadget13TLinkListNode(); -extern "C" void Remove__Q27JGadget13TNodeLinkListFPQ27JGadget13TLinkListNode(); -extern "C" void __register_global_object(); -extern "C" void __construct_array(); -extern "C" void __cvt_fp2unsigned(); -extern "C" void _savegpr_20(); -extern "C" void _savegpr_23(); -extern "C" void _savegpr_26(); -extern "C" void _savegpr_27(); -extern "C" void _savegpr_28(); -extern "C" void _savegpr_29(); -extern "C" void _restgpr_20(); -extern "C" void _restgpr_23(); -extern "C" void _restgpr_26(); -extern "C" void _restgpr_27(); -extern "C" void _restgpr_28(); -extern "C" void _restgpr_29(); -extern "C" extern u8 struct_80451230[8]; -extern "C" extern u8 __OSReport_disable; - -// -// Declarations: -// /* 80291228-8029131C 28BB68 00F4+00 1/1 3/3 0/0 .text __ct__8JASTrackFv */ // NONMATCHING @@ -301,15 +144,15 @@ void JASTrack::init() { /* 802918FC-8029194C 28C23C 0050+00 1/1 0/0 0/0 .text initTimed__8JASTrackFv */ void JASTrack::initTimed() { - mMoveParam[0].mValue = 1.0f; - mMoveParam[1].mValue = 0.0f; - mMoveParam[3].mValue = 0.5f; - mMoveParam[2].mValue = 0.0f; - mMoveParam[4].mValue = 0.0f; - mMoveParam[5].mValue = 0.0f; + mMoveParam.params.volume.mValue = 1.0f; + mMoveParam.params.pitch.mValue = 0.0f; + mMoveParam.params.pan.mValue = 0.5f; + mMoveParam.params.fxmix.mValue = 0.0f; + mMoveParam.params.dolby.mValue = 0.0f; + mMoveParam.params.distFilter.mValue = 0.0f; for (int i = 0; i < 6; i++) { - mMoveParam[i].mCount = 0; - mMoveParam[i].mTarget = mMoveParam[i].mValue; + mMoveParam.array[i].mCount = 0; + mMoveParam.array[i].mTarget = mMoveParam.array[i].mValue; } } @@ -575,7 +418,7 @@ void JASTrack::overwriteOsc(JASChannel* i_channel) { /* 802922D8-80292348 28CC18 0070+00 1/1 0/0 0/0 .text updateTimedParam__8JASTrackFv */ void JASTrack::updateTimedParam() { for (u32 i = 0; i < 6; i++) { - MoveParam_* param = &mMoveParam[i]; + MoveParam_* param = &mMoveParam.array[i]; if (param->mCount != 0) { param->mValue += (param->mTarget - param->mValue) / param->mCount; param->mCount--; @@ -589,13 +432,13 @@ void JASTrack::updateTrack(f32 param_0) { for (u32 i = 0; i < mChannelMgrCount; i++) { TChannelMgr* channel_mgr = mChannelMgrs[i]; if (channel_mgr != NULL) { - f32 volume = mMoveParam[0].mValue; + f32 volume = mMoveParam.params.volume.mValue; volume = volume * volume; f32 pitch = 1.0f; - f32 fvar6 = mMoveParam[1].mValue * mBendSense * (1.0f / 3.0f); - f32 pan = (mMoveParam[3].mValue - 0.5f) * mPanPower; - f32 fxmix = mMoveParam[2].mValue; - f32 dolby = mMoveParam[4].mValue; + f32 fvar6 = mMoveParam.params.pitch.mValue * mBendSense * (1.0f / 3.0f); + f32 pan = (mMoveParam.params.pan.mValue - 0.5f) * mPanPower; + f32 fxmix = mMoveParam.params.fxmix.mValue; + f32 dolby = mMoveParam.params.dolby.mValue; JASSoundParams* sound_params = channel_mgr->mSoundParams; if (sound_params != NULL) { volume *= sound_params->mVolume; @@ -671,7 +514,7 @@ u32 JASTrack::seqTimeToDspTime(f32 i_seqTime) { /* 802926E0-80292708 28D020 0028+00 0/0 4/4 0/0 .text setParam__8JASTrackFUlfUl */ void JASTrack::setParam(u32 i_index, f32 i_target, u32 i_count) { - MoveParam_* param = &mMoveParam[i_index]; + MoveParam_* param = &mMoveParam.array[i_index]; param->mTarget = i_target; if (i_count == 0) { param->mValue = param->mTarget; @@ -847,7 +690,7 @@ void JASTrack::updateChannel(JASChannel* param_0, JASDsp::TChannel* param_1) { param_1->setFIR8FilterParam(mFIR); } param_1->setFilterMode(mFilterMode); - param_1->setDistFilter(mMoveParam[5].mValue * 32767.0f); + param_1->setDistFilter(mMoveParam.params.distFilter.mValue * 32767.0f); } @@ -955,9 +798,12 @@ void JASTrack::TList::append(JASTrack* i_track) { } /* 8029301C-802930DC 28D95C 00C0+00 1/1 0/0 0/0 .text seqMain__Q28JASTrack5TListFv */ -// NONMATCHING problems with the iterator +// NONMATCHING missing load instruction void JASTrack::TList::seqMain() { - for (iterator it = begin(); it != end(); it++) { + iterator it, it2; + for (it = begin(); it != end(); it = it2) { + it2 = it; + it2++; if (it->seqMain() < 0) { Remove(&*it); if (it->mFlags.autoDelete) { diff --git a/src/JSystem/JAudio2/osdsp_task.cpp b/src/JSystem/JAudio2/osdsp_task.cpp index 4f444c6f909..0fe94da0d70 100644 --- a/src/JSystem/JAudio2/osdsp_task.cpp +++ b/src/JSystem/JAudio2/osdsp_task.cpp @@ -172,17 +172,3 @@ bool Dsp_Running_Check() { void Dsp_Running_Start() { struct_80451308 = 1; } - -/* ############################################################################################## */ -/* 80451310-80451318 000810 0008+00 0/0 3/3 0/0 .sbss None */ -u8 data_80451310[8]; - -/* 80451318-80451320 000818 0008+00 0/0 7/7 0/0 .sbss None */ -u8 data_80451318[8]; - -/* 80451320-80451328 000820 0008+00 0/0 4/4 0/0 .sbss None */ -u8 data_80451320[8]; - -/* 80451328-80451330 000828 0008+00 0/0 3/3 0/0 .sbss None */ -// init$localstatic4$getMemPool__30JASPoolAllocObject<9JAIStream>Fv -u8 data_80451328[8]; diff --git a/src/Z2AudioLib/Z2AudioArcLoader.cpp b/src/Z2AudioLib/Z2AudioArcLoader.cpp index b7d6789d98a..4d50aa7d021 100644 --- a/src/Z2AudioLib/Z2AudioArcLoader.cpp +++ b/src/Z2AudioLib/Z2AudioArcLoader.cpp @@ -30,7 +30,7 @@ bool Z2AudioArcLoader::readCommandMore(u32 param_0) { // NONMATCHING regalloc void Z2AudioArcLoader::readBFCA(void const* param_0) { JKRHeap* heap = JAUSectionHeap::getInstance()->getHeap(); - JKRArchive* archive = JKRArchive::mount((void*)param_0, JKRGetCurrentHeap(), JKRArchive::MOUNT_DIRECTION_TAIL); + JKRArchive* archive = JKRMountArchive((void*)param_0, JKRGetCurrentHeap(), JKRArchive::MOUNT_DIRECTION_TAIL); Z2GetFxLineMgr()->initDataArc(archive, heap); JKRUnmountArchive(archive); } diff --git a/src/Z2AudioLib/Z2Creature.cpp b/src/Z2AudioLib/Z2Creature.cpp index ef20c361922..d5f057b1025 100644 --- a/src/Z2AudioLib/Z2Creature.cpp +++ b/src/Z2AudioLib/Z2Creature.cpp @@ -4,6 +4,7 @@ */ #include "Z2AudioLib/Z2Creature.h" +#include "SSystem/SComponent/c_xyz.h" #include "Z2AudioLib/Z2Param.h" #include "Z2AudioLib/Z2Calc.h" #include "Z2AudioLib/Z2AudioMgr.h" @@ -180,7 +181,7 @@ Z2SoundHandlePool* Z2Creature::startCreatureSound(JAISoundID i_soundID, u32 para return mSoundObjSimple1.startSound(i_soundID, param_1, 0); default: Z2SoundHandlePool* handle = mSoundObjAnime.startSound(i_soundID, param_1, param_2); - if (handle != NULL && *handle != NULL) { + if (handle != NULL && *handle) { switch (i_soundID) { case Z2SE_FAIRY_S_FLY: f32 pitch = Z2Calc::getParamByExp((f32)param_1, 30.0f, 100.0f, 0.3f, @@ -199,12 +200,12 @@ Z2SoundHandlePool* Z2Creature::startCreatureSound(JAISoundID i_soundID, u32 para * startCreatureSoundLevel__10Z2CreatureF10JAISoundIDUlSc */ Z2SoundHandlePool* Z2Creature::startCreatureSoundLevel(JAISoundID i_soundID, u32 param_1, s8 param_2) { switch (i_soundID) { - case 0x600d6: + case Z2SE_FAIRY_S_LV: Z2GetAudioMgr()->seStartLevel(i_soundID, mpPos, 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0); return NULL; default: Z2SoundHandlePool* handle = mSoundObjAnime.startLevelSound(i_soundID, param_1, param_2); - if (handle != NULL && *handle != NULL) { + if (handle != NULL && *handle) { if (i_soundID == Z2SE_YM_SNOBO_RIDE || i_soundID == Z2SE_YW_SNOBO_RIDE) { f32 volume = 0.0f; if (param_1 != 0) { @@ -486,7 +487,7 @@ Z2SoundHandlePool* Z2CreatureEnemy::startCreatureSoundLevel(JAISoundID i_soundID switch (mEnemyID) { case Z2_ENEMY_FZ: - if (handle != NULL && *handle != NULL && i_soundID == Z2SE_EN_FZ_MOVE) { + if (handle != NULL && *handle && i_soundID == Z2SE_EN_FZ_MOVE) { f32 volume = Z2Calc::getParamByExp(param_1, 1.0f, 50.0f, 0.4f, 0.1f, 1.1f, Z2Calc::CURVE_SIGN_1); (*handle)->getAuxiliary().moveVolume(volume, 0); @@ -496,7 +497,7 @@ Z2SoundHandlePool* Z2CreatureEnemy::startCreatureSoundLevel(JAISoundID i_soundID Z2_E_sw_modPitch(handle, param_1); break; case Z2_ENEMY_RB: - if (handle != NULL && *handle != NULL && i_soundID == Z2SE_EN_RB_MOVE) { + if (handle != NULL && *handle && i_soundID == Z2SE_EN_RB_MOVE) { f32 volume = Z2Calc::getParamByExp(param_1, 4.0f, 35.0f, 0.6f, 0.7f, 1.0f, Z2Calc::CURVE_SIGN_1); f32 pitch = Z2Calc::getParamByExp(param_1, 4.0f, 35.0f, 0.4f, 0.8f, 1.0f, @@ -507,7 +508,7 @@ Z2SoundHandlePool* Z2CreatureEnemy::startCreatureSoundLevel(JAISoundID i_soundID } // no break default: - if (handle != NULL && *handle != NULL && i_soundID == Z2SE_EN_PH_PROPELLER) { + if (handle != NULL && *handle && i_soundID == Z2SE_EN_PH_PROPELLER) { f32 volume = Z2Calc::getParamByExp(param_1, 0.0f, 30.0f, 0.4f, 0.0f, 1.0f, Z2Calc::CURVE_SIGN_1); f32 pitch = Z2Calc::getParamByExp(param_1, 4000.0f, 13000.0f, 0.4f, 0.8f, 1.2f, @@ -856,7 +857,7 @@ Z2SoundHandlePool* Z2CreatureFM::startChainSoundLevel(JAISoundID i_soundID, u8 p switch (param_1) { case 0: handle = field_0xa4.startLevelSound(i_soundID, param_3, param_4); - if (handle != NULL && *handle != NULL) { + if (handle != NULL && *handle) { if (param_2 > 30.0f) { pitch = 1.06f; } else { @@ -872,7 +873,7 @@ Z2SoundHandlePool* Z2CreatureFM::startChainSoundLevel(JAISoundID i_soundID, u8 p return NULL; case 1: handle = field_0xa4.startLevelSound(i_soundID, param_3, param_4); - if (handle != NULL && *handle != NULL) { + if (handle != NULL && *handle) { if (param_2 > 30.0f) { pitch = 1.06f; } else { @@ -1052,7 +1053,7 @@ Z2SoundHandlePool* Z2CreatureOI::startTentacleSoundLevel(JAISoundID i_soundID, u f32 param_2, u32 param_3, s8 param_4) { Z2SoundHandlePool* handle = mTentacleSounds[param_1].startLevelSound(i_soundID, param_3, param_4); - if (handle != NULL && *handle != NULL) { + if (handle != NULL && *handle) { f32 volume = Z2Calc::getParamByExp(param_2, 0.0f, 60.0f, 0.4f, 0.0f, 1.0f, Z2Calc::CURVE_SIGN_1); f32 pitch = Z2Calc::getParamByExp(param_2, 0.0f, 60.0f, 0.4f, 0.9f, 1.1f, diff --git a/src/Z2AudioLib/Z2EnvSeMgr.cpp b/src/Z2AudioLib/Z2EnvSeMgr.cpp index 9189867d2d4..b62f873c14e 100644 --- a/src/Z2AudioLib/Z2EnvSeMgr.cpp +++ b/src/Z2AudioLib/Z2EnvSeMgr.cpp @@ -211,20 +211,20 @@ Z2EnvSeMgr::Z2EnvSeMgr() field_0x39 = 0; field_0x2e8.setParam(0.1f, 0.007823764f, 0.06f); field_0x2f8.setParam(0.2f, 0.007823764f, 0.06f); - field_0x90.setParam(0.1f, 0.02630252f, 0.005f); - field_0xa0.setParam(0.9f, 0.02331011f, 0.003f); - field_0xb0.setParam(0.2f, 0.006385157f, 0.004f); + field_0x90.setParam(0.1f, 0.026302524f, 0.005f); + field_0xa0.setParam(0.9f, 0.023310114f, 0.003f); + field_0xb0.setParam(0.2f, 0.0063851574f, 0.004f); field_0xc0.setParam(0.8f, 0.006188805f, 0.0045f); - field_0xd0.setParam(0.3f, 0.05343298f, 0.002f); - field_0xe0.setParam(0.7f, 0.04256627f, 0.0025f); - field_0xf0.setParam(0.4f, 0.01293395f, 0.006f); - field_0x100.setParam(0.6f, 0.01215741f, 0.0065f); - field_0x18c.setParam(0.1f, 0.02331011f, 0.005f); - field_0x19c.setParam(0.5f, 0.05343298f, 0.0025f); + field_0xd0.setParam(0.3f, 0.053432982f, 0.002f); + field_0xe0.setParam(0.7f, 0.042566273f, 0.0025f); + field_0xf0.setParam(0.4f, 0.012933955f, 0.006f); + field_0x100.setParam(0.6f, 0.012157413f, 0.0065f); + field_0x18c.setParam(0.1f, 0.023310114f, 0.005f); + field_0x19c.setParam(0.5f, 0.053432982f, 0.0025f); field_0x64.setVolumeScale(1.0f); mWolfSmellSeMgr.setVolumeScale(1.0f); - field_0x120.setParam(0.5f, 0.02092357f, 0.001f); - field_0x130.setParam(0.1f, 0.003790878f, 0.005f); + field_0x120.setParam(0.5f, 0.020923574f, 0.001f); + field_0x130.setParam(0.1f, 0.0037908785f, 0.005f); } /* 802C6540-802C66B0 2C0E80 0170+00 0/0 1/1 0/0 .text __dt__10Z2EnvSeMgrFv */ @@ -968,7 +968,7 @@ void Z2EnvSeMgr::setHyrulSewerOpen(bool param_0) { } /* 802C8300-802C8730 2C2C40 0430+00 2/1 1/1 0/0 .text startRiverSe__10Z2EnvSeMgrFSc */ -// NONMATCHING missing branch and JAISound stack issues +// NONMATCHING JAISound stack issues bool Z2EnvSeMgr::startRiverSe(s8 param_1) { if (Z2GetStatusMgr()->mCameraMapInfo == 6) { switch (Z2GetSceneMgr()->getCurrentSceneNum()) { @@ -979,16 +979,20 @@ bool Z2EnvSeMgr::startRiverSe(s8 param_1) { case 0x10: if (Z2GetStatusMgr()->mPolygonPosition.y < -14500.0f) { break; - } + } case 8: - default: - registRiverSePos(&Z2GetStatusMgr()->mPolygonPosition); - break; + // fake match: should be 2000.0f according to debug, but that generates an extra entry in sdata2 + if (Z2GetStatusMgr()->mPolygonPosition.y < -14500.0f) { + break; + } case 0x15: case 0x1e: case 0x1f: case 0x2e: break; + default: + registRiverSePos(&Z2GetStatusMgr()->mPolygonPosition); + break; } } if (mRiverSeMgr.getPosCount() < 0) { diff --git a/src/Z2AudioLib/Z2LinkMgr.cpp b/src/Z2AudioLib/Z2LinkMgr.cpp index 96664f7dc79..378b1c5a6c8 100644 --- a/src/Z2AudioLib/Z2LinkMgr.cpp +++ b/src/Z2AudioLib/Z2LinkMgr.cpp @@ -4,18 +4,7 @@ // #include "Z2AudioLib/Z2LinkMgr.h" -#include "Z2AudioLib/Z2Creature.h" #include "d/d_com_inf_game.h" -#include "dol2asm.h" -#include "global.h" - -struct Z2SoundObjCoach { - /* 802C54B8 */ Z2SoundObjCoach(); - /* 802C54FC */ void init(Vec*, u8); - /* 802C551C */ void startWheelSound(f32); - /* 802C56C0 */ void startFireSound(u16); - /* 802C57C0 */ int startSound(JAISoundID, u32, s8); -}; /* 802C321C-802C3220 2BDB5C 0004+00 0/0 1/1 0/0 .text setLinkGroupInfo__14Z2CreatureLinkFUc */ void Z2CreatureLink::setLinkGroupInfo(u8) {} @@ -355,14 +344,113 @@ JAISoundHandle* Z2CreatureLink::startLinkSoundLevel(JAISoundID i_soundID, u32 pa /* 802C4320-802C45B0 2BEC60 0290+00 1/1 1/1 0/0 .text * startLinkVoice__14Z2CreatureLinkF10JAISoundIDSc */ -void Z2CreatureLink::startLinkVoice(JAISoundID param_0, s8 param_1) { - // NONMATCHING +Z2SoundHandlePool* Z2CreatureLink::startLinkVoice(JAISoundID i_soundID, s8 param_1) { + if (mLinkState == 1) { + switch (i_soundID) { + case Z2SE_WL_V_BREATH_WAIT: + case Z2SE_WL_V_BREATH_TIRED: + case Z2SE_WL_V_BREATH_SIT: + if (Z2GetStatusMgr()->getDemoStatus() == 2 || !Z2GetSceneMgr()->isInGame()) { + return NULL; + } + // fallthrough + case Z2SE_WL_V_BREATH_WALK: + case Z2SE_WL_V_BREATH_RUN: + if (field_0xc1 < 5) { + return NULL; + } + field_0xc1 = 0; + break; + case Z2SE_WL_V_BITE_ATTACK: + if (mSoundObjSimple1.getHandleSoundID(Z2SE_WL_V_BITE_THROAT) != NULL) { + return NULL; + } + break; + } + } else { + if (i_soundID == Z2SE_AL_V_ATTACK_RUN) { + if (field_0xc1 < 10) { + return NULL; + } + field_0xc1 = 0; + } + + if (mMarkState != 3 && Z2GetSoundObjMgr()->getEnemyNumNear() == 0 + && !Z2GetSoundObjMgr()->isForceBattle()) + { + switch (i_soundID) { + case Z2SE_AL_V_ATTACK_S: + i_soundID = Z2SE_AL_V_ATTACK_S_FREE; + break; + case Z2SE_AL_V_ATTACK_M: + case Z2SE_AL_V_TATE_OSHI: + i_soundID = Z2SE_AL_V_ATTACK_M_FREE; + break; + case Z2SE_AL_V_ATTACK_L: + i_soundID = Z2SE_AL_V_ATTACK_L_FREE; + break; + case Z2SE_AL_V_KAITEN: + i_soundID = Z2SE_AL_V_KAITEN_FREE; + break; + case Z2SE_AL_V_BACKTEN: + case Z2SE_AL_V_SOTOMO_ROLL: + i_soundID = Z2SE_AL_V_BACKTEN_FREE; + break; + case Z2SE_AL_V_ATTACK_RUN: + i_soundID = Z2SE_AL_V_ATTACK_RUN_FREE; + break; + } + } else { + if (i_soundID == Z2SE_AL_V_JUMP_S) { + i_soundID = Z2SE_AL_V_BACKTEN; + } + } + + if (isInWater()) { + i_soundID = Z2SE_AL_V_UNDER_WATER; + } + } + + return startCreatureVoice(i_soundID, param_1); } /* 802C45B0-802C46F0 2BEEF0 0140+00 0/0 1/1 0/0 .text * startLinkVoiceLevel__14Z2CreatureLinkF10JAISoundIDSc */ -void Z2CreatureLink::startLinkVoiceLevel(JAISoundID param_0, s8 param_1) { - // NONMATCHING +Z2SoundHandlePool* Z2CreatureLink::startLinkVoiceLevel(JAISoundID i_soundID, s8 param_1) { + if (mLinkState == 1) { + switch (i_soundID) { + case Z2SE_WL_V_ROAR: + f32 volume = 0.0f; + u8 port_data = 0; + switch (mMarkState) { + case 0: + volume = 1.0f; + port_data = 2; + break; + case 1: + volume = 0.3f; + port_data = 1; + break; + case 2: + volume = 0.5f; + port_data = 1; + break; + case 3: + volume = 0.8f; + port_data = 2; + break; + } + + Z2SoundHandlePool* handle = startCreatureVoiceLevel(Z2SE_WL_V_ROAR, param_1); + if (handle != NULL && *handle) { + (*handle)->getAuxiliary().moveVolume(volume, 0); + Z2GetSoundStarter()->setPortData(handle, 8, port_data, -1); + } + return handle; + } + } + + return startCreatureVoiceLevel(i_soundID, param_1); } /* 802C46F0-802C4784 2BF030 0094+00 0/0 2/2 0/0 .text @@ -401,15 +489,26 @@ Z2SoundHandlePool* Z2CreatureLink::startCollisionSE(u32 hitID, u32 mapinfo) { return mSoundObjAnime.startCollisionSE(hitID, mapinfo, NULL); } -/* ############################################################################################## */ -/* 80455D18-80455D1C 004318 0004+00 1/1 0/0 0/0 .sdata2 @4178 */ -SECTION_SDATA2 static f32 lit_4178 = 100.0f; - /* 802C4814-802C48D8 2BF154 00C4+00 0/0 4/4 2/2 .text * startHitItemSE__14Z2CreatureLinkFUlUlP14Z2SoundObjBasef */ -int Z2CreatureLink::startHitItemSE(u32 param_0, u32 param_1, Z2SoundObjBase* param_2, - f32 speed) { - // NONMATCHING +Z2SoundHandlePool* Z2CreatureLink::startHitItemSE(u32 i_soundID, u32 param_1, + Z2SoundObjBase* param_2, f32 speed) { + if (param_2 == NULL) { + param_2 = &mSoundObjSimple2; + } + + if (i_soundID == Z2SE_HIT_SHIELD_ATTACK) { + return mSoundObjAnime.startCollisionSE(i_soundID, param_1, NULL); + } + + Z2SoundHandlePool* handle = param_2->startCollisionSE(i_soundID, param_1, NULL); + if (speed >= 0.0f && handle != NULL && *handle) { + if (speed >= 100.0f) { + speed = 100.0f; + } + (*handle)->getAuxiliary().moveVolume(speed / 100.0f, 0); + } + return handle; } /* 802C48D8-802C48E8 2BF218 0010+00 0/0 1/1 0/0 .text setResumeAttack__14Z2CreatureLinkFb @@ -421,17 +520,158 @@ void Z2CreatureLink::setResumeAttack(bool i_resumeAttack) { /* 802C48E8-802C4928 2BF228 0040+00 1/1 0/0 0/0 .text __ct__18Z2LinkSoundStarterFv */ Z2LinkSoundStarter::Z2LinkSoundStarter() : Z2SoundStarter(false) {} -/* ############################################################################################## */ -/* 80455D1C-80455D20 00431C 0004+00 2/2 0/0 0/0 .sdata2 @4399 */ -SECTION_SDATA2 static f32 lit_4399 = 9.0f / 10.0f; - /* 802C4928-802C4FFC 2BF268 06D4+00 2/0 0/0 0/0 .text * startSound__18Z2LinkSoundStarterF10JAISoundIDP14JAISoundHandlePCQ29JGeometry8TVec3UlfffffUl */ -bool Z2LinkSoundStarter::startSound(JAISoundID param_0, JAISoundHandle* param_1, - JGeometry::TVec3 const* param_2, u32 param_3, - f32 param_4, f32 param_5, f32 param_6, f32 param_7, - f32 param_8, u32 param_9) { - // NONMATCHING +// NONMATCHING stack alloc +bool Z2LinkSoundStarter::startSound(JAISoundID i_soundID, JAISoundHandle* param_1, + JGeometry::TVec3 const* param_2, u32 param_3, + f32 param_4, f32 param_5, f32 param_6, f32 param_7, + f32 param_8, u32 param_9) { + bool bVar2 = false; + bool bVar3 = false; + + if (Z2GetLink()->isInWater() && Z2GetStatusMgr()->getCameraInWaterDepthRatio() > 0.0f) { + switch (i_soundID) { + case Z2SE_AL_SWIM: + case Z2SE_AL_DIVE_SWIM: + i_soundID = Z2SE_AL_SWIM_UNDERWATER; + break; + case Z2SE_AL_SWORD_SWING_S: + case Z2SE_AL_FINISH_SWING1: + case Z2SE_AL_FINISH_SWING2: + case Z2SE_AL_WAIT_SWORD_SWING: + i_soundID = Z2SE_AL_WATER_STROKE_S; + break; + case Z2SE_AL_SWORD_SWING_L: + i_soundID = Z2SE_AL_WATER_STROKE_L; + break; + case Z2SE_AL_SWORD_THRUST: + i_soundID = Z2SE_AL_WATER_STROKE_FAST; + break; + case Z2SE_AL_KAITENGIRI: + i_soundID = Z2SE_AL_WATER_STROKE_CIRCLE; + break; + } + } + + if (i_soundID.mId.mBytes.b1 == 3 && param_3 > 26) { + if (param_3 == 44) { + param_3 = 23; + } else { + param_3 = 0; + } + } + + switch (i_soundID) { + case Z2SE_AL_INTO_WATER: + case Z2SE_AL_DIVE_INTO_WATER: + case Z2SE_WL_INTO_WATER: + if (Z2GetLink()->mSoundObjSimple1.isActive()) { + Z2GetLink()->mSoundObjSimple1.stopAllSounds(1); + } + break; + case Z2SE_FN_WALK_DUMMY: + case Z2SE_FN_LADDER_CLIMB: + case Z2SE_FN_LADDER_DOWN: + bVar2 = true; + // fallthrough + case Z2SE_GORON_FOOTNOTE: + case Z2SE_FN_GOB_JUMP: + if (Z2GetLink()->mLinkBootsType == 1) { + i_soundID = Z2SE_FN_WALK_HEAVY; + if (Z2GetLink()->mMagnetized) { + param_3 = 127; + } + } + bVar3 = true; + break; + case Z2SE_FN_JUMP_DUMMY: + bVar2 = true; + bVar3 = true; + if (Z2GetLink()->mLinkBootsType == 1) { + i_soundID = Z2SE_FN_JUMP_HEAVY; + if (Z2GetLink()->mMagnetized) { + param_3 = 127; + } + } + if (Z2GetLink()->mSoundObjSimple1.getHandleSoundID(Z2SE_AL_V_FALL) != NULL) { + Z2GetLink()->startLinkVoice(Z2SE_AL_V_FOOT_MISS, -1); + } + break; + case Z2SE_FN_BOUND_DUMMY: + case Z2SE_FN_HAND_DUMMY: + bVar2 = true; + break; + case Z2SE_BODY_FALL_DOWN: + if (Z2GetLink()->mSoundObjSimple1.getHandleSoundID(Z2SE_AL_V_FALL) != NULL) { + Z2GetLink()->startLinkVoice(Z2SE_AL_V_LANDING_FAIL, -1); + } + break; + case Z2SE_OBJ_ARROW_SHOT_NORMAL: + case Z2SE_OBJ_ARROW_SHOT_GAIN: + case Z2SE_OBJ_ARROWBOMB_SHOT: + case Z2SE_OBJ_ARROWBOMB_SHOTGAIN: + Z2SoundHandlePool* handle = Z2GetLink()->mSoundObjAnime.getHandleSoundID(Z2SE_AL_DRAW_BOW); + if (handle != NULL) { + (*handle)->stop(0); + } + break; + } + + if (Z2GetLink()->mSinkDepth > 0) { + switch (i_soundID) { + case Z2SE_FN_WALK_DUMMY: + case Z2SE_FN_JUMP_DUMMY: + case Z2SE_FN_BOUND_DUMMY: + case Z2SE_FN_HAND_DUMMY: + case Z2SE_FN_WALK_HEAVY: + case Z2SE_FN_JUMP_HEAVY: + case Z2SE_WL_WALK_L_DUMMY: + case Z2SE_WL_WALK_R_DUMMY: + case Z2SE_WL_RUN_L_DUMMY: + case Z2SE_WL_RUN_R_DUMMY: + if (param_3 == 3) { + param_5 *= Z2Calc::linearTransform(Z2GetLink()->mSinkDepth, + 0.0f, 127.0f, 1.0f, 0.5f, true); + } else if (param_3 == 25) { + param_5 *= Z2Calc::linearTransform(Z2GetLink()->mSinkDepth, + 0.0f, 23.0f, 1.0f, 0.7f, true); + } + break; + } + } + + bool ret = Z2SoundStarter::startSound(i_soundID, param_1, param_2, param_3, param_4, param_5, + param_6, param_7, param_8, param_9); + + if (bVar2 && Z2GetSceneMgr()->getDemoSeWaveNum() != 114) { + if (Z2GetLink()->mFlag5) { + Z2GetLink()->startLinkSound(Z2SE_AL_SWORD_SHIELD_ADD, 0, param_4 * 127.0f); + } + + if (Z2GetLink()->mUsingIronBall) { + Z2GetLink()->startLinkSound(Z2SE_AL_IB_CHAIN_ADD, 0, param_4 * 127.0f); + } + + if (Z2GetLink()->mKanteraState != 0) { + Z2SoundHandlePool* handle = + Z2GetLink()->mKantera.startSound(Z2SE_AL_KANTERA_SWING_ADD, 0, param_4 * 127.0f); + if (Z2GetLink()->mKanteraState == 2 && handle != NULL && *handle) { + (*handle)->getAuxiliary().moveVolume(0.6f, 0); + (*handle)->getAuxiliary().movePitch(0.9f, 0); + } + } + } + + if (bVar3) { + if (Z2GetLink()->mLinkState == 4) { + Z2GetLink()->startLinkSound(Z2SE_FN_ARMER_LIGHT_ADD, 0, param_4 * 127.0f); + } else if (Z2GetLink()->mLinkState == 5) { + Z2GetLink()->startLinkSound(Z2SE_FN_ARMER_HEAVY_ADD, 0, param_4 * 127.0f); + } + } + + return ret; } /* 802C4FFC-802C5078 2BF93C 007C+00 0/0 0/0 3/3 .text __ct__14Z2CreatureRideFv */ @@ -441,14 +681,9 @@ Z2CreatureRide::Z2CreatureRide() : Z2RideSoundStarter(this) { setSoundStarter(this); } -/* 802C5078-802C5114 2BF9B8 009C+00 1/0 0/0 0/0 .text __dt__18Z2RideSoundStarterFv */ -inline Z2RideSoundStarter::~Z2RideSoundStarter() { - // NONMATCHING -} - /* 802C5114-802C51EC 2BFA54 00D8+00 2/1 0/0 2/2 .text __dt__14Z2CreatureRideFv */ Z2CreatureRide::~Z2CreatureRide() { - // NONMATCHING + deleteObject(); } /* 802C51EC-802C520C 2BFB2C 0020+00 1/0 0/0 0/0 .text deleteObject__14Z2CreatureRideFv */ @@ -475,61 +710,133 @@ Z2RideSoundStarter::Z2RideSoundStarter(Z2CreatureRide* ride) : Z2SoundStarter(fa /* 802C5284-802C54B8 2BFBC4 0234+00 2/0 0/0 0/0 .text * startSound__18Z2RideSoundStarterF10JAISoundIDP14JAISoundHandlePCQ29JGeometry8TVec3UlfffffUl */ -bool Z2RideSoundStarter::startSound(JAISoundID param_0, JAISoundHandle* param_1, - JGeometry::TVec3 const* param_2, u32 param_3, - f32 param_4, f32 param_5, f32 param_6, f32 param_7, - f32 param_8, u32 param_9) { - // NONMATCHING +// NONMATCHING regalloc / extra load +bool Z2RideSoundStarter::startSound(JAISoundID i_soundID, JAISoundHandle* param_1, + JGeometry::TVec3 const* param_2, u32 param_3, + f32 param_4, f32 param_5, f32 param_6, f32 param_7, + f32 param_8, u32 param_9) { + if (!Z2GetSceneMgr()->isInGame()) { + return false; + } + + u8 uVar3 = 0; + switch (i_soundID) { + case Z2SE_HS_WALK_L_DUMMY: + case Z2SE_HS_WALK_R_DUMMY: + case Z2SE_HS_TROT_L_DUMMY: + case Z2SE_HS_TROT_R_DUMMY: + case Z2SE_HS_GALLOP_L_DUMMY: + uVar3 = 1; + break; + case Z2SE_WB_FRONT_L_DUMMY: + case Z2SE_WB_FRONT_R_DUMMY: + case Z2SE_WB_REAR_L_DUMMY: + uVar3 = 2; + break; + } + + bool ret = Z2SoundStarter::startSound(i_soundID, param_1, param_2, param_3, param_4, param_5, + param_6, param_7, param_8, param_9); + + if (mRide->isLinkRiding() && uVar3 != 0) { + if (Z2GetLink()->mFlag5) { + Z2GetLink()->startLinkSound(Z2SE_AL_SWORD_SHIELD_ADD, 0, param_4 * 127.0f); + } + + if (Z2GetLink()->mKanteraState != 0) { + Z2SoundHandlePool* handle = + Z2GetLink()->mKantera.startSound(Z2SE_AL_KANTERA_SWING_ADD, 0, param_4 * 127.0f); + if (Z2GetLink()->mKanteraState == 2 && handle != NULL && *handle) { + (*handle)->getAuxiliary().moveVolume(0.6f, 0); + (*handle)->getAuxiliary().movePitch(0.9f, 0); + } + } + + switch (uVar3) { + case 1: + Z2GetLink()->startLinkSound(Z2SE_AL_HARNESS_ADD_HS, 0, param_4 * 127.0f); + break; + + case 2: + Z2GetLink()->startLinkSound(Z2SE_AL_HARNESS_ADD_WB, 0, param_4 * 127.0f); + break; + } + } + + return ret; } /* 802C54B8-802C54FC 2BFDF8 0044+00 0/0 0/0 1/1 .text __ct__15Z2SoundObjCoachFv */ Z2SoundObjCoach::Z2SoundObjCoach() { - // NONMATCHING + field_0x20 = 0.0f; } /* 802C54FC-802C551C 2BFE3C 0020+00 1/0 0/0 0/0 .text init__15Z2SoundObjCoachFP3VecUc */ -void Z2SoundObjCoach::init(Vec* param_0, u8 param_1) { - // NONMATCHING +void Z2SoundObjCoach::init(Vec* i_soundPos, u8 i_numHandles) { + Z2SoundObjBase::init(i_soundPos, i_numHandles); } -/* ############################################################################################## */ -/* 80455D20-80455D24 004320 0004+00 1/1 0/0 0/0 .sdata2 @4621 */ -SECTION_SDATA2 static f32 lit_4621 = 2.0f; - -/* 80455D24-80455D28 004324 0004+00 1/1 0/0 0/0 .sdata2 @4622 */ -SECTION_SDATA2 static f32 lit_4622 = 35.0f; - -/* 80455D28-80455D2C 004328 0004+00 1/1 0/0 0/0 .sdata2 @4623 */ -SECTION_SDATA2 static f32 lit_4623 = 22.0f / 25.0f; - -/* 80455D2C-80455D30 00432C 0004+00 3/3 0/0 0/0 .sdata2 @4624 */ -SECTION_SDATA2 static f32 lit_4624 = 1.25f; - -/* 80455D30-80455D34 004330 0004+00 2/2 0/0 0/0 .sdata2 @4625 */ -SECTION_SDATA2 static f32 lit_4625 = 50.0f; - /* 802C551C-802C56C0 2BFE5C 01A4+00 0/0 0/0 1/1 .text startWheelSound__15Z2SoundObjCoachFf */ -void Z2SoundObjCoach::startWheelSound(f32 param_0) { - // NONMATCHING +Z2SoundHandlePool* Z2SoundObjCoach::startWheelSound(f32 param_0) { + Z2SoundHandlePool* handle = NULL; + + if (!(param_0 < 2.0f)) { + if (param_0 < 35.0f) { + handle = startLevelSound(Z2SE_COACH_WHEEL_ROLL_A, 0, -1); + if (handle != NULL && *handle) { + f32 pitch = Z2Calc::getParamByExp(param_0, 0.0f, 35.0f, 0.25f, 0.88f, 1.25f, + Z2Calc::CURVE_SIGN_1); + (*handle)->getAuxiliary().movePitch(pitch, 0); + f32 volume = Z2Calc::getParamByExp(param_0, 0.0f, 35.0f, 0.3f, 0.7f, 1.0f, + Z2Calc::CURVE_SIGN_1); + (*handle)->getAuxiliary().moveVolume(volume, 0); + } + } else { + handle = startLevelSound(Z2SE_COACH_WHEEL_ROLL_B, 0, -1); + if (handle != NULL && *handle) { + f32 pitch = Z2Calc::getParamByExp(param_0, 35.0f, 50.0f, 0.25f, 0.88f, 1.25f, + Z2Calc::CURVE_SIGN_1); + (*handle)->getAuxiliary().movePitch(pitch, 0); + f32 volume = Z2Calc::getParamByExp(param_0, 35.0f, 50.0f, 0.3f, 0.8f, 1.0f, + Z2Calc::CURVE_SIGN_1); + (*handle)->getAuxiliary().moveVolume(volume, 0); + } + } + } + + field_0x20 = param_0; + return handle; } -/* ############################################################################################## */ -/* 80455D34-80455D38 004334 0004+00 1/1 0/0 0/0 .sdata2 @4645 */ -SECTION_SDATA2 static f32 lit_4645 = 1500.0f; - -/* 80455D38-80455D3C 004338 0004+00 2/2 0/0 0/0 .sdata2 @4646 */ -SECTION_SDATA2 static f32 lit_4646 = 1.0f / 5.0f; - -/* 80455D3C-80455D40 00433C 0004+00 2/2 0/0 0/0 .sdata2 @4647 */ -SECTION_SDATA2 static f32 lit_4647 = 17.0f / 20.0f; - /* 802C56C0-802C57C0 2C0000 0100+00 0/0 0/0 1/1 .text startFireSound__15Z2SoundObjCoachFUs */ -void Z2SoundObjCoach::startFireSound(u16 param_0) { - // NONMATCHING +Z2SoundHandlePool* Z2SoundObjCoach::startFireSound(u16 param_0) { + Z2SoundHandlePool* handle = startLevelSound(Z2SE_COACH_FIRE, 0, -1); + + if (handle != NULL && *handle) { + f32 pitch = Z2Calc::getParamByExp(param_0, 0.0f, 1500.0f, 0.2f, 0.85f, 1.25f, + Z2Calc::CURVE_SIGN_1); + (*handle)->getAuxiliary().movePitch(pitch, 0); + f32 volume = Z2Calc::getParamByExp(param_0, 0.0f, 1500.0f, 0.2f, 0.6f, 1.0f, + Z2Calc::CURVE_SIGN_1); + (*handle)->getAuxiliary().moveVolume(volume, 0); + } + + return handle; } /* 802C57C0-802C588C 2C0100 00CC+00 1/0 0/0 0/0 .text * startSound__15Z2SoundObjCoachF10JAISoundIDUlSc */ -int Z2SoundObjCoach::startSound(JAISoundID param_0, u32 param_1, s8 param_2) { - // NONMATCHING +Z2SoundHandlePool* Z2SoundObjCoach::startSound(JAISoundID i_soundID, u32 param_1, s8 param_2) { + Z2SoundHandlePool* handle = Z2SoundObjBase::startSound(i_soundID, param_1, param_2); + + if (handle != NULL && *handle && i_soundID == Z2SE_COACH_SHAKE) { + f32 pitch = Z2Calc::getParamByExp(field_0x20, 0.0f, 50.0f, 0.2f, 0.85f, 1.25f, + Z2Calc::CURVE_SIGN_1); + (*handle)->getAuxiliary().movePitch(pitch, 0); + f32 volume = Z2Calc::getParamByExp(field_0x20, 0.0f, 50.0f, 0.2f, 0.8f, 1.0f, + Z2Calc::CURVE_SIGN_1); + (*handle)->getAuxiliary().moveVolume(volume, 0); + } + + return handle; } diff --git a/src/Z2AudioLib/Z2Param.cpp b/src/Z2AudioLib/Z2Param.cpp index 2cefa6e907f..a720929182e 100644 --- a/src/Z2AudioLib/Z2Param.cpp +++ b/src/Z2AudioLib/Z2Param.cpp @@ -167,7 +167,3 @@ u8 struct_80451341; u8 struct_80451342; u8 pad_80451344[4]; #pragma pop - -/* 80451348-80451350 000848 0008+00 0/0 4/4 0/0 .sbss None */ -extern u8 data_80451348[8]; -u8 data_80451348[8]; \ No newline at end of file diff --git a/src/Z2AudioLib/Z2SeMgr.cpp b/src/Z2AudioLib/Z2SeMgr.cpp index 4c3a4c76552..b5886c6a3f8 100644 --- a/src/Z2AudioLib/Z2SeMgr.cpp +++ b/src/Z2AudioLib/Z2SeMgr.cpp @@ -6,49 +6,14 @@ #include "Z2AudioLib/Z2SeMgr.h" #include "Z2AudioLib/Z2Audience.h" #include "Z2AudioLib/Z2Calc.h" +#include "Z2AudioLib/Z2LinkMgr.h" #include "Z2AudioLib/Z2SoundMgr.h" #include "Z2AudioLib/Z2SceneMgr.h" #include "Z2AudioLib/Z2SpeechMgr2.h" #include "Z2AudioLib/Z2StatusMgr.h" #include "Z2AudioLib/Z2Param.h" #include "Z2AudioLib/Z2SeqMgr.h" -#include "dol2asm.h" - -// -// Forward References: -// - -extern "C" void __ct__7Z2SeMgrFv(); -extern "C" void __ct__12Z2MultiSeObjFv(); -extern "C" void initSe__7Z2SeMgrFv(); -extern "C" void resetModY__7Z2SeMgrFv(); -extern "C" void modHeightAtCamera__7Z2SeMgrFPPC3Vec(); -extern "C" void incrCrowdSize__7Z2SeMgrFv(); -extern "C" void decrCrowdSize__7Z2SeMgrFv(); -extern "C" void seStart__7Z2SeMgrF10JAISoundIDPC3VecUlScffffUc(); -extern "C" void seStartLevel__7Z2SeMgrF10JAISoundIDPC3VecUlScffffUc(); -extern "C" void seStop__7Z2SeMgrF10JAISoundIDUl(); -extern "C" void seStopAll__7Z2SeMgrFUl(); -extern "C" void seMoveVolumeAll__7Z2SeMgrFfUl(); -extern "C" void messageSePlay__7Z2SeMgrFUsP3VecSc(); -extern "C" void talkInSe__7Z2SeMgrFv(); -extern "C" void talkOutSe__7Z2SeMgrFv(); -extern "C" void menuInSe__7Z2SeMgrFv(); -extern "C" void setLevObjSE__7Z2SeMgrFUlP3VecSc(); -extern "C" void setMultiTriggerSE__7Z2SeMgrFUlP3VecSc(); -extern "C" void processSeFramework__7Z2SeMgrFv(); -extern "C" void isLevelSe__7Z2SeMgrF10JAISoundID(); -extern "C" void isSoundCulling__7Z2SeMgrF10JAISoundID(); -extern "C" void __ct__12Z2MultiSeMgrFv(); -extern "C" void __dt__12Z2MultiSeMgrFv(); -extern "C" void registMultiSePos__12Z2MultiSeMgrFP3Vec(); -extern "C" void resetMultiSePos__12Z2MultiSeMgrFv(); -extern "C" void getPanPower__12Z2MultiSeMgrFv(); -extern "C" void getDolbyPower__12Z2MultiSeMgrFv(); - -// -// Declarations: -// +#include "JSystem/J3DU/J3DUD.h" /* 802AB64C-802AB710 2A5F8C 00C4+00 0/0 1/1 0/0 .text __ct__7Z2SeMgrFv */ Z2SeMgr::Z2SeMgr() : JASGlobalInstance(this), mSoundHandles(mSoundHandle, 0x18) { @@ -145,12 +110,12 @@ void Z2SeMgr::decrCrowdSize() { /* 802AB984-802AC50C 2A62C4 0B88+00 1/1 196/196 549/549 .text * seStart__7Z2SeMgrF10JAISoundIDPC3VecUlScffffUc */ -// NONMATCHING something is wrong with the switch, also isMovieDemo needs to not get inlined bool Z2SeMgr::seStart(JAISoundID i_soundID, Vec const* i_pos, u32 param_2, s8 i_reverb, f32 i_pitch, f32 i_volume, f32 i_pan, f32 i_dolby, u8 param_8) { if (i_soundID == 0xffffffff) { return false; } + if (param_8 != 1) { switch (i_soundID) { case Z2SE_OBJ_L8_STAIR_ON: @@ -165,6 +130,7 @@ bool Z2SeMgr::seStart(JAISoundID i_soundID, Vec const* i_pos, u32 param_2, s8 i_ return false; } } + switch (i_soundID) { case Z2SE_QUIT_GAME: Z2GetStatusMgr()->menuOut(); @@ -177,7 +143,7 @@ bool Z2SeMgr::seStart(JAISoundID i_soundID, Vec const* i_pos, u32 param_2, s8 i_ seStop(JA_SE_OBJ_STN_DOOR_MOVE_D, 0); break; case JA_SE_OBJ_STN_DOOR_STOP_D: - seStop(JA_SE_OBJ_STN_DOOR_STOP_D, 0); + seStop(JA_SE_OBJ_STN_DOOR_MOVE_U, 0); seStop(JA_SE_OBJ_STN_DOOR_MOVE_D, 0); break; case JA_SE_OBJ_STN_DOOR_MOVE_D: @@ -185,6 +151,7 @@ bool Z2SeMgr::seStart(JAISoundID i_soundID, Vec const* i_pos, u32 param_2, s8 i_ seStop(JA_SE_OBJ_STN_DOOR_MOVE_U, 0); seStop(JA_SE_OBJ_STN_DOOR_MOVE_D, 0); break; + case Z2SE_OBJ_WOOD_DOOR_ROLLOPEN: case Z2SE_OBJ_WOOD_DOOR_ROLLOPEN2: case Z2SE_OBJ_WOOD_DR_OP_MDN: case Z2SE_OBJ_WOOD_DR_OP_MDN_FX: @@ -193,11 +160,10 @@ bool Z2SeMgr::seStart(JAISoundID i_soundID, Vec const* i_pos, u32 param_2, s8 i_ seStop(Z2SE_OBJ_WOOD_DOOR_ROLLCLOSE, 0); break; case Z2SE_OBJ_WOOD_DOOR_CLOSE_STOP: - seStop(Z2SE_OBJ_WOOD_DOOR_CLOSE_STOP, 0); + seStop(Z2SE_OBJ_WOOD_DOOR_ROLLOPEN, 0); seStop(Z2SE_OBJ_WOOD_DOOR_ROLLOPEN2, 0); seStop(Z2SE_OBJ_WOOD_DOOR_ROLLCLOSE, 0); break; - case Z2SE_OBJ_WOOD_DOOR_ROLLOPEN: case Z2SE_OBJ_WOOD_DOOR_ROLLCLOSE: case Z2SE_OBJ_WOOD_DOOR_OPEN_STOP: seStop(Z2SE_OBJ_WOOD_DOOR_ROLLOPEN, 0); @@ -314,12 +280,13 @@ bool Z2SeMgr::seStart(JAISoundID i_soundID, Vec const* i_pos, u32 param_2, s8 i_ i_volume = Z2Calc::getParamByExp(param_2, 0.0f, 41.0f, 0.4f, 0.3f, 1.0f, Z2Calc::CURVE_SIGN_2); break; - case Z2SE_OBJ_L8_B_FOG_FLY: + case Z2SE_OBJ_L8_B_FOG_FLY: { Vec tmp = Z2GetAudience()->getAudioCamPos(0); if (i_pos->y > tmp.y) { return false; } break; + } case Z2SE_OBJ_BLN_BREAK_S: case Z2SE_OBJ_BLN_BREAK_M: case Z2SE_OBJ_BLN_BREAK_L: @@ -354,157 +321,387 @@ bool Z2SeMgr::seStart(JAISoundID i_soundID, Vec const* i_pos, u32 param_2, s8 i_ i_soundID = Z2SE_OBJ_DARK_GATE_RIPPLE_WLF; } break; + case Z2SE_OBJ_ARMOR_SWING: + case Z2SE_OBJ_ARMOR_HIT: + break; } + if (isLevelSe(i_soundID)) { return seStartLevel(i_soundID, i_pos, param_2, i_reverb, i_pitch, i_volume, i_pan, i_dolby, param_8); } + if (isSoundCulling(i_soundID)) { return false; } + JAISoundHandle* handle = mSoundHandles.getFreeHandle(); if (handle == NULL) { return false; } + return Z2GetSoundStarter()->startSound(i_soundID, handle, (JGeometry::TVec3*)i_pos, param_2, i_reverb / 127.0f, i_pitch, i_volume, i_pan, i_dolby, 0); } -/* ############################################################################################## */ -/* 803C9D98-803C9DF8 -00001 0060+00 1/1 0/0 0/0 .data @4619 */ -SECTION_DATA static void* lit_4619[24] = { - (void*)(((char*)seStartLevel__7Z2SeMgrF10JAISoundIDPC3VecUlScffffUc) + 0xF78), - (void*)(((char*)seStartLevel__7Z2SeMgrF10JAISoundIDPC3VecUlScffffUc) + 0xF78), - (void*)(((char*)seStartLevel__7Z2SeMgrF10JAISoundIDPC3VecUlScffffUc) + 0xF78), - (void*)(((char*)seStartLevel__7Z2SeMgrF10JAISoundIDPC3VecUlScffffUc) + 0xF78), - (void*)(((char*)seStartLevel__7Z2SeMgrF10JAISoundIDPC3VecUlScffffUc) + 0xF84), - (void*)(((char*)seStartLevel__7Z2SeMgrF10JAISoundIDPC3VecUlScffffUc) + 0xF90), - (void*)(((char*)seStartLevel__7Z2SeMgrF10JAISoundIDPC3VecUlScffffUc) + 0xF9C), - (void*)(((char*)seStartLevel__7Z2SeMgrF10JAISoundIDPC3VecUlScffffUc) + 0xFA8), - (void*)(((char*)seStartLevel__7Z2SeMgrF10JAISoundIDPC3VecUlScffffUc) + 0xFB4), - (void*)(((char*)seStartLevel__7Z2SeMgrF10JAISoundIDPC3VecUlScffffUc) + 0xFC0), - (void*)(((char*)seStartLevel__7Z2SeMgrF10JAISoundIDPC3VecUlScffffUc) + 0xFCC), - (void*)(((char*)seStartLevel__7Z2SeMgrF10JAISoundIDPC3VecUlScffffUc) + 0xFD8), - (void*)(((char*)seStartLevel__7Z2SeMgrF10JAISoundIDPC3VecUlScffffUc) + 0x1028), - (void*)(((char*)seStartLevel__7Z2SeMgrF10JAISoundIDPC3VecUlScffffUc) + 0x1028), - (void*)(((char*)seStartLevel__7Z2SeMgrF10JAISoundIDPC3VecUlScffffUc) + 0x1028), - (void*)(((char*)seStartLevel__7Z2SeMgrF10JAISoundIDPC3VecUlScffffUc) + 0x1028), - (void*)(((char*)seStartLevel__7Z2SeMgrF10JAISoundIDPC3VecUlScffffUc) + 0x1028), - (void*)(((char*)seStartLevel__7Z2SeMgrF10JAISoundIDPC3VecUlScffffUc) + 0x1028), - (void*)(((char*)seStartLevel__7Z2SeMgrF10JAISoundIDPC3VecUlScffffUc) + 0xFE4), - (void*)(((char*)seStartLevel__7Z2SeMgrF10JAISoundIDPC3VecUlScffffUc) + 0xFF0), - (void*)(((char*)seStartLevel__7Z2SeMgrF10JAISoundIDPC3VecUlScffffUc) + 0xFFC), - (void*)(((char*)seStartLevel__7Z2SeMgrF10JAISoundIDPC3VecUlScffffUc) + 0x1008), - (void*)(((char*)seStartLevel__7Z2SeMgrF10JAISoundIDPC3VecUlScffffUc) + 0x1014), - (void*)(((char*)seStartLevel__7Z2SeMgrF10JAISoundIDPC3VecUlScffffUc) + 0x1020), -}; - -/* 804558E8-804558EC 003EE8 0004+00 1/1 0/0 0/0 .sdata2 @4586 */ -SECTION_SDATA2 static f32 lit_4586 = 25.0f; - -/* 804558EC-804558F0 003EEC 0004+00 1/1 0/0 0/0 .sdata2 @4587 */ -SECTION_SDATA2 static f32 lit_4587 = 1.0f / 10.0f; - -/* 804558F0-804558F4 003EF0 0004+00 1/1 0/0 0/0 .sdata2 @4588 */ -SECTION_SDATA2 static f32 lit_4588 = 10.0f; - -/* 804558F4-804558F8 003EF4 0004+00 1/1 0/0 0/0 .sdata2 @4589 */ -SECTION_SDATA2 static f32 lit_4589 = 2.0f; - -/* 804558F8-80455900 003EF8 0004+04 2/2 0/0 0/0 .sdata2 @4590 */ -SECTION_SDATA2 static f32 lit_4590[1 + 1 /* padding */] = { - 13.0f / 10.0f, - /* padding */ - 0.0f, -}; - -/* 80455900-80455908 003F00 0008+00 1/1 0/0 0/0 .sdata2 @4591 */ -SECTION_SDATA2 static f64 lit_4591 = 0.7; - -/* 80455908-80455910 003F08 0008+00 1/1 0/0 0/0 .sdata2 @4592 */ -SECTION_SDATA2 static f64 lit_4592 = 0.0006; - -/* 80455910-80455918 003F10 0008+00 1/1 0/0 0/0 .sdata2 @4593 */ -SECTION_SDATA2 static f64 lit_4593 = 1.0; - -/* 80455918-80455920 003F18 0008+00 1/1 0/0 0/0 .sdata2 @4594 */ -SECTION_SDATA2 static f64 lit_4594 = 0.0015; - -/* 80455920-80455928 003F20 0008+00 1/1 0/0 0/0 .sdata2 @4595 */ -SECTION_SDATA2 static f64 lit_4595 = 0.005; - -/* 80455928-80455930 003F28 0008+00 1/1 0/0 0/0 .sdata2 @4596 */ -SECTION_SDATA2 static f64 lit_4596 = 0.3; - -/* 80455930-80455938 003F30 0008+00 1/1 0/0 0/0 .sdata2 @4597 */ -SECTION_SDATA2 static f64 lit_4597 = 0.001; - -/* 80455938-8045593C 003F38 0004+00 1/1 0/0 0/0 .sdata2 @4598 */ -SECTION_SDATA2 static f32 lit_4598 = 4000.0f; - -/* 8045593C-80455940 003F3C 0004+00 1/1 0/0 0/0 .sdata2 @4599 */ -SECTION_SDATA2 static f32 lit_4599 = 3500.0f; - -/* 80455940-80455944 003F40 0004+00 1/1 0/0 0/0 .sdata2 @4600 */ -SECTION_SDATA2 static f32 lit_4600 = 26.0f; - -/* 80455944-80455948 003F44 0004+00 1/1 0/0 0/0 .sdata2 @4601 */ -SECTION_SDATA2 static f32 lit_4601 = 3.0f / 5.0f; - -/* 80455948-8045594C 003F48 0004+00 1/1 0/0 0/0 .sdata2 @4602 */ -SECTION_SDATA2 static f32 lit_4602 = 64.0f; - -/* 8045594C-80455950 003F4C 0004+00 1/1 0/0 0/0 .sdata2 @4603 */ -SECTION_SDATA2 static f32 lit_4603 = 4500.0f; - -/* 80455950-80455954 003F50 0004+00 1/1 0/0 0/0 .sdata2 @4604 */ -SECTION_SDATA2 static f32 lit_4604 = 40.0f; - -/* 80455954-80455958 003F54 0004+00 1/1 0/0 0/0 .sdata2 @4605 */ -SECTION_SDATA2 static f32 lit_4605 = 120.0f; - -/* 80455958-80455960 003F58 0004+04 1/1 0/0 0/0 .sdata2 @4606 */ -SECTION_SDATA2 static f32 lit_4606[1 + 1 /* padding */] = { - 5.0f, - /* padding */ - 0.0f, -}; - -/* 80455960-80455968 003F60 0008+00 1/1 0/0 0/0 .sdata2 @4607 */ -SECTION_SDATA2 static f64 lit_4607 = 0.5; - -/* 80455968-80455970 003F68 0008+00 1/1 0/0 0/0 .sdata2 @4608 */ -SECTION_SDATA2 static f64 lit_4608 = 3.0; - -/* 80455970-80455978 003F70 0008+00 1/1 0/0 0/0 .sdata2 @4609 */ -SECTION_SDATA2 static u8 lit_4609[8] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; - -/* 80455978-8045597C 003F78 0004+00 1/1 0/0 0/0 .sdata2 @4610 */ -SECTION_SDATA2 static f32 lit_4610 = 2000.0f; - -/* 8045597C-80455980 003F7C 0004+00 1/1 0/0 0/0 .sdata2 @4611 */ -SECTION_SDATA2 static f32 lit_4611 = 5000.0f; - -/* 80455980-80455984 003F80 0004+00 1/1 0/0 0/0 .sdata2 @4612 */ -SECTION_SDATA2 static f32 lit_4612 = 9.0f / 20.0f; - -/* 80455984-80455988 003F84 0004+00 1/1 0/0 0/0 .sdata2 @4613 */ -SECTION_SDATA2 static f32 lit_4613 = 50.0f; - -/* 80455988-8045598C 003F88 0004+00 1/1 0/0 0/0 .sdata2 @4614 */ -SECTION_SDATA2 static f32 lit_4614 = 600.0f; - -/* 8045598C-80455990 003F8C 0004+00 1/1 0/0 0/0 .sdata2 @4615 */ -SECTION_SDATA2 static f32 lit_4615 = 90.0f; - /* 802AC50C-802AD8B0 2A6E4C 13A4+00 3/2 19/19 199/199 .text * seStartLevel__7Z2SeMgrF10JAISoundIDPC3VecUlScffffUc */ -bool Z2SeMgr::seStartLevel(JAISoundID param_0, Vec const* param_1, u32 param_2, s8 param_3, - f32 param_4, f32 param_5, f32 param_6, f32 param_7, u8 param_8) { - // NONMATCHING +bool Z2SeMgr::seStartLevel(JAISoundID i_soundID, Vec const* i_pos, u32 param_2, s8 i_reverb, + f32 i_pitch, f32 i_volume, f32 i_pan, f32 i_dolby, u8 param_8) { + if (param_8 != 1) { + switch (i_soundID) { + case Z2SE_OBJ_FIRE_BURNING: + if (Z2GetStatusMgr()->getDemoStatus() == 2 || !Z2GetSceneMgr()->isInGame()) { + return false; + } + // fallthrough + case Z2SE_FAIRY_S_LV: + case Z2SE_EN_ZZ_MV: + case Z2SE_OBJ_L8_L_BALL_SW: + case Z2SE_OBJ_GANON_BARRIER: + case Z2SE_OBJ_CRVN_BURNING: + setLevObjSE(i_soundID, const_cast(i_pos), i_reverb); + return false; + } + } + + switch (i_soundID) { + case Z2SE_OBJ_FLAG_TRAILING: + i_volume = Z2Calc::getParamByExp(param_2, 25.0f, 127.0f, 0.4f, 0.1f, 1.0f, + Z2Calc::CURVE_SIGN_0); + i_pitch = Z2Calc::getParamByExp(param_2, 25.0f, 127.0f, 0.4f, 0.7f, 1.2f, + Z2Calc::CURVE_SIGN_0); + break; + case Z2SE_OBJ_BRIDGE_TRAILING: + case Z2SE_OBJ_BROKENBRIDGE: + i_volume = Z2Calc::getParamByExp(param_2, 0.0f, 127.0f, 0.4f, 0.1f, 1.0f, + Z2Calc::CURVE_SIGN_0); + i_pitch = Z2Calc::getParamByExp(param_2, 0.0f, 127.0f, 0.4f, 0.7f, 1.2f, + Z2Calc::CURVE_SIGN_0); + break; + case Z2SE_OBJ_BOOMSHTR_SWITCH: + if (param_2 < 10) { + param_2 = 10; + } + i_volume = Z2Calc::getParamByExp(param_2, 10.0f, 127.0f, 2.0f, 0.0f, 1.0f, + Z2Calc::CURVE_SIGN_1); + i_pitch = Z2Calc::getParamByExp(param_2, 10.0f, 127.0f, 2.0f, 0.7f, 1.2f, + Z2Calc::CURVE_SIGN_1); + break; + case Z2SE_OBJ_FAN_WIND_S: + modHeightAtCamera(&i_pos); + break; + case Z2SE_OBJ_FAN_ROLL_S: + case Z2SE_OBJ_FAN_ROLL_M: + case Z2SE_OBJ_FAN_ROLL_L: + if (param_2 < 10) { + param_2 = 10; + } + i_volume = Z2Calc::getParamByExp(param_2, 10.0f, 127.0f, 2.0f, 0.0f, 1.0f, + Z2Calc::CURVE_SIGN_1); + i_pitch = Z2Calc::getParamByExp(param_2, 10.0f, 127.0f, 2.0f, 0.7f, 1.2f, + Z2Calc::CURVE_SIGN_1); + break; + case Z2SE_OBJ_AMI_ROLL: + if (param_2 < 10) { + param_2 = 10; + } + i_volume = Z2Calc::getParamByExp(param_2, 10.0f, 127.0f, 2.0f, 0.0f, 1.0f, + Z2Calc::CURVE_SIGN_1); + i_pitch = Z2Calc::getParamByExp(param_2, 10.0f, 127.0f, 2.0f, 0.7f, 1.2f, + Z2Calc::CURVE_SIGN_1); + break; + case Z2SE_OBJ_BRDG_MOVE: + i_pitch = Z2Calc::getParamByExp(param_2, 0.0f, 127.0f, 2.0f, 0.7f, 1.2f, + Z2Calc::CURVE_SIGN_1); + break; + case Z2SE_ENV_WIND_SARUDAN: + i_volume = Z2Calc::getParamByExp(param_2, 25.0f, 127.0f, 0.4f, 0.4f, 1.0f, + Z2Calc::CURVE_SIGN_0); + i_pitch = Z2Calc::getParamByExp(param_2, 25.0f, 127.0f, 0.4f, 0.8f, 1.0f, + Z2Calc::CURVE_SIGN_0); + break; + case Z2SE_OBJ_CHANDLV9_SWING: + if (param_2 < 10) { + param_2 = 10; + } + i_volume = Z2Calc::getParamByExp(param_2, 10.0f, 127.0f, 2.0f, 0.0f, 1.0f, + Z2Calc::CURVE_SIGN_1); + i_pitch = Z2Calc::getParamByExp(param_2, 10.0f, 127.0f, 2.0f, 0.7f, 1.2f, + Z2Calc::CURVE_SIGN_1); + break; + case Z2SE_OBJ_BOMB_HOUSE_BURN: + if (param_2 > 300) { + seStartLevel(Z2SE_OBJ_BOMB_HOUSE_BURN_S, NULL, param_2, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0); + } + if (param_2 > 500) { + i_volume = 1.0f; + i_pitch = 1.3f; + } else { + i_volume = param_2 * 0.0006 + 0.7; + i_pitch = param_2 * 0.0006 + 1.0; + } + break; + case Z2SE_OBJ_BOMB_HOUSE_BURN_S: + if (param_2 > 500) { + i_volume = 1.0f; + i_pitch = (param_2 - 500) * 0.0015 + 1.0; + } else if (param_2 < 300) { + i_volume = 0.0f; + } else { + i_volume = (param_2 - 300) * 0.005; + } + break; + case Z2SE_OBJ_WTR_CLMN_UP: + if (param_2 <= 500) { + i_pitch = 0.8f; + } else if (param_2 > 500 && param_2 <= 1000) { + i_pitch = 1.0f; + } else if (param_2 > 1000 && param_2 <= 1500) { + i_pitch = 1.0f; + } else { + i_pitch = 1.2f; + } + modHeightAtCamera(&i_pos); + break; + case Z2SE_OBJ_WTR_CLMN_DOWN: + if (param_2 > 700) { + i_pitch = 1.0f; + } else { + i_pitch = param_2 * 0.001 + 0.3; + } + modHeightAtCamera(&i_pos); + break; + case Z2SE_OBJ_STN_SPRL_RAIL: + case Z2SE_OBJ_STN_SPRL_RAIL_DW: + modHeightAtCamera(&i_pos); + break; + case Z2SE_OBJ_SPNR_GEAR_S: + i_volume = Z2Calc::getParamByExp(param_2, 0.0f, 4000.0f, 0.4f, 0.3f, 1.0f, + Z2Calc::CURVE_SIGN_0); + i_pitch = Z2Calc::getParamByExp(param_2, 0.0f, 4000.0f, 0.4f, 0.7f, 1.2f, + Z2Calc::CURVE_SIGN_0); + break; + case Z2SE_OBJ_SPNR_GEAR_L: + i_volume = Z2Calc::getParamByExp(param_2, 0.0f, 3500.0f, 0.4f, 0.3f, 1.0f, + Z2Calc::CURVE_SIGN_0); + i_pitch = Z2Calc::getParamByExp(param_2, 0.0f, 3500.0f, 0.4f, 0.7f, 1.2f, + Z2Calc::CURVE_SIGN_0); + break; + case Z2SE_OBJ_TOGE_SPIN: + i_volume = Z2Calc::getParamByExp(param_2, 0.0f, 26.0f, 0.4f, 0.6f, 1.0f, + Z2Calc::CURVE_SIGN_0); + i_pitch = Z2Calc::getParamByExp(param_2, 0.0f, 26.0f, 0.4f, 0.8f, 1.2f, + Z2Calc::CURVE_SIGN_0); + break; + case Z2SE_OBJ_STN_WL_RL: + case Z2SE_OBJ_STN_WL_RL_OP: + i_volume = Z2Calc::getParamByExp(param_2, 0.0f, 64.0f, 0.4f, 0.3f, 1.0f, + Z2Calc::CURVE_SIGN_0); + i_pitch = Z2Calc::getParamByExp(param_2, 0.0f, 64.0f, 0.4f, 0.6f, 1.2f, + Z2Calc::CURVE_SIGN_0); + break; + case Z2SE_OBJ_SPNR_SW_RL: + i_volume = Z2Calc::getParamByExp(param_2, 0.0f, 4500.0f, 0.4f, 0.6f, 1.0f, + Z2Calc::CURVE_SIGN_0); + i_pitch = Z2Calc::getParamByExp(param_2, 0.0f, 4500.0f, 0.4f, 0.7f, 1.2f, + Z2Calc::CURVE_SIGN_0); + break; + case Z2SE_OBJ_TOGE_ROLL_MV: + i_volume = Z2Calc::getParamByExp(param_2, 0.0f, 40.0f, 0.4f, 0.0f, 1.0f, + Z2Calc::CURVE_SIGN_0); + i_pitch = Z2Calc::getParamByExp(param_2, 0.0f, 40.0f, 0.4f, 0.8f, 1.2f, + Z2Calc::CURVE_SIGN_0); + break; + case Z2SE_OBJ_L8_L_TORCH_SW: + i_volume = Z2Calc::getParamByExp(param_2, 0.0f, 120.0f, 0.4f, 0.0f, 1.0f, + Z2Calc::CURVE_SIGN_0); + i_pitch = Z2Calc::getParamByExp(param_2, 0.0f, 120.0f, 0.4f, 0.9f, 1.0f, + Z2Calc::CURVE_SIGN_0); + break; + case Z2SE_OBJ_L8_B_FOG_STAY: + i_volume = Z2Calc::getParamByExp(param_2, 0.0f, 100.0f, 0.4f, 0.0f, 1.0f, + Z2Calc::CURVE_SIGN_0); + break; + case Z2SE_OBJ_L8_B_FALL_S: + i_volume = Z2Calc::getParamByExp(param_2, 0.0f, 100.0f, 0.4f, 0.0f, 1.0f, + Z2Calc::CURVE_SIGN_0); + break; + case Z2SE_OBJ_L8_B_FALL_L: + i_volume = Z2Calc::getParamByExp(param_2, 0.0f, 100.0f, 0.4f, 0.0f, 1.0f, + Z2Calc::CURVE_SIGN_0); + break; + case Z2SE_OBJ_L8_L_LIFT_MV: + i_volume = Z2Calc::getParamByExp(param_2, 0.0f, 5.0f, 0.4f, 0.5f, 1.0f, + Z2Calc::CURVE_SIGN_0); + i_pitch = Z2Calc::getParamByExp(param_2, 0.0f, 5.0f, 0.4f, 0.7f, 1.0f, + Z2Calc::CURVE_SIGN_0); + break; + case Z2SE_OBJ_AMATA_CRK: + i_volume = Z2Calc::getParamByExp(param_2, 0.0f, 400.0f, 0.4f, 0.5f, 1.0f, + Z2Calc::CURVE_SIGN_0); + i_pitch = Z2Calc::getParamByExp(param_2, 0.0f, 400.0f, 0.4f, 0.8f, 1.1f, + Z2Calc::CURVE_SIGN_0); + break; + case Z2SE_OBJ_HYRULE_BARRIER: + if (Z2GetSceneMgr()->getCurrentSceneNum() != 0x16) { + break; + } + // fallthrough + case Z2SE_OBJ_DARK_GATE: + if (!Z2GetSceneMgr()->isInDarkness() && i_pos != NULL + && Z2GetLink() != NULL && Z2GetLink()->getCurrentPos() != NULL) + { + f32 dist = sqrtf(VECSquareDistance(i_pos, Z2GetLink()->getCurrentPos())); + f32 gate_volume = 1.0f; + if (dist < 2000.0f) { + gate_volume = 0.0f; + } else if (dist < 4000.0f) { + gate_volume = Z2Calc::getParamByExp(dist, 2000.0f, 5000.0f, 0.45f, 0.0f, 1.0f, + Z2Calc::CURVE_SIGN_0); + } + Z2GetSeqMgr()->setTwilightGateVol(gate_volume); + } + break; + case Z2SE_OBJ_HASU_WTR: + i_volume = Z2Calc::getParamByExp(param_2, 0.0f, 50.0f, 0.4f, 0.5f, 1.0f, + Z2Calc::CURVE_SIGN_0); + break; + case Z2SE_ENV_PEOPLE_CROWD: { + f32 scale = 1.0f; + if (Z2GetSceneMgr()->getCurrentRoomNum() == 3) { + scale = Z2Calc::linearTransform(J3DUD::JMAAbs(Z2GetLink()->getCurrentPos()->x), + 600.0f, 3500.0f, 1.0f, 0.1f, false); + } + switch (Z2GetStatusMgr()->getHour()) { + case 0: + case 1: + case 2: + case 3: + scale *= 0.1f; + break; + case 4: + scale *= 0.2f; + break; + case 5: + scale *= 0.3f; + break; + case 6: + scale *= 0.4f; + break; + case 7: + scale *= 0.5f; + break; + case 8: + scale *= 0.6f; + break; + case 9: + scale *= 0.7f; + break; + case 10: + scale *= 0.8f; + break; + case 11: + scale *= 0.9f; + break; + case 18: + scale *= 0.9f; + break; + case 19: + scale *= 0.8f; + break; + case 20: + scale *= 0.7f; + break; + case 21: + scale *= 0.5f; + break; + case 22: + scale *= 0.4f; + break; + case 23: + scale *= 0.2f; + break; + } + i_volume = Z2Calc::getParamByExp(mCrowdSize * scale, 5.0f, 90.0f, 0.2f, 0.0f, 1.0f, + Z2Calc::CURVE_SIGN_0); + break; + } + case Z2SE_AL_COPYROD_WAIT: + param_2++; + break; + } + + for (int i = 0; i < 24; i++) { + if (mSoundHandles[i] && mSoundHandles[i]->getID() == i_soundID + && i_pos == (Vec*)mSoundHandles[i]->getUserData()) + { + if (param_8 == 1) { + i_volume = Z2GetAudience()->calcOffMicSound(i_volume); + } + + mSoundHandles[i]->updateLifeTime(1); + + if (i_pos != NULL) { + mSoundHandles[i]->setPos((JGeometry::TVec3)*i_pos); + } + + if (param_2 != 0) { + JAISoundHandle* handle = &mSoundHandles[i]; + Z2GetSoundStarter()->setPortData(handle, 6, param_2, -1); + } + + if (i_reverb != 0) { + mSoundHandles[i]->getAuxiliary().moveFxMix(i_reverb / 127.0f, 0); + } + if (i_pitch != 1.0f) { + mSoundHandles[i]->getAuxiliary().movePitch(i_pitch, 0); + } + if (i_volume != 1.0f) { + mSoundHandles[i]->getAuxiliary().moveVolume(i_volume, 0); + } + if (i_pan != -1.0f) { + mSoundHandles[i]->getAuxiliary().movePan(i_pan, 0); + } + if (i_dolby != -1.0f) { + mSoundHandles[i]->getAuxiliary().moveDolby(i_dolby, 0); + } + + return true; + } + } + + if (isSoundCulling(i_soundID)) { + return false; + } + + JAISoundHandle* handle = mSoundHandles.getFreeHandle(); + if (handle == NULL) { + return false; + } + + bool ret = Z2GetSoundStarter()->startSound(i_soundID, handle, (JGeometry::TVec3*)i_pos, + param_2, i_reverb / 127.0f, i_pitch, i_volume, + i_pan, i_dolby, false); + + if (handle != NULL && *handle) { + if (i_soundID == Z2SE_OBJ_BOMB_HOUSE_BURN) { + Z2GetSeqMgr()->bgmStart(Z2BGM_EVENT02, 0, 0); + } + + if (param_8 == 1) { + Z2GetAudience()->calcOffMicSound(i_volume); + } + + (*handle)->setUserData((u32)i_pos); + + if (ret) { + (*handle)->setLifeTime(1, false); + } + } + + return ret; } /* 802AD8B0-802AD94C 2A81F0 009C+00 1/1 0/0 4/4 .text seStop__7Z2SeMgrF10JAISoundIDUl */ diff --git a/src/Z2AudioLib/Z2SeqMgr.cpp b/src/Z2AudioLib/Z2SeqMgr.cpp index 0be99b8f335..6a57686328d 100644 --- a/src/Z2AudioLib/Z2SeqMgr.cpp +++ b/src/Z2AudioLib/Z2SeqMgr.cpp @@ -4,7 +4,7 @@ // #include "Z2AudioLib/Z2SeqMgr.h" -#include "Z2AudioLib/Z2Creature.h" +#include "Z2AudioLib/Z2LinkMgr.h" #include "Z2AudioLib/Z2Param.h" #include "Z2AudioLib/Z2SceneMgr.h" #include "Z2AudioLib/Z2SoundMgr.h" diff --git a/src/Z2AudioLib/Z2SoundHandles.cpp b/src/Z2AudioLib/Z2SoundHandles.cpp index b351939a2b2..68804a6d017 100644 --- a/src/Z2AudioLib/Z2SoundHandles.cpp +++ b/src/Z2AudioLib/Z2SoundHandles.cpp @@ -19,7 +19,6 @@ void Z2SoundHandles::initHandlesPool(u8 pNumHandles) { } /* 802AB120-802AB200 2A5A60 00E0+00 1/1 1/1 0/0 .text deleteHandlesPool__14Z2SoundHandlesFv */ -// NONMATCHING JASPoolAllocObject<_> locations void Z2SoundHandles::deleteHandlesPool() { JSULink* link; while (link = getFirst(), link != NULL) { @@ -60,7 +59,6 @@ Z2SoundHandlePool* Z2SoundHandles::getHandleUserData(u32 pUserData) { /* 802AB2D8-802AB3D0 2A5C18 00F8+00 0/0 3/3 0/0 .text getFreeHandle__14Z2SoundHandlesFv */ -// NONMATCHING JASPoolAllocObject<_> locations Z2SoundHandlePool* Z2SoundHandles::getFreeHandle() { JSULink* link; for (link = getFirst(); link != NULL; link = link->getNext()) { @@ -133,7 +131,6 @@ bool Z2SoundHandles::isActive() const { /* 802AB538-802AB64C 2A5E78 0114+00 0/0 1/1 0/0 .text * setPos__14Z2SoundHandlesFRCQ29JGeometry8TVec3 */ -// NONMATCHING JASPoolAllocObject<_> locations void Z2SoundHandles::setPos(JGeometry::TVec3 const& param_0) { JSULink* link; for (link = getFirst(); link != NULL; link = link->getNext()) { diff --git a/src/Z2AudioLib/Z2SoundObjMgr.cpp b/src/Z2AudioLib/Z2SoundObjMgr.cpp index 45023dccd7c..47d0d36c150 100644 --- a/src/Z2AudioLib/Z2SoundObjMgr.cpp +++ b/src/Z2AudioLib/Z2SoundObjMgr.cpp @@ -8,6 +8,7 @@ #include "Z2AudioLib/Z2SeqMgr.h" #include "Z2AudioLib/Z2Calc.h" #include "Z2AudioLib/Z2SceneMgr.h" +#include "Z2AudioLib/Z2LinkMgr.h" /* 802BF920-802BF980 2BA260 0060+00 0/0 1/1 0/0 .text __ct__13Z2SoundObjMgrFv */ Z2SoundObjMgr::Z2SoundObjMgr() : JASGlobalInstance(this) { diff --git a/src/Z2AudioLib/Z2SpeechMgr2.cpp b/src/Z2AudioLib/Z2SpeechMgr2.cpp index 02a77b8c1c6..14647ae15c0 100644 --- a/src/Z2AudioLib/Z2SpeechMgr2.cpp +++ b/src/Z2AudioLib/Z2SpeechMgr2.cpp @@ -4,14 +4,12 @@ // #include "Z2AudioLib/Z2SpeechMgr2.h" +#include "Z2AudioLib/Z2AudioMgr.h" +#include "Z2AudioLib/Z2EnvSeMgr.h" #include "Z2AudioLib/Z2SceneMgr.h" #include "Z2AudioLib/Z2SeMgr.h" #include "JSystem/JMath/JMath.h" -// -// Types: -// - typedef struct { const u8* field_0x0; const u8* field_0x4; @@ -60,386 +58,6 @@ struct Z2MdnPrm { static u8 const sDesideTail[8]; }; -/* 802CBC60-802CBCEC 2C65A0 008C+00 0/0 1/1 0/0 .text __ct__12Z2SpeechMgr2Fv */ -Z2SpeechMgr2::Z2SpeechMgr2() : JASGlobalInstance(true), random(0) { - field_0x3f8 = 0; - field_0x3fa = -1; - field_0x3fc = 0; - field_0x3fe = 0; - field_0x3ff = 0; - field_0x401 = 0; - for (int i = 0; i < 64; i++) { - field_0x402[i] = -1; - } -} - -/* 802CBD88-802CBF60 2C66C8 01D8+00 1/0 1/1 0/0 .text setString__12Z2SpeechMgr2FPCUssUcUs - */ -void Z2SpeechMgr2::setString(u16 const* param_1, s16 param_2, u8 param_3, u16 param_4) { - switch (param_3) { - case 0x13: - case 0x15: - field_0x3fe = 1; - break; - case 0x12: - case 0x14: - field_0x3fe = 2; - break; - case 4: - case '\a': - case '\n': - case 0x16: - case 0x19: - case 0x1d: - case '!': - case '$': - case ')': - case ',': - case '-': - case '2': - case '3': - case '?': - case '@': - case 'A': - case 'S': - case 'T': - case 'U': - case 'Y': - case 'Z': - case '[': - case '\\': - case '`': - case 'a': - case 'b': - case 'c': - case 'd': - field_0x3fe = 12; - break; - case 0x1e: - case 0x1f: - case '\"': - case '%': - case '\'': - case '=': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - field_0x3fe = 13; - break; - case '7': - case '8': - case '9': - case ':': - case ';': - case '<': - case 'l': - case 'm': - field_0x3fe = 14; - break; - case '/': - field_0x3fe = 15; - break; - case 0x0f: - case 0x10: - case '4': - case '5': - case '6': - case 'p': - field_0x3fe = 16; - break; - case 0x0e: - case 'B': - case 'D': - field_0x3fe = 17; - break; - case '\f': - field_0x3fe = 18; - break; - case '\t': - case '&': - case 'o': - field_0x3fe = 30; - break; - case '\b': - field_0x3fe = 31; - break; - case 0: - case 1: - case 2: - case 3: - field_0x3fe = 99; - return; - case 'q': - default: - field_0x3fe = 11; - break; - } - if ((field_0x3fe == 1) || (field_0x3fe == 2)) { - if (param_4 == 0) { - field_0x3fc = 0; - } else { - if (param_4 > 0x11) { - if ((field_0x3fe == 21) || (field_0x3fe == 20)) { - field_0x3fc = 0; - } - } else { - field_0x3fc = param_4 - 1; - } - } - } else { - field_0x3fc = param_4; - } - for (int i = 0; i < 500; i++) { - field_0x10[i] = 0; - } - - if (param_2 > 500) { - field_0x3f8 = 500; - JUT_WARN(387, "TOO MANY TEXT : now(%d) > max(%d)", param_2, 500); - } else { - field_0x3f8 = param_2; - } - for (int i = 0; i < field_0x3f8; i++) { - field_0x10[i] = param_1[i]; - } - field_0x3fa = 0; - field_0x3ff = 0; - field_0x400 = 0; - field_0x401 = 0; - for (int i = 0; i < 64; i++) { - field_0x402[i] = -1; - } - selectUnit(false); -} - -/* 80455EE0-80455EE8 0044E0 0006+02 1/0 0/0 0/0 .sdata2 sBoringTail__8Z2MdnPrm */ -u8 const Z2MdnPrm::sBoringTail[6] = { - 0x92, 0x58, 0x59, 0x5B, 0x70, 0x71, -}; - -/* 80455EE8-80455EF0 0044E8 0006+02 1/0 0/0 0/0 .sdata2 sOrderTail__8Z2MdnPrm */ -u8 const Z2MdnPrm::sOrderTail[6] = { - 0x60, 0xA8, 0x5B, 0x4E, 0x5D, 0x87, -}; - -/* 80455EF0-80455EF8 0044F0 0005+03 1/0 0/0 0/0 .sdata2 sResentTail__8Z2MdnPrm */ -u8 const Z2MdnPrm::sResentTail[5] = { - 0x4A, 0x98, 0x8A, 0x7E, 0x57, -}; - -/* 80455EF8-80455F00 0044F8 0008+00 1/0 0/0 0/0 .sdata2 sCheerfulTail__8Z2MdnPrm */ -u8 const Z2MdnPrm::sCheerfulTail[8] = { - 0x60, 0x6D, 0x4D, 0x44, 0x9C, 0x54, 0x70, 0x7B, -}; - -/* 80455F00-80455F08 004500 0005+03 1/0 0/0 0/0 .sdata2 sConfusedTail__8Z2MdnPrm */ -u8 const Z2MdnPrm::sConfusedTail[5] = { - 0x2C, 0x42, 0x4C, 0x7C, 0x49, -}; - -/* 80455F08-80455F10 004508 0007+01 1/0 0/0 0/0 .sdata2 sHostilityTail__8Z2MdnPrm */ -u8 const Z2MdnPrm::sHostilityTail[7] = { - 0x97, 0x67, 0x94, 0x6A, 0x66, 0x4F, 0x6A, -}; - -/* 80455F10-80455F18 004510 0008+00 1/0 0/0 0/0 .sdata2 sTiredTail__8Z2MdnPrm */ -u8 const Z2MdnPrm::sTiredTail[8] = { - 0x66, 0x6F, 0x3B, 0x7A, 0x49, 0x91, 0x5C, 0x6A, -}; - -/* 80455F18-80455F20 004518 0007+01 1/0 0/0 0/0 .sdata2 sSeriousTail__8Z2MdnPrm */ -u8 const Z2MdnPrm::sSeriousTail[7] = { - 0x7B, 0x69, 0x4B, 0x61, 0x52, 0x59, 0x87, -}; - -/* 80455F20-80455F28 004520 0007+01 1/0 0/0 0/0 .sdata2 sReplybTail__8Z2MdnPrm */ -u8 const Z2MdnPrm::sReplybTail[7] = { - 0x4F, 0x4A, 0xA2, 0x4F, 0x65, 0x98, 0x5C, -}; - -/* 80455F28-80455F30 004528 0008+00 1/0 0/0 0/0 .sdata2 sDesideTail__8Z2MdnPrm */ -u8 const Z2MdnPrm::sDesideTail[8] = { - 0x64, 0x2E, 0x4A, 0x57, 0x80, 0x48, 0x7C, 0x5F, -}; - -/* 802CBF60-802CC190 2C68A0 0230+00 1/0 2/2 0/0 .text setTextCount__12Z2SpeechMgr2Fs */ -void Z2SpeechMgr2::setTextCount(s16 param_0) { - if (field_0x3fe != 0x63) { - field_0x3ff = 0x0; - param_0 = (param_0 == 0) ? 0 : param_0 - 1; - bool bVar1 = false; - if (field_0x3fa == 0 && param_0 >= field_0x3f8) { - bVar1 = true; - } - field_0x3fa = param_0; - if (field_0x3fa >= field_0x3f8) { - field_0x3fa = field_0x3f8; - } - if ((field_0x3fe == 1) || (field_0x3fe == 2)) { - if (!field_0x0.isSoundAttached()) { - speakOneWord(false); - } - } else if (bVar1) { - if (field_0x3fc == 0) { - mSpeech.startSound(0x7a, &field_0x4, NULL, 0, 0.0f, 1.0f, 1.0f, -1.0f, - -1.0f, 0); - } - } else { - if (!isNonVerbal() ) { - JAISoundID aJStack_18; - switch (field_0x3fe) { - case 0xb: - aJStack_18 = Z2SE_SY_TEXT_OUT; - break; - case 0xc: - aJStack_18 = Z2SE_SY_TEXT_OUT_FEMALE; - break; - case 0xd: - aJStack_18 = Z2SE_SY_TEXT_OUT_CHILD; - break; - case 0xe: - aJStack_18 = Z2SE_SY_TEXT_OUT_GORON; - break; - case 0xf: - aJStack_18 = Z2SE_SY_TEXT_OUT_ZORA; - break; - case 0x10: - aJStack_18 = Z2SE_SY_TEXT_OUT_GREY; - break; - case 0x11: - aJStack_18 = Z2SE_SY_TEXT_OUT_SPIRIT; - break; - case 0x12: - aJStack_18 = Z2SE_SY_TEXT_OUT_BRAVE; - break; - case 0x1e: - aJStack_18 = Z2SE_SY_TEXT_OUT_GANON; - break; - case 0x1f: - aJStack_18 = Z2SE_SY_TEXT_OUT_ZANT; - break; - } - mSpeech.startSound(aJStack_18, &field_0x4, NULL, 0, 0.0f, 1.0f, 1.0f, -1.0f, -1.0f, - 0); - } - } - } -} - -/* 802CC190-802CC2FC 2C6AD0 016C+00 1/1 1/1 0/0 .text speakOneWord__12Z2SpeechMgr2Fb */ -void Z2SpeechMgr2::speakOneWord(bool param_0) { - if (Z2GetSceneMgr()->isSceneExist() && (field_0x3fe == 1 || field_0x3fe == 2) && - field_0x400 == 0 && field_0x3ff <= 30) - { - if (field_0x3fa >= field_0x3f8) { - selectTail(); - field_0x400 = 1; - } else if (isNonVerbal()) { - return; - } - u32 sound = field_0x3fc + 0x500a1; - f32 fVar1 = Z2GetSceneMgr()->getRoomReverb() / 127.0f; - mSpeech.startSound(sound, &field_0x0, NULL, 0, - fVar1, 1.0f, 1.0f, -1.0f, -1.0f, 0); - mSpeech.setPortData(&field_0x0, 8, field_0x402[field_0x401 - 1] + 1, -1); - if (field_0x400 == 0) { - selectUnit(param_0); - } - } -} - - -/* 802CC2FC-802CC4C0 2C6C3C 01C4+00 2/2 0/0 0/0 .text isNonVerbal__12Z2SpeechMgr2Fv */ -bool Z2SpeechMgr2::isNonVerbal() { - switch(field_0x10[field_0x3fa]) { - case 0: - case 0x20: - case 0x21: - case 0x22: - case 0x23: - case 0x24: - case 0x25: - case 0x26: - case 0x27: - case 0x28: - case 0x29: - case 0x2a: - case 0x2b: - case 0x2c: - case 0x2d: - case 0x2e: - case 0x2f: - case 0x3a: - case 0x3b: - case 0x3c: - case 0x3d: - case 0x3e: - case 0x3f: - case 0x4b: - case 0x4c: - case 0x4d: - case 0x4e: - case 0x4f: - case 0x5b: - case 0x5c: - case 0x5d: - case 0x5e: - case 0x5f: - case 0x813f: - case 0x8140: - case 0x8141: - case 0x8142: - case 0x8143: - case 0x8144: - case 0x8145: - case 0x8146: - case 0x8147: - case 0x8148: - case 0x8149: - case 0x814a: - case 0x814b: - case 0x8151: - case 0x815e: - case 0x8162: - case 0x8166: - case 0x8168: - case 0x8169: - case 0x816a: - case 0x816d: - case 0x816e: - case 0x816f: - case 0x8170: - case 0x8171: - case 0x8172: - case 0x8175: - case 0x8176: - case 0x817b: - case 0x817c: - case 0x8181: - case 0x818f: - case 0x8190: - case 0x8193: - case 0x8194: - case 0x8195: - case 0x8196: - return true; - } - - if(field_0x10[field_0x3fa] == 10) { - switch (field_0x3fe) { - case 1: - case 2: - return false; - default: - return true; - } - } - return false; -} - /* 8039C260-8039C2C4 0288C0 0064+00 1/0 0/0 0/0 .rodata sReply__8Z2MdnPrm */ u8 const Z2MdnPrm::sReply[100] = { 0x6A, 0x8A, 0x50, 0x5F, 0x53, 0x37, 0x37, 0x4F, 0x4F, 0x5E, 0xAA, 0x46, 0x52, 0x5A, 0x5A, @@ -514,6 +132,11 @@ u8 const Z2MdnPrm::sBoring[108] = { 0x5B, 0x5E, 0x70, 0x56, 0x56, 0x4C, 0x4C, 0x59, 0x59, 0x5B, 0x5B, 0x71, }; +/* 80455EE0-80455EE8 0044E0 0006+02 1/0 0/0 0/0 .sdata2 sBoringTail__8Z2MdnPrm */ +u8 const Z2MdnPrm::sBoringTail[6] = { + 0x92, 0x58, 0x59, 0x5B, 0x70, 0x71, +}; + /* 8039C48C-8039C4EC 028AEC 005E+02 1/0 0/0 0/0 .rodata sIrritated__8Z2MdnPrm */ u8 const Z2MdnPrm::sIrritated[94] = { 0x6C, 0x91, 0x67, 0x8B, 0x8B, 0xA2, 0xA2, 0xAB, 0x48, 0x64, 0x73, 0x61, 0x61, 0x64, 0x64, 0x6D, @@ -541,6 +164,11 @@ u8 const Z2MdnPrm::sOrder[114] = { 0x48, 0x48, 0x69, 0x69, 0x6D, 0x6D, 0x94, 0x94, 0x97, }; +/* 80455EE8-80455EF0 0044E8 0006+02 1/0 0/0 0/0 .sdata2 sOrderTail__8Z2MdnPrm */ +u8 const Z2MdnPrm::sOrderTail[6] = { + 0x60, 0xA8, 0x5B, 0x4E, 0x5D, 0x87, +}; + /* 8039C56C-8039C5D8 028BCC 006A+02 1/0 0/0 0/0 .rodata sResent__8Z2MdnPrm */ u8 const Z2MdnPrm::sResent[106] = { 0x6F, 0x5F, 0x5F, 0x66, 0x66, 0x66, 0x66, 0x55, 0x55, 0x55, 0x55, 0x4B, 0x4B, 0x6B, 0x6B, 0x86, @@ -552,6 +180,11 @@ u8 const Z2MdnPrm::sResent[106] = { 0x5E, 0xAA, 0xAA, 0x9E, 0x9E, 0x5A, 0x5A, 0x57, 0x57, 0x57, }; +/* 80455EF0-80455EF8 0044F0 0005+03 1/0 0/0 0/0 .sdata2 sResentTail__8Z2MdnPrm */ +u8 const Z2MdnPrm::sResentTail[5] = { + 0x4A, 0x98, 0x8A, 0x7E, 0x57, +}; + /* 8039C5D8-8039C644 028C38 006A+02 1/0 0/0 0/0 .rodata sCheerful__8Z2MdnPrm */ u8 const Z2MdnPrm::sCheerful[106] = { 0x64, 0x6D, 0x6D, 0x6D, 0x99, 0x6D, 0x40, 0x51, 0x51, 0x6F, 0x6F, 0x66, 0x66, 0x60, 0xA7, 0xAF, @@ -563,6 +196,11 @@ u8 const Z2MdnPrm::sCheerful[106] = { 0x65, 0x70, 0x6B, 0x6B, 0x6B, 0x6D, 0x6D, 0x57, 0x57, 0x7B, }; +/* 80455EF8-80455F00 0044F8 0008+00 1/0 0/0 0/0 .sdata2 sCheerfulTail__8Z2MdnPrm */ +u8 const Z2MdnPrm::sCheerfulTail[8] = { + 0x60, 0x6D, 0x4D, 0x44, 0x9C, 0x54, 0x70, 0x7B, +}; + /* 8039C644-8039C6B0 028CA4 006A+02 1/0 0/0 0/0 .rodata sConfused__8Z2MdnPrm */ u8 const Z2MdnPrm::sConfused[106] = { 0x83, 0x80, 0x80, 0x82, 0x82, 0x82, 0x82, 0x5B, 0x75, 0x84, 0x84, 0x84, 0x84, 0x75, 0x75, 0x62, @@ -574,6 +212,11 @@ u8 const Z2MdnPrm::sConfused[106] = { 0x38, 0x38, 0x38, 0x83, 0x83, 0x8E, 0x8E, 0x4C, 0x56, 0x56, }; +/* 80455F00-80455F08 004500 0005+03 1/0 0/0 0/0 .sdata2 sConfusedTail__8Z2MdnPrm */ +u8 const Z2MdnPrm::sConfusedTail[5] = { + 0x2C, 0x42, 0x4C, 0x7C, 0x49, +}; + /* 8039C6B0-8039C718 028D10 0068+00 1/0 0/0 0/0 .rodata sHostility__8Z2MdnPrm */ u8 const Z2MdnPrm::sHostility[104] = { 0x85, 0x71, 0x71, 0x73, 0x73, 0x3B, 0x62, 0x84, 0x94, 0x94, 0x94, 0xAF, 0x98, 0xAD, 0xAD, @@ -585,6 +228,11 @@ u8 const Z2MdnPrm::sHostility[104] = { 0x62, 0x6A, 0x5F, 0x72, 0x72, 0x62, 0x62, 0x65, 0x5E, 0x69, 0x69, 0x63, 0x63, 0x7F, }; +/* 80455F08-80455F10 004508 0007+01 1/0 0/0 0/0 .sdata2 sHostilityTail__8Z2MdnPrm */ +u8 const Z2MdnPrm::sHostilityTail[7] = { + 0x97, 0x67, 0x94, 0x6A, 0x66, 0x4F, 0x6A, +}; + /* 8039C718-8039C784 028D78 006A+02 1/0 0/0 0/0 .rodata sTired__8Z2MdnPrm */ u8 const Z2MdnPrm::sTired[106] = { 0x70, 0x70, 0x70, 0x5C, 0x5C, 0x5C, 0x6F, 0x6F, 0x6F, 0x93, 0x8C, 0x9A, 0x9D, 0x89, 0x99, 0x7A, @@ -596,6 +244,11 @@ u8 const Z2MdnPrm::sTired[106] = { 0x84, 0x6D, 0x6D, 0x6A, 0x6A, 0x8D, 0x8D, 0x8D, 0x8D, 0x3B, }; +/* 80455F10-80455F18 004510 0008+00 1/0 0/0 0/0 .sdata2 sTiredTail__8Z2MdnPrm */ +u8 const Z2MdnPrm::sTiredTail[8] = { + 0x66, 0x6F, 0x3B, 0x7A, 0x49, 0x91, 0x5C, 0x6A, +}; + /* 8039C784-8039C7F0 028DE4 006A+02 1/0 0/0 0/0 .rodata sSerious__8Z2MdnPrm */ u8 const Z2MdnPrm::sSerious[106] = { 0x52, 0x65, 0x65, 0x72, 0x5A, 0x61, 0x61, 0x7B, 0x80, 0x92, 0x93, 0x9D, 0x9D, 0x70, 0x79, 0x76, @@ -607,6 +260,11 @@ u8 const Z2MdnPrm::sSerious[106] = { 0x70, 0x60, 0x3C, 0x81, 0x81, 0x92, 0x92, 0x8E, 0x98, 0x87, }; +/* 80455F18-80455F20 004518 0007+01 1/0 0/0 0/0 .sdata2 sSeriousTail__8Z2MdnPrm */ +u8 const Z2MdnPrm::sSeriousTail[7] = { + 0x7B, 0x69, 0x4B, 0x61, 0x52, 0x59, 0x87, +}; + /* 8039C7F0-8039C844 028E50 0054+00 1/0 0/0 0/0 .rodata sReplyb__8Z2MdnPrm */ u8 const Z2MdnPrm::sReplyb[84] = { 0x5C, 0x45, 0x45, 0x71, 0x9F, 0x57, 0xB4, 0xB4, 0x56, 0x62, 0x8E, 0x61, 0x61, 0xB0, @@ -617,6 +275,11 @@ u8 const Z2MdnPrm::sReplyb[84] = { 0x44, 0x4F, 0x52, 0x58, 0x5A, 0x6F, 0x6E, 0x8A, 0x8E, 0x8E, 0x8E, 0x8C, 0x8C, 0x9B, }; +/* 80455F20-80455F28 004520 0007+01 1/0 0/0 0/0 .sdata2 sReplybTail__8Z2MdnPrm */ +u8 const Z2MdnPrm::sReplybTail[7] = { + 0x4F, 0x4A, 0xA2, 0x4F, 0x65, 0x98, 0x5C, +}; + /* 8039C844-8039C8A8 028EA4 0064+00 1/0 0/0 0/0 .rodata sApologize__8Z2MdnPrm */ u8 const Z2MdnPrm::sApologize[100] = { 0x6A, 0x6A, 0x6A, 0x51, 0x51, 0x51, 0x51, 0x51, 0x51, 0x51, 0x57, 0x57, 0x57, 0x63, 0x61, @@ -644,6 +307,11 @@ u8 const Z2MdnPrm::sDeside[100] = { 0x75, 0x6A, 0x66, 0x76, 0x69, 0x69, 0x69, 0x60, 0x60, 0x5F, }; +/* 80455F28-80455F30 004528 0008+00 1/0 0/0 0/0 .sdata2 sDesideTail__8Z2MdnPrm */ +u8 const Z2MdnPrm::sDesideTail[8] = { + 0x64, 0x2E, 0x4A, 0x57, 0x80, 0x48, 0x7C, 0x5F, +}; + /* 8039C918-8039C980 028F78 0068+00 1/0 0/0 0/0 .rodata sAfford__8Z2MdnPrm */ u8 const Z2MdnPrm::sAfford[104] = { 0x4E, 0x45, 0x52, 0x5B, 0x56, 0x5B, 0x59, 0x52, 0x52, 0x57, 0x5C, 0x50, 0x50, 0x49, 0x80, @@ -681,74 +349,472 @@ sPrmStruct const Z2MdnPrm::sPrm[17] = { { Z2MdnPrm::sAfford, Z2MdnPrm::sAffordTail, 0x34, 0x02, 0x0A, 0x00}, }; +/* 802CBC60-802CBCEC 2C65A0 008C+00 0/0 1/1 0/0 .text __ct__12Z2SpeechMgr2Fv */ +Z2SpeechMgr2::Z2SpeechMgr2() : JASGlobalInstance(true), random(0) { + mTextNum = 0; + mTextCount = -1; + mMood = 0; + mVoice = 0; + field_0x3ff = 0; + field_0x401 = 0; + for (int i = 0; i < 64; i++) { + field_0x402[i] = -1; + } +} + +/* 802CBD88-802CBF60 2C66C8 01D8+00 1/0 1/1 0/0 .text setString__12Z2SpeechMgr2FPCUssUcUs + */ +void Z2SpeechMgr2::setString(u16 const* i_text, s16 i_textNum, u8 i_speaker, u16 i_mood) { + switch (i_speaker) { + case 0x13: + case 0x15: + mVoice = 1; + break; + case 0x12: + case 0x14: + mVoice = 2; + break; + case 0x04: + case 0x07: + case 0x0a: + case 0x16: + case 0x19: + case 0x1d: + case 0x21: + case 0x24: + case 0x29: + case 0x2c: + case 0x2d: + case 0x32: + case 0x33: + case 0x3f: + case 0x40: + case 0x41: + case 0x53: + case 0x54: + case 0x55: + case 0x59: + case 0x5a: + case 0x5b: + case 0x5c: + case 0x60: + case 0x61: + case 0x62: + case 0x63: + case 0x64: + mVoice = 12; + break; + case 0x1e: + case 0x1f: + case 0x22: + case 0x25: + case 0x27: + case 0x3d: + case 0x65: + case 0x66: + case 0x67: + case 0x68: + case 0x69: + case 0x6a: + mVoice = 13; + break; + case 0x37: + case 0x38: + case 0x39: + case 0x3a: + case 0x3b: + case 0x3c: + case 0x6c: + case 0x6d: + mVoice = 14; + break; + case 0x2f: + mVoice = 15; + break; + case 0x0f: + case 0x10: + case 0x34: + case 0x35: + case 0x36: + case 0x70: + mVoice = 16; + break; + case 0x0e: + case 0x42: + case 0x44: + mVoice = 17; + break; + case 0x0c: + mVoice = 18; + break; + case 0x09: + case 0x26: + case 0x6f: + mVoice = 30; + break; + case 0x08: + mVoice = 31; + break; + case 0x00: + case 0x01: + case 0x02: + case 0x03: + mVoice = 99; + return; + case 0x71: + default: + mVoice = 11; + break; + } + + if (mVoice == 1 || mVoice == 2) { + if (i_mood == 0) { + mMood = 0; + } else { + if (i_mood > 17) { + if ((mVoice == 21) || (mVoice == 20)) { + mMood = 0; + } + } else { + mMood = i_mood - 1; + } + } + } else { + mMood = i_mood; + } + + for (int i = 0; i < 500; i++) { + mText[i] = 0; + } + + if (i_textNum > 500) { + mTextNum = 500; + JUT_WARN(387, "TOO MANY TEXT : now(%d) > max(%d)", param_2, 500); + } else { + mTextNum = i_textNum; + } + + for (int i = 0; i < mTextNum; i++) { + mText[i] = i_text[i]; + } + + mTextCount = 0; + field_0x3ff = 0; + field_0x400 = 0; + field_0x401 = 0; + + for (int i = 0; i < 64; i++) { + field_0x402[i] = -1; + } + + selectUnit(false); +} + +/* 802CBF60-802CC190 2C68A0 0230+00 1/0 2/2 0/0 .text setTextCount__12Z2SpeechMgr2Fs */ +void Z2SpeechMgr2::setTextCount(s16 i_textCount) { + if (mVoice != 99) { + field_0x3ff = 0x0; + i_textCount = (i_textCount == 0) ? 0 : i_textCount - 1; + bool all_text = false; + if (mTextCount == 0 && i_textCount >= mTextNum) { + all_text = true; + } + mTextCount = i_textCount; + if (mTextCount >= mTextNum) { + mTextCount = mTextNum; + } + if (mVoice == 1 || mVoice == 2) { + if (!field_0x0.isSoundAttached()) { + speakOneWord(false); + } + } else if (all_text) { + if (mMood == 0) { + mSpeech.startSound(Z2SE_SY_TEXT_DISP_ALL, &field_0x4, NULL, 0, 0.0f, 1.0f, 1.0f, + -1.0f, -1.0f, 0); + } + } else { + if (!isNonVerbal()) { + JAISoundID sound_id; + switch (mVoice) { + case 0xb: + sound_id = Z2SE_SY_TEXT_OUT; + break; + case 0xc: + sound_id = Z2SE_SY_TEXT_OUT_FEMALE; + break; + case 0xd: + sound_id = Z2SE_SY_TEXT_OUT_CHILD; + break; + case 0xe: + sound_id = Z2SE_SY_TEXT_OUT_GORON; + break; + case 0xf: + sound_id = Z2SE_SY_TEXT_OUT_ZORA; + break; + case 0x10: + sound_id = Z2SE_SY_TEXT_OUT_GREY; + break; + case 0x11: + sound_id = Z2SE_SY_TEXT_OUT_SPIRIT; + break; + case 0x12: + sound_id = Z2SE_SY_TEXT_OUT_BRAVE; + break; + case 0x1e: + sound_id = Z2SE_SY_TEXT_OUT_GANON; + break; + case 0x1f: + sound_id = Z2SE_SY_TEXT_OUT_ZANT; + break; + } + mSpeech.startSound(sound_id, &field_0x4, NULL, 0, 0.0f, 1.0f, 1.0f, -1.0f, -1.0f, + 0); + } + } + } +} + +/* 802CC190-802CC2FC 2C6AD0 016C+00 1/1 1/1 0/0 .text speakOneWord__12Z2SpeechMgr2Fb */ +void Z2SpeechMgr2::speakOneWord(bool param_0) { + if (Z2GetSceneMgr()->isSceneExist() && (mVoice == 1 || mVoice == 2) && + field_0x400 == 0 && field_0x3ff <= 30) + { + if (mTextCount >= mTextNum) { + selectTail(); + field_0x400 = 1; + } else if (isNonVerbal()) { + return; + } + u32 sound = mMood + Z2SE_HYL_MDN_RPLY; + f32 fVar1 = Z2GetSceneMgr()->getRoomReverb() / 127.0f; + mSpeech.startSound(sound, &field_0x0, NULL, 0, + fVar1, 1.0f, 1.0f, -1.0f, -1.0f, 0); + mSpeech.setPortData(&field_0x0, 8, field_0x402[field_0x401 - 1] + 1, -1); + if (field_0x400 == 0) { + selectUnit(param_0); + } + } +} + +/* 802CC2FC-802CC4C0 2C6C3C 01C4+00 2/2 0/0 0/0 .text isNonVerbal__12Z2SpeechMgr2Fv */ +bool Z2SpeechMgr2::isNonVerbal() { + switch(mText[mTextCount]) { + case 0: + case 0x20: + case 0x21: + case 0x22: + case 0x23: + case 0x24: + case 0x25: + case 0x26: + case 0x27: + case 0x28: + case 0x29: + case 0x2a: + case 0x2b: + case 0x2c: + case 0x2d: + case 0x2e: + case 0x2f: + case 0x3a: + case 0x3b: + case 0x3c: + case 0x3d: + case 0x3e: + case 0x3f: + case 0x4b: + case 0x4c: + case 0x4d: + case 0x4e: + case 0x4f: + case 0x5b: + case 0x5c: + case 0x5d: + case 0x5e: + case 0x5f: + case 0x813f: + case 0x8140: + case 0x8141: + case 0x8142: + case 0x8143: + case 0x8144: + case 0x8145: + case 0x8146: + case 0x8147: + case 0x8148: + case 0x8149: + case 0x814a: + case 0x814b: + case 0x8151: + case 0x815e: + case 0x8162: + case 0x8166: + case 0x8168: + case 0x8169: + case 0x816a: + case 0x816d: + case 0x816e: + case 0x816f: + case 0x8170: + case 0x8171: + case 0x8172: + case 0x8175: + case 0x8176: + case 0x817b: + case 0x817c: + case 0x8181: + case 0x818f: + case 0x8190: + case 0x8193: + case 0x8194: + case 0x8195: + case 0x8196: + return true; + } + + if(mText[mTextCount] == 0x0a) { + switch (mVoice) { + case 1: + case 2: + return false; + default: + return true; + } + } + return false; +} + typedef struct { - u8 field_0x0; + s8 field_0x0; u8 field_0x1; } Z2ConnectCost; /* 802CC4C0-802CC738 2C6E00 0278+00 2/2 0/0 0/0 .text selectUnit__12Z2SpeechMgr2Fb */ -// NONMATCHING This one is a mess +// NONMATCHING minor regalloc void Z2SpeechMgr2::selectUnit(bool param_0) { - Z2ConnectCost local_3c[5]; + Z2ConnectCost cost[5]; + if (field_0x401 >= 64) { field_0x0->stop(); - } else { - int best = random.get_uint8(Z2MdnPrm::sPrm[field_0x3fc].field_0x8); + return; + } - if (field_0x401 != 0 && param_0) { - int cVar5 = 0; - int ZVar2 = field_0x402[field_0x401 - 1]; + s8 ZVar2 = random.get_uint8(Z2MdnPrm::sPrm[mMood].field_0x8); + s8 ZVar3; + s8 cVar5; - do { - bool bVar1; - int ZVar3; - do { - do { - bVar1 = false; - ZVar3 = random.get_uint8(Z2MdnPrm::sPrm[field_0x3fc].field_0x8); - for (int iVar4 = 0; iVar4 < field_0x401; iVar4++) { - if (ZVar3 == field_0x402[iVar4]) { - bVar1 = true; - break; - } - } - } while (bVar1); - for (int iVar4 = 0; iVar4 < cVar5; iVar4++) { - if (ZVar3 == local_3c[iVar4].field_0x0) { - bVar1 = true; - break; - } - } - } while (bVar1); - u8 diff = JMAAbs(Z2MdnPrm::sPrm[field_0x3fc].field_0x0[ZVar3 * 2] - - Z2MdnPrm::sPrm[field_0x3fc].field_0x0[ZVar2 * 2 + 1]); - local_3c[cVar5] = (Z2ConnectCost){ZVar3, diff}; - cVar5++; - } while ((s8)cVar5 != 5); + if (field_0x401 != 0 && param_0) { + cVar5 = 0; + ZVar2 = field_0x402[field_0x401 - 1]; - best = local_3c[0].field_0x0; - u16 min = local_3c[0].field_0x1; - for (int iVar4 = 0; iVar4 < 5; iVar4++) { - if (local_3c[iVar4].field_0x1 < min) { - min = local_3c[iVar4].field_0x1; - best = local_3c[iVar4].field_0x0; + while (true) { + bool bVar1 = false; + ZVar3 = random.get_uint8(Z2MdnPrm::sPrm[mMood].field_0x8); + + for (int i = 0; i < field_0x401; i++) { + if (field_0x402[i] == ZVar3) { + bVar1 = true; + break; } } - } - field_0x402[field_0x401] = best; - field_0x401++; + if (bVar1) { + continue; + } + + for (int i = 0; i < cVar5; i++) { + if (ZVar3 == cost[i].field_0x0) { + bVar1 = true; + break; + } + } + + if (bVar1) { + continue; + } + + u8 local_3f = JMAAbs(Z2MdnPrm::sPrm[mMood].field_0x0[ZVar3 * 2] + - Z2MdnPrm::sPrm[mMood].field_0x0[ZVar2 * 2 + 1]); + cost[cVar5] = (Z2ConnectCost){ZVar3, local_3f}; + cVar5++; + + if (cVar5 == 5) { + u16 tmp = cost[0].field_0x1; + ZVar2 = cost[0].field_0x0; + for (int i = 0; i < 5; i++) { + if (cost[i].field_0x1 < tmp) { + tmp = cost[i].field_0x1; + ZVar2 = cost[i].field_0x0; + } + } + break; + } + } } + + field_0x402[field_0x401] = ZVar2; + field_0x401++; } /* 802CC738-802CC9D0 2C7078 0298+00 1/1 0/0 0/0 .text selectTail__12Z2SpeechMgr2Fv */ +// NONMATCHING minor regalloc void Z2SpeechMgr2::selectTail() { - // NONMATCHING + Z2ConnectCost cost[5]; + s8 cVar9 = 0; + s8 ZVar1 = field_0x402[field_0x401 - 1]; + s8 ZVar6; + u8 bVar3; + + while (true) { + bool bVar5 = false; + + switch (mVoice) { + case 2: + bVar3 = Z2MdnPrm::sPrm[mMood].field_0x9; + ZVar6 = random.get_uint8(bVar3); + break; + case 1: + bVar3 = Z2MdnPrm::sPrm[mMood].field_0xa; + ZVar6 = Z2MdnPrm::sPrm[mMood].field_0x9 + random.get_uint8(bVar3); + break; + default: + return; + } + + for (int i = 0; i < cVar9; i++) { + if (ZVar6 == cost[i].field_0x0) { + bVar5 = true; + break; + } + } + + if (!bVar5) { + u8 local_3f = JMAAbs(Z2MdnPrm::sPrm[mMood].field_0x4[ZVar6] + - Z2MdnPrm::sPrm[mMood].field_0x0[ZVar1 * 2 + 1]); + cost[cVar9] = (Z2ConnectCost){ZVar6, local_3f}; + cVar9++; + + if (cVar9 == bVar3 || cVar9 == 5) { + s8 tmp_r8; + u16 tmp_r9 = cost[0].field_0x1; + tmp_r8 = cost[0].field_0x0; + int local_3c = bVar3 >= 5 ? 5 : bVar3; + for (int i = 0; i < local_3c; i++) { + if (cost[i].field_0x1 < tmp_r9) { + tmp_r9 = cost[i].field_0x1; + tmp_r8 = cost[i].field_0x0; + } + } + field_0x402[field_0x401 - 1] = tmp_r8 + Z2MdnPrm::sPrm[mMood].field_0x8; + return; + } + } + } } /* 802CC9D0-802CCA18 2C7310 0048+00 0/0 1/1 0/0 .text framework__12Z2SpeechMgr2Fv */ void Z2SpeechMgr2::framework() { - switch (field_0x3fe) { + switch (mVoice) { case 1: case 2: if (field_0x0) { @@ -757,7 +823,7 @@ void Z2SpeechMgr2::framework() { return; } } else { - field_0x3fa = 0; + mTextCount = 0; } break; } @@ -765,13 +831,163 @@ void Z2SpeechMgr2::framework() { /* 802CCA18-802CCF88 2C7358 0570+00 0/0 2/2 0/0 .text playOneShotVoice__12Z2SpeechMgr2FUcUsP3VecSc */ -void Z2SpeechMgr2::playOneShotVoice(u8 param_0, u16 param_1, Vec* param_2, s8 param_3) { - // NONMATCHING +void Z2SpeechMgr2::playOneShotVoice(u8 i_speaker, u16 param_1, Vec* i_pos, s8 param_3) { + if (i_speaker == 0) { + return; + } + + f32 fxmix = Z2GetSceneMgr()->getRoomReverb() / 127.0f; + + if (mVoice == 1 || mVoice == 2) { + JAISoundID sound_id; + switch (param_1) { + case 25: + sound_id = Z2SE_MSG_V_MDN_D21; + break; + case 30: + sound_id = Z2SE_MSG_V_MDN_LAUGH_30; + break; + case 31: + sound_id = Z2SE_MSG_V_MDN_LAUGH_31; + break; + case 32: + sound_id = Z2SE_MSG_V_MDN_LAUGH_32; + break; + case 100: + sound_id = Z2SE_MSG_V_A_MDN_1; + break; + case 101: + sound_id = Z2SE_MSG_V_A_MDN_2; + break; + case 102: + sound_id = Z2SE_MSG_V_A_MDN_102; + break; + case 103: + sound_id = Z2SE_MSG_V_A_MDN_103; + break; + case 104: + sound_id = Z2SE_MSG_V_A_MDN_104; + break; + default: + return; + } + + if (sound_id != -1) { + mSpeech.startSound(sound_id, &field_0x0, (JGeometry::TVec3*)i_pos, + i_speaker, fxmix, 1.0f, 1.0f, -1.0f, -1.0f, 0); + } + + } else { + JAISoundID sound_id = Z2SE_MESSAGE_SE_COMMON; + switch (i_speaker) { + case 3: + if (param_1 == 1) { + Z2GetSeqMgr()->subBgmStart(Z2BGM_ITEM_GET_MINI); + return; + } + break; + case 30: + if (param_1 == 15) { + sound_id = Z2SE_TAMABE_V_TUTO_BIKKURI; + } + break; + case 29: + if (param_1 == 4) { + sound_id = Z2SE_KYURY_MV_ZEKKU; + } else if (param_1 == 5) { + sound_id = Z2SE_KYURY_MV_WORRY; + } + break; + case 32: + if (param_1 == 6) { + sound_id = Z2SE_MOI_MV_WOUND_UMEKI; + } + break; + case 35: + if (param_1 == 10) { + sound_id = Z2SE_HANJO_MV_CRY; + } + break; + case 37: + if (param_1 == 10) { + sound_id = Z2SE_BESU_MV_DOUYOU; + } + break; + case 47: + if (param_1 == 15) { + sound_id = Z2SE_ZRA_MV_WOUND_BREATH; + } else if (param_1 == 17) { + sound_id = Z2SE_ZRA_MV_WOUND_COUGH; + } + break; + case 69: + if (param_1 == 1) { + sound_id = Z2SE_MSG_V_CAT; + } else if (param_1 == 2) { + sound_id = Z2SE_MSG_V_PERU; + } + break; + case 70: + if (param_1 == 1) { + sound_id = Z2SE_MSG_V_DOG; + } + break; + case 71: + if (param_1 == 1) { + sound_id = Z2SE_MSG_V_KOKKO; + } + break; + case 72: + if (param_1 == 1) { + sound_id = Z2SE_MSG_V_SQUIRREL; + } + break; + case 73: + if (param_1 == 1) { + sound_id = Z2SE_MSG_V_MONKEY; + } + break; + case 74: + if (param_1 == 1) { + sound_id = Z2SE_MSG_V_FROG; + } + break; + case 107: + if (param_1 == 1) { + sound_id = Z2SE_MSG_V_MYNA; + } + break; + case 113: + if (param_1 == 1) { + sound_id = Z2SE_HS_V_CRY_UMAKUSA; + } + break; + case 112: + if (param_1 == 1) { + sound_id = Z2SE_TKJ_V_SHOP_TALK; + } + break; + case 38: + if (param_1 == 4) { + sound_id = Z2SE_D21V_MDN_HATTOSURU; + } + break; + } + + if (field_0x0) { + field_0x0.releaseSound(); + } + mSpeech.startSound(sound_id, &field_0x0, (JGeometry::TVec3*)i_pos, i_speaker, + fxmix, 1.0f, 1.0f, -1.0f, -1.0f, 0); + if (field_0x0) { + mSpeech.setPortData(&field_0x0, 8, param_1, -1); + } + } } /* 802CCF88-802CCFB8 2C78C8 0030+00 0/0 1/1 0/0 .text isMidnaSpeak__12Z2SpeechMgr2Fv */ bool Z2SpeechMgr2::isMidnaSpeak() { - if ((field_0x3fe == 1 || field_0x3fe == 2) && field_0x0) { + if ((mVoice == 1 || mVoice == 2) && field_0x0) { return true; } return false; @@ -782,9 +998,50 @@ Z2SpeechStarter::Z2SpeechStarter() : Z2SoundStarter(false) {} /* 802CCFF8-802CD248 2C7938 0250+00 1/0 0/0 0/0 .text * startSound__15Z2SpeechStarterF10JAISoundIDP14JAISoundHandlePCQ29JGeometry8TVec3UlfffffUl */ -bool Z2SpeechStarter::startSound(JAISoundID param_0, JAISoundHandle* param_1, - JGeometry::TVec3 const* param_2, u32 param_3, f32 param_4, - f32 param_5, f32 param_6, f32 param_7, f32 param_8, - u32 param_9) { - // NONMATCHING +bool Z2SpeechStarter::startSound(JAISoundID i_soundID, JAISoundHandle* i_handle, + JGeometry::TVec3 const* i_pos, u32 param_3, f32 i_fxmix, + f32 i_pitch, f32 i_volume, f32 i_pan, f32 i_dolby, u32 i_count) { + if (Z2GetSceneMgr()->isInDarkness() && Z2GetSceneMgr()->getDemoSeWaveNum() != 0x77 + && Z2GetSceneMgr()->getDemoSeWaveNum() != 0x78) { + i_fxmix = 1.0f; + } else { + f32 tmp = Z2GetStatusMgr()->getCameraInWaterDepthRatio() > 0.0f; + if (tmp) { + i_fxmix = tmp; + } else if (Z2GetSceneMgr()->getDemoSeWaveNum() == 0x6c + || Z2GetSceneMgr()->getDemoSeWaveNum() == 0x77) + { + i_fxmix = 0.07f; + } else { + i_fxmix += Z2GetEnvSeMgr()->getFogDensity() * 0.5f; + if (i_fxmix > 1.0f) { + i_fxmix = 1.0f; + } + } + } + + bool ret = Z2GetAudioMgr()->startSound(i_soundID, i_handle, i_pos); + + if (*i_handle) { + if (param_3 != 0) { + setPortData(i_handle, 6, param_3, -1); + } + if (i_fxmix > 0.0f) { + (*i_handle)->getAuxiliary().moveFxMix(i_fxmix, i_count); + } + if (i_pitch != 1.0f) { + (*i_handle)->getAuxiliary().movePitch(i_pitch, i_count); + } + if (i_volume != 1.0f) { + (*i_handle)->getAuxiliary().moveVolume(i_volume, i_count); + } + if (i_pan != -1.0f) { + (*i_handle)->getAuxiliary().movePan(i_pan, i_count); + } + if (i_dolby != -1.0f) { + (*i_handle)->getAuxiliary().moveDolby(i_dolby, i_count); + } + } + + return ret; } diff --git a/src/d/actor/d_a_arrow.cpp b/src/d/actor/d_a_arrow.cpp index 4401511f5ff..084217c6de7 100644 --- a/src/d/actor/d_a_arrow.cpp +++ b/src/d/actor/d_a_arrow.cpp @@ -573,7 +573,7 @@ int daArrow_c::procWait() { } } - mSoundObjArrow.startLevelSound(0x8000a, 0, mReverb); + mSoundObjArrow.startLevelSound(Z2SE_OBJ_BOMB_IGNITION, 0, mReverb); } if(dComIfGp_checkCameraAttentionStatus(dComIfGp_getPlayerCameraID(0), 2)) { @@ -614,7 +614,7 @@ int daArrow_c::procMove() { bVar14 = TRUE; } else if (water_next_pos == 1) { fopKyM_createWpillar(field_0x5dc.GetCrossP(), 0.3f, 0); - mDoAud_seStart(0x60031, field_0x5dc.GetCrossP(), 0, mReverb); + mDoAud_seStart(Z2SE_CM_BODYFALL_WATER_S, field_0x5dc.GetCrossP(), 0, mReverb); } field_0x945 = 1; @@ -787,13 +787,13 @@ int daArrow_c::procMove() { 0.0f ); if (mArrowType == 4) { - se_id = 0x40018; + se_id = Z2SE_HIT_PACHINKO; current.angle = angle; procSlingHitInit(¤t.pos, NULL); } else { procReturnInit(0); dComIfGp_setHitMark(9, this, ¤t.pos, &angle, NULL, 0); - se_id = 0x40017; + se_id = Z2SE_HIT_AL_ARROW_REBOUND; } } else { setBlur(); @@ -860,7 +860,7 @@ int daArrow_c::procMove() { u32 sound_id; if (mArrowType == 2) { - sound_id = 0x6001c; + sound_id = Z2SE_ZELDA_ARROW_FLY; } else { if (fopAcM_GetParam(this) == 2) { if (mArrowType == 1) { @@ -1032,7 +1032,7 @@ int daArrow_c::procSlingHitInit(cXyz* param_0, dCcD_GObjInf* param_1) { hitmark = 9; if (hit_ac != NULL && param_1->GetAtHitGObj() != NULL) { if (param_1->GetAtHitGObj()->ChkTgNoSlingHitInfSet()) { - mDoAud_seStart(0x40018, param_0, 0x2d, mReverb); + mDoAud_seStart(Z2SE_HIT_PACHINKO, param_0, 0x2d, mReverb); } } } diff --git a/src/d/actor/d_a_b_bh.cpp b/src/d/actor/d_a_b_bh.cpp index eded62267bf..86016b47f99 100644 --- a/src/d/actor/d_a_b_bh.cpp +++ b/src/d/actor/d_a_b_bh.cpp @@ -1369,7 +1369,7 @@ static int daB_BH_Execute(b_bh_class* i_this) { } } } else { - i_this->mSound.startCreatureSoundLevel(0x70109, 0, -1); + i_this->mSound.startCreatureSoundLevel(Z2SE_EN_BH_BURST, 0, -1); if (i_this->field_0x909[i] == 0) { i_this->field_0x909[i] = (YREG_S(5) + 1); diff --git a/src/d/actor/d_a_e_oc.cpp b/src/d/actor/d_a_e_oc.cpp index a127920ed77..5eb3b2f2e01 100644 --- a/src/d/actor/d_a_e_oc.cpp +++ b/src/d/actor/d_a_e_oc.cpp @@ -731,7 +731,7 @@ void daE_OC_c::setStabPos() { /* 8072E528-8072E5A4 002048 007C+00 1/1 0/0 0/0 .text setWaitSound__8daE_OC_cFv */ void daE_OC_c::setWaitSound() { if (checkBck(0x1b) && mpMorf->checkFrame(0.0f)) { - mSound.startCreatureVoice(0x70180, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_WAIT, -1); } } @@ -739,9 +739,9 @@ void daE_OC_c::setWaitSound() { void daE_OC_c::setWalkSound() { if (checkBck(0x1d)) { if (mpMorf->checkFrame(14.0f)) { - mSound.startCreatureSound(0x70178, 0, -1); + mSound.startCreatureSound(Z2SE_EN_OC_FOOTNOTE_L, 0, -1); } else if (mpMorf->checkFrame(30.0f)) { - mSound.startCreatureSound(0x70179, 0, -1); + mSound.startCreatureSound(Z2SE_EN_OC_FOOTNOTE_R, 0, -1); } } } @@ -750,11 +750,11 @@ void daE_OC_c::setWalkSound() { void daE_OC_c::setWalkStSound() { if (checkBck(0x1e)) { if (mpMorf->checkFrame(0.0f)) { - mSound.startCreatureVoice(0x7018e, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_WALK_ST, -1); } else if (mpMorf->checkFrame(1.0f)) { - mSound.startCreatureSound(0x70178, 0, -1); + mSound.startCreatureSound(Z2SE_EN_OC_FOOTNOTE_L, 0, -1); } else if (mpMorf->checkFrame(9.0f)) { - mSound.startCreatureSound(0x70179, 0, -1); + mSound.startCreatureSound(Z2SE_EN_OC_FOOTNOTE_R, 0, -1); } } } @@ -763,16 +763,16 @@ void daE_OC_c::setWalkStSound() { void daE_OC_c::setDashSound() { if (checkBck(0xb)) { if (mpMorf->checkFrame(0.0f)) { - mSound.startCreatureVoice(0x7017f, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_DASH, -1); } else if (mpMorf->checkFrame(1.0f)) { - mSound.startCreatureSound(0x70178, 0, -1); + mSound.startCreatureSound(Z2SE_EN_OC_FOOTNOTE_L, 0, -1); } else if (mpMorf->checkFrame(8.5f)) { - mSound.startCreatureSound(0x70179, 0, -1); + mSound.startCreatureSound(Z2SE_EN_OC_FOOTNOTE_R, 0, -1); } if (mName == "E_OC") { - mSound.startCreatureSoundLevel(0x70193, 0, -1); + mSound.startCreatureSoundLevel(Z2SE_EN_OC_CLUB_DAGGLE, 0, -1); } else { - mSound.startCreatureSoundLevel(0x70537, 0, -1); + mSound.startCreatureSoundLevel(Z2SE_EN_OC_NATA_DAGGLE, 0, -1); } } } @@ -781,11 +781,11 @@ void daE_OC_c::setDashSound() { void daE_OC_c::setWaitStSound() { if (checkBck(0x1c)) { if (mpMorf->checkFrame(0.0f)) { - mSound.startCreatureVoice(0x7018d, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_WAIT_ST, -1); } else if (mpMorf->checkFrame(6.5f) || mpMorf->checkFrame(20.0f)) { - mSound.startCreatureSound(0x70178, 0, -1); + mSound.startCreatureSound(Z2SE_EN_OC_FOOTNOTE_L, 0, -1); } else if (mpMorf->checkFrame(13.0f) || mpMorf->checkFrame(28.5f)) { - mSound.startCreatureSound(0x70179, 0, -1); + mSound.startCreatureSound(Z2SE_EN_OC_FOOTNOTE_R, 0, -1); } } } @@ -821,10 +821,10 @@ void daE_OC_c::executeWait() { case 0: if (field_0x6b4 == 0) { setBck(0x1b, 2, 5.0f, 1.0f); - mSound.startCreatureVoice(0x70180, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_WAIT, -1); } else { setBck(0x18, 2, 5.0f, 1.0f); - mSound.startCreatureVoice(0x7018b, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_STAND_WAIT, -1); } speedF = 0.0f; field_0x6bc = shape_angle.y; @@ -848,7 +848,7 @@ void daE_OC_c::executeWait() { cLib_addCalcAngleS(&shape_angle.y, field_0x6bc, 4, 0x800, 0x100); if (field_0x6c0 == 0) { setBck(0x16, 0, 5.0f, 1.0f); - mSound.startCreatureVoice(0x7017c, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_SEARCH, -1); mOcState = 2; } break; @@ -858,7 +858,7 @@ void daE_OC_c::executeWait() { } else { if (mpMorf->isStop()) { setBck(0x1b, 2, 5.0f, 1.0f); - mSound.startCreatureVoice(0x70180, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_WAIT, -1); if (field_0x6b4 == 0) { field_0x6c0 = cM_rndF(10.0f) + 10.0f; mOcState = 3; @@ -977,15 +977,15 @@ void daE_OC_c::executeTalk() { if (rand_val < 0.2f) { setBck(0x1a, 0, 5.0f, 1.0f); mOcState = 3; - mSound.startCreatureVoice(0x7018f, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_TALK_B, -1); } else if (rand_val < 0.6f) { setBck(0x19, 2, 5.0f, 1.0f); - mSound.startCreatureVoice(0x7018a, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_TALK, -1); mOcState = 2; field_0x6c0 = cM_rndF(30.0f) + 30.0f; } else { setBck(0x18, 2, 5.0f, 1.0f); - mSound.startCreatureVoice(0x7018b, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_STAND_WAIT, -1); mOcState = 2; field_0x6c0 = cM_rndF(30.0f) + 30.0f; } @@ -1044,7 +1044,7 @@ void daE_OC_c::executeFind() { field_0x6c2 = field_0x6c0 + 0x14; if (checkBck(0x1c) == 0) { setBck(0x1c, 2, 5.0f, 1.0f); - mSound.startCreatureVoice(0x7018d, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_WAIT_ST, -1); } field_0x6de = 1; } else if (mOcState == 1) { @@ -1056,11 +1056,11 @@ void daE_OC_c::executeFind() { field_0x6e2 = 0; field_0x6ca = 0x96; setBck(0xd, 0, 5.0f, 1.0f); - mSound.startCreatureVoice(0x7017e, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_FIND, -1); } else { field_0x6c0 = cM_rndF(5.0f) + 5.0f; setBck(0xd, 0, 5.0f, 1.0f); - mSound.startCreatureVoice(0x7017e, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_FIND, -1); } mOcState = 3; speedF = 0.0f; @@ -1069,10 +1069,10 @@ void daE_OC_c::executeFind() { if (field_0x6de || pl_dist < 400.0f) { setBck(0x1e, 2, 5.0f, 1.3f); field_0x6de = 1; - mSound.startCreatureVoice(0x7018e, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_WALK_ST, -1); } else { setBck(0xb, 2, 5.0f, 1.2f); - mSound.startCreatureVoice(0x7017f, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_DASH, -1); } mOcState = 4; field_0x6c0 = 0x1e; @@ -1124,17 +1124,17 @@ void daE_OC_c::executeFind() { if (speedF < 0.0f) { if (checkBck(0x1c) == 0 || mpMorf->getPlaySpeed() != 1.0f) { setBck(0x1c, 2, 5.0f, 1.0f); - mSound.startCreatureVoice(0x7018d, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_WAIT_ST, -1); } } else if (!speedF && (s16)cLib_distanceAngleS(shape_angle.y, pl_ang) < 0x1000) { if (checkBck(0x1c) == 0) { setBck(0x1c, 2, 5.0f, 1.0f); - mSound.startCreatureVoice(0x7018d, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_WAIT_ST, -1); } } else { if (checkBck(0x1e) == 0 || mpMorf->getPlaySpeed() != 1.3f) { setBck(0x1e, 2, 5.0f, 1.3f); - mSound.startCreatureVoice(0x7018e, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_WALK_ST, -1); } } } @@ -1151,17 +1151,17 @@ void daE_OC_c::executeFind() { if (speedF < 0.0f) { if (checkBck(0x1e) == 0 || mpMorf->getPlaySpeed() != -1.0f) { setBck(0x1e, 2, 5.0f, -1.0f); - mSound.startCreatureVoice(0x7018e, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_WALK_ST, -1); } } else if (!speedF && (s16)cLib_distanceAngleS(shape_angle.y, pl_ang) < 0x1000) { if (checkBck(0x1c) == 0) { setBck(0x1c, 2, 5.0f, 1.0f); - mSound.startCreatureVoice(0x7018d, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_WAIT_ST, -1); } } else { if (checkBck(0x1e) == 0 || mpMorf->getPlaySpeed() != 1.3f) { setBck(0x1e, 2, 5.0f, 1.3f); - mSound.startCreatureVoice(0x7018e, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_WALK_ST, -1); } } if (0 == strcmp("D_MN05", dComIfGp_getStartStageName()) @@ -1187,7 +1187,7 @@ void daE_OC_c::executeFind() { break; case 5: setBck(0x16, 0, 5.0f, 1.0f); - mSound.startCreatureVoice(0x7017c, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_SEARCH, -1); mOcState = 6; field_0x6de = 0; // fallthrough intentional. @@ -1265,11 +1265,11 @@ void daE_OC_c::executeAttack() { if (cLib_chaseF(&speedF, 0.0f, 1.0f)) { if (cM_rndF(1.0f) < 0.5f) { setBck(5, 0, 5.0f, 1.0f); - mSound.startCreatureVoice(0x70184, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_ATTACK_B, -1); mOcState = 1; } else { setBck(6, 0, 5.0f, 1.0f); - mSound.startCreatureVoice(0x70185, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_ATTACK_C, -1); mOcState = 2; } field_0x6a0 = 0.0f; @@ -1288,21 +1288,21 @@ void daE_OC_c::executeAttack() { case 1: { if (mOcState == 1) { if (mpMorf->checkFrame(10.0f)) { - mSound.startCreatureVoice(0x70186, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_ATTACK_B2, -1); } else if (mpMorf->checkFrame(12.5f)) { - mSound.startCreatureSound(0x70188, 0, -1); + mSound.startCreatureSound(Z2SE_EN_OC_ATTACK_B, 0, -1); } else if (mpMorf->checkFrame(19.0f)) { if (mName == "E_OC") { - mSound.startCreatureSound(0x70192, 0, -1); + mSound.startCreatureSound(Z2SE_EN_OC_CLUB_HIT, 0, -1); } else { - mSound.startCreatureSound(0x70536, 0, -1); + mSound.startCreatureSound(Z2SE_EN_OC_NATA_HIT, 0, -1); } } } else { if (mpMorf->checkFrame(7.0f)) { - mSound.startCreatureVoice(0x70187, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_ATTACK_C2, -1); } else if (mpMorf->checkFrame(11.5f)) { - mSound.startCreatureSound(0x70189, 0, -1); + mSound.startCreatureSound(Z2SE_EN_OC_ATTACK_C, 0, -1); } } if (mpMorf->getFrame() >= 14.0f && mpMorf->getFrame() <= 22.0f) { @@ -1335,7 +1335,7 @@ void daE_OC_c::executeAttack() { field_0x6a0 = my_float; if (mpMorf->isStop()) { setBck(0x1c, 2, 0.0f, 1.0f); - mSound.startCreatureVoice(0x7018d, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_WAIT_ST, -1); if (field_0x6e3) { setActionMode(0x10, 0); } else { @@ -1354,7 +1354,7 @@ void daE_OC_c::executeAttack() { field_0x6a0 = my_float; if (mpMorf->isStop()) { setBck(0x1c, 2, 5.0f, 1.0f); - mSound.startCreatureVoice(0x7018d, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_WAIT_ST, -1); if (field_0x6e3) { setActionMode(0x10, 0); } else { @@ -1382,24 +1382,24 @@ void daE_OC_c::executeDamage() { case 0: speedF = 0.0f; setBck(0x9, 0, 0.0f, 1.0f); - mSound.startCreatureVoice(0x70182, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_DAMAGE_LR, -1); mOcState = 5; break; case 1: speedF = 0.0f; setBck(0xa, 0, 0.0f, 1.0f); - mSound.startCreatureVoice(0x70182, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_DAMAGE_LR, -1); mOcState = 5; break; case 2: speedF = 0.0f; setBck(0x8, 0, 0.0f, 1.0f); - mSound.startCreatureVoice(0x70182, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_DAMAGE_LR, -1); mOcState = 5; break; case 3: { setBck(0x8, 0, 0.0f, 1.0f); - mSound.startCreatureVoice(0x70181, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_DAMAGE, -1); mOcState = 5; s16 half_val = cLib_distanceAngleS(shape_angle.y, fopAcM_searchPlayerAngleY(this)); if (half_val < 0x4000) { @@ -1412,7 +1412,7 @@ void daE_OC_c::executeDamage() { } case 4: setBck(0xf, 0, 0.0f, 1.0f); - mSound.startCreatureVoice(0x701a2, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_GALE, -1); mOcState = 6; speedF = 0.0f; break; @@ -1465,18 +1465,18 @@ void daE_OC_c::executeBigDamage() { field_0x6bc = -0x1f60; } if (health < 1) { - mSound.startCreatureVoice(0x70191, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_DEATH, -1); } else { - mSound.startCreatureVoice(0x70190, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_LEAP_SPIN, -1); } } else { field_0x6dc = 0; setBck(0x13, 0, 0.0f, 1.0f); field_0x6bc = 0; if (health < 1) { - mSound.startCreatureVoice(0x70191, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_DEATH, -1); } else { - mSound.startCreatureVoice(0x7017a, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_LEAP_A, -1); } } offTgSph(); @@ -1508,10 +1508,10 @@ void daE_OC_c::executeBigDamage() { field_0x6d8 = 0; shape_angle.x = 0; setBck(0x14, 0, 0.0f, 1.0f); - mSound.startCreatureSound(0x6002c, 0, -1); + mSound.startCreatureSound(Z2SE_CM_BODYFALL_M, 0, -1); if (field_0x6dc) { mpMorf->setFrame(5.0f); - mSound.startCreatureSound(0x7017b, 0, -1); + mSound.startCreatureSound(Z2SE_EN_OC_LEAP_B, 0, -1); } mOcState = 4; fopAcM_effSmokeSet1(&field_0xe60, &field_0xe64, ¤t.pos, NULL, 2.0f, &tevStr, 1); @@ -1520,10 +1520,10 @@ void daE_OC_c::executeBigDamage() { case 4: setGroundAngle(); if (mpMorf->checkFrame(15.0f)) { - mSound.startCreatureSound(0x6002c, 0, -1); + mSound.startCreatureSound(Z2SE_CM_BODYFALL_M, 0, -1); } if (field_0x6dc == 0 && mpMorf->checkFrame(5.0f)) { - mSound.startCreatureSound(0x7017b, 0, -1); + mSound.startCreatureSound(Z2SE_EN_OC_LEAP_B, 0, -1); } checkDamageBg(); if (mAcch.ChkWallHit()) { @@ -1557,7 +1557,7 @@ void daE_OC_c::executeBigDamage() { } if (field_0x6c0 == 0) { setBck(0x17, 0, 5.0f, 1.0f); - mSound.startCreatureVoice(0x7017d, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_STAND, -1); mOcState = 6; offDownFlg(); } @@ -1581,10 +1581,10 @@ void daE_OC_c::executeWatch() { speedF = 0.0f; if (field_0x6de) { setBck(0x1c, 2, 5.0f, 1.0f); - mSound.startCreatureVoice(0x7018d, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_WAIT_ST, -1); } else { setBck(0x1b, 2, 5.0f, 1.0f); - mSound.startCreatureVoice(0x70180, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_WAIT, -1); } field_0x6c0 = (s8) (cM_rndFX(15.0f) + 35.0f); mOcState = 1; @@ -1600,10 +1600,10 @@ void daE_OC_c::executeWatch() { speedF = 0.0f; if (field_0x6de) { setBck(0x1c, 2, 5.0f, 1.0f); - mSound.startCreatureVoice(0x7018d, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_WAIT_ST, -1); } else { setBck(0x1b, 2, 5.0f, 1.0f); - mSound.startCreatureVoice(0x70180, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_WAIT, -1); } field_0x6c0 = (s8) (cM_rndFX(15.0f) + 35.0f); mOcState = 3; @@ -1612,7 +1612,7 @@ void daE_OC_c::executeWatch() { if (field_0x6c0 == 0) { mOcState = 4; setBck(7, 0, 5.0f, 1.0f); - mSound.startCreatureVoice(0x70183, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_CRY, -1); } break; case 4: @@ -1645,13 +1645,13 @@ void daE_OC_c::executeSoundWatch() { case 0: speedF = 0.0f; setBck(0xd, 0, 5.0f, 1.0f); - mSound.startCreatureVoice(0x7017e, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_FIND, -1); field_0x6c0 = cM_rndF(30.0f) + 60.0f; mOcState = 1; case 1: if (field_0x6c0 == 0) { setBck(0xb, 2, 5.0f, 1.2f); - mSound.startCreatureVoice(0x7017f, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_DASH, -1); mOcState = 2; field_0x6c0 = 0x3c; } @@ -1699,7 +1699,7 @@ void daE_OC_c::executeDeath() { } else { field_0x6c0 = 0x2d; setBck(0xe, 0, 0.0f, 1.0f); - mSound.startCreatureVoice(0x7018c, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_FINISH, -1); mOcState = 3; offDownFlg(); } @@ -1707,7 +1707,7 @@ void daE_OC_c::executeDeath() { case 3: setSpitEffect(); if (mpMorf->checkFrame(28.5f)) { - mSound.startCreatureSound(0x6002b, 0, -1); + mSound.startCreatureSound(Z2SE_CM_BODYFALL_S, 0, -1); } case 2: cLib_chaseF(&speedF, 0.0f, 1.0f); @@ -1750,14 +1750,14 @@ void daE_OC_c::executeWaterDeath() { switch (mOcState) { case 0: setBck(0xC, 0, 0.0f, 1.0f); - mSound.startCreatureVoice(0x701AF, -1); - mSound.startCreatureSound(0x701B0, 0, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_DROWNED, -1); + mSound.startCreatureSound(Z2SE_EN_OC_DROWNED, 0, -1); current.pos.y += 140.0f; mOcState = 1; speedF = 0.0f; gravity = 0.0f; setWaterEffect(); - mSound.startCreatureSound(0x60032, 0, -1); + mSound.startCreatureSound(Z2SE_CM_BODYFALL_WATER_M, 0, -1); offTgSph(); break; case 1: @@ -1831,7 +1831,7 @@ void daE_OC_c::executeDemoMaster() { return; } case 1: - mSound.startCreatureVoice(0x701B1, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_SAKEBU, -1); setBck(7, 0, 5.0f, 1.0f); mOcState = 2; field_0x6c0 = 15; @@ -1849,19 +1849,19 @@ void daE_OC_c::executeDemoMaster() { if (mOcState == 4) { if (mpMorf->isStop()) { setBck(4, 0, 5.0f, 1.0f); - mSound.startCreatureVoice(0x701A4, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_ANGRY_B, -1); mOcState = 5; } } else { if (mpMorf->checkFrame(9.0f)) { - mSound.startCreatureSound(0x70189, 0, -1); + mSound.startCreatureSound(Z2SE_EN_OC_ATTACK_C, 0, -1); } s16 angle = fopAcM_searchPlayerAngleY(this); cLib_chaseAngleS(&field_0x6bc, angle + 0x8000, 0x200); if (mpMorf->isStop()) { mOcState = 6; setBck(0x10, 0, 5.0f, 1.0f); - mSound.startCreatureVoice(0x701B2, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_JUMP, -1); speedF = 10.0f; speed.y = 40.0f; field_0x6c0 = 0x28; @@ -1898,7 +1898,7 @@ void daE_OC_c::executeDemoMaster() { cLib_addCalc2(&field_0x6f8.y, my_vec_0.y + 2950.0f, 0.1f, 10.0f); } if (mAcch.ChkGroundHit()) { - mSound.startCreatureSound(0x6002B, 0, -1); + mSound.startCreatureSound(Z2SE_CM_BODYFALL_S, 0, -1); fopAcM_effSmokeSet1(&field_0xe60, &field_0xe64, ¤t.pos, NULL, 2.0f, &tevStr, 1); setBck(0x12, 0, 5.0f, 1.0f); mOcState = 8; @@ -1908,7 +1908,7 @@ void daE_OC_c::executeDemoMaster() { field_0x704 = 47.0f; cLib_addCalc2(&field_0x6f8.y, my_vec_0.y + 2950.0f, 0.1f, 10.0f); if (mpMorf->checkFrame(34.0f)) { - mSound.startCreatureVoice(0x7017E, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_FIND, -1); } if (mpMorf->isStop()) { field_0x6c8 = 30; @@ -1945,14 +1945,14 @@ void daE_OC_c::executeDemoChild() { case 1: if (mpParent->mOcState == 5) { setBck(3, 0, 5.0f, 1.0f); - mSound.startCreatureVoice(0x701A3, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_ANGRY_A, -1); mOcState = 5; } break; case 5: if (mpMorf->isStop()) { setBck(0x10, 0, 5.0f, 1.0f); - mSound.startCreatureVoice(0x701B2, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_JUMP, -1); mOcState = 6; speedF = 10.0f; speed.y = 40.0f; @@ -1975,7 +1975,7 @@ void daE_OC_c::executeDemoChild() { break; case 7: if (mAcch.ChkGroundHit()) { - mSound.startCreatureSound(0x6002B, 0, -1); + mSound.startCreatureSound(Z2SE_CM_BODYFALL_S, 0, -1); fopAcM_effSmokeSet1(&field_0xe60, &field_0xe64, ¤t.pos, NULL, 2.0f, &tevStr, 1); setBck(0x12, 0, 5.0f, 1.0f); mOcState = 8; @@ -1983,7 +1983,7 @@ void daE_OC_c::executeDemoChild() { break; case 8: if (mpMorf->checkFrame(34.0f)) { - mSound.startCreatureVoice(0x7017E, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_FIND, -1); } if (mpMorf->isStop()) { setActionMode(3, 0); @@ -2025,7 +2025,7 @@ void daE_OC_c::executeFallDead() { mPrevShapeAngle = shape_angle.y; switch (mOcState) { case 0: - mSound.startCreatureVoice(0x701A5, -1); + mSound.startCreatureVoice(Z2SE_EN_OC_V_FALL, -1); if (checkBck(0x15) || checkBck(0x13)) { mOcState = 1; } else { @@ -2071,7 +2071,7 @@ void daE_OC_c::executeFall() { case 1: if (mAcch.ChkGroundHit()) { speedF = 0.0f; - mSound.startCreatureSound(0x6002B, 0, -1); + mSound.startCreatureSound(Z2SE_CM_BODYFALL_S, 0, -1); fopAcM_effSmokeSet1(&field_0xe60, &field_0xe64, ¤t.pos, NULL, 2.0f, &tevStr, 1); setBck(0x12, 0, 5.0f, 1.0f); mOcState = 2; diff --git a/src/d/actor/d_a_obj_Y_taihou.cpp b/src/d/actor/d_a_obj_Y_taihou.cpp index 9158023685e..81cbb9d9c9b 100644 --- a/src/d/actor/d_a_obj_Y_taihou.cpp +++ b/src/d/actor/d_a_obj_Y_taihou.cpp @@ -31,12 +31,12 @@ static void ccHitCallback(fopAc_ac_c* param_0, dCcD_GObjInf* param_1, fopAc_ac_c int iVar1 = ((daObjYtaihou_c*)param_0)->getIronBallId(); if (iVar1 == 0xffffffff && ((daObjCarry_c*)param_2)->getType() == daObjCarry_c::TYPE_IRON_BALL) { ((daObjYtaihou_c*)param_0)->setIronBall((daObjCarry_c*)param_2); - fopAcM_seStartCurrent(param_0, 0x801c9, 0); + fopAcM_seStartCurrent(param_0, Z2SE_OBJ_CANNON_CHARGE, 0); } } else if (fopAcM_GetProfName(param_2) == 0x221) { ((daObjYtaihou_c*)param_0)->startBomb(); fopAcM_delete(param_2); - fopAcM_seStartCurrent(param_0, 0x801c9, 0); + fopAcM_seStartCurrent(param_0, Z2SE_OBJ_CANNON_CHARGE, 0); } } @@ -220,9 +220,9 @@ void daObjYtaihou_c::rotateCheck() { field_0x772 = 0; daPy_getLinkPlayerActorClass()->offPushPullKeep(); field_0x774 = -1; - fopAcM_seStartCurrent(this, 0x801cb, 0); + fopAcM_seStartCurrent(this, Z2SE_OBJ_CANNON_STOP, 0); } else { - fopAcM_seStartCurrentLevel(this, 0x801ca, 0); + fopAcM_seStartCurrentLevel(this, Z2SE_OBJ_CANNON_MOVE, 0); } } else if (field_0x774) { daPy_py_c* player_class = daPy_getLinkPlayerActorClass(); @@ -301,7 +301,7 @@ void daObjYtaihou_c::shotCheck() { mParticleKeys[1] = dComIfGp_particle_set(mParticleKeys[1], 0x1df, &my_vec_0, &tevStr, NULL, &l_effectScale, 0xff, NULL, -1, NULL, NULL, NULL); - fopAcM_seStartCurrentLevel(this, 0x8000a, 0); + fopAcM_seStartCurrentLevel(this, Z2SE_OBJ_BOMB_IGNITION, 0); } else if (mStartBomb == 4) { daObjCarry_c* pCarry = (daObjCarry_c*) fopAcM_SearchByID(mIronBallId); if (pCarry) { @@ -323,7 +323,7 @@ void daObjYtaihou_c::shotCheck() { dComIfGp_particle_set(0x8ae5, &my_vec_1, &tevStr, &shape_angle, 0); dComIfGp_particle_set(0x8ae6, &my_vec_1, &tevStr, &shape_angle, 0); dComIfGp_getVibration().StartShock(8, 0x1f, cXyz(0.0f, 1.0f, 0.0f)); - fopAcM_seStartCurrent(this, 0x8000b, 0); + fopAcM_seStartCurrent(this, Z2SE_OBJ_BOMB_EXPLODE, 0); speed.y = 40.0f; } } diff --git a/src/d/actor/d_a_obj_carry.cpp b/src/d/actor/d_a_obj_carry.cpp index 5aa7a952957..c3aba8ef4f3 100644 --- a/src/d/actor/d_a_obj_carry.cpp +++ b/src/d/actor/d_a_obj_carry.cpp @@ -200,7 +200,7 @@ const daObjCarry_dt_t daObjCarry_c::mData[] = { 1000000.0f, 50.0f, Z2SE_OBJ_BREAK_WOOD_S, - 0x801D4, + Z2SE_OBJ_IRONBALL_HIT, Z2SE_OBJ_PUT_WATER_M, JA_SE_OBJ_FALL_MAGMA_S, Z2SE_OBJ_FALL_WATER_S, @@ -287,8 +287,8 @@ const daObjCarry_dt_t daObjCarry_c::mData[] = { 48.0f, 250.0f, 0.0f, - 0x800F6, - 0x800F7, + Z2SE_OBJ_SKULL_BREAK, + Z2SE_OBJ_SKULL_PUT, Z2SE_OBJ_PUT_WATER_S, JA_SE_OBJ_FALL_MAGMA_S, Z2SE_OBJ_FALL_WATER_S, @@ -331,8 +331,8 @@ const daObjCarry_dt_t daObjCarry_c::mData[] = { 60.0f, 250.0f, 0.0f, - 0x800B9, - 0x800B8, + Z2SE_OBJ_BOKKURI_BURST, + Z2SE_OBJ_BOKKURI_PUT, Z2SE_OBJ_PUT_WATER_S, JA_SE_OBJ_FALL_MAGMA_M, Z2SE_OBJ_FALL_WATER_M, diff --git a/src/d/actor/d_a_obj_lv1Candle00.cpp b/src/d/actor/d_a_obj_lv1Candle00.cpp index 4636e66a006..36ddc2cf91d 100644 --- a/src/d/actor/d_a_obj_lv1Candle00.cpp +++ b/src/d/actor/d_a_obj_lv1Candle00.cpp @@ -185,7 +185,8 @@ int daLv1Cdl00_c::Execute() { g_whiteColor, g_whiteColor, 0, 0.0f); dComIfGp_particle_setSimple(0x103, &mTorchPos, 0xff, g_whiteColor, g_whiteColor, 0, 0.0f); - mDoAud_seStartLevel(0x80018, &mTorchPos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(this))); + mDoAud_seStartLevel(Z2SE_OBJ_FIRE_BURNING, &mTorchPos, 0, + dComIfGp_getReverb(fopAcM_GetRoomNo(this))); } setBaseMtx(); @@ -200,7 +201,8 @@ int daLv1Cdl00_c::Execute() { } else { fopAcM_offSwitch(this, fopAcM_GetParam(this) & 0xff); } - mDoAud_seStart(0x80017, &mTorchPos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(this))); + mDoAud_seStart(Z2SE_OBJ_FIRE_IGNITION, &mTorchPos, 0, + dComIfGp_getReverb(fopAcM_GetRoomNo(this))); setLight(); } if (gobj->GetAtType() == AT_TYPE_BOOMERANG && gobj->GetAtMtrl() == dCcD_MTRL_WIND && mIsLit == true) { @@ -211,7 +213,8 @@ int daLv1Cdl00_c::Execute() { } else { fopAcM_onSwitch(this, fopAcM_GetParam(this) & 0xff); } - mDoAud_seStart(0x80019, &mTorchPos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(this))); + mDoAud_seStart(Z2SE_OBJ_FIRE_OFF, &mTorchPos, 0, + dComIfGp_getReverb(fopAcM_GetRoomNo(this))); cutLight(); } cCcD_Obj* obj = mCyl.GetTgHitObj(); diff --git a/src/d/actor/d_a_obj_lv1Candle01.cpp b/src/d/actor/d_a_obj_lv1Candle01.cpp index 550250085ac..69a5ee0f4da 100644 --- a/src/d/actor/d_a_obj_lv1Candle01.cpp +++ b/src/d/actor/d_a_obj_lv1Candle01.cpp @@ -149,7 +149,8 @@ int daLv1Cdl01_c::Execute(f32 (**param_0)[3][4]) { g_whiteColor, g_whiteColor, 0, 0.0f); dComIfGp_particle_setSimple(0x103, &mTorchPos, 0xff, g_whiteColor, g_whiteColor, 0, 0.0f); - mDoAud_seStartLevel(0x80018, &mTorchPos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(this))); + mDoAud_seStartLevel(Z2SE_OBJ_FIRE_BURNING, &mTorchPos, 0, + dComIfGp_getReverb(fopAcM_GetRoomNo(this))); } setBaseMtx(); @@ -159,12 +160,14 @@ int daLv1Cdl01_c::Execute(f32 (**param_0)[3][4]) { if (gobj->GetAtType() == AT_TYPE_LANTERN_SWING && gobj->GetAtMtrl() == dCcD_MTRL_FIRE && !mIsLit) { mIsLit = true; setLight(); - mDoAud_seStart(0x80017, &mTorchPos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(this))); + mDoAud_seStart(Z2SE_OBJ_FIRE_IGNITION, &mTorchPos, 0, + dComIfGp_getReverb(fopAcM_GetRoomNo(this))); } if (gobj->GetAtType() == AT_TYPE_BOOMERANG && gobj->GetAtMtrl() == dCcD_MTRL_WIND && mIsLit == true) { mTimer = 30; mIsLit = false; - mDoAud_seStart(0x80019, &mTorchPos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(this))); + mDoAud_seStart(Z2SE_OBJ_FIRE_OFF, &mTorchPos, 0, + dComIfGp_getReverb(fopAcM_GetRoomNo(this))); cutLight(); } cCcD_Obj* obj = mCyl.GetTgHitObj(); diff --git a/src/d/actor/d_a_obj_lv2Candle.cpp b/src/d/actor/d_a_obj_lv2Candle.cpp index 66b14d74942..7da6dda01c7 100644 --- a/src/d/actor/d_a_obj_lv2Candle.cpp +++ b/src/d/actor/d_a_obj_lv2Candle.cpp @@ -280,7 +280,8 @@ int daLv2Candle_c::Execute() { g_whiteColor, g_whiteColor, 0, 0.0f); dComIfGp_particle_setSimple(0x103, &mTorchPos, 0xff, g_whiteColor, g_whiteColor, 0, 0.0f); - mDoAud_seStartLevel(0x80018, &mTorchPos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(this))); + mDoAud_seStartLevel(Z2SE_OBJ_FIRE_BURNING, &mTorchPos, 0, + dComIfGp_getReverb(fopAcM_GetRoomNo(this))); } if (field_0x734 != NULL) { @@ -305,7 +306,8 @@ int daLv2Candle_c::Execute() { } else { fopAcM_offSwitch(this, mSw); } - mDoAud_seStart(0x80017, &mTorchPos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(this))); + mDoAud_seStart(Z2SE_OBJ_FIRE_IGNITION, &mTorchPos, 0, + dComIfGp_getReverb(fopAcM_GetRoomNo(this))); setLight(); } if (gobj->GetAtType() == AT_TYPE_BOOMERANG && gobj->GetAtMtrl() == dCcD_MTRL_WIND && @@ -313,7 +315,8 @@ int daLv2Candle_c::Execute() { mIsLit = false; mCyl.SetAtMtrl(dCcD_MTRL_NONE); cutLight(); - mDoAud_seStart(0x80019, &mTorchPos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(this))); + mDoAud_seStart(Z2SE_OBJ_FIRE_OFF, &mTorchPos, 0, + dComIfGp_getReverb(fopAcM_GetRoomNo(this))); if (mSw == 0xff) { mTimer = l_HIO.mTimer; } diff --git a/src/d/actor/d_a_obj_lv3Candle.cpp b/src/d/actor/d_a_obj_lv3Candle.cpp index c64b556ae09..3648c0f6ef9 100644 --- a/src/d/actor/d_a_obj_lv3Candle.cpp +++ b/src/d/actor/d_a_obj_lv3Candle.cpp @@ -147,7 +147,8 @@ int daLv3Candle_c::Execute() { dComIfGp_particle_setSimple(0x101, &mTorchPos, 0xff, g_whiteColor, g_whiteColor, 0, 0.0f); dComIfGp_particle_setSimple(0x103, &mTorchPos, 0xff, g_whiteColor, g_whiteColor, 0, 0.0f); - mDoAud_seStartLevel(0x80018, &mTorchPos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(this))); + mDoAud_seStartLevel(Z2SE_OBJ_FIRE_BURNING, &mTorchPos, 0, + dComIfGp_getReverb(fopAcM_GetRoomNo(this))); if (mSph.ChkTgHit()) { cCcD_Obj* obj = mSph.GetTgHitObj(); diff --git a/src/d/d_msg_scrn_explain.cpp b/src/d/d_msg_scrn_explain.cpp index 74bf15bb6b5..ea799fdadc0 100644 --- a/src/d/d_msg_scrn_explain.cpp +++ b/src/d/d_msg_scrn_explain.cpp @@ -363,7 +363,7 @@ void dMsgScrnExplain_c::move_proc() { { mStatus = 5; dMeter2Info_set2DVibrationM(); - mDoAud_seStart(0x52, 0, 0, 0); + mDoAud_seStart(Z2SE_SY_EXP_WIN_CLOSE, 0, 0, 0); } } @@ -556,4 +556,4 @@ bool dMsgScrnExplain_c::checkTriggerA() { /* 8023E654-8023E668 238F94 0014+00 1/1 0/0 0/0 .text checkTriggerB__17dMsgScrnExplain_cFv */ bool dMsgScrnExplain_c::checkTriggerB() { return mDoCPd_c::getTrigB(PAD_1); -} \ No newline at end of file +}