mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-06-03 01:58:44 -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>
226 lines
5.8 KiB
C++
226 lines
5.8 KiB
C++
/**
|
|
* @file d_a_obj_bed.cpp
|
|
*
|
|
*/
|
|
|
|
#include "d/dolzel_rel.h" // IWYU pragma: keep
|
|
|
|
#include "d/actor/d_a_obj_bed.h"
|
|
#include "d/d_bg_w.h"
|
|
#include "d/d_com_inf_game.h"
|
|
#include "m_Do/m_Do_ext.h"
|
|
#include "d/actor/d_a_npc.h"
|
|
#include "f_pc/f_pc_name.h"
|
|
|
|
static char* l_resName = "KH_Bed";
|
|
|
|
static OBJ_BED_HIO_CLASS l_HIO;
|
|
|
|
#if DEBUG
|
|
daObj_Bed_HIO_c::daObj_Bed_HIO_c() {
|
|
m = daObj_Bed_Param_c::m;
|
|
}
|
|
|
|
void daObj_Bed_HIO_c::listenPropertyEvent(const JORPropertyEvent* event) {
|
|
// NONMATCHING
|
|
}
|
|
|
|
void daObj_Bed_HIO_c::genMessage(JORMContext* ctx) {
|
|
// NONMATCHING
|
|
}
|
|
#endif
|
|
|
|
daObj_Bed_HIOParam const daObj_Bed_Param_c::m = {0, -3.0f, 1.0f, 600.0f};
|
|
|
|
daObj_Bed_c::~daObj_Bed_c() {
|
|
if (mpCollider != NULL) {
|
|
dComIfG_Bgsp().Release(mpCollider);
|
|
}
|
|
|
|
#if DEBUG
|
|
if (mpHIO != NULL) {
|
|
mpHIO->removeHIO();
|
|
}
|
|
#endif
|
|
|
|
dComIfG_resDelete(&mPhase, getResName());
|
|
}
|
|
|
|
cPhs_Step daObj_Bed_c::create() {
|
|
fopAcM_ct(this, daObj_Bed_c);
|
|
mType = getType();
|
|
cPhs_Step step = dComIfG_resLoad(&mPhase, getResName());
|
|
if (step == cPhs_COMPLEATE_e) {
|
|
if (isDelete()) {
|
|
return cPhs_ERROR_e;
|
|
}
|
|
if (!fopAcM_entrySolidHeap(this, createHeapCallBack, 0x2520)) {
|
|
return cPhs_ERROR_e;
|
|
}
|
|
if (mpCollider != NULL) {
|
|
if (dComIfG_Bgsp().Regist(mpCollider, this) == true) {
|
|
return cPhs_ERROR_e;
|
|
}
|
|
}
|
|
fopAcM_SetMtx(this, mpModel->getBaseTRMtx());
|
|
fopAcM_setCullSizeBox(this, -200.0f, -100.0f, -200.0f, 200.0f, 200.0f, 200.0f);
|
|
|
|
#if DEBUG
|
|
mpHIO = &l_HIO;
|
|
mpHIO->entryHIO("ベッド");
|
|
#endif
|
|
|
|
mAcch.Set(¤t.pos, &old.pos, this, 1, &mAcchCir,
|
|
&speed, ¤t.angle, &shape_angle);
|
|
mAcch.CrrPos(dComIfG_Bgsp());
|
|
mGndChk = mAcch.m_gnd;
|
|
mGroundH = mAcch.GetGroundH();
|
|
if (mGroundH != -G_CM3D_F_INF) {
|
|
setEnvTevColor();
|
|
setRoomNo();
|
|
}
|
|
Execute();
|
|
}
|
|
return step;
|
|
}
|
|
|
|
int daObj_Bed_c::CreateHeap() {
|
|
J3DModelData* model_data = (J3DModelData*)dComIfG_getObjectRes(getResName(), 4);
|
|
if (model_data == NULL) {
|
|
return 0;
|
|
}
|
|
mpModel = mDoExt_J3DModel__create(model_data, 0x80000, 0x11000084);
|
|
if (mpModel == NULL) {
|
|
return 0;
|
|
}
|
|
mpCollider = new dBgW();
|
|
if (mpCollider == NULL) {
|
|
return 0;
|
|
}
|
|
cBgD_t* dzb = (cBgD_t*)dComIfG_getObjectRes(getResName(), 7);
|
|
if (mpCollider->Set(dzb, 1, &mMtx) == true) {
|
|
return 0;
|
|
}
|
|
mpCollider->SetCrrFunc(dBgS_MoveBGProc_Typical);
|
|
return 1;
|
|
}
|
|
|
|
int daObj_Bed_c::Delete() {
|
|
this->~daObj_Bed_c();
|
|
return 1;
|
|
}
|
|
|
|
int daObj_Bed_c::Execute() {
|
|
mAcch.CrrPos(dComIfG_Bgsp());
|
|
mGndChk = mAcch.m_gnd;
|
|
mGroundH = mAcch.GetGroundH();
|
|
if (mGroundH != -G_CM3D_F_INF) {
|
|
setEnvTevColor();
|
|
setRoomNo();
|
|
}
|
|
setMtx();
|
|
if (mpCollider != NULL) {
|
|
PSMTXCopy(mpModel->getBaseTRMtx(), mMtx);
|
|
mpCollider->Move();
|
|
}
|
|
eyePos = attention_info.position = current.pos;
|
|
attention_info.flags = 0;
|
|
return 1;
|
|
}
|
|
|
|
int daObj_Bed_c::Draw() {
|
|
g_env_light.settingTevStruct(0, ¤t.pos, &tevStr);
|
|
g_env_light.setLightTevColorType_MAJI(mpModel, &tevStr);
|
|
mDoExt_modelUpdateDL(mpModel);
|
|
if (mGroundH != -G_CM3D_F_INF) {
|
|
mShadow = dComIfGd_setShadow(mShadow, 1, mpModel, ¤t.pos,
|
|
mpHIO->m.field_0xc, 20.0f,
|
|
current.pos.y, mGroundH, mGndChk, &tevStr, 0,
|
|
1.0f, &dDlst_shadowControl_c::mSimpleTexObj);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
int daObj_Bed_c::createHeapCallBack(fopAc_ac_c* i_this) {
|
|
return static_cast<daObj_Bed_c*>(i_this)->CreateHeap();
|
|
}
|
|
|
|
u8 daObj_Bed_c::getType() {
|
|
return 0;
|
|
}
|
|
|
|
char* daObj_Bed_c::getResName() {
|
|
return l_resName;
|
|
}
|
|
|
|
int daObj_Bed_c::isDelete() {
|
|
switch (mType) {
|
|
case 0:
|
|
return daNpcT_chkEvtBit(0x108) == 0;
|
|
default:
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
void daObj_Bed_c::setEnvTevColor() {
|
|
tevStr.YukaCol = dComIfG_Bgsp().GetPolyColor(mGndChk);
|
|
tevStr.room_no = dComIfG_Bgsp().GetRoomId(mGndChk);
|
|
}
|
|
|
|
void daObj_Bed_c::setRoomNo() {
|
|
fopAcM_SetRoomNo(this, dComIfG_Bgsp().GetRoomId(mGndChk));
|
|
}
|
|
|
|
void daObj_Bed_c::setMtx() {
|
|
mDoMtx_stack_c::transS(current.pos.x, current.pos.y, current.pos.z);
|
|
mDoMtx_stack_c::ZXYrotM(shape_angle);
|
|
mDoMtx_stack_c::scaleM(scale);
|
|
mpModel->setBaseTRMtx(mDoMtx_stack_c::get());
|
|
}
|
|
|
|
|
|
static cPhs_Step daObj_Bed_Create(void* i_this) {
|
|
return static_cast<daObj_Bed_c*>(i_this)->create();
|
|
}
|
|
|
|
static int daObj_Bed_Delete(void* i_this) {
|
|
return static_cast<daObj_Bed_c*>(i_this)->Delete();
|
|
}
|
|
|
|
static int daObj_Bed_Execute(void* i_this) {
|
|
return static_cast<daObj_Bed_c*>(i_this)->Execute();
|
|
}
|
|
|
|
static int daObj_Bed_Draw(void* i_this) {
|
|
return static_cast<daObj_Bed_c*>(i_this)->Draw();
|
|
}
|
|
|
|
static int daObj_Bed_IsDelete(void* param_0) {
|
|
return 1;
|
|
}
|
|
|
|
static actor_method_class daObj_Bed_MethodTable = {
|
|
(process_method_func)daObj_Bed_Create,
|
|
(process_method_func)daObj_Bed_Delete,
|
|
(process_method_func)daObj_Bed_Execute,
|
|
(process_method_func)daObj_Bed_IsDelete,
|
|
(process_method_func)daObj_Bed_Draw,
|
|
};
|
|
|
|
actor_process_profile_definition g_profile_OBJ_BED = {
|
|
/* Layer ID */ fpcLy_CURRENT_e,
|
|
/* List ID */ 7,
|
|
/* List Prio */ fpcPi_CURRENT_e,
|
|
/* Proc Name */ fpcNm_OBJ_BED_e,
|
|
/* Proc SubMtd */ &g_fpcLf_Method.base,
|
|
/* Size */ sizeof(daObj_Bed_c),
|
|
/* Size Other */ 0,
|
|
/* Parameters */ 0,
|
|
/* Leaf SubMtd */ &g_fopAc_Method.base,
|
|
/* Draw Prio */ fpcDwPi_OBJ_BED_e,
|
|
/* Actor SubMtd */ &daObj_Bed_MethodTable,
|
|
/* Status */ fopAcStts_UNK_0x40000_e | fopAcStts_UNK_0x4000_e | fopAcStts_CULL_e,
|
|
/* Group */ fopAc_ACTOR_e,
|
|
/* Cull Type */ fopAc_CULLBOX_CUSTOM_e,
|
|
};
|