mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-06-05 02:37:50 -04:00
56890c32e8
* 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>
179 lines
4.8 KiB
C++
179 lines
4.8 KiB
C++
/**
|
|
* d_a_obj_barDesk.cpp
|
|
* Object - Table
|
|
*/
|
|
|
|
#include "d/dolzel_rel.h" // IWYU pragma: keep
|
|
|
|
#include "d/actor/d_a_obj_barDesk.h"
|
|
#include "f_pc/f_pc_name.h"
|
|
#include "d/d_bg_w.h"
|
|
#include "d/d_com_inf_game.h"
|
|
|
|
static daBarDesk_HIO_c l_HIO;
|
|
|
|
dCcD_SrcGObjInf const daBarDesk_c::mCcDObjInfo = {
|
|
{0, {{0, 0, 0}, {0xD8FAFDBF, 0x11}, {0}}},
|
|
{1, 0, 0, 0, 0},
|
|
{0xA, 0, 0, 0, 6},
|
|
{0}
|
|
};
|
|
|
|
dCcD_SrcCyl daBarDesk_c::mCcDCyl = {
|
|
mCcDObjInfo,
|
|
{
|
|
{{0.0f, 0.0f, 0.0f}, 0.0f, 0.0f}
|
|
}
|
|
};
|
|
|
|
daBarDesk_HIO_c::daBarDesk_HIO_c() : field_0x4(10), field_0x5(3) {
|
|
/* empty function */
|
|
}
|
|
|
|
void daBarDesk_c::setBaseMtx() {
|
|
mDoMtx_stack_c::transS(current.pos.x, current.pos.y, current.pos.z);
|
|
mDoMtx_stack_c::ZXYrotM(shape_angle.x, shape_angle.y, shape_angle.z);
|
|
mpModel->setBaseScale(scale);
|
|
mpModel->setBaseTRMtx(mDoMtx_stack_c::get());
|
|
}
|
|
|
|
int daBarDesk_c::CreateHeap() {
|
|
J3DModelData* model_data = (J3DModelData*)dComIfG_getObjectRes("KHdesk", 4);
|
|
mpModel = mDoExt_J3DModel__create(model_data, 0x80000, 0x11000084);
|
|
if (mpModel == NULL) {
|
|
return 0;
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
cPhs_Step daBarDesk_c::create() {
|
|
fopAcM_ct(this, daBarDesk_c);
|
|
if (fopAcM_isSwitch(this, (u8)fopAcM_GetParam(this))) {
|
|
return cPhs_ERROR_e;
|
|
}
|
|
cPhs_Step step = dComIfG_resLoad(&mPhase, "KHdesk");
|
|
if (step == cPhs_COMPLEATE_e) {
|
|
if (MoveBGCreate("KHdesk", 7, dBgS_MoveBGProc_TypicalRotY, 0xe50, NULL) == cPhs_ERROR_e) {
|
|
return cPhs_ERROR_e;
|
|
}
|
|
fopAcM_SetMtx(this, mpModel->getBaseTRMtx());
|
|
fopAcM_setCullSizeBox2(this, mpModel->getModelData());
|
|
mColStatus.Init(0xff, 0xff, this);
|
|
mColCyl.Set(mCcDCyl);
|
|
mColCyl.SetStts(&mColStatus);
|
|
init_modeWait();
|
|
setBaseMtx();
|
|
}
|
|
return step;
|
|
}
|
|
|
|
int daBarDesk_c::Execute(Mtx** i_mtxP) {
|
|
windowProc();
|
|
*i_mtxP = &mpModel->getBaseTRMtx();
|
|
setBaseMtx();
|
|
return 1;
|
|
}
|
|
|
|
void daBarDesk_c::windowProc() {
|
|
typedef void (daBarDesk_c::*daBarDesk_modeFunc)();
|
|
static const daBarDesk_modeFunc mode_proc[2] = {
|
|
&daBarDesk_c::modeWait,
|
|
&daBarDesk_c::modeBreak,
|
|
};
|
|
(this->*mode_proc[mMode])();
|
|
}
|
|
|
|
void daBarDesk_c::init_modeWait() {
|
|
mMode = 0;
|
|
}
|
|
|
|
void daBarDesk_c::modeWait() {
|
|
if (mColCyl.ChkTgHit()) {
|
|
if (mpBgW != NULL) {
|
|
dComIfG_Bgsp().Release(mpBgW);
|
|
}
|
|
init_modeBreak();
|
|
}
|
|
mColCyl.SetR(90.0f);
|
|
mColCyl.SetH(90.0f);
|
|
mColCyl.SetC(current.pos);
|
|
dComIfG_Ccsp()->Set(&mColCyl);
|
|
mColCyl.ClrTgHit();
|
|
}
|
|
|
|
void daBarDesk_c::init_modeBreak() {
|
|
mDoAud_seStart(Z2SE_OBJ_TABLE_BRAKE, ¤t.pos, 0,
|
|
dComIfGp_getReverb(fopAcM_GetRoomNo(this)));
|
|
setBreakEffect();
|
|
dComIfGp_getVibration().StartShock(l_HIO.field_0x5, 15, cXyz(0.0f, 1.0f, 0.0f));
|
|
fopAcM_onSwitch(this, (u8)fopAcM_GetParam(this));
|
|
mMode = 1;
|
|
}
|
|
|
|
void daBarDesk_c::modeBreak() {
|
|
fopAcM_delete(this);
|
|
}
|
|
|
|
void daBarDesk_c::setBreakEffect() {
|
|
static const u16 particle_id[2] = {0x85F4, 0x85F5};
|
|
for (int i = 0; i < 2; i++) {
|
|
dComIfGp_particle_set(particle_id[i], ¤t.pos, NULL, &scale,
|
|
0xff, NULL, -1, NULL, NULL, NULL);
|
|
}
|
|
}
|
|
|
|
int daBarDesk_c::Draw() {
|
|
g_env_light.settingTevStruct(0x10, ¤t.pos, &tevStr);
|
|
g_env_light.setLightTevColorType_MAJI(mpModel, &tevStr);
|
|
dComIfGd_setListBG();
|
|
mDoExt_modelUpdateDL(mpModel);
|
|
dComIfGd_setList();
|
|
return 1;
|
|
}
|
|
|
|
int daBarDesk_c::Delete() {
|
|
dComIfG_resDelete(&mPhase, "KHdesk");
|
|
return 1;
|
|
}
|
|
|
|
static int daBarDesk_Draw(daBarDesk_c* i_this) {
|
|
return i_this->MoveBGDraw();
|
|
}
|
|
|
|
static int daBarDesk_Execute(daBarDesk_c* i_this) {
|
|
return i_this->MoveBGExecute();
|
|
}
|
|
|
|
static int daBarDesk_Delete(daBarDesk_c* i_this) {
|
|
return i_this->MoveBGDelete();
|
|
}
|
|
|
|
static cPhs_Step daBarDesk_Create(fopAc_ac_c* i_this) {
|
|
return static_cast<daBarDesk_c*>(i_this)->create();
|
|
}
|
|
|
|
static actor_method_class l_daBarDesk_Method = {
|
|
(process_method_func)daBarDesk_Create,
|
|
(process_method_func)daBarDesk_Delete,
|
|
(process_method_func)daBarDesk_Execute,
|
|
(process_method_func)NULL,
|
|
(process_method_func)daBarDesk_Draw,
|
|
};
|
|
|
|
actor_process_profile_definition g_profile_Obj_BarDesk = {
|
|
/* Layer ID */ fpcLy_CURRENT_e,
|
|
/* List ID */ 3,
|
|
/* List Prio */ fpcPi_CURRENT_e,
|
|
/* Proc Name */ fpcNm_Obj_BarDesk_e,
|
|
/* Proc SubMtd */ &g_fpcLf_Method.base,
|
|
/* Size */ sizeof(daBarDesk_c),
|
|
/* Size Other */ 0,
|
|
/* Parameters */ 0,
|
|
/* Leaf SubMtd */ &g_fopAc_Method.base,
|
|
/* Draw Prio */ fpcDwPi_Obj_BarDesk_e,
|
|
/* Actor SubMtd */ &l_daBarDesk_Method,
|
|
/* Status */ fopAcStts_UNK_0x40000_e | fopAcStts_CULL_e,
|
|
/* Group */ fopAc_ACTOR_e,
|
|
/* Cull Type */ fopAc_CULLBOX_CUSTOM_e,
|
|
};
|