mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-05-28 16:00:40 -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>
253 lines
6.3 KiB
C++
253 lines
6.3 KiB
C++
/**
|
|
* @file d_a_obj_lv6egate.cpp
|
|
*
|
|
*/
|
|
|
|
#include "d/dolzel_rel.h" // IWYU pragma: keep
|
|
|
|
#include "d/actor/d_a_obj_lv6egate.h"
|
|
|
|
static char* l_arcName = "LV6EGATE";
|
|
|
|
const int l_dzbidx = 3;
|
|
|
|
int daObjLv6EGate_c::create1st() {
|
|
int phase_state = dComIfG_resLoad(this, l_arcName);
|
|
if (phase_state == cPhs_COMPLEATE_e) {
|
|
setMtx();
|
|
phase_state = MoveBGCreate(l_arcName, l_dzbidx, dBgS_MoveBGProc_TypicalRotY, 0x7B0, &field_0x5a8);
|
|
if (phase_state == cPhs_ERROR_e) {
|
|
return phase_state;
|
|
}
|
|
}
|
|
|
|
return phase_state;
|
|
}
|
|
|
|
void daObjLv6EGate_c::setMtx() {
|
|
mDoMtx_stack_c::transS(current.pos.x, current.pos.y, current.pos.z);
|
|
mDoMtx_stack_c::YrotM(current.angle.y);
|
|
MTXCopy(mDoMtx_stack_c::get(), field_0x5d8);
|
|
MTXCopy(mDoMtx_stack_c::get(), field_0x5a8);
|
|
}
|
|
|
|
int daObjLv6EGate_c::CreateHeap() {
|
|
return 1;
|
|
}
|
|
|
|
static const cull_box l_cull_box = {
|
|
{-500.0f, 0.0f, -50.0f},
|
|
{500.0f, 300.0f, 50.0f},
|
|
};
|
|
|
|
static dCcD_SrcCyl l_cc_cyl_src = {
|
|
{
|
|
{0x0, {{0x0, 0x2, 0x0}, {0x400, 0x11}, 0x79}}, // mObj
|
|
{dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x0}, // mGObjAt
|
|
{dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x2}, // mGObjTg
|
|
{0x0}, // mGObjCo
|
|
}, // mObjInf
|
|
{
|
|
{
|
|
{0.0f, 0.0f, 0.0f}, // mCenter
|
|
30.0f, // mRadius
|
|
300.0f // mHeight
|
|
} // mCyl
|
|
}
|
|
};
|
|
|
|
static dCcD_SrcCyl l_at_cyl_src = {
|
|
{
|
|
{0x0, {{0x100, 0x2, 0xd}, {0x400, 0x0}, 0x11}}, // mObj
|
|
{dCcD_SE_NONE, 0x0, 0xd, 0x0, 0x0}, // mGObjAt
|
|
{dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x2}, // mGObjTg
|
|
{0x0}, // mGObjCo
|
|
}, // mObjInf
|
|
{
|
|
{
|
|
{0.0f, 0.0f, 0.0f}, // mCenter
|
|
50.0f, // mRadius
|
|
300.0f // mHeight
|
|
} // mCyl
|
|
}
|
|
};
|
|
|
|
static u8 l_local_cyl[] = {
|
|
0xC3, 0x91, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x43, 0x91, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
};
|
|
|
|
int daObjLv6EGate_c::Create() {
|
|
fopAcM_SetMtx(this, field_0x5d8);
|
|
fopAcM_setCullSizeBox(this, l_cull_box.min.x, l_cull_box.min.y, l_cull_box.min.z, l_cull_box.max.x, l_cull_box.max.y, l_cull_box.max.z);
|
|
mCcStts.Init(255, 0, this);
|
|
|
|
for (int i = 0; i < 8; i++) {
|
|
mAtCyl[i].Set(l_at_cyl_src);
|
|
mAtCyl[i].SetStts(&mCcStts);
|
|
mAtCyl[i].SetAtMtrl(dCcD_MTRL_ELECTRIC);
|
|
}
|
|
|
|
if (getSwNo() == 0xFF) {
|
|
onDisp();
|
|
} else if (getType() != 0) {
|
|
if (fopAcM_isSwitch(this, getSwNo())) {
|
|
onDisp();
|
|
} else {
|
|
offDisp();
|
|
}
|
|
} else if (fopAcM_isSwitch(this, getSwNo())) {
|
|
offDisp();
|
|
} else {
|
|
onDisp();
|
|
}
|
|
|
|
field_0x1025 = 0;
|
|
|
|
for (int i = 0; i < 4; i++) {
|
|
mEmtId[i] = 0;
|
|
}
|
|
|
|
return 1;
|
|
}
|
|
|
|
void daObjLv6EGate_c::offDisp() {
|
|
mElecOff = true;
|
|
|
|
if (mpBgW->ChkUsed()) {
|
|
int result = dComIfG_Bgsp().Release(mpBgW);
|
|
JUT_ASSERT(301, result == 0);
|
|
}
|
|
}
|
|
|
|
void daObjLv6EGate_c::onDisp() {
|
|
mElecOff = false;
|
|
|
|
if (!mpBgW->ChkUsed()) {
|
|
int result = dComIfG_Bgsp().Regist(mpBgW, this);
|
|
JUT_ASSERT(313, result == 0);
|
|
}
|
|
}
|
|
|
|
int daObjLv6EGate_c::Execute(Mtx** param_0) {
|
|
if (getSwNo() != 0xFF) {
|
|
if (getType() != 0) {
|
|
if (fopAcM_isSwitch(this, getSwNo())) {
|
|
onDisp();
|
|
} else {
|
|
offDisp();
|
|
}
|
|
} else if (fopAcM_isSwitch(this, getSwNo())) {
|
|
offDisp();
|
|
} else {
|
|
onDisp();
|
|
}
|
|
}
|
|
|
|
setMtx();
|
|
*param_0 = &field_0x5a8;
|
|
|
|
if (mElecOff) {
|
|
return 1;
|
|
}
|
|
|
|
bool at_cyl_hit = false;
|
|
if (field_0x1025 == 0) {
|
|
for (int i = 0; i < 8; i++) {
|
|
if (mAtCyl[i].ChkAtHit()) {
|
|
Z2GetAudioMgr()->seStart(Z2SE_OBJ_L6_ELK_GATE_TOUCH, mAtCyl[i].GetCP(), 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0);
|
|
at_cyl_hit = true;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (at_cyl_hit) {
|
|
field_0x1025 = 1;
|
|
} else {
|
|
field_0x1025 = 0;
|
|
}
|
|
|
|
Z2GetAudioMgr()->seStartLevel(Z2SE_OBJ_L6_ELK_GATE_LV, ¤t.pos, 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0);
|
|
|
|
cXyz cyl_pos;
|
|
f32 var_f31 = -280.0f;
|
|
f32 temp_f30 = (330.0f - var_f31) / 8.0f;
|
|
for (int i = 0; i < 8; i++) {
|
|
cXyz local_pos;
|
|
local_pos.x = var_f31;
|
|
local_pos.y = 0.0f;
|
|
local_pos.z = 0.0f;
|
|
PSMTXMultVec(field_0x5a8, &local_pos, &cyl_pos);
|
|
mAtCyl[i].SetC(cyl_pos);
|
|
dComIfG_Ccsp()->Set(&mAtCyl[i]);
|
|
|
|
var_f31 += temp_f30;
|
|
}
|
|
|
|
cXyz effpos(current.pos);
|
|
effpos.y += 30.0f;
|
|
for (int i = 0; i < 4; i++) {
|
|
mEmtId[i] = dComIfGp_particle_set(mEmtId[i], dPa_RM(ID_ZI_S_ELECGATE_A), &effpos, &shape_angle, NULL);
|
|
effpos.y += 50.0f;
|
|
}
|
|
|
|
return 1;
|
|
}
|
|
|
|
int daObjLv6EGate_c::Draw() {
|
|
if (mElecOff) {
|
|
return 1;
|
|
}
|
|
|
|
return 1;
|
|
}
|
|
|
|
int daObjLv6EGate_c::Delete() {
|
|
dComIfG_resDelete(this, l_arcName);
|
|
return 1;
|
|
}
|
|
|
|
static int daObjLv6EGate_create1st(daObjLv6EGate_c* i_this) {
|
|
fopAcM_ct(i_this, daObjLv6EGate_c);
|
|
return i_this->create1st();
|
|
}
|
|
|
|
static int daObjLv6EGate_MoveBGDelete(daObjLv6EGate_c* i_this) {
|
|
return i_this->MoveBGDelete();
|
|
}
|
|
|
|
static int daObjLv6EGate_MoveBGExecute(daObjLv6EGate_c* i_this) {
|
|
return i_this->MoveBGExecute();
|
|
}
|
|
|
|
static int daObjLv6EGate_MoveBGDraw(daObjLv6EGate_c* i_this) {
|
|
return i_this->MoveBGDraw();
|
|
}
|
|
|
|
static actor_method_class daObjLv6EGate_METHODS = {
|
|
(process_method_func)daObjLv6EGate_create1st,
|
|
(process_method_func)daObjLv6EGate_MoveBGDelete,
|
|
(process_method_func)daObjLv6EGate_MoveBGExecute,
|
|
NULL,
|
|
(process_method_func)daObjLv6EGate_MoveBGDraw,
|
|
};
|
|
|
|
actor_process_profile_definition g_profile_Obj_Lv6EGate = {
|
|
/* Layer ID */ fpcLy_CURRENT_e,
|
|
/* List ID */ 3,
|
|
/* List Prio */ fpcPi_CURRENT_e,
|
|
/* Proc Name */ fpcNm_Obj_Lv6EGate_e,
|
|
/* Proc SubMtd */ &g_fpcLf_Method.base,
|
|
/* Size */ sizeof(daObjLv6EGate_c),
|
|
/* Size Other */ 0,
|
|
/* Parameters */ 0,
|
|
/* Leaf SubMtd */ &g_fopAc_Method.base,
|
|
/* Draw Prio */ fpcDwPi_Obj_Lv6EGate_e,
|
|
/* Actor SubMtd */ &daObjLv6EGate_METHODS,
|
|
/* Status */ fopAcStts_UNK_0x40000_e | fopAcStts_CULL_e,
|
|
/* Group */ fopAc_ACTOR_e,
|
|
/* Cull Type */ fopAc_CULLBOX_CUSTOM_e,
|
|
};
|