summaryrefslogtreecommitdiff
path: root/src/Z2AudioLib/Z2SoundObjMgr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Z2AudioLib/Z2SoundObjMgr.cpp')
-rw-r--r--src/Z2AudioLib/Z2SoundObjMgr.cpp203
1 files changed, 82 insertions, 121 deletions
diff --git a/src/Z2AudioLib/Z2SoundObjMgr.cpp b/src/Z2AudioLib/Z2SoundObjMgr.cpp
index 74723562aa..a4bfb2bc9c 100644
--- a/src/Z2AudioLib/Z2SoundObjMgr.cpp
+++ b/src/Z2AudioLib/Z2SoundObjMgr.cpp
@@ -8,10 +8,8 @@
#include "Z2AudioLib/Z2SeqMgr.h"
#include "Z2AudioLib/Z2Calc.h"
#include "Z2AudioLib/Z2SceneMgr.h"
-#include "dol2asm.h"
/* 802BF920-802BF980 2BA260 0060+00 0/0 1/1 0/0 .text __ct__13Z2SoundObjMgrFv */
-// order wrong because this needs to inherit from JASGlobalInstance<T>
Z2SoundObjMgr::Z2SoundObjMgr() : JASGlobalInstance<Z2SoundObjMgr>(this) {
mGhostEnemyState = 0;
mTwilightBattle = 0;
@@ -28,122 +26,96 @@ void Z2SoundObjMgr::setForceBattleArea(bool forceBattle, u16 param_1, u16 param_
mEnemyArea.field_0x6 = param_3;
}
-struct EnemyInfo {
- u8 field_0x0;
- u8 field_0x1;
- u8 field_0x2;
- u8 field_0x3;
- u8 field_0x4;
- u8 field_0x5;
- u8 field_0x6;
- u8 field_0x7;
- u32 field_0x8;
- u32 field_0xc;
-};
-
-/* 803CAD70-803CB170 027E90 0400+00 3/3 0/0 0/0 .data mEnemyInfo */
-SECTION_DATA static EnemyInfo mEnemyInfo[64] = {
- {0x44, 0x75, 0x6D, 0x6D, 0x79, 0x00, 0x00, 0x00, 0x00000000, 0x00000000},
- {0x45, 0x5F, 0x73, 0x31, 0x00, 0x00, 0x00, 0x00, 0x010002BC, 0x04B007D0},
- {0x45, 0x5F, 0x79, 0x6B, 0x00, 0x00, 0x00, 0x00, 0x00000000, 0x00000000},
- {0x45, 0x5F, 0x79, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00000000, 0x00000000},
- {0x45, 0x5F, 0x79, 0x67, 0x00, 0x00, 0x00, 0x00, 0x0100012C, 0x01F402BC},
- {0x45, 0x5F, 0x79, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00000000, 0x00000000},
- {0x45, 0x5F, 0x79, 0x64, 0x00, 0x00, 0x00, 0x00, 0x010001F4, 0x038405DC},
- {0x45, 0x5F, 0x72, 0x64, 0x79, 0x00, 0x00, 0x00, 0x00000000, 0x00000000},
- {0x45, 0x5F, 0x79, 0x6D, 0x62, 0x00, 0x00, 0x00, 0x0000000A, 0x0014001E},
- {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00000000, 0x00000000},
- {0x45, 0x5F, 0x77, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00000000, 0x00000000},
- {0x45, 0x5F, 0x72, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00000000, 0x00000000},
- {0x45, 0x5F, 0x64, 0x6E, 0x00, 0x00, 0x00, 0x00, 0x00000000, 0x00000000},
- {0x45, 0x5F, 0x6B, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00000000, 0x00000000},
- {0x45, 0x5F, 0x73, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00000000, 0x00000000},
- {0x45, 0x5F, 0x74, 0x6B, 0x00, 0x00, 0x00, 0x00, 0x010002BC, 0x05DC09C4},
- {0x45, 0x5F, 0x74, 0x6B, 0x32, 0x00, 0x00, 0x00, 0x010002BC, 0x05DC09C4},
- {0x45, 0x5F, 0x63, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00000000, 0x00000000},
- {0x45, 0x5F, 0x64, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00000000, 0x00000000},
- {0x45, 0x5F, 0x66, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00000000, 0x00000000},
- {0x45, 0x5F, 0x53, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00000000, 0x00000000},
- {0x45, 0x5F, 0x50, 0x4D, 0x00, 0x00, 0x00, 0x00, 0x00000000, 0x00000000},
- {0x45, 0x5F, 0x64, 0x62, 0x00, 0x00, 0x00, 0x00, 0x010001F4, 0x03840708},
- {0x45, 0x5F, 0x6B, 0x67, 0x00, 0x00, 0x00, 0x00, 0x00000000, 0x00000000},
- {0x45, 0x5F, 0x73, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00000000, 0x00000000},
- {0x45, 0x5F, 0x73, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00000000, 0x00000000},
- {0x45, 0x5F, 0x62, 0x73, 0x00, 0x00, 0x00, 0x00, 0x010000C8, 0x01900258},
- {0x45, 0x5F, 0x53, 0x4D, 0x00, 0x00, 0x00, 0x00, 0x00000000, 0x00000000},
- {0x45, 0x5F, 0x62, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00000000, 0x00000000},
- {0x45, 0x5F, 0x62, 0x75, 0x00, 0x00, 0x00, 0x00, 0x00000000, 0x00000000},
- {0x45, 0x5F, 0x48, 0x4D, 0x00, 0x00, 0x00, 0x00, 0x00000000, 0x00000000},
- {0x45, 0x5F, 0x67, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00000000, 0x00000000},
- {0x45, 0x5F, 0x68, 0x7A, 0x00, 0x00, 0x00, 0x00, 0x000001F4, 0x03200514},
- {0x45, 0x5F, 0x77, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00000000, 0x00000000},
- {0x45, 0x5F, 0x6F, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00000000, 0x00000000},
- {0x45, 0x5F, 0x66, 0x7A, 0x00, 0x00, 0x00, 0x00, 0x00000000, 0x00000000},
- {0x45, 0x5F, 0x66, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00000000, 0x00000000},
- {0x45, 0x5F, 0x62, 0x67, 0x00, 0x00, 0x00, 0x00, 0x00000000, 0x00000000},
- {0x45, 0x5F, 0x6D, 0x6D, 0x00, 0x00, 0x00, 0x00, 0x010001F4, 0x032005DC},
- {0x45, 0x5F, 0x6E, 0x7A, 0x00, 0x00, 0x00, 0x00, 0x010001F4, 0x02BC044C},
- {0x45, 0x5F, 0x70, 0x6F, 0x00, 0x00, 0x00, 0x00, 0x00000000, 0x00000000},
- {0x45, 0x5F, 0x72, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00000000, 0x00000000},
- {0x45, 0x5F, 0x73, 0x67, 0x00, 0x00, 0x00, 0x00, 0x010001F4, 0x02BC0384},
- {0x45, 0x5F, 0x68, 0x62, 0x00, 0x00, 0x00, 0x00, 0x010001F4, 0x038405DC},
- {0x45, 0x5F, 0x67, 0x62, 0x00, 0x00, 0x00, 0x00, 0x01000640, 0x0BB80FA0},
- {0x45, 0x5F, 0x6D, 0x73, 0x00, 0x00, 0x00, 0x00, 0x010001F4, 0x02BC044C},
- {0x45, 0x5F, 0x64, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00000000, 0x00000000},
- {0x45, 0x5F, 0x62, 0x69, 0x00, 0x00, 0x00, 0x00, 0x010001F4, 0x02BC0384},
- {0x45, 0x5F, 0x74, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00000000, 0x00000000},
- {0x45, 0x5F, 0x61, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00000000, 0x00000000},
- {0x45, 0x5F, 0x64, 0x6B, 0x00, 0x00, 0x00, 0x00, 0x00000000, 0x00000000},
- {0x45, 0x5F, 0x77, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00000000, 0x00000000},
- {0x45, 0x5F, 0x67, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00000000, 0x00000000},
- {0x45, 0x5F, 0x73, 0x6D, 0x32, 0x00, 0x00, 0x00, 0x00000000, 0x00000000},
- {0x45, 0x5F, 0x73, 0x77, 0x00, 0x00, 0x00, 0x00, 0x01000190, 0x025805DC},
- {0x45, 0x5F, 0x72, 0x64, 0x62, 0x00, 0x00, 0x00, 0x010001F4, 0x03E805DC},
- {0x45, 0x5F, 0x6B, 0x6B, 0x00, 0x00, 0x00, 0x00, 0x00000000, 0x00000000},
- {0x45, 0x5F, 0x68, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00000000, 0x00000000},
- {0x45, 0x5F, 0x7A, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00000000, 0x00000000},
- {0x45, 0x5F, 0x67, 0x6D, 0x00, 0x00, 0x00, 0x00, 0x00000000, 0x00000000},
- {0x42, 0x5F, 0x47, 0x47, 0x00, 0x00, 0x00, 0x00, 0x000003E8, 0x07D00FA0},
- {0x45, 0x5F, 0x6D, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00000000, 0x00000000},
- {0x45, 0x5F, 0x7A, 0x6D, 0x00, 0x00, 0x00, 0x00, 0x00000000, 0x00000000},
- {0x42, 0x5F, 0x74, 0x6E, 0x00, 0x00, 0x00, 0x00, 0x00000000, 0x00000000},
-};
-
/* 80455B80-80455B84 004180 0004+00 1/1 0/0 0/0 .sdata2 sAreaDefault */
-SECTION_SDATA2 static u32 sAreaDefault = 0x010002BC;
-
-/* 80455B84-80455B88 004184 0004+00 1/1 0/0 0/0 .sdata2 None */
-SECTION_SDATA2 static u32 data_80455B84 = 0x044C05DC;
+static Z2EnemyArea const sAreaDefault = {true, 700, 1100, 1500};
/* 80455B88-80455B8C 004188 0004+00 1/1 0/0 0/0 .sdata2 sAreaFloating */
-SECTION_SDATA2 static u32 sAreaFloating = 0x000002BC;
-
-/* 80455B8C-80455B90 00418C 0004+00 1/1 0/0 0/0 .sdata2 None */
-SECTION_SDATA2 static u32 data_80455B8C = 0x044C05DC;
+static Z2EnemyArea const sAreaFloating = {false, 700, 1100, 1500};
/* 80455B90-80455B94 004190 0004+00 1/1 0/0 0/0 .sdata2 sAreaWide */
-SECTION_SDATA2 static u32 sAreaWide = 0x010002BC;
-
-/* 80455B94-80455B98 004194 0004+00 1/1 0/0 0/0 .sdata2 None */
-SECTION_SDATA2 static u32 data_80455B94 = 0x05DC0CE4;
+static Z2EnemyArea const sAreaWide = {true, 700, 1500, 3300};
/* 80455B98-80455B9C 004198 0004+00 1/1 0/0 0/0 .sdata2 sAreaWideFloating */
-SECTION_SDATA2 static u32 sAreaWideFloating = 0x000002BC;
-
-/* 80455B9C-80455BA0 00419C 0004+00 1/1 0/0 0/0 .sdata2 None */
-SECTION_SDATA2 static u32 data_80455B9C = 0x05DC0CE4;
+static Z2EnemyArea const sAreaWideFloating = {false, 700, 1500, 3300};
/* 80455BA0-80455BA4 0041A0 0004+00 1/1 0/0 0/0 .sdata2 sAreaSmall */
-SECTION_SDATA2 static u32 sAreaSmall = 0x0100012C;
-
-/* 80455BA4-80455BA8 0041A4 0004+00 1/1 0/0 0/0 .sdata2 None */
-SECTION_SDATA2 static u32 data_80455BA4 = 0x02BC03E8;
+static Z2EnemyArea const sAreaSmall = {true, 300, 700, 1000};
/* 80455BA8-80455BAC 0041A8 0004+00 1/1 0/0 0/0 .sdata2 sAreaSmallFloating */
-SECTION_SDATA2 static u32 sAreaSmallFloating = 0x000001F4;
+static Z2EnemyArea const sAreaSmallFloating = {false, 500, 800, 1200};
-/* 80455BAC-80455BB0 0041AC 0004+00 1/1 0/0 0/0 .sdata2 None */
-SECTION_SDATA2 static u32 data_80455BAC = 0x032004B0;
+struct EnemyInfo {
+ char mName[8];
+ Z2EnemyArea mEnemyArea;
+};
+
+/* 803CAD70-803CB170 027E90 0400+00 3/3 0/0 0/0 .data mEnemyInfo */
+static EnemyInfo mEnemyInfo[64] = {
+ {"Dummy", sAreaDefault},
+ {"E_s1", {true, 700, 1200, 2000}},
+ {"E_yk", sAreaSmallFloating},
+ {"E_yr", sAreaWideFloating},
+ {"E_yg", {true, 300, 500, 700}},
+ {"E_yc", sAreaWideFloating},
+ {"E_yd", {true, 500, 900, 1500}},
+ {"E_rdy", sAreaDefault},
+ {"E_ymb", {false, 10, 20, 30}},
+ {"", sAreaDefault},
+ {"E_wb", sAreaDefault},
+ {"E_rd", sAreaDefault},
+ {"E_dn", sAreaDefault},
+ {"E_kr", sAreaWideFloating},
+ {"E_st", sAreaDefault},
+ {"E_tk", {true, 700, 1500, 2500}},
+ {"E_tk2", {true, 700, 1500, 2500}},
+ {"E_cr", sAreaSmall},
+ {"E_df", sAreaDefault},
+ {"E_fs", sAreaDefault},
+ {"E_SB", sAreaDefault},
+ {"E_PM", sAreaDefault},
+ {"E_db", {true, 500, 900, 1800}},
+ {"E_kg", sAreaSmall},
+ {"E_sh", sAreaDefault},
+ {"E_sf", sAreaDefault},
+ {"E_bs", {true, 200, 400, 600}},
+ {"E_SM", sAreaDefault},
+ {"E_ba", sAreaSmallFloating},
+ {"E_bu", sAreaFloating},
+ {"E_HM", sAreaDefault},
+ {"E_ge", sAreaFloating},
+ {"E_hz", {false, 500, 800, 1300}},
+ {"E_ws", sAreaSmallFloating},
+ {"E_oc", sAreaDefault},
+ {"E_fz", sAreaDefault},
+ {"E_fb", sAreaDefault},
+ {"E_bg", sAreaSmall},
+ {"E_mm", {true, 500, 800, 1500}},
+ {"E_nz", {true, 500, 700, 1100}},
+ {"E_po", sAreaWide},
+ {"E_rb", sAreaDefault},
+ {"E_sg", {true, 500, 700, 900}},
+ {"E_hb", {true, 500, 900, 1500}},
+ {"E_gb", {true, 1600, 3000, 4000}},
+ {"E_ms", {true, 500, 700, 1100}},
+ {"E_dd", sAreaDefault},
+ {"E_bi", {true, 500, 700, 900}},
+ {"E_tt", sAreaSmallFloating},
+ {"E_ai", sAreaDefault},
+ {"E_dk", sAreaSmall},
+ {"E_ww", sAreaWide},
+ {"E_gi", sAreaDefault},
+ {"E_sm2", sAreaDefault},
+ {"E_sw", {true, 400, 600, 1500}},
+ {"E_rdb", {true, 500, 1000, 1500}},
+ {"E_kk", sAreaDefault},
+ {"E_hp", sAreaDefault},
+ {"E_zh", sAreaDefault},
+ {"E_gm", sAreaSmall},
+ {"B_GG", {false, 1000, 2000, 4000}},
+ {"E_mf", sAreaDefault},
+ {"E_zm", sAreaDefault},
+ {"B_tn", sAreaDefault},
+};
/* 802BF994-802BFFEC 2BA2D4 0658+00 1/0 1/1 0/0 .text searchEnemy__13Z2SoundObjMgrFv */
void Z2SoundObjMgr::searchEnemy() {
@@ -157,7 +129,7 @@ void Z2SoundObjMgr::searchEnemy() {
bool bVar7 = false;
bool local_96 = false;
bool iVar8 = false;
- if (Z2GetSeqMgr()->getMainBgmID() == 0x1000041) {
+ if (Z2GetSeqMgr()->getMainBgmID() == Z2BGM_HOLY_FOREST) {
iVar8 = true;
}
u8 iVar16 = 0;
@@ -233,13 +205,12 @@ void Z2SoundObjMgr::searchEnemy() {
if (iVar10 != NULL) {
Vec* iVar14 = Z2GetLink()->getCurrentPos();
if (iVar14 != NULL) {
- Z2EnemyArea local_88;
- __memcpy(&local_88, &mEnemyInfo[enemyId].field_0x8, 8);
+ Z2EnemyArea local_88 = mEnemyInfo[enemyId].mEnemyArea;
if (mForceBattle) {
local_88 = mEnemyArea;
}
f32 fVar2 = 2.0f;
- if (local_88.field_0x0 == 1) {
+ if (local_88.field_0x0 == true) {
fVar2 = 4.0f;
}
Vec local_80 = {0.0f, 0.0f, 0.0f};
@@ -369,7 +340,7 @@ void Z2SoundObjMgr::setGhostEnemyState(u8 p1) {
u8 Z2SoundObjMgr::getEnemyID(char const* param_0, JSULink<Z2CreatureEnemy>* param_1) {
if (param_0 != NULL) {
for (u8 uVar2 = 0; uVar2 < 0x40; uVar2++) {
- if (strcmp(param_0, (char*)&mEnemyInfo[(u32)uVar2].field_0x0) == 0) {
+ if (strcmp(param_0, mEnemyInfo[(u32)uVar2].mName) == 0) {
append(param_1);
return uVar2;
}
@@ -431,13 +402,3 @@ bool Z2SoundObjMgr::removeEnemy(JSULink<Z2CreatureEnemy>* param_0) {
u8 Z2SoundObjMgr::isTwilightBattle() {
return mTwilightBattle;
}
-
-/* 802C01EC-802C03C8 2BAB2C 01DC+00 0/0 1/0 0/0 .text __sinit_Z2SoundObjMgr_cpp */
-void __sinit_Z2SoundObjMgr_cpp() {
- // NONMATCHING
-}
-
-#pragma push
-#pragma force_active on
-REGISTER_CTORS(0x802C01EC, __sinit_Z2SoundObjMgr_cpp);
-#pragma pop \ No newline at end of file