Files
tp/src/d/s/d_s_name.cpp
T
hatal175 2e6e468928 Work on d_resorce, d_vibration, d_tresure and others (#347)
* Work on d_resorce

* Work on d_a_tag_TWgate

* Work on d_meter_map

* d_tresure OK

* Work on d_vibration

* Work on d_a_npc

* Work on d_a_npc

* Work on d_a_npc
2023-06-19 14:39:09 -06:00

416 lines
12 KiB
C++

//
// Generated By: dol2asm
// Translation Unit: d/s/d_s_name
//
#include "d/s/d_s_name.h"
#include "JSystem/JKernel/JKRExpHeap.h"
#include "d/com/d_com_inf_game.h"
#include "d/d_procname.h"
#include "d/meter/d_meter2_info.h"
#include "dolphin/types.h"
#include "f_op/f_op_overlap_mng.h"
#include "f_op/f_op_scene_mng.h"
#include "f_pc/f_pc_manager.h"
#include "global.h"
#include "m_Do/m_Do_Reset.h"
#include "m_Do/m_Do_audio.h"
#include "m_Do/m_Do_graphic.h"
#include "m_Do/m_Do_machine.h"
#include "m_Do/m_Do_mtx.h"
//
// Types:
//
class dSn_HIO_c {
public:
/* 8025878C */ dSn_HIO_c();
/* 802592DC */ virtual ~dSn_HIO_c() {}
/* 0x4 */ s8 field_0x4;
/* 0x5 */ u8 mFileSelWaitTime;
};
// TODO: Remove when dFile_select_c virtual functions are properly defined in header
class dFile_select_c {
public:
/* 8018366C */ dFile_select_c(JKRArchive*);
/* 8018375C */ virtual ~dFile_select_c();
/* 801843CC */ void _create();
/* 801844FC */ void _move();
/* 8018DD38 */ void _draw();
bool getFadeFlag() { return mFadeFlag; }
int isDataNew(u8 i) { return mDataNew[i]; }
int isSelectEnd() { return mSelectEnd; }
u8 getSelectNum() { return mSelectNum; }
void setUseType(u8 type) { mUseType = type; }
private:
u8 field_0x4[0x254];
/* 0x0258 */ u8 mDataNew[3];
/* 0x025B */ u8 field_0x25b[0x265 - 0x25b];
/* 0x0265 */ u8 mSelectNum;
/* 0x0266 */ u8 field_0x266[0x270 - 0x266];
/* 0x0270 */ bool mSelectEnd;
/* 0x0271 */ u8 field_0x271[0x3b0 - 0x271];
/* 0x03B0 */ u8 mUseType;
/* 0x03B1 */ u8 field_0x3b1[0x2374 - 0x3b1];
/* 0x2374 */ bool mFadeFlag;
/* 0x2375 */ u8 field_0x2375[0x237c - 0x2375];
};
// TODO: Remove when dBrightCheck_c virtual functions are properly defined in header
class dBrightCheck_c {
public:
/* 80192F10 */ dBrightCheck_c(JKRArchive*);
/* 80192F98 */ virtual ~dBrightCheck_c();
/* 801934D0 */ void _move();
/* 80193594 */ void _draw();
bool isEnd() { return mEnd; }
u8 field_0x4[0x15];
/* 0x19 */ bool mEnd;
};
//
// Forward References:
//
//
// Declarations:
//
/* ############################################################################################## */
/* 803C3040-803C304C 020160 000C+00 1/1 0/0 0/0 .data cNullVec__6Z2Calc */
static u8 cNullVec__6Z2Calc[12] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
/* 804510F0-804510F8 0005F0 0008+00 2/2 0/0 0/0 .sbss g_snHIO */
static dSn_HIO_c g_snHIO;
/* 803C3094-803C30DC 0201B4 0048+00 1/2 0/0 0/0 .data MainProc */
typedef void (dScnName_c::*mainProcFunc)(void);
static mainProcFunc MainProc[6] = {
&dScnName_c::FileSelectOpen, &dScnName_c::FileSelectMain, &dScnName_c::FileSelectClose,
&dScnName_c::brightCheckOpen, &dScnName_c::brightCheck, &dScnName_c::changeGameScene,
};
/* 8025878C-802587A4 2530CC 0018+00 1/1 0/0 0/0 .text __ct__9dSn_HIO_cFv */
dSn_HIO_c::dSn_HIO_c() {
mFileSelWaitTime = 15;
}
/* 802587A4-80258820 2530E4 007C+00 1/0 0/0 0/0 .text phase_1__FPc */
static s32 phase_1(char* resName) {
mDoAud_bgmStart(-1);
if (dComIfG_setObjectRes(resName, (u8)0, NULL) == 0) {
return 5;
}
return 2;
}
/* 80258820-80258878 253160 0058+00 1/0 0/0 0/0 .text phase_2__FPc */
static s32 phase_2(char* resName) {
int syncStatus = dComIfG_syncObjectRes(resName);
if (syncStatus < 0) {
return 5;
} else {
return syncStatus > 0 ? 0 : 4;
}
}
/* 80258878-802588A0 2531B8 0028+00 1/1 0/0 0/0 .text
* resLoad__FP30request_of_phase_process_classPc */
static s32 resLoad(request_of_phase_process_class* i_phase, char* param_1) {
static s32 (*l_method[2])(char*) = {phase_1, phase_2};
return dComLbG_PhaseHandler(i_phase, (request_of_phase_process_fn)l_method, param_1);
}
/* ############################################################################################## */
s32 dScnName_c::create() {
int phase_state = resLoad(&field_0x1c4, "fileSel");
if (phase_state == cPhs_COMPLEATE_e) {
mHeap = JKRExpHeap::create(0x180000, mDoExt_getGameHeap(), false);
field_0x1d0 = (JKRExpHeap*)mDoExt_setCurrentHeap(mHeap);
dRes_info_c* res = dComIfG_getObjectResInfo("fileSel");
dFs_c = new dFile_select_c(res->getArchive());
dFs_c->_create();
if (fpcM_GetName(this) == PROC_NAME_SCENE) {
dFs_c->setUseType(0);
dComIfGs_setNoFile(0);
}
mBrightCheck = new dBrightCheck_c(res->getArchive());
field_0x420 = 0;
g_snHIO.field_0x4 = -1;
field_0x1d0->becomeCurrentHeap();
dComIfGp_setWindowNum(1);
dComIfGp_setWindow(0, 0.0f, 0.0f, mDoMch_render_c::getFbWidth(),
mDoMch_render_c::getEfbHeight(), 0.0f, 1.0f, 0, 2);
dDlst_window_c* window = dComIfGp_getWindow(0);
dComIfGp_setCamera(0, (camera_class*)&mCamera);
mCamera.mNear = 1.0f;
mCamera.mFar = 100000.0f;
mCamera.mFovy = 45.0f;
mCamera.mAspect = mDoGph_gInf_c::getWidthF() / mDoGph_gInf_c::getHeightF();
mCamera.mLookat.mEye.set(0.0f, 0.0f, -1000.0f);
mCamera.mLookat.mCenter.set(0.0f, 0.0f, 0.0f);
mCamera.mBank = 0;
dComIfGp_setPlayer(0, NULL);
dComIfGd_setWindow(window);
dComIfGd_setViewport(window->getViewPort());
dComIfGd_setView(&mCamera);
mDoGph_gInf_c::offAutoForcus();
setView();
dKy_setLight_init();
field_0x41e = g_snHIO.mFileSelWaitTime;
field_0x41c = 0;
field_0x41d = 0;
mDoGph_gInf_c::setTickRate((OS_BUS_CLOCK / 4) / 30);
dComIfGp_getVibration().Init();
}
return phase_state;
}
/* 80258B2C-80258BC8 25346C 009C+00 1/1 0/0 0/0 .text setView__10dScnName_cFv */
void dScnName_c::setView() {
C_MTXPerspective(mCamera.mProjMtx, mCamera.mFovy, mCamera.mAspect, mCamera.mNear,
mCamera.mFar);
mDoMtx_lookAt(mCamera.mViewMtx, &mCamera.mLookat.mEye, &mCamera.mLookat.mCenter,
mCamera.mBank);
PSMTXInverse(mCamera.mViewMtx, mCamera.mInvViewMtx);
PSMTXCopy(mCamera.mViewMtx, mCamera.mViewMtxNoTrans);
mCamera.mViewMtxNoTrans[0][3] = 0.0f;
mCamera.mViewMtxNoTrans[1][3] = 0.0f;
mCamera.mViewMtxNoTrans[2][3] = 0.0f;
PSMTXCopy(mCamera.mViewMtx, j3dSys.mViewMtx);
mDoMtx_concatProjView(mCamera.mProjMtx, mCamera.mViewMtx, mCamera.mProjViewMtx);
}
/* 80258BC8-80258C5C 253508 0094+00 1/1 0/0 0/0 .text execute__10dScnName_cFv */
s32 dScnName_c::execute() {
if (fopOvlpM_IsPeek() == 0) {
dComIfG_resetToOpening(this);
}
if (mDoRst::isReset() && field_0x420 == 0 && !dFs_c->getFadeFlag()) {
return 1;
}
(this->*MainProc[field_0x41d])();
return 1;
}
/* 80258C5C-80258CC8 25359C 006C+00 1/1 0/0 0/0 .text draw__10dScnName_cFv */
s32 dScnName_c::draw() {
dComIfGp_getVibration().Run();
switch (field_0x41c) {
case 0:
dFs_c->_draw();
break;
case 1:
mBrightCheck->_draw();
break;
}
return 1;
}
/* 80258CC8-80258DD0 253608 0108+00 1/1 0/0 0/0 .text __dt__10dScnName_cFv */
dScnName_c::~dScnName_c() {
delete dFs_c;
delete mBrightCheck;
dComIfG_deleteObjectResMain("fileSel");
mHeap->destroy();
for (int i = 0; i < 4; i++) {
dMeter2Info_changeWater(i + SLOT_11);
}
dComIfGp_setWindowNum(0);
dComIfGd_setView(NULL);
}
/* 80258DD0-80258E34 253710 0064+00 1/0 0/0 0/0 .text FileSelectOpen__10dScnName_cFv */
void dScnName_c::FileSelectOpen() {
if (field_0x41e != 0) {
field_0x41e--;
} else {
mDoAud_bgmStreamPrepare(0x2000000);
mDoAud_bgmStreamPlay();
field_0x41d = 1;
}
}
/* 80258E34-80258E78 253774 0044+00 1/0 0/0 0/0 .text FileSelectMain__10dScnName_cFv */
void dScnName_c::FileSelectMain() {
dFs_c->_move();
if (fpcM_GetName(this) == PROC_NAME_SCENE) {
FileSelectMainNormal();
}
}
/* 80258E78-80258F20 2537B8 00A8+00 1/1 0/0 0/0 .text FileSelectMainNormal__10dScnName_cFv */
void dScnName_c::FileSelectMainNormal() {
switch(dFs_c->isSelectEnd()) {
case 1:
field_0x41e = 15;
mDoGph_gInf_c::setFadeColor(*(JUtility::TColor*)&g_blackColor);
mDoGph_gInf_c::startFadeOut(15);
field_0x41d = 2;
field_0x420 = 1;
break;
}
}
/* 80258F20-80258FD4 253860 00B4+00 1/0 0/0 0/0 .text FileSelectClose__10dScnName_cFv */
void dScnName_c::FileSelectClose() {
field_0x41e--;
if (field_0x41e == 0) {
field_0x41d = 3;
field_0x41e = 15;
field_0x41c = 1;
mDoGph_gInf_c::setFadeColor(*(JUtility::TColor*)&g_blackColor);
mDoGph_gInf_c::startFadeIn(15);
field_0x420 = 0;
}
}
/* 80258FD4-80259008 253914 0034+00 1/0 0/0 0/0 .text brightCheckOpen__10dScnName_cFv */
void dScnName_c::brightCheckOpen() {
if (!mDoRst::isReset()) {
field_0x41e--;
if (field_0x41e == 0) {
field_0x41d = 4;
}
}
}
/* 80259008-802590F8 253948 00F0+00 1/0 0/0 0/0 .text brightCheck__10dScnName_cFv */
void dScnName_c::brightCheck() {
mBrightCheck->_move();
if (mBrightCheck->isEnd()) {
dComIfGs_setSaveTotalTime(dComIfGs_getTotalTime());
dComIfGs_setSaveStartTime(OSGetTime());
mDoAud_bgmStop(0x2D);
field_0x41f = 0;
field_0x41d = 5;
dComIfGs_offItemFirstBit(GREEN_RUPEE);
dComIfGs_offItemFirstBit(BLUE_RUPEE);
dComIfGs_offItemFirstBit(YELLOW_RUPEE);
dComIfGs_offItemFirstBit(RED_RUPEE);
dComIfGs_offItemFirstBit(PURPLE_RUPEE);
dComIfGs_offItemFirstBit(ORANGE_RUPEE);
dComIfGs_offItemFirstBit(SILVER_RUPEE);
}
}
/* ############################################################################################## */
/* 802590F8-802591C0 253A38 00C8+00 1/0 0/0 0/0 .text changeGameScene__10dScnName_cFv */
void dScnName_c::changeGameScene() {
if (!mDoRst::isReset() && !fopOvlpM_IsPeek()) {
dComIfGs_gameStart();
fopScnM_ChangeReq(this, field_0x41f == 0 ? PROC_PLAY_SCENE : PROC_PLAY_SCENE, 0, 5);
dComIfGp_offEnableNextStage();
if (dFs_c->isDataNew(dFs_c->getSelectNum())) {
dComIfGp_setNextStage("F_SP108", 21, 1, 13);
}
dKy_clear_game_init();
dComIfGs_resetDan();
dComIfGs_setRestartRoomParam(0);
}
}
/* 802591C0-802591E0 253B00 0020+00 1/0 0/0 0/0 .text dScnName_Draw__FP10dScnName_c */
static void dScnName_Draw(dScnName_c* scn) {
scn->draw();
}
/* 802591E0-80259200 253B20 0020+00 1/0 0/0 0/0 .text dScnName_Execute__FP10dScnName_c */
static void dScnName_Execute(dScnName_c* scn) {
scn->execute();
}
/* 80259200-80259230 253B40 0030+00 1/0 0/0 0/0 .text dScnName_IsDelete__FP10dScnName_c
*/
static s32 dScnName_IsDelete(dScnName_c*) {
dComIfGp_particle_cleanup();
return 1;
}
/* 80259230-80259258 253B70 0028+00 1/0 0/0 0/0 .text dScnName_Delete__FP10dScnName_c */
static s32 dScnName_Delete(dScnName_c* scn) {
scn->~dScnName_c();
return 1;
}
/* 80259258-80259294 253B98 003C+00 1/0 0/0 0/0 .text dScnName_Create__FP11scene_class */
static void dScnName_Create(scene_class* scn) {
new (scn) dScnName_c();
static_cast<dScnName_c*>(scn)->create();
}
/* 8039A2A8-8039A2A8 026908 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */
/* 803C30DC-803C30F0 -00001 0014+00 2/0 0/0 0/0 .data l_dScnName_Method */
static leafdraw_method_class l_dScnName_Method = {
(process_method_func)dScnName_Create, (process_method_func)dScnName_Delete,
(process_method_func)dScnName_Execute, (process_method_func)dScnName_IsDelete,
(process_method_func)dScnName_Draw,
};
/* 803C30F0-803C3118 -00001 0028+00 0/0 0/0 1/0 .data g_profile_NAME_SCENE */
extern scene_process_profile_definition g_profile_NAME_SCENE = {
0,
1,
-3,
PROC_NAME_SCENE,
&g_fpcNd_Method.mBase,
sizeof(dScnName_c),
0,
0,
&g_fopScn_Method.mBase,
(process_method_class*)&l_dScnName_Method,
NULL,
};
/* 803C3118-803C3140 -00001 0028+00 0/0 0/0 1/0 .data g_profile_NAMEEX_SCENE */
extern scene_process_profile_definition g_profile_NAMEEX_SCENE = {
0,
1,
-3,
PROC_NAMEEX_SCENE,
&g_fpcNd_Method.mBase,
sizeof(dScnName_c),
0,
0,
&g_fopScn_Method.mBase,
(process_method_class*)&l_dScnName_Method,
NULL,
};