diff options
| author | TakaRikka <38417346+TakaRikka@users.noreply.github.com> | 2022-02-06 06:23:54 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-02-06 09:23:54 -0500 |
| commit | 3a79e96e8b033e26a3970da68d0633010fac0f03 (patch) | |
| tree | 4f96139d922bc2af03685bca121fb327723447f2 /src | |
| parent | 612f26c132280da43ecfa5fa8c8cc32966f06eb6 (diff) | |
d_meter2 wip / d_s_play / d_file_sel_info (#179)
* d_meter2 wip
* d_s_play
* d_file_sel_info
* format
* tag_lv5soup / tag_setBall / fix dKyeff
* d_cc_uty
Diffstat (limited to 'src')
| -rw-r--r-- | src/d/a/d_a_alink.cpp | 1 | ||||
| -rw-r--r-- | src/d/cc/d_cc_uty.cpp | 504 | ||||
| -rw-r--r-- | src/d/com/d_com_inf_game.cpp | 2 | ||||
| -rw-r--r-- | src/d/d_drawlist.cpp | 16 | ||||
| -rw-r--r-- | src/d/d_kyeff.cpp | 89 | ||||
| -rw-r--r-- | src/d/d_stage.cpp | 5 | ||||
| -rw-r--r-- | src/d/event/d_event_data.cpp | 1 | ||||
| -rw-r--r-- | src/d/file/d_file_sel_info.cpp | 308 | ||||
| -rw-r--r-- | src/d/kankyo/d_kankyo.cpp | 1 | ||||
| -rw-r--r-- | src/d/kankyo/d_kankyo_wether.cpp | 5 | ||||
| -rw-r--r-- | src/d/menu/d_menu_window.cpp | 2 | ||||
| -rw-r--r-- | src/d/meter/d_meter2.cpp | 654 | ||||
| -rw-r--r-- | src/d/msg/d_msg_object.cpp | 1 | ||||
| -rw-r--r-- | src/d/particle/d_particle.cpp | 3 | ||||
| -rw-r--r-- | src/d/s/d_s_play.cpp | 882 | ||||
| -rw-r--r-- | src/d/s/d_s_room.cpp | 96 | ||||
| -rw-r--r-- | src/d/save/d_save.cpp | 87 | ||||
| -rw-r--r-- | src/f_op/f_op_msg.cpp | 33 | ||||
| -rw-r--r-- | src/f_op/f_op_msg_mng.cpp | 14 | ||||
| -rw-r--r-- | src/f_op/f_op_scene_pause.cpp | 2 | ||||
| -rw-r--r-- | src/f_op/f_op_scene_req.cpp | 2 | ||||
| -rw-r--r-- | src/f_pc/f_pc_base.cpp | 2 | ||||
| -rw-r--r-- | src/f_pc/f_pc_priority.cpp | 4 | ||||
| -rw-r--r-- | src/f_pc/f_pc_profile.cpp | 4 | ||||
| -rw-r--r-- | src/m_Do/m_Do_graphic.cpp | 2 |
25 files changed, 1595 insertions, 1125 deletions
diff --git a/src/d/a/d_a_alink.cpp b/src/d/a/d_a_alink.cpp index 3ede1b76e1..bbd6ff7cce 100644 --- a/src/d/a/d_a_alink.cpp +++ b/src/d/a/d_a_alink.cpp @@ -3285,7 +3285,6 @@ extern "C" extern void* __vt__19JPAParticleCallBack[5]; extern "C" extern void* g_fopAc_Method[8]; extern "C" extern void* __vt__8cM3dGPla[3]; extern "C" extern void* __vt__14dBgS_ObjGndChk[12 + 1 /* padding */]; -extern "C" extern void* g_fpcLf_Method[5 + 1 /* padding */]; extern "C" extern void* __vt__12dDlst_base_c[3]; extern "C" extern void* __vt__8cM3dGCyl[3]; extern "C" extern void* __vt__8cM3dGAab[3]; diff --git a/src/d/cc/d_cc_uty.cpp b/src/d/cc/d_cc_uty.cpp index 401c6c13cb..6df62d5e65 100644 --- a/src/d/cc/d_cc_uty.cpp +++ b/src/d/cc/d_cc_uty.cpp @@ -4,33 +4,13 @@ // #include "d/cc/d_cc_uty.h" +#include "SSystem/SComponent/c_math.h" +#include "d/d_procname.h" +#include "d/s/d_s_play.h" #include "dol2asm.h" #include "dolphin/types.h" // -// Types: -// - -struct fopAc_ac_c {}; - -struct daPy_py_c { - /* 80088134 */ bool checkCutJumpCancelTurn() const; - /* 8015F398 */ void checkMasterSwordEquip(); -}; - -struct dCcU_AtInfo {}; - -struct dCcD_GObjInf { - /* 800845B0 */ void getHitSeID(u8, int); -}; - -struct cCcD_Obj { - /* 80263A48 */ void GetAc(); -}; - -struct Z2Creature {}; - -// // Forward References: // @@ -54,108 +34,319 @@ extern "C" void checkMasterSwordEquip__9daPy_py_cFv(); extern "C" void GetAc__8cCcD_ObjFv(); extern "C" void cM_atan2s__Fff(); extern "C" void cM_rndFX__Ff(); -extern "C" void PSVECSquareMag(); extern "C" void _savegpr_25(); extern "C" void _restgpr_25(); -extern "C" extern u8 g_dComIfG_gameInfo[122384]; -extern "C" extern u32 __float_nan; extern "C" extern u8 struct_80451124[4]; // // Declarations: // +bool daPy_py_c::checkWoodSwordEquip() { + return dComIfGs_getSelectEquipSword() == WOOD_STICK; +} + +BOOL daPy_py_c::checkNowWolf() { + return dComIfGp_getLinkPlayer()->i_checkWolf(); +} + /* ############################################################################################## */ /* 803AC418-803AC500 009538 00E8+00 1/1 0/0 0/0 .data plCutLRC */ -SECTION_DATA static u8 plCutLRC[232] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, - 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, - 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, - 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, - 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +SECTION_DATA static int plCutLRC[58] = { + 0, 0, 1, 1, 2, 0, 2, 1, 0, 0, 0, 2, 1, 1, 1, 2, 2, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 2, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, }; /* 800873B0-800873D4 081CF0 0024+00 0/0 0/0 3/3 .text pl_cut_LRC__Fi */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void pl_cut_LRC(int param_0) { - nofralloc -#include "asm/d/cc/d_cc_uty/pl_cut_LRC__Fi.s" +int pl_cut_LRC(int index) { + if (index >= 58) { + return 0; + } + + return plCutLRC[index]; } -#pragma pop /* 800873D4-800874C4 081D14 00F0+00 1/1 0/0 14/14 .text cc_pl_cut_bit_get__Fv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void cc_pl_cut_bit_get() { - nofralloc -#include "asm/d/cc/d_cc_uty/cc_pl_cut_bit_get__Fv.s" +u16 cc_pl_cut_bit_get() { + daPy_py_c* link = (daPy_py_c*)dComIfGp_getPlayer(0); + + u16 bit = 0; + if (link->getCutType() == daPy_py_c::TYPE_CUT_VERTICAL) { + bit = 0x1; + } else if (link->getCutType() == daPy_py_c::TYPE_CUT_STAB) { + bit = 0x2; + } else if (link->getCutType() == daPy_py_c::TYPE_CUT_STAB_COMBO) { + bit = 0x200; + } else if (link->getCutType() == daPy_py_c::TYPE_CUT_SWEEP) { + bit = 0x4; + } else if (link->getCutType() == daPy_py_c::TYPE_CUT_HORIZONTAL) { + bit = 0x8; + } else if (link->getCutType() == daPy_py_c::TYPE_CUT_LEFT_SWEEP_FINISH) { + bit = 0x20; + } else if (link->getCutType() == daPy_py_c::TYPE_CUT_DOWN_FINISH) { + bit = 0x40; + } else if (link->getCutType() == daPy_py_c::TYPE_CUT_TURN_RIGHT || link->getCutType() == 9 || + link->getCutType() == 43 || + link->getCutType() == daPy_py_c::TYPE_CUT_LARGE_TURN_RIGHT) { + bit = 0x80; + } else if (link->getCutType() == daPy_py_c::TYPE_CUT_TURN_LEFT || + link->getCutType() == daPy_py_c::TYPE_CUT_LARGE_TURN_LEFT) { + bit = 0x800; + } else if (link->getCutType() == daPy_py_c::TYPE_CUT_JUMP) { + bit = 0x100; + } else if (link->getCutType() == 40 || link->getCutType() == 41) { + bit = 0x400; + } + + return bit; } -#pragma pop /* 800874C4-800874F0 081E04 002C+00 1/1 0/0 0/0 .text getMapInfo__FSc */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void getMapInfo(s8 param_0) { - nofralloc -#include "asm/d/cc/d_cc_uty/getMapInfo__FSc.s" +static int getMapInfo(s8 param_0) { + int map_info = 30; + if (param_0 == 1) { + map_info = 31; + } else if (param_0 == 2) { + map_info = 32; + } + + return map_info; } -#pragma pop /* 800874F0-80087514 081E30 0024+00 2/2 0/0 0/0 .text getHitId__FP8cCcD_Obji */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void getHitId(cCcD_Obj* param_0, int param_1) { - nofralloc -#include "asm/d/cc/d_cc_uty/getHitId__FP8cCcD_Obji.s" +static u32 getHitId(cCcD_Obj* obj, int param_1) { + dCcD_GObjInf* dObj = static_cast<dCcD_GObjInf*>(obj); + return dObj->getHitSeID(dObj->GetAtSe(), param_1); } -#pragma pop /* 80087514-80087594 081E54 0080+00 0/0 0/0 47/47 .text * def_se_set__FP10Z2CreatureP8cCcD_ObjUlP10fopAc_ac_c */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void def_se_set(Z2Creature* param_0, cCcD_Obj* param_1, u32 param_2, fopAc_ac_c* param_3) { - nofralloc -#include "asm/d/cc/d_cc_uty/def_se_set__FP10Z2CreatureP8cCcD_ObjUlP10fopAc_ac_c.s" +void def_se_set(Z2Creature* sound, cCcD_Obj* collider, u32 map_info, fopAc_ac_c* actor) { + if (sound != NULL) { + int tmp; + if (actor != NULL && fopAcM_checkStatus(actor, 0x280000)) { + tmp = 0; + } else { + tmp = 1; + } + sound->startCollisionSE(getHitId(collider, tmp), map_info); + } } -#pragma pop /* 80087594-80087A58 081ED4 04C4+00 1/1 0/0 0/0 .text at_power_get__FP11dCcU_AtInfo */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void at_power_get(dCcU_AtInfo* param_0) { - nofralloc -#include "asm/d/cc/d_cc_uty/at_power_get__FP11dCcU_AtInfo.s" +static u8 at_power_get(dCcU_AtInfo* info) { + u8 power = info->mpCollider->GetAtAtp(); + + if (info->mPowerType == 0) { + if (info->mpCollider->ChkAtType(0x10000000)) { + power = 0; + } else if (power == 1) { + power = 1; + } else if (power == 2) { + power = 10; + } else if (power == 3) { + power *= 10; + } else if (power == 6) { + power = 80; + } else if (power >= 4) { + power = 200; + } + } else if (info->mPowerType == 6) { + if (info->mpCollider->ChkAtType(0x10000000)) { + power = 0; + } else if (power == 1) { + power = 1; + } else if (power == 2) { + power = 10; + } else if (power == 6) { + power = 80; + } else if (power >= 3) { + power *= 10; + } + } else if (info->mPowerType == 4) { + if (info->mpCollider->ChkAtType(0x400000)) { + power = 200; + } else if (info->mpCollider->ChkAtType(0x10000000)) { + power = 0; + } else if (power == 1) { + power = 1; + } else if (power == 2) { + power = 10; + } else if (power >= 3) { + power *= 10; + } else if (power == 6) { + power = 80; + } else if (power >= 4) { + power = 200; + } + } else if (info->mPowerType == 5) { + if (info->mpCollider->ChkAtType(0x2000)) { + power = 0; + } else if (power == 1) { + power = 1; + } else if (power == 2) { + power = 3; + } else if (power >= 3) { + power = 4; + } + } else if (info->mPowerType == 2) { + if (info->mpCollider->ChkAtType(0x400000)) { + power = 200; + } else if (power == 1) { + power = 1; + } else if (power == 2) { + power = 10; + } else if (power == 3) { + power = 20; + } else if (power == 6) { + power = 80; + } else if (power >= 4) { + power = 200; + } + } else if (info->mPowerType == 1) { + if (info->mpCollider->ChkAtType(0x400000) || power >= 4) { + power = 200; + } else { + power *= 10; + } + } else if (info->mPowerType == 3) { + if (info->mpCollider->ChkAtType(0x400000) || power >= 4) { + power = 200; + } else if (power == 1) { + power = 10; + } else if (power == 2) { + power = 20; + } else if (power >= 3) { + power = 40; + } + } else if (info->mPowerType == 7) { + if (info->mpCollider->ChkAtType(0x420008)) { + power = 50; + } else if (info->mpCollider->ChkAtType(0x2000)) { + power = 27; + } else if (power == 1) { + power = 1; + } else if (power == 2) { + power = 10; + } else if (power == 3) { + power *= 10; + } else if (power == 6) { + power = 80; + } else if (power >= 4) { + power = 200; + } + } else if (info->mPowerType == 8) { + if (power == 1) { + power = 3; + } else if (power == 2) { + power = 10; + } else if (power == 6) { + power = 80; + } else if (power >= 3) { + power *= 10; + } + } else if (info->mPowerType == 9 || info->mPowerType == 10) { + if (info->mpCollider->ChkAtType(0x4000)) { + power = 0; + } + if (info->mpCollider->ChkAtType(0x400000)) { + power = 19; + } + + if (power == 1) { + power = 4; + } else if (power == 2) { + power = 8; + } else if (power == 3) { + power *= 10; + } else if (power == 6) { + power = 80; + } else if (power >= 4) { + power = 200; + } + } else if (info->mPowerType == 11) { + if (info->mpCollider->ChkAtType(0x4000)) { + power = 0; + } + + if (power == 1) { + power = 10; + } else if (power == 2) { + power = 20; + } else if (power == 3) { + power = 30; + } else if (power >= 4) { + power = 100; + } + } else if (info->mPowerType == 12) { + if (power == 1) { + power = 10; + } else if (power == 2) { + power = 20; + } else if (power == 3) { + power = 30; + } else if (power >= 4) { + power = 100; + } + } + + return power; } -#pragma pop /* 80087A58-80087C04 082398 01AC+00 1/1 0/0 38/38 .text at_power_check__FP11dCcU_AtInfo */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void at_power_check(dCcU_AtInfo* param_0) { - nofralloc -#include "asm/d/cc/d_cc_uty/at_power_check__FP11dCcU_AtInfo.s" +fopAc_ac_c* at_power_check(dCcU_AtInfo* info) { + if (info->mpCollider == NULL) { + return NULL; + } + + info->mpActor = info->mpCollider->GetAc(); + info->mHitType = 12; + info->mAttackPower = 0; + info->mHitBit = 0; + + if (info->mpActor != NULL) { + info->mAttackPower = at_power_get(info); + + s16 ac_name = fopAcM_GetName(info->mpActor); + if (ac_name == PROC_ALINK || ac_name == PROC_ALINK) { + if (info->mpCollider->ChkAtType(0x8000) || info->mpCollider->ChkAtType(0x400000)) { + info->mHitType = 9; + } else { + info->mHitType = 1; + info->mHitBit = cc_pl_cut_bit_get(); + } + } else if (ac_name == PROC_NBOMB) { + info->mHitType = 2; + info->mHitBit = 0x10000000; + } else if (ac_name == PROC_BOOMERANG) { + info->mHitType = 10; + info->mHitBit = 0x40000000; + } else if (ac_name == PROC_ARROW) { + info->mHitType = 15; + info->mHitBit = 0x80000000; + } + } + + info->mHitStatus = 0; + if (info->mpCollider->ChkAtType(0x40) || info->mpCollider->ChkAtType(0x10000) || + info->mpCollider->ChkAtType(0x80) || info->mpCollider->ChkAtType(0x10)) { + info->mHitType = 0x10; + } else if (info->mpCollider->ChkAtType(0x4000)) { + info->mHitBit = 0x1000; + } else { + s16 ac_name = fopAcM_GetName(info->mpActor); + if (ac_name == PROC_ALINK || ac_name == PROC_ALINK) { + if (dCcD_GetGObjInf(info->mpCollider)->GetAtSpl() == 1) { + info->mHitStatus = 1; + } + } else if (info->mAttackPower >= 3) { + info->mHitStatus = 1; + } + } + + return info->mpActor; } -#pragma pop /* ############################################################################################## */ /* 80452798-804527A0 000D98 0004+04 1/1 0/0 0/0 .sdata2 @4212 */ @@ -191,16 +382,141 @@ SECTION_SDATA2 static f32 lit_4218[1 + 1 /* padding */] = { /* 80087C04-80088134 082544 0530+00 0/0 0/0 84/84 .text cc_at_check__FP10fopAc_ac_cP11dCcU_AtInfo */ +// reg issues +#ifdef NONMATCHING +fopAc_ac_c* cc_at_check(fopAc_ac_c* enemy, dCcU_AtInfo* info) { + daPy_py_c* link = (daPy_py_c*)dComIfGp_getPlayer(0); + info->mpActor = at_power_check(info); + + if (info->mpActor != NULL) { + cXyz tmp = info->mpActor->mSpeed; + tmp.y = 0.0f; + if (tmp.abs() > 100.0f) { + f32 x = info->mpActor->mSpeed.x; + f32 z = info->mpActor->mSpeed.z; + info->mHitDirection = cM_atan2s(-x, -z) + (s16)cM_rndFX(4000.0f); + } else { + if (fopAcM_GetName(info->mpActor) == PROC_BOOMERANG) { + f32 x_diff = enemy->mCurrent.mPosition.x - link->mCurrent.mPosition.x; + f32 z_diff = enemy->mCurrent.mPosition.z - link->mCurrent.mPosition.z; + info->mHitDirection = cM_atan2s(-x_diff, -z_diff) + (s16)cM_rndFX(10000.0f); + } else { + f32 x_diff = enemy->mCurrent.mPosition.x - info->mpActor->mCurrent.mPosition.x; + f32 z_diff = enemy->mCurrent.mPosition.z - info->mpActor->mCurrent.mPosition.z; + info->mHitDirection = cM_atan2s(-x_diff, -z_diff); + } + } + + if (info->mHitType == 1 && link->getCutType() == daPy_py_c::TYPE_CUT_HEAD) { + info->mHitDirection = link->mCollisionRot.y; + } + + if (info->mpCollider->ChkAtType(0x4000) && fopAcM_checkStatus(enemy, 0x380000)) { + info->mAttackPower = 0; + } + + if (static_cast<dCcD_GObjInf*>(info->mpCollider)->GetAtMtrl() == 4) { + if (fopAcM_GetName(enemy) == PROC_B_GND) { + info->mAttackPower = 0; + } else if (fopAcM_GetName(enemy) != PROC_B_ZANT) { + info->mAttackPower = 100; + } + } + + if (info->mHitType == 1) { + if (!daPy_py_c::checkNowWolf()) { + if (link->checkMasterSwordEquip()) { + info->mAttackPower *= 2; + } + + if (daPy_py_c::checkWoodSwordEquip()) { + // probably supposed to be some sort of division + info->mAttackPower = info->mAttackPower >> 1; + } + } + + if (link->getSwordAtUpTime()) { + info->mAttackPower *= 2; + info->mHitStatus = 1; + } + } + + if (info->mAttackPower != 0) { + enemy->field_0x562 -= info->mAttackPower; + } + + s8 pause_time = 0; + if (info->mAttackPower != 0 && enemy->field_0x562 <= 0) { + info->mHitStatus = 2; + enemy->field_0x562 = 0; + } + + int uvar8; + if (info->mpCollider->ChkAtType(0x4000) && !fopAcM_checkStatus(enemy, 0x280000)) { + uvar8 = 1; + } else { + uvar8 = 0; + } + + if (info->mpSound != NULL) { + if (info->field_0x18 != 0) { + info->mpSound->startCollisionSE(getHitId(info->mpCollider, uvar8), info->field_0x18); + } else { + info->mpSound->startCollisionSE(getHitId(info->mpCollider, uvar8), + getMapInfo(info->mHitStatus)); + } + } + + if (info->mHitStatus != 0) { + pause_time = 5; + } else { + if (info->mAttackPower > 1) { + pause_time = 2; + } + } + + if (info->mpCollider->ChkAtType(0x8000000) || + ((daPy_py_c*)dComIfGp_getPlayer(0))->checkHorseRide()) { + // actor is Bulblin or Horseback Ganon + // add bulblin class later + if ((fopAcM_GetName(enemy) == PROC_E_RD && *(char*)((char*)&enemy + 0x1292) != 0) || + fopAcM_GetName(enemy) == PROC_B_GND) { + pause_time = 3; + } else { + pause_time = 0; + } + } + + s16 ac_name = fopAcM_GetName(enemy); + // actor is Stalkin, Chu, Keese, Shadow Keese, Shadow Vermin, Baby Gohma, or Rat + if (ac_name == PROC_E_BS || ac_name == PROC_E_SM2 || ac_name == PROC_E_BA || + ac_name == PROC_E_YK || ac_name == PROC_E_YG || ac_name == PROC_E_GM || + ac_name == PROC_E_MS) { + pause_time = 0; + } + + if (info->mHitType == 1 || info->mpCollider->ChkAtType(0x8)) { + if (!link->checkCutJumpCancelTurn() && info->mpCollider->ChkAtType(0x8)) { + pause_time = 4; + } + dScnPly_c::setPauseTimer(pause_time); + } + } + + return info->mpActor; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void cc_at_check(fopAc_ac_c* param_0, dCcU_AtInfo* param_1) { +asm fopAc_ac_c* cc_at_check(fopAc_ac_c* param_0, dCcU_AtInfo* param_1) { nofralloc #include "asm/d/cc/d_cc_uty/cc_at_check__FP10fopAc_ac_cP11dCcU_AtInfo.s" } #pragma pop +#endif /* 80088134-8008813C 082A74 0008+00 0/0 1/0 0/0 .text checkCutJumpCancelTurn__9daPy_py_cCFv */ -bool daPy_py_c::checkCutJumpCancelTurn() const { - return false; +int daPy_py_c::checkCutJumpCancelTurn() const { + return 0; } diff --git a/src/d/com/d_com_inf_game.cpp b/src/d/com/d_com_inf_game.cpp index 79a3114d6f..1b37d72d0b 100644 --- a/src/d/com/d_com_inf_game.cpp +++ b/src/d/com/d_com_inf_game.cpp @@ -1367,7 +1367,7 @@ asm void dComIfG_changeOpeningScene(scene_class* param_0, s16 param_1) { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void dComIfG_resetToOpening(scene_class* param_0) { +asm BOOL dComIfG_resetToOpening(scene_class* param_0) { nofralloc #include "asm/d/com/d_com_inf_game/dComIfG_resetToOpening__FP11scene_class.s" } diff --git a/src/d/d_drawlist.cpp b/src/d/d_drawlist.cpp index e3e1ffb72c..ba99320c4d 100644 --- a/src/d/d_drawlist.cpp +++ b/src/d/d_drawlist.cpp @@ -79,19 +79,6 @@ struct dDlst_2DM_c { /* 80052C58 */ void draw(); }; -class cM_rnd_c { -public: - /* 80053CDC */ void init(int, int, int); - /* 80053CEC */ f32 get(); - /* 80053DE0 */ f32 getF(f32); - /* 80053E18 */ f32 getFX(f32); - /* 80053E60 */ f32 getValue(f32, f32); - - /* 0x0 */ int seed0; - /* 0x4 */ int seed1; - /* 0x8 */ int seed2; -}; - struct cBgS_ShdwDraw { /* 80267F88 */ cBgS_ShdwDraw(); /* 80267FD0 */ ~cBgS_ShdwDraw(); @@ -3027,8 +3014,7 @@ SECTION_SDATA u8 dDlst_list_c::mWipeColor[4] = { }; /* 80450ED0-80450ED4 0003D0 0004+00 2/2 1/1 0/0 .sbss None */ -extern u8 data_80450ED0[4]; -u8 data_80450ED0[4]; +u8 data_80450ED0; /* 80450ED4-80450ED8 0003D4 0004+00 2/2 1/1 0/0 .sbss mWipeRate__12dDlst_list_c */ f32 dDlst_list_c::mWipeRate; diff --git a/src/d/d_kyeff.cpp b/src/d/d_kyeff.cpp index d4946a6fcf..9103d5c4da 100644 --- a/src/d/d_kyeff.cpp +++ b/src/d/d_kyeff.cpp @@ -4,22 +4,18 @@ // #include "d/d_kyeff.h" -#include "d/kankyo/d_kankyo_wether.h" +#include "Z2AudioLib/Z2EnvSeMgr.h" +#include "d/com/d_com_inf_game.h" +#include "d/kankyo/d_kankyo.h" #include "dol2asm.h" #include "dolphin/types.h" -#include "d/com/d_com_inf_game.h" - // // Types: // struct kankyo_class {}; -struct Z2EnvSeMgr { - /* 802C66B0 */ void framework(); -}; - // // Forward References: // @@ -45,69 +41,50 @@ extern "C" void dKyw_wether_draw__Fv(); extern "C" void dKy_FiveSenses_fullthrottle_dark__Fv(); extern "C" void framework__10Z2EnvSeMgrFv(); extern "C" extern void* g_fopKy_Method[5 + 1 /* padding */]; -extern "C" extern void* g_fpcLf_Method[5 + 1 /* padding */]; -extern "C" extern u8 g_env_light[4880]; -extern "C" extern u8 g_mEnvSeMgr[780]; +extern "C" extern dScnKy_env_light_c g_env_light; +extern "C" extern Z2EnvSeMgr g_mEnvSeMgr; // // Declarations: // +// move later +inline void mDoAud_mEnvse_framework() { + g_mEnvSeMgr.framework(); +} + /* 801ADD00-801ADD38 1A8640 0038+00 2/2 0/0 0/0 .text dKankyo_DayProc__Fv */ void dKankyo_DayProc() { dComIfGs_offTmpBit(dSv_event_tmp_flag_c::tempBitLabels[91]); } -static bool dKyeff_Draw(dKyeff_c* ptr) { +static int dKyeff_Draw(dKyeff_c* ptr) { dKyw_wether_draw(); - return true; + return 1; } -/* ############################################################################################## */ -/* 80394F38-80394F38 021598 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -#pragma push -#pragma force_active on -SECTION_DEAD static char const* const stringBase_80394F38 = "Name"; -/* @stringBase0 padding */ -SECTION_DEAD static char const* const pad_80394F3D = "\0\0"; -#pragma pop - /* 801ADD5C-801ADDB4 1A869C 0058+00 1/1 0/0 0/0 .text execute__8dKyeff_cFv */ -// matching but need gameinfo setup -#ifdef NONMATCHING -bool dKyeff_c::execute() { - const char* stageName = dComIfGp_getStartStageName(); - int strcmp_result = strcmp(stageName, "Name"); // strcmp(stageName,"Name"); - if (strcmp_result != 0) { +int dKyeff_c::execute() { + if (strcmp(dComIfGp_getStartStageName(), "Name")) { dKyw_wether_move(); } dKyw_wether_move_draw(); dKy_FiveSenses_fullthrottle_dark(); mDoAud_mEnvse_framework(); - return true; -} -#else -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm bool dKyeff_c::execute() { - nofralloc -#include "asm/d/d_kyeff/execute__8dKyeff_cFv.s" + return 1; } -#pragma pop -#endif -static bool dKyeff_Execute(dKyeff_c* ptr) { +static int dKyeff_Execute(dKyeff_c* ptr) { return ptr->execute(); } -static bool dKyeff_IsDelete(dKyeff_c* ptr) { - return true; +static int dKyeff_IsDelete(dKyeff_c* ptr) { + return 1; } -static bool dKyeff_Delete(dKyeff_c* ptr) { +static int dKyeff_Delete(dKyeff_c* ptr) { dKyw_wether_delete(); - return true; + return 1; } /* ############################################################################################## */ @@ -132,25 +109,17 @@ SECTION_SDATA2 static f32 lit_3843 = 7.0f / 10.0f; SECTION_SDATA2 static f32 lit_3844 = 15.0f; /* 801ADE00-801ADEA0 1A8740 00A0+00 1/0 0/0 0/0 .text dKyeff_Create__FP12kankyo_class */ -// matching but need gameinfo setup +// float data #ifdef NONMATCHING -u32 dKyeff_Create(kankyo_class* kankyo_class_ptr) { - int strcmp_result; - OSTime Time; - OSCalendarTime CalendarTime; +static int dKyeff_Create(kankyo_class* kankyo) { + OSCalendarTime time; dKyw_wether_init(); - strcmp_result = strcmp(dComIfGp_getStartStageName(), "Name"); - if (strcmp_result == 0) { - Time = OSGetTime(); - OSTicksToCalendarTime( - Time, - &CalendarTime); // CONCAT44(iVar1,(int)((ulonglong)OVar2 >> 0x20)),&CalendarTime); - lbl_8042CA54.field_0xe48 = 1.0f; - lbl_8042CA54.field_0xe4c = 0.0f; - lbl_8042CA54.field_0xe50 = 0.0f; - lbl_8042CA54.field_0xe58 = 0.7f; - lbl_8042CA54.field_0x1244 = CalendarTime.hours * 15.0f; + if (!strcmp(dComIfGp_getStartStageName(), "Name")) { + OSTicksToCalendarTime(OSGetTime(), &time); + g_env_light.mWind.vec.set(1.0f, 0.0f, 0.0f); + g_env_light.mWind.pow = 0.7f; + g_env_light.mDaytime = time.hours * 15.0f; } return 4; } @@ -158,7 +127,7 @@ u32 dKyeff_Create(kankyo_class* kankyo_class_ptr) { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void dKyeff_Create(kankyo_class* param_0) { +static asm int dKyeff_Create(kankyo_class* param_0) { nofralloc #include "asm/d/d_kyeff/dKyeff_Create__FP12kankyo_class.s" } diff --git a/src/d/d_stage.cpp b/src/d/d_stage.cpp index f4c0f08351..4d519a0d6b 100644 --- a/src/d/d_stage.cpp +++ b/src/d/d_stage.cpp @@ -412,7 +412,6 @@ extern "C" void _restgpr_28(); extern "C" void _restgpr_29(); extern "C" extern J3DLightInfo const j3dDefaultLightInfo; extern "C" extern u8 g_save_bit_HIO[1184 + 4 /* padding */]; -extern "C" extern u8 data_804505F0[8]; extern "C" u8 mResetData__6mDoRst[4 + 4 /* padding */]; // @@ -1826,7 +1825,7 @@ int dStage_roomControl_c::resetArchiveBank(int i_bank) { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm int dStage_roomControl_c::resetArchiveBank(int param_0) { +asm bool dStage_roomControl_c::resetArchiveBank(int param_0) { nofralloc #include "asm/d/d_stage/resetArchiveBank__20dStage_roomControl_cFi.s" } @@ -2279,7 +2278,7 @@ static asm int dStage_lgtvInfoInit(dStage_dt_c* param_0, void* param_1, int para #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void dStage_stagInfo_GetParticleNo(stage_stag_info_class* param_0, int param_1) { +asm u8 dStage_stagInfo_GetParticleNo(stage_stag_info_class* param_0, int param_1) { nofralloc #include "asm/d/d_stage/dStage_stagInfo_GetParticleNo__FP21stage_stag_info_classi.s" } diff --git a/src/d/event/d_event_data.cpp b/src/d/event/d_event_data.cpp index ddb63cb9ab..e52bbfe19d 100644 --- a/src/d/event/d_event_data.cpp +++ b/src/d/event/d_event_data.cpp @@ -143,7 +143,6 @@ extern "C" void _restgpr_29(); extern "C" u8 const tempBitLabels__20dSv_event_tmp_flag_c[370 + 2 /* padding */]; extern "C" u8 saveBitLabels__16dSv_event_flag_c[1644 + 4 /* padding */]; extern "C" f32 mFadeRate__13mDoGph_gInf_c; -extern "C" extern u8 struct_80450BE4[4]; extern "C" u8 m_control__7dDemo_c[4]; extern "C" u8 m_frameNoMsg__7dDemo_c[4]; extern "C" u8 m_mode__7dDemo_c[4]; diff --git a/src/d/file/d_file_sel_info.cpp b/src/d/file/d_file_sel_info.cpp index df72165740..a0b69cfe64 100644 --- a/src/d/file/d_file_sel_info.cpp +++ b/src/d/file/d_file_sel_info.cpp @@ -8,63 +8,6 @@ #include "dolphin/types.h" // -// Types: -// - -struct dSv_save_c {}; - -struct JMSMesgEntry_c {}; - -struct dMeter2Info_c { - /* 8021C250 */ void getString(u32, char*, JMSMesgEntry_c*); -}; - -struct JKRArchive {}; - -struct dFile_info_c { - /* 80192434 */ dFile_info_c(JKRArchive*, u8); - /* 801924A0 */ ~dFile_info_c(); - /* 80192570 */ void screenSet(); - /* 80192954 */ void setSaveData(dSv_save_c*, int, u8); - /* 80192AA0 */ void setHeartCnt(dSv_save_c*); - /* 80192C08 */ void setSaveDate(dSv_save_c*); - /* 80192C70 */ void setPlayTime(dSv_save_c*); - /* 80192D58 */ void modeWait(); - /* 80192D5C */ void modeMove(); - /* 80192D60 */ void _draw(); -}; - -struct dDlst_base_c {}; - -struct dDlst_list_c { - /* 80056794 */ void set(dDlst_base_c**&, dDlst_base_c**&, dDlst_base_c*); -}; - -struct dDlst_FileInfo_c { - /* 80192D9C */ void draw(); - /* 80192EC8 */ ~dDlst_FileInfo_c(); -}; - -struct JKRExpHeap {}; - -struct J2DTextBox { - /* 80300658 */ void getStringPtr() const; - /* 8030074C */ void setString(s16, char const*, ...); -}; - -struct J2DGrafContext {}; - -struct J2DScreen { - /* 802F8498 */ J2DScreen(); - /* 802F8648 */ void setPriority(char const*, u32, JKRArchive*); - /* 802F8ED4 */ void draw(f32, f32, J2DGrafContext const*); -}; - -struct CPaneMgrAlpha { - /* 802553FC */ CPaneMgrAlpha(J2DScreen*, u64, u8, JKRExpHeap*); -}; - -// // Forward References: // @@ -99,10 +42,6 @@ extern "C" void setPriority__9J2DScreenFPCcUlP10JKRArchive(); extern "C" void draw__9J2DScreenFffPC14J2DGrafContext(); extern "C" void getStringPtr__10J2DTextBoxCFv(); extern "C" void setString__10J2DTextBoxFsPCce(); -extern "C" void OSTicksToCalendarTime(); -extern "C" void PSMTXCopy(); -extern "C" void PSMTXConcat(); -extern "C" void PSMTXScale(); extern "C" void _savegpr_22(); extern "C" void _savegpr_26(); extern "C" void _savegpr_28(); @@ -113,11 +52,7 @@ extern "C" void _restgpr_28(); extern "C" void _restgpr_29(); extern "C" void __div2i(); extern "C" void __mod2i(); -extern "C" void sprintf(); -extern "C" void strcpy(); extern "C" extern void* __vt__12dDlst_base_c[3]; -extern "C" extern u8 g_dComIfG_gameInfo[122384]; -extern "C" extern u8 g_meter2_info[248]; // // Declarations: @@ -154,25 +89,18 @@ SECTION_DATA static u8 cNullVec__6Z2Calc[12 + 4 /* padding */] = { }; /* 803BB4A8-803BB548 0185C8 00A0+00 1/1 0/0 0/0 .data l_htag$3879 */ -SECTION_DATA static u8 l_htag[160] = { - 0x00, 0x68, 0x65, 0x61, 0x72, 0x5F, 0x32, 0x30, 0x00, 0x68, 0x65, 0x61, 0x72, 0x5F, 0x32, 0x31, - 0x00, 0x68, 0x65, 0x61, 0x72, 0x5F, 0x32, 0x32, 0x00, 0x68, 0x65, 0x61, 0x72, 0x5F, 0x32, 0x33, - 0x00, 0x68, 0x65, 0x61, 0x72, 0x5F, 0x32, 0x34, 0x00, 0x68, 0x65, 0x61, 0x72, 0x5F, 0x32, 0x35, - 0x00, 0x68, 0x65, 0x61, 0x72, 0x5F, 0x32, 0x36, 0x00, 0x68, 0x65, 0x61, 0x72, 0x5F, 0x32, 0x37, - 0x00, 0x68, 0x65, 0x61, 0x72, 0x5F, 0x32, 0x38, 0x00, 0x68, 0x65, 0x61, 0x72, 0x5F, 0x32, 0x39, - 0x00, 0x68, 0x65, 0x61, 0x72, 0x5F, 0x33, 0x30, 0x00, 0x68, 0x65, 0x61, 0x72, 0x5F, 0x33, 0x31, - 0x00, 0x68, 0x65, 0x61, 0x72, 0x5F, 0x33, 0x32, 0x00, 0x68, 0x65, 0x61, 0x72, 0x5F, 0x33, 0x33, - 0x00, 0x68, 0x65, 0x61, 0x72, 0x5F, 0x33, 0x34, 0x00, 0x68, 0x65, 0x61, 0x72, 0x5F, 0x33, 0x35, - 0x00, 0x68, 0x65, 0x61, 0x72, 0x5F, 0x33, 0x36, 0x00, 0x68, 0x65, 0x61, 0x72, 0x5F, 0x33, 0x37, - 0x00, 0x68, 0x65, 0x61, 0x72, 0x5F, 0x33, 0x38, 0x00, 0x68, 0x65, 0x61, 0x72, 0x5F, 0x33, 0x39, +SECTION_DATA static u64 l_htag[20] = { + 'hear_20', 'hear_21', 'hear_22', 'hear_23', 'hear_24', 'hear_25', 'hear_26', + 'hear_27', 'hear_28', 'hear_29', 'hear_30', 'hear_31', 'hear_32', 'hear_33', + 'hear_34', 'hear_35', 'hear_36', 'hear_37', 'hear_38', 'hear_39', }; /* 803BB548-803BB558 -00001 0010+00 1/1 0/0 0/0 .data amariheartTex$3880 */ -SECTION_DATA static void* amariheartTex[4] = { - (void*)(((char*)&d_file_d_file_sel_info__stringBase0) + 0x21), - (void*)(((char*)&d_file_d_file_sel_info__stringBase0) + 0x21), - (void*)(((char*)&d_file_d_file_sel_info__stringBase0) + 0x21), - (void*)(((char*)&d_file_d_file_sel_info__stringBase0) + 0x21), +SECTION_DATA static char* amariheartTex[4] = { + "tt_heart_00.bti", + "tt_heart_00.bti", + "tt_heart_00.bti", + "tt_heart_00.bti", }; /* 803BB558-803BB564 -00001 000C+00 0/1 0/0 0/0 .data @3953 */ @@ -224,47 +152,144 @@ SECTION_DATA extern void* __vt__12dFile_info_c[3 + 3 /* padding */] = { }; /* 80192434-801924A0 18CD74 006C+00 0/0 3/3 0/0 .text __ct__12dFile_info_cFP10JKRArchiveUc */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm dFile_info_c::dFile_info_c(JKRArchive* param_0, u8 param_1) { - nofralloc -#include "asm/d/file/d_file_sel_info/__ct__12dFile_info_cFP10JKRArchiveUc.s" +dFile_info_c::dFile_info_c(JKRArchive* arc, u8 param_1) { + mArchive = arc; + field_0x22 = param_1; + mFileInfo.mBasePane = NULL; + screenSet(); + field_0x20 = 0; } -#pragma pop /* 801924A0-80192570 18CDE0 00D0+00 1/0 0/0 0/0 .text __dt__12dFile_info_cFv */ +#ifdef NONMATCHING +dFile_info_c::~dFile_info_c() { + delete mFileInfo.Scr; + delete mDatBase; + delete mNoDatBase; + + mDoExt_removeMesgFont(); +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm dFile_info_c::~dFile_info_c() { +// asm dFile_info_c::~dFile_info_c() { +extern "C" asm void __dt__12dFile_info_cFv() { nofralloc #include "asm/d/file/d_file_sel_info/__dt__12dFile_info_cFv.s" } #pragma pop +#endif /* 80192570-80192954 18CEB0 03E4+00 1/1 0/0 0/0 .text screenSet__12dFile_info_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void dFile_info_c::screenSet() { - nofralloc -#include "asm/d/file/d_file_sel_info/screenSet__12dFile_info_cFv.s" +void dFile_info_c::screenSet() { + mFileInfo.Scr = new J2DScreen(); + mFileInfo.Scr->setPriority("zelda_file_select_info_text.blo", 0x1100000, mArchive); + mFileInfo.mFont = mDoExt_getMesgFont(); + mFileInfo.Scr->search('w_cp_ef1')->hide(); + mFileInfo.field_0x10 = mFileInfo.Scr->search('w_dat_i1'); + mDatBase = new CPaneMgrAlpha(mFileInfo.Scr, 'w_dat_i1', 2, NULL); + mNoDatBase = new CPaneMgrAlpha(mFileInfo.Scr, 'w_nda_i1', 2, NULL); + + J2DTextBox* tboxs[4]; + tboxs[0] = (J2DTextBox*)mFileInfo.Scr->search('f_s_t_02'); + tboxs[1] = (J2DTextBox*)mFileInfo.Scr->search('f_p_t_02'); + mFileInfo.Scr->search('w_s_t_01')->hide(); + mFileInfo.Scr->search('w_p_t_01')->hide(); + + for (int i = 0; i < 2; i++) { + tboxs[i]->setFont(mFileInfo.mFont); + tboxs[i]->setString(0x20, ""); + } + dMeter2Info_getString(0x3D0, tboxs[0]->getStringPtr(), NULL); // Save time + dMeter2Info_getString(0x3D1, tboxs[1]->getStringPtr(), NULL); // Total play time + + tboxs[0] = (J2DTextBox*)mFileInfo.Scr->search('f_name01'); + tboxs[1] = (J2DTextBox*)mFileInfo.Scr->search('f_new_1'); + mFileInfo.Scr->search('w_name01')->hide(); + mFileInfo.Scr->search('w_new_1')->hide(); + + tboxs[2] = (J2DTextBox*)mFileInfo.Scr->search('w_time01'); + tboxs[3] = (J2DTextBox*)mFileInfo.Scr->search('w_ptim01'); + + for (int i = 0; i < 4; i++) { + tboxs[i]->setFont(mFileInfo.mFont); + tboxs[i]->setString(0x40, ""); + } + mPlayerName = tboxs[0]->getStringPtr(); + mSaveStatus = tboxs[1]->getStringPtr(); + mSaveDate = tboxs[2]->getStringPtr(); + mPlayTime = tboxs[3]->getStringPtr(); +} + +inline u16 dComIfGs_getLife() { + return g_dComIfG_gameInfo.info.getPlayer().getPlayerStatusA().getLife(); } -#pragma pop /* 80192954-80192AA0 18D294 014C+00 0/0 3/3 0/0 .text setSaveData__12dFile_info_cFP10dSv_save_ciUc */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void dFile_info_c::setSaveData(dSv_save_c* param_0, int param_1, u8 param_2) { - nofralloc -#include "asm/d/file/d_file_sel_info/setSaveData__12dFile_info_cFP10dSv_save_ciUc.s" +int dFile_info_c::setSaveData(dSv_save_c* save, int param_1, u8 data_num) { + if (param_1 != 0) { + char* player_name = save->getPlayer().getPlayerInfo().getLinkName(); + if (*player_name == NULL) { + if (field_0x22 == 1 && data_num == dComIfGs_getDataNum()) { + save->getPlayer().getPlayerStatusA().setLife(dComIfGs_getLife()); + setHeartCnt(save); + save->getPlayer().getPlayerStatusA().setLife(12); + strcpy(mPlayerName, dComIfGs_getPlayerName()); + strcpy(mSaveDate, ""); + strcpy(mPlayTime, ""); + dMeter2Info_getString(0x4D, mSaveStatus, NULL); // New Quest Log + return 2; + } else { + dMeter2Info_getString(0x4D, mSaveStatus, NULL); // New Quest Log + return 1; + } + } else { + setHeartCnt(save); + strcpy(mPlayerName, player_name); + setSaveDate(save); + setPlayTime(save); + return 0; + } + } else { + dMeter2Info_getString(0x51, mSaveStatus, NULL); // This Quest Log is Corrupted + return -1; + } } -#pragma pop /* 80192AA0-80192C08 18D3E0 0168+00 1/1 0/0 0/0 .text setHeartCnt__12dFile_info_cFP10dSv_save_c */ +// close +#ifdef NONMATCHING +void dFile_info_c::setHeartCnt(dSv_save_c* save) { + u16 life = save->getPlayer().getPlayerStatusA().getLife(); + s32 count = (u8)(life) / 5; + s32 quarter_count = life % 5; + if (quarter_count != 0) { + count++; + } + + J2DPicture* heartP[20]; + for (int i = 0; i < 20; i++) { + heartP[i] = (J2DPicture*)mFileInfo.Scr->search(l_htag[i]); + + if (i < save->getPlayer().getPlayerStatusA().getMaxLife() / 5) { + heartP[i]->show(); + if (i < count) { + if (quarter_count != 0 && i == --count) { + heartP[i]->changeTexture(amariheartTex[quarter_count - 1], 0); + } else { + heartP[i]->changeTexture("tt_heart_00.bti", 0); + } + } else { + heartP[i]->changeTexture("tt_heart_00.bti", 0); + } + } else { + heartP[i]->hide(); + } + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -273,43 +298,29 @@ asm void dFile_info_c::setHeartCnt(dSv_save_c* param_0) { #include "asm/d/file/d_file_sel_info/setHeartCnt__12dFile_info_cFP10dSv_save_c.s" } #pragma pop - -/* ############################################################################################## */ -/* 803948B8-803948B8 020F18 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -#pragma push -#pragma force_active on -SECTION_DEAD static char const* const stringBase_803948E9 = "%02d/%02d/%d %02d:%02d"; -#pragma pop +#endif /* 80192C08-80192C70 18D548 0068+00 1/1 0/0 0/0 .text setSaveDate__12dFile_info_cFP10dSv_save_c */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void dFile_info_c::setSaveDate(dSv_save_c* param_0) { - nofralloc -#include "asm/d/file/d_file_sel_info/setSaveDate__12dFile_info_cFP10dSv_save_c.s" +void dFile_info_c::setSaveDate(dSv_save_c* save) { + OSCalendarTime time; + OSTicksToCalendarTime(save->getPlayer().getPlayerStatusB().getDateIpl(), &time); + sprintf(mSaveDate, "%02d/%02d/%d %02d:%02d", time.month + 1, time.day_of_month, time.year, + time.hours, time.minutes); } -#pragma pop - -/* ############################################################################################## */ -/* 803948B8-803948B8 020F18 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -#pragma push -#pragma force_active on -SECTION_DEAD static char const* const stringBase_80394900 = "999:59"; -SECTION_DEAD static char const* const stringBase_80394907 = "%d:%02d"; -/* @stringBase0 padding */ -SECTION_DEAD static char const* const pad_8039490F = ""; -#pragma pop /* 80192C70-80192D58 18D5B0 00E8+00 1/1 0/0 0/0 .text setPlayTime__12dFile_info_cFP10dSv_save_c */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void dFile_info_c::setPlayTime(dSv_save_c* param_0) { - nofralloc -#include "asm/d/file/d_file_sel_info/setPlayTime__12dFile_info_cFP10dSv_save_c.s" +void dFile_info_c::setPlayTime(dSv_save_c* save) { + s64 time = save->getPlayer().getPlayerInfo().getTotalTime() / (OS_BUS_CLOCK / 4); + + // 3599940 = 999:59 in seconds + if (time >= 3599940) { + sprintf(mPlayTime, "999:59"); + } else { + u32 min = (time % 3600) / 60; + u32 hours = time / 3600; + sprintf(mPlayTime, "%d:%02d", hours, min); + } } -#pragma pop /* 80192D58-80192D5C 18D698 0004+00 1/0 0/0 0/0 .text modeWait__12dFile_info_cFv */ void dFile_info_c::modeWait() { @@ -322,14 +333,9 @@ void dFile_info_c::modeMove() { } /* 80192D60-80192D9C 18D6A0 003C+00 0/0 2/2 0/0 .text _draw__12dFile_info_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void dFile_info_c::_draw() { - nofralloc -#include "asm/d/file/d_file_sel_info/_draw__12dFile_info_cFv.s" +void dFile_info_c::_draw() { + dComIfGd_set2DOpa(&mFileInfo); } -#pragma pop /* ############################################################################################## */ /* 804539F8-804539FC 001FF8 0004+00 1/1 0/0 0/0 .sdata2 @4000 */ @@ -344,14 +350,32 @@ SECTION_SDATA2 static u8 lit_4001[4] = { }; /* 80192D9C-80192E88 18D6DC 00EC+00 1/0 0/0 0/0 .text draw__16dDlst_FileInfo_cFv */ +// close +#ifdef NONMATCHING +void dDlst_FileInfo_c::draw() { + Mtx m; + J2DGrafContext* ctx = dComIfGp_getCurrentGrafPort(); + + if (mBasePane != NULL) { + MtxP glbMtx = mBasePane->getGlbMtx(); + PSMTXScale(m, mBasePane->getWidth() / field_0x10->getWidth(), + mBasePane->getHeight() / field_0x10->getHeight(), 1.0f); + PSMTXConcat(glbMtx, m, glbMtx); + Scr->search('Nm_02')->setMtx(glbMtx); + } + Scr->draw(0.0f, 0.0f, ctx); +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void dDlst_FileInfo_c::draw() { +// asm void dDlst_FileInfo_c::draw() { +extern "C" asm void draw__16dDlst_FileInfo_cFv() { nofralloc #include "asm/d/file/d_file_sel_info/draw__16dDlst_FileInfo_cFv.s" } #pragma pop +#endif /* 80192E88-80192EC8 18D7C8 0040+00 0/0 1/0 0/0 .text __sinit_d_file_sel_info_cpp */ #pragma push diff --git a/src/d/kankyo/d_kankyo.cpp b/src/d/kankyo/d_kankyo.cpp index 051381c62b..6e84d67a4e 100644 --- a/src/d/kankyo/d_kankyo.cpp +++ b/src/d/kankyo/d_kankyo.cpp @@ -344,7 +344,6 @@ extern "C" void _restgpr_29(); extern "C" u8 const tempBitLabels__20dSv_event_tmp_flag_c[370 + 2 /* padding */]; extern "C" extern void* __vt__12J3DFrameCtrl[3]; extern "C" extern void* g_fopKy_Method[5 + 1 /* padding */]; -extern "C" extern void* g_fpcLf_Method[5 + 1 /* padding */]; extern "C" u8 m_bloom__13mDoGph_gInf_c[20]; extern "C" u8 now__14mDoMtx_stack_c[48]; extern "C" u8 mStatus__20dStage_roomControl_c[65792]; diff --git a/src/d/kankyo/d_kankyo_wether.cpp b/src/d/kankyo/d_kankyo_wether.cpp index 4ffcdc2682..60c4e81ecf 100644 --- a/src/d/kankyo/d_kankyo_wether.cpp +++ b/src/d/kankyo/d_kankyo_wether.cpp @@ -227,11 +227,6 @@ inline void mDoAud_rainPlay(s32 enable) { g_mEnvSeMgr.startRainSe(enable, 0); } -inline void mDoAud_seStart(u32 sfx_id, const Vec* param_1, u32 param_2, s8 param_3) { - Z2AudioMgr::getInterface()->mSeMgr.seStart(sfx_id, param_1, param_2, param_3, 1.0f, 1.0f, -1.0f, - -1.0f, 0); -} - /* 80056AA8-80056AF8 0513E8 0050+00 3/3 0/0 0/0 .text dKyw_setDrawPacketList__FP9J3DPacketi */ static J3DPacket* dKyw_setDrawPacketList(J3DPacket* p_packet, int param_1) { if (p_packet == NULL) { diff --git a/src/d/menu/d_menu_window.cpp b/src/d/menu/d_menu_window.cpp index 7100179a88..d4bee51560 100644 --- a/src/d/menu/d_menu_window.cpp +++ b/src/d/menu/d_menu_window.cpp @@ -259,14 +259,12 @@ extern "C" void _restgpr_28(); extern "C" void _restgpr_29(); extern "C" extern u8 g_mDoMtx_identity[48 + 24 /* padding */]; extern "C" extern void* g_fopMsg_Method[5 + 1 /* padding */]; -extern "C" extern void* g_fpcLf_Method[5 + 1 /* padding */]; extern "C" extern void* __vt__12dDlst_base_c[3]; extern "C" extern void* __vt__10CSTControl[4]; extern "C" u8 m_cpadInfo__8mDoCPd_c[256]; extern "C" u8 mFader__13mDoGph_gInf_c[4]; extern "C" u8 mFrameBufferTimg__13mDoGph_gInf_c[4]; extern "C" u8 mFrameBufferTex__13mDoGph_gInf_c[4]; -extern "C" extern u8 struct_80450BE4[4]; extern "C" u8 sManager__10JFWDisplay[4]; extern "C" u8 mAudioMgrPtr__10Z2AudioMgr[4 + 4 /* padding */]; diff --git a/src/d/meter/d_meter2.cpp b/src/d/meter/d_meter2.cpp index 24b8d4a645..106a3431ed 100644 --- a/src/d/meter/d_meter2.cpp +++ b/src/d/meter/d_meter2.cpp @@ -4,9 +4,14 @@ // #include "d/meter/d_meter2.h" +#include "d/d_timer.h" +#include "d/menu/d_menu_window_HIO.h" +#include "d/meter/d_meter_HIO.h" #include "dol2asm.h" #include "dolphin/types.h" +#include "f_op/f_op_msg.h" #include "f_op/f_op_msg_mng.h" +#include "m_Do/m_Do_audio.h" // // Types: @@ -16,35 +21,10 @@ struct dScope_c { /* 80193690 */ dScope_c(u8); }; -struct dMw_HIO_c { - /* 801F9E14 */ bool getBombFlag(); - /* 801F9E1C */ bool getArrowFlag(); - /* 801F9E24 */ bool getPachinkoFlag(); -}; - -struct dMeterString_c { - /* 8020ED60 */ dMeterString_c(int); - /* 8020F5A4 */ void createString(int); -}; - struct dMeterHakusha_c { /* 8020C320 */ dMeterHakusha_c(void*); }; -struct dMeterHaihai_c { - /* 8020AE8C */ dMeterHaihai_c(u8); -}; - -struct dMeterButton_c { - /* 80201328 */ dMeterButton_c(); - /* 80201404 */ void _execute(u32, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, - bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, - bool); - /* 80209474 */ void isClose(); - /* 802095C0 */ void setString(char*, u8, u8, u8); - /* 80209CEC */ void hideAll(); -}; - struct dDemo_c { static u8 m_mode[4]; }; @@ -53,19 +33,6 @@ struct dCamera_c { /* 80174EA4 */ bool CalcSubjectAngle(s16*, s16*); }; -struct Z2StatusMgr { - /* 802B5F70 */ void heartGaugeOn(); -}; - -struct Z2SeMgr { - /* 802AB984 */ void seStart(JAISoundID, Vec const*, u32, s8, f32, f32, f32, f32, u8); - /* 802AC50C */ void seStartLevel(JAISoundID, Vec const*, u32, s8, f32, f32, f32, f32, u8); -}; - -struct Z2AudioMgr { - static u8 mAudioMgrPtr[4 + 4 /* padding */]; -}; - // // Forward References: // @@ -120,7 +87,7 @@ extern "C" static bool dMeter2_IsDelete__FP9dMeter2_c(); extern "C" static void dMeter2_Delete__FP9dMeter2_c(); extern "C" static void dMeter2_Create__FP9msg_class(); extern "C" extern char const* const d_meter_d_meter2__stringBase0; -extern "C" extern void* g_profile_METER2[10]; +// extern "C" extern void* g_profile_METER2[10]; // // External References: @@ -276,13 +243,6 @@ extern "C" void _restgpr_23(); extern "C" void _restgpr_25(); extern "C" void _restgpr_27(); extern "C" void _restgpr_29(); -extern "C" extern void* g_fopMsg_Method[5 + 1 /* padding */]; -extern "C" extern void* g_fpcLf_Method[5 + 1 /* padding */]; -extern "C" extern u8 g_mwHIO[304]; -extern "C" extern u8 g_drawHIO[3880]; -extern "C" extern u8 g_ringHIO[344]; -extern "C" extern u8 g_fmapHIO[1188]; -extern "C" extern u8 g_cursorHIO[68 + 4 /* padding */]; extern "C" u8 m_mode__7dDemo_c[4]; extern "C" u8 mAudioMgrPtr__10Z2AudioMgr[4 + 4 /* padding */]; @@ -351,9 +311,9 @@ int dMeter2_c::_create() { field_0x1e6 = 0; field_0x1e7 = 0; - mItemMaxNum[2] = dComIfGs_getArrowMax(); + mItemMaxNum[ARROW_MAX] = dComIfGs_getArrowMax(); mArrowNum = dComIfGs_getArrowNum(); - mItemMaxNum[3] = dComIfGs_getPachinkoMax(); + mItemMaxNum[PACHINKO_MAX] = dComIfGs_getPachinkoMax(); mPachinkoNum = dComIfGs_getPachinkoNum(); for (int i = 0; i < 3; i++) { @@ -371,8 +331,8 @@ int dMeter2_c::_create() { field_0x1e8 = 0; field_0x1e9 = 0; - field_0x1ea = 0; - field_0x1eb = 0; + mRupeeSound = 0; + mArrowSound = 0; for (int i = 0; i < 5; i++) { field_0x1b8[i] = 0; @@ -412,8 +372,8 @@ int dMeter2_c::_create() { mRupeeNum = i_dComIfGs_getRupee(); mKeyNum = dComIfGs_getKeyNum(); - field_0x1c4 = dComIfGp_getDoStatus(); - field_0x1dc = dComIfGp_isDoSetFlag(2); + mDoStatus = dComIfGp_getDoStatus(); + mDoSetFlag = dComIfGp_isDoSetFlag(2); int i = 0; f32 temp0 = FLOAT_LABEL(lit_4662); @@ -423,9 +383,9 @@ int dMeter2_c::_create() { } field_0x144 = lit_4663; - field_0x1c5 = dComIfGp_getAStatus(); + mAStatus = dComIfGp_getAStatus(); field_0x1c6 = 0; - field_0x1dd = dComIfGp_isASetFlag(2); + mASetFlag = dComIfGp_isASetFlag(2); i = 0; f32 temp1 = FLOAT_LABEL(lit_4662); @@ -436,7 +396,7 @@ int dMeter2_c::_create() { field_0x158 = lit_4663; field_0x1e4 = 0; - field_0x1e2 = dComIfGs_getSelectEquipSword(); + mEquipSword = dComIfGs_getSelectEquipSword(); field_0x1e3 = 0; field_0x1fe = 0; @@ -445,20 +405,20 @@ int dMeter2_c::_create() { field_0x200 = 0; field_0x201 = 0; - field_0x1c7 = dComIfGs_getCollectSmell(); - field_0x1c8 = dComIfGp_getRStatus(); - field_0x1de = dComIfGp_isRSetFlag(2); - field_0x1df = dComIfGp_isXSetFlag(2); - field_0x1e0 = dComIfGp_isYSetFlag(2); + mCollectSmell = dComIfGs_getCollectSmell(); + mRStatus = dComIfGp_getRStatus(); + mRSetFlag = dComIfGp_isRSetFlag(2); + mXSetFlag = dComIfGp_isXSetFlag(2); + mYSetFlag = dComIfGp_isYSetFlag(2); for (int i = 0; i < 2; i++) { dComIfGp_setSelectItem(i); } - field_0x1d2[0] = dComIfGp_getSelectItem(0); - field_0x1d2[2] = dComIfGp_getSelectItem(1); - field_0x1d2[1] = dComIfGp_getXStatus(); - field_0x1d2[3] = dComIfGp_getYStatus(); + mItemStatus[X_ITEM] = dComIfGp_getSelectItem(0); + mItemStatus[Y_ITEM] = dComIfGp_getSelectItem(1); + mItemStatus[X_STATUS] = dComIfGp_getXStatus(); + mItemStatus[Y_STATUS] = dComIfGp_getYStatus(); f32 temp2 = FLOAT_LABEL(lit_4662); field_0x188 = temp2; field_0x18c = temp2; @@ -480,15 +440,15 @@ int dMeter2_c::_create() { } field_0x190 = 0; - field_0x1c9 = dComIfGp_getZStatus(); - field_0x1ca = dComIfGp_get3DStatus(); - field_0x1cb = dComIfGp_getCStickStatus(); - field_0x1cc = dComIfGp_getSButtonStatus(); - field_0x1cd = dComIfGp_getNunStatus(); - field_0x1ce = dComIfGp_getRemoConStatus(); - field_0x1cf = dComIfGp_getNunZStatus(); - field_0x1d0 = dComIfGp_getNunCStatus(); - field_0x1d1 = dComIfGp_getBottleStatus(); + mZStatus = dComIfGp_getZStatus(); + m3DStatus = dComIfGp_get3DStatus(); + mCStickStatus = dComIfGp_getCStickStatus(); + mSButtonStatus = dComIfGp_getSButtonStatus(); + mNunStatus = dComIfGp_getNunStatus(); + mRemoConStatus = dComIfGp_getRemoConStatus(); + mNunZStatus = dComIfGp_getNunZStatus(); + mNunCStatus = dComIfGp_getNunCStatus(); + mBottleStatus = dComIfGp_getBottleStatus(); field_0x1ac = dMeter2Info_isUseButton(16); field_0x19a = 0; @@ -500,20 +460,20 @@ int dMeter2_c::_create() { for (int i = 0; i < 2; i++) { if (field_0x128 == 0) { - if (field_0x1d2[i * 2] == BOMB_BAG_LV1 || field_0x1d2[i * 2] == NORMAL_BOMB || - field_0x1d2[i * 2] == WATER_BOMB || field_0x1d2[i * 2] == POKE_BOMB) { + if (mItemStatus[i * 2] == BOMB_BAG_LV1 || mItemStatus[i * 2] == NORMAL_BOMB || + mItemStatus[i * 2] == WATER_BOMB || mItemStatus[i * 2] == POKE_BOMB) { mpMeterDraw->setItemNum(i, dComIfGp_getSelectItemNum(i), dComIfGp_getSelectItemMaxNum(i)); - } else if (field_0x1d2[i * 2] == BEE_CHILD) { + } else if (mItemStatus[i * 2] == BEE_CHILD) { mpMeterDraw->setItemNum(i, dComIfGp_getSelectItemNum(i), dComIfGp_getSelectItemMaxNum(i)); - } else if (field_0x1d2[i * 2] == BOW || field_0x1d2[i * 2] == LIGHT_ARROW || - field_0x1d2[i * 2] == ARROW_LV1 || field_0x1d2[i * 2] == ARROW_LV2 || - field_0x1d2[i * 2] == ARROW_LV3 || field_0x1d2[i * 2] == HAWK_ARROW) { + } else if (mItemStatus[i * 2] == BOW || mItemStatus[i * 2] == LIGHT_ARROW || + mItemStatus[i * 2] == ARROW_LV1 || mItemStatus[i * 2] == ARROW_LV2 || + mItemStatus[i * 2] == ARROW_LV3 || mItemStatus[i * 2] == HAWK_ARROW) { mpMeterDraw->setItemNum(i, mArrowNum, dComIfGs_getArrowMax()); - } else if (field_0x1d2[i * 2] == PACHINKO) { + } else if (mItemStatus[i * 2] == PACHINKO) { mpMeterDraw->setItemNum(i, mPachinkoNum, dComIfGs_getPachinkoMax()); - } else if (field_0x1d2[i * 2] == BOMB_ARROW) { + } else if (mItemStatus[i * 2] == BOMB_ARROW) { u8 item_num = dComIfGp_getSelectItemNum(i); u8 item_max = dComIfGp_getSelectItemMaxNum(i); if (item_num > mArrowNum) { @@ -541,9 +501,9 @@ int dMeter2_c::_create() { mpHeap->getTotalFreeSize(); mpSubHeap = fopMsgM_createExpHeap(0x5000, mpHeap); field_0x108 = NULL; - field_0x110 = NULL; - field_0x114 = NULL; - field_0x118 = NULL; + mpMeterSub = NULL; + mpMeterString = NULL; + mpMeterButton = NULL; mpHeap->getTotalFreeSize(); field_0x11c = NULL; @@ -623,14 +583,37 @@ int dMeter2_c::_execute() { } /* 8021F370-8021F49C 219CB0 012C+00 1/1 0/0 0/0 .text _draw__9dMeter2_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm int dMeter2_c::_draw() { - nofralloc -#include "asm/d/meter/d_meter2/_draw__9dMeter2_cFv.s" +int dMeter2_c::_draw() { + if (mpMap != NULL) { + mpMap->_draw(); + } + + if (mpMeterSub != NULL) { + dComIfGd_set2DOpaTop(mpMeterSub); + } + + if (mpMeterString != NULL) { + if (mSubContents == 5) { + if (mSubContentsStringType != 0) { + dComIfGd_set2DOpaTop(mpMeterString); + } + } else { + dComIfGd_set2DOpaTop(mpMeterString); + } + } + + if (dMeter2Info_getWindowStatus() == 2) { + dComIfGd_set2DOpa(mpMeterDraw); + } else { + dComIfGd_set2DOpaTop(mpMeterDraw); + } + + if (mpMeterButton != NULL) { + dComIfGd_set2DOpaTop(mpMeterButton); + } + + return 1; } -#pragma pop /* ############################################################################################## */ /* 804549D0-804549D8 002FD0 0004+04 10/10 0/0 0/0 .sdata2 @4837 */ @@ -641,6 +624,58 @@ SECTION_SDATA2 static f32 lit_4837[1 + 1 /* padding */] = { }; /* 8021F49C-8021F6EC 219DDC 0250+00 1/1 0/0 0/0 .text _delete__9dMeter2_cFv */ +#ifdef NONMATCHING +int dMeter2_c::_delete() { + mpHeap->getTotalFreeSize(); + JKRHeap* heap = mDoExt_setCurrentHeap(mpHeap); + + if (isRupeeSoundBit(2)) { + mDoAud_seStart(Z2SE_LUPY_INC_CNT_2, 0, 0, 0); + } + + if (isRupeeSoundBit(3)) { + mDoAud_seStart(Z2SE_LUPY_DEC_CNT_2, 0, 0, 0); + } + + if (isArrowSoundBit(2) && (isArrowEquip() || isPachinkoEquip()) && + mpMeterDraw->isButtonVisible()) { + mDoAud_seStart(Z2SE_CONSUM_INC_CNT_2, 0, 0, 0); + } + + mpHeap->getTotalFreeSize(); + if (mpMap != NULL) { + delete mpMap; + mpMap = NULL; + } + + mpHeap->getTotalFreeSize(); + mDoExt_setCurrentHeap(mpSubHeap); + if (mpMeterSub != NULL) { + delete mpMeterSub; + mpMeterSub = NULL; + } + + if (mpMeterString != NULL) { + delete mpMeterString; + mpMeterString = NULL; + } + + mpHeap->getTotalFreeSize(); + if (field_0x11c != NULL) { + delete field_0x11c; + field_0x11c = NULL; + } + + mDoExt_setCurrentHeap(heap); + delete mpMeterDraw; + mpMeterDraw = NULL; + + fopMsgM_destroyExpHeap(mpSubHeap); + fopMsgM_destroyExpHeap(mpHeap); + emphasisButtonDelete(); + return 1; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -649,17 +684,24 @@ asm int dMeter2_c::_delete() { #include "asm/d/meter/d_meter2/_delete__9dMeter2_cFv.s" } #pragma pop +#endif /* 8021F6EC-8021F780 21A02C 0094+00 1/1 5/5 0/0 .text emphasisButtonDelete__9dMeter2_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void dMeter2_c::emphasisButtonDelete() { - nofralloc -#include "asm/d/meter/d_meter2/emphasisButtonDelete__9dMeter2_cFv.s" +int dMeter2_c::emphasisButtonDelete() { + if (mpMeterButton != NULL) { + JKRExpHeap* heap = dComIfGp_getSubHeap2D(8); + mpMeterButton->hideAll(); + + if (heap != NULL) { + delete mpMeterButton; + mpMeterButton = NULL; + heap->freeAll(); + dComIfGp_offHeapLockFlag(8); + } + } + return 1; } -#pragma pop inline void i_dComIfGp_setItemLifeCount(f32 amount, u8 type) { g_dComIfG_gameInfo.play.setItemLifeCount(amount, type); @@ -705,7 +747,144 @@ SECTION_SDATA2 static f64 lit_5267 = 4503601774854144.0 /* cast s32 to float */; /* 804549E0-804549E8 002FE0 0008+00 2/2 0/0 0/0 .sdata2 @5268 */ SECTION_SDATA2 static f64 lit_5268 = 4503599627370496.0 /* cast u32 to float */; +inline bool i_dComIfGp_checkPlayerStatus1(int param_0, u32 flag) { + return g_dComIfG_gameInfo.play.checkPlayerStatus(param_0, 1, flag); +} + +inline bool dComIfGp_checkPlayerStatus0(int param_0, u32 param_1) { + return g_dComIfG_gameInfo.play.checkPlayerStatus(param_0, 0, param_1); +} + +inline void dComIfGp_setItemLifeCount(float amount, u8 type) { + g_dComIfG_gameInfo.play.setItemLifeCount(amount, type); +} + /* 8021FD60-80220180 21A6A0 0420+00 1/1 0/0 0/0 .text moveLife__9dMeter2_cFv */ +// small type issue +#ifdef NONMATCHING +void dMeter2_c::moveLife() { + s16 life_count = 0; + bool setDraw = false; + s16 temp_r5 = dComIfGp_getItemMaxLifeCount(); + + if (temp_r5 != 0) { + s16 max_count = dComIfGs_getMaxLife() + dComIfGp_getItemMaxLifeCount(); + if (max_count > 100) { + max_count = 100; + } else { + if (max_count < 15) { + max_count = 15; + } + } + + life_count = (max_count / 5) * 4; + dComIfGs_setMaxLife(max_count); + s16 current_life = life_count - dComIfGs_getLife(); + dComIfGp_setItemLifeCount(current_life, 0); + dComIfGp_clearItemMaxLifeCount(); + setDraw = true; + } + + f32 item_life_count = dComIfGp_getItemLifeCount(); + if (item_life_count != FLOAT_LABEL(lit_4662)) { + field_0x1ee = dComIfGp_getItemLifeCountType(); + if (!setDraw) { + life_count = (dComIfGs_getMaxLife() / 5) * 4; + } + + s16 tmp = dComIfGs_getLife() + dComIfGp_getItemLifeCount(); + if (tmp > life_count) { + tmp = life_count; + } else if (tmp < 0) { + tmp = 0; + } + + dComIfGs_setLife((u8)tmp); + dComIfGp_clearItemLifeCount(); + + // extsh instead of mr + if (mNowLifeGauge == tmp && field_0x1ee != 0) { + field_0x1ee = 0; + } + setDraw = true; + } + + u16 max_life = dComIfGs_getMaxLife(); + if (mMaxLife != max_life) { + if (mMaxLife < max_life) { + mMaxLife++; + dMeter2Info_onLifeGaugeSE(); + setDraw = true; + } else if (mMaxLife > max_life) { + mMaxLife--; + setDraw = true; + } + } + + u16 current_life = dComIfGs_getLife(); + if (mNowLifeGauge != current_life) { + if (mNowLifeGauge < current_life) { + mNowLifeGauge++; + if (i_dComIfGp_checkPlayerStatus1(0, 0x2000) || + dComIfGp_checkPlayerStatus0(0, 0x20000000) || dMeter2Info_getLifeGaugeSE()) { + if (mNowLifeGauge % 4 == 0) { + mDoAud_seStart(Z2SE_HP_GAUGE_INC, 0, 0, 0); + } + } else { + if (field_0x1ee == 1) { + mDoAud_seStart(Z2SE_HP_GAUGE_INC, 0, 0, 0); + } + } + + u16 life = dComIfGs_getLife(); + if (mNowLifeGauge == life && field_0x1ee != 0) { + field_0x1ee = 0; + } + setDraw = true; + } else if (mNowLifeGauge > current_life) { + mNowLifeGauge--; + if (field_0x1ee != 0) { + field_0x1ee = 0; + } + setDraw = true; + } + } else { + if (dMeter2Info_getLifeGaugeSE()) { + dMeter2Info_offLifeGaugeSE(); + } + } + + f32 life_gauge_x = g_drawHIO.mLifeGaugePosX; + f32 life_gauge_y = g_drawHIO.mLifeGaugePosY; + + if (field_0x204 != g_drawHIO.mLifeGaugePosX) { + field_0x204 = g_drawHIO.mLifeGaugePosX; + setDraw = true; + } + if (field_0x208 != g_drawHIO.mLifeGaugePosY) { + field_0x208 = g_drawHIO.mLifeGaugePosY; + setDraw = true; + } + if (field_0x20c != g_drawHIO.mLifeGaugeScale) { + field_0x20c = g_drawHIO.mLifeGaugeScale; + setDraw = true; + } + if (field_0x210 != g_drawHIO.mHeartScale) { + field_0x210 = g_drawHIO.mHeartScale; + setDraw = true; + } + if (field_0x214 != g_drawHIO.mLargeHeartScale) { + field_0x214 = g_drawHIO.mLargeHeartScale; + setDraw = true; + } + + if (setDraw == true) { + mpMeterDraw->drawLife(mMaxLife, mNowLifeGauge, life_gauge_x, life_gauge_y); + } + alphaAnimeLife(); + dComIfGp_setItemNowLife((u8)mNowLifeGauge); +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -714,6 +893,7 @@ asm void dMeter2_c::moveLife() { #include "asm/d/meter/d_meter2/moveLife__9dMeter2_cFv.s" } #pragma pop +#endif /* ############################################################################################## */ /* 804549E8-804549EC 002FE8 0004+00 4/4 0/0 0/0 .sdata2 @5791 */ @@ -835,24 +1015,46 @@ asm void dMeter2_c::moveButton3D() { #pragma pop /* 80222364-80222494 21CCA4 0130+00 1/1 0/0 0/0 .text moveButtonC__9dMeter2_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void dMeter2_c::moveButtonC() { - nofralloc -#include "asm/d/meter/d_meter2/moveButtonC__9dMeter2_cFv.s" +void dMeter2_c::moveButtonC() { + if (dComIfGp_getCStickStatusForce()) { + u8 setFlag = dComIfGp_getCStickSetFlagForce(); + u8 dirForce = dComIfGp_getCStickDirectionForce(); + u8 statusForce = dComIfGp_getCStickStatusForce(); + dComIfGp_setCStickStatus(statusForce, dirForce, setFlag); + dComIfGp_setCStickStatusForce(0, 0, 0); + } + + if (mCStickStatus == dComIfGp_getCStickStatus() && + field_0x1ac == dMeter2Info_isUseButton(0x10)) { + if ((!mpMeterDraw->isEmphasisC() || dComIfGp_isCStickSetFlag(2)) && + (mpMeterDraw->isEmphasisC() || !dComIfGp_isCStickSetFlag(2)) && + field_0x19a == mpMeterDraw->getButtonTimer()) { + return; + } + } + + field_0x19a = mpMeterDraw->getButtonTimer(); + mCStickStatus = dComIfGp_getCStickStatus(); + field_0x1ac = dMeter2Info_isUseButton(0x10); + mpMeterDraw->drawButtonC(mCStickStatus, field_0x128 == 0); } -#pragma pop /* 80222494-80222518 21CDD4 0084+00 1/1 0/0 0/0 .text moveButtonS__9dMeter2_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void dMeter2_c::moveButtonS() { - nofralloc -#include "asm/d/meter/d_meter2/moveButtonS__9dMeter2_cFv.s" +void dMeter2_c::moveButtonS() { + if (dComIfGp_getSButtonStatusForce()) { + u8 setFlag = dComIfGp_getSButtonSetFlagForce(); + u8 statusForce = dComIfGp_getSButtonStatusForce(); + dComIfGp_setSButtonStatus(statusForce, setFlag); + dComIfGp_setSButtonStatusForce(0, 0); + } else { + dComIfGp_setSButtonStatus(0, 0); + } + + if (mSButtonStatus != dComIfGp_getSButtonStatus()) { + mSButtonStatus = dComIfGp_getSButtonStatus(); + mpMeterDraw->drawButtonS(mSButtonStatus); + } } -#pragma pop /* 80222518-80222E88 21CE58 0970+00 1/1 0/0 0/0 .text moveButtonXY__9dMeter2_cFv */ #pragma push @@ -887,14 +1089,25 @@ void dMeter2_c::moveTouchSubMenu() { } /* 802230FC-802231C8 21DA3C 00CC+00 1/1 0/0 0/0 .text moveSubContents__9dMeter2_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void dMeter2_c::moveSubContents() { - nofralloc -#include "asm/d/meter/d_meter2/moveSubContents__9dMeter2_cFv.s" +void dMeter2_c::moveSubContents() { + JKRHeap* heap = mDoExt_setCurrentHeap(mpSubHeap); + checkSubContents(); + + if (mpMeterSub != NULL) { + mpMeterSub->_execute(field_0x124); + } + + if (mpMeterString != NULL) { + if (mSubContents == 5 && mSubContentsStringType != dMeter2Info_getMeterStringType()) { + mSubContentsStringType = dMeter2Info_getMeterStringType(); + if (mSubContentsStringType != 0) { + mpMeterString->createString(mSubContentsStringType); + } + } + mpMeterString->_execute(field_0x124); + } + mDoExt_setCurrentHeap(heap); } -#pragma pop /* 802231C8-802237D4 21DB08 060C+00 1/1 0/0 0/0 .text move2DContents__9dMeter2_cFv */ #pragma push @@ -964,6 +1177,68 @@ asm void dMeter2_c::moveArrowNum() { #pragma pop /* 80224680-802248E4 21EFC0 0264+00 1/1 0/0 0/0 .text movePachinkoNum__9dMeter2_cFv */ +// matches with literals +#ifdef NONMATCHING +void dMeter2_c::movePachinkoNum() { + if (g_mwHIO.getPachinkoFlag()) { + if (dComIfGs_getPachinkoNum() != dComIfGs_getPachinkoMax()) { + u8 max = dComIfGs_getPachinkoMax(); + dComIfGp_setItemPachinkoNumCount(max); + } + if (dComIfGp_getItemPachinkoNumCount() < 0) { + dComIfGp_clearItemPachinkoNumCount(); + } + } + + if (dComIfGp_getItemPachinkoNumCount() == 0 && mItemMaxNum[3] == dComIfGs_getPachinkoMax() && + mPachinkoNum == dComIfGs_getPachinkoNum()) { + return; + } + + s16 pachinko_num = dComIfGs_getPachinkoNum() + dComIfGp_getItemPachinkoNumCount(); + dComIfGp_clearItemPachinkoNumCount(); + if (pachinko_num < 0) { + pachinko_num = 0; + } + + if (dComIfGs_getPachinkoMax() < pachinko_num) { + pachinko_num = dComIfGs_getPachinkoMax(); + } + + dComIfGs_setPachinkoNum(pachinko_num); + mItemMaxNum[3] = dComIfGs_getPachinkoMax(); + + if (mPachinkoNum < dComIfGs_getPachinkoNum()) { + mPachinkoNum++; + onArrowSoundBit(2); + + if (isArrowSoundBit(2)) { + if (mPachinkoNum != dComIfGs_getPachinkoNum()) { + if (!isArrowSoundBit(0) && isPachinkoEquip() && mpMeterDraw->isButtonVisible()) { + onArrowSoundBit(0); + mDoAud_seStart(Z2SE_CONSUM_INC_CNT_1, 0, 0, 0); + } else { + offArrowSoundBit(0); + } + } else { + if (isPachinkoEquip() && mpMeterDraw->isButtonVisible()) { + mDoAud_seStart(Z2SE_CONSUM_INC_CNT_2, 0, 0, 0); + } + offArrowSoundBit(2); + offArrowSoundBit(0); + } + } + } else if (mPachinkoNum > dComIfGs_getPachinkoNum()) { + mPachinkoNum--; + } + + for (int i = 0; i < 2; i++) { + if (mItemStatus[i * 2] == PACHINKO) { + mpMeterDraw->setItemNum(i, mPachinkoNum, dComIfGs_getPachinkoMax()); + } + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -972,6 +1247,7 @@ asm void dMeter2_c::movePachinkoNum() { #include "asm/d/meter/d_meter2/movePachinkoNum__9dMeter2_cFv.s" } #pragma pop +#endif /* 802248E4-80224A04 21F224 0120+00 1/1 0/0 0/0 .text alphaAnimeLife__9dMeter2_cFv */ #pragma push @@ -1075,25 +1351,65 @@ asm void dMeter2_c::alphaAnimeButtonCross() { } #pragma pop +inline daPy_py_c* daPy_getPlayerActorClass() { + return (daPy_py_c*)dComIfGp_getPlayer(0); +} + +inline u16 dComIfGp_event_checkHind(u16 flag) { + if (!dComIfGp_event_runCheck()) { + return false; + } + return g_dComIfG_gameInfo.play.getEvent().checkHind(flag); +} + /* 802256DC-802258A0 22001C 01C4+00 3/3 0/0 0/0 .text isShowLightDrop__9dMeter2_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void dMeter2_c::isShowLightDrop() { - nofralloc -#include "asm/d/meter/d_meter2/isShowLightDrop__9dMeter2_cFv.s" +bool dMeter2_c::isShowLightDrop() { + if (!g_drawHIO.mLightDrop.mAnimDebug) { + if ((field_0x124 & 0x4000) || + !dComIfGs_isLightDropGetFlag(dComIfGp_getStartStageDarkArea()) || + dMeter2Info_getLightDropGetFlag(dComIfGp_getStartStageDarkArea()) <= 1 || + !dKy_darkworld_check() || ((field_0x124 & 0x40) && dComIfGp_event_checkHind(0x200)) || + daPy_getPlayerActorClass()->i_getSumouMode() || + (daPy_getPlayerActorClass()->checkCanoeSlider() && + (dComIfG_getTimerMode() == 3 || dComIfG_getTimerMode() == 4)) || + (field_0x124 & 0x40000000) || (field_0x124 & 0x00001000) || + (field_0x124 & 0x00100000) || (field_0x124 & 0x80000000) || + (field_0x124 & 0x00000100) || (field_0x124 & 0x00000080) || + (field_0x124 & 0x00000008) || (field_0x124 & 0x00000010) || + (field_0x124 & 0x01000000) || (field_0x124 & 0x00000020) || + (field_0x124 & 0x04000000) || (field_0x124 & 0x08000000) || + (field_0x124 & 0x10000000) || dMeter2Info_isSub2DStatus(1)) { + return false; + } + } + return true; } -#pragma pop /* 802258A0-80225960 2201E0 00C0+00 1/1 0/0 0/0 .text killSubContents__9dMeter2_cFUc */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void dMeter2_c::killSubContents(u8 param_0) { - nofralloc -#include "asm/d/meter/d_meter2/killSubContents__9dMeter2_cFUc.s" +void dMeter2_c::killSubContents(u8 param_0) { + if (mSubContents != param_0 && mSubContents != 0) { + bool free = false; + + if (mpMeterSub != NULL) { + delete mpMeterSub; + mpMeterSub = NULL; + free = true; + } + + if (mpMeterString != NULL) { + delete mpMeterString; + mpMeterString = NULL; + free = true; + } + + if (free) { + mpSubHeap->freeAll(); + } + + mSubContents = 0; + mSubContentsStringType = 0; + } } -#pragma pop /* 80225960-802259F8 2202A0 0098+00 1/1 0/0 0/0 .text isKeyVisible__9dMeter2_cFv */ #pragma push @@ -1106,24 +1422,27 @@ asm void dMeter2_c::isKeyVisible() { #pragma pop /* 802259F8-80225A64 220338 006C+00 2/2 0/0 0/0 .text isArrowEquip__9dMeter2_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void dMeter2_c::isArrowEquip() { - nofralloc -#include "asm/d/meter/d_meter2/isArrowEquip__9dMeter2_cFv.s" +int dMeter2_c::isArrowEquip() { + for (int i = 0; i < 2; i++) { + if (mItemStatus[i * 2] == BOW || mItemStatus[i * 2] == LIGHT_ARROW || + mItemStatus[i * 2] == ARROW_LV1 || mItemStatus[i * 2] == ARROW_LV2 || + mItemStatus[i * 2] == ARROW_LV3 || mItemStatus[i * 2] == HAWK_ARROW || + mItemStatus[i * 2] == BOMB_ARROW) { + return i + 1; + } + } + return 0; } -#pragma pop /* 80225A64-80225AA0 2203A4 003C+00 2/2 0/0 0/0 .text isPachinkoEquip__9dMeter2_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void dMeter2_c::isPachinkoEquip() { - nofralloc -#include "asm/d/meter/d_meter2/isPachinkoEquip__9dMeter2_cFv.s" +int dMeter2_c::isPachinkoEquip() { + for (int i = 0; i < 2; i++) { + if (mItemStatus[i * 2] == PACHINKO) { + return i + 1; + } + } + return 0; } -#pragma pop /* 80225AA0-80225AC0 2203E0 0020+00 1/0 0/0 0/0 .text dMeter2_Draw__FP9dMeter2_c */ static int dMeter2_Draw(dMeter2_c* p_meter) { @@ -1146,28 +1465,37 @@ static int dMeter2_Delete(dMeter2_c* p_meter) { } /* 80225B08-80225BB8 220448 00B0+00 1/0 0/0 0/0 .text dMeter2_Create__FP9msg_class */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm int dMeter2_Create(msg_class* param_0) { - nofralloc -#include "asm/d/meter/d_meter2/dMeter2_Create__FP9msg_class.s" +static int dMeter2_Create(msg_class* meter) { + dMeter2Info_setMeterClass(static_cast<dMeter2_c*>(meter)); + dComIfGp_2dShowOn(); + fopMsgM_Create(0x314, NULL, NULL); + g_drawHIO.field_0x4 = -1; + g_ringHIO.field_0x4 = -1; + g_fmapHIO.field_0x4 = -1; + g_cursorHIO.field_0x4 = -1; + u32 id = fopMsgM_Create(0x313, NULL, NULL); + fopMsgM_setMessageID(id); + dTimer_createStockTimer(); + fopMsgM_setStageLayer(meter); + return static_cast<dMeter2_c*>(meter)->_create(); } -#pragma pop /* ############################################################################################## */ /* 803BFA54-803BFA68 -00001 0014+00 1/0 0/0 0/0 .data l_dMeter2_Method */ -SECTION_DATA static dMeter2_Method l_dMeter2_Method[5] = { - (dMeter2_Method)dMeter2_Create, dMeter2_Delete, dMeter2_Execute, dMeter2_IsDelete, dMeter2_Draw, +SECTION_DATA static leafdraw_method_class l_dMeter2_Method = { + (process_method_func)dMeter2_Create, (process_method_func)dMeter2_Delete, + (process_method_func)dMeter2_Execute, (process_method_func)dMeter2_IsDelete, + (process_method_func)dMeter2_Draw, }; /* 803BFA68-803BFA90 -00001 0028+00 0/0 0/0 1/0 .data g_profile_METER2 */ -SECTION_DATA extern void* g_profile_METER2[10] = { - (void*)0xFFFFFFFD, (void*)0x000CFFFD, - (void*)0x03160000, (void*)&g_fpcLf_Method, - (void*)0x000004C0, (void*)NULL, - (void*)NULL, (void*)&g_fopMsg_Method, - (void*)0x03010000, (void*)&l_dMeter2_Method, -}; +SECTION_DATA extern leaf_process_profile_definition g_profile_METER2 = { + -3, 12, + -3, 0x0316, + 0, (process_method_class*)&g_fpcLf_Method, + 0x4C0, 0, + 0, &g_fopMsg_Method, + 0x0301, 0, + 0, &l_dMeter2_Method}; /* 80399338-80399338 025998 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ diff --git a/src/d/msg/d_msg_object.cpp b/src/d/msg/d_msg_object.cpp index 38978405fb..683d819692 100644 --- a/src/d/msg/d_msg_object.cpp +++ b/src/d/msg/d_msg_object.cpp @@ -429,7 +429,6 @@ extern "C" void _restgpr_28(); extern "C" void _restgpr_29(); extern "C" u8 const tempBitLabels__20dSv_event_tmp_flag_c[370 + 2 /* padding */]; extern "C" extern void* g_fopMsg_Method[5 + 1 /* padding */]; -extern "C" extern void* g_fpcLf_Method[5 + 1 /* padding */]; extern "C" u8 saveBitLabels__16dSv_event_flag_c[1644 + 4 /* padding */]; extern "C" u8 m_cpadInfo__8mDoCPd_c[256]; extern "C" extern u8 data_80450B70[4]; diff --git a/src/d/particle/d_particle.cpp b/src/d/particle/d_particle.cpp index d6917f2064..fc0a5455da 100644 --- a/src/d/particle/d_particle.cpp +++ b/src/d/particle/d_particle.cpp @@ -1408,8 +1408,7 @@ asm void dPa_control_c::level_c::emitter_c::entry(u32 param_0, u16 param_1, JPAB /* ############################################################################################## */ /* 80450EC4-80450EC8 0003C4 0004+00 1/1 2/2 0/0 .sbss None */ -extern u8 data_80450EC4[4]; -u8 data_80450EC4[4]; +u8 data_80450EC4; /* 80450EC8-80450ED0 0003C8 0004+04 2/2 1/1 17/17 .sbss mParticleTracePCB__13dPa_control_c */ u8 dPa_control_c::mParticleTracePCB[4 + 4 /* padding */]; diff --git a/src/d/s/d_s_play.cpp b/src/d/s/d_s_play.cpp index 4ec0eea442..e04521f15d 100644 --- a/src/d/s/d_s_play.cpp +++ b/src/d/s/d_s_play.cpp @@ -4,267 +4,47 @@ // #include "d/s/d_s_play.h" +#include "JSystem/JUtility/JUTConsole.h" +#include "SSystem/SComponent/c_counter.h" +#include "d/d_item.h" +#include "d/msg/d_msg_object.h" #include "dol2asm.h" #include "dolphin/types.h" +#include "f_op/f_op_draw_iter.h" +#include "f_op/f_op_overlap_mng.h" +#include "f_op/f_op_scene_mng.h" +#include "m_Do/m_Do_audio.h" // // Types: // -struct stage_stag_info_class {}; - -struct scene_class {}; - -struct request_of_phase_process_class {}; - -struct mDoRst { - static u8 mResetData[4 + 4 /* padding */]; -}; - -struct mDoGph_gInf_c { - struct bloom_c { - /* 800095F8 */ void remove(); - }; - - static u8 m_bloom[20]; - static u8 mFader[4]; -}; - -struct mDoDvdThd_toMainRam_c {}; - -struct mDoDvdThd_mountXArchive_c {}; - -struct fopAc_ac_c {}; - -struct fopAcM_wt_c { - static u8 mWaterCheck[84 + 4 /* padding */]; -}; - -struct fopAcM_rc_c { - static u8 mRoofCheck[80]; -}; - -struct fopAcM_lc_c { - static u8 mLineCheck[112]; -}; - -struct fopAcM_gc_c { - static u8 mGndCheck[84]; -}; - struct daYkgr_c { static u8 m_emitter[4]; }; struct daSus_c { /* 800313BC */ void reset(); - /* 800315A4 */ void execute(); -}; - -struct daPy_py_c { - /* 8015F660 */ void checkRoomRestartStart(); -}; - -struct dVibration_c { - /* 8006F268 */ void Run(); - /* 8006FF04 */ void Init(); - /* 8006FF38 */ void Pause(); - /* 8006FFF8 */ void Remove(); -}; - -struct dTres_c { - /* 8009BC18 */ void create(); - /* 8009BC60 */ void remove(); -}; - -struct dSv_player_status_b_c { - /* 80032B94 */ void onDarkClearLV(int); - /* 80032BD0 */ void onTransformLV(int); -}; - -struct dSv_player_item_c { - /* 80032FB8 */ void setItem(int, u8); -}; - -struct dSv_player_get_item_c { - /* 80033E60 */ void onFirstBit(u8); -}; - -struct dSv_info_c { - /* 80034FCC */ void init(); -}; - -struct dSv_event_c { - /* 8003498C */ void onEventBit(u16); -}; - -struct dSv_danBit_c { - /* 80034B98 */ void onSwitch(int); -}; - -struct dStage_startStage_c {}; - -struct dStage_roomControl_c { - /* 80024954 */ void resetArchiveBank(int); - - static u8 mProcID[4]; -}; - -struct dScnPly_reg_HIO_c { - /* 8025AD78 */ ~dScnPly_reg_HIO_c(); -}; - -struct dScnPly_preLoad_HIO_c { - /* 8025ADC0 */ ~dScnPly_preLoad_HIO_c(); -}; - -struct dScnPly_env_otherHIO_c { - /* 80259440 */ dScnPly_env_otherHIO_c(); - /* 8025AC0C */ ~dScnPly_env_otherHIO_c(); -}; - -struct dScnPly_env_debugHIO_c { - /* 80259468 */ dScnPly_env_debugHIO_c(); - /* 8025ABC4 */ ~dScnPly_env_debugHIO_c(); -}; - -struct dScnPly_env_HIO_c { - /* 8025AD04 */ ~dScnPly_env_HIO_c(); -}; - -struct dScnPly_c { - /* 80259400 */ void calcPauseTimer(); - /* 80259AC4 */ void resetGame(); - /* 80259BFC */ void offReset(); -}; - -struct dRes_info_c {}; - -struct JKRHeap {}; - -struct dRes_control_c { - /* 8003C078 */ void setRes(char const*, dRes_info_c*, int, char const*, u8, JKRHeap*); - /* 8003C160 */ void syncRes(char const*, dRes_info_c*, int); - /* 8003C470 */ void syncAllRes(dRes_info_c*, int); - /* 8003C5BC */ void setStageRes(char const*, JKRHeap*); -}; - -struct dPa_control_c { - /* 8004BDFC */ void readScene(u8, mDoDvdThd_toMainRam_c**); - /* 8004BEB0 */ void createScene(void const*); - /* 8004BFD4 */ void removeScene(bool); - /* 8004C054 */ void cleanup(); - /* 8004C078 */ void calc3D(); - /* 8004C0EC */ void calc2D(); -}; - -struct dMsgObject_c { - /* 8023800C */ void readMessageGroup(mDoDvdThd_mountXArchive_c**); -}; - -struct dMpath_c { - /* 8003FB70 */ void create(); - /* 8003FC70 */ void remove(); + /* 800315A4 */ static void execute(); }; struct dMdl_mng_c { /* 8009C7AC */ void create(); /* 8009C864 */ void remove(); - /* 8009C8C0 */ void reset(); -}; - -struct dEyeHL_mng_c { - /* 8009CA48 */ void update(); -}; - -struct dEvt_control_c { - /* 80042BBC */ void Step(); - /* 800431E8 */ void remove(); -}; - -struct dDlst_window_c { - /* 80051AC0 */ void setViewPort(f32, f32, f32, f32, f32, f32); - /* 80051ADC */ void setScissor(f32, f32, f32, f32); + /* 8009C8C0 */ static void reset(); }; struct dDemo_c { /* 80039678 */ void create(); /* 80039910 */ void remove(); - /* 80039DA4 */ void update(); + /* 80039DA4 */ static void update(); }; -struct dComIfG_play_c { - /* 8002B22C */ void init(); - /* 8002B3B8 */ void setStartStage(dStage_startStage_c*); - /* 8002B434 */ void getLayerNo_common_common(char const*, int, int); - /* 8002C950 */ void getLayerNo_common(char const*, int, int); - /* 8002C97C */ void getLayerNo(int); - /* 8002CA1C */ void createSimpleModel(); - /* 8002CA70 */ void deleteSimpleModel(); -}; - -struct dCcS { - /* 80085ED4 */ void Ct(); - /* 80085F08 */ void Dt(); - /* 800872B0 */ void Move(); - /* 800872D0 */ void Draw(); -}; - -struct dBgS { - /* 8007493C */ void ClrMoveFlag(); - /* 800749A8 */ void Move(); -}; - -struct dAttention_c { - /* 80070198 */ dAttention_c(fopAc_ac_c*, u32); - /* 80070774 */ ~dAttention_c(); - /* 80072924 */ void Run(); - /* 80072BD4 */ void Draw(); -}; - -struct csXyz {}; - -struct create_tag_class {}; - -struct cXyz {}; - struct cDylPhs { /* 8001884C */ void Link(request_of_phase_process_class*, s16); /* 80018890 */ void Unlink(request_of_phase_process_class*, s16); }; -struct cBgS_PolyInfo { - /* 80268120 */ void ClearPi(); -}; - -struct Z2SceneMgr { - /* 802B68B0 */ void setInDarkness(bool); - /* 802BA09C */ void check1stDynamicWave(); - /* 802BA120 */ void load2ndDynamicWave(); - /* 802BA294 */ void sceneBgmStart(); -}; - -struct Z2AudioMgr { - static u8 mAudioMgrPtr[4 + 4 /* padding */]; -}; - -struct JUTGamePad { - struct C3ButtonReset { - static u8 sCallback[4]; - static u8 sCallbackArg[4 + 4 /* padding */]; - }; -}; - -struct JUTAssertion { - /* 802E4C3C */ void setMessageCount(int); -}; - -struct JKRExpHeap {}; - -struct JFWDisplay { - static u8 sManager[4]; -}; - // // Forward References: // @@ -398,7 +178,7 @@ extern "C" void dMeter2Info_setCloth__FUcb(); extern "C" void dMeter2Info_setSword__FUcb(); extern "C" void dMeter2Info_setShield__FUcb(); extern "C" void readMessageGroup__12dMsgObject_cFPP25mDoDvdThd_mountXArchive_c(); -extern "C" void func_80252E70(void* _this, s8*); +extern "C" s8 func_80252E70(s8*); extern "C" void ClearPi__13cBgS_PolyInfoFv(); extern "C" void setInDarkness__10Z2SceneMgrFb(); extern "C" void check1stDynamicWave__10Z2SceneMgrFv(); @@ -406,8 +186,6 @@ extern "C" void load2ndDynamicWave__10Z2SceneMgrFv(); extern "C" void sceneBgmStart__10Z2SceneMgrFv(); extern "C" void __dl__FPv(); extern "C" void setMessageCount__12JUTAssertionFi(); -extern "C" void JUTReportConsole_f(); -extern "C" void OSGetTime(); extern "C" void __register_global_object(); extern "C" void _savegpr_26(); extern "C" void _savegpr_28(); @@ -415,7 +193,6 @@ extern "C" void _savegpr_29(); extern "C" void _restgpr_26(); extern "C" void _restgpr_28(); extern "C" void _restgpr_29(); -extern "C" void strcmp(); extern "C" extern void* g_fopScn_Method[5 + 1 /* padding */]; extern "C" extern void* g_fpcNd_Method[5 + 1 /* padding */]; extern "C" extern void* __vt__14mDoHIO_entry_c[3]; @@ -424,39 +201,33 @@ extern "C" u8 mLineCheck__11fopAcM_lc_c[112]; extern "C" u8 mGndCheck__11fopAcM_gc_c[84]; extern "C" u8 mRoofCheck__11fopAcM_rc_c[80]; extern "C" u8 mWaterCheck__11fopAcM_wt_c[84 + 4 /* padding */]; -extern "C" extern u8 g_dComIfG_gameInfo[122384]; -extern "C" extern u8 g_env_light[4880]; +extern "C" extern dScnKy_env_light_c g_env_light; extern "C" extern u8 g_save_bit_HIO[1184 + 4 /* padding */]; -extern "C" extern u8 g_Counter[12 + 4 /* padding */]; -extern "C" extern u8 data_804505F0[8]; -extern "C" extern u32 g_blackColor; -extern "C" extern u32 g_saftyWhiteColor; -extern "C" extern u8 struct_80450BB8[4]; +extern "C" extern GXColor g_saftyWhiteColor; extern "C" u8 mFader__13mDoGph_gInf_c[4]; -extern "C" extern u8 struct_80450BE4[4]; extern "C" u8 mResetData__6mDoRst[4 + 4 /* padding */]; extern "C" u8 mProcID__20dStage_roomControl_c[4]; -extern "C" extern u8 data_80450D68[4]; extern "C" extern u8 struct_80450D8C[4]; extern "C" u8 m_emitter__8daYkgr_c[4]; -extern "C" extern u8 data_80450EC4[4]; -extern "C" extern u8 data_80450ED0[4]; extern "C" u8 sManager__10JFWDisplay[4]; extern "C" u8 mAudioMgrPtr__10Z2AudioMgr[4 + 4 /* padding */]; extern "C" u8 sCallback__Q210JUTGamePad13C3ButtonReset[4]; extern "C" u8 sCallbackArg__Q210JUTGamePad13C3ButtonReset[4 + 4 /* padding */]; -extern "C" extern u8 struct_80451500[4]; // // Declarations: // +inline dEvt_control_c& dComIfGp_getEvent() { + return g_dComIfG_gameInfo.play.getEvent(); +} + /* ############################################################################################## */ /* 804510F8-80451100 0005F8 0008+00 2/2 0/0 0/0 .sbss resPhase */ -static u8 resPhase[8]; +static request_of_phase_process_class resPhase; /* 80451100-80451108 000600 0008+00 2/2 0/0 0/0 .sbss dylPhase */ -static u8 dylPhase[8]; +static request_of_phase_process_class dylPhase; /* 80451108-8045110C 000608 0004+00 1/1 0/0 0/0 .sbss dylPreLoadTime1 */ static u8 dylPreLoadTime1[4]; @@ -482,96 +253,45 @@ static u8 g_preLoadHIO[4]; /* 80451124-80451128 -00001 0004+00 3/3 7/7 38/38 .sbss None */ /* 80451124 0001+00 data_80451124 None */ /* 80451125 0003+00 data_80451125 None */ -extern u8 struct_80451124[4]; -u8 struct_80451124[4]; +extern s8 struct_80451124; +s8 struct_80451124; + +s8 data_80451125; /* 80259400-80259440 253D40 0040+00 1/1 0/0 0/0 .text calcPauseTimer__9dScnPly_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void dScnPly_c::calcPauseTimer() { - nofralloc -#include "asm/d/s/d_s_play/calcPauseTimer__9dScnPly_cFv.s" +s8 dScnPly_c::calcPauseTimer() { + if (data_80451125 != 0) { + struct_80451124 = data_80451125; + data_80451125 = 0; + return struct_80451124; + } else { + return func_80252E70(&struct_80451124); // cLib_calcTimer<s8> : 80252E70 + } } -#pragma pop /* ############################################################################################## */ /* 803C3158-803C3188 020278 002E+02 1/1 0/0 0/0 .data l_wipeType$4081 */ -SECTION_DATA static u8 l_wipeType[46 + 2 /* padding */] = { - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x11, - 0x00, - 0x02, - 0x00, - 0x02, - 0x00, - 0x01, - 0x00, - 0x03, - 0x00, - 0x01, - 0x00, - 0x04, - 0x00, - 0x04, - 0x00, - 0x05, - 0x00, - 0x05, - 0x00, - 0x06, - 0x00, - 0x07, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x02, - 0x00, - 0x02, - 0x00, - 0x02, - 0x00, - 0x02, - 0x00, - 0x02, - 0x00, - 0x08, - 0x00, - 0x08, - /* padding */ - 0x00, - 0x00, +SECTION_DATA static s16 l_wipeType[23] = { + 0x0000, 0x0000, 0x0011, 0x0002, 0x0002, 0x0001, 0x0003, 0x0001, 0x0004, 0x0004, 0x0005, 0x0005, + 0x0006, 0x0007, 0x0000, 0x0000, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0008, 0x0008, }; /* 803C3188-803C3194 0202A8 000A+02 1/1 0/0 0/0 .data camparamarc$4608 */ -SECTION_DATA static u8 camparamarc[10 + 2 /* padding */] = { - 0x43, - 0x61, - 0x6D, - 0x50, - 0x61, - 0x72, - 0x61, - 0x6D, - 0x00, - 0x00, - /* padding */ - 0x00, - 0x00, -}; +SECTION_DATA static char camparamarc[10] = "CamParam"; /* 803C3194-803C31C0 -00001 002C+00 1/1 0/0 0/0 .data l_method$4860 */ -SECTION_DATA static void* l_method[11] = { - (void*)phase_00__FP9dScnPly_c, (void*)phase_1__FP9dScnPly_c, (void*)phase_1_0__FP9dScnPly_c, - (void*)phase_01__FP9dScnPly_c, (void*)phase_0__FP9dScnPly_c, (void*)phase_2__FP9dScnPly_c, - (void*)phase_3__FP9dScnPly_c, (void*)phase_4__FP9dScnPly_c, (void*)phase_5__FP9dScnPly_c, - (void*)phase_6__FP9dScnPly_c, (void*)phase_compleate__FPv, +SECTION_DATA static request_of_phase_process_fn l_method[11] = { + (request_of_phase_process_fn)phase_00__FP9dScnPly_c, + (request_of_phase_process_fn)phase_1__FP9dScnPly_c, + (request_of_phase_process_fn)phase_1_0__FP9dScnPly_c, + (request_of_phase_process_fn)phase_01__FP9dScnPly_c, + (request_of_phase_process_fn)phase_0__FP9dScnPly_c, + (request_of_phase_process_fn)phase_2__FP9dScnPly_c, + (request_of_phase_process_fn)phase_3__FP9dScnPly_c, + (request_of_phase_process_fn)phase_4__FP9dScnPly_c, + (request_of_phase_process_fn)phase_5__FP9dScnPly_c, + (request_of_phase_process_fn)phase_6__FP9dScnPly_c, + (request_of_phase_process_fn)phase_compleate__FPv, }; /* 803C31C0-803C31D4 -00001 0014+00 2/0 0/0 0/0 .data l_dScnPly_Method */ @@ -624,24 +344,16 @@ SECTION_DATA extern void* __vt__22dScnPly_env_otherHIO_c[3] = { }; /* 80454F18-80454F1C 003518 0002+02 1/0 0/0 0/0 .sdata2 T_JOINT_dylKeyTbl */ -SECTION_SDATA2 static u16 T_JOINT_dylKeyTbl[1 + 1 /* padding */] = { +SECTION_SDATA2 static u16 T_JOINT_dylKeyTbl = { 0x0106, - /* padding */ - 0x0000, }; -/* 80454F1C-80454F20 00351C 0004+00 1/1 0/0 0/0 .sdata2 @4055 */ -SECTION_SDATA2 static f32 lit_4055 = 255.0f; - /* 80259440-80259468 253D80 0028+00 1/1 0/0 0/0 .text __ct__22dScnPly_env_otherHIO_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm dScnPly_env_otherHIO_c::dScnPly_env_otherHIO_c() { - nofralloc -#include "asm/d/s/d_s_play/__ct__22dScnPly_env_otherHIO_cFv.s" +dScnPly_env_otherHIO_c::dScnPly_env_otherHIO_c() { + mShadowDensity = 255.0f; + mLODBias = 1; + mDispTransCylinder = false; } -#pragma pop /* ############################################################################################## */ /* 80454F20-80454F24 003520 0004+00 1/1 0/0 0/0 .sdata2 @4066 */ @@ -659,6 +371,15 @@ SECTION_SDATA2 static u8 lit_4068[4] = { }; /* 80259468-802594AC 253DA8 0044+00 1/1 0/0 0/0 .text __ct__22dScnPly_env_debugHIO_cFv */ +// matches with literals +#ifdef NONMATCHING +dScnPly_env_debugHIO_c::dScnPly_env_debugHIO_c() { + mBoxCullMinSize.set(-100.0f, -100.0f, -100.0f); + mBoxCullMaxSize.set(100.0f, 100.0f, 100.0f); + mSphereCullCenter.set(0.0f, 0.0f, 0.0f); + mSphereCullRadius = 100.0f; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -667,12 +388,83 @@ asm dScnPly_env_debugHIO_c::dScnPly_env_debugHIO_c() { #include "asm/d/s/d_s_play/__ct__22dScnPly_env_debugHIO_cFv.s" } #pragma pop +#endif /* ############################################################################################## */ /* 80454F2C-80454F30 00352C 0004+00 1/1 0/0 0/0 .sdata2 @4100 */ SECTION_SDATA2 static u32 lit_4100 = 0x2A1E46FF; /* 802594AC-802597B8 253DEC 030C+00 1/0 0/0 0/0 .text dScnPly_Draw__FP9dScnPly_c */ +// some small issues like instruction reordering +#ifdef NONMATCHING +static int dScnPly_Draw(dScnPly_c* scn) { + dComIfG_Ccsp()->Move(); + dComIfG_Bgsp().ClrMoveFlag(); + + u8 useWhiteColor; + if (!fopOvlpM_IsPeek() && !dComIfG_resetToOpening(scn)) { + if (dComIfGp_isEnableNextStage()) { + u8 wipe = dComIfGp_getNextStageWipe(); + fopScnM_ChangeReq(scn, 11, l_wipeType[wipe], 5); + + int hour = dKy_getdaytime_hour(); + useWhiteColor = false; + if (hour >= 6 && hour < 18) { + useWhiteColor = true; + } + bool tmp = useWhiteColor == 0; + + if (wipe == 1 || wipe == 2 || wipe == 7 || wipe == 17 || wipe == 21 || + ((wipe == 8 || wipe == 10 || wipe == 18) && tmp) || + ((wipe == 9 || wipe == 11 || wipe == 19) && !tmp)) { + mDoGph_gInf_c::setFadeColor(*(JUtility::TColor*)&g_saftyWhiteColor); + } else if (wipe == 14 || wipe == 20) { + GXColor color = {0x2A, 0x1E, 0x46, 0xFF}; + if (dKy_darkworld_check()) { + color.r = 0xFF; + color.g = 0xCF; + color.b = 0xB4; + } + mDoGph_gInf_c::setFadeColor(*(JUtility::TColor*)&color); + } else { + mDoGph_gInf_c::setFadeColor(*(JUtility::TColor*)&g_blackColor); + } + } + } + dMdl_mng_c::reset(); + + if (!dComIfGp_isPauseFlag() && struct_80451124 == 0) { + if (fpcM_GetName(scn) == 0xB) { + dComIfGp_getVibration().Run(); + } + daSus_c::execute(); + dComIfG_Bgsp().Move(); + dComIfGp_particle_calc3D(); + dComIfGp_particle_calc2D(); + cCt_execCounter(); + } else { + dPa_control_c::onStatus(1); + if (struct_80451124 == 0) { + dPa_control_c::onStatus(2); + if (struct_80451124 == 0) { + dComIfGp_getVibration().Pause(); + } + } + } + + for (create_tag_class* i = fopDwIt_Begin(); i != NULL; i = fopDwIt_Next(i)) { + fpcM_Draw(i->mpTagData); + } + + if (!dComIfGp_isPauseFlag()) { + dEyeHL_mng_c::update(); + dComIfG_Ccsp()->Draw(); + dComIfGp_getAttention().Draw(); + } + + return 1; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -681,42 +473,56 @@ static asm void dScnPly_Draw(dScnPly_c* param_0) { #include "asm/d/s/d_s_play/dScnPly_Draw__FP9dScnPly_c.s" } #pragma pop +#endif /* 802597B8-8025987C 2540F8 00C4+00 1/0 0/0 0/0 .text dScnPly_Execute__FP9dScnPly_c */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void dScnPly_Execute(dScnPly_c* param_0) { - nofralloc -#include "asm/d/s/d_s_play/dScnPly_Execute__FP9dScnPly_c.s" +static int dScnPly_Execute(dScnPly_c* scnPly) { + scnPly->offReset(); + dStage_roomControl_c::offNoChangeRoom(); + dStage_roomControl_c::setRoomReadId(0xFF); + + if (!fopOvlpM_IsPeek()) { + if (mDoAud_zelAudio_c::isBgmSet()) { + mDoAud_sceneBgmStart(); + mDoAud_load2ndDynamicWave(); + mDoAud_zelAudio_c::offBgmSet(); + } + + if (scnPly->calcPauseTimer() != 0) { + return 1; + } + } + + dKy_itudemo_se(); + if (!dComIfGp_isPauseFlag()) { + dDemo_c::update(); + dComIfGp_getEvent().Step(); + dComIfGp_getAttention().Run(); + } + return 1; } -#pragma pop /* 8025987C-802598AC 2541BC 0030+00 1/0 0/0 0/0 .text dScnPly_IsDelete__F9dScnPly_c */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void dScnPly_IsDelete(dScnPly_c param_0) { - nofralloc -#include "asm/d/s/d_s_play/dScnPly_IsDelete__F9dScnPly_c.s" +static int dScnPly_IsDelete(dScnPly_c scnPly) { + dComIfGp_particle_cleanup(); + return 1; } -#pragma pop /* ############################################################################################## */ /* 8039A2DF-8039A2E7 02693F 0008+00 1/0 0/0 0/0 .rodata None */ extern "C" char const* const stringBase_8039A2DF; /* 80450760-80450764 -00001 0004+00 1/0 0/0 0/0 .sdata T_JOINT_resName */ -extern "C" void* T_JOINT_resName; +extern "C" char* T_JOINT_resName; /* 80454F18-80454F1C 003518 0002+02 1/0 0/0 0/0 .sdata2 T_JOINT_dylKeyTbl */ -extern "C" u16 T_JOINT_dylKeyTbl[1 + 1 /* padding */]; +extern "C" u16 T_JOINT_dylKeyTbl; /* 8039A2C8-8039A2D8 -00001 0010+00 4/4 0/0 0/0 .rodata PreLoadInfoT */ SECTION_RODATA static void* const PreLoadInfoT[4] = { (void*)(((char*)&d_s_d_s_play__stringBase0) + 0x7), - (void*)&T_JOINT_dylKeyTbl, - (void*)&T_JOINT_resName, + &T_JOINT_dylKeyTbl, + &T_JOINT_resName, (void*)0x01010000, }; COMPILER_STRIP_GATE(0x8039A2C8, &PreLoadInfoT); @@ -729,16 +535,14 @@ SECTION_DEAD static char const* const stringBase_8039A2DF = "T_JOINT"; #pragma pop /* 80450760-80450764 -00001 0004+00 1/0 0/0 0/0 .sdata T_JOINT_resName */ -SECTION_SDATA static void* T_JOINT_resName = (void*)&d_s_d_s_play__stringBase0; +SECTION_SDATA static char* T_JOINT_resName = "Always"; /* 80450764-80450768 -00001 0004+00 4/4 0/0 0/0 .sdata None */ -SECTION_SDATA static u8 struct_80450764[4] = { +SECTION_SDATA static u8 struct_80450764[2] = { /* 80450764 0001+00 data_80450764 None */ 0xFF, /* 80450765 0003+00 data_80450765 None */ 0x01, - 0x00, - 0x00, }; /* 802598AC-80259AC4 2541EC 0218+00 1/0 0/0 0/0 .text dScnPly_Delete__FP9dScnPly_c */ @@ -751,126 +555,281 @@ static asm void dScnPly_Delete(dScnPly_c* param_0) { } #pragma pop -/* ############################################################################################## */ -/* 8039A2D8-8039A2D8 026938 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -#pragma push -#pragma force_active on -SECTION_DEAD static char const* const stringBase_8039A2E7 = "F_SP109"; -SECTION_DEAD static char const* const stringBase_8039A2EF = "F_SP116"; -#pragma pop - /* 80259AC4-80259BFC 254404 0138+00 1/1 0/0 0/0 .text resetGame__9dScnPly_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void dScnPly_c::resetGame() { - nofralloc -#include "asm/d/s/d_s_play/resetGame__9dScnPly_cFv.s" +bool dScnPly_c::resetGame() { + if (fpcM_GetName(this) == 0xC) { + if (!dStage_roomControl_c::resetArchiveBank(0)) { + return false; + } + + if (!mDoAud_resetRecover()) { + return false; + } + + if (mDoRst::isReset()) { + field_0x1d4 = 1; + } + } else { + if (dComIfGp_getNextStagePoint() == -4 || (dComIfGs_getLastSceneMode() & 0xF) == 0xC || + !strcmp(dComIfGp_getNextStageName(), "F_SP109") || + (!strcmp(dComIfGp_getNextStageName(), "F_SP116") && + dComIfGp_getNextStageRoomNo() == 1 && dComIfGp_getNextStageLayer() == 9)) { + if (!dStage_roomControl_c::resetArchiveBank(0)) { + return false; + } + } + } + + dComIfG_setBrightness(255); + mDoGph_gInf_c::offFade(); + dDlst_list_c::offWipe(); + return true; } -#pragma pop /* 80259BFC-80259C70 25453C 0074+00 1/1 0/0 0/0 .text offReset__9dScnPly_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void dScnPly_c::offReset() { - nofralloc -#include "asm/d/s/d_s_play/offReset__9dScnPly_cFv.s" +void dScnPly_c::offReset() { + if (field_0x1d4 != 0 && !fopOvlpM_IsPeek()) { + mDoRst::offReset(); + mDoRst::offResetPrepare(); + struct_80451501 = false; + JUTGamePad::setResetCallback(mDoRst_resetCallBack, NULL); + field_0x1d4 = 0; + } } -#pragma pop /* 80259C70-80259CAC 2545B0 003C+00 1/0 0/0 0/0 .text phase_00__FP9dScnPly_c */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void phase_00(dScnPly_c* param_0) { - nofralloc -#include "asm/d/s/d_s_play/phase_00__FP9dScnPly_c.s" +static int phase_00(dScnPly_c* scn) { + if (!scn->resetGame()) { + return 0; + } else { + mDoGph_gInf_c::offBlure(); + return 2; + } } -#pragma pop /* 80259CAC-80259D7C 2545EC 00D0+00 1/0 0/0 0/0 .text phase_01__FP9dScnPly_c */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void phase_01(dScnPly_c* param_0) { - nofralloc -#include "asm/d/s/d_s_play/phase_01__FP9dScnPly_c.s" +static int phase_01(dScnPly_c* scn) { + mDoAud_setHour(dKy_getdaytime_hour()); + mDoAud_setMinute(dKy_getdaytime_minute()); + mDoAud_setWeekday(dKy_get_dayofweek()); + + if (dKy_darkworld_check()) { + mDoAud_setInDarkness(true); + } else { + mDoAud_setInDarkness(false); + } + + s8 start_room = dComIfGp_getStartStageRoomNo(); + int layer = dComIfG_play_c::getLayerNo_common(dComIfGp_getStartStageName(), start_room, + dComIfGp_getStartStageLayer()); + + mDoAud_setSceneName(dComIfGp_getStartStageName(), start_room, layer); + + if (!mDoAud_load1stDynamicWave()) { + return 0; + } else { + return 2; + } } -#pragma pop /* 80259D7C-80259D84 2546BC 0008+00 1/0 0/0 0/0 .text phase_0__FP9dScnPly_c */ -static s32 phase_0(dScnPly_c* param_0) { +static int phase_0(dScnPly_c* param_0) { return 2; } -/* ############################################################################################## */ -/* 8039A2D8-8039A2D8 026938 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -#pragma push -#pragma force_active on -SECTION_DEAD static char const* const stringBase_8039A2F7 = "F_SP108"; -SECTION_DEAD static char const* const stringBase_8039A2FF = "F_SP115"; -SECTION_DEAD static char const* const stringBase_8039A307 = "F_SP117"; -SECTION_DEAD static char const* const stringBase_8039A30F = "F_SP104"; -SECTION_DEAD static char const* const stringBase_8039A317 = "D_SB10"; -SECTION_DEAD static char const* const stringBase_8039A31E = "D_MN08D"; -SECTION_DEAD static char const* const stringBase_8039A326 = "R_SP107"; -SECTION_DEAD static char const* const stringBase_8039A32E = "F_SP121"; -SECTION_DEAD static char const* const stringBase_8039A336 = "F_SP127"; -SECTION_DEAD static char const* const stringBase_8039A33E = "Start StageName:RoomNo [%s:%d]\n"; -SECTION_DEAD static char const* const stringBase_8039A35E = "Stg_00"; -#pragma pop - /* 80259D84-8025A438 2546C4 06B4+00 1/0 0/0 0/0 .text phase_1__FP9dScnPly_c */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void phase_1(dScnPly_c* param_0) { - nofralloc -#include "asm/d/s/d_s_play/phase_1__FP9dScnPly_c.s" +static int phase_1(dScnPly_c* scn) { + u32 id = fopScnM_GetID(scn); + dStage_roomControl_c::setProcID(id); + + dComIfGp_setStartStage(dComIfGp_getNextStartStage()); + + if (dComIfGp_getStartStageLayer() < 0 && daPy_py_c::checkRoomRestartStart()) { + const char* stage = dComIfGp_getStartStageName(); + s8 room = dComIfGp_getStartStageRoomNo(); + s8 layer = dComIfGp_getStartStageLayer(); + if (dComIfG_play_c::getLayerNo_common_common(stage, room, layer) < 0) { + dComIfGp_setStartStageLayer(dComIfGp_getLayerOld()); + } + } + dComIfGp_offEnableNextStage(); + + // Stage: Faron Woods, Room: Faron Spring + if (!strcmp(dComIfGp_getStartStageName(), "F_SP108") && dComIfGp_getStartStageRoomNo() == 1 && + dComIfGp_getStartStagePoint() == 3) { + dComIfGs_onDarkClearLV(0); + execItemGet(WEAR_KOKIRI); + } + // Stage: Kakariko Village, Room: Kakariko Village + else if (!strcmp(dComIfGp_getStartStageName(), "F_SP109") && + dComIfGp_getStartStageRoomNo() == 0 && dComIfGp_getStartStagePoint() == 30) { + dComIfGs_onDarkClearLV(1); + } + // Stage: Lake Hylia, Room: Fountain + else if (!strcmp(dComIfGp_getStartStageName(), "F_SP115") && + dComIfGp_getStartStageRoomNo() == 1 && dComIfGp_getStartStagePoint() == 20) { + dComIfGs_onDarkClearLV(2); + } + // Stage: Sacred Grove, Room: Lost Woods + else if (!strcmp(dComIfGp_getStartStageName(), "F_SP117") && + dComIfGp_getStartStageRoomNo() == 1 && dComIfGp_getStartStagePoint() == 99) { + dComIfGs_onDarkClearLV(3); + } + + // Stage: Ordon Spring, Room: Ordon Spring + if (!strcmp(dComIfGp_getStartStageName(), "F_SP104") && dComIfGp_getStartStageRoomNo() == 1 && + dComIfGp_getStartStagePoint() == 23 && dComIfGp_getStartStageLayer() == 12) { + dComIfGs_onItemFirstBit(HORSE_FLUTE); + dComIfGs_setItem(SLOT_21, HORSE_FLUTE); + } + + if ((u8)dKy_darkworld_stage_check(dComIfGp_getStartStageName(), + dComIfGp_getStartStageRoomNo()) == true) { + dComIfGp_world_dark_set(1); + } else if ((u8)dKy_darkworld_spot_check(dComIfGp_getStartStageName(), + dComIfGp_getStartStageRoomNo()) == true) { + dComIfGp_world_dark_set(2); + } else { + dComIfGp_world_dark_set(0); + } + + // Stage: Lake Hylia, Room: Fountain + if (!strcmp(dComIfGp_getStartStageName(), "F_SP115") && dComIfGp_getStartStageRoomNo() == 1 && + dComIfGp_getStartStageLayer() < 0) { + const char* stage = dComIfGp_getStartStageName(); + s8 room = dComIfGp_getStartStageRoomNo(); + s8 layer = dComIfGp_getStartStageLayer(); + if (dComIfG_play_c::getLayerNo_common(stage, room, layer) == 9) { + dComIfGp_setStartStageLayer(9); + } + } + + // Stage: Faron Woods, Room: South Faron + // Stage: Faron Woods Cave + // Stage: Kakariko Village, Room: Kakariko Village + // Stage: Lake Hylia, Room: Fountain + if ((!strcmp(dComIfGp_getStartStageName(), "F_SP108") && dComIfGp_getStartStageRoomNo() == 0 && + dComIfGp_getStartStageLayer() == 7) || + (!strcmp(dComIfGp_getStartStageName(), "D_SB10") && dComIfG_play_c::getLayerNo(0) == 14) || + (!strcmp(dComIfGp_getStartStageName(), "F_SP109") && dComIfGp_getStartStageRoomNo() == 0 && + dComIfGp_getStartStageLayer() == 8) || + (!strcmp(dComIfGp_getStartStageName(), "F_SP115") && dComIfGp_getStartStageRoomNo() == 1 && + dComIfGp_getStartStageLayer() == 8) || + (!strcmp(dComIfGp_getStartStageName(), "F_SP115") && dComIfGp_getStartStageRoomNo() == 1 && + dComIfGp_getStartStageLayer() == 9)) { + dComIfGp_world_dark_set(1); + } + + // Stage: Zant Boss Fight, Room: Throne Room + if (!strcmp(dComIfGp_getStartStageName(), "D_MN08D") && dComIfGp_getStartStageRoomNo() == 50 && + dComIfGp_getStartStagePoint() == 20) { + dComIfGs_onSaveDunSwitch(30); + } + + dKy_darkworld_Area_set(dComIfGp_getStartStageName(), dComIfGp_getStartStageRoomNo()); + + // Stage: Hyrule Castle Sewers, Room: Prison Cell + if (!strcmp(dComIfGp_getStartStageName(), "R_SP107") && dComIfGp_getStartStageRoomNo() == 0 && + (dComIfGp_getStartStagePoint() == 24 || dComIfGp_getStartStagePoint() == 0)) { + dComIfGs_onTransformLV(0); + } + // Stage: Hyrule Field, Room: Eldin Gorge south entrance + else if (!strcmp(dComIfGp_getStartStageName(), "F_SP121") && + dComIfGp_getStartStageRoomNo() == 2 && dComIfGp_getStartStagePoint() == 10) { + dComIfGs_onTransformLV(1); + } + // Stage: Hyrule Field, Room: Lanayru Field north entrance + else if (!strcmp(dComIfGp_getStartStageName(), "F_SP121") && + dComIfGp_getStartStageRoomNo() == 9 && dComIfGp_getStartStagePoint() == 10) { + dComIfGs_onTransformLV(2); + } + // Stage: Hyrule Field, Room: Lanayru Field + else if (!strcmp(dComIfGp_getStartStageName(), "F_SP121") && + dComIfGp_getStartStageRoomNo() == 10 && + (dComIfGp_getStartStagePoint() == 23 || dComIfGp_getStartStagePoint() == 20)) { + dComIfGs_onTransformLV(3); + } + + // Stage: Fishing Pond, Room: Fishing Pond + if (!strcmp(dComIfGp_getStartStageName(), "F_SP127") && dComIfGp_getStartStageRoomNo() == 0 && + dComIfGp_getStartStagePoint() == 2) { + g_env_light.field_0x12fe++; + + if (g_env_light.field_0x12fe > 4) { + g_env_light.field_0x12fe = 1; + } + } + + dComIfGs_BossLife_public_Set(0xFF); + g_env_light.field_0x1308 = 0; + + JUTReportConsole_f("Start StageName:RoomNo [%s:%d]\n", dComIfGp_getStartStageName(), + dComIfGp_getStartStageRoomNo()); + dComIfGp_setStatus(0); + if (dComIfG_syncStageRes("Stg_00") < 0) { + dComIfG_setStageRes("Stg_00", NULL); + } + return 2; } -#pragma pop - -/* ############################################################################################## */ -/* 8039A2D8-8039A2D8 026938 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -#pragma push -#pragma force_active on -SECTION_DEAD static char const* const stringBase_8039A365 = "Event"; -SECTION_DEAD static char const* const stringBase_8039A36B = "/res/Object/"; -SECTION_DEAD static char const* const stringBase_8039A378 = "CamParam"; -/* @stringBase0 padding */ -SECTION_DEAD static char const* const pad_8039A381 = "\0\0\0\0\0\0"; -#pragma pop /* 8025A438-8025A4F8 254D78 00C0+00 1/0 0/0 0/0 .text phase_1_0__FP9dScnPly_c */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void phase_1_0(dScnPly_c* param_0) { - nofralloc -#include "asm/d/s/d_s_play/phase_1_0__FP9dScnPly_c.s" +static int phase_1_0(dScnPly_c* param_0) { + if (dComIfG_syncStageRes("Stg_00")) { + return 0; + } else { + dStage_infoCreate(); + dComIfG_setObjectRes("Event", 0, NULL); + dComIfGp_setCameraParamFileName(0, camparamarc); + dComIfG_setObjectRes("CamParam", 0, NULL); + return 2; + } +} + +inline dStage_stageDt_c* dComIfGp_getStage() { + return &g_dComIfG_gameInfo.play.getStage(); } -#pragma pop /* 8025A4F8-8025A5D4 254E38 00DC+00 1/0 0/0 0/0 .text phase_2__FP9dScnPly_c */ +// extra mr +#ifdef NONMATCHING +static int phase_2(dScnPly_c* scn) { + int tmp = dComIfG_syncAllObjectRes(); + if (tmp >= 0 && tmp != 0) { + return 0; + } + int layer = dComIfG_play_c::getLayerNo(0); + stage_stag_info_class* stag_info = dComIfGp_getStage()->getStagInfo(); + + u8 particle_no = dStage_stagInfo_GetParticleNo(stag_info, layer); + if (particle_no == 255) { + particle_no = dStage_stagInfo_GetParticleNo(dComIfGp_getStage()->getStagInfo()); + } + + dComIfGp_particle_readScene(particle_no, &scn->sceneCommand); + dMsgObject_readMessageGroup(&scn->field_0x1d0); + return 2; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void phase_2(dScnPly_c* param_0) { +static asm int phase_2(dScnPly_c* param_0) { nofralloc #include "asm/d/s/d_s_play/phase_2__FP9dScnPly_c.s" } #pragma pop +#endif /* 8025A5D4-8025A654 254F14 0080+00 1/0 0/0 0/0 .text phase_3__FP9dScnPly_c */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void phase_3(dScnPly_c* param_0) { - nofralloc -#include "asm/d/s/d_s_play/phase_3__FP9dScnPly_c.s" +static int phase_3(dScnPly_c* scn) { + if ((scn->sceneCommand != NULL && !scn->sceneCommand->sync()) || mDoAud_check1stDynamicWave()) { + return 0; + } else if (!scn->field_0x1d0 == NULL && !scn->field_0x1d0->sync()) { + return 0; + } else { + return 2; + } } -#pragma pop /* ############################################################################################## */ /* 80430778-80430784 05D498 000C+00 1/1 0/0 0/0 .bss @4041 */ @@ -936,11 +895,16 @@ static asm void phase_6(dScnPly_c* param_0) { #pragma pop /* 8025AB8C-8025AB94 2554CC 0008+00 1/0 0/0 0/0 .text phase_compleate__FPv */ -static s32 phase_compleate(void* param_0) { +static int phase_compleate(void* param_0) { return 4; } /* 8025AB94-8025ABC4 2554D4 0030+00 1/0 0/0 0/0 .text dScnPly_Create__FP11scene_class */ +#ifdef NONMATCHING +static void dScnPly_Create(scene_class* scn) { + dComLbG_PhaseHandler(&scn->field_0x1c4, l_method[0], scn); +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -949,12 +913,14 @@ static asm void dScnPly_Create(scene_class* param_0) { #include "asm/d/s/d_s_play/dScnPly_Create__FP11scene_class.s" } #pragma pop +#endif /* 8025ABC4-8025AC0C 255504 0048+00 1/0 0/0 0/0 .text __dt__22dScnPly_env_debugHIO_cFv */ #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm dScnPly_env_debugHIO_c::~dScnPly_env_debugHIO_c() { +// asm dScnPly_env_debugHIO_c::~dScnPly_env_debugHIO_c() { +extern "C" asm void __dt__22dScnPly_env_debugHIO_cFv() { nofralloc #include "asm/d/s/d_s_play/__dt__22dScnPly_env_debugHIO_cFv.s" } @@ -964,7 +930,8 @@ asm dScnPly_env_debugHIO_c::~dScnPly_env_debugHIO_c() { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm dScnPly_env_otherHIO_c::~dScnPly_env_otherHIO_c() { +// asm dScnPly_env_otherHIO_c::~dScnPly_env_otherHIO_c() { +extern "C" asm void __dt__22dScnPly_env_otherHIO_cFv() { nofralloc #include "asm/d/s/d_s_play/__dt__22dScnPly_env_otherHIO_cFv.s" } @@ -1014,7 +981,8 @@ REGISTER_CTORS(0x8025AC54, __sinit_d_s_play_cpp); #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm dScnPly_env_HIO_c::~dScnPly_env_HIO_c() { +// asm dScnPly_env_HIO_c::~dScnPly_env_HIO_c() { +extern "C" asm void __dt__17dScnPly_env_HIO_cFv() { nofralloc #include "asm/d/s/d_s_play/__dt__17dScnPly_env_HIO_cFv.s" } @@ -1024,7 +992,8 @@ asm dScnPly_env_HIO_c::~dScnPly_env_HIO_c() { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm dScnPly_reg_HIO_c::~dScnPly_reg_HIO_c() { +// asm dScnPly_reg_HIO_c::~dScnPly_reg_HIO_c() { +extern "C" asm void __dt__17dScnPly_reg_HIO_cFv() { nofralloc #include "asm/d/s/d_s_play/__dt__17dScnPly_reg_HIO_cFv.s" } @@ -1034,7 +1003,8 @@ asm dScnPly_reg_HIO_c::~dScnPly_reg_HIO_c() { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm dScnPly_preLoad_HIO_c::~dScnPly_preLoad_HIO_c() { +// asm dScnPly_preLoad_HIO_c::~dScnPly_preLoad_HIO_c() { +extern "C" asm void __dt__21dScnPly_preLoad_HIO_cFv() { nofralloc #include "asm/d/s/d_s_play/__dt__21dScnPly_preLoad_HIO_cFv.s" } diff --git a/src/d/s/d_s_room.cpp b/src/d/s/d_s_room.cpp index 806bdd0499..d415716ac8 100644 --- a/src/d/s/d_s_room.cpp +++ b/src/d/s/d_s_room.cpp @@ -4,89 +4,27 @@ // #include "d/s/d_s_room.h" +#include "d/com/d_com_inf_game.h" #include "dol2asm.h" #include "dolphin/types.h" +#include "f_op/f_op_scene.h" // // Types: // -struct scene_class {}; - -struct room_of_scene_class {}; - -struct request_of_phase_process_class {}; - -struct mDoRst { - static u8 mResetData[4 + 4 /* padding */]; -}; - -struct layer_class {}; - -struct dSv_zoneBit_c { - /* 80034CEC */ void clearRoomSwitch(); - /* 80034CF8 */ void clearRoomItem(); -}; - -struct dSv_info_c { - /* 800351A4 */ void createZone(int); -}; - -struct dStage_roomControl_c { - /* 80024384 */ void getStatusRoomDt(int); - /* 800243B0 */ void getMemoryBlock(int); - /* 8002490C */ void setArcBank(int, char const*); - /* 80024940 */ void getArcBank(int); - /* 80024954 */ void resetArchiveBank(int); - /* 8002D9B0 */ void getZoneNo(int); - /* 8025BAAC */ void setZoneNo(int, int); - - static u8 mStatus[65792]; - static u8 mDemoArcName[10 + 2 /* padding */]; - static u8 mArcBankName[4]; - static u8 mArcBankData[4]; -}; - -struct dStage_dt_c {}; - -struct dRes_info_c {}; - -struct JKRHeap { - /* 802CE5CC */ void freeAll(); -}; - -struct dRes_control_c { - /* 8003C078 */ void setRes(char const*, dRes_info_c*, int, char const*, u8, JKRHeap*); - /* 8003C160 */ void syncRes(char const*, dRes_info_c*, int); - /* 8003C194 */ void deleteRes(char const*, dRes_info_c*, int); - /* 8003C37C */ void getRes(char const*, char const*, dRes_info_c*, int); - /* 8003C5BC */ void setStageRes(char const*, JKRHeap*); -}; - -struct dPa_control_c { - struct level_c { - /* 8004B8E8 */ void allForceOnEventMove(); - }; -}; - -struct dEvent_manager_c { - /* 80046888 */ void demoInit(); - /* 80046904 */ void roomInit(int); - /* 800469EC */ void roomFinish(int); -}; - -struct dComIfG_play_c { - /* 8002C97C */ void getLayerNo(int); -}; - -struct csXyz {}; - -struct create_tag {}; - -struct cXyz {}; - -struct JKRExpHeap { - /* 802CFD64 */ void getTotalUsedSize() const; +class room_of_scene_class : public process_node_class { +public: + /* 0x1AC */ process_method_class* mpProcessMtd; + /* 0x1B0 */ scene_tag_class* field_0x1b0; + /* 0x1B4 */ u8 field_0x1b4[0x10]; + /* 0x1C4 */ request_of_phase_process_class field_0x1c4; + /* 0x1CC */ void* field_0x1cc; + /* 0x1D0 */ dStage_roomDt_c* field_0x1d0; + /* 0x1D4 */ s8 field_0x1d4; + /* 0x1D5 */ s8 field_0x1d5; + /* 0x1D6 */ u8 field_0x1d6[2]; + /* 0x1D8 */ u8 field_0x1d8; }; // @@ -121,7 +59,6 @@ extern "C" extern void* g_profile_ROOM_SCENE[10]; // External References: // -extern "C" void OSReport_Error(); extern "C" void mDoExt_getArchiveHeap__Fv(); extern "C" void mDoExt_setCurrentHeap__FP7JKRHeap(); extern "C" void fopAc_IsActor__FPv(); @@ -165,17 +102,12 @@ extern "C" void _restgpr_25(); extern "C" void _restgpr_27(); extern "C" void _restgpr_28(); extern "C" void _restgpr_29(); -extern "C" void sprintf(); -extern "C" void strcmp(); extern "C" void strnicmp(); extern "C" extern void* g_fopScn_Method[5 + 1 /* padding */]; extern "C" extern void* g_fpcNd_Method[5 + 1 /* padding */]; extern "C" u8 mStatus__20dStage_roomControl_c[65792]; extern "C" u8 mDemoArcName__20dStage_roomControl_c[10 + 2 /* padding */]; -extern "C" extern u8 g_dComIfG_gameInfo[122384]; extern "C" u8 mResetData__6mDoRst[4 + 4 /* padding */]; -extern "C" extern u8 g_fpcNd_type[4 + 4 /* padding */]; -extern "C" extern u8 struct_80450D64[4]; extern "C" u8 mArcBankName__20dStage_roomControl_c[4]; extern "C" u8 mArcBankData__20dStage_roomControl_c[4]; extern "C" extern u8 struct_80451124[4]; diff --git a/src/d/save/d_save.cpp b/src/d/save/d_save.cpp index 8d93c8b4cd..bef3b669f6 100644 --- a/src/d/save/d_save.cpp +++ b/src/d/save/d_save.cpp @@ -1819,61 +1819,55 @@ SECTION_DEAD static char const* const stringBase_8037926C = "SAVE size:%d\n"; #pragma pop /* 80035798-80035A04 0300D8 026C+00 0/0 1/1 0/0 .text memory_to_card__10dSv_info_cFPci */ -// few wrong instructions, lots of regalloc issues +// lots of regalloc issues #ifdef NONMATCHING -int dSv_info_c::memory_to_card(char* param_0, int param_1) { - BOOL bVar1 = FALSE; - u32 unaff27; - int unaff23; - int unkr27 = 0; +int dSv_info_c::memory_to_card(char* card_ptr, int data_num) { + bool lantern_not_recovered = false; + s32 lantern_stolen; + s32 lantern_dropped; + bool phi_r30 = false; u16 current_lantern_oil = 0; if (!dComIfGs_isEventBit(dSv_event_flag_c::saveBitLabels[226])) { - unaff27 = dComIfGs_isEventBit(dSv_event_flag_c::saveBitLabels[224]); - unaff23 = dComIfGs_isEventBit(dSv_event_flag_c::saveBitLabels[225]); + lantern_stolen = dComIfGs_isEventBit(dSv_event_flag_c::saveBitLabels[224]); + lantern_dropped = dComIfGs_isEventBit(dSv_event_flag_c::saveBitLabels[225]); dComIfGs_offEventBit(dSv_event_flag_c::saveBitLabels[224]); dComIfGs_offEventBit(dSv_event_flag_c::saveBitLabels[225]); - unkr27 = 1; + lantern_not_recovered = true; } - if (dComIfGs_isItemFirstBit(KANTERA) && dComIfGs_getItem(1, 1) == 0xFF) { + if (dComIfGs_isItemFirstBit(KANTERA) && dComIfGs_getItem(SLOT_1, 1) == NO_ITEM) { dComIfGs_setItem(SLOT_1, KANTERA); current_lantern_oil = dComIfGs_getOil(); - u16 oil_gauge_backup = dMeter2Info_getOilGaugeBackUp(); - dComIfGs_setOil(oil_gauge_backup); - bVar1 = TRUE; + dComIfGs_setOil(dMeter2Info_getOilGaugeBackUp()); + phi_r30 = true; } - char* ptr = param_0 + param_1 * 0xa94; + char* save_ptr = card_ptr + (data_num * 0xA94); // 0xA94 = Quest Log size + dSv_save_c* savedata = dComIfGs_getSaveData(); - // weird time stuff going on here. not really sure about any of it - s64 start_time = dComIfGs_getSaveStartTime(); - s64 new_time = OSGetTime() - start_time; - // new_time = 0; - s64 ivar7 = new_time + start_time; + s64 play_time = (OSGetTime() - dComIfGs_getSaveStartTime()); + s64 total_time = (play_time + dComIfGs_getSaveTotalTime()) / (OS_BUS_CLOCK / 4); - s64 total_time = dComIfGs_getSaveTotalTime(); - new_time += total_time; - - if (new_time < start_time) { - g_dComIfG_gameInfo.info.getPlayer().getPlayerInfo().setTotalTime(new_time); + // 3599940 = 999:59 in seconds + if (total_time < 3599940) { + savedata->getPlayer().getPlayerInfo().setTotalTime(total_time); } + savedata->getPlayer().getPlayerStatusB().setDateIpl(OSGetTime()); - s64 tmp = OSGetTime(); - g_dComIfG_gameInfo.info.getPlayer().getPlayerStatusB().setDateIpl(tmp); - memcpy(ptr, &g_dComIfG_gameInfo, sizeof(dSv_save_c)); + memcpy(save_ptr, savedata, sizeof(dSv_save_c)); printf("Write size:%d\n", sizeof(dSv_save_c)); - if ((u8)unkr27 == 1) { - if (unaff27) { + if (lantern_not_recovered == true) { + if (lantern_stolen) { dComIfGs_onEventBit(dSv_event_flag_c::saveBitLabels[224]); } - if ((u8)unaff23 != 0) { + if (lantern_dropped) { dComIfGs_onEventBit(dSv_event_flag_c::saveBitLabels[225]); } } - if (!bVar1) { + if (phi_r30 == true) { dComIfGs_setItem(SLOT_1, NO_ITEM); dComIfGs_setOil(current_lantern_oil); } @@ -1900,29 +1894,24 @@ SECTION_DEAD static char const* const stringBase_8037927A = "LOAD size:%d\n"; #pragma pop /* 80035A04-80035BD0 030344 01CC+00 0/0 2/2 0/0 .text card_to_memory__10dSv_info_cFPci */ -// close, some instructions out of order / regalloc +// memcpy param loads out of order #ifdef NONMATCHING int dSv_info_c::card_to_memory(char* param_0, int param_1) { - char* ptr = param_0 + param_1 * 0xa94; - dSv_save_c* tmp = &g_dComIfG_gameInfo.info.getSavedata(); - memcpy(tmp, ptr, sizeof(dSv_save_c)); + memcpy(dComIfGs_getSaveData(), param_0 + param_1 * 0xa94, sizeof(dSv_save_c)); - if (!OSGetSoundMode()) { + if (OSGetSoundMode() == SOUND_MODE_MONO) { g_dComIfG_gameInfo.info.getPlayer().getConfig().setSound(SOUND_MODE_MONO); Z2AudioMgr::mAudioMgrPtr->setOutputMode(SOUND_MODE_MONO); + } else if (g_dComIfG_gameInfo.info.getPlayer().getConfig().getSound() == 2) { + Z2AudioMgr::mAudioMgrPtr->setOutputMode(2); } else { - u8 save_sound = g_dComIfG_gameInfo.info.getPlayer().getConfig().getSound(); - - if (save_sound == 2) { - Z2AudioMgr::mAudioMgrPtr->setOutputMode(2); - } else { - g_dComIfG_gameInfo.info.getPlayer().getConfig().setSound(SOUND_MODE_STEREO); - Z2AudioMgr::mAudioMgrPtr->setOutputMode(SOUND_MODE_STEREO); - } + g_dComIfG_gameInfo.info.getPlayer().getConfig().setSound(SOUND_MODE_STEREO); + Z2AudioMgr::mAudioMgrPtr->setOutputMode(SOUND_MODE_STEREO); } - if (dComIfGs_getSaveData().getPlayer().getPlayerStatusA().getLife() < 12) { - dComIfGs_setLife(12); + dSv_save_c* savedata = dComIfGs_getSaveData(); + if (savedata->getPlayer().getPlayerStatusA().getLife() < 12) { + savedata->getPlayer().getPlayerStatusA().setLife(12); } dComIfGs_setKeyNum(6, 0); @@ -1932,16 +1921,16 @@ int dSv_info_c::card_to_memory(char* param_0, int param_1) { dComIfGs_setItem(SLOT_9, NO_ITEM); } - if (dComIfGs_getItem(SLOT_9, 1) == HOOKSHOT && dComIfGs_getItem(SLOT_9, 1) == W_HOOKSHOT) { + if (dComIfGs_getItem(SLOT_9, 1) == HOOKSHOT && dComIfGs_getItem(SLOT_10, 1) == W_HOOKSHOT) { dComIfGs_setItem(SLOT_9, NO_ITEM); } dComIfGs_setLineUpItem(); - u8 save_vibration = dComIfGs_getSaveData().getPlayer().getConfig().getVibration(); + u8 save_vibration = savedata->getPlayer().getConfig().getVibration(); dComIfGp_setNowVibration(save_vibration); - char* save_stage = dComIfGs_getSaveData().getPlayer().getPlayerReturnPlace().getName(); + char* save_stage = g_dComIfG_gameInfo.info.getPlayer().getPlayerReturnPlace().getName(); dMeter2Info_setSaveStageName(save_stage); printf("LOAD size:%d\n", sizeof(dSv_save_c)); diff --git a/src/f_op/f_op_msg.cpp b/src/f_op/f_op_msg.cpp index bffbb68b3d..c80912ee98 100644 --- a/src/f_op/f_op_msg.cpp +++ b/src/f_op/f_op_msg.cpp @@ -8,18 +8,6 @@ #include "dolphin/types.h" // -// Types: -// - -struct process_method_class {}; - -struct leafdraw_method_class {}; - -struct leafdraw_class {}; - -struct create_tag_class {}; - -// // Forward References: // @@ -28,7 +16,6 @@ extern "C" static void fopMsg_Execute__FPv(); extern "C" static void fopMsg_IsDelete__FPv(); extern "C" static void fopMsg_Delete__FPv(); extern "C" static void fopMsg_Create__FPv(); -extern "C" extern void* g_fopMsg_Method[5 + 1 /* padding */]; // // External References: @@ -55,7 +42,7 @@ extern "C" extern u8 struct_80451124[4]; #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void fopMsg_Draw(void* param_0) { +static asm int fopMsg_Draw(void* param_0) { nofralloc #include "asm/f_op/f_op_msg/fopMsg_Draw__FPv.s" } @@ -65,7 +52,7 @@ static asm void fopMsg_Draw(void* param_0) { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void fopMsg_Execute(void* param_0) { +static asm int fopMsg_Execute(void* param_0) { nofralloc #include "asm/f_op/f_op_msg/fopMsg_Execute__FPv.s" } @@ -75,7 +62,7 @@ static asm void fopMsg_Execute(void* param_0) { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void fopMsg_IsDelete(void* param_0) { +static asm int fopMsg_IsDelete(void* param_0) { nofralloc #include "asm/f_op/f_op_msg/fopMsg_IsDelete__FPv.s" } @@ -85,7 +72,7 @@ static asm void fopMsg_IsDelete(void* param_0) { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void fopMsg_Delete(void* param_0) { +static asm int fopMsg_Delete(void* param_0) { nofralloc #include "asm/f_op/f_op_msg/fopMsg_Delete__FPv.s" } @@ -99,7 +86,7 @@ static u8 fopMsg_MSG_TYPE[4 + 4 /* padding */]; #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void fopMsg_Create(void* param_0) { +static asm int fopMsg_Create(void* param_0) { nofralloc #include "asm/f_op/f_op_msg/fopMsg_Create__FPv.s" } @@ -107,12 +94,6 @@ static asm void fopMsg_Create(void* param_0) { /* ############################################################################################## */ /* 803A3958-803A3970 -00001 0014+04 0/0 5/0 0/0 .data g_fopMsg_Method */ -SECTION_DATA extern void* g_fopMsg_Method[5 + 1 /* padding */] = { - (void*)fopMsg_Create__FPv, - (void*)fopMsg_Delete__FPv, - (void*)fopMsg_Execute__FPv, - (void*)fopMsg_IsDelete__FPv, - (void*)fopMsg_Draw__FPv, - /* padding */ - NULL, +SECTION_DATA extern leafdraw_method_class g_fopMsg_Method = { + &fopMsg_Create, &fopMsg_Delete, &fopMsg_Execute, &fopMsg_IsDelete, &fopMsg_Draw, }; diff --git a/src/f_op/f_op_msg_mng.cpp b/src/f_op/f_op_msg_mng.cpp index 9bed0c4814..2450e5d4a6 100644 --- a/src/f_op/f_op_msg_mng.cpp +++ b/src/f_op/f_op_msg_mng.cpp @@ -3,7 +3,7 @@ // Translation Unit: f_op/f_op_msg_mng // -// #include "f_op/f_op_msg_mng.h" +#include "f_op/f_op_msg_mng.h" #include "JSystem/J2DGraph/J2DPane.h" #include "dol2asm.h" #include "dolphin/types.h" @@ -12,12 +12,6 @@ // Types: // -struct process_priority_class {}; - -struct layer_class {}; - -struct fopAc_ac_c {}; - struct dStage_roomControl_c { static u8 mProcID[4]; }; @@ -48,10 +42,6 @@ struct JMath { static u8 sincosTable_[65536]; }; -struct JKRExpHeap { - /* 802CEE2C */ void create(u32, JKRHeap*, bool); -}; - struct J2DPicture { /* 800202CC */ void setBlendRatio(f32, f32); /* 80020338 */ void append(char const*, f32); @@ -283,7 +273,7 @@ asm void fopMsgM_setMessageID(unsigned int param_0) { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void fopMsgM_Create(s16 param_0, int (*param_1)(void*), void* param_2) { +asm u32 fopMsgM_Create(s16 param_0, int (*param_1)(void*), void* param_2) { nofralloc #include "asm/f_op/f_op_msg_mng/fopMsgM_Create__FsPFPv_iPv.s" } diff --git a/src/f_op/f_op_scene_pause.cpp b/src/f_op/f_op_scene_pause.cpp index 05770967b0..fac70803aa 100644 --- a/src/f_op/f_op_scene_pause.cpp +++ b/src/f_op/f_op_scene_pause.cpp @@ -27,7 +27,7 @@ int fopScnPause_Enable(scene_class* pScene) { /* 80020594-8002064C 01AED4 00B8+00 0/0 2/2 0/0 .text fopScnPause_Disable__FP11scene_class */ int fopScnPause_Disable(scene_class* pScene) { if (pScene) { - void* tmp = (void*)pScene->field_0x2C[6]; + void* tmp = (void*)pScene->field_0x0.mLyTg.mpLayer->mpPcNode; if (!tmp) { fpcM_PauseDisable(pScene, 1); diff --git a/src/f_op/f_op_scene_req.cpp b/src/f_op/f_op_scene_req.cpp index cb93c14a8f..c6c7f51a59 100644 --- a/src/f_op/f_op_scene_req.cpp +++ b/src/f_op/f_op_scene_req.cpp @@ -78,7 +78,7 @@ static void fopScnRq_Execute(scene_request_class* pScnRq) { static int fopScnRq_PostMethod(void* param_1, scene_request_class* pScnRq) { if (pScnRq->mFadeRequest) { fopScnPause_Enable((scene_class*)param_1); - fopOvlpM_ToldAboutID(((scene_class*)param_1)->field_0x04); + fopOvlpM_ToldAboutID(((scene_class*)param_1)->field_0x0.mBsPcId); } return 1; } diff --git a/src/f_pc/f_pc_base.cpp b/src/f_pc/f_pc_base.cpp index 7bc7002516..c259ab51f9 100644 --- a/src/f_pc/f_pc_base.cpp +++ b/src/f_pc/f_pc_base.cpp @@ -85,7 +85,7 @@ base_process_class* fpcBs_Create(s16 pProcTypeID, unsigned int pProcID, void* pD base_process_class* procClass; u32 size; - procProfDef = fpcPf_Get(pProcTypeID); + procProfDef = (process_profile_definition*)fpcPf_Get(pProcTypeID); size = procProfDef->mSize + procProfDef->mSizeOther; procClass = (base_process_class*)cMl::memalignB(-4, size); if (procClass == NULL) { diff --git a/src/f_pc/f_pc_priority.cpp b/src/f_pc/f_pc_priority.cpp index 644cf19999..1ae9e4492d 100644 --- a/src/f_pc/f_pc_priority.cpp +++ b/src/f_pc/f_pc_priority.cpp @@ -179,6 +179,4 @@ s32 fpcPi_Init(process_priority_class* pPi, void* pUserData, unsigned int layer, /* ############################################################################################## */ /* 804505F0-804505F8 0008+00 s=0 e=5 z=1 None .sdata None */ -SECTION_SDATA u8 data_804505F0[8] = { - 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; +SECTION_SDATA s8 data_804505F0 = 0xFF; diff --git a/src/f_pc/f_pc_profile.cpp b/src/f_pc/f_pc_profile.cpp index 6f4ecd45fa..453d34ae45 100644 --- a/src/f_pc/f_pc_profile.cpp +++ b/src/f_pc/f_pc_profile.cpp @@ -9,9 +9,9 @@ /* ############################################################################################## */ /* 80450D50-80450D58 0004+04 s=1 e=0 z=2 None .sbss g_fpcPf_ProfileList_p */ -process_profile_definition** g_fpcPf_ProfileList_p; +leaf_process_profile_definition** g_fpcPf_ProfileList_p; /* 80023564-80023578 0014+00 s=0 e=1 z=0 None .text fpcPf_Get__Fs */ -process_profile_definition* fpcPf_Get(s16 profileID) { +leaf_process_profile_definition* fpcPf_Get(s16 profileID) { return g_fpcPf_ProfileList_p[profileID]; } diff --git a/src/m_Do/m_Do_graphic.cpp b/src/m_Do/m_Do_graphic.cpp index 36d0be5ede..123db56641 100644 --- a/src/m_Do/m_Do_graphic.cpp +++ b/src/m_Do/m_Do_graphic.cpp @@ -237,7 +237,7 @@ u8 struct_80450BE4; #pragma force_active on static bool data_80450BE5; -static u8 data_80450BE6; +u8 data_80450BE6; static bool data_80450BE7; #pragma pop |
