Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 45 additions & 10 deletions include/d/actor/d_a_obj_Itnak.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,63 @@

#include "f_op/f_op_actor.h"
#include "d/d_cc_d.h"
#include "d/d_bg_s_gnd_chk.h"

namespace daObjItnak {
class Act_c : public fopAc_ac_c {
public:
void is_switch() const {}
void param_get_arg0() const {}
void param_get_swbit() const {}

void solidHeapCB(fopAc_ac_c*);
void create_heap();
virtual ~Act_c() {}
static BOOL solidHeapCB(fopAc_ac_c*);
BOOL create_heap();
cPhs_State _create();
bool _delete();
void set_mtx();
void set_co_se(dCcD_Cyl*);
BOOL set_co_se(dCcD_Cyl*);
void manage_draw_flag();
void set_collision();
bool _execute();
bool _draw();

struct Attr_c {
/* 0x00 */ f32 cyl1_r;
/* 0x04 */ f32 cyl1_h;
/* 0x08 */ f32 cyl2_r;
/* 0x0C */ f32 cyl2_h;
/* 0x10 */ f32 cyl2_pos_x;
/* 0x14 */ f32 cyl2_pos_y;
/* 0x18 */ f32 cyl2_pos_z;
/* 0x1C */ f32 cyl3_r;
/* 0x20 */ f32 cyl3_h;
/* 0x24 */ f32 cyl3_pos_x;
/* 0x28 */ f32 cyl3_pos_y;
/* 0x2C */ f32 cyl3_pos_z;
};
static const char M_arcname[];
enum Prm_e {
PRM_STATE_W = 8,
PRM_STATE_S = 0,
PRM_SWSAVE_W = 8,
PRM_SWSAVE_S = 8,
};
public:
/* Place member variables here */
};
// /* 0x290 */ void* mpVtbl;
/* 0x294 */ request_of_phase_process_class mPhase;
/* 0x29C */ J3DModel* mpModel;
/* 0x2A0 */ Mtx mMtx;
/* 0x2D0 */ u32 mShadowId;
/* 0x2D4 */ dBgS_ObjGndChk mFloorPoly;
/* 0x328 */ f32 mGroundY;
/* 0x32C */ dCcD_Stts mStts1;
/* 0x368 */ dCcD_Cyl mCyl1;
/* 0x498 */ dCcD_Stts mStts2;
/* 0x4D4 */ dCcD_Cyl mCyl2;
/* 0x604 */ dCcD_Stts mStts3;
/* 0x640 */ dCcD_Cyl mCyl3;
/* 0x770 */ int mInitVisible;
/* 0x774 */ int mVisible;
// Size: 0x778
private:
static const Attr_c L_attr;
};
};

#endif /* D_A_OBJ_ITNAK_H */
219 changes: 206 additions & 13 deletions src/d/actor/d_a_obj_Itnak.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,55 +5,248 @@

#include "d/dolzel_rel.h" // IWYU pragma: keep
#include "d/actor/d_a_obj_Itnak.h"
#include "d/d_a_obj.h"
#include "d/d_com_inf_game.h"
#include "res/Object/Itnak.h"

const daObjItnak::Act_c::Attr_c daObjItnak::Act_c::L_attr = {
68.0f, 230.0f, // cyl1_r, cyl1_h
62.0f, 121.0f, // cyl2_r, cyl2_h
41.0f, 44.0f, 84.0f, // cyl2_pos
47.0f, 205.0f, // cyl3_r, cyl3_h
-88.0f, 83.0f, 86.0f // cyl3_pos
};

namespace daObjItnak {
static const dCcD_SrcCyl M_cyl_src = {
{ // dCcD_SrcGObjInf
{ // cCcD_SrcObj
/* mFlags 0x00 */ 0,
{ // cCcD_SrcObjHitInf
/* ObjAt.mType 0x04 */ { 0, 0, { 0 } }, // type=0, atp=0, SPrm=0
/* ObjTg.mType 0x10 */ { 0xFF1DFEFF, { 0x0000000F } },
/* ObjCo.mSPrm 0x18 */ { { 0x00000079 } },
}
},
/* GAt 0x1C */ { 0, 0, 0, 0, { 0 } }, // Se=HM=Spl=Mtrl=0, SPrm=0
/* GTg 0x24 */ { 0, 0, 0, 0, { 0x00000003 } }, // Se=HM=Spl=Mtrl=0, SPrm=3
/* GCo 0x2C */ { { 0 } },
},
{ // cCcD_SrcCylAttr
{ // cM3dGCylS mCyl
{ 0.0f, 0.0f, 0.0f }, // Vec mCenter
100.0f, // mRadius
200.0f, // mHeight
}
},

};
const char daObjItnak::Act_c::M_arcname[] = "Itnak";

}

/* 00000078-0000009C .text solidHeapCB__Q210daObjItnak5Act_cFP10fopAc_ac_c */
void daObjItnak::Act_c::solidHeapCB(fopAc_ac_c*) {
/* Nonmatching */
BOOL daObjItnak::Act_c::solidHeapCB(fopAc_ac_c* i_this) {
u8 ret;
ret = ((daObjItnak::Act_c*)i_this)->create_heap();
return ret;
}

/* 0000009C-0000016C .text create_heap__Q210daObjItnak5Act_cFv */
void daObjItnak::Act_c::create_heap() {
/* Nonmatching */
BOOL daObjItnak::Act_c::create_heap() {
J3DModelData *mdl_data;
BOOL ret;

mdl_data = (J3DModelData*)dComIfG_getObjectRes(M_arcname, dRes_INDEX_ITNAK_BDL_ITNAK_e);
JUT_ASSERT(0x141, mdl_data != 0);
if(mdl_data != 0){
this->mpModel = mDoExt_J3DModel__create(mdl_data, 0, 0x11000002);
}
this->set_mtx();
ret = false;
if ((mdl_data != (J3DModelData *)0x0) && (this->mpModel != (J3DModel *)0x0)) {
ret = true;
}
return ret;
}

/* 0000016C-000003A0 .text _create__Q210daObjItnak5Act_cFv */
cPhs_State daObjItnak::Act_c::_create() {
/* Nonmatching */
fpc_ProcID actor_id;
cPhs_State res_load_state;
int is_visible;
bool solid_heap;
f32 ground_y;

fopAcM_ct(this, Act_c);
res_load_state = dComIfG_resLoad(&this->mPhase, M_arcname);
is_visible = ::daObj::PrmAbstract(this, (int)PRM_STATE_W, (int)PRM_STATE_S);
this->mInitVisible = is_visible;
if (res_load_state == cPhs_COMPLEATE_e) {
solid_heap = fopAcM_entrySolidHeap(this, solidHeapCB, 0);
if (solid_heap) {
this->mVisible = this->mInitVisible;
this->cullMtx = this->mpModel->getBaseTRMtx();
fopAcM_setCullSizeBox(this, -120.0, 0.0, -100.0, 120.0, 280.0, 150.0);
cXyz pos(this->current.pos.x, this->current.pos.y + 100.0f, this->current.pos.z);
this->mFloorPoly.SetPos(&pos);
actor_id = fopAcM_GetID(this);
this->mFloorPoly.SetActorPid(actor_id);
ground_y = dComIfG_Bgsp()->GroundCross(&this->mFloorPoly);
this->mGroundY = ground_y;
this->mStts1.Init( 0xff, 0xff, this);
this->mCyl1.Set(M_cyl_src);
mCyl1.SetStts(&mStts1);
mCyl1.SetTgVec((cXyz&)cXyz::Zero);
this->mCyl1.OnTgNoHitMark();
this->mStts2.Init( 0xff, 0xff, this);
this->mCyl2.Set(M_cyl_src);
mCyl2.SetStts(&mStts2);
mCyl2.SetTgVec((cXyz&)cXyz::Zero);

this->mCyl2.OnTgNoHitMark();
this->mStts3.Init( 0xff, 0xff, this);
this->mCyl3.Set(M_cyl_src);
mCyl3.SetStts(&mStts3);
mCyl3.SetTgVec((cXyz&)cXyz::Zero);

this->mCyl3.OnTgNoHitMark();
}
else {
res_load_state = cPhs_ERROR_e;
}
}
return res_load_state;

}

/* 00000D10-00000D40 .text _delete__Q210daObjItnak5Act_cFv */
bool daObjItnak::Act_c::_delete() {
/* Nonmatching */
dComIfG_resDelete(&this->mPhase, M_arcname);
return 1;
}

/* 00000D40-00000DEC .text set_mtx__Q210daObjItnak5Act_cFv */
void daObjItnak::Act_c::set_mtx() {
/* Nonmatching */
Vec* pBaseScale = this->mpModel->getBaseScale();
pBaseScale->x = this->scale.x;
pBaseScale->y = this->scale.y;
pBaseScale->z = this->scale.z;

mDoMtx_stack_c::transS( this->current.pos.x, this->current.pos.y, this->current.pos.z);
mDoMtx_stack_c::ZXYrotM( this->shape_angle.x, this->shape_angle.y, this->shape_angle.z);
this->mpModel->setBaseTRMtx(mDoMtx_stack_c::now);
PSMTXCopy(mDoMtx_stack_c::now, this->mMtx);

this->mpModel->calc();
}

/* 00000DEC-00000EB0 .text set_co_se__Q210daObjItnak5Act_cFP8dCcD_Cyl */
void daObjItnak::Act_c::set_co_se(dCcD_Cyl*) {
/* Nonmatching */
BOOL daObjItnak::Act_c::set_co_se(dCcD_Cyl* i_collision) {
if (i_collision->ChkTgHit() != 0) {
daObj::HitSeStart(&this->current.pos, this->current.roomNo, i_collision, 0xd);
dKy_Sound_set(this->current.pos, 4, fopAcM_GetID(this), 100);
::daObj::HitEff_hibana(this, i_collision);
i_collision->ClrTgHit();
return TRUE;
}
return FALSE;
}


/* 00000EB0-00000F94 .text manage_draw_flag__Q210daObjItnak5Act_cFv */
void daObjItnak::Act_c::manage_draw_flag() {
/* Nonmatching */
int switch_no;
bool is_switch;

if (this->mInitVisible == 1) {
if (this->mVisible == 1) {
switch_no = daObj::PrmAbstract(this, (int)PRM_SWSAVE_W, (int)PRM_SWSAVE_S);
is_switch = dComIfGs_isSwitch(switch_no, this->home.roomNo);
if (is_switch == 1) {
this->mVisible = 0;
}
}
}
else if (this->mInitVisible == 0) {
if (this->mVisible == 0) {
switch_no = daObj::PrmAbstract(this, (int)PRM_SWSAVE_W, (int)PRM_SWSAVE_S);
is_switch = dComIfGs_isSwitch(switch_no, this->home.roomNo);
if (is_switch == 1) {
this->mVisible = 1;
}
}
}
else {
this->mVisible = 1;
}
}

/* 00000F94-00001118 .text set_collision__Q210daObjItnak5Act_cFv */
void daObjItnak::Act_c::set_collision() {
/* Nonmatching */
BOOL was_hit;
cXyz cyl2_pos;
cXyz cyl2_world_pos;
cXyz cyl3_pos;
cXyz cyl3_world_pos;

if (this->mVisible == 1) {
was_hit = this->set_co_se(&this->mCyl1);
if (was_hit == 0) {
this->mCyl1.SetR(68.0);
this->mCyl1.SetH(230.0);
this->mCyl1.SetC(this->current.pos);
g_dComIfG_gameInfo.play.mCcS.Set((cCcD_Obj *)&this->mCyl1);
}
was_hit = this->set_co_se( &this->mCyl2);
if (was_hit == 0) {
cyl2_pos.x = 41.0;
cyl2_pos.y = 44.0;
cyl2_pos.z = 84.0;
PSMTXMultVec(this->mMtx, &cyl2_pos, &cyl2_world_pos);
this->mCyl2.SetR(62.0);
this->mCyl2.SetH(121.0);
this->mCyl2.SetC(cyl2_world_pos);
g_dComIfG_gameInfo.play.mCcS.Set((cCcD_Obj *)&this->mCyl2);
}
was_hit = this->set_co_se( &this->mCyl3);
if (was_hit == 0) {
cyl3_pos.x = -88.0;
cyl3_pos.y = 83.0;
cyl3_pos.z = 86.0;
PSMTXMultVec(this->mMtx, &cyl3_pos, &cyl3_world_pos);
this->mCyl3.SetR(47.0);
this->mCyl3.SetH(205.0);
this->mCyl3.SetC(cyl3_world_pos);
g_dComIfG_gameInfo.play.mCcS.Set( (cCcD_Obj *)&this->mCyl3);
}
fopAcM_rollPlayerCrash(this, 68.0, 0xd);
}
}

/* 00001118-00001158 .text _execute__Q210daObjItnak5Act_cFv */
bool daObjItnak::Act_c::_execute() {
/* Nonmatching */
this->set_mtx();
this->manage_draw_flag();
this->set_collision();
return true;
}

/* 00001158-0000123C .text _draw__Q210daObjItnak5Act_cFv */
bool daObjItnak::Act_c::_draw() {
/* Nonmatching */
u32 shadow_id;

if (this->mVisible != 0) {
g_env_light.settingTevStruct(TEV_TYPE_BG0, &this->current.pos, &this->tevStr);
g_env_light.setLightTevColorType(this->mpModel, &this->tevStr);
mDoExt_modelUpdateDL(this->mpModel);
cXyz scale = cXyz(this->current.pos.x, this->current.pos.y + 30.0f, this->current.pos.z);
shadow_id = dComIfGd_setShadow(this->mShadowId, 1, this->mpModel, &scale, 800.0, 60.0, this->current.pos.y, this->mGroundY,
this->mFloorPoly, &this->tevStr, 0, 1.0,
&dDlst_shadowControl_c::mSimpleTexObj);
this->mShadowId = shadow_id;
}
return true;
}

namespace daObjItnak {
Expand Down
Loading