Skip to content

Commit

Permalink
Add enums for island room numbers and indexes
Browse files Browse the repository at this point in the history
  • Loading branch information
LagoLunatic committed Jan 6, 2025
1 parent 37dbfd7 commit b18a1e4
Show file tree
Hide file tree
Showing 13 changed files with 176 additions and 59 deletions.
117 changes: 114 additions & 3 deletions include/d/d_save.h
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,115 @@ class dSv_player_collect_c {

STATIC_ASSERT(sizeof(dSv_player_collect_c) == 0xD);

enum dIslandRoomNo_e {
// Room 0 on the sea is not an island, it's the sea floor, used to load islands as you sail.
dIsleRoom_SeaFloor_e = 0,

/* 0x01 */ dIsleRoom_ForsakenFortress_e = 1,
/* 0x02 */ dIsleRoom_StarIsland_e = 2,
/* 0x03 */ dIsleRoom_NorthernFairyIsland_e = 3,
/* 0x04 */ dIsleRoom_GaleIsle_e = 4,
/* 0x05 */ dIsleRoom_CrescentMoonIsland_e = 5,
/* 0x06 */ dIsleRoom_SevenStarIsles_e = 6,
/* 0x07 */ dIsleRoom_OverlookIsland_e = 7,
/* 0x08 */ dIsleRoom_FourEyeReef_e = 8,
/* 0x09 */ dIsleRoom_MotherandChildIsles_e = 9,
/* 0x0A */ dIsleRoom_SpectacleIsland_e = 10,
/* 0x0B */ dIsleRoom_WindfallIsland_e = 11,
/* 0x0C */ dIsleRoom_PawprintIsle_e = 12,
/* 0x0D */ dIsleRoom_DragonRoostIsland_e = 13,
/* 0x0E */ dIsleRoom_FlightControlPlatform_e = 14,
/* 0x0F */ dIsleRoom_WesternFairyIsland_e = 15,
/* 0x10 */ dIsleRoom_RockSpireIsle_e = 16,
/* 0x11 */ dIsleRoom_TingleIsland_e = 17,
/* 0x12 */ dIsleRoom_NorthernTriangleIsland_e = 18,
/* 0x13 */ dIsleRoom_EasternFairyIsland_e = 19,
/* 0x14 */ dIsleRoom_FireMountain_e = 20,
/* 0x15 */ dIsleRoom_StarBeltArchipelago_e = 21,
/* 0x16 */ dIsleRoom_ThreeEyeReef_e = 22,
/* 0x17 */ dIsleRoom_GreatfishIsle_e = 23,
/* 0x18 */ dIsleRoom_CyclopsReef_e = 24,
/* 0x19 */ dIsleRoom_SixEyeReef_e = 25,
/* 0x1A */ dIsleRoom_ToweroftheGods_e = 26,
/* 0x1B */ dIsleRoom_EasternTriangleIsland_e = 27,
/* 0x1C */ dIsleRoom_ThornedFairyIsland_e = 28,
/* 0x1D */ dIsleRoom_NeedleRockIsle_e = 29,
/* 0x1E */ dIsleRoom_IsletofSteel_e = 30,
/* 0x1F */ dIsleRoom_StoneWatcherIsland_e = 31,
/* 0x20 */ dIsleRoom_SouthernTriangleIsland_e = 32,
/* 0x21 */ dIsleRoom_PrivateOasis_e = 33,
/* 0x22 */ dIsleRoom_BombIsland_e = 34,
/* 0x23 */ dIsleRoom_BirdsPeakRock_e = 35,
/* 0x24 */ dIsleRoom_DiamondSteppeIsland_e = 36,
/* 0x25 */ dIsleRoom_FiveEyeReef_e = 37,
/* 0x26 */ dIsleRoom_SharkIsland_e = 38,
/* 0x27 */ dIsleRoom_SouthernFairyIsland_e = 39,
/* 0x28 */ dIsleRoom_IceRingIsle_e = 40,
/* 0x29 */ dIsleRoom_ForestHaven_e = 41,
/* 0x2A */ dIsleRoom_CliffPlateauIsles_e = 42,
/* 0x2B */ dIsleRoom_HorseshoeIsland_e = 43,
/* 0x2C */ dIsleRoom_OutsetIsland_e = 44,
/* 0x2D */ dIsleRoom_HeadstoneIsland_e = 45,
/* 0x2E */ dIsleRoom_TwoEyeReef_e = 46,
/* 0x2F */ dIsleRoom_AngularIsles_e = 47,
/* 0x30 */ dIsleRoom_BoatingCourse_e = 48,
/* 0x31 */ dIsleRoom_FiveStarIsles_e = 49,
};

enum dIslandIndex_e {
dIsleIdx_ForsakenFortress_e = 0,
dIsleIdx_StarIsland_e = 1,
dIsleIdx_NorthernFairyIsland_e = 2,
dIsleIdx_GaleIsle_e = 3,
dIsleIdx_CrescentMoonIsland_e = 4,
dIsleIdx_SevenStarIsles_e = 5,
dIsleIdx_OverlookIsland_e = 6,
dIsleIdx_FourEyeReef_e = 7,
dIsleIdx_MotherandChildIsles_e = 8,
dIsleIdx_SpectacleIsland_e = 9,
dIsleIdx_WindfallIsland_e = 10,
dIsleIdx_PawprintIsle_e = 11,
dIsleIdx_DragonRoostIsland_e = 12,
dIsleIdx_FlightControlPlatform_e = 13,
dIsleIdx_WesternFairyIsland_e = 14,
dIsleIdx_RockSpireIsle_e = 15,
dIsleIdx_TingleIsland_e = 16,
dIsleIdx_NorthernTriangleIsland_e = 17,
dIsleIdx_EasternFairyIsland_e = 18,
dIsleIdx_FireMountain_e = 19,
dIsleIdx_StarBeltArchipelago_e = 20,
dIsleIdx_ThreeEyeReef_e = 21,
dIsleIdx_GreatfishIsle_e = 22,
dIsleIdx_CyclopsReef_e = 23,
dIsleIdx_SixEyeReef_e = 24,
dIsleIdx_ToweroftheGods_e = 25,
dIsleIdx_EasternTriangleIsland_e = 26,
dIsleIdx_ThornedFairyIsland_e = 27,
dIsleIdx_NeedleRockIsle_e = 28,
dIsleIdx_IsletofSteel_e = 29,
dIsleIdx_StoneWatcherIsland_e = 30,
dIsleIdx_SouthernTriangleIsland_e = 31,
dIsleIdx_PrivateOasis_e = 32,
dIsleIdx_BombIsland_e = 33,
dIsleIdx_BirdsPeakRock_e = 34,
dIsleIdx_DiamondSteppeIsland_e = 35,
dIsleIdx_FiveEyeReef_e = 36,
dIsleIdx_SharkIsland_e = 37,
dIsleIdx_SouthernFairyIsland_e = 38,
dIsleIdx_IceRingIsle_e = 39,
dIsleIdx_ForestHaven_e = 40,
dIsleIdx_CliffPlateauIsles_e = 41,
dIsleIdx_HorseshoeIsland_e = 42,
dIsleIdx_OutsetIsland_e = 43,
dIsleIdx_HeadstoneIsland_e = 44,
dIsleIdx_TwoEyeReef_e = 45,
dIsleIdx_AngularIsles_e = 46,
dIsleIdx_BoatingCourse_e = 47,
dIsleIdx_FiveStarIsles_e = 48,

dIsleIdx_COUNT_e = 49,
};

class dSv_player_map_c {
public:
void init();
Expand All @@ -306,7 +415,7 @@ class dSv_player_map_c {
BOOL isSaveArriveGridForAgb(int);

/* 0x00 */ u32 field_0x0[4][4];
/* 0x40 */ u8 field_0x40[49];
/* 0x40 */ u8 mFmapBits[dIsleIdx_COUNT_e];
/* 0x71 */ u8 field_0x71[16];
/* 0x81 */ u8 field_0x81;
/* 0x82 */ u8 field_0x82[0x84 - 0x82];
Expand Down Expand Up @@ -454,6 +563,8 @@ class dSv_player_c {

dSv_player_status_c_c* getpPlayerStatusC(int i_idx) { return &mStatusC[i_idx]; }

static const int PLAYER_STATUS_C_COUNT = 4;

static const int PACKED_STRUCT_SIZE =
sizeof(dSv_player_status_a_c) +
sizeof(dSv_player_status_b_c) +
Expand All @@ -470,7 +581,7 @@ class dSv_player_c {
sizeof(dSv_player_info_c) +
sizeof(dSv_player_config_c) +
sizeof(dSv_player_priest_c) +
sizeof(dSv_player_status_c_c) * 4;
sizeof(dSv_player_status_c_c) * PLAYER_STATUS_C_COUNT;

/* 0x000 */ dSv_player_status_a_c mPlayerStatusA;
/* 0x018 */ dSv_player_status_b_c mPlayerStatusB;
Expand All @@ -490,7 +601,7 @@ class dSv_player_c {
/* 0x1A4 */ dSv_player_config_c mConfig;
/* 0x1A9 */ /* 3 bytes of alignment padding */
/* 0x1AC */ dSv_player_priest_c mPriest;
/* 0x1BC */ dSv_player_status_c_c mStatusC[4];
/* 0x1BC */ dSv_player_status_c_c mStatusC[PLAYER_STATUS_C_COUNT];
/* 0x37C */ /* 4 bytes of alignment padding */
}; // Size: 0x380

Expand Down
26 changes: 13 additions & 13 deletions src/JAZelAudio/JAIZelBasic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ JAIZelBasic::JAIZelBasic() {
field_0x00c9 = 0;
field_0x00ca = 0;
mCameraSeaFloorGroupInfo = 0;
mIslandRoomNo = 0;
mIslandRoomNo = dIsleRoom_SeaFloor_e;
mLinkSeaFloorGroupInfo = 0;
field_0x021e = 0;
field_0x00cb = -1;
Expand Down Expand Up @@ -222,7 +222,7 @@ void JAIZelBasic::resetRecover() {
data->field_0x48->stop(0);
}
}
setScene(0, 0, 0, -1);
setScene(0, dIsleRoom_SeaFloor_e, 0, -1);
load1stDynamicWave();
sceneBgmStart();
load2ndDynamicWave();
Expand Down Expand Up @@ -1022,7 +1022,7 @@ void JAIZelBasic::setCameraGroupInfo(u8 param_1) {
}
} else if (mCameraSeaFloorGroupInfo & 0x80) {
OSReport("[JAIZelBasic::setCameraGroupInfo] Outer Edge -> Outer Sea\n");
mIslandRoomNo = 0;
mIslandRoomNo = dIsleRoom_SeaFloor_e;
} else if ((mCameraSeaFloorGroupInfo & 0x40) == 0 && mCameraSeaFloorGroupInfo) {
OSReport("[JAIZelBasic::setCameraGroupInfo] Inner Edge -> Inner Sea\n");
}
Expand All @@ -1034,7 +1034,7 @@ void JAIZelBasic::setCameraGroupInfo(u8 param_1) {
/* 802A9F60-802AA2B8 .text changeSeaBgm__11JAIZelBasicFv */
void JAIZelBasic::changeSeaBgm() {
if (field_0x0224 != 0x12) { return; }
if (mIslandRoomNo == 0) { return; }
if (mIslandRoomNo == dIsleRoom_SeaFloor_e) { return; }
if (mMainBgmNum == JA_BGM_DIE_LINK) { return; }
if (!checkEventBit(dSv_evtBit_c::MET_KORL)) { return; }
if (mAudioCamera->field_0x0 == NULL) { return; }
Expand Down Expand Up @@ -1099,7 +1099,7 @@ void JAIZelBasic::startIsleBgm() {
return;
}
u32 bgmNum;
if (mIslandRoomNo == 44 && checkEventBit(0xe20) == 1) {
if (mIslandRoomNo == dIsleRoom_OutsetIsland_e && checkEventBit(0xe20) == 1) {
bgmNum = JA_BGM_ISLAND_LINK_3;
} else {
bgmNum = m_isle_info[mIslandRoomNo].bgmNum;
Expand All @@ -1113,7 +1113,7 @@ void JAIZelBasic::setLinkGroupInfo(u8 param_1) {
if (field_0x0224 != 0x12) {
return;
}
if (mIslandRoomNo == 0) {
if (mIslandRoomNo == dIsleRoom_SeaFloor_e) {
return;
}
if (param_1 == mLinkSeaFloorGroupInfo) {
Expand Down Expand Up @@ -1159,7 +1159,7 @@ void JAIZelBasic::setScene(s32 sceneNum, s32 roomNo, s32 param_3, s32 layerNo) {
}
OSReport(" --- Isle = %d\n", mIslandRoomNo);
if (param_3 != 1) {
if (mIslandRoomNo == 44) {
if (mIslandRoomNo == dIsleRoom_OutsetIsland_e) {
if (layerNo == 10) {
bgmNum = 0;
} else if (checkEventBit(0x3510) == 0) {
Expand All @@ -1174,21 +1174,21 @@ void JAIZelBasic::setScene(s32 sceneNum, s32 roomNo, s32 param_3, s32 layerNo) {
bgmNum = m_isle_info[mIslandRoomNo].bgmNum;
bgmNum = expandSceneBgmNum(bgmNum);
}
} else if (mIslandRoomNo == 11) {
} else if (mIslandRoomNo == dIsleRoom_WindfallIsland_e) {
if (checkEventBit(0x2e01) == 0) {
bgmNum = 0;
} else {
bgmNum = m_isle_info[mIslandRoomNo].bgmNum;
bgmNum = expandSceneBgmNum(bgmNum);
}
} else if (mIslandRoomNo == 13) {
} else if (mIslandRoomNo == dIsleRoom_DragonRoostIsland_e) {
if (layerNo == 8 || layerNo == 10 || layerNo == 11) {
bgmNum = 0;
} else {
bgmNum = m_isle_info[mIslandRoomNo].bgmNum;
bgmNum = expandSceneBgmNum(bgmNum);
}
} else if (mIslandRoomNo == 14) {
} else if (mIslandRoomNo == dIsleRoom_FlightControlPlatform_e) {
if (layerNo == 2 || layerNo == 3) {
bgmNum = 0;
field_0x00bd = 1;
Expand All @@ -1204,7 +1204,7 @@ void JAIZelBasic::setScene(s32 sceneNum, s32 roomNo, s32 param_3, s32 layerNo) {
var1 = m_isle_info[mIslandRoomNo].field_0x2;
var2 = m_isle_info[mIslandRoomNo].field_0x3;
} else {
mIslandRoomNo = 0;
mIslandRoomNo = dIsleRoom_SeaFloor_e;
if (sceneNum == 16 && checkEventBit(0x280) == 0) {
bgmNum = JA_BGM_FIND_TETRA;
} else if (sceneNum == 19 && checkEventBit(0x801) == 0) {
Expand Down Expand Up @@ -1372,7 +1372,7 @@ u32 JAIZelBasic::expandSceneBgmNum(u32 bgmNum) {
/* 802AAD0C-802AAD48 .text checkLinkOnSea__11JAIZelBasicFv */
BOOL JAIZelBasic::checkLinkOnSea() {
if (field_0x0224 == 0x12) {
if (mIslandRoomNo == 0) {
if (mIslandRoomNo == dIsleRoom_SeaFloor_e) {
return TRUE;
} else if (mLinkSeaFloorGroupInfo != 0) {
return TRUE;
Expand Down Expand Up @@ -1643,7 +1643,7 @@ int JAIZelBasic::checkOnOuterSea(f32* r4) {
if (field_0x0224 != 0x12) {
return -1;
}
if (mIslandRoomNo == 0) {
if (mIslandRoomNo == dIsleRoom_SeaFloor_e) {
return 4;
}
isle_area_s sp0C = mIsleArea[mIslandRoomNo];
Expand Down
12 changes: 6 additions & 6 deletions src/d/actor/d_a_agbsw0.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -907,7 +907,7 @@ u32 daAgbsw0_c::TriforceCheck(daAgb_c* agb)
#else
int roomNo = agb->field_0x66d;
#endif
return roomNo == 0x21 ? 0x30A : 0x30B;
return roomNo == dIsleRoom_PrivateOasis_e ? 0x30A : 0x30B;
}
else {
u8 num = dComIfGs_checkGetItemNum(dItem_JOY_PENDANT_e);
Expand All @@ -922,7 +922,7 @@ u32 daAgbsw0_c::TriforceCheck(daAgb_c* agb)
#else
int roomNo = agb->field_0x66d;
#endif
return roomNo == 0x23 ? 0x311 : 0x310;
return roomNo == dIsleRoom_BirdsPeakRock_e ? 0x311 : 0x310;
}
else {
return 0x30F;
Expand Down Expand Up @@ -1021,7 +1021,7 @@ u32 daAgbsw0_c::TriforceCheck(daAgb_c* agb)
#else
int roomNo = agb->field_0x66d;
#endif
return roomNo == 0x1D ? 0x31C : 0x31D;
return roomNo == dIsleRoom_NeedleRockIsle_e ? 0x31C : 0x31D;
}
}
if(!dComIfGs_isCollect(2, 0)) {
Expand All @@ -1039,23 +1039,23 @@ u32 daAgbsw0_c::TriforceCheck(daAgb_c* agb)
#else
int roomNo = agb->field_0x66d;
#endif
return roomNo == 0x2C ? 0x325 : 0x324;
return roomNo == dIsleRoom_OutsetIsland_e ? 0x325 : 0x324;
}
if(!dComIfGs_isGetCollectMap(7)) {
#if VERSION == VERSION_JPN
s8 roomNo = dComIfGp_roomControl_getStayNo();
#else
int roomNo = agb->field_0x66d;
#endif
return roomNo == 0x1F ? 0x327 : 0x326;
return roomNo == dIsleRoom_StoneWatcherIsland_e ? 0x327 : 0x326;
}
if(dComIfGs_checkGetItem(dItem_HOOKSHOT_e)) {
#if VERSION == VERSION_JPN
s8 roomNo = dComIfGp_roomControl_getStayNo();
#else
int roomNo = agb->field_0x66d;
#endif
return roomNo == 0x7 ? 0x32C : 0x32D;
return roomNo == dIsleRoom_OverlookIsland_e ? 0x32C : 0x32D;
}

return 0x32B;
Expand Down
18 changes: 9 additions & 9 deletions src/d/actor/d_a_lod_bg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,10 @@ BOOL daLodbg_c::createModelData() {
if (!loadModelData(resPath, mModelData, mDataHeap, mDataSize))
return FALSE;

if (getRoomNo() == 11) { // windfall
if (getRoomNo() == dIsleRoom_WindfallIsland_e) {
if (!loadModelData("/lod11/bdl/shikari.bdl", mModelData2, mDataHeap2, mDataSize2))
return FALSE;
} else if (getRoomNo() == 1 && !dComIfGs_isEventBit(0x1820)) { // forsaken
} else if (getRoomNo() == dIsleRoom_ForsakenFortress_e && !dComIfGs_isEventBit(0x1820)) {
if (!loadModelData("/lod01/bdl/model1.bdl", mModelData2, mDataHeap2, mDataSize2))
return FALSE;
}
Expand All @@ -170,7 +170,7 @@ BOOL daLodbg_c::createHeap() {
mModel = mDoExt_J3DModel__create(mModelData, 0x80000, 0x11000022);
if (mModel == NULL)
return FALSE;
if (getRoomNo() == 11) { // windfall
if (getRoomNo() == dIsleRoom_WindfallIsland_e) {
JUT_ASSERT(0x1bf, mModelData2 != NULL);
for (s32 i = 0; i < 2; i++) {
mModel2[i] = mDoExt_J3DModel__create(mModelData2, 0x80000, 0x11000022);
Expand All @@ -180,7 +180,7 @@ BOOL daLodbg_c::createHeap() {
return FALSE;
}
}
} else if (getRoomNo() == 1 && mModelData2 != NULL) { // forsaken
} else if (getRoomNo() == dIsleRoom_ForsakenFortress_e && mModelData2 != NULL) {
mModel2[0] = mDoExt_J3DModel__create(mModelData2, 0x80000, 0x11000022);
if (mModel2[0] == NULL) {
mModel = NULL;
Expand Down Expand Up @@ -267,7 +267,7 @@ BOOL daLodbg_c::execDeleteWait() {
mDoMtx_stack_c::YrotM(shape_angle.y);
mModel->setBaseTRMtx(mDoMtx_stack_c::get());
if (mModel2[0] != NULL) {
if (roomNo == 11) { // windfall
if (roomNo == dIsleRoom_WindfallIsland_e) {
mDrawModel2 = daObjLight::Act_c::renew_light_angle();
if (mDrawModel2) {
mDoMtx_stack_c::transS(630.46338f, y + 4044.508f, -202724.0f);
Expand All @@ -276,7 +276,7 @@ BOOL daLodbg_c::execDeleteWait() {
mDoMtx_stack_c::YrotM(-0x8000);
mModel2[1]->setBaseTRMtx(mDoMtx_stack_c::get());
}
} else if (roomNo == 1) { // forsaken
} else if (roomNo == dIsleRoom_ForsakenFortress_e) {
mModel2[0]->setBaseTRMtx(mDoMtx_stack_c::get());
mDrawModel2 = true;
}
Expand All @@ -303,7 +303,7 @@ BOOL daLodbg_c::draw() {
return TRUE;

s32 roomNo = getRoomNo();
if (roomNo == 26 && !dComIfGs_isEventBit(0x1e40)) // totg
if (roomNo == dIsleRoom_ToweroftheGods_e && !dComIfGs_isEventBit(0x1e40))
return TRUE;

g_env_light.settingTevStruct(TEV_TYPE_BG0, NULL, &tevStr);
Expand All @@ -317,7 +317,7 @@ BOOL daLodbg_c::draw() {
mDoExt_modelEntryDL(mModel);

if (mModel2[0] != NULL && mDrawModel2) {
if (roomNo == 11) { // windfall
if (roomNo == dIsleRoom_WindfallIsland_e) {
J3DModelData* modelData = mModel2[0]->getModelData();
for (u16 i = 0; i < modelData->getMaterialNum(); i++)
modelData->getMaterialNodePointer(i)->getTevKColor(3)->mColor.a = mAlpha;
Expand All @@ -327,7 +327,7 @@ BOOL daLodbg_c::draw() {
mDoLib_clipper::clip(mModel2[i]);
mDoExt_modelEntryDL(mModel2[i]);
}
} else if (roomNo == 1) { // forsaken
} else if (roomNo == dIsleRoom_ForsakenFortress_e) {
g_env_light.setLightTevColorType(mModel2[0], &tevStr);
J3DModelData* modelData = mModel2[0]->getModelData(); // ??? was this supposed to modify mModel2?
for (u16 i = 0; i < modelData->getMaterialNum(); i++)
Expand Down
Loading

0 comments on commit b18a1e4

Please sign in to comment.