mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-06-20 22:51:16 -04:00
5d68762590
* Add a *ton* of const and constexpr around the codebase. This makes the codebase compile without strings being cast to non-const char*. I also went through and added constexpr where appropriate for tons of static data. * Make process definitions const too Might as well
173 lines
4.6 KiB
C++
173 lines
4.6 KiB
C++
/**
|
|
* d_a_obj_sekizo.cpp
|
|
*
|
|
*/
|
|
|
|
#include "d/dolzel_rel.h" // IWYU pragma: keep
|
|
|
|
#include "d/actor/d_a_obj_sekizo.h"
|
|
#include "d/d_bg_w.h"
|
|
#include "d/d_com_inf_game.h"
|
|
|
|
static struct {
|
|
u32 bmdIdx;
|
|
u32 resIdx;
|
|
} l_bmdData[1] = {4, 1};
|
|
|
|
static struct {
|
|
u32 dzbIdx;
|
|
u32 resIdx;
|
|
} l_dzbData[1] = {7, 1};
|
|
|
|
static DUSK_CONSTEXPR char DUSK_CONST* l_resNameList[2] = {"", "Sekizo"};
|
|
|
|
static u8 lit_3800[12];
|
|
|
|
daObj_Sekizo_HIOParam const daObj_Sekizo_Param_c::m = {};
|
|
|
|
static OBJ_SEKIZO_HIO_CLASS l_HIO;
|
|
|
|
#if DEBUG
|
|
daObj_Sekizo_HIO_c::daObj_Sekizo_HIO_c() {
|
|
m = daObj_Sekizo_Param_c::m;
|
|
}
|
|
|
|
void daObj_Sekizo_HIO_c::listenPropertyEvent(const JORPropertyEvent* event) {
|
|
// NONMATCHING
|
|
}
|
|
|
|
void daObj_Sekizo_HIO_c::genMessage(JORMContext* ctx) {
|
|
// NONMATCHING
|
|
}
|
|
#endif
|
|
|
|
cPhs_Step daObj_Sekizo_c::create() {
|
|
fopAcM_ct(this, daObj_Sekizo_c);
|
|
|
|
field_0x5b0 = 0;
|
|
cPhs_Step step =
|
|
dComIfG_resLoad(&mPhaseReq, l_resNameList[l_bmdData[field_0x5b0].resIdx]);
|
|
if (step == cPhs_COMPLEATE_e) {
|
|
step = MoveBGCreate(l_resNameList[l_dzbData[field_0x5b0].resIdx],
|
|
l_dzbData[field_0x5b0].dzbIdx, dBgS_MoveBGProc_TypicalRotY,
|
|
0x4000, NULL);
|
|
if (step == cPhs_ERROR_e) {
|
|
return step;
|
|
}
|
|
}
|
|
return step;
|
|
}
|
|
|
|
int daObj_Sekizo_c::CreateHeap() {
|
|
J3DModelData* model_data = (J3DModelData*)dComIfG_getObjectRes(
|
|
l_resNameList[l_bmdData[field_0x5b0].resIdx], l_bmdData[field_0x5b0].bmdIdx);
|
|
mpModel = mDoExt_J3DModel__create(model_data, 0x80000, 0x11000084);
|
|
if (mpModel == NULL) {
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
int daObj_Sekizo_c::Create() {
|
|
initBaseMtx();
|
|
fopAcM_SetMtx(this, mpModel->getBaseTRMtx());
|
|
fopAcM_setCullSizeBox2(this, mpModel->getModelData());
|
|
field_0x5b2 = false;
|
|
field_0x5b1 = true;
|
|
return 1;
|
|
}
|
|
|
|
int daObj_Sekizo_c::Delete() {
|
|
#if DEBUG
|
|
if (mpHIO != NULL) {
|
|
mpHIO->removeHIO();
|
|
}
|
|
#endif
|
|
|
|
dComIfG_resDelete(&mPhaseReq, l_resNameList[l_bmdData[field_0x5b0].resIdx]);
|
|
return 1;
|
|
}
|
|
|
|
int daObj_Sekizo_c::Execute(Mtx** i_mtx) {
|
|
if (home.roomNo == dComIfGp_roomControl_getStayNo()) {
|
|
*i_mtx = &mBgMtx;
|
|
setBaseMtx();
|
|
if (field_0x5b2) {
|
|
if (field_0x5b1) {
|
|
dComIfG_Bgsp().Release(mpBgW);
|
|
field_0x5b1 = false;
|
|
}
|
|
} else if (!field_0x5b1) {
|
|
dComIfG_Bgsp().Regist(mpBgW, this);
|
|
field_0x5b1 = true;
|
|
}
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
int daObj_Sekizo_c::Draw() {
|
|
if (!field_0x5b2) {
|
|
g_env_light.settingTevStruct(0x10, ¤t.pos, &tevStr);
|
|
g_env_light.setLightTevColorType_MAJI(mpModel, &tevStr);
|
|
dComIfGd_setListBG();
|
|
mDoExt_modelUpdateDL(mpModel);
|
|
dComIfGd_setList();
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
void daObj_Sekizo_c::initBaseMtx() {
|
|
mpModel->setBaseScale(scale);
|
|
setBaseMtx();
|
|
}
|
|
|
|
void daObj_Sekizo_c::setBaseMtx() {
|
|
mDoMtx_stack_c::transS(current.pos);
|
|
mDoMtx_stack_c::YrotM(shape_angle.y);
|
|
mpModel->setBaseTRMtx(mDoMtx_stack_c::get());
|
|
cMtx_copy(mDoMtx_stack_c::get(), mBgMtx);
|
|
}
|
|
|
|
static int daObj_Sekizo_Create(void* i_this) {
|
|
return static_cast<daObj_Sekizo_c*>(i_this)->create();
|
|
}
|
|
|
|
static int daObj_Sekizo_Delete(void* i_this) {
|
|
return static_cast<daObj_Sekizo_c*>(i_this)->MoveBGDelete();
|
|
}
|
|
|
|
static int daObj_Sekizo_Execute(void* i_this) {
|
|
return static_cast<daObj_Sekizo_c*>(i_this)->MoveBGExecute();
|
|
}
|
|
|
|
static int daObj_Sekizo_Draw(void* i_this) {
|
|
return static_cast<daObj_Sekizo_c*>(i_this)->MoveBGDraw();
|
|
}
|
|
|
|
static int daObj_Sekizo_IsDelete(void* i_this) {
|
|
return 1;
|
|
}
|
|
|
|
static DUSK_CONST actor_method_class daObj_Sekizo_MethodTable = {
|
|
(process_method_func)daObj_Sekizo_Create, (process_method_func)daObj_Sekizo_Delete,
|
|
(process_method_func)daObj_Sekizo_Execute, (process_method_func)daObj_Sekizo_IsDelete,
|
|
(process_method_func)daObj_Sekizo_Draw};
|
|
|
|
DUSK_PROFILE actor_process_profile_definition DUSK_CONST g_profile_OBJ_SEKIZO = {
|
|
/* Layer ID */ fpcLy_CURRENT_e,
|
|
/* List ID */ 7,
|
|
/* List Prio */ fpcPi_CURRENT_e,
|
|
/* Proc Name */ fpcNm_OBJ_SEKIZO_e,
|
|
/* Proc SubMtd */ &g_fpcLf_Method.base,
|
|
/* Size */ sizeof(daObj_Sekizo_c),
|
|
/* Size Other */ 0,
|
|
/* Parameters */ 0,
|
|
/* Leaf SubMtd */ &g_fopAc_Method.base,
|
|
/* Draw Prio */ fpcDwPi_OBJ_SEKIZO_e,
|
|
/* Actor SubMtd */ &daObj_Sekizo_MethodTable,
|
|
/* Status */ fopAcStts_UNK_0x40000_e | fopAcStts_UNK_0x4000_e,
|
|
/* Group */ fopAc_ACTOR_e,
|
|
/* Cull Type */ fopAc_CULLBOX_CUSTOM_e,
|
|
};
|