Files
dusklight/src/d/actor/d_a_obj_window.cpp
T
Huitzi 56890c32e8 Actor status consolidation & process profile definition editing (#3117)
* Consolidate fopAcM_STATUS into fopAc_Status_e

* Add _e suffix to fopAcStts enums

* Prepare for profile enumeration
* Correct typo in scene_process_profile_definition
* Manually handle g_profile_Obj_DamCps (inline preprocessing)
* Correct g_profile_TAG_LV5SOUP procname to enum
* Create d_priority.h

* Update process profile definitions
* Moved inline comments to the left
* Add missing fopAcStts enums
* Add d_priority.h include in f_pc_leaf.h
* Manually update d_a_obj_damCps profile

* Replace fopAcStts enums replacing and anticipatory profile size correction
* Changed profile size from literal to sizeof() in anticipation of PR #3116
* Provided putative names to staff-related status enums
* Replaced appropriate literals with fopAcStts enums

* Fix borked merge

* Rename item number enums and move to d_item_data.h

* Rename process profile name & draw priority enums

* Move process profile name & draw priority enums to appropriate files
* Moved fpcNm_ enums from d/d_procname.h to f_pc/f_pc_name.h
* Moved fpcDwPi_ enums from d/d_priority.h to f_pc/f_pc_draw_priority.h

* ACTUALLY (whoops) stage merge

* Correct item mistranslation

Co-authored-by: LagoLunatic <LagoLunatic@users.noreply.github.com>

---------

Co-authored-by: LagoLunatic <LagoLunatic@users.noreply.github.com>
2026-03-09 18:33:31 -07:00

196 lines
5.9 KiB
C++

/**
* d_a_obj_window.cpp
* Object - Twilight Hyrule Castle Window Shutter
*/
#include "d/dolzel_rel.h" // IWYU pragma: keep
#include "d/actor/d_a_obj_window.h"
#include "d/d_com_inf_game.h"
#include "f_pc/f_pc_name.h"
static char* l_arcName = "J_KazeD";
static int const l_bck[3] = {5, 6, -1};
static dCcD_SrcCyl l_cyl_src = {
{
{0x0, {{0x0, 0x0, 0x0}, {0xd8fbfdff, 0x11}, 0x79}}, // mObj
{dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x0}, // mGObjAt
{dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x4}, // mGObjTg
{0x0}, // mGObjCo
}, // mObjInf
{
{
{0.0f, 0.0f, 0.0f}, // mCenter
40.0f, // mRadius
400.0f // mHeight
} // mCyl
} // mCylAttr
};
void daObjWindow_c::initBaseMtx() {
mpModel->calc();
mpModel->setBaseScale(scale);
setBaseMtx();
}
void daObjWindow_c::setBaseMtx() {
mDoMtx_stack_c::transS(current.pos);
mDoMtx_stack_c::YrotM(current.angle.y);
mpModel->setBaseTRMtx(mDoMtx_stack_c::get());
if (mpBckAnm != NULL) {
MTXCopy(mpModel->getAnmMtx(0), mBgMtx);
} else {
MTXCopy(mpModel->getBaseTRMtx(), mBgMtx);
}
}
int daObjWindow_c::Create() {
initBaseMtx();
fopAcM_SetMtx(this, mpModel->getBaseTRMtx());
fopAcM_setCullSizeBox(this, -250.0f, 600.0f, -250.0f, 250.0f, 0.0f, 250.0f);
if (mType == 1) {
mStts.Init(0xff, 0xff, this);
mCyl.Set(l_cyl_src);
mCyl.SetStts(&mStts);
}
u8 light = getLightInf();
tevStr.mLightInf.r = light;
return 1;
}
int daObjWindow_c::CreateHeap() {
J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes(l_arcName, 9);
JUT_ASSERT(251, modelData != NULL);
mpModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000084);
if (mpModel == NULL) {
return 0;
}
if (l_bck[mType] > 0) {
J3DAnmTransform* pbck = (J3DAnmTransform*)dComIfG_getObjectRes(l_arcName, l_bck[mType]);
JUT_ASSERT(266, pbck != NULL);
mpBckAnm = new mDoExt_bckAnm();
if (mpBckAnm == NULL || !mpBckAnm->init(pbck, 1, 2, 1.0f, 0, -1, false)) {
return 0;
}
}
return 1;
}
cPhs_Step daObjWindow_c::create1st() {
mType = getType();
if (mType == 0xff) {
mType = 0;
}
cPhs_Step step = dComIfG_resLoad(&mPhaseReq, l_arcName);
if (step == cPhs_COMPLEATE_e) {
step = MoveBGCreate(l_arcName, 12, NULL, 0xee0, NULL);
if (step == cPhs_ERROR_e) {
return step;
}
}
return step;
}
int daObjWindow_c::Execute(Mtx** i_mtx) {
if (mpBckAnm != NULL) {
mpBckAnm->play();
f32 frame = mpBckAnm->getFrame();
if (frame == 164.0f || frame == 757.0f) {
fopAcM_seStart(this, Z2SE_OBJ_SPIRALSTEP_DOOR_BOUND, 0);
}
if (frame < 125.0f) {
fopAcM_seStartLevel(this, Z2SE_OBJ_SPIRALSTEP_DOOR_1, 0);
} else if (frame < 264.0f) {
fopAcM_seStartLevel(this, Z2SE_OBJ_SPIRALSTEP_DOOR_2, 0);
} else if (frame < 364.0f) {
fopAcM_seStartLevel(this, Z2SE_OBJ_SPIRALSTEP_DOOR_3, 0);
} else if (frame < 464.0f) {
fopAcM_seStartLevel(this, Z2SE_OBJ_SPIRALSTEP_DOOR_4, 0);
} else if (frame < 544.0f) {
fopAcM_seStartLevel(this, Z2SE_OBJ_SPIRALSTEP_DOOR_5, 0);
} else if (frame < 714.0f) {
fopAcM_seStartLevel(this, Z2SE_OBJ_SPIRALSTEP_DOOR_6, 0);
} else if (frame < 829.0f) {
fopAcM_seStartLevel(this, Z2SE_OBJ_SPIRALSTEP_DOOR_7, 0);
} else {
fopAcM_seStartLevel(this, Z2SE_OBJ_SPIRALSTEP_DOOR_8, 0);
}
}
*i_mtx = &mBgMtx;
setBaseMtx();
if (mType == 1) {
cXyz center(-50.0f, 0.0f, -50.0f);
mDoMtx_stack_c::transS(current.pos);
mDoMtx_stack_c::YrotM(shape_angle.y);
mDoMtx_stack_c::multVec(&center, &center);
mCyl.SetC(center);
mCyl.SetR(80.0f);
dComIfG_Ccsp()->Set(&mCyl);
}
return 1;
}
int daObjWindow_c::Draw() {
g_env_light.settingTevStruct(0x14, &current.pos, &tevStr);
g_env_light.setLightTevColorType_MAJI(mpModel, &tevStr);
dComIfGd_setListBG();
if (mpBckAnm != NULL) {
mpBckAnm->entry(mpModel->getModelData());
}
mDoExt_modelUpdateDL(mpModel);
mDoExt_bckAnmRemove(mpModel->getModelData());
dComIfGd_setList();
return 1;
}
int daObjWindow_c::Delete() {
dComIfG_resDelete(&mPhaseReq, l_arcName);
return 1;
}
static cPhs_Step daObjWindow_create1st(daObjWindow_c* i_this) {
fopAcM_ct(i_this, daObjWindow_c);
return i_this->create1st();
}
static int daObjWindow_MoveBGDelete(daObjWindow_c* i_this) {
return i_this->MoveBGDelete();
}
static int daObjWindow_MoveBGExecute(daObjWindow_c* i_this) {
return i_this->MoveBGExecute();
}
static int daObjWindow_MoveBGDraw(daObjWindow_c* i_this) {
return i_this->MoveBGDraw();
}
static actor_method_class daObjWindow_METHODS = {
(process_method_func)daObjWindow_create1st,
(process_method_func)daObjWindow_MoveBGDelete,
(process_method_func)daObjWindow_MoveBGExecute,
(process_method_func)NULL,
(process_method_func)daObjWindow_MoveBGDraw,
};
actor_process_profile_definition g_profile_Obj_Window = {
/* Layer ID */ fpcLy_CURRENT_e,
/* List ID */ 3,
/* List Prio */ fpcPi_CURRENT_e,
/* Proc Name */ fpcNm_Obj_Window_e,
/* Proc SubMtd */ &g_fpcLf_Method.base,
/* Size */ sizeof(daObjWindow_c),
/* Size Other */ 0,
/* Parameters */ 0,
/* Leaf SubMtd */ &g_fopAc_Method.base,
/* Draw Prio */ fpcDwPi_Obj_Window_e,
/* Actor SubMtd */ &daObjWindow_METHODS,
/* Status */ fopAcStts_UNK_0x40000_e | fopAcStts_CULL_e,
/* Group */ fopAc_ACTOR_e,
/* Cull Type */ fopAc_CULLBOX_CUSTOM_e,
};