mirror of
https://github.com/zeldaret/tww.git
synced 2026-05-28 00:15:50 -04:00
d_a_mtoge (#621)
* Started implementing d_a_mtoge * Started work on actions in d_a_mtoge * d_a_mtoge actions WIP * Implemented daMtoge_c::draw * Implemented daMtoge_Delete * Implemented daMtoge_c::CreateHeap * Implemented daMtoge_c::create * Minor tweaks for d_a_mtoge * Implemented daMtoge_c::calcMtx * Implemented daMtoge_c::CreateInit * d_a_mtoge cleanup * Removed ternary expression * d_a_mtoge fixed matching
This commit is contained in:
+1
-1
@@ -1254,7 +1254,7 @@ config.libs = [
|
||||
ActorRel(NonMatching, "d_a_majuu_flag"),
|
||||
ActorRel(NonMatching, "d_a_mdoor"),
|
||||
ActorRel(NonMatching, "d_a_msw"),
|
||||
ActorRel(NonMatching, "d_a_mtoge"),
|
||||
ActorRel(Matching, "d_a_mtoge"),
|
||||
ActorRel(Matching, "d_a_obj_AjavW", extra_cflags=['-pragma "nosyminline on"']),
|
||||
ActorRel(Matching, "d_a_obj_Ygush00", extra_cflags=['-pragma "nosyminline on"']),
|
||||
ActorRel(Matching, "d_a_obj_akabe"),
|
||||
|
||||
@@ -1,27 +1,30 @@
|
||||
#ifndef D_A_MTOGE_H
|
||||
#define D_A_MTOGE_H
|
||||
|
||||
#include "f_op/f_op_actor.h"
|
||||
#include "d/d_bg_w.h"
|
||||
#include "SSystem/SComponent/c_phase.h"
|
||||
#include "d/d_bg_w.h"
|
||||
#include "f_op/f_op_actor.h"
|
||||
|
||||
|
||||
class daMtoge_c : public fopAc_ac_c {
|
||||
public:
|
||||
inline BOOL draw();
|
||||
inline BOOL execute();
|
||||
void setAction(unsigned char) {}
|
||||
void setAction(u8 action) { mState = action; }
|
||||
|
||||
void getSwbit();
|
||||
void CreateHeap();
|
||||
u8 getSwbit();
|
||||
BOOL CreateHeap();
|
||||
void calcMtx();
|
||||
void CreateInit();
|
||||
BOOL CreateInit();
|
||||
s32 create();
|
||||
|
||||
static const char M_arcname[];
|
||||
|
||||
public:
|
||||
/* 0x290 */ request_of_phase_process_class mPhaseProcReq;
|
||||
/* 0x298 */ J3DModel* mpModel;
|
||||
/* 0x29C */ dBgW* mpBgW;
|
||||
/* 0x2A0 */ s8 mState;
|
||||
/* 0x2A0 */ u8 mState;
|
||||
/* 0x2A1 */ s8 m2A1;
|
||||
/* 0x2A2 */ s8 m2A2;
|
||||
/* 0x2A3 */ s8 m2A3;
|
||||
|
||||
+173
-29
@@ -4,86 +4,230 @@
|
||||
//
|
||||
|
||||
#include "d/actor/d_a_mtoge.h"
|
||||
#include "d/d_com_inf_game.h"
|
||||
#include "d/d_procname.h"
|
||||
#include "d/res/res_mtoge.h"
|
||||
#include "f_op/f_op_actor_mng.h"
|
||||
|
||||
const char daMtoge_c::M_arcname[] = "Mtoge";
|
||||
|
||||
enum Action {
|
||||
ACT_WAIT,
|
||||
ACT_HIND,
|
||||
ACT_UP,
|
||||
ACT_ARRIVAL,
|
||||
ACT_DOWN,
|
||||
};
|
||||
|
||||
/* 00000078-00000084 .text getSwbit__9daMtoge_cFv */
|
||||
void daMtoge_c::getSwbit() {
|
||||
/* Nonmatching */
|
||||
u8 daMtoge_c::getSwbit() {
|
||||
return fopAcM_GetParam(this) & 0xFF;
|
||||
}
|
||||
|
||||
/* 00000084-000000A4 .text CheckCreateHeap__FP10fopAc_ac_c */
|
||||
static BOOL CheckCreateHeap(fopAc_ac_c*) {
|
||||
/* Nonmatching */
|
||||
static BOOL CheckCreateHeap(fopAc_ac_c* i_this) {
|
||||
return static_cast<daMtoge_c*>(i_this)->CreateHeap();
|
||||
}
|
||||
|
||||
/* 000000A4-000001E8 .text CreateHeap__9daMtoge_cFv */
|
||||
void daMtoge_c::CreateHeap() {
|
||||
/* Nonmatching */
|
||||
BOOL daMtoge_c::CreateHeap() {
|
||||
J3DModelData* modelData = static_cast<J3DModelData*>(dComIfG_getObjectRes(M_arcname, MTOGE_BMD_S_MTOGE));
|
||||
JUT_ASSERT(0x70, modelData != 0);
|
||||
|
||||
mpModel = mDoExt_J3DModel__create(modelData, 0, 0x11020203U);
|
||||
|
||||
if (!mpModel) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
mpBgW = new dBgW();
|
||||
|
||||
if (!mpBgW)
|
||||
return FALSE;
|
||||
|
||||
cBgD_t* pData = (cBgD_t*)dComIfG_getObjectRes(M_arcname, MTOGE_DZB_S_MTOGE);
|
||||
|
||||
if (!pData) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
calcMtx();
|
||||
|
||||
if (mpBgW->Set(pData, cBgW::MOVE_BG_e, &mpModel->getBaseTRMtx()) == true) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* 000001E8-00000254 .text calcMtx__9daMtoge_cFv */
|
||||
void daMtoge_c::calcMtx() {
|
||||
/* Nonmatching */
|
||||
mDoMtx_stack_c::transS(current.pos.x, current.pos.y + mHeightOffset, current.pos.z);
|
||||
mDoMtx_stack_c::YrotM(home.angle.y);
|
||||
mpModel->setBaseTRMtx(mDoMtx_stack_c::get());
|
||||
}
|
||||
|
||||
/* 00000254-00000384 .text CreateInit__9daMtoge_cFv */
|
||||
void daMtoge_c::CreateInit() {
|
||||
/* Nonmatching */
|
||||
BOOL daMtoge_c::CreateInit() {
|
||||
s32 sw = getSwbit();
|
||||
|
||||
if (dComIfG_Bgsp()->Regist(mpBgW, this)) {
|
||||
JUT_PANIC(0xA8);
|
||||
}
|
||||
|
||||
tevStr.mRoomNo = fopAcM_GetRoomNo(this);
|
||||
|
||||
if (sw == 0xFF) {
|
||||
mState = ACT_WAIT;
|
||||
} else if (dComIfGs_isSwitch(sw + 1, fopAcM_GetRoomNo(this))) {
|
||||
mState = ACT_WAIT;
|
||||
mHeightOffset = -300.0f;
|
||||
} else if (!dComIfGs_isSwitch(sw, fopAcM_GetRoomNo(this))) {
|
||||
mState = ACT_HIND;
|
||||
mHeightOffset = -300.0f;
|
||||
} else {
|
||||
mState = ACT_ARRIVAL;
|
||||
}
|
||||
|
||||
calcMtx();
|
||||
mpBgW->Move();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* 00000384-0000041C .text create__9daMtoge_cFv */
|
||||
s32 daMtoge_c::create() {
|
||||
/* Nonmatching */
|
||||
fopAcM_SetupActor(this, daMtoge_c);
|
||||
|
||||
cPhs__Step phase_state = (cPhs__Step)dComIfG_resLoad(&mPhaseProcReq, M_arcname);
|
||||
if (phase_state != cPhs_COMPLEATE_e) {
|
||||
return phase_state;
|
||||
}
|
||||
|
||||
if (!fopAcM_entrySolidHeap(this, CheckCreateHeap, 0x15C0U)) {
|
||||
return cPhs_ERROR_e;
|
||||
}
|
||||
|
||||
CreateInit();
|
||||
|
||||
return cPhs_COMPLEATE_e;
|
||||
}
|
||||
|
||||
/* 0000041C-00000424 .text daMtoge_actionWait__FP9daMtoge_c */
|
||||
void daMtoge_actionWait(daMtoge_c*) {
|
||||
/* Nonmatching */
|
||||
BOOL daMtoge_actionWait(daMtoge_c*) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* 00000424-000004D4 .text daMtoge_actionHind__FP9daMtoge_c */
|
||||
void daMtoge_actionHind(daMtoge_c*) {
|
||||
/* Nonmatching */
|
||||
BOOL daMtoge_actionHind(daMtoge_c* i_this) {
|
||||
s32 swbit = i_this->getSwbit();
|
||||
|
||||
if (dComIfGs_isSwitch(swbit, fopAcM_GetRoomNo(i_this)) != 0) {
|
||||
i_this->setAction(ACT_UP);
|
||||
fopAcM_SetSpeedF(i_this, 0.0f);
|
||||
|
||||
fopAcM_seStart(i_this, JA_SE_OBJ_TOGE_OUT, 0);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* 000004D4-00000550 .text daMtoge_actionUp__FP9daMtoge_c */
|
||||
void daMtoge_actionUp(daMtoge_c*) {
|
||||
/* Nonmatching */
|
||||
BOOL daMtoge_actionUp(daMtoge_c* i_this) {
|
||||
cLib_chaseF(&i_this->speedF, 30.0f, 4.0f);
|
||||
|
||||
if (cLib_chaseF(&i_this->mHeightOffset, 0.0f, fopAcM_GetSpeedF(i_this))) {
|
||||
i_this->setAction(ACT_ARRIVAL);
|
||||
}
|
||||
|
||||
i_this->calcMtx();
|
||||
i_this->mpBgW->Move();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* 00000550-00000600 .text daMtoge_actionArrival__FP9daMtoge_c */
|
||||
void daMtoge_actionArrival(daMtoge_c*) {
|
||||
/* Nonmatching */
|
||||
BOOL daMtoge_actionArrival(daMtoge_c* i_this) {
|
||||
s32 swbit = i_this->getSwbit();
|
||||
|
||||
if (dComIfGs_isSwitch(swbit, fopAcM_GetRoomNo(i_this)) == 0) {
|
||||
i_this->setAction(ACT_DOWN);
|
||||
fopAcM_SetSpeedF(i_this, 0.0f);
|
||||
|
||||
fopAcM_seStart(i_this, JA_SE_OBJ_TOGE_IN, 0);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* 00000600-0000067C .text daMtoge_actionDown__FP9daMtoge_c */
|
||||
void daMtoge_actionDown(daMtoge_c*) {
|
||||
/* Nonmatching */
|
||||
BOOL daMtoge_actionDown(daMtoge_c* i_this) {
|
||||
cLib_chaseF(&i_this->speedF, 30.0f, 4.0f);
|
||||
|
||||
if (cLib_chaseF(&i_this->mHeightOffset, -300.0f, fopAcM_GetSpeedF(i_this)) != 0) {
|
||||
i_this->setAction(ACT_HIND);
|
||||
}
|
||||
|
||||
i_this->calcMtx();
|
||||
i_this->mpBgW->Move();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL daMtoge_c::execute() {
|
||||
static BOOL (*l_action[])(daMtoge_c*) = {
|
||||
daMtoge_actionWait,
|
||||
daMtoge_actionHind,
|
||||
daMtoge_actionUp,
|
||||
daMtoge_actionArrival,
|
||||
daMtoge_actionDown,
|
||||
};
|
||||
|
||||
l_action[mState](this);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL daMtoge_c::draw() {
|
||||
g_env_light.settingTevStruct(TEV_TYPE_BG0, ¤t.pos, &tevStr);
|
||||
g_env_light.setLightTevColorType(mpModel, &tevStr);
|
||||
|
||||
mDoExt_modelUpdateDL(mpModel);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* 0000067C-000006DC .text daMtoge_Draw__FP9daMtoge_c */
|
||||
static BOOL daMtoge_Draw(daMtoge_c*) {
|
||||
/* Nonmatching */
|
||||
static BOOL daMtoge_Draw(daMtoge_c* i_this) {
|
||||
return i_this->draw();
|
||||
}
|
||||
|
||||
/* 000006DC-00000718 .text daMtoge_Execute__FP9daMtoge_c */
|
||||
static BOOL daMtoge_Execute(daMtoge_c*) {
|
||||
/* Nonmatching */
|
||||
static BOOL daMtoge_Execute(daMtoge_c* i_this) {
|
||||
return i_this->execute();
|
||||
}
|
||||
|
||||
/* 00000718-00000720 .text daMtoge_IsDelete__FP9daMtoge_c */
|
||||
static BOOL daMtoge_IsDelete(daMtoge_c*) {
|
||||
/* Nonmatching */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* 00000720-00000790 .text daMtoge_Delete__FP9daMtoge_c */
|
||||
static BOOL daMtoge_Delete(daMtoge_c*) {
|
||||
/* Nonmatching */
|
||||
static BOOL daMtoge_Delete(daMtoge_c* i_this) {
|
||||
if (i_this->heap != NULL) {
|
||||
dComIfG_Bgsp()->Release(i_this->mpBgW);
|
||||
}
|
||||
|
||||
dComIfG_resDelete(&i_this->mPhaseProcReq, i_this->M_arcname);
|
||||
|
||||
i_this->~daMtoge_c();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* 00000790-000007B0 .text daMtoge_Create__FP10fopAc_ac_c */
|
||||
static s32 daMtoge_Create(fopAc_ac_c*) {
|
||||
/* Nonmatching */
|
||||
static s32 daMtoge_Create(fopAc_ac_c* i_this) {
|
||||
return static_cast<daMtoge_c*>(i_this)->create();
|
||||
}
|
||||
|
||||
static actor_method_class l_daMtoge_Method = {
|
||||
|
||||
Reference in New Issue
Block a user