From f02691a407304371832a217a2542be1f2d756f33 Mon Sep 17 00:00:00 2001 From: Zeclos Date: Thu, 27 Mar 2025 09:24:40 +0100 Subject: [PATCH] D_a_tpota (#710) * cool push for now, execute almost done * _create function * alot closer to matching most * fixed data * delete function * rodata is good now * 100% matching * matching in configure.py * changes from comments --- configure.py | 2 +- include/d/actor/d_a_tpota.h | 20 ++++++- src/d/actor/d_a_tpota.cpp | 115 ++++++++++++++++++++++++++++++------ 3 files changed, 114 insertions(+), 23 deletions(-) diff --git a/configure.py b/configure.py index 583c00105..d6c8db5e1 100755 --- a/configure.py +++ b/configure.py @@ -1441,7 +1441,7 @@ config.libs = [ ActorRel(Matching, "d_a_tag_waterlevel"), ActorRel(Matching, "d_a_tama", extra_cflags=['-pragma "nosyminline on"']), ActorRel(Matching, "d_a_tbox", extra_cflags=['-pragma "nosyminline on"']), - ActorRel(NonMatching, "d_a_tpota"), + ActorRel(Matching, "d_a_tpota", extra_cflags=['-pragma "nosyminline on"']), ActorRel(NonMatching, "d_a_tsubo"), ActorRel(NonMatching, "d_a_warpdm20"), ActorRel(NonMatching, "d_a_warphr"), diff --git a/include/d/actor/d_a_tpota.h b/include/d/actor/d_a_tpota.h index 52f4d20b0..9194c2ee6 100644 --- a/include/d/actor/d_a_tpota.h +++ b/include/d/actor/d_a_tpota.h @@ -3,21 +3,35 @@ #include "f_op/f_op_actor.h" + +class JPABaseEmitter; class JPABaseParticle; class daTpota_c : public fopAc_ac_c { + + struct unknown_struct { + JPABaseParticle* ptcl; + f32 pos_y; + }; + public: cPhs_State _create(); bool _delete(); void make_ripple(cXyz); - void check_water_h(JPABaseParticle*, float); + BOOL check_water_h(JPABaseParticle*, float); void clear_splash(); void renew_splash(); bool _execute(); bool _draw(); public: - /* Place member variables here */ -}; + /* 0x290 */ u8 field_0x290[0x298 - 0x290]; + /* 0x298 */ JPABaseEmitter* mpEmitters[2]; + /* 0x2A0 */ cXyz mPositions[2]; + /* 0x2B8 */ csXyz mAngles[2]; + /* 0x2C4 */ unknown_struct field_0x2C4[30]; + /* 0x3B4 */ u8 field_0x3B4[0x3E4 - 0x3B4]; +}; // Size: 0x3E4 + #endif /* D_A_TPOTA_H */ diff --git a/src/d/actor/d_a_tpota.cpp b/src/d/actor/d_a_tpota.cpp index b4f97b125..4e88474b1 100644 --- a/src/d/actor/d_a_tpota.cpp +++ b/src/d/actor/d_a_tpota.cpp @@ -5,71 +5,148 @@ #include "d/actor/d_a_tpota.h" #include "d/d_procname.h" +#include "JSystem/JGeometry.h" +#include "d/d_particle.h" +#include "JSystem/JParticle/JPAParticle.h" +#include "d/d_particle.h" +#include "d/d_com_inf_game.h" + +const u16 l_daTpota_idx_table[2] = {dPa_name::ID_SCENE_82AE, dPa_name::ID_SCENE_82AF}; /* 00000078-000001D0 .text _create__9daTpota_cFv */ cPhs_State daTpota_c::_create() { - /* Nonmatching */ + fopAcM_SetupActor(this, daTpota_c); + JPABaseEmitter* emitter; + for (int i = 0; i < 2; i++) { + mPositions[i] = current.pos; + mAngles[i] = current.angle; + emitter = dComIfGp_particle_set( + l_daTpota_idx_table[i], + &mPositions[i], + &mAngles[i], + NULL, 0xff, NULL, -1, NULL, NULL, NULL + ); + mpEmitters[i] = emitter; + } + return cPhs_COMPLEATE_e; } /* 00000250-00000298 .text _delete__9daTpota_cFv */ bool daTpota_c::_delete() { - /* Nonmatching */ + for (int i = 0; i < 2; i++) { + if (mpEmitters[i] != NULL) { + mpEmitters[i]->becomeInvalidEmitter(); + mpEmitters[i] = NULL; + } + } + return true; } /* 00000298-000002FC .text make_ripple__9daTpota_cF4cXyz */ -void daTpota_c::make_ripple(cXyz) { - /* Nonmatching */ +void daTpota_c::make_ripple(cXyz i_position) { + dComIfGp_particle_set(dPa_name::ID_SCENE_82B0, &i_position, + NULL, NULL, 0xff, NULL, -1, NULL, NULL, NULL); } /* 000002FC-00000354 .text check_water_h__9daTpota_cFP15JPABaseParticlef */ -void daTpota_c::check_water_h(JPABaseParticle*, float) { - /* Nonmatching */ +BOOL daTpota_c::check_water_h(JPABaseParticle* i_ptcl, float i_position_y) { + unknown_struct* unknown_struct = field_0x2C4; + int ret = FALSE; + if (i_position_y <= -230.0f) { + for (int i = 0; i < ARRAY_SIZE(field_0x2C4); i++, unknown_struct++) { + if (unknown_struct->ptcl == i_ptcl) { + if (unknown_struct->pos_y > -230.0f) { + ret = TRUE; + } + break; + } + } + } + return ret; } /* 00000354-00000380 .text clear_splash__9daTpota_cFv */ void daTpota_c::clear_splash() { - /* Nonmatching */ + unknown_struct* unknown_struct = field_0x2C4; + for (int i = 0; i < 30; i++) { + unknown_struct->ptcl = NULL; + unknown_struct->pos_y = 0.0f; + unknown_struct++; + } } /* 00000380-000003F4 .text renew_splash__9daTpota_cFv */ void daTpota_c::renew_splash() { - /* Nonmatching */ + if (mpEmitters[1] != NULL) { + JSUPtrList* list = mpEmitters[1]->getParticleList(); + unknown_struct *unknown_struct = field_0x2C4; + if(list != NULL){ + clear_splash(); + for (JSUPtrLink* link = list->getFirstLink(); link != NULL && (link != NULL); link = link->getNext()){ + JPABaseParticle* particle = (JPABaseParticle*)link->getObjectPtr(); + JGeometry::TVec3 position; + particle->getGlobalPosition(position); + unknown_struct->ptcl = particle; + unknown_struct->pos_y = position.y; + unknown_struct++; + } + } + } } /* 000003F4-000004C8 .text _execute__9daTpota_cFv */ bool daTpota_c::_execute() { - /* Nonmatching */ + if (mpEmitters[1] != NULL){ + JSUPtrList* list = mpEmitters[1]->getParticleList(); + if(list != NULL){ + for (JSUPtrLink* link = list->getFirstLink(); link != NULL && (link != NULL); + link = link->getNext()){ + JPABaseParticle* particle = (JPABaseParticle *)link->getObjectPtr(); + JGeometry::TVec3 position; + particle->getGlobalPosition(position); + if(check_water_h(particle, position.y)){ + cXyz local_48; + local_48.x = position.x; + local_48.y = -230.0; + local_48.z = position.z; + make_ripple(local_48); + } + } + } + renew_splash(); + } + return true; } /* 000004C8-000004D0 .text _draw__9daTpota_cFv */ bool daTpota_c::_draw() { - /* Nonmatching */ + return TRUE; } namespace { /* 000004D0-000004F0 .text Mthd_Create__23@unnamed@d_a_tpota_cpp@FPv */ -cPhs_State Mthd_Create(void*) { - /* Nonmatching */ +cPhs_State Mthd_Create(void* i_this) { + return static_cast(i_this)->_create(); } /* 000004F0-00000514 .text Mthd_Delete__23@unnamed@d_a_tpota_cpp@FPv */ -BOOL Mthd_Delete(void*) { - /* Nonmatching */ +BOOL Mthd_Delete(void* i_this) { + return static_cast(i_this)->_delete(); } /* 00000514-00000538 .text Mthd_Execute__23@unnamed@d_a_tpota_cpp@FPv */ -BOOL Mthd_Execute(void*) { - /* Nonmatching */ +BOOL Mthd_Execute(void* i_this) { + return static_cast(i_this)->_execute(); } /* 00000538-0000055C .text Mthd_Draw__23@unnamed@d_a_tpota_cpp@FPv */ -BOOL Mthd_Draw(void*) { - /* Nonmatching */ +BOOL Mthd_Draw(void* i_this) { + return static_cast(i_this)->_draw(); } /* 0000055C-00000564 .text Mthd_IsDelete__23@unnamed@d_a_tpota_cpp@FPv */ BOOL Mthd_IsDelete(void*) { - /* Nonmatching */ + return TRUE; } static actor_method_class Tpota_Mthd_Table = {