mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-06-12 04:57:06 -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>
297 lines
8.8 KiB
C++
297 lines
8.8 KiB
C++
/**
|
|
* @file d_a_obj_spinLift.cpp
|
|
*
|
|
*/
|
|
|
|
#include "d/dolzel_rel.h" // IWYU pragma: keep
|
|
|
|
#include "d/actor/d_a_obj_spinLift.h"
|
|
|
|
class daSpinLift_HIO_c : public mDoHIO_entry_c {
|
|
public:
|
|
daSpinLift_HIO_c();
|
|
~daSpinLift_HIO_c() {};
|
|
|
|
#if DEBUG
|
|
void genMessage(JORMContext*);
|
|
#endif
|
|
|
|
/* 0x06 */ u8 field_0x06;
|
|
/* 0x08 */ f32 mInitialSpeed;
|
|
/* 0x0C */ u8 mVibration;
|
|
};
|
|
|
|
static daSpinLift_HIO_c l_HIO;
|
|
|
|
daSpinLift_HIO_c::daSpinLift_HIO_c() {
|
|
field_0x06 = 0x3c;
|
|
mInitialSpeed = 0.0f;
|
|
mVibration = 4;
|
|
}
|
|
|
|
#if DEBUG
|
|
void daSpinLift_HIO_c::genMessage(JORMContext* ctx) {
|
|
// === Ascent ===
|
|
ctx->genLabel("\n=== 上昇 ===", 0);
|
|
// Initial Speed
|
|
ctx->genSlider("初速", &mInitialSpeed, 0.0f, 100.0f);
|
|
// Vibration
|
|
ctx->startComboBox("振動", &mVibration);
|
|
// Strength 1 - 8
|
|
ctx->genComboBoxItem("強さ1", 1);
|
|
ctx->genComboBoxItem("強さ2", 2);
|
|
ctx->genComboBoxItem("強さ3", 3);
|
|
ctx->genComboBoxItem("強さ4", 4);
|
|
ctx->genComboBoxItem("強さ5", 5);
|
|
ctx->genComboBoxItem("強さ6", 6);
|
|
ctx->genComboBoxItem("強さ7", 7);
|
|
ctx->genComboBoxItem("強さ8", 8);
|
|
ctx->endComboBox();
|
|
}
|
|
#endif
|
|
|
|
static char* l_resNameIdx[] = {
|
|
"L4_N_Entr", "L4_N_SlpH", "L4_N_SlpL", "L4_Center", "L4_Switch",
|
|
"L4_S_Slp", "L4_Wal_ZE", "L4_Wal_ZW", "L4_Wal_X",
|
|
};
|
|
|
|
void daSpinLift_c::setBaseMtx() {
|
|
mDoMtx_stack_c::transS(current.pos.x, current.pos.y, current.pos.z);
|
|
mpModel->setBaseScale(scale);
|
|
mpModel->setBaseTRMtx(mDoMtx_stack_c::get());
|
|
}
|
|
|
|
static u32 const l_bmdIdx[] = {4, 4, 4, 4, 4, 4, 4, 4, 4};
|
|
int daSpinLift_c::CreateHeap() {
|
|
J3DModelData* modelData =
|
|
(J3DModelData*)dComIfG_getObjectRes(l_resNameIdx[mModelType], l_bmdIdx[mModelType]);
|
|
JUT_ASSERT(222, modelData != NULL);
|
|
mpModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000084);
|
|
if (mpModel == NULL) {
|
|
return 0;
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
static const int l_dzbIdx[] = {7, 7, 7, 7, 7, 7, 7, 7, 7};
|
|
int daSpinLift_c::create() {
|
|
fopAcM_ct(this, daSpinLift_c);
|
|
mModelType = getModelType();
|
|
int phase = dComIfG_resLoad(&mPhase, l_resNameIdx[mModelType]);
|
|
|
|
if (phase == cPhs_COMPLEATE_e) {
|
|
if (MoveBGCreate(l_resNameIdx[mModelType], l_dzbIdx[mModelType],
|
|
dBgS_MoveBGProc_TypicalRotY, 0x9300, NULL) == cPhs_ERROR_e)
|
|
{
|
|
return cPhs_ERROR_e;
|
|
}
|
|
|
|
fopAcM_SetMtx(this, mpModel->getBaseTRMtx());
|
|
fopAcM_setCullSizeBox2(this, mpModel->getModelData());
|
|
|
|
s8 move_height = (s8)getMoveHeight();
|
|
mMoveHeight = move_height * 50.0f;
|
|
|
|
u8 move_speed = (u8)getMoveSpeed();
|
|
mMoveSpeed = mMoveHeight / move_speed;
|
|
|
|
mTimer = getTimer();
|
|
field_0x5bc = fopAcM_isSwitch(this, getSw());
|
|
|
|
if (fopAcM_isSwitch(this, getEndSw())) {
|
|
current.pos.y += mMoveHeight;
|
|
init_modeMoveEnd();
|
|
} else {
|
|
init_modeWait();
|
|
}
|
|
|
|
setBaseMtx();
|
|
#if DEBUG
|
|
// Spin Lift
|
|
l_HIO.entryHIO("スピンリフト");
|
|
#endif
|
|
}
|
|
|
|
return phase;
|
|
}
|
|
|
|
int daSpinLift_c::Execute(Mtx** param_0) {
|
|
moveLift();
|
|
*param_0 = &mpModel->getBaseTRMtx();
|
|
setBaseMtx();
|
|
return 1;
|
|
}
|
|
|
|
void daSpinLift_c::moveLift() {
|
|
static const daSpinLift_c::modeFunc mode_proc[] = {
|
|
&daSpinLift_c::modeWait,
|
|
&daSpinLift_c::modeUpMove,
|
|
&daSpinLift_c::modeDownMove,
|
|
&daSpinLift_c::modeMoveEnd,
|
|
};
|
|
|
|
if (!fopAcM_isSwitch(this, getEndSw())) {
|
|
u8 f5bc = field_0x5bc;
|
|
field_0x5bc = fopAcM_isSwitch(this, getSw());
|
|
if (f5bc != field_0x5bc) {
|
|
if (field_0x5bc != 0) {
|
|
init_modeUpMove();
|
|
} else {
|
|
init_modeDownMove();
|
|
}
|
|
}
|
|
}
|
|
|
|
(this->*mode_proc[field_0x5ac])();
|
|
}
|
|
|
|
void daSpinLift_c::init_modeWait() {
|
|
field_0x5ac = 0;
|
|
}
|
|
|
|
void daSpinLift_c::modeWait() {}
|
|
|
|
void daSpinLift_c::init_modeUpMove() {
|
|
fopAcM_SetSpeedF(this, l_HIO.mInitialSpeed);
|
|
field_0x5ba = mTimer;
|
|
field_0x5ac = 1;
|
|
}
|
|
|
|
void daSpinLift_c::modeUpMove() {
|
|
if (field_0x5ba != 0) {
|
|
field_0x5ba--;
|
|
return;
|
|
}
|
|
|
|
int unused = cLib_chaseF(&speedF, mMoveSpeed, mMoveSpeed / 30.0f);
|
|
f32 dVar3 =
|
|
cLib_addCalc(¤t.pos.y, home.pos.y + mMoveHeight, 1.0f, fopAcM_GetSpeedF(this), 0.1f);
|
|
cXyz cStack_34(current.pos);
|
|
cStack_34.y += cull.box.max.y;
|
|
mDoAud_seStartLevel(Z2SE_OBJ_STN_SPRL_RAIL, &cStack_34, 0,
|
|
dComIfGp_getReverb(fopAcM_GetRoomNo(this)));
|
|
|
|
if (dVar3 == 0.0f) {
|
|
if (mModelType == 1 || mModelType == 4) {
|
|
init_modeMoveEnd();
|
|
return;
|
|
}
|
|
|
|
mDoAud_seStart(Z2SE_OBJ_STN_SPRL_RAIL_ST, 0, 0, 0);
|
|
dComIfGp_getVibration().StartShock(l_HIO.mVibration, 15, cXyz(0.0f, 1.0f, 0.0f));
|
|
|
|
csXyz local_48(shape_angle);
|
|
local_48.x = 0;
|
|
|
|
dComIfGp_particle_set(dPa_RM(ID_ZI_S_LV4SLPH_KIDOU_A), ¤t.pos, &local_48, NULL);
|
|
dComIfGp_particle_set(dPa_RM(ID_ZI_S_LV4SLPH_KIDOU_B), ¤t.pos, &local_48, NULL);
|
|
dComIfGp_particle_set(dPa_RM(ID_ZI_S_LV4SLPH_KIDOU_C), ¤t.pos, &local_48, NULL);
|
|
dComIfGp_particle_set(dPa_RM(ID_ZI_S_LV4SLPH_KIDOU_D), ¤t.pos, &local_48, NULL);
|
|
dComIfGp_particle_set(dPa_RM(ID_ZI_S_LV4SLPH_KIDOU_E), ¤t.pos, &local_48, NULL);
|
|
dComIfGp_particle_set(dPa_RM(ID_ZI_S_LV4SLPH_KIDOU_F), ¤t.pos, &local_48, NULL);
|
|
dComIfGp_particle_set(dPa_RM(ID_ZI_S_LV4SLPH_KIDOU_G), ¤t.pos, &local_48, NULL);
|
|
init_modeWait();
|
|
}
|
|
}
|
|
|
|
void daSpinLift_c::init_modeDownMove() {
|
|
field_0x5ac = 2;
|
|
}
|
|
|
|
void daSpinLift_c::modeDownMove() {
|
|
f32 dVar3 = cLib_addCalc(¤t.pos.y, home.pos.y, 0.3f, mMoveSpeed, 0.1f);
|
|
|
|
if (current.pos.y != home.pos.y) {
|
|
cXyz acStack_38(current.pos);
|
|
acStack_38.y += cull.box.max.y;
|
|
mDoAud_seStartLevel(Z2SE_OBJ_STN_SPRL_RAIL_DW, &acStack_38, 0,
|
|
dComIfGp_getReverb(fopAcM_GetRoomNo(this)));
|
|
}
|
|
|
|
if (dVar3 == 0.0f) {
|
|
init_modeWait();
|
|
}
|
|
}
|
|
|
|
void daSpinLift_c::init_modeMoveEnd() {
|
|
if (fopAcM_isSwitch(this, getEndSw()) == 0) {
|
|
fopAcM_onSwitch(this, getEndSw());
|
|
mDoAud_seStart(Z2SE_OBJ_STN_SPRL_RAIL_ST, 0, 0, 0);
|
|
dComIfGp_getVibration().StartShock(l_HIO.mVibration, 15, cXyz(0.0f, 1.0f, 0.0f));
|
|
|
|
csXyz local_28(shape_angle);
|
|
local_28.x = 0;
|
|
|
|
dComIfGp_particle_set(dPa_RM(ID_ZI_S_LV4SLPH_KIDOU_A), ¤t.pos, &local_28, NULL);
|
|
dComIfGp_particle_set(dPa_RM(ID_ZI_S_LV4SLPH_KIDOU_B), ¤t.pos, &local_28, NULL);
|
|
dComIfGp_particle_set(dPa_RM(ID_ZI_S_LV4SLPH_KIDOU_C), ¤t.pos, &local_28, NULL);
|
|
dComIfGp_particle_set(dPa_RM(ID_ZI_S_LV4SLPH_KIDOU_D), ¤t.pos, &local_28, NULL);
|
|
dComIfGp_particle_set(dPa_RM(ID_ZI_S_LV4SLPH_KIDOU_E), ¤t.pos, &local_28, NULL);
|
|
dComIfGp_particle_set(dPa_RM(ID_ZI_S_LV4SLPH_KIDOU_F), ¤t.pos, &local_28, NULL);
|
|
dComIfGp_particle_set(dPa_RM(ID_ZI_S_LV4SLPH_KIDOU_G), ¤t.pos, &local_28, NULL);
|
|
}
|
|
|
|
field_0x5ac = 3;
|
|
}
|
|
|
|
void daSpinLift_c::modeMoveEnd() {}
|
|
|
|
int daSpinLift_c::Draw() {
|
|
g_env_light.settingTevStruct(0x40, ¤t.pos, &tevStr);
|
|
g_env_light.setLightTevColorType_MAJI(mpModel, &tevStr);
|
|
dComIfGd_setListBG();
|
|
mDoExt_modelUpdateDL(mpModel);
|
|
dComIfGd_setList();
|
|
return 1;
|
|
}
|
|
|
|
int daSpinLift_c::Delete() {
|
|
dComIfG_resDelete(&mPhase, l_resNameIdx[mModelType]);
|
|
#if DEBUG
|
|
l_HIO.removeHIO();
|
|
#endif
|
|
return 1;
|
|
}
|
|
|
|
static int daSpinLift_Draw(daSpinLift_c* i_this) {
|
|
return i_this->MoveBGDraw();
|
|
}
|
|
|
|
static int daSpinLift_Execute(daSpinLift_c* i_this) {
|
|
return i_this->MoveBGExecute();
|
|
}
|
|
|
|
static int daSpinLift_Delete(daSpinLift_c* i_this) {
|
|
fopAcM_RegisterCreateID(i_this, "daSpinLift");
|
|
return i_this->MoveBGDelete();
|
|
}
|
|
|
|
static int daSpinLift_Create(fopAc_ac_c* i_this) {
|
|
daSpinLift_c* a_this = (daSpinLift_c*)i_this;
|
|
fopAcM_RegisterDeleteID(i_this, "daSpinLift");
|
|
return a_this->create();
|
|
}
|
|
|
|
static actor_method_class l_daSpinLift_Method = {
|
|
(process_method_func)daSpinLift_Create, (process_method_func)daSpinLift_Delete,
|
|
(process_method_func)daSpinLift_Execute, 0,
|
|
(process_method_func)daSpinLift_Draw,
|
|
};
|
|
|
|
actor_process_profile_definition g_profile_Obj_SpinLift = {
|
|
/* Layer ID */ fpcLy_CURRENT_e,
|
|
/* List ID */ 3,
|
|
/* List Prio */ fpcPi_CURRENT_e,
|
|
/* Proc Name */ fpcNm_Obj_SpinLift_e,
|
|
/* Proc SubMtd */ &g_fpcLf_Method.base,
|
|
/* Size */ sizeof(daSpinLift_c),
|
|
/* Size Other */ 0,
|
|
/* Parameters */ 0,
|
|
/* Leaf SubMtd */ &g_fopAc_Method.base,
|
|
/* Draw Prio */ fpcDwPi_Obj_SpinLift_e,
|
|
/* Actor SubMtd */ &l_daSpinLift_Method,
|
|
/* Status */ fopAcStts_UNK_0x40000_e | fopAcStts_CULL_e,
|
|
/* Group */ fopAc_ACTOR_e,
|
|
/* Cull Type */ fopAc_CULLBOX_CUSTOM_e,
|
|
};
|