mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-06-02 01:30:00 -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>
196 lines
6.0 KiB
C++
196 lines
6.0 KiB
C++
/**
|
|
* @file d_a_obj_roten.cpp
|
|
*
|
|
*/
|
|
|
|
#include "d/dolzel_rel.h" // IWYU pragma: keep
|
|
|
|
#include "d/actor/d_a_obj_roten.h"
|
|
#include "SSystem/SComponent/c_math.h"
|
|
#include "d/d_com_inf_game.h"
|
|
|
|
void daObj_Roten_c::initBaseMtx() {
|
|
mModel->setBaseScale(scale);
|
|
setBaseMtx();
|
|
}
|
|
|
|
void daObj_Roten_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);
|
|
mModel->setBaseTRMtx(mDoMtx_stack_c::get());
|
|
mDoMtx_stack_c::scaleM(scale.x, scale.y, scale.z);
|
|
MTXCopy(mDoMtx_stack_c::get(), mBgMtx);
|
|
}
|
|
|
|
int daObj_Roten_c::Create() {
|
|
initBaseMtx();
|
|
fopAcM_SetMtx(this, mModel->getBaseTRMtx());
|
|
cXyz minCull;
|
|
cXyz maxCull;
|
|
J3DJoint* pJoint = mModel->getModelData()->getJointNodePointer(0);
|
|
minCull.x = scale.x * pJoint->getMin()->x;
|
|
minCull.y = scale.y * pJoint->getMin()->y;
|
|
minCull.z = scale.z * pJoint->getMin()->z;
|
|
maxCull.x = scale.x * pJoint->getMax()->x;
|
|
maxCull.y = scale.y * pJoint->getMax()->y;
|
|
maxCull.z = scale.z * pJoint->getMax()->z;
|
|
fopAcM_setCullSizeBox(this, minCull.x, minCull.y, minCull.z, maxCull.x, maxCull.y,
|
|
maxCull.z);
|
|
fopAcM_setCullSizeFar(this, 10.0f);
|
|
for (int i = 0; i < 2; i++) {
|
|
mEmitters[i] = 0;
|
|
}
|
|
if (dComIfGs_getTime() >= 90.0f && dComIfGs_getTime() < 270.0f) {
|
|
mWithinTime = false;
|
|
} else {
|
|
mWithinTime = true;
|
|
}
|
|
mBossLightRefDist = 0.0f;
|
|
cXyz local_64(-80.0f, 177.0f, 110.0f);
|
|
cXyz local_70;
|
|
f32 dVar8 = cM_ssin(-shape_angle.y);
|
|
f32 dVar9 = cM_scos(-shape_angle.y);
|
|
local_70.x = (local_64.x * dVar9) - (local_64.z * dVar8);
|
|
local_70.y = local_64.y;
|
|
local_70.z = (local_64.x * dVar8) + (local_64.z * dVar9);
|
|
mParticlePos.set(current.pos.x + local_70.x, current.pos.y + (f32)(double)local_64.y,
|
|
current.pos.z + local_70.z);
|
|
if (mWithinTime) {
|
|
cXyz cStack_7c(cXyz(0.4f, 0.4f, 0.4f));
|
|
cXyz cStack_88(cXyz(0.25f, 0.25f, 0.25f));
|
|
if (mEmitters[0] == NULL) {
|
|
mEmitters[0] = dComIfGp_particle_set(0x3ad, &mParticlePos, ¤t.angle, &cStack_7c);
|
|
}
|
|
if (mEmitters[1] == NULL) {
|
|
mEmitters[1] = dComIfGp_particle_set(0x3af, &mParticlePos, ¤t.angle, &cStack_88);
|
|
}
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
static char* l_resFileName = "Obj_roten";
|
|
|
|
static u32 l_bmdFileIdx = 4;
|
|
|
|
int daObj_Roten_c::CreateHeap() {
|
|
J3DModelData* mdlData_p = (J3DModelData*)dComIfG_getObjectRes(getResName(), l_bmdFileIdx);
|
|
JUT_ASSERT(156, mdlData_p != NULL);
|
|
mModel = mDoExt_J3DModel__create(mdlData_p, 0x80000, 0x11000084);
|
|
return mModel != NULL;
|
|
}
|
|
|
|
static u32 l_dzbFileIdx = 7;
|
|
|
|
int daObj_Roten_c::create() {
|
|
fopAcM_ct(this, daObj_Roten_c);
|
|
/* dSv_event_flag_c::M_031 - Goron Mines - Goron Mines clear */
|
|
if (!dComIfGs_isEventBit(dSv_event_flag_c::saveBitLabels[0x40])) {
|
|
return cPhs_ERROR_e;
|
|
}
|
|
int rv = dComIfG_resLoad(&mPhase, getResName());
|
|
if (rv == cPhs_COMPLEATE_e) {
|
|
if (MoveBGCreate(getResName(), l_dzbFileIdx, dBgS_MoveBGProc_TypicalRotY, 0x1430, NULL) ==
|
|
cPhs_ERROR_e)
|
|
{
|
|
return cPhs_ERROR_e;
|
|
}
|
|
MoveBGExecute();
|
|
}
|
|
return rv;
|
|
}
|
|
|
|
int daObj_Roten_c::Execute(Mtx** ppMtx) {
|
|
if (mWithinTime) {
|
|
if (dComIfGp_roomControl_getStayNo() != 0) {
|
|
mDoAud_seStartLevel(Z2SE_OBJ_MYNA_LIGHT_BURNING, &mParticlePos, 0, dComIfGp_getReverb(dComIfGp_roomControl_getStayNo()));
|
|
} else {
|
|
mDoAud_seStartLevel(Z2SE_OBJ_MYNA_LIGHT_BURNING, &mParticlePos, 0, 0);
|
|
}
|
|
}
|
|
*ppMtx = &mBgMtx;
|
|
setBaseMtx();
|
|
return 1;
|
|
}
|
|
|
|
int daObj_Roten_c::Draw() {
|
|
if (mWithinTime) {
|
|
cLib_addCalc(&mBossLightRefDist, 1.0f, 0.5f, 0.1f, 0.0001f);
|
|
} else {
|
|
cLib_addCalc(&mBossLightRefDist, 0, 0.5f, 0.1f, 0.0001f);
|
|
}
|
|
if (mBossLightRefDist >= 1e-6f) {
|
|
GXColor bossLightColor = {0xbc, 0x66, 0x42, 0xff};
|
|
dKy_BossLight_set(&mParticlePos, &bossLightColor, mBossLightRefDist, 0);
|
|
}
|
|
g_env_light.settingTevStruct(0x10, ¤t.pos, &tevStr);
|
|
g_env_light.setLightTevColorType_MAJI(mModel, &tevStr);
|
|
dComIfGd_setListBG();
|
|
mDoExt_modelUpdateDL(mModel);
|
|
dComIfGd_setList();
|
|
return 1;
|
|
}
|
|
|
|
int daObj_Roten_c::Delete() {
|
|
for (int i = 0; i < 2; i = i + 1) {
|
|
if (mEmitters[i] != NULL) {
|
|
mEmitters[i]->quitImmortalEmitter();
|
|
mEmitters[i]->becomeInvalidEmitter();
|
|
mEmitters[i] = NULL;
|
|
}
|
|
}
|
|
dComIfG_resDelete(&mPhase, getResName());
|
|
return 1;
|
|
}
|
|
|
|
char* daObj_Roten_c::getResName() {
|
|
return l_resFileName;
|
|
}
|
|
|
|
static int daObj_Roten_Create(void* i_this) {
|
|
return static_cast<daObj_Roten_c*>(i_this)->create();
|
|
}
|
|
|
|
static int daObj_Roten_Delete(void* i_this) {
|
|
return static_cast<daObj_Roten_c*>(i_this)->MoveBGDelete();
|
|
}
|
|
|
|
static int daObj_Roten_Execute(void* i_this) {
|
|
return static_cast<daObj_Roten_c*>(i_this)->MoveBGExecute();
|
|
}
|
|
|
|
static int daObj_Roten_Draw(void* i_this) {
|
|
return static_cast<daObj_Roten_c*>(i_this)->Draw();
|
|
}
|
|
|
|
static int daObj_Roten_IsDelete(void* i_this) {
|
|
return 1;
|
|
}
|
|
|
|
daObj_Roten_c::~daObj_Roten_c() {
|
|
}
|
|
|
|
static actor_method_class daObj_Roten_MethodTable = {
|
|
(process_method_func)daObj_Roten_Create,
|
|
(process_method_func)daObj_Roten_Delete,
|
|
(process_method_func)daObj_Roten_Execute,
|
|
(process_method_func)daObj_Roten_IsDelete,
|
|
(process_method_func)daObj_Roten_Draw,
|
|
};
|
|
|
|
actor_process_profile_definition g_profile_OBJ_ROTEN = {
|
|
/* Layer ID */ fpcLy_CURRENT_e,
|
|
/* List ID */ 7,
|
|
/* List Prio */ fpcPi_CURRENT_e,
|
|
/* Proc Name */ fpcNm_OBJ_ROTEN_e,
|
|
/* Proc SubMtd */ &g_fpcLf_Method.base,
|
|
/* Size */ sizeof(daObj_Roten_c),
|
|
/* Size Other */ 0,
|
|
/* Parameters */ 0,
|
|
/* Leaf SubMtd */ &g_fopAc_Method.base,
|
|
/* Draw Prio */ fpcDwPi_OBJ_ROTEN_e,
|
|
/* Actor SubMtd */ &daObj_Roten_MethodTable,
|
|
/* Status */ fopAcStts_UNK_0x40000_e,
|
|
/* Group */ fopAc_ACTOR_e,
|
|
/* Cull Type */ fopAc_CULLBOX_CUSTOM_e,
|
|
};
|