mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-05-30 16:35:26 -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>
132 lines
3.8 KiB
C++
132 lines
3.8 KiB
C++
/*
|
|
* d_a_obj_bombf.cpp
|
|
* Bomb Flower
|
|
*/
|
|
|
|
#include "d/dolzel_rel.h" // IWYU pragma: keep
|
|
|
|
#include "d/actor/d_a_obj_bombf.h"
|
|
#include "f_pc/f_pc_name.h"
|
|
|
|
static const char l_arcName[] = "Bombf";
|
|
|
|
bool daObjBombf_c::createHeap() {
|
|
field_0x570 = mDoExt_J3DModel__create((J3DModelData*)dComIfG_getObjectRes(l_arcName, 4),
|
|
0x80000, 0x11000084);
|
|
return (field_0x570 != NULL);
|
|
}
|
|
|
|
static bool daObjBombf_createHeap(fopAc_ac_c* i_this) {
|
|
return static_cast<daObjBombf_c*>(i_this)->createHeap();
|
|
}
|
|
|
|
int daObjBombf_c::create() {
|
|
fopAcM_ct(this, daObjBombf_c);
|
|
|
|
int phase = dComIfG_resLoad(&field_0x568, l_arcName);
|
|
if (phase == cPhs_COMPLEATE_e) {
|
|
if (!fopAcM_entrySolidHeap(this, (heapCallbackFunc)daObjBombf_createHeap, 0x820)) {
|
|
return cPhs_ERROR_e;
|
|
}
|
|
|
|
fopAcM_SetMtx(this, field_0x570->getBaseTRMtx());
|
|
tevStr.room_no = fopAcM_GetRoomNo(this);
|
|
attention_info.position = current.pos;
|
|
eyePos = attention_info.position;
|
|
field_0x574 = 0xffffffff;
|
|
setMatrix();
|
|
fopAcM_SetMin(this, -75.0f, 0.0f, -75.0f);
|
|
fopAcM_SetMax(this, 75.0f, 30.0f, 75.0f);
|
|
}
|
|
|
|
return phase;
|
|
}
|
|
|
|
static int daObjBombf_Create(fopAc_ac_c* i_this) {
|
|
return static_cast<daObjBombf_c*>(i_this)->create();
|
|
}
|
|
|
|
daObjBombf_c::~daObjBombf_c() {
|
|
dComIfG_resDelete(&field_0x568, l_arcName);
|
|
}
|
|
|
|
static int daObjBombf_Delete(daObjBombf_c* i_this) {
|
|
i_this->~daObjBombf_c();
|
|
return 1;
|
|
}
|
|
|
|
void daObjBombf_c::setMatrix() {
|
|
mDoMtx_stack_c::transS(current.pos.x, current.pos.y + field_0x584, current.pos.z);
|
|
mDoMtx_stack_c::ZXYrotM(shape_angle.x, shape_angle.y, shape_angle.z);
|
|
MTXCopy(mDoMtx_stack_c::now, field_0x570->mBaseTransformMtx);
|
|
}
|
|
|
|
static const Vec bombOffset = {0.0f, 7.0f, 0.0f};
|
|
|
|
int daObjBombf_c::execute() {
|
|
u32 uVar;
|
|
cXyz vStack;
|
|
|
|
setMatrix();
|
|
|
|
if (field_0x574 == -1) {
|
|
if (field_0x578 != 0) {
|
|
field_0x578--;
|
|
} else {
|
|
mDoMtx_multVec(field_0x570->getBaseTRMtx(), &bombOffset, &vStack);
|
|
|
|
fopAc_ac_c* bomb_actor =
|
|
dBomb_c::createFlowerBomb(&vStack, &shape_angle, fopAcM_GetRoomNo(this));
|
|
field_0x574 = fopAcM_GetID(bomb_actor);
|
|
}
|
|
} else {
|
|
fopAc_ac_c* actor = fopAcM_SearchByID(field_0x574);
|
|
|
|
if (actor == NULL) {
|
|
field_0x574 = -1;
|
|
field_0x578 = 150;
|
|
} else if (dBomb_c::checkFlowerBombWait(actor)) {
|
|
mDoMtx_multVec(field_0x570->getBaseTRMtx(), &bombOffset, &actor->current.pos);
|
|
}
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
static int daObjBombf_Execute(daObjBombf_c* i_this) {
|
|
return i_this->execute();
|
|
}
|
|
|
|
int daObjBombf_c::draw() {
|
|
g_env_light.settingTevStruct(0, ¤t.pos, &tevStr);
|
|
g_env_light.setLightTevColorType_MAJI(field_0x570, &tevStr);
|
|
mDoExt_modelUpdateDL(field_0x570);
|
|
return 1;
|
|
}
|
|
|
|
static int daObjBombf_Draw(daObjBombf_c* i_this) {
|
|
return i_this->draw();
|
|
}
|
|
|
|
static actor_method_class l_daObjBombf_Method = {
|
|
(process_method_func)daObjBombf_Create, (process_method_func)daObjBombf_Delete,
|
|
(process_method_func)daObjBombf_Execute, (process_method_func)NULL,
|
|
(process_method_func)daObjBombf_Draw,
|
|
};
|
|
|
|
actor_process_profile_definition g_profile_Obj_Bombf = {
|
|
/* Layer ID */ fpcLy_CURRENT_e,
|
|
/* List ID */ 7,
|
|
/* List Prio */ fpcPi_CURRENT_e,
|
|
/* Proc Name */ fpcNm_Obj_Bombf_e,
|
|
/* Proc SubMtd */ &g_fpcLf_Method.base,
|
|
/* Size */ sizeof(daObjBombf_c),
|
|
/* Size Other */ 0,
|
|
/* Parameters */ 0,
|
|
/* Leaf SubMtd */ &g_fopAc_Method.base,
|
|
/* Draw Prio */ fpcDwPi_Obj_Bombf_e,
|
|
/* Actor SubMtd */ &l_daObjBombf_Method,
|
|
/* Status */ fopAcStts_UNK_0x40000_e | fopAcStts_CULL_e,
|
|
/* Group */ fopAc_ENV_e,
|
|
/* Cull Type */ fopAc_CULLBOX_CUSTOM_e,
|
|
};
|