mirror of
https://github.com/zeldaret/tww.git
synced 2026-05-31 17:31:50 -04:00
143 lines
5.2 KiB
C++
143 lines
5.2 KiB
C++
//
|
|
// Generated by dtk
|
|
// Translation Unit: d_a_disappear.cpp
|
|
//
|
|
|
|
#include "d/dolzel.h" // IWYU pragma: keep
|
|
#include "d/actor/d_a_disappear.h"
|
|
#include "f_op/f_op_actor.h"
|
|
#include "f_op/f_op_actor_mng.h"
|
|
#include "d/d_procname.h"
|
|
#include "d/d_priority.h"
|
|
#include "d/d_com_inf_game.h"
|
|
#include "d/d_s_play.h"
|
|
|
|
/* 800E79C0-800E79C8 .text daDisappear_Draw__FP15disappear_class */
|
|
static BOOL daDisappear_Draw(disappear_class*) {
|
|
return TRUE;
|
|
}
|
|
|
|
/* 800E79C8-800E7AC0 .text daDisappear_Execute__FP15disappear_class */
|
|
static BOOL daDisappear_Execute(disappear_class* i_this) {
|
|
if (i_this->mTimer != 0) {
|
|
i_this->mTimer--;
|
|
|
|
if (i_this->mTimer == 0) {
|
|
s8 dropType = i_this->health;
|
|
|
|
if (dropType != daDisItem_NONE1_e && dropType != daDisItem_NONE3_e) {
|
|
if (dropType == daDisItem_HEART_CONTAINER_e) {
|
|
fopAcM_createItemForBoss(&i_this->current.pos, 0, i_this->current.roomNo, &i_this->current.angle, NULL, 0);
|
|
}
|
|
else if (dropType >= daDisItem_HEART_e && dropType <= daDisItem_NONE13_e) {
|
|
// Special type for Keese (ki) spawned in the Puppet Ganon fight.
|
|
// This also seems to be used by several other enemies, such as Molgera's spawn.
|
|
static u32 ki_item_d[] = {
|
|
dItem_HEART_e,
|
|
dItem_LARGE_MAGIC_e,
|
|
dItem_ARROW_10_e,
|
|
};
|
|
if (dropType < daDisItem_HEART_e + (int)ARRAY_SIZE(ki_item_d)) {
|
|
fopAcM_createItem(&i_this->current.pos, ki_item_d[dropType - daDisItem_HEART_e], -1, -1, daItemType_0_e, NULL, daItemAct_4_e);
|
|
}
|
|
}
|
|
else {
|
|
fopAcM_createIball(&i_this->current.pos, i_this->itemTableIdx, i_this->current.roomNo, &i_this->current.angle, i_this->mItemBitNo);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
fopAcM_delete(i_this);
|
|
}
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
/* 800E7AC0-800E7AC8 .text daDisappear_IsDelete__FP15disappear_class */
|
|
static BOOL daDisappear_IsDelete(disappear_class*) {
|
|
return TRUE;
|
|
}
|
|
|
|
/* 800E7AC8-800E7AD0 .text daDisappear_Delete__FP15disappear_class */
|
|
static BOOL daDisappear_Delete(disappear_class*) {
|
|
return TRUE;
|
|
}
|
|
|
|
/* 800E7AD0-800E7DBC .text set_disappear__FP15disappear_classf */
|
|
void set_disappear(disappear_class* i_this, float scale) {
|
|
fopAcM_seStart(i_this, JA_SE_CM_MONS_EXPLODE, 0);
|
|
|
|
cXyz particleScale(scale, scale, scale);
|
|
i_this->mTimer = 58 + REG8_S(0);
|
|
|
|
switch (i_this->health) {
|
|
case 0x0:
|
|
case 0x2:
|
|
case 0xA:
|
|
case 0xB:
|
|
case 0xC:
|
|
case 0xD:
|
|
dComIfGp_particle_set(dPa_name::ID_COMMON_0014, &i_this->current.pos, NULL, &particleScale);
|
|
// Fall-through
|
|
case 0x3:
|
|
dComIfGp_particle_set(dPa_name::ID_COMMON_0013, &i_this->current.pos, NULL, &particleScale);
|
|
dComIfGp_particle_setStripes(dPa_name::ID_COMMON_0015, &i_this->current.pos, NULL, &particleScale, 0xFF, 0x96);
|
|
dComIfGp_particle_set(dPa_name::ID_COMMON_0016, &i_this->current.pos, NULL, &particleScale);
|
|
break;
|
|
case 0x1:
|
|
dComIfGp_particle_set(dPa_name::ID_COMMON_0013, &i_this->current.pos, NULL, &particleScale);
|
|
dComIfGp_particle_set(dPa_name::ID_COMMON_0016, &i_this->current.pos, NULL, &particleScale);
|
|
break;
|
|
case 0x4:
|
|
dComIfGp_particle_set(dPa_name::ID_COMMON_043C, &i_this->current.pos);
|
|
dComIfGp_particle_set(dPa_name::ID_COMMON_043D, &i_this->current.pos);
|
|
dComIfGp_particle_set(dPa_name::ID_COMMON_043E, &i_this->current.pos);
|
|
break;
|
|
}
|
|
}
|
|
|
|
/* 800E7DBC-800E7E60 .text daDisappear_Create__FP10fopAc_ac_c */
|
|
static cPhs_State daDisappear_Create(fopAc_ac_c* i_this) {
|
|
disappear_class* dis = static_cast<disappear_class*>(i_this);
|
|
|
|
fopAcM_SetupActor(dis, disappear_class);
|
|
|
|
dis->health = fopAcM_GetParam(dis) & 0xFF; // Drop type param is stored in health
|
|
f32 scaleMag = ((fopAcM_GetParam(dis) >> 8) & 0xFF) * 0.1f;
|
|
|
|
dis->mItemBitNo = (fopAcM_GetParam(dis) >> 0x10) & 0xFF;
|
|
if (dis->mItemBitNo == 0xFF) {
|
|
dis->mItemBitNo = -1;
|
|
}
|
|
|
|
set_disappear(dis, scaleMag);
|
|
|
|
return cPhs_COMPLEATE_e;
|
|
}
|
|
|
|
static actor_method_class l_daDisappear_Method = {
|
|
(process_method_func)daDisappear_Create,
|
|
(process_method_func)daDisappear_Delete,
|
|
(process_method_func)daDisappear_Execute,
|
|
(process_method_func)daDisappear_IsDelete,
|
|
(process_method_func)daDisappear_Draw,
|
|
};
|
|
|
|
actor_process_profile_definition g_profile_DISAPPEAR = {
|
|
/* LayerID */ fpcLy_CURRENT_e,
|
|
/* ListID */ 0x0007,
|
|
/* ListPrio */ fpcPi_CURRENT_e,
|
|
/* ProcName */ PROC_DISAPPEAR,
|
|
/* Proc SubMtd */ &g_fpcLf_Method.base,
|
|
/* Size */ sizeof(disappear_class),
|
|
/* SizeOther */ 0,
|
|
/* Parameters */ 0,
|
|
/* Leaf SubMtd */ &g_fopAc_Method.base,
|
|
/* Priority */ PRIO_DISAPPEAR,
|
|
/* Actor SubMtd */ &l_daDisappear_Method,
|
|
/* Status */ fopAcStts_UNK4000_e | fopAcStts_UNK40000_e,
|
|
/* Group */ fopAc_ACTOR_e,
|
|
/* CullType */ fopAc_CULLBOX_0_e,
|
|
};
|