diff --git a/include/d/actor/d_a_oship.h b/include/d/actor/d_a_oship.h index 7cc6986e6..94001769e 100644 --- a/include/d/actor/d_a_oship.h +++ b/include/d/actor/d_a_oship.h @@ -66,7 +66,7 @@ public: /* 0x2B2 */ u8 mSwitchB; /* 0x2B3 */ u8 mPathId; /* 0x2B4 */ u8 mTriforce; - /* 0x2B5 */ u8 mFmapIdx; + /* 0x2B5 */ u8 mRandomSalvagePoint; /* 0x2B6 */ u8 mModelType; /* 0x2B7 */ u8 m2B7[0x2B8 - 0x2B7]; /* 0x2B8 */ cXyz mOrigPos; diff --git a/include/d/d_com_inf_game.h b/include/d/d_com_inf_game.h index c2cac3e96..781a94ba1 100644 --- a/include/d/d_com_inf_game.h +++ b/include/d/d_com_inf_game.h @@ -1148,10 +1148,38 @@ inline int dComIfGs_getTriforceNum() { return g_dComIfG_gameInfo.save.getPlayer().getCollect().getTriforceNum(); } +inline u8 dComIfGs_getOptRuby() { + return g_dComIfG_gameInfo.save.getPlayer().getConfig().getRuby(); +} + +inline void dComIfGs_setOptRuby(u8 ruby) { + g_dComIfG_gameInfo.save.getPlayer().getConfig().setRuby(ruby); +} + +inline u8 dComIfGs_getOptSound() { + return g_dComIfG_gameInfo.save.getPlayer().getConfig().getSound(); +} + +inline void dComIfGs_setOptSound(u8 mode) { + g_dComIfG_gameInfo.save.getPlayer().getConfig().setSound(mode); +} + +inline u8 dComIfGs_getOptAttentionType() { + return g_dComIfG_gameInfo.save.getPlayer().getConfig().getAttentionType(); +} + +inline void dComIfGs_setOptAttentionType(u8 type) { + g_dComIfG_gameInfo.save.getPlayer().getConfig().setAttentionType(type); +} + inline u8 dComIfGs_getOptVibration() { return g_dComIfG_gameInfo.save.getPlayer().getConfig().getVibration(); } +inline void dComIfGs_setOptVibration(u8 vib) { + g_dComIfG_gameInfo.save.getPlayer().getConfig().setVibration(vib); +} + inline BOOL dComIfGs_isTbox(int i_no) { return g_dComIfG_gameInfo.save.getMemory().getBit().isTbox(i_no); } @@ -1445,10 +1473,30 @@ inline const char* dComIfGs_getPlayerName() { return g_dComIfG_gameInfo.save.getPlayer().getPlayerInfo().getPlayerName(); } +inline void dComIfGs_setPlayerName(const char* name) { + g_dComIfG_gameInfo.save.getPlayer().getPlayerInfo().setPlayerName(name); +} + inline u8 dComIfGs_getClearCount() { return g_dComIfG_gameInfo.save.getPlayer().getPlayerInfo().getClearCount(); } +inline void dComIfGs_setClearCount(u8 count) { + g_dComIfG_gameInfo.save.getPlayer().getPlayerInfo().setClearCount(count); +} + +inline void dComIfGs_clearCountUp() { + return g_dComIfG_gameInfo.save.getPlayer().getPlayerInfo().clearCountUp(); +} + +inline u8 dComIfGs_getRandomSalvagePoint() { + return g_dComIfG_gameInfo.save.getPlayer().getPlayerInfo().getRandomSalvage(); +} + +inline void dComIfGs_setRandomSalvagePoint(u8 point) { + g_dComIfG_gameInfo.save.getPlayer().getPlayerInfo().setRandomSalvage(point); +} + inline u8 dComIfGs_getGbaRupeeCount() { return g_dComIfG_gameInfo.save.getDan().getGbaRupeeCount(); } diff --git a/include/d/d_save.h b/include/d/d_save.h index e3f86d127..e7ac36f32 100644 --- a/include/d/d_save.h +++ b/include/d/d_save.h @@ -3,6 +3,7 @@ #include "global.h" #include "SSystem/SComponent/c_xyz.h" +#include "string.h" class dSv_player_status_a_c { public: @@ -316,16 +317,16 @@ public: void init(); const char* getPlayerName() const { return mPlayerName; } - void setPlayerName(const char*) {} + void setPlayerName(const char* name) { strcpy(mPlayerName, name); } u8 getClearCount() { return mClearCount; } + void setClearCount(u8 count) { mClearCount = count; } void clearCountUp() {} - void setClearCount(u8) {} void addDeathCount() {} void getPuzzleInfo() {} void setPuzzleInfo(u8) {} void setPuzzleData(int, u8) {} - void getRandomSalvage() {} - void setRandomSalvage(u8) {} + u8 getRandomSalvage() { return mRandomSalvagePoint; } + void setRandomSalvage(u8 point) { mRandomSalvagePoint = point; } /* 0x00 */ u8 field_0x0[0x10]; /* 0x10 */ u16 field_0x10; @@ -335,7 +336,7 @@ public: /* 0x36 */ char field_0x36[17]; /* 0x47 */ char field_0x47[17]; /* 0x58 */ u8 mClearCount; - /* 0x59 */ u8 mFmapIdx; + /* 0x59 */ u8 mRandomSalvagePoint; /* 0x5A */ u8 field_0x5a[0x5c - 0x5a]; }; // Size: 0x5C @@ -346,16 +347,16 @@ public: void init(); s32 checkVibration(); - u8 getVibration() { return mVibration; } - void setVibration(u8 vib) { mVibration = vib; } - u8 getAttentionType() { return mAttentionType; } - void setAttentionType(u8 type) { mAttentionType = type; } - void getRuby() {} - void setRuby(u8) {} + u8 getRuby() { return mRuby; } + void setRuby(u8 ruby) { mRuby = ruby; } u8 getSound() { return mSoundMode; } void setSound(u8 mode) { mSoundMode = mode; } + u8 getAttentionType() { return mAttentionType; } + void setAttentionType(u8 type) { mAttentionType = type; } + u8 getVibration() { return mVibration; } + void setVibration(u8 vib) { mVibration = vib; } - /* 0x0 */ u8 field_0x0; + /* 0x0 */ u8 mRuby; /* 0x1 */ u8 mSoundMode; /* 0x2 */ u8 mAttentionType; /* 0x3 */ u8 mVibration; diff --git a/src/d/d_item.cpp b/src/d/d_item.cpp index 42c38fdad..d9dcb45a8 100644 --- a/src/d/d_item.cpp +++ b/src/d/d_item.cpp @@ -611,7 +611,7 @@ void item_func_l_magic() { /* 800C3008-800C3060 .text item_func_bomb_5__Fv */ void item_func_bomb_5() { dComIfGs_onGetItem(0xD, 0); - dComIfGp_setItem(0xD, 0xB); + dComIfGp_setItem(0xD, BOMB_5); dComIfGp_setItemBombNumCount(5); } diff --git a/src/d/d_save.cpp b/src/d/d_save.cpp index 40f538c3e..c5f066708 100644 --- a/src/d/d_save.cpp +++ b/src/d/d_save.cpp @@ -944,15 +944,15 @@ void dSv_player_info_c::init() { field_0x47[i] = 0; } - mFmapIdx = cM_rndF(3.0f); - if (mFmapIdx >= 3) { - mFmapIdx = 2; + mRandomSalvagePoint = cM_rndF(3.0f); + if (mRandomSalvagePoint >= 3) { + mRandomSalvagePoint = 2; } } /* 8005BF2C-8005BFA4 .text init__19dSv_player_config_cFv */ void dSv_player_config_c::init() { - field_0x0 = 1; + mRuby = 1; u32 soundMode = OSGetSoundMode(); if (soundMode == 0) { @@ -1350,6 +1350,62 @@ void dSv_info_c::reinit() { 0x84FF, 0x83FF, 0x82FF, 0x81FF, 0x80FF}; static u16 l_onEventBit[] = {0x2F08, 0x2F04, 0x2F02, 0x3A01, 0x3401}; + + u8* r29 = new u8[ARRAY_SIZE(l_holdEventReg)]; + for (int i = 0; i < ARRAY_SIZE(l_holdEventReg); i++) { + r29[i] = dComIfGs_getEventReg(l_holdEventReg[i]); + } + + u8 clearCount = dComIfGs_getClearCount(); + + char name[17]; + strcpy(name, dComIfGs_getPlayerName()); + + u8 attnType = dComIfGs_getOptAttentionType(); + u8 ruby = dComIfGs_getOptRuby(); + u8 sound = dComIfGs_getOptSound(); + u8 vib = dComIfGs_getOptVibration(); + + u8 pictureNum = dComIfGs_getPictureNum(); + + u8 r27 = dComIfGs_getEventReg(0x89FF); + + init(); + + for (int i = 0; i < ARRAY_SIZE(l_holdEventReg); i++) { + dComIfGs_setEventReg(l_holdEventReg[i], r29[i]); + } + + for (int i = 0; i < ARRAY_SIZE(l_onEventBit); i++) { + dComIfGs_onEventBit(l_onEventBit[i]); + } + + dComIfGs_setEventReg(0xC407, 7); + + dComIfGs_setClearCount(clearCount); + + dComIfGs_onSaveTbox(dSv_save_c::STAGE_MISC, 0x00); + dComIfGs_onSaveSwitch(dSv_save_c::STAGE_SEA, 0x47); + dComIfGs_onSaveSwitch(dSv_save_c::STAGE_SEA, 0x5E); + + dComIfGs_setPlayerName(name); + + dComIfGs_setOptAttentionType(attnType); + dComIfGs_setOptRuby(ruby); + dComIfGs_setOptSound(sound); + dComIfGs_setOptVibration(vib); + + dComIfGs_setRandomSalvagePoint(3); + + dComIfGs_setItem(0x8, CAMERA2); + dComIfGp_setItem(0x8, CAMERA2); + + dComIfGs_onGetItem(0x8, 0); + dComIfGs_onGetItem(0x8, 1); + + dComIfGs_setPictureNum(pictureNum); + + dComIfGs_setEventReg(0x89FF, r27); } /* 8005D860-8005D8C8 .text init__10dSv_save_cFv */