summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJasper St. Pierre <jstpierre@mecheye.net>2023-12-03 19:04:54 -0800
committerGitHub <noreply@github.com>2023-12-03 19:04:54 -0800
commita4f5a3a6917e82dd5664ee13cfa140d574aee46a (patch)
tree5beee5afe6c6bd7ef15aa55a02f3ebb9afcd4d0d /src
parent650fc00522a3b37baafd7afe066bdd3136220ba3 (diff)
parent2e3e51b80cd06143edb0b69c461b7342b5d4a916 (diff)
Merge pull request #546 from SuperDude88/ghostship
d_a_ghostship Mostly Done
Diffstat (limited to 'src')
-rw-r--r--src/d/actor/d_a_ghostship.cpp453
-rw-r--r--src/d/actor/d_a_tag_ghostship.cpp202
-rw-r--r--src/d/d_kankyo.cpp2
3 files changed, 554 insertions, 103 deletions
diff --git a/src/d/actor/d_a_ghostship.cpp b/src/d/actor/d_a_ghostship.cpp
index c50981df..cb41b1a2 100644
--- a/src/d/actor/d_a_ghostship.cpp
+++ b/src/d/actor/d_a_ghostship.cpp
@@ -4,115 +4,464 @@
//
#include "d/actor/d_a_ghostship.h"
-#include "dolphin/types.h"
+#include "JSystem/JKernel/JKRHeap.h"
+#include "SSystem/SComponent/c_math.h"
+#include "m_Do/m_Do_mtx.h"
+#include "d/d_procname.h"
+#include "d/d_com_inf_game.h"
+#include "d/d_s_play.h"
+#include "d/d_kankyo_wether.h"
-/* 000000EC-000000F8 .text daGhostship_SailVtxFactorCB__FP15dCloth_packet_cii */
-void daGhostship_SailVtxFactorCB(dCloth_packet_c*, int, int) {
- /* Nonmatching */
+// Needed for .data to match.
+static f32 dummy1[3] = {1.0f, 1.0f, 1.0f};
+static f32 dummy2[3] = {1.0f, 1.0f, 1.0f};
+static u8 dummy3[4] = {0x02, 0x00, 0x02, 0x01};
+static f64 dummy4[2] = {3.0, 0.5};
+
+const u32 daGhostship_c::m_heapsize = 0x1EA0;
+const char daGhostship_c::m_arc_name[] = "Ayush";
+const char daGhostship_c::m_cloth_arc_name[] = "Cloth";
+
+static daGhostship_HIO_c l_HIO;
+
+/* 000000EC-000000F8 .text daGhostship_SailVtxFactorCB__FP15dCloth_packet_cii */
+static int daGhostship_SailVtxFactorCB(dCloth_packet_c*, int, int param_3) {
+ return param_3 ? 0 : 1;
}
-/* 000000F8-00000118 .text createHeap_CB__FP10fopAc_ac_c */
-static BOOL createHeap_CB(fopAc_ac_c*) {
- /* Nonmatching */
+/* 000000F8-00000118 .text createHeap_CB__FP10fopAc_ac_c */
+static BOOL createHeap_CB(fopAc_ac_c* i_this) {
+ return static_cast<daGhostship_c*>(i_this)->_createHeap();
}
-/* 00000118-0000032C .text _createHeap__13daGhostship_cFv */
-void daGhostship_c::_createHeap() {
- /* Nonmatching */
+/* 00000118-0000032C .text _createHeap__13daGhostship_cFv */
+BOOL daGhostship_c::_createHeap() {
+ J3DModelData* modelData = static_cast<J3DModelData*>(dComIfG_getObjectRes(m_arc_name, 5));
+ JUT_ASSERT(88, modelData != 0);
+
+ mpModel = mDoExt_J3DModel__create(modelData, 0, 0x11020203);
+ if(!mpModel) {
+ return false;
+ }
+
+ J3DAnmTextureSRTKey* btk = static_cast<J3DAnmTextureSRTKey*>(dComIfG_getObjectRes(m_arc_name, 8));
+ JUT_ASSERT(95, btk != 0);
+
+ if(!mBtk.init(modelData, btk, true, J3DFrameCtrl::LOOP_REPEAT_e, 1.0f, 0, -1, false, 0)) {
+ return false;
+ }
+
+ ResTIMG* res1 = static_cast<ResTIMG*>(dComIfG_getObjectRes(m_arc_name, 0xB));
+ ResTIMG* res2 = static_cast<ResTIMG*>(dComIfG_getObjectRes(m_arc_name, 0xC));
+ ResTIMG* res3 = static_cast<ResTIMG*>(dComIfG_getObjectRes(m_cloth_arc_name, 0x3));
+
+ mpCloth = dCloth_packetXlu_create(res1, res3, 5, 5, 700.0f, 350.0f, &mTevStr, 0);
+ mpCloth2 = dCloth_packetXlu_create(res2, res3, 6, 6, 1800.0f, 1000.0f, &mTevStr, 0);
+ if(!mpCloth || !mpCloth2) {
+ return false;
+ }
+
+ mpCloth2->setFactorCheckCB(&daGhostship_SailVtxFactorCB);
+
+ return true;
}
-/* 0000032C-00000368 .text pathMove_CB__FP4cXyzP4cXyzP4cXyzPv */
-void pathMove_CB(cXyz*, cXyz*, cXyz*, void*) {
- /* Nonmatching */
+/* 0000032C-00000368 .text pathMove_CB__FP4cXyzP4cXyzP4cXyzPv */
+static int pathMove_CB(cXyz* curPos, cXyz* curPntPos, cXyz* nextPntPos, void* i_this) {
+ static_cast<daGhostship_c*>(i_this)->_pathMove(curPos, curPntPos, nextPntPos);
}
-/* 00000368-000003B8 .text __ct__17daGhostship_HIO_cFv */
+/* 00000368-000003B8 .text __ct__17daGhostship_HIO_cFv */
daGhostship_HIO_c::daGhostship_HIO_c() {
- /* Nonmatching */
+ field_0x04 = 0;
+ hideShip = false;
+ shipAlpha = 0.51f;
+ field_0x0C = 5.0f;
+ shipHideDist = 3000.0f;
+ shipEnterDist = 1500.0f;
}
-/* 00000400-000004CC .text pathMove__13daGhostship_cFv */
+/* 00000400-000004CC .text pathMove__13daGhostship_cFv */
void daGhostship_c::pathMove() {
- /* Nonmatching */
+ cLib_addCalc2(&speedF, mPathSpeed, 0.1f, 2.0f);
+ dLib_pathMove(&mPathPos, &mPathPntNo, mPath, speedF, &pathMove_CB, this);
+ cLib_addCalcPosXZ2(&current.pos, mPathPos, g_regHIO.mChild[12].mFloatRegs[0] + 0.01f, speedF);
+ if(speedF != 0.0f && mPathSpeed != 0.0f) {
+ cLib_addCalcAngleS2(&shape_angle.y, cLib_targetAngleY(&current.pos, &mPathPos), 8, 0x100);
+ }
}
-/* 000004CC-000004D8 .text modeWaitInit__13daGhostship_cFv */
+/* 000004CC-000004D8 .text modeWaitInit__13daGhostship_cFv */
void daGhostship_c::modeWaitInit() {
- /* Nonmatching */
+ mMode = 0;
}
-/* 000004D8-000004DC .text modeWait__13daGhostship_cFv */
+/* 000004D8-000004DC .text modeWait__13daGhostship_cFv */
void daGhostship_c::modeWait() {
- /* Nonmatching */
+ return;
}
-/* 000004DC-000004E0 .text modeRealize__13daGhostship_cFv */
+/* 000004DC-000004E0 .text modeRealize__13daGhostship_cFv */
void daGhostship_c::modeRealize() {
- /* Nonmatching */
+ return;
}
-/* 000004E0-00000770 .text _pathMove__13daGhostship_cFP4cXyzP4cXyzP4cXyz */
-void daGhostship_c::_pathMove(cXyz*, cXyz*, cXyz*) {
+/* 000004E0-00000770 .text _pathMove__13daGhostship_cFP4cXyzP4cXyzP4cXyz */
+bool daGhostship_c::_pathMove(cXyz* curPos, cXyz* p_curPntPos, cXyz* p_nextPntPos) {
/* Nonmatching */
+ mCurPntPos = *p_curPntPos;
+ mCurPntPos.y = current.pos.y;
+ mNextPntPos = *p_nextPntPos;
+ mNextPntPos.y = current.pos.y;
+
+ cXyz dist = mNextPntPos - mCurPntPos;
+ if(!dist.normalizeRS()) {
+ return true;
+ }
+
+ f32 step = speedF * fabsf(cM_scos(cLib_addCalcAngleS(&current.angle.y, cM_atan2s(dist.x, dist.z), 8, 0x200, 8)));
+ cLib_chasePosXZ(curPos, mNextPntPos, step);
+ if((*curPos - mNextPntPos).absXZ() < step * (g_regHIO.mChild[12].mFloatRegs[5] + 1.0f) || (*curPos - mNextPntPos).absXZ() == 0.0f) {
+ return true;
+ }
+
+ return false;
}
-/* 00000770-0000077C .text modePathMoveInit__13daGhostship_cFv */
+/* 00000770-0000077C .text modePathMoveInit__13daGhostship_cFv */
void daGhostship_c::modePathMoveInit() {
- /* Nonmatching */
+ mMode = 2;
}
/* 0000077C-000007D0 .text modePathMove__13daGhostship_cFv */
void daGhostship_c::modePathMove() {
- /* Nonmatching */
+ if(pathId != 0xFF) {
+ mPathSpeed = 10.0f;
+ pathMove();
+ }
+
+ current.pos.y = dLib_getWaterY(current.pos, mAcch);
}
-/* 000007D0-00000874 .text modeProcCall__13daGhostship_cFv */
+/* 000007D0-00000874 .text modeProcCall__13daGhostship_cFv */
void daGhostship_c::modeProcCall() {
/* Nonmatching */
+ typedef void(daGhostship_c::*ProcFunc)(void);
+ static const ProcFunc mode_proc[] = {
+ &daGhostship_c::modeWait,
+ &daGhostship_c::modeRealize,
+ &daGhostship_c::modePathMove
+ };
+
+ (this->*mode_proc[mMode])();
+}
+
+// probably unused/debug colors or something
+const u32 dummy[] = {
+ 0x0000FF80,
+ 0xFF000080,
+ 0xFF000080,
+ 0xFF000080,
+ 0x00FF0080,
+ 0x0000FF80,
+ 0x0000FF80,
+ 0x0000FF80,
+};
+u32 dummyFunc() {
+ return dummy[0];
}
-/* 00000874-00000C78 .text createInit__13daGhostship_cFv */
+/* 00000874-00000C78 .text createInit__13daGhostship_cFv */
void daGhostship_c::createInit() {
- /* Nonmatching */
+ mPathPos = current.pos;
+
+ for(int i = 0; i < 0xC; i++) {
+ mPaths[i].mAngle = 0x2000 * i;
+
+ s32 temp2 = 1;
+ f32 temp3 = 600.0f * cM_scos(mPaths[i].mAngle + mPaths[i].mAngleSpeed);
+ if(i % 2 == 1) {
+ temp2 = -1;
+ temp3 = 600.0f * cM_ssin(mPaths[i].mAngle + mPaths[i].mAngleSpeed);
+ }
+
+ mPaths[i].mRadius = 100.0f * i;
+
+ f32 temp4 = 500.0f + g_regHIO.mChild[12].mFloatRegs[10];
+ mPaths[i].mWobbleAmplitude = 300.0f + g_regHIO.mChild[12].mFloatRegs[1];
+ mPaths[i].mAngleSpeed = temp2 * (0x100 + g_regHIO.mChild[12].mShortRegs[0] + 0x10 * i + cM_rndF(100.0f));
+ mPaths[i].mTranslation.x = current.pos.x + temp4 * cM_ssin(shape_angle.y);
+ mPaths[i].mTranslation.y = 600.0f + current.pos.y + temp3 + cM_rndF(100.0f);
+ mPaths[i].mTranslation.z = current.pos.z + temp4 * cM_scos(shape_angle.y);
+
+ dLib_setCirclePath(&mPaths[i]);
+ }
+
+ if(pathId != 0xFF) {
+ mPath = dPath_GetRoomPath(pathId, fopAcM_GetRoomNo(this));
+ modePathMoveInit();
+ }
+ else {
+ modeWaitInit();
+ }
+
+ mCir.SetWall(30.0f, 30.0f);
+ mAcch.Set(&fopAcM_GetPosition_p(this), &fopAcM_GetOldPosition_p(this), this, true, &mCir, &fopAcM_GetSpeed_p(this), 0, 0);
+ mAcch.SetWallNone();
+ mAcch.SetRoofNone();
+ dLib_waveRot(&current.pos, 0.0f, &mWave);
+
+ shape_angle.x = mWave.mRotX;
+ shape_angle.z = mWave.mRotZ;
+
+ mpModel->setBaseScale(mScale);
+ mDoMtx_stack_c::transS(current.pos);
+ mDoMtx_stack_c::XYZrotM(shape_angle.x, 0, shape_angle.z);
+ mDoMtx_stack_c::YrotM(shape_angle.y);
+ mpModel->setBaseTRMtx(mDoMtx_stack_c::get());
+ mDoMtx_stack_c::copy(mpModel->getBaseTRMtx());
+
+ mDoMtx_stack_c::push();
+ mDoMtx_stack_c::transM(0.0f, 3200.0f, 75.0f);
+ mpCloth->setMtx(mDoMtx_stack_c::get());
+
+ mDoMtx_stack_c::pop();
+ mDoMtx_stack_c::transM(-900.0f, 2080.0f, 85.0f);
+ mDoMtx_stack_c::YrotM(0x4000);
+ mpCloth2->setMtx(mDoMtx_stack_c::get());
}
-/* 00000C78-00000C8C .text getArg__13daGhostship_cFv */
+/* 00000C78-00000C8C .text getArg__13daGhostship_cFv */
void daGhostship_c::getArg() {
- /* Nonmatching */
+ u32 param = fopAcM_GetParam(this);
+ pathId = fopAcM_GetParamBit(param, 0x10, 8);
+ moonPhase = fopAcM_GetParamBit(param, 0, 8);
}
-/* 00000C8C-00000DFC .text daGhostshipCreate__FPv */
-static s32 daGhostshipCreate(void*) {
- /* Nonmatching */
+/* 00000C8C-00000DFC .text daGhostshipCreate__FPv */
+static s32 daGhostshipCreate(void* i_actor) {
+ daGhostship_c* i_this = static_cast<daGhostship_c*>(i_actor);
+ fopAcM_SetupActor(i_this, daGhostship_c);
+
+ s32 result = dComIfG_resLoad(&i_this->mPhs, daGhostship_c::m_arc_name);
+ if(result != cPhs_COMPLEATE_e) {
+ return result;
+ }
+
+ result = dComIfG_resLoad(&i_this->mClothPhs, daGhostship_c::m_cloth_arc_name);
+ if(result != cPhs_COMPLEATE_e) {
+ return result;
+ }
+
+ i_this->getArg();
+ if((s32)dComIfGs_getEventReg(0x8803) == 3) {
+ return cPhs_ERROR_e;
+ }
+
+ if (!fopAcM_entrySolidHeap(i_this, createHeap_CB, 0x1EA0)) {
+ return cPhs_ERROR_e;
+ }
+
+ i_this->createInit();
+
+ return cPhs_COMPLEATE_e;
}
-/* 00000FD8-00001024 .text daGhostshipDelete__FPv */
-static BOOL daGhostshipDelete(void*) {
- /* Nonmatching */
+/* 00000FD8-00001024 .text daGhostshipDelete__FPv */
+static BOOL daGhostshipDelete(void* i_actor) {
+ daGhostship_c* i_this = static_cast<daGhostship_c*>(i_actor);
+
+ dComIfG_resDelete(&i_this->mPhs, daGhostship_c::m_arc_name);
+ dComIfG_resDelete(&i_this->mClothPhs, daGhostship_c::m_cloth_arc_name);
+
+ return true;
}
-/* 00001024-00001048 .text daGhostshipExecute__FPv */
-static BOOL daGhostshipExecute(void*) {
- /* Nonmatching */
+/* 00001024-00001048 .text daGhostshipExecute__FPv */
+static BOOL daGhostshipExecute(void* i_this) {
+ return static_cast<daGhostship_c*>(i_this)->_execute();
}
-/* 00001048-0000182C .text _execute__13daGhostship_cFv */
-BOOL daGhostship_c::_execute() {
- /* Nonmatching */
+/* 00001048-0000182C .text _execute__13daGhostship_cFv */
+bool daGhostship_c::_execute() {
+ f32 time = dComIfGs_getTime();
+ f32 dist = fopAcM_searchActorDistanceXZ(this, dComIfGp_getPlayer(0));
+
+ mbCanEnterShip = false;
+ if(moonPhase != dKy_moon_type_chk() || (time > 90.0f && time < 285.0f)) {
+ dKy_pship_existense_cut();
+ mAlpha = 0.0f;
+ }
+ else {
+ dKy_pship_existense_set();
+ f32 targetAlpha;
+ if(dist < l_HIO.shipHideDist) {
+ targetAlpha = 0.0f;
+ }
+ else {
+ targetAlpha = l_HIO.shipAlpha;
+ }
+
+ if(dComIfGs_isOpenCollectMap(0x24) && dComIfGs_isGetCollectMap(0x24)) {
+ mbCanEnterShip = 1;
+ targetAlpha = l_HIO.shipAlpha;
+ }
+
+ cLib_chaseF(&mAlpha, targetAlpha, 0.02f);
+ }
+
+ if(mAlpha == 0.0f) {
+ fopAcM_OffStatus(this, fopAcStts_SHOWMAP_e | 0x3);
+ }
+ else {
+ fopAcM_seStart(this, JA_SE_CV_YUUREISEN_SONG, 0);
+ fopAcM_OnStatus(this, fopAcStts_SHOWMAP_e | 0x3);
+ }
+
+ for(int i = 0; i < 0xC; i++) {
+ if(mPaths[i].mRadius < 900.0f) {
+ field_0x6C4[i] = i * 100.0f + 1500.0f;
+ }
+ else {
+ if(mPaths[i].mRadius > i * 100.0f + 1400.0f) {
+ field_0x6C4[i] = 800.0f;
+ }
+ }
+
+ s32 temp2 = 1;
+ f32 temp3 = 600.0f * cM_scos((mPaths[i].mAngle + mPaths[i].mAngleSpeed) * 2 & 0xFFFE);
+ if(i % 2 == 1) {
+ temp2 = -1;
+ temp3 = 600.0f * cM_ssin((mPaths[i].mAngle + mPaths[i].mAngleSpeed) * 2 & 0xFFFE);
+ }
+
+ cLib_addCalc2(&mPaths[i].mRadius, field_0x6C4[i], 0.1f, 10.0f);
+
+ f32 temp = (500.0f + g_regHIO.mChild[12].mFloatRegs[10]);
+
+ mPaths[i].mWobbleAmplitude = 300.0f + g_regHIO.mChild[12].mFloatRegs[1];
+ mPaths[i].mAngleSpeed = (5 + g_regHIO.mChild[12].mShortRegs[0] + i * 2 + cM_rndF(20.0f)) * temp2;
+
+ mPaths[i].mTranslation.x = current.pos.x + temp * cM_ssin(shape_angle.y);
+ mPaths[i].mTranslation.y = 600.0f + current.pos.y + temp3;
+ mPaths[i].mTranslation.z = current.pos.z + temp * cM_scos(shape_angle.y);
+
+ dLib_setCirclePath(&mPaths[i]);
+ if(mAlpha != 0.0f) {
+ dComIfGp_particle_setSimple(0x8306, &mPaths[i].mPos, 0xFF, g_whiteColor, g_whiteColor, 0);
+ }
+ }
+
+ if(mAlpha == l_HIO.shipAlpha && dist < l_HIO.shipEnterDist && dComIfGs_getEventReg(0x8803) < 3 && !mbEnteredShip) {
+ mDoAud_seStart(JA_SE_LK_WARP_TO_G_SHIP, 0, 0, 0);
+ stage_scls_info_class* scls_data = dComIfGd_getMeshSceneList(current.pos);
+ JUT_ASSERT(463, scls_data != 0)
+
+ u8 startCode = scls_data->mStart;
+ dComIfGs_setEventReg(0xC3FF, scls_data->mRoom);
+ dComIfGs_setEventReg(0x85FF, startCode);
+ dComIfGp_setNextStage("PShip", 0, 2, 0xFF, 0.0f, 0, 1, 0);
+ mbEnteredShip = true;
+ }
+
+ modeProcCall();
+ mBtk.play();
+
+ dLib_waveRot(&current.pos, 0.0f, &mWave);
+ shape_angle.x = mWave.mRotX;
+ shape_angle.z = mWave.mRotZ;
+
+ mpModel->setBaseScale(mScale);
+ mDoMtx_stack_c::transS(current.pos);
+ mDoMtx_stack_c::XYZrotM(shape_angle.x, 0, shape_angle.z);
+ mDoMtx_stack_c::YrotM(shape_angle.y);
+ mpModel->setBaseTRMtx(mDoMtx_stack_c::get());
+ mDoMtx_stack_c::copy(mpModel->getBaseTRMtx());
+
+ mDoMtx_stack_c::push();
+ mDoMtx_stack_c::transM(0.0f, 3200.0f, 75.0f);
+ mpCloth->setMtx(mDoMtx_stack_c::get());
+
+ mDoMtx_stack_c::pop();
+ mDoMtx_stack_c::transM(-900.0f, 2080.0f, 85.0f);
+ mDoMtx_stack_c::YrotM(0x4000);
+ mpCloth2->setMtx(mDoMtx_stack_c::get());
+
+ mpCloth->setParam(0.45f, -1.5f, 0.875f, 1.0f, 1.0f, 0x100, 0, 900, -800, 7.0f, 6.0f);
+ mpCloth->setGlobalWind(dKyw_get_wind_vec());
+ mpCloth->cloth_move();
+
+ mpCloth2->setParam(0.45f, -0.25f, 0.875f, 1.0f, 1.0f, 0x100, 0, 900, -800, 7.0f, 6.0f);
+ cXyz wind2 = *dKyw_get_wind_vec();
+ wind2 *= 0.548f;
+ wind2.y = -0.83f;
+ mpCloth2->setGlobalWind(&wind2);
+ mpCloth2->cloth_move();
+
+ return false;
}
-/* 0000182C-00001850 .text daGhostshipDraw__FPv */
-static BOOL daGhostshipDraw(void*) {
- /* Nonmatching */
+/* 0000182C-00001850 .text daGhostshipDraw__FPv */
+static BOOL daGhostshipDraw(void* i_this) {
+ return static_cast<daGhostship_c*>(i_this)->_draw();
}
-/* 00001850-000019A4 .text _draw__13daGhostship_cFv */
-BOOL daGhostship_c::_draw() {
+/* 00001850-000019A4 .text _draw__13daGhostship_cFv */
+bool daGhostship_c::_draw() {
/* Nonmatching */
+ if(mAlpha == 0.0f) {
+ return true;
+ }
+
+ if(!l_HIO.hideShip) {
+ g_env_light.settingTevStruct(TEV_TYPE_ACTOR, &current.pos, &mTevStr);
+ g_env_light.setLightTevColorType(mpModel, &mTevStr);
+
+ J3DModelData* modelData = mpModel->getModelData();
+ u32 alpha = (u8)(mAlpha * 255.5f);
+ for(u8 i = 0; i < modelData->getMaterialNum(); i++) {
+ modelData->getMaterialNodePointer(i)->getTevKColor(3)->mColor.a = alpha;
+ }
+
+ mBtk.entry(modelData, mBtk.getFrame());
+ mDoExt_modelUpdateDL(mpModel);
+ mBtk.remove(modelData);
+
+ mTevStr.mColorC0.a = alpha;
+ mpCloth->cloth_draw();
+ mTevStr.mColorC0.a = alpha;
+ mpCloth2->cloth_draw();
+ }
+
+ return true;
}
-/* 000019A4-000019AC .text daGhostshipIsDelete__FPv */
+/* 000019A4-000019AC .text daGhostshipIsDelete__FPv */
static BOOL daGhostshipIsDelete(void*) {
- /* Nonmatching */
+ return true;
}
+static actor_method_class daGhostshipMethodTable = {
+ (process_method_func)daGhostshipCreate,
+ (process_method_func)daGhostshipDelete,
+ (process_method_func)daGhostshipExecute,
+ (process_method_func)daGhostshipIsDelete,
+ (process_method_func)daGhostshipDraw,
+};
+
+actor_process_profile_definition g_profile_AYUSH = {
+ fpcLy_CURRENT_e,
+ 7,
+ fpcPi_CURRENT_e,
+ PROC_AYUSH,
+ &g_fpcLf_Method.mBase,
+ sizeof(daGhostship_c),
+ 0,
+ 0,
+ &g_fopAc_Method.base,
+ 0x009E,
+ &daGhostshipMethodTable,
+ fopAcStts_UNK40000_e | fopAcStts_SHOWMAP_e | 0x3,
+ fopAc_ACTOR_e,
+ fopAc_CULLBOX_4_e,
+};
diff --git a/src/d/actor/d_a_tag_ghostship.cpp b/src/d/actor/d_a_tag_ghostship.cpp
index ce05241c..266d953c 100644
--- a/src/d/actor/d_a_tag_ghostship.cpp
+++ b/src/d/actor/d_a_tag_ghostship.cpp
@@ -4,85 +4,187 @@
//
#include "d/actor/d_a_tag_ghostship.h"
-#include "dolphin/types.h"
+#include "JSystem/JKernel/JKRHeap.h"
+#include "d/d_com_inf_game.h"
+#include "d/d_procname.h"
-/* 000000EC-0000010C .text __ct__17daTag_Gship_HIO_cFv */
+// Needed for .data to match.
+static f32 dummy1[3] = {1.0f, 1.0f, 1.0f};
+static f32 dummy2[3] = {1.0f, 1.0f, 1.0f};
+static u8 dummy3[4] = {0x02, 0x00, 0x02, 0x01};
+static f64 dummy4[2] = {3.0, 0.5};
+
+static daTag_Gship_HIO_c l_HIO;
+
+/* 000000EC-0000010C .text __ct__17daTag_Gship_HIO_cFv */
daTag_Gship_HIO_c::daTag_Gship_HIO_c() {
- /* Nonmatching */
+ field_0x04 = -1;
+ field_0x05 = 0;
}
-/* 0000010C-00000110 .text modeClearWaitInit__13daTag_Gship_cFv */
+/* 0000010C-00000110 .text modeClearWaitInit__13daTag_Gship_cFv */
void daTag_Gship_c::modeClearWaitInit() {
- /* Nonmatching */
+ return;
}
-/* 00000110-000001C0 .text modeClearWait__13daTag_Gship_cFv */
+/* 00000110-000001C0 .text modeClearWait__13daTag_Gship_cFv */
void daTag_Gship_c::modeClearWait() {
- /* Nonmatching */
+ if(dComIfGp_evmng_endCheck("DEFAULT_TREASURE") || dComIfGp_evmng_endCheck("DEFAULT_TREASURE2") || dComIfGp_evmng_endCheck("DEFAULT_TREASURE_A") || l_HIO.field_0x05) {
+ modeProc(CLEAR_WAIT, 1);
+ }
}
-/* 000001C0-00000214 .text modeClearEventInit__13daTag_Gship_cFv */
+/* 000001C0-00000214 .text modeClearEventInit__13daTag_Gship_cFv */
void daTag_Gship_c::modeClearEventInit() {
- /* Nonmatching */
+ dComIfGs_getEventReg(0x8803);
+ dComIfGs_setEventReg(0x8803, 3);
}
-/* 00000214-00000418 .text modeClearEvent__13daTag_Gship_cFv */
+/* 00000214-00000418 .text modeClearEvent__13daTag_Gship_cFv */
void daTag_Gship_c::modeClearEvent() {
- /* Nonmatching */
-}
-
-/* 00000418-00000508 .text modeProc__13daTag_Gship_cFQ213daTag_Gship_c6Proc_ei */
-void daTag_Gship_c::modeProc(daTag_Gship_c::Proc_e, int) {
- /* Nonmatching */
-}
+ if(mEvtInfo.checkCommandDemoAccrpt()) {
+ int staffIdx = dComIfGp_evmng_getMyStaffId("PScnChg", 0, 0);
+ if(dEvmng_strcmp(dComIfGp_getPEvtManager()->getMyNowCutName(staffIdx), "WARAIGOE") == 0) {
+ if(dComIfGs_getEventReg(0x8803) == 3) {
+ mDoAud_seStart(JA_SE_CV_G_SHIP_SCREAM, 0, 0, 0);
+ }
+ else {
+ mDoAud_seStart(JA_SE_CV_G_SHIP_LAUGH, 0, 0, 0);
+ }
+
+ dComIfGp_evmng_cutEnd(staffIdx);
+ }
+
+ if(dComIfGp_evmng_endCheck("PSHIP_CLEAR")) {
+ mDoAud_seStart(JA_SE_LK_WARP_TO_G_SHIP, 0, 0, 0);
+ s8 room = dComIfGs_getEventReg(0xC3FF);
+ s8 spawn = dComIfGs_getEventReg(0x85FF);
+ dKy_set_nexttime(120.0f);
+ dComIfGp_setNextStage("sea", spawn, room, 0xFF, 0.0f, 5, 1, 0);
+ }
+ }
+ else {
+ fopAcM_orderOtherEvent2(this, "PSHIP_CLEAR", 1, 0xFFFF);
+ }
+}
+
+/* 00000418-00000508 .text modeProc__13daTag_Gship_cFQ213daTag_Gship_c6Proc_ei */
+void daTag_Gship_c::modeProc(daTag_Gship_c::Proc_e proc, int param_2) {
+ typedef void(daTag_Gship_c::*ProcFunc)(void);
+ struct ProcEntry {
+ ProcFunc init;
+ ProcFunc run;
+ const char* name;
+ };
+
+ static const ProcEntry mode_proc[] = {
+ {
+ &daTag_Gship_c::modeClearWaitInit,
+ &daTag_Gship_c::modeClearWait,
+ "CLEAR_WAIT"
+ },
+ {
+ &daTag_Gship_c::modeClearEventInit,
+ &daTag_Gship_c::modeClearEvent,
+ "CLEAR_EVENT"
+ }
+ };
+
+ if(proc == CLEAR_WAIT) {
+ mMode = param_2;
+ (this->*mode_proc[mMode].init)();
+ }
+ else if(proc == CLEAR_EVENT) {
+ (this->*mode_proc[mMode].run)();
+ }
+}
+
+/* 00000508-00000534 .text _execute__13daTag_Gship_cFv */
+bool daTag_Gship_c::_execute() {
+ modeProc(CLEAR_EVENT, 2);
+ return true;
+}
+
+/* 00000534-0000053C .text _draw__13daTag_Gship_cFv */
+bool daTag_Gship_c::_draw() {
+ return true;
+}
+
+/* 0000053C-00000594 .text getArg__13daTag_Gship_cFv */
+void daTag_Gship_c::getArg() {
+ u32 param = fopAcM_GetParam(this);
-/* 00000508-00000534 .text _execute__13daTag_Gship_cFv */
-BOOL daTag_Gship_c::_execute() {
- /* Nonmatching */
+ field_0x294 = param;
+ s32 bit = fopAcM_GetParamBit(param, 8, 8);
+ if(bit == 0xFF) {
+ field_0x298 = 1000.0f;
+ }
+ else {
+ field_0x298 = bit * 100;
+ }
}
-/* 00000534-0000053C .text _draw__13daTag_Gship_cFv */
-BOOL daTag_Gship_c::_draw() {
- /* Nonmatching */
-}
+/* 00000594-000005EC .text _create__13daTag_Gship_cFv */
+s32 daTag_Gship_c::_create() {
+ fopAcM_SetupActor(this, daTag_Gship_c);
-/* 0000053C-00000594 .text getArg__13daTag_Gship_cFv */
-void daTag_Gship_c::getArg() {
- /* Nonmatching */
-}
+ getArg();
-/* 00000594-000005EC .text _create__13daTag_Gship_cFv */
-s32 daTag_Gship_c::_create() {
- /* Nonmatching */
+ return cPhs_COMPLEATE_e;
}
-/* 000005EC-000005F4 .text _delete__13daTag_Gship_cFv */
-BOOL daTag_Gship_c::_delete() {
- /* Nonmatching */
+/* 000005EC-000005F4 .text _delete__13daTag_Gship_cFv */
+bool daTag_Gship_c::_delete() {
+ return true;
}
-/* 000005F4-00000614 .text daTag_GshipCreate__FPv */
-static s32 daTag_GshipCreate(void*) {
- /* Nonmatching */
+/* 000005F4-00000614 .text daTag_GshipCreate__FPv */
+static s32 daTag_GshipCreate(void* i_this) {
+ return static_cast<daTag_Gship_c*>(i_this)->_create();
}
-/* 00000614-00000638 .text daTag_GshipDelete__FPv */
-static BOOL daTag_GshipDelete(void*) {
- /* Nonmatching */
+/* 00000614-00000638 .text daTag_GshipDelete__FPv */
+static BOOL daTag_GshipDelete(void* i_this) {
+ return static_cast<daTag_Gship_c*>(i_this)->_delete();
}
-/* 00000638-0000065C .text daTag_GshipExecute__FPv */
-static BOOL daTag_GshipExecute(void*) {
- /* Nonmatching */
+/* 00000638-0000065C .text daTag_GshipExecute__FPv */
+static BOOL daTag_GshipExecute(void* i_this) {
+ return static_cast<daTag_Gship_c*>(i_this)->_execute();
}
-/* 0000065C-00000680 .text daTag_GshipDraw__FPv */
-static BOOL daTag_GshipDraw(void*) {
- /* Nonmatching */
+/* 0000065C-00000680 .text daTag_GshipDraw__FPv */
+static BOOL daTag_GshipDraw(void* i_this) {
+ return static_cast<daTag_Gship_c*>(i_this)->_draw();
}
-/* 00000680-00000688 .text daTag_GshipIsDelete__FPv */
+/* 00000680-00000688 .text daTag_GshipIsDelete__FPv */
static BOOL daTag_GshipIsDelete(void*) {
- /* Nonmatching */
-}
-
+ return true;
+}
+
+
+static actor_method_class daTag_GshipMethodTable = {
+ (process_method_func)daTag_GshipCreate,
+ (process_method_func)daTag_GshipDelete,
+ (process_method_func)daTag_GshipExecute,
+ (process_method_func)daTag_GshipIsDelete,
+ (process_method_func)daTag_GshipDraw,
+};
+
+actor_process_profile_definition g_profile_TAG_GSHIP = {
+ fpcLy_CURRENT_e,
+ 8,
+ fpcPi_CURRENT_e,
+ PROC_TAG_GSHIP,
+ &g_fpcLf_Method.mBase,
+ sizeof(daTag_Gship_c),
+ 0,
+ 0,
+ &g_fopAc_Method.base,
+ 0x0066,
+ &daTag_GshipMethodTable,
+ fopAcStts_UNK40000_e | fopAcStts_UNK4000_e,
+ fopAc_ACTOR_e,
+ fopAc_CULLBOX_4_e,
+};
diff --git a/src/d/d_kankyo.cpp b/src/d/d_kankyo.cpp
index 277a68da..5da4948d 100644
--- a/src/d/d_kankyo.cpp
+++ b/src/d/d_kankyo.cpp
@@ -3436,7 +3436,7 @@ void dKy_instant_rainchg() {
}
/* 801973B8-80197404 .text dKy_moon_type_chk__Fv */
-u32 dKy_moon_type_chk() {
+s32 dKy_moon_type_chk() {
int weekday = dKy_get_dayofweek();
if (dComIfGs_getTime() < 180.0f) {