diff --git a/configure.py b/configure.py index a0f6e8a99..f0e7f1f4d 100755 --- a/configure.py +++ b/configure.py @@ -1469,7 +1469,7 @@ config.libs = [ ActorRel(Matching, "d_a_warpdm20", extra_cflags=['-pragma "nosyminline on"']), ActorRel(Matching, "d_a_warphr", extra_cflags=['-pragma "nosyminline on"']), ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_wbird"), - ActorRel(NonMatching, "d_a_ykgr"), + ActorRel(Equivalent, "d_a_ykgr", extra_cflags=['-pragma "nosyminline on"']), ActorRel(Matching, "d_a_alldie"), ActorRel(Matching, "d_a_am", extra_cflags=['-pragma "nosyminline on"']), ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_am2", extra_cflags=["-sym off"]), @@ -1506,7 +1506,7 @@ config.libs = [ ActorRel(Equivalent, "d_a_obj_barrier", extra_cflags=['-pragma "nosyminline on"']), # weak func order ActorRel(NonMatching, "d_a_obj_bemos"), ActorRel(Matching, "d_a_obj_canon", extra_cflags=["-sym off"]), - ActorRel(NonMatching, "d_a_obj_eff"), + ActorRel(Matching, "d_a_obj_eff", extra_cflags=['-pragma "nosyminline on"']), ActorRel(NonMatching, "d_a_obj_magmarock"), ActorRel(NonMatching, "d_a_obj_majyuu_door"), ActorRel(NonMatching, "d_a_obj_stair"), diff --git a/include/d/actor/d_a_obj_eff.h b/include/d/actor/d_a_obj_eff.h index b58c8dc7c..263e865e5 100644 --- a/include/d/actor/d_a_obj_eff.h +++ b/include/d/actor/d_a_obj_eff.h @@ -1,6 +1,7 @@ #ifndef D_A_OBJ_EFF_H #define D_A_OBJ_EFF_H +#include "d/d_a_obj.h" #include "f_op/f_op_actor.h" #include "f_op/f_op_actor_mng.h" #include "d/d_particle.h" @@ -9,29 +10,41 @@ namespace daObjEff { class Act_c : public fopAc_ac_c { public: + + typedef BOOL (Act_c::*Proc)(); + typedef void (Act_c::*voidProc)(); + typedef bool (Act_c::*HeapProc)(); + + enum Prm_e { + PRM_TYPE_W = 8, + PRM_TYPE_S = 0, + }; + static void make_barrel_smoke(cXyz* pos) { fopAcM_create(PROC_Obj_Eff, 0, pos); } static void make_land_smoke(cXyz*, float) {} static void make_pinecone_smoke(cXyz* pos) { fopAcM_create(PROC_Obj_Eff, 4, pos); } static void make_skull_smoke(cXyz* pos) { fopAcM_create(PROC_Obj_Eff, 2, pos); } static void make_stool_smoke(cXyz* pos) { fopAcM_create(PROC_Obj_Eff, 1, pos); } static void make_woodBox_smoke(cXyz*) {} - void prm_get_type() const {} + int prm_get_type() const { + return daObj::PrmAbstract(this, PRM_TYPE_W, PRM_TYPE_S); + } - void solidHeapCB(fopAc_ac_c*); - void create_heap_barrel_smoke(); - void create_heap_stool_smoke(); - void create_heap_skull_smoke(); - void create_heap_land_smoke(); - void create_heap_pinecone_smoke(); - void create_heap_woodBox_smoke(); - void create_heap(); - void eff_set_barrel_smoke(); - void eff_set_stool_smoke(); - void eff_set_skull_smoke(); - void eff_set_land_smoke(); - void eff_set_pinecone_smoke(); - void eff_set_woodBox_smoke(); - void eff_set(); + static BOOL solidHeapCB(fopAc_ac_c*); + bool create_heap_barrel_smoke(); + bool create_heap_stool_smoke(); + bool create_heap_skull_smoke(); + bool create_heap_land_smoke(); + bool create_heap_pinecone_smoke(); + bool create_heap_woodBox_smoke(); + bool create_heap(); + BOOL eff_set_barrel_smoke(); + BOOL eff_set_stool_smoke(); + BOOL eff_set_skull_smoke(); + BOOL eff_set_land_smoke(); + BOOL eff_set_pinecone_smoke(); + BOOL eff_set_woodBox_smoke(); + BOOL eff_set(); cPhs_State _create(); void remove_barrel_smoke(); void remove_stool_smoke(); @@ -51,25 +64,35 @@ namespace daObjEff { bool _execute(); public: - /* Place member variables here */ + /* 0x290 */ int mProcIndex; + /* 0x294 */ dPa_followEcallBack* mParticleCallback; }; class BarrelSmokeCB : public dPa_smokeEcallBack { public: BarrelSmokeCB(); void execute(JPABaseEmitter*); + public: + /* 0x20 */ int field_0x20; + /* 0x24 */ static const GXColor original_color; }; class StoolSmokeCB : public dPa_smokeEcallBack { public: StoolSmokeCB(); void execute(JPABaseEmitter*); + public: + /* 0x20 */ int field_0x20; + /* 0x24 */ static const GXColor original_color; }; class SkullSmokeCB : public dPa_smokeEcallBack { public: SkullSmokeCB(); void execute(JPABaseEmitter*); + public: + /* 0x20 */ int field_0x20; + /* 0x24 */ static const GXColor original_color; }; class LandSmokeCB : public dPa_smokeEcallBack { @@ -81,12 +104,18 @@ namespace daObjEff { public: PineconeSmokeCB(); void execute(JPABaseEmitter*); + public: + /* 0x20 */ int field_0x20; + /* 0x24 */ static const GXColor original_color; }; class WoodBoxSmokeCB : public dPa_smokeEcallBack { public: WoodBoxSmokeCB(); void execute(JPABaseEmitter*); + public: + /* 0x20 */ int field_0x20; + /* 0x24 */ static const GXColor original_color; }; }; diff --git a/include/d/actor/d_a_ykgr.h b/include/d/actor/d_a_ykgr.h index 7f1194170..214bb43a3 100644 --- a/include/d/actor/d_a_ykgr.h +++ b/include/d/actor/d_a_ykgr.h @@ -2,6 +2,10 @@ #define D_A_YKGR_H #include "f_op/f_op_actor.h" +#include "Jsystem/JParticle/JPAEmitter.h" +#include "f_op/f_op_camera_mng.h" +#include "d/d_com_inf_game.h" +#include "m_Do/m_Do_hostIO.h" struct dPath; class JPABaseEmitter; @@ -35,21 +39,48 @@ public: inline bool _execute(); void hide() {} void setAimRate(float) {} - void setAlpha(unsigned char) {} - void set_mtx() {} + void setAlpha(unsigned char alpha) { m_alpha = alpha; } + inline void set_mtx(); void show() {} - void start() {} + void start() { + if (m_emitter != NULL) { + m_alpha_flag = 1; + } + } - void getPosRate(); + f32 getPosRate(); public: - /* Place member variables here */ -}; + /* 0x290 */ request_of_phase_process_class mPhase; + /* 0x298 */ Mtx mMtx; + /* 0x2C8 */ u8 m2C8[0x2CC - 0x2C8]; + /* 0x2CC */ f32 m2CC; + /* 0x2D0 */ f32 m2D0; +}; // size = 0x2D4 -class dPa_YkgrPcallBack { +class dPa_YkgrPcallBack : public JPACallBackBase2 { public: + dPa_YkgrPcallBack() { + m04 = 0.5f; + m08 = 0.0f; + m0C = 0.0f; + m10 = 0.0f; + m14 = 0.5f; + m18 = 0.0f; + m1C = true; + } + void draw(JPABaseEmitter*, JPABaseParticle*); void setParam(float); -}; + +public: + /* 0x04 */ f32 m04; + /* 0x08 */ f32 m08; + /* 0x0C */ f32 m0C; + /* 0x10 */ f32 m10; + /* 0x14 */ f32 m14; + /* 0x18 */ f32 m18; + /* 0x1C */ s8 m1C; +}; // size = 0x20 #endif /* D_A_YKGR_H */ diff --git a/src/d/actor/d_a_obj_eff.cpp b/src/d/actor/d_a_obj_eff.cpp index 15a317a31..4ea68fd55 100644 --- a/src/d/actor/d_a_obj_eff.cpp +++ b/src/d/actor/d_a_obj_eff.cpp @@ -2,261 +2,463 @@ // Generated by dtk // Translation Unit: d_a_obj_eff.cpp // - #include "d/actor/d_a_obj_eff.h" #include "d/d_procname.h" #include "d/d_priority.h" +#include "d/d_com_inf_game.h" + +#include "weak_bss_936_to_1036.h" // IWYU pragma: keep +#include "weak_data_1811.h" // IWYU pragma: keep +#include "weak_data_2100_2080.h" + +const GXColor daObjEff::BarrelSmokeCB::original_color = {0xAF, 0x96, 0x64, 0xFF}; + /* 000000EC-00000140 .text __ct__Q28daObjEff13BarrelSmokeCBFv */ -daObjEff::BarrelSmokeCB::BarrelSmokeCB() { - /* Nonmatching */ +daObjEff::BarrelSmokeCB::BarrelSmokeCB() : dPa_smokeEcallBack(original_color, NULL, 0) { + field_0x20 = 0x3c; } /* 00000140-000001CC .text execute__Q28daObjEff13BarrelSmokeCBFP14JPABaseEmitter */ -void daObjEff::BarrelSmokeCB::execute(JPABaseEmitter*) { - /* Nonmatching */ +void daObjEff::BarrelSmokeCB::execute(JPABaseEmitter *i_emitter) { + field_0x20 -= 1; + if (field_0x20 <= 0) { + end(); + } else if (field_0x20 < 0x32) { + i_emitter->setGlobalAlpha(field_0x20 * 3.6f); + } } +const GXColor daObjEff::StoolSmokeCB::original_color = {0xAF, 0x96, 0x64, 0xFF}; /* 000001CC-00000220 .text __ct__Q28daObjEff12StoolSmokeCBFv */ -daObjEff::StoolSmokeCB::StoolSmokeCB() { - /* Nonmatching */ +daObjEff::StoolSmokeCB::StoolSmokeCB() : dPa_smokeEcallBack(original_color, NULL, 0) { + field_0x20 = 0x3c; } /* 00000220-000002AC .text execute__Q28daObjEff12StoolSmokeCBFP14JPABaseEmitter */ -void daObjEff::StoolSmokeCB::execute(JPABaseEmitter*) { - /* Nonmatching */ +void daObjEff::StoolSmokeCB::execute(JPABaseEmitter *i_emitter) { + field_0x20 -= 1; + if (field_0x20 <= 0) { + end(); + } else if (field_0x20 < 0x32) { + i_emitter->setGlobalAlpha(field_0x20 * 3.6f); + } } +const GXColor daObjEff::SkullSmokeCB::original_color = {0xA0, 0xA0, 0x80, 0xFF}; /* 000002AC-00000300 .text __ct__Q28daObjEff12SkullSmokeCBFv */ -daObjEff::SkullSmokeCB::SkullSmokeCB() { - /* Nonmatching */ +daObjEff::SkullSmokeCB::SkullSmokeCB() : dPa_smokeEcallBack(original_color, NULL, 0) { + field_0x20 = 0x3c; } /* 00000300-0000038C .text execute__Q28daObjEff12SkullSmokeCBFP14JPABaseEmitter */ -void daObjEff::SkullSmokeCB::execute(JPABaseEmitter*) { - /* Nonmatching */ +void daObjEff::SkullSmokeCB::execute(JPABaseEmitter *i_emitter) { + field_0x20 -= 1; + if (field_0x20 <= 0) { + end(); + } else if (field_0x20 < 0x32) { + i_emitter->setGlobalAlpha(field_0x20 * 3.6f); + } } /* 0000038C-000003CC .text __ct__Q28daObjEff11LandSmokeCBFv */ -daObjEff::LandSmokeCB::LandSmokeCB() { - /* Nonmatching */ +daObjEff::LandSmokeCB::LandSmokeCB() : dPa_smokeEcallBack(0) { } +const GXColor daObjEff::PineconeSmokeCB::original_color = {0x96, 0x78, 0x3C, 0xFF}; /* 000003CC-00000420 .text __ct__Q28daObjEff15PineconeSmokeCBFv */ -daObjEff::PineconeSmokeCB::PineconeSmokeCB() { - /* Nonmatching */ +daObjEff::PineconeSmokeCB::PineconeSmokeCB() : dPa_smokeEcallBack(original_color, NULL, 0) { + field_0x20 = 0x3c; } /* 00000420-000004AC .text execute__Q28daObjEff15PineconeSmokeCBFP14JPABaseEmitter */ -void daObjEff::PineconeSmokeCB::execute(JPABaseEmitter*) { - /* Nonmatching */ +void daObjEff::PineconeSmokeCB::execute(JPABaseEmitter *i_emitter) { + field_0x20 -= 1; + if (field_0x20 <= 0) { + end(); + } else if (field_0x20 < 0x32) { + i_emitter->setGlobalAlpha(field_0x20 * 3.6f); + } } +const GXColor daObjEff::WoodBoxSmokeCB::original_color = {0xAF, 0x96, 0x64, 0xFF}; /* 000004AC-00000500 .text __ct__Q28daObjEff14WoodBoxSmokeCBFv */ -daObjEff::WoodBoxSmokeCB::WoodBoxSmokeCB() { - /* Nonmatching */ +daObjEff::WoodBoxSmokeCB::WoodBoxSmokeCB() : dPa_smokeEcallBack(original_color, NULL, 0) { + field_0x20 = 0x3c; } /* 00000500-0000058C .text execute__Q28daObjEff14WoodBoxSmokeCBFP14JPABaseEmitter */ -void daObjEff::WoodBoxSmokeCB::execute(JPABaseEmitter*) { - /* Nonmatching */ +void daObjEff::WoodBoxSmokeCB::execute(JPABaseEmitter *i_emitter) { + field_0x20 -= 1; + if (field_0x20 <= 0) { + end(); + } else if (field_0x20 < 0x32) { + i_emitter->setGlobalAlpha(field_0x20 * 3.6f); + } } /* 0000058C-000005B0 .text solidHeapCB__Q28daObjEff5Act_cFP10fopAc_ac_c */ -void daObjEff::Act_c::solidHeapCB(fopAc_ac_c*) { - /* Nonmatching */ +BOOL daObjEff::Act_c::solidHeapCB(fopAc_ac_c *i_this) { + return static_cast(i_this)->create_heap(); } /* 000005B0-00000600 .text create_heap_barrel_smoke__Q28daObjEff5Act_cFv */ -void daObjEff::Act_c::create_heap_barrel_smoke() { - /* Nonmatching */ +bool daObjEff::Act_c::create_heap_barrel_smoke() { + BarrelSmokeCB *barrel_smoke_cb = new BarrelSmokeCB(); + mParticleCallback = barrel_smoke_cb; + return mParticleCallback != NULL; } /* 00000600-00000650 .text create_heap_stool_smoke__Q28daObjEff5Act_cFv */ -void daObjEff::Act_c::create_heap_stool_smoke() { - /* Nonmatching */ +bool daObjEff::Act_c::create_heap_stool_smoke() { + StoolSmokeCB *stool_smoke_cb = new StoolSmokeCB(); + mParticleCallback = stool_smoke_cb; + return mParticleCallback != NULL; } /* 00000650-000006A0 .text create_heap_skull_smoke__Q28daObjEff5Act_cFv */ -void daObjEff::Act_c::create_heap_skull_smoke() { - /* Nonmatching */ +bool daObjEff::Act_c::create_heap_skull_smoke() { + SkullSmokeCB *skull_smoke_cb = new SkullSmokeCB(); + mParticleCallback = skull_smoke_cb; + return mParticleCallback != NULL; } /* 000006A0-000006F0 .text create_heap_land_smoke__Q28daObjEff5Act_cFv */ -void daObjEff::Act_c::create_heap_land_smoke() { - /* Nonmatching */ +bool daObjEff::Act_c::create_heap_land_smoke() { + LandSmokeCB *land_smoke_cb = new LandSmokeCB(); + mParticleCallback = land_smoke_cb; + return mParticleCallback != NULL; } /* 000006F0-00000740 .text create_heap_pinecone_smoke__Q28daObjEff5Act_cFv */ -void daObjEff::Act_c::create_heap_pinecone_smoke() { - /* Nonmatching */ +bool daObjEff::Act_c::create_heap_pinecone_smoke() { + PineconeSmokeCB *pinecone_smoke_cb = new PineconeSmokeCB(); + mParticleCallback = pinecone_smoke_cb; + return mParticleCallback != NULL; } /* 00000740-00000790 .text create_heap_woodBox_smoke__Q28daObjEff5Act_cFv */ -void daObjEff::Act_c::create_heap_woodBox_smoke() { - /* Nonmatching */ +bool daObjEff::Act_c::create_heap_woodBox_smoke() { + WoodBoxSmokeCB *woodbox_smoke_cb = new WoodBoxSmokeCB(); + mParticleCallback = woodbox_smoke_cb; + return mParticleCallback != NULL; } /* 00000790-00000898 .text create_heap__Q28daObjEff5Act_cFv */ -void daObjEff::Act_c::create_heap() { - /* Nonmatching */ +bool daObjEff::Act_c::create_heap() { + static HeapProc proc[] = { + &Act_c::create_heap_barrel_smoke, + &Act_c::create_heap_stool_smoke, + &Act_c::create_heap_skull_smoke, + &Act_c::create_heap_land_smoke, + &Act_c::create_heap_pinecone_smoke, + &Act_c::create_heap_woodBox_smoke + }; + + bool ret = false; + if ((this->*proc[mProcIndex])()) { + ret = true; + } + + return ret; } /* 00000898-00000998 .text eff_set_barrel_smoke__Q28daObjEff5Act_cFv */ -void daObjEff::Act_c::eff_set_barrel_smoke() { - /* Nonmatching */ +BOOL daObjEff::Act_c::eff_set_barrel_smoke() { + static cXyz particle_scl(2.5f, 2.5f, 1.0f); + JPABaseEmitter *emitter = dComIfGp_particle_setToon(dPa_name::ID_COMMON_2027, ¤t.pos, NULL, NULL, 0xB4, mParticleCallback, -1, NULL, NULL, &particle_scl); + if (emitter != NULL) { + emitter->setVolumeSize(0x28); + emitter->setRate(20.0f); + emitter->setMaxFrame(1); + emitter->setAwayFromCenterSpeed(15.0f); + emitter->setAwayFromAxisSpeed(10.0f); + return true; + } + + return false; } /* 000009D4-00000AD0 .text eff_set_stool_smoke__Q28daObjEff5Act_cFv */ -void daObjEff::Act_c::eff_set_stool_smoke() { - /* Nonmatching */ +BOOL daObjEff::Act_c::eff_set_stool_smoke() { + static cXyz particle_scl(2.5f, 2.5f, 1.0f); + JPABaseEmitter *emitter = dComIfGp_particle_setToon(dPa_name::ID_COMMON_2027, ¤t.pos, + NULL, NULL, 0xB4, mParticleCallback, -1, NULL, NULL, &particle_scl); + if (emitter != NULL) { + emitter->setVolumeSize(0x1E); + emitter->setRate(15.0f); + emitter->setMaxFrame(1); + emitter->setAwayFromCenterSpeed(15.0f); + emitter->setAwayFromAxisSpeed(10.0f); + return true; + } + + return FALSE; } /* 00000AD0-00000BC0 .text eff_set_skull_smoke__Q28daObjEff5Act_cFv */ -void daObjEff::Act_c::eff_set_skull_smoke() { - /* Nonmatching */ +BOOL daObjEff::Act_c::eff_set_skull_smoke() { + static cXyz particle_scl(1.6f, 1.6f, 1.0f); + JPABaseEmitter *emitter = dComIfGp_particle_setToon(dPa_name::ID_COMMON_2027, ¤t.pos, + NULL, NULL, 0xB4, mParticleCallback, -1, NULL, NULL, &particle_scl); + if (emitter != NULL) { + emitter->setRate(10.0f); + emitter->setMaxFrame(1); + emitter->setAwayFromCenterSpeed(8.0f); + return true; + } + + return FALSE; } /* 00000BC0-00000D24 .text eff_set_land_smoke__Q28daObjEff5Act_cFv */ -void daObjEff::Act_c::eff_set_land_smoke() { - /* Nonmatching */ +BOOL daObjEff::Act_c::eff_set_land_smoke() { + int ret; + cXyz pScale; + pScale.x = scale.x; + pScale.y = scale.y; + pScale.z = scale.z; + + JPABaseEmitter *emitter = dComIfGp_particle_setToon(dPa_name::ID_COMMON_2027, ¤t.pos, + NULL, &pScale, 0xB4, mParticleCallback, -1, NULL, NULL, NULL); + if (emitter != NULL) { + emitter->setVolumeSize(0x1E); + emitter->setLifeTime(0x23); + emitter->setRate(20.0f); + emitter->setMaxFrame(1); + emitter->setAwayFromCenterSpeed(10.0f); + static JGeometry::TVec3 em_scl(1.0f, 0.0f, 1.0f); + emitter->setEmitterScale(em_scl); + static JGeometry::TVec3 em_trans(0.0f, 5.0f, 0.0f); + emitter->setEmitterTranslation(em_trans); + ret = true; + } else { + ret = false; + } + + return ret; } /* 00000D24-00000D98 .text eff_set_pinecone_smoke__Q28daObjEff5Act_cFv */ -void daObjEff::Act_c::eff_set_pinecone_smoke() { - /* Nonmatching */ +BOOL daObjEff::Act_c::eff_set_pinecone_smoke() { + JPABaseEmitter *emitter = dComIfGp_particle_setToon(dPa_name::ID_SCENE_A16B, ¤t.pos, + NULL, NULL, 0xB4, mParticleCallback, -1, NULL, NULL, NULL); + return emitter != NULL; } /* 00000D98-00000E80 .text eff_set_woodBox_smoke__Q28daObjEff5Act_cFv */ -void daObjEff::Act_c::eff_set_woodBox_smoke() { - /* Nonmatching */ +BOOL daObjEff::Act_c::eff_set_woodBox_smoke() { + static cXyz particle_scl(2.5f, 2.5f, 1.0f); + JPABaseEmitter *emitter = dComIfGp_particle_setToon(dPa_name::ID_COMMON_2027, ¤t.pos, + NULL, NULL, 0xB4, mParticleCallback, -1, NULL, NULL, &particle_scl); + if (emitter != NULL) { + emitter->mRate = 30.0f; + emitter->mMaxFrame = 1; + return true; + } + + return false; } /* 00000E80-00000F6C .text eff_set__Q28daObjEff5Act_cFv */ -void daObjEff::Act_c::eff_set() { - /* Nonmatching */ +BOOL daObjEff::Act_c::eff_set() { + static Proc proc[] = { + &Act_c::eff_set_barrel_smoke, + &Act_c::eff_set_stool_smoke, + &Act_c::eff_set_skull_smoke, + &Act_c::eff_set_land_smoke, + &Act_c::eff_set_pinecone_smoke, + &Act_c::eff_set_woodBox_smoke + }; + + return (this->*proc[mProcIndex])(); } /* 00000F6C-00001030 .text _create__Q28daObjEff5Act_cFv */ cPhs_State daObjEff::Act_c::_create() { - /* Nonmatching */ + static const u32 heap_size[] = { + 0x00000040, + 0x00000040, + 0x00000040, + 0x00000020, + 0x00000040, + 0x00000040, + }; + + mProcIndex = prm_get_type(); + fopAcM_SetupActor(this, daObjEff::Act_c); + int phase = cPhs_COMPLEATE_e; + if (fopAcM_entrySolidHeap(this, &solidHeapCB, heap_size[mProcIndex])) { + if ((u8) eff_set() != 0) { + fopDwTg_DrawQTo(&draw_tag); + } else { + phase = cPhs_ERROR_e; + } + } else { + phase = cPhs_ERROR_e; + } + + return phase; } /* 00001030-00001068 .text remove_barrel_smoke__Q28daObjEff5Act_cFv */ void daObjEff::Act_c::remove_barrel_smoke() { - /* Nonmatching */ + if (mParticleCallback != NULL) { + (mParticleCallback)->remove(); + } } /* 00001068-000010A0 .text remove_stool_smoke__Q28daObjEff5Act_cFv */ void daObjEff::Act_c::remove_stool_smoke() { - /* Nonmatching */ + if (mParticleCallback != NULL) { + (mParticleCallback)->remove(); + } } /* 000010A0-000010D8 .text remove_skull_smoke__Q28daObjEff5Act_cFv */ void daObjEff::Act_c::remove_skull_smoke() { - /* Nonmatching */ + if (mParticleCallback != NULL) { + (mParticleCallback)->remove(); + } } /* 000010D8-00001110 .text remove_land_smoke__Q28daObjEff5Act_cFv */ void daObjEff::Act_c::remove_land_smoke() { - /* Nonmatching */ + if (mParticleCallback != NULL) { + (mParticleCallback)->remove(); + } } /* 00001110-00001148 .text remove_pinecone_smoke__Q28daObjEff5Act_cFv */ void daObjEff::Act_c::remove_pinecone_smoke() { - /* Nonmatching */ + if (mParticleCallback != NULL) { + (mParticleCallback)->remove(); + } } /* 00001148-00001180 .text remove_woodBox_smoke__Q28daObjEff5Act_cFv */ void daObjEff::Act_c::remove_woodBox_smoke() { - /* Nonmatching */ + if (mParticleCallback != NULL) { + (mParticleCallback)->remove(); + } } /* 00001180-0000126C .text remove__Q28daObjEff5Act_cFv */ void daObjEff::Act_c::remove() { - /* Nonmatching */ + static voidProc proc[] = { + &Act_c::remove_barrel_smoke, + &Act_c::remove_stool_smoke, + &Act_c::remove_skull_smoke, + &Act_c::remove_land_smoke, + &Act_c::remove_pinecone_smoke, + &Act_c::remove_woodBox_smoke + }; + (this->*proc[mProcIndex])(); } /* 0000126C-00001290 .text _delete__Q28daObjEff5Act_cFv */ bool daObjEff::Act_c::_delete() { - /* Nonmatching */ + remove(); + return TRUE; } /* 00001290-000012C0 .text die_barrel_smoke__Q28daObjEff5Act_cFv */ void daObjEff::Act_c::die_barrel_smoke() { - /* Nonmatching */ + if (mParticleCallback->isEnd()) { + fopAcM_delete(this); + } } /* 000012C0-000012F0 .text die_stool_smoke__Q28daObjEff5Act_cFv */ void daObjEff::Act_c::die_stool_smoke() { - /* Nonmatching */ + if (mParticleCallback->isEnd()) { + fopAcM_delete(this); + } } /* 000012F0-00001320 .text die_skull_smoke__Q28daObjEff5Act_cFv */ void daObjEff::Act_c::die_skull_smoke() { - /* Nonmatching */ + if (mParticleCallback->isEnd()) { + fopAcM_delete(this); + } } /* 00001320-00001350 .text die_land_smoke__Q28daObjEff5Act_cFv */ void daObjEff::Act_c::die_land_smoke() { - /* Nonmatching */ + if (mParticleCallback->isEnd()) { + fopAcM_delete(this); + } } /* 00001350-00001380 .text die_pinecone_smoke__Q28daObjEff5Act_cFv */ void daObjEff::Act_c::die_pinecone_smoke() { - /* Nonmatching */ + if (mParticleCallback->isEnd()) { + fopAcM_delete(this); + } } /* 00001380-000013B0 .text die_woodBox_smoke__Q28daObjEff5Act_cFv */ void daObjEff::Act_c::die_woodBox_smoke() { - /* Nonmatching */ + if (mParticleCallback->isEnd()) { + fopAcM_delete(this); + } } /* 000013B0-0000149C .text die__Q28daObjEff5Act_cFv */ void daObjEff::Act_c::die() { - /* Nonmatching */ + static voidProc proc[] = { + &Act_c::die_barrel_smoke, + &Act_c::die_stool_smoke, + &Act_c::die_skull_smoke, + &Act_c::die_land_smoke, + &Act_c::die_pinecone_smoke, + &Act_c::die_woodBox_smoke + }; + + (this->*proc[mProcIndex])(); } /* 0000149C-000014C0 .text _execute__Q28daObjEff5Act_cFv */ bool daObjEff::Act_c::_execute() { - /* Nonmatching */ + die(); + return TRUE; } namespace daObjEff { -namespace { -/* 000014C0-000014E0 .text Mthd_Create__Q28daObjEff25@unnamed@d_a_obj_eff_cpp@FPv */ -cPhs_State Mthd_Create(void* i_this) { - return ((daObjEff::Act_c*)i_this)->_create(); -} + namespace { + /* 000014C0-000014E0 .text Mthd_Create__Q28daObjEff25@unnamed@d_a_obj_eff_cpp@FPv */ + cPhs_State Mthd_Create(void *i_this) { + return ((Act_c *) i_this)->_create(); + } -/* 000014E0-00001504 .text Mthd_Delete__Q28daObjEff25@unnamed@d_a_obj_eff_cpp@FPv */ -BOOL Mthd_Delete(void* i_this) { - return ((daObjEff::Act_c*)i_this)->_delete(); -} + /* 000014E0-00001504 .text Mthd_Delete__Q28daObjEff25@unnamed@d_a_obj_eff_cpp@FPv */ + BOOL Mthd_Delete(void *i_this) { + return ((Act_c *) i_this)->_delete(); + } -/* 00001504-00001528 .text Mthd_Execute__Q28daObjEff25@unnamed@d_a_obj_eff_cpp@FPv */ -BOOL Mthd_Execute(void* i_this) { - return ((daObjEff::Act_c*)i_this)->_execute(); -} + /* 00001504-00001528 .text Mthd_Execute__Q28daObjEff25@unnamed@d_a_obj_eff_cpp@FPv */ + BOOL Mthd_Execute(void *i_this) { + return ((Act_c *) i_this)->_execute(); + } -/* 00001528-00001530 .text Mthd_Draw__Q28daObjEff25@unnamed@d_a_obj_eff_cpp@FPv */ -BOOL Mthd_Draw(void*) { - return TRUE; -} + /* 00001528-00001530 .text Mthd_Draw__Q28daObjEff25@unnamed@d_a_obj_eff_cpp@FPv */ + BOOL Mthd_Draw(void *) { + return TRUE; + } -/* 00001530-00001538 .text Mthd_IsDelete__Q28daObjEff25@unnamed@d_a_obj_eff_cpp@FPv */ -BOOL Mthd_IsDelete(void*) { - return TRUE; -} + /* 00001530-00001538 .text Mthd_IsDelete__Q28daObjEff25@unnamed@d_a_obj_eff_cpp@FPv */ + BOOL Mthd_IsDelete(void *) { + return TRUE; + } -static actor_method_class Mthd_Table = { - (process_method_func)Mthd_Create, - (process_method_func)Mthd_Delete, - (process_method_func)Mthd_Execute, - (process_method_func)Mthd_IsDelete, - (process_method_func)Mthd_Draw, -}; -}; // namespace + static actor_method_class Mthd_Table = { + static_cast(Mthd_Create), + static_cast(Mthd_Delete), + static_cast(Mthd_Execute), + static_cast(Mthd_IsDelete), + static_cast(Mthd_Draw), + }; + }; // namespace }; // namespace daObjEff actor_process_profile_definition g_profile_Obj_Eff = { diff --git a/src/d/actor/d_a_ykgr.cpp b/src/d/actor/d_a_ykgr.cpp index f9dc66a17..bcc57a118 100644 --- a/src/d/actor/d_a_ykgr.cpp +++ b/src/d/actor/d_a_ykgr.cpp @@ -4,22 +4,119 @@ // #include "d/actor/d_a_ykgr.h" +#include "d/actor/d_a_player.h" #include "d/d_procname.h" #include "d/d_priority.h" +#include "d/d_path.h" +#include "f_op/f_op_actor_mng.h" +#include "m_Do/m_Do_hostIO.h" + +#include "weak_bss_936_to_1036.h" // IWYU pragma: keep + +class daYkgr_HIO_c : +#if VERSION == VERSION_DEMO + public JORReflexible +#else + public mDoHIO_entry_c +#endif +{ +public: + daYkgr_HIO_c() { +#if VERSION == VERSION_DEMO + mNo = -1; + m05 = 0; +#else + mNo = 0; +#endif + m08 = 0xFF; + m0C = 3; + m10 = -16.0f; + m14 = -5.0f; + m18 = -3.0f; + m1C = 0.0f; + m20 = 1500.0f; + m24 = 500.0f; + } + + virtual ~daYkgr_HIO_c() { +#if VERSION == VERSION_DEMO + mNo = -1; +#endif + } + + void genMessage(JORMContext*); + +public: + /* 0x04 */ s8 mNo; + /* 0x05 */ s8 m05; + /* 0x08 */ s32 m08; + /* 0x0C */ s32 m0C; + /* 0x10 */ f32 m10; + /* 0x14 */ f32 m14; + /* 0x18 */ f32 m18; + /* 0x1C */ f32 m1C; + /* 0x20 */ f32 m20; + /* 0x24 */ f32 m24; +}; // size = 0x28 + +static daYkgr_HIO_c l_HIO; +static dPa_YkgrPcallBack YkgrCB; /* 000000EC-00000134 .text draw__17dPa_YkgrPcallBackFP14JPABaseEmitterP15JPABaseParticle */ void dPa_YkgrPcallBack::draw(JPABaseEmitter*, JPABaseParticle*) { - /* Nonmatching */ + GXSetIndTexMtx(GX_ITM_0, &m04, m1C); + GXSetTevAlphaIn(GX_TEVSTAGE0, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_A0); } /* 00000134-00000234 .text setParam__17dPa_YkgrPcallBackFf */ -void dPa_YkgrPcallBack::setParam(float) { - /* Nonmatching */ +void dPa_YkgrPcallBack::setParam(float arg1) { + if ((arg1 <= -17.0f) || (arg1 >= 47.0f)) { + return; + } + + if (arg1 >= 0.0f) { + m1C = arg1; + m04 = m14 = (arg1 - m1C) * 0.5f + 0.5f; + } else { + f32 tmp = arg1 - 1.0f; + m1C = tmp; + m04 = m14 = (tmp - m1C) * 0.5f + 1.0f; + } + + m08 = 0.0f; + m0C = 0.0f; + m10 = 0.0f; + m18 = 0.0f; } /* 00000234-00000408 .text getPosRate__8daYkgr_cFv */ -void daYkgr_c::getPosRate() { - /* Nonmatching */ +f32 daYkgr_c::getPosRate() { + if (m_path == NULL) { + return 0.0f; + } + + f32 fVar4 = FLOAT_MAX; + fopAc_ac_c* player = dComIfGp_getPlayer(0); + cXyz sp30 = player->current.pos; + dPnt* pdVar7 = m_path->m_points; + s32 num = m_path->m_num; + + for (s32 i = 0; i < num; i++, pdVar7++) { + cXyz sp24(pdVar7->m_position.x, pdVar7->m_position.y, pdVar7->m_position.z); + f32 abs = sp30.absXZ(sp24); + if (abs < fVar4) { + fVar4 = abs; + } + } + + if (fVar4 > l_HIO.m20) { + fVar4 = l_HIO.m20; + } else if (fVar4 < l_HIO.m24) { + fVar4 = l_HIO.m24; + } + + fVar4 = (fVar4 - l_HIO.m24) / (l_HIO.m20 - l_HIO.m24); + return 1.0f - fVar4; } /* 00000408-00000428 .text daYkgrCreate__FPv */ @@ -29,22 +126,143 @@ static cPhs_State daYkgrCreate(void* i_this) { /* 00000428-00000680 .text _create__8daYkgr_cFv */ cPhs_State daYkgr_c::_create() { - /* Nonmatching */ + u8 uVar4 = fopAcM_GetParam(this) >> 0x14 & 0xF; + + fopAcM_SetupActor(this, daYkgr_c); + + u8 pathIndex = fopAcM_GetParam(this) >> 8 & 0xFF; + if (pathIndex != 0xff) { + m_path = dPath_GetRoomPath(pathIndex, fopAcM_GetRoomNo(this)); + } else { + m_path = NULL; + } + + if (strcmp(dComIfGp_getStartStageName(), "Adanmae") == 0 && dComIfGs_isSymbol(1)) { + return cPhs_STOP_e; + } + + if (m_emitter == NULL) { + fopAc_ac_c* player = dComIfGp_getPlayer(0); + current.pos = player->current.pos; + m_emitter = dComIfGp_particle_setProjection(dPa_name::ID_SCENE_C06D, ¤t.pos); + if (m_emitter != NULL) { + m_emitter->setParticleCallBackPtr(&YkgrCB); + YkgrCB.setParam(-3.0f); + } else { + return cPhs_ERROR_e; + } + + fopAcM_setStageLayer(this); + + if ((s32)uVar4 == 1) { + setAlpha(0xFF); + m_emitter->setGlobalAlpha(0xFF); + m2CC = 0.5f; + m2D0 = 0.0f; + start(); + } else { + setAlpha(0); + m_emitter->setGlobalAlpha(0); + m2CC = 0.5f; + m2D0 = 0.0f; + stop(); + } + +#if VERSION == VERSION_DEMO + if (l_HIO.mNo < 0) { + l_HIO.mNo = mDoHIO_createChild("竜の山陽炎", &l_HIO); + } +#endif + } else { + if ((s32)uVar4 == 1) { + start(); + } else { + stop(); + } + return cPhs_STOP_e; + } + + return cPhs_COMPLEATE_e; +} + +bool daYkgr_c::_delete() { + return true; } /* 00000680-00000688 .text daYkgrDelete__FPv */ -static BOOL daYkgrDelete(void*) { - return TRUE; +static BOOL daYkgrDelete(void* v_this) { + return ((daYkgr_c*)v_this)->_delete(); +} + +bool daYkgr_c::_execute() { + cLib_addCalc2(&m2CC, m_aim_rate, 0.25f, 0.05f); + cLib_addCalc2(&daYkgr_c::m_aim_rate, l_HIO.m1C, 0.25f, 0.05f); + cLib_addCalc2(&m2D0, getPosRate(), 0.25f, 0.05f); + + f32 fVar1 = m2CC * 0.5f + m2D0 * 0.5f; + f32 tmp2 = fVar1 * l_HIO.m18 + (1.0f - fVar1) * l_HIO.m14; + YkgrCB.setParam(tmp2); + + if (m_alpha_flag == 0) { + if (m_alpha != 0) { + if (m_alpha > l_HIO.m0C) { + m_alpha -= l_HIO.m0C; + } else { + m_alpha = 0; + } + } + } else if (m_alpha < 0xff) { + if (m_alpha < 0xff - l_HIO.m0C) { + m_alpha += l_HIO.m0C; + } else { + m_alpha = 0xff; + } + } + return true; } /* 00000688-000007F4 .text daYkgrExecute__FPv */ -static BOOL daYkgrExecute(void*) { - /* Nonmatching */ +static BOOL daYkgrExecute(void* v_this) { + return ((daYkgr_c*)v_this)->_execute(); +} + +void daYkgr_c::set_mtx() { + camera_class* camera = dComIfGp_getCamera(0); + current.pos = *fopCamM_GetEye_p(camera); + current.angle.y = fopCamM_GetAngleY(camera); + current.angle.x = fopCamM_GetAngleX(camera); + + mDoMtx_stack_c::transS(current.pos.x, current.pos.y, current.pos.z); + mDoMtx_stack_c::YrotM(current.angle.y); + mDoMtx_stack_c::XrotM(current.angle.x); + + MTXCopy(mDoMtx_stack_c::get(), mMtx); +} + +bool daYkgr_c::_draw() { + if (m_alpha == 0) { + return true; + } + + set_mtx(); + +#if VERSION == VERSION_DEMO + m_emitter->setGlobalRTMatrix(mMtx); + if (m_emitter != NULL) { + m_emitter->setGlobalAlpha(m_alpha); + } +#else + if (m_emitter != NULL) { + m_emitter->setGlobalRTMatrix(mMtx); + m_emitter->setGlobalAlpha(m_alpha); + } +#endif + return true; } /* 000007F4-000008F4 .text daYkgrDraw__FPv */ -static BOOL daYkgrDraw(void*) { - /* Nonmatching */ +static BOOL daYkgrDraw(void* v_this) { + return ((daYkgr_c*)v_this)->_draw(); } /* 000008F4-000008FC .text daYkgrIsDelete__FPv */