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>
156 lines
4.0 KiB
C++
156 lines
4.0 KiB
C++
/**
|
|
* d_a_obj_crystal.cpp
|
|
*
|
|
*/
|
|
|
|
#include "d/dolzel_rel.h" // IWYU pragma: keep
|
|
|
|
#include "d/actor/d_a_obj_crystal.h"
|
|
#include "d/d_com_inf_game.h"
|
|
#include "f_pc/f_pc_name.h"
|
|
#include <cstring>
|
|
|
|
static int CheckCreateHeap(fopAc_ac_c* i_this) {
|
|
return static_cast<daObjCrystal_c*>(i_this)->CreateHeap();
|
|
}
|
|
|
|
void daObjCrystal_c::initBaseMtx() {
|
|
mpModel[0]->setBaseScale(scale);
|
|
mpModel[1]->setBaseScale(scale);
|
|
setBaseMtx();
|
|
}
|
|
|
|
void daObjCrystal_c::setBaseMtx() {
|
|
mDoMtx_stack_c::transS(current.pos);
|
|
mDoMtx_stack_c::ZXYrotM(shape_angle);
|
|
|
|
mpModel[0]->setBaseTRMtx(mDoMtx_stack_c::get());
|
|
mpModel[1]->setBaseTRMtx(mDoMtx_stack_c::get());
|
|
}
|
|
|
|
static char* l_arcName = "H_Suisho";
|
|
|
|
int daObjCrystal_c::Create() {
|
|
initBaseMtx();
|
|
fopAcM_SetMtx(this, mpModel[0]->getBaseTRMtx());
|
|
|
|
mpEmitter = dComIfGp_particle_set(0x8BED, ¤t.pos, &home.angle, &scale, 255, NULL, -1,
|
|
NULL, NULL, NULL);
|
|
mJointID = 0xFFFF;
|
|
|
|
JUTNameTab* joint_name = mpModel[0]->getModelData()->getJointTree().getJointName();
|
|
for (u16 i = 0; i < mpModel[0]->getModelData()->getJointNum(); i++) {
|
|
if (strcmp(joint_name->getName(i), "polySurface1") == 0) {
|
|
mJointID = i;
|
|
}
|
|
}
|
|
|
|
mpModel[0]->calc();
|
|
|
|
if (mpEmitter != NULL) {
|
|
mpEmitter->setGlobalRTMatrix(mpModel[0]->getAnmMtx(mJointID));
|
|
}
|
|
|
|
return 1;
|
|
}
|
|
|
|
int daObjCrystal_c::CreateHeap() {
|
|
static int const l_bmd[] = {4, 7};
|
|
static u32 const l_diff_flag[] = {0, 0x80000};
|
|
static u32 const l_flag[] = {0x19000084, 0x11000084};
|
|
|
|
for (int i = 0; i < 2; i++) {
|
|
J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes(l_arcName, l_bmd[i]);
|
|
|
|
mpModel[i] = mDoExt_J3DModel__create(modelData, l_diff_flag[i], l_flag[i]);
|
|
if (mpModel[i] == NULL) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
return 1;
|
|
}
|
|
|
|
int daObjCrystal_c::create() {
|
|
fopAcM_ct(this, daObjCrystal_c);
|
|
|
|
int phase = dComIfG_resLoad(&mPhase, l_arcName);
|
|
if (phase == cPhs_COMPLEATE_e) {
|
|
if (!fopAcM_entrySolidHeap(this, CheckCreateHeap, 0x4000)) {
|
|
return cPhs_ERROR_e;
|
|
}
|
|
|
|
if (!Create()) {
|
|
return cPhs_ERROR_e;
|
|
}
|
|
}
|
|
|
|
return phase;
|
|
}
|
|
|
|
int daObjCrystal_c::execute() {
|
|
setBaseMtx();
|
|
return 1;
|
|
}
|
|
|
|
int daObjCrystal_c::draw() {
|
|
g_env_light.settingTevStruct(0x10, ¤t.pos, &tevStr);
|
|
|
|
for (int i = 0; i < 2; i++) {
|
|
g_env_light.setLightTevColorType_MAJI(mpModel[i], &tevStr);
|
|
mDoExt_modelUpdateDL(mpModel[i]);
|
|
}
|
|
|
|
return 1;
|
|
}
|
|
|
|
int daObjCrystal_c::_delete() {
|
|
if (mpEmitter != NULL) {
|
|
mpEmitter->becomeInvalidEmitter();
|
|
mpEmitter->quitImmortalEmitter();
|
|
mpEmitter = NULL;
|
|
}
|
|
|
|
dComIfG_resDelete(&mPhase, l_arcName);
|
|
return 1;
|
|
}
|
|
|
|
static int daObjCrystal_Draw(daObjCrystal_c* i_this) {
|
|
return i_this->draw();
|
|
}
|
|
|
|
static int daObjCrystal_Execute(daObjCrystal_c* i_this) {
|
|
return i_this->execute();
|
|
}
|
|
|
|
static int daObjCrystal_Delete(daObjCrystal_c* i_this) {
|
|
return i_this->_delete();
|
|
}
|
|
|
|
static int daObjCrystal_Create(daObjCrystal_c* i_this) {
|
|
return i_this->create();
|
|
}
|
|
|
|
static actor_method_class l_daObjCrystal_Method = {
|
|
(process_method_func)daObjCrystal_Create, (process_method_func)daObjCrystal_Delete,
|
|
(process_method_func)daObjCrystal_Execute, (process_method_func)NULL,
|
|
(process_method_func)daObjCrystal_Draw,
|
|
};
|
|
|
|
actor_process_profile_definition g_profile_Obj_Crystal = {
|
|
/* Layer ID */ fpcLy_CURRENT_e,
|
|
/* List ID */ 7,
|
|
/* List Prio */ fpcPi_CURRENT_e,
|
|
/* Proc Name */ fpcNm_Obj_Crystal_e,
|
|
/* Proc SubMtd */ &g_fpcLf_Method.base,
|
|
/* Size */ sizeof(daObjCrystal_c),
|
|
/* Size Other */ 0,
|
|
/* Parameters */ 0,
|
|
/* Leaf SubMtd */ &g_fopAc_Method.base,
|
|
/* Draw Prio */ fpcDwPi_Obj_Crystal_e,
|
|
/* Actor SubMtd */ &l_daObjCrystal_Method,
|
|
/* Status */ fopAcStts_UNK_0x40000_e,
|
|
/* Group */ fopAc_ACTOR_e,
|
|
/* Cull Type */ fopAc_CULLBOX_CUSTOM_e,
|
|
};
|