d_a_acorn_leaf (#807)

* d_a_acorn_leaf

* PR
This commit is contained in:
Maide
2025-07-14 23:48:26 +01:00
committed by GitHub
parent 129b604709
commit e58f66b8e4
4 changed files with 203 additions and 23 deletions
+1 -1
View File
@@ -1530,7 +1530,7 @@ config.libs = [
ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_tornado", extra_cflags=['-pragma "nosyminline on"']),
ActorRel(NonMatching, "d_a_warpf"),
ActorRel(NonMatching, "d_a_wind_tag"),
ActorRel(NonMatching, "d_a_acorn_leaf"),
ActorRel(MatchingFor("D44J01", "GZLJ01", "GZLE01", "GZLP01"), "d_a_acorn_leaf", extra_cflags=['-pragma "nosyminline on"']),
ActorRel(NonMatching, "d_a_atdoor"),
ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_auction", extra_cflags=['-pragma "nosyminline on"']),
ActorRel(NonMatching, "d_a_bb"),
+21 -5
View File
@@ -2,22 +2,38 @@
#define D_A_ACORN_LEAF_H
#include "f_op/f_op_actor.h"
#include "d/d_cc_d.h"
#include "d/d_particle.h"
class daAleaf_c : public fopAc_ac_c {
public:
inline bool _delete();
void CreateHeap();
BOOL CreateHeap();
void CreateInit();
void create_acorn();
void create_acorn_sub(bool);
fpc_ProcID create_acorn_sub(bool);
cPhs_State _create();
void set_mtx();
bool _execute();
bool _draw();
inline bool _delete();
static const char m_arcname[];
public:
/* Place member variables here */
/* 0x290 */ request_of_phase_process_class unk_290;
/* 0x298 */ J3DModel* unk_298;
/* 0x29C */ dCcD_Stts unk_29C;
/* 0x2D8 */ dCcD_Cyl unk_2D8;
/* 0x408 */ mDoExt_bckAnm unk_408;
/* 0x418 */ bool unk_418;
/* 0x419 */ bool unk_419;
/* 0x41A */ char unk41A[1];
/* 0x41B */ s8 unk_41B;
/* 0x41C */ s32 unk_41C;
/* 0x420 */ s32 unk_420;
/* 0x424 */ fpc_ProcID unk_424;
/* 0x428 */ fpc_ProcID unk_428;
/* 0x42C */ f32 unk_42C;
};
#endif /* D_A_ACORN_LEAF_H */
+19 -2
View File
@@ -18,6 +18,9 @@ namespace daTsubo {
enum Prm_e {
PRM_TYPE_W = 0x04,
PRM_TYPE_S = 0x18,
PRM_STICK_W = 0x01,
PRM_STICK_S = 0x1F,
};
enum Type {
@@ -57,8 +60,22 @@ namespace daTsubo {
void prm_get_itemSave() const {}
void prm_get_moveBg() const {}
void prm_get_spec() const {}
void prm_get_stick() const {}
void prm_make_acorn(bool, int, int) {}
int prm_get_stick() const {
return daObj::PrmAbstract(this, PRM_STICK_W, PRM_STICK_S);
}
static s32 prm_make_acorn(bool arg1, int item_no, int bit_no) {
s32 a1 = (arg1 ? 0x4 : 0x3F);
s32 param = 0;
param |= ((bit_no & 0x7F) << 16);
param |= ((item_no & 0x3F) << 0) | (a1 << 8);
param |= ((7 << 24) | (1 << 31));
return param;
}
void prm_make_skull() {}
void prm_make_yw1() {}
void prm_off_moveBg() {}
+162 -15
View File
@@ -7,6 +7,14 @@
#include "d/d_procname.h"
#include "d/d_priority.h"
#include "d/d_cc_d.h"
#include "d/d_com_inf_game.h"
#include "f_op/f_op_actor_mng.h"
#include "JSystem/J3DGraphANimator/J3DModel.h"
#include "d/actor/d_a_tsubo.h"
#include "d/actor/d_a_player.h"
#include "d/res/res_vigah.h"
static cXyz acorn_offset(0.0f, 15.0f, 0.0f);
static dCcD_SrcCyl l_cyl_src = {
// dCcD_SrcGObjInf
@@ -38,50 +46,189 @@ static dCcD_SrcCyl l_cyl_src = {
},
};
const char daAleaf_c::m_arcname[] = "VigaH";
namespace daAleaf_prm {
inline u32 getItemBitNo(daAleaf_c* actor) {
return (fopAcM_GetParam(actor) >> 6) & 0x7F;
}
inline u32 getItemNo(daAleaf_c* actor) {
return fopAcM_GetParam(actor) & 0x3F;
}
};
/* 000000EC-0000010C .text CheckCreateHeap__FP10fopAc_ac_c */
static BOOL CheckCreateHeap(fopAc_ac_c*) {
/* Nonmatching */
static BOOL CheckCreateHeap(fopAc_ac_c* i_actor) {
return ((daAleaf_c*)i_actor)->CreateHeap();
}
/* 0000010C-00000258 .text CreateHeap__9daAleaf_cFv */
void daAleaf_c::CreateHeap() {
/* Nonmatching */
BOOL daAleaf_c::CreateHeap() {
J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes(daAleaf_c::m_arcname, VIGAH_BDL_VIGAH);
JUT_ASSERT(VERSION_SELECT(258, 262, 262, 262), modelData != NULL);
unk_298 = mDoExt_J3DModel__create(modelData, 0x80000U, 0x11000022U);
if (unk_298 == NULL) {
return FALSE;
}
J3DAnmTransform* pbck = (J3DAnmTransform*)dComIfG_getObjectRes(daAleaf_c::m_arcname, VIGAH_BCK_VIGAH);
JUT_ASSERT(VERSION_SELECT(273, 277, 277, 277), pbck != NULL);
if (!unk_408.init(modelData, pbck, 1, 1, 1.0f, 0, -1, 0)) {
return FALSE;
}
return TRUE;
}
/* 00000258-00000314 .text CreateInit__9daAleaf_cFv */
void daAleaf_c::CreateInit() {
/* Nonmatching */
fopAcM_SetMtx(this, unk_298->getBaseTRMtx());
fopAcM_setCullSizeBox(this, -50.0f, 0.0f, -50.0f, 50.0f, 100.0f, 50.0f);
unk_29C.Init(255, 255, this);
unk_2D8.Set(l_cyl_src);
unk_2D8.SetStts(&unk_29C);
current.angle = home.angle;
unk_428 = fpcM_ERROR_PROCESS_ID_e;
unk_424 = fpcM_ERROR_PROCESS_ID_e;
set_mtx();
create_acorn_sub(false);
}
/* 00000314-00000384 .text create_acorn__9daAleaf_cFv */
void daAleaf_c::create_acorn() {
/* Nonmatching */
void daAleaf_c::create_acorn(void) {
fopAc_ac_c* sp8;
if ((unk_420 == 0) && !fopAcM_SearchByID(unk_424, &sp8)) {
create_acorn_sub(true);
unk_420 = 60;
}
if (unk_420 > 0) {
unk_420--;
}
}
/* 00000384-00000460 .text create_acorn_sub__9daAleaf_cFb */
void daAleaf_c::create_acorn_sub(bool) {
/* Nonmatching */
fpc_ProcID daAleaf_c::create_acorn_sub(bool arg1) {
u32 params = daTsubo::Act_c::prm_make_acorn(arg1, daAleaf_prm::getItemNo(this), daAleaf_prm::getItemBitNo(this));
mDoMtx_stack_c::XrotS(home.angle.x);
cXyz sp10;
mDoMtx_stack_c::multVec(&acorn_offset, &sp10);
unk_424 = fopAcM_createChildFromOffset(PROC_TSUBO, fpcM_GetID(this), params, &sp10, fopAcM_GetRoomNo(this), NULL, NULL, -1, NULL);
unk_41B = false;
unk_41C = false;
return unk_424;
}
/* 0000049C-000005EC .text _create__9daAleaf_cFv */
cPhs_State daAleaf_c::_create() {
/* Nonmatching */
fopAcM_SetupActor(this, daAleaf_c);
cPhs_State ret = dComIfG_resLoad(&unk_290, daAleaf_c::m_arcname);
if (ret == cPhs_COMPLEATE_e) {
if (!fopAcM_entrySolidHeap(this, CheckCreateHeap, 0x620)) {
return cPhs_ERROR_e;
}
CreateInit();
}
return ret;
}
/* 00000848-000008D0 .text set_mtx__9daAleaf_cFv */
void daAleaf_c::set_mtx() {
/* Nonmatching */
unk_298->setBaseScale(scale);
mDoMtx_stack_c::transS(current.pos);
mDoMtx_stack_c::ZXYrotM(current.angle.x, current.angle.y, current.angle.z);
unk_298->setBaseTRMtx(mDoMtx_stack_c::get());
}
/* 000008D0-00000C44 .text _execute__9daAleaf_cFv */
bool daAleaf_c::_execute() {
/* Nonmatching */
daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0);
fpc_ProcID sp14 = unk_424;
fopAc_ac_c* actor = fopAcM_Search(fpcSch_JudgeByID, &sp14);
bool var_r29 = false;
if (actor != NULL) {
var_r29 = ((daTsubo::Act_c*)actor)->prm_get_stick();
}
create_acorn();
if (actor != NULL) {
if (unk_41C < 69) {
unk_41C++;
}
if (unk_41C == 69) {
unk_418 = true;
unk_408.setPlaySpeed(1.0f);
unk_408.setFrame(0.0f);
unk_41C = 70;
}
}
if (!var_r29 && unk_419) {
unk_418 = true;
unk_408.setPlaySpeed(1.0f);
}
f32 var_f31 = std::sqrtf((player->current.pos - current.pos).getMagXZ());
if (var_f31 < 50.0f && (unk_42C - var_f31) > 3.0f && std::fabsf(player->current.pos.y - current.pos.y) < 5.0f) {
unk_418 = true;
unk_408.setPlaySpeed(1.0f);
}
if (var_f31 < 200.0f && unk_428 != player->getGrabActorID() && player->getGrabActorID() == fpcM_ERROR_PROCESS_ID_e) {
fpc_ProcID sp14 = unk_428;
fopAc_ac_c* actor = fopAcM_Search(fpcSch_JudgeByID, &sp14);
if (actor != NULL) {
f32 var_f1 = std::sqrtf((actor->current.pos - current.pos).getMagXZ());
if (var_f1 < 70.0f) {
unk_418 = true;
unk_408.setPlaySpeed(1.0f);
}
}
}
if (unk_418 && unk_408.play()) {
unk_418 = false;
}
set_mtx();
unk_419 = var_r29;
unk_428 = player->getGrabActorID();
unk_42C = var_f31;
return true;
}
/* 00000C44-00000CD4 .text _draw__9daAleaf_cFv */
bool daAleaf_c::_draw() {
/* Nonmatching */
g_env_light.settingTevStruct(TEV_TYPE_ACTOR, &current.pos, &tevStr);
g_env_light.setLightTevColorType(unk_298, &tevStr);
unk_408.entry(unk_298->getModelData());
mDoExt_modelUpdateDL(unk_298);
unk_408.remove(unk_298->getModelData());
return true;
}
bool daAleaf_c::_delete() {
dComIfG_resDeleteDemo(&unk_290, daAleaf_c::m_arcname);
return true;
}
/* 00000CD4-00000CF4 .text daAleaf_Create__FPv */
@@ -90,8 +237,8 @@ static cPhs_State daAleaf_Create(void* i_this) {
}
/* 00000CF4-00000D24 .text daAleaf_Delete__FPv */
static BOOL daAleaf_Delete(void*) {
/* Nonmatching */
static BOOL daAleaf_Delete(void* i_this) {
return ((daAleaf_c*)i_this)->_delete();
}
/* 00000D24-00000D48 .text daAleaf_Draw__FPv */