diff --git a/include/JSystem/JGeometry.h b/include/JSystem/JGeometry.h index 9a0d87fee..f1465a9f8 100644 --- a/include/JSystem/JGeometry.h +++ b/include/JSystem/JGeometry.h @@ -88,6 +88,12 @@ struct TVec3 { z = other.z; } + void set(const Vec& vec) { + x = vec.x; + y = vec.y; + z = vec.z; + } + void set(f32 x_, f32 y_, f32 z_) { x = x_; y = y_; @@ -140,6 +146,11 @@ struct TVec3 { return *this; } + inline TVec3& operator=(const Vec& vec) { + set(vec); + return *this; + } + f32 squared() const { return C_VECSquareMag((Vec*)&x); } diff --git a/include/JSystem/JParticle/JPAEmitter.h b/include/JSystem/JParticle/JPAEmitter.h index 349593acd..f3b7f4ed1 100644 --- a/include/JSystem/JParticle/JPAEmitter.h +++ b/include/JSystem/JParticle/JPAEmitter.h @@ -93,10 +93,13 @@ public: mGlobalScale2D.set(scale); } void setGlobalParticleScale(const JGeometry::TVec3& scale) { - mGlobalScale.set(scale); + mGlobalScale2D.set(scale); } void setGlobalDynamicsScale(const JGeometry::TVec3& scale) { - mGlobalScale2D.set(scale); + mGlobalScale.set(scale); + } + void setDirection(const JGeometry::TVec3& dir) { + mEmitterDir.set(dir); } void setMaxFrame(s32 maxFrame) { mMaxFrame = maxFrame; } @@ -126,7 +129,7 @@ public: /* 0x024 */ csXyz mEmitterRot; /* 0x02A */ u8 mVolumeType; /* 0x02B */ u8 mRateStep; - /* 0x02C */ cXyz mEmitterDir; + /* 0x02C */ JGeometry::TVec3 mEmitterDir; /* 0x038 */ f32 mRate; /* 0x03C */ f32 mRateRndm; /* 0x040 */ f32 mAccel; diff --git a/include/SSystem/SComponent/c_cc_d.h b/include/SSystem/SComponent/c_cc_d.h index f770141b0..a873b74ce 100644 --- a/include/SSystem/SComponent/c_cc_d.h +++ b/include/SSystem/SComponent/c_cc_d.h @@ -40,6 +40,7 @@ enum cCcD_ObjAtType { /* 0x04000000 */ AT_TYPE_DARKNUT_SWORD = (1 << 26), /* 0x08000000 */ AT_TYPE_GRAPPLING_HOOK = (1 << 27), /* 0x10000000 */ AT_TYPE_MOBLIN_SPEAR = (1 << 28), + /* 0xFFFFFFFF */ AT_TYPE_ALL = ~0, }; class cCcD_ShapeAttr { diff --git a/include/SSystem/SComponent/c_lib.h b/include/SSystem/SComponent/c_lib.h index a6b36cfba..c963473d5 100644 --- a/include/SSystem/SComponent/c_lib.h +++ b/include/SSystem/SComponent/c_lib.h @@ -102,7 +102,7 @@ T cLib_calcTimer(T* value) { void MtxInit(void); void MtxTrans(f32, f32, f32, u8); void MtxScale(f32, f32, f32, u8); -void MtxPosition(cXyz*, cXyz*); +void MtxPosition(cXyz* src, cXyz* dest); void MtxPush(void); Mtx* MtxPull(void); diff --git a/include/c/c_damagereaction.h b/include/c/c_damagereaction.h index acb36885a..539d5c944 100644 --- a/include/c/c_damagereaction.h +++ b/include/c/c_damagereaction.h @@ -11,19 +11,19 @@ struct enemyice { public: /* 0x000 */ fopAc_ac_c* mpActor; - /* 0x004 */ s16 mTotalNumFramesToRemainFrozen; - /* 0x006 */ u8 mNumFramesDyingToLightArrowsSoFar; + /* 0x004 */ s16 mFreezeDuration; + /* 0x006 */ s8 mLightShrinkTimer; /* 0x007 */ u8 m007[0x008 - 0x007]; /* 0x008 */ f32 mYOffset; - /* 0x00C */ u8 m00C; - /* 0x00D */ u8 mState; - /* 0x00E */ s16 mNumFramesLeftToRemainFrozen; - /* 0x010 */ s16 m010; - /* 0x012 */ s16 m012; - /* 0x014 */ s16 m014; + /* 0x00C */ s8 m00C; + /* 0x00D */ s8 mState; + /* 0x00E */ s16 mFreezeTimer; + /* 0x010 */ s16 mMoveDelayTimer; + /* 0x012 */ s16 mAngleY; + /* 0x014 */ s16 mAngularVelY; /* 0x016 */ u8 m016[0x018 - 0x016]; - /* 0x018 */ cXyz m018; - /* 0x024 */ f32 m024; + /* 0x018 */ cXyz mSpeed; + /* 0x024 */ f32 mSpeedF; /* 0x028 */ f32 m028; /* 0x02C */ f32 m02C; /* 0x030 */ dCcD_Stts mStts; @@ -32,7 +32,7 @@ public: /* 0x1A0 */ f32 mWallRadius; /* 0x1A4 */ f32 mScaleXZ; /* 0x1A8 */ f32 mScaleY; - /* 0x1AC */ f32 m1AC; + /* 0x1AC */ f32 mParticleScale; /* 0x1B0 */ u8 m1B0; /* 0x1B1 */ u8 mDeathSwitch; /* 0x1B2 */ u8 m1B2[0x1B4 - 0x1B2]; @@ -44,23 +44,22 @@ STATIC_ASSERT(sizeof(enemyice) == 0x3B8); struct enemyfire { public: /* 0x000 */ fopAc_ac_c* mpActor; - /* 0x004 */ s16 m004; - /* 0x006 */ u8 m006; + /* 0x004 */ s16 mFireDuration; + /* 0x006 */ s8 mState; /* 0x007 */ u8 m007[0x008 - 0x007]; - /* 0x008 */ s16 m008; + /* 0x008 */ s16 mFireTimer; /* 0x00A */ u8 m00A[0x00C - 0x00A]; /* 0x00C */ mDoExt_McaMorf* mpMcaMorf; - /* 0x010 */ u8 m010[10]; + /* 0x010 */ s8 mFlameJntIdxs[10]; /* 0x01A */ u8 m01A[0x01C - 0x01A]; - /* 0x01C */ f32 m01C[10]; - /* 0x044 */ u8 m044[0x080 - 0x044]; - /* 0x080 */ cXyz m080; - /* 0x08C */ f32 m08C; - /* 0x090 */ f32 m090; - /* 0x094 */ f32 m094; - /* 0x098 */ f32 m098; + /* 0x01C */ f32 mParticleScale[10]; + /* 0x044 */ s16 mFlameTimers[10]; + /* 0x058 */ JPABaseEmitter* mpFlameEmitters[10]; + /* 0x080 */ cXyz mPrevPos; + /* 0x08C */ JGeometry::TVec3 mDirection; + /* 0x098 */ f32 mFlameScaleY; /* 0x09C */ u8 m09C[0x09D - 0x09C]; - /* 0x09D */ char m09D; + /* 0x09D */ u8 mHitboxFlameIdx; /* 0x09E */ u8 m09E[0x0A0 - 0x09E]; /* 0x0A0 */ dCcD_Stts mStts; /* 0x0DC */ dCcD_Sph mSph; @@ -184,12 +183,12 @@ public: }; // STATIC_ASSERT(sizeof(damagereaction) == 0x7BC); -void ice_bg_check(enemyice*); +BOOL ice_bg_check(enemyice*); BOOL enemy_ice(enemyice*); void enemy_fire(enemyfire*); void enemy_fire_remove(enemyfire*); void enemy_piyo_set(fopAc_ac_c*); -void wall_angle_get(fopAc_ac_c*, short); +void wall_angle_get(fopAc_ac_c*, s16); void dr_body_bg_check(damagereaction*); void dr_joint_bg_check(damagereaction*); void kado_check(damagereaction*); diff --git a/include/d/actor/d_a_sea.h b/include/d/actor/d_a_sea.h new file mode 100644 index 000000000..39f4070ea --- /dev/null +++ b/include/d/actor/d_a_sea.h @@ -0,0 +1,115 @@ +#ifndef D_A_SEA_H +#define D_A_SEA_H + +#include "dolphin/types.h" +#include "f_op/f_op_actor.h" +#include "JSystem/J3DGraphBase/J3DPacket.h" +#include "JSystem/JGeometry.h" + +class daSea_WaterHeightInfo_Mng { +public: + /* 0x00 */ u8 mHeight[9][9]; + /* 0x51 */ u8 m51[0x54 - 0x51]; + /* 0x54 */ /* vtable */ + +public: + void Pos2Index(f32, f32*); + void GetHeight(f32, f32); + void GetHeight(int, int); + void GetArea(int, int, f32*, f32*, f32*, f32*); + void SetInf(); + virtual ~daSea_WaterHeightInfo_Mng() {} +}; +STATIC_ASSERT(sizeof(daSea_WaterHeightInfo_Mng) == 0x58); + +struct daSea_WaveInfo__Table { + /* 0x00 */ f32 mHeight; + /* 0x04 */ f32 mKm; + /* 0x08 */ s16 mPhase; + /* 0x0A */ u8 m0A[0x0C - 0x0A]; + /* 0x0C */ f32 mScaleX; + /* 0x10 */ f32 mScaleZ; + /* 0x14 */ int mCounterMax; +}; + +class daSea_WaveInfo { +public: + /* 0x00 */ daSea_WaveInfo__Table* mWaveInfoTable; + /* 0x04 */ f32 m04[4]; + /* 0x14 */ int mCounters[4]; + /* 0x24 */ f32 mCurScale; + /* 0x28 */ /* vtable */ + +public: + daSea_WaveInfo(); + virtual ~daSea_WaveInfo(); + void AddCounter(); + void GetRatio(int); + void GetKm(int); + void GetScale(f32); +}; + +class daSea_packet_c : public J3DPacket { +public: + void create(cXyz&); + void CleanUp(); + daSea_packet_c(); + void SetFlat(); + void ClrFlat(); + void CalcFlatInterTarget(cXyz&); + void CalcFlatInter(); + void SetCullStopFlag(); + void CheckRoomChange(); + void execute(cXyz&); + void draw(); + ~daSea_packet_c(); + +public: + /* 0x010 */ daSea_WaterHeightInfo_Mng mWaterHeightMgr; + /* 0x068 */ daSea_WaveInfo mWaveInfo; + /* 0x094 */ JGeometry::TVec3 mPlayerPos; + /* 0x0A0 */ int mIdxX; + /* 0x0A4 */ int mIdxZ; + /* 0x0A8 */ f32 mFlatInter; + /* 0x0AC */ f32 mFlatTarget; + /* 0x0B0 */ f32 mFlatInterCounter; + /* 0x0B4 */ _GXTexObj mTexSea0; + /* 0x0D4 */ _GXTexObj mTexSea1; + /* 0x0F4 */ _GXTexObj mpTexWyurayura; + /* 0x114 */ f32 mDrawMinX; + /* 0x118 */ f32 mDrawMinZ; + /* 0x11C */ f32 mDrawMaxX; + /* 0x120 */ f32 mDrawMaxZ; + /* 0x124 */ float* mpHeightTable; + /* 0x128 */ JGeometry::TVec3 mCurPos; + /* 0x134 */ JGeometry::TVec3* mpDrawVtx; + /* 0x138 */ u8 mbIsDelete; + /* 0x139 */ u8 mCullStopFlag; + /* 0x13A */ u8 m13A; + /* 0x13B */ u8 m13B[0x13C - 0x13B]; + /* 0x13C */ int mRoomNo; + /* 0x140 */ int mFlags; + /* 0x144 */ s16 mAnimCounter; + /* 0x146 */ u8 field_146[0x148 - 0x146]; + + static f32 BASE_HEIGHT; +}; + +class sea_class; + +void get_wave_max(int); +void calcMinMax(int, f32*, f32*); +void daSea_Init(); +void daSea_ChkAreaBeforePos(f32, f32); +bool daSea_ChkArea(f32, f32); +f32 daSea_calcWave(f32, f32); +void daSea_GetPoly(void*, void (*)(void*, cXyz&, cXyz&, cXyz&), const cXyz&, const cXyz&); +void daSea_execute(cXyz&); +void daSea_Draw(sea_class*); +void daSea_Execute(sea_class*); +void daSea_IsDelete(sea_class*); +void daSea_Delete(sea_class*); +void CheckCreateHeap(fopAc_ac_c*); +void daSea_Create(fopAc_ac_c*); + +#endif /* D_A_SEA_H */ diff --git a/include/d/d_bg_s_acch.h b/include/d/d_bg_s_acch.h index 897ed892c..fe43c3caf 100644 --- a/include/d/d_bg_s_acch.h +++ b/include/d/d_bg_s_acch.h @@ -80,7 +80,8 @@ public: dBgS_Acch(); void Init(); void Set(fopAc_ac_c*, int, dBgS_AcchCir*); - void Set(cXyz*, cXyz*, fopAc_ac_c*, int, dBgS_AcchCir*, cXyz*, csXyz*, csXyz*); + void Set(cXyz* pos, cXyz* old_pos, fopAc_ac_c* actor, int tbl_size, dBgS_AcchCir* acchCir, cXyz* speed, + csXyz* angle, csXyz* shape_angle); void GroundCheckInit(dBgS&); void GroundCheck(dBgS&); void GroundRoofProc(dBgS&); @@ -178,7 +179,7 @@ public: /* 0x07C */ u32 field_0x7c; /* 0x080 */ fopAc_ac_c* m_my_ac; /* 0x084 */ int m_tbl_size; - /* 0x088 */ dBgS_AcchCir* mp_acch_cir; + /* 0x088 */ dBgS_AcchCir* pm_acch_cir; /* 0x08C */ f32 m_ground_up_h; /* 0x090 */ f32 m_ground_up_h_diff; /* 0x094 */ f32 m_ground_h; diff --git a/include/d/d_cc_uty.h b/include/d/d_cc_uty.h index 0bff3f3ff..6757b35de 100644 --- a/include/d/d_cc_uty.h +++ b/include/d/d_cc_uty.h @@ -5,6 +5,11 @@ #include "f_op/f_op_actor.h" struct CcAtInfo { +public: + CcAtInfo() {} + ~CcAtInfo() {} + +public: /* 0x00 */ cCcD_Obj* mpObj; /* 0x04 */ fopAc_ac_c* mpActor; /* 0x08 */ u8 mDamage; diff --git a/include/d/d_com_inf_game.h b/include/d/d_com_inf_game.h index 8903d103a..2667d4f6a 100644 --- a/include/d/d_com_inf_game.h +++ b/include/d/d_com_inf_game.h @@ -1783,59 +1783,103 @@ inline void* dComIfG_getObjectIDRes(const char* arcName, u16 id) { void set(u8, u16, cXyz const*, csXyz const*, cXyz const*, u8, dPa_levelEcallBack*, s8, GXColor const*, GXColor const*, cXyz const*); -inline JPABaseEmitter* dComIfGp_particle_set(u16 particleID, const cXyz* pos, const csXyz* angle, - const cXyz* scale, u8 alpha, - dPa_levelEcallBack* pCallBack, s8 setupInfo, - const GXColor* pPrmColor, const GXColor* pEnvColor, - const cXyz* pScale2D) { +inline JPABaseEmitter* dComIfGp_particle_set(u16 particleID, const cXyz* pos, + const csXyz* angle = NULL, const cXyz* scale = NULL, + u8 alpha = 0xFF, dPa_levelEcallBack* pCallBack = NULL, + s8 setupInfo = -1, const GXColor* pPrmColor = NULL, + const GXColor* pEnvColor = NULL, + const cXyz* pScale2D = NULL) { dPa_control_c* pParticle = g_dComIfG_gameInfo.play.getParticle(); return pParticle->setNormal(particleID, pos, angle, scale, alpha, pCallBack, setupInfo, pPrmColor, pEnvColor, pScale2D); } -inline JPABaseEmitter* dComIfGp_particle_setP1(u16 particleID, const cXyz* pos, const csXyz* angle, - const cXyz* scale, u8 alpha, - dPa_levelEcallBack* pCallBack, s8 setupInfo, - const GXColor* pPrmColor, const GXColor* pEnvColor, - const cXyz* pScale2D) { +inline JPABaseEmitter* dComIfGp_particle_setP1(u16 particleID, const cXyz* pos, + const csXyz* angle = NULL, const cXyz* scale = NULL, + u8 alpha = 0xFF, dPa_levelEcallBack* pCallBack = NULL, + s8 setupInfo = -1, const GXColor* pPrmColor = NULL, + const GXColor* pEnvColor = NULL, + const cXyz* pScale2D = NULL) { dPa_control_c* pParticle = g_dComIfG_gameInfo.play.getParticle(); return pParticle->setNormalP1(particleID, pos, angle, scale, alpha, pCallBack, setupInfo, pPrmColor, pEnvColor, pScale2D); } inline JPABaseEmitter* dComIfGp_particle_setToon(u16 particleID, const cXyz* pos, - const csXyz* angle, const cXyz* scale, u8 alpha, - dPa_levelEcallBack* pCallBack, s8 setupInfo, - const GXColor* pPrmColor, const GXColor* pEnvColor, - const cXyz* pScale2D) { + const csXyz* angle = NULL, const cXyz* scale = NULL, + u8 alpha = 0xFF, dPa_levelEcallBack* pCallBack = NULL, + s8 setupInfo = -1, const GXColor* pPrmColor = NULL, + const GXColor* pEnvColor = NULL, + const cXyz* pScale2D = NULL) { dPa_control_c* pParticle = g_dComIfG_gameInfo.play.getParticle(); return pParticle->setToon(particleID, pos, angle, scale, alpha, pCallBack, setupInfo, pPrmColor, pEnvColor, pScale2D); } inline JPABaseEmitter* dComIfGp_particle_setToonP1(u16 particleID, const cXyz* pos, - const csXyz* angle, const cXyz* scale, u8 alpha, - dPa_levelEcallBack* pCallBack, s8 setupInfo, - const GXColor* pPrmColor, const GXColor* pEnvColor, - const cXyz* pScale2D) { + const csXyz* angle = NULL, const cXyz* scale = NULL, + u8 alpha = 0xFF, dPa_levelEcallBack* pCallBack = NULL, + s8 setupInfo = -1, const GXColor* pPrmColor = NULL, + const GXColor* pEnvColor = NULL, + const cXyz* pScale2D = NULL) { dPa_control_c* pParticle = g_dComIfG_gameInfo.play.getParticle(); return pParticle->setToonP1(particleID, pos, angle, scale, alpha, pCallBack, setupInfo, pPrmColor, pEnvColor, pScale2D); } -inline JPABaseEmitter* dComIfGp_particle_setProjection(u16 particleID, const cXyz* pos, const csXyz* angle, - const cXyz* scale, u8 alpha, - dPa_levelEcallBack* pCallBack, s8 setupInfo, - const GXColor* pPrmColor, const GXColor* pEnvColor, - const cXyz* pScale2D) { +inline JPABaseEmitter* dComIfGp_particle_setProjection(u16 particleID, const cXyz* pos, + const csXyz* angle = NULL, const cXyz* scale = NULL, + u8 alpha = 0xFF, dPa_levelEcallBack* pCallBack = NULL, + s8 setupInfo = -1, const GXColor* pPrmColor = NULL, + const GXColor* pEnvColor = NULL, + const cXyz* pScale2D = NULL) { dPa_control_c* pParticle = g_dComIfG_gameInfo.play.getParticle(); return pParticle->setProjection(particleID, pos, angle, scale, alpha, pCallBack, setupInfo, pPrmColor, pEnvColor, pScale2D); } -inline JPABaseEmitter* dComIfGp_particle_set(u16 particleID, const cXyz* pos, const csXyz* angle, - const cXyz* scale) { - return dComIfGp_particle_set(particleID, pos, angle, scale, 0xFF, NULL, -1, NULL, NULL, NULL); +inline JPABaseEmitter* dComIfGp_particle_setShipTail(u16 particleID, const cXyz* pos, + const csXyz* angle = NULL, const cXyz* scale = NULL, + u8 alpha = 0xFF, dPa_levelEcallBack* pCallBack = NULL, + s8 setupInfo = -1, const GXColor* pPrmColor = NULL, + const GXColor* pEnvColor = NULL, + const cXyz* pScale2D = NULL) { + dPa_control_c* pParticle = g_dComIfG_gameInfo.play.getParticle(); + return pParticle->setShipTail(particleID, pos, angle, scale, alpha, pCallBack, setupInfo, + pPrmColor, pEnvColor, pScale2D); +} + +inline JPABaseEmitter* dComIfGp_particle_set2Dfore(u16 particleID, const cXyz* pos, + const csXyz* angle = NULL, const cXyz* scale = NULL, + u8 alpha = 0xFF, dPa_levelEcallBack* pCallBack = NULL, + s8 setupInfo = -1, const GXColor* pPrmColor = NULL, + const GXColor* pEnvColor = NULL, + const cXyz* pScale2D = NULL) { + dPa_control_c* pParticle = g_dComIfG_gameInfo.play.getParticle(); + return pParticle->set2Dfore(particleID, pos, angle, scale, alpha, pCallBack, setupInfo, + pPrmColor, pEnvColor, pScale2D); +} + +inline JPABaseEmitter* dComIfGp_particle_set2Dback(u16 particleID, const cXyz* pos, + const csXyz* angle = NULL, const cXyz* scale = NULL, + u8 alpha = 0xFF, dPa_levelEcallBack* pCallBack = NULL, + s8 setupInfo = -1, const GXColor* pPrmColor = NULL, + const GXColor* pEnvColor = NULL, + const cXyz* pScale2D = NULL) { + dPa_control_c* pParticle = g_dComIfG_gameInfo.play.getParticle(); + return pParticle->set2Dback(particleID, pos, angle, scale, alpha, pCallBack, setupInfo, + pPrmColor, pEnvColor, pScale2D); +} + +inline JPABaseEmitter* dComIfGp_particle_set2DmenuFore(u16 particleID, const cXyz* pos, + const csXyz* angle = NULL, const cXyz* scale = NULL, + u8 alpha = 0xFF, dPa_levelEcallBack* pCallBack = NULL, + s8 setupInfo = -1, const GXColor* pPrmColor = NULL, + const GXColor* pEnvColor = NULL, + const cXyz* pScale2D = NULL) { + dPa_control_c* pParticle = g_dComIfG_gameInfo.play.getParticle(); + return pParticle->set2DmenuFore(particleID, pos, angle, scale, alpha, pCallBack, setupInfo, + pPrmColor, pEnvColor, pScale2D); } inline void dComIfGp_particle_setStripes(u16 particleID, cXyz* pos, csXyz* angle, cXyz* scale, u8 param_4, u16 param_5) { diff --git a/include/d/d_particle.h b/include/d/d_particle.h index 9d0d2df4c..7fe8c1182 100644 --- a/include/d/d_particle.h +++ b/include/d/d_particle.h @@ -394,6 +394,30 @@ public: const cXyz* pScale2D) { return set(4, particleID, pos, angle, scale, alpha, pCallBack, setupInfo, pPrmColor, pEnvColor, pScale2D); } + JPABaseEmitter* setShipTail(u16 particleID, const cXyz* pos, const csXyz* angle, + const cXyz* scale, u8 alpha, dPa_levelEcallBack* pCallBack, + s8 setupInfo, const GXColor* pPrmColor, const GXColor* pEnvColor, + const cXyz* pScale2D) { + return set(5, particleID, pos, angle, scale, alpha, pCallBack, setupInfo, pPrmColor, pEnvColor, pScale2D); + } + JPABaseEmitter* set2Dfore(u16 particleID, const cXyz* pos, const csXyz* angle, + const cXyz* scale, u8 alpha, dPa_levelEcallBack* pCallBack, + s8 setupInfo, const GXColor* pPrmColor, const GXColor* pEnvColor, + const cXyz* pScale2D) { + return set(7, particleID, pos, angle, scale, alpha, pCallBack, setupInfo, pPrmColor, pEnvColor, pScale2D); + } + JPABaseEmitter* set2Dback(u16 particleID, const cXyz* pos, const csXyz* angle, + const cXyz* scale, u8 alpha, dPa_levelEcallBack* pCallBack, + s8 setupInfo, const GXColor* pPrmColor, const GXColor* pEnvColor, + const cXyz* pScale2D) { + return set(8, particleID, pos, angle, scale, alpha, pCallBack, setupInfo, pPrmColor, pEnvColor, pScale2D); + } + JPABaseEmitter* set2DmenuFore(u16 particleID, const cXyz* pos, const csXyz* angle, + const cXyz* scale, u8 alpha, dPa_levelEcallBack* pCallBack, + s8 setupInfo, const GXColor* pPrmColor, const GXColor* pEnvColor, + const cXyz* pScale2D) { + return set(9, particleID, pos, angle, scale, alpha, pCallBack, setupInfo, pPrmColor, pEnvColor, pScale2D); + } void drawModelParticle() { mModelCtrl->draw(); } diff --git a/include/d/d_s_play.h b/include/d/d_s_play.h index 8a5479c96..cc3783e20 100644 --- a/include/d/d_s_play.h +++ b/include/d/d_s_play.h @@ -13,7 +13,7 @@ public: void offReset(); static bool isPause() { return pauseTimer != 0; } - static void setPauseTimer(s8 time) { pauseTimer = time; } + static void setPauseTimer(s8 time) { nextPauseTimer = time; } static s8 pauseTimer; static s8 nextPauseTimer; diff --git a/include/f_op/f_op_actor.h b/include/f_op/f_op_actor.h index 3bad63b38..2dcd4e315 100644 --- a/include/f_op/f_op_actor.h +++ b/include/f_op/f_op_actor.h @@ -29,6 +29,7 @@ enum fopAc_Status_e { fopAcStts_UNK200000_e = 0x00200000, fopAcStts_NODRAW_e = 0x01000000, fopAcStts_BOSS_e = 0x04000000, + fopAcStts_UNK8000000_e = 0x08000000, }; enum fopAc_Condition_e { diff --git a/include/f_op/f_op_actor_mng.h b/include/f_op/f_op_actor_mng.h index b97ec0042..bfc9ebe53 100644 --- a/include/f_op/f_op_actor_mng.h +++ b/include/f_op/f_op_actor_mng.h @@ -87,7 +87,7 @@ inline bool fopAcM_checkStatus(fopAc_ac_c* pActor, u32 status) { } inline u32 fopAcM_checkCarryNow(fopAc_ac_c* pActor) { - return pActor->mStatus & 0x2000; + return pActor->mStatus & fopAcStts_CARRY_e; } enum fopAcM_CARRY { @@ -442,13 +442,13 @@ s32 fopAcM_createItemFromTable(cXyz* p_pos, int i_tableNo, int i_itemBitNo, int csXyz* p_angle, int param_5, cXyz * p_scale, f32* speedF, f32* speedY, bool createDirect); -s32 fopAcM_createShopItem(cXyz* pos, int i_itemNo, csXyz* rot, int roomNo, cXyz* scale, +s32 fopAcM_createShopItem(cXyz* p_pos, int i_itemNo, csXyz* rot, int roomNo, cXyz* scale, createFunc createFunc); -s32 fopAcM_createRaceItem(cXyz* pos, int i_itemNo, int i_itemBitNo, csXyz* rot, int roomNo, +s32 fopAcM_createRaceItem(cXyz* p_pos, int i_itemNo, int i_itemBitNo, csXyz* rot, int roomNo, cXyz* scale, int param_7); -s32 fopAcM_createIball(cXyz*, int, int, csXyz*, int); +s32 fopAcM_createIball(cXyz* p_pos, int itemTableIdx, int roomNo, csXyz* rot, int itemStealNum); s32 fopAcM_createDemoItem(cXyz* p_pos, int itemNo, int itemBitNo, csXyz* p_angle, int roomNo, cXyz* scale, u8 param_7); diff --git a/src/c/c_damagereaction.cpp b/src/c/c_damagereaction.cpp index eb6ac608d..50215f694 100644 --- a/src/c/c_damagereaction.cpp +++ b/src/c/c_damagereaction.cpp @@ -5,73 +5,636 @@ #include "c/c_damagereaction.h" #include "dolphin/types.h" +#include "d/d_com_inf_game.h" +#include "d/actor/d_a_sea.h" +#include "d/d_s_play.h" +#include "JAZelAudio/JAZelAudio_SE.h" +#include "f_op/f_op_actor_mng.h" +#include "m_Do/m_Do_mtx.h" +#include "d/d_cc_uty.h" +#include "d/d_procname.h" + +cXyz non_pos(-20000.0f, -20000.0f, 20000.0f); /* 8001BEDC-8001C0B4 .text ice_bg_check__FP8enemyice */ -void ice_bg_check(enemyice*) { - /* Nonmatching */ +BOOL ice_bg_check(enemyice* ei) { + fopAc_ac_c* ac = ei->mpActor; + BOOL ret = FALSE; + f32 speedY = ei->mSpeed.y; + + ei->mBgAcch.CrrPos(*dComIfG_Bgsp()); + + if (ei->mBgAcch.ChkWaterHit()) { + f32 waterH = ei->mBgAcch.m_wtr.GetHeight(); + if (ac->current.pos.y < waterH + 100.0f) { + if (speedY < -20.0f) { + ei->mSpeed.y = 0.0f; + } else { + ei->mSpeed.y = 0.0f; + } + if (ac->mHealth <= 0) { + ret = TRUE; + } + } + } else if (ei->mBgAcch.ChkGroundHit()) { + ei->mSpeedF *= 0.5f; + if (ac->mHealth <= 0 || speedY < -40.0f + g_regHIO.mChild[0].mFloatRegs[14]) { + ret = TRUE; + } + if (speedY < -20.0f) { + ei->mSpeed.y = 10.0f; + } else { + ei->mSpeed.y = 0.0f; + } + ei->mAngularVelY = 0; + } else if (daSea_ChkArea(ac->current.pos.x, ac->current.pos.z)) { + f32 seaH = daSea_calcWave(ac->current.pos.x, ac->current.pos.z); + if (ac->current.pos.y < seaH + 100.0f) { + if (speedY < -20.0f) { + ei->mSpeed.y = 0.0f; + } else { + ei->mSpeed.y = 0.0f; + } + if (ac->mHealth <= 0) { + ret = TRUE; + } + } + } + + if (ei->mBgAcch.ChkWallHit()) { + if (fabsf(ei->mSpeedF) > 10.0f) { + ret = TRUE; + } + ei->mSpeedF *= 0.5f; + ei->mAngleY += 0x8000; + } + + return ret; } +dCcD_SrcCyl cc_cyl_src = { + // dCcD_SrcGObjInf + { + /* Flags */ 0, + /* SrcObjAt Type */ AT_TYPE_SKULL_HAMMER, + /* SrcObjAt Atp */ 0, + /* SrcObjAt SPrm */ 0x0F, + /* SrcObjTg Type */ AT_TYPE_ALL, + /* SrcObjTg SPrm */ 0x03, + /* SrcObjCo SPrm */ 0x75, + /* SrcGObjAt Se */ 0, + /* SrcGObjAt HitMark */ 0, + /* SrcGObjAt Spl */ 0, + /* SrcGObjAt Mtrl */ 0, + /* SrcGObjAt GFlag */ 0, + /* SrcGObjTg Se */ 0x05, + /* SrcGObjTg HitMark */ 0x0C, + /* SrcGObjTg Spl */ 0, + /* SrcGObjTg Mtrl */ 0, + /* SrcGObjTg GFlag */ 0x03, + /* SrcGObjCo GFlag */ 0, + }, + // cM3dGCylS + { + /* Center */ 0.0f, 0.0f, 0.0f, + /* Radius */ 250.0f, + /* Height */ 400.0f, + }, +}; + /* 8001C0B4-8001CD7C .text enemy_ice__FP8enemyice */ -BOOL enemy_ice(enemyice*) { - /* Nonmatching */ +BOOL enemy_ice(enemyice* ei) { + fopAc_ac_c* player = dComIfGp_getPlayer(0); + fopAc_ac_c* ac = ei->mpActor; + s8 shattered = 0; + cXyz speedXZRel; + cXyz speedXZ; + cXyz particleScale; + cXyz pos; + + if (ei->mLightShrinkTimer != 0) { // Dying to light arrows. + particleScale.setAll(ei->mParticleScale); + pos = ac->current.pos; + pos.y += ei->mYOffset; + + if (ei->mLightShrinkTimer == 1) { // Just started dying to light arrows. + ei->mLightShrinkTimer++; + dComIfGp_particle_set(0x272, &pos, NULL, &particleScale); + ac->mTevStr.mFogColor.b = 0xFF; + ac->mTevStr.mFogColor.g = 0xFF; + ac->mTevStr.mFogColor.r = 0xFF; + ac->mTevStr.mFogStartZ = 0.0f; + ac->mTevStr.mFogEndZ = 2000.0f; + fopAcM_seStart(ac, JA_SE_CM_L_ARROW_SHRINK, 0); + ac->mAttentionInfo.mFlags &= ~4; + } else { + ei->mLightShrinkTimer++; + + cLib_addCalc2(&ac->mTevStr.mFogEndZ, 10.0f, 1.0f, 80.0f); + + mDoMtx_stack_c::transS(ac->current.pos); + mDoMtx_stack_c::transM(0, ei->mYOffset, 0); + mDoMtx_stack_c::scaleM(ei->mScaleXZ, ei->mScaleY, ei->mScaleXZ); + mDoMtx_stack_c::transM(0, -ei->mYOffset, 0); + mDoMtx_stack_c::YrotM(ac->shape_angle.y); + mDoMtx_stack_c::XrotM(ac->shape_angle.x); + mDoMtx_stack_c::ZrotM(ac->shape_angle.z); + mDoMtx_stack_c::scaleM(ac->mScale); + + if (ei->mLightShrinkTimer < (s8)(70 + g_regHIO.mChild[14].mShortRegs[1])) { + cLib_addCalc0(&ei->mScaleXZ, 0.1f, 0.01f + g_regHIO.mChild[14].mFloatRegs[0]); + cLib_addCalc0(&ei->mScaleY, 0.1f, 0.01f + g_regHIO.mChild[14].mFloatRegs[0]); + } else { + if (ei->mLightShrinkTimer == (s8)(70 + g_regHIO.mChild[14].mShortRegs[1])) { + fopAcM_seStart(ac, JA_SE_CM_L_ARROW_PASS_AWAY, 0); + } + + cLib_addCalc2(&ei->mScaleY, 5.0f + g_regHIO.mChild[14].mFloatRegs[1], 0.1f, 1.0f + g_regHIO.mChild[14].mFloatRegs[2]); + cLib_addCalc0(&ei->mScaleXZ, 0.1f + g_regHIO.mChild[14].mFloatRegs[3], 0.05f + g_regHIO.mChild[14].mFloatRegs[4]); + + if (ei->mLightShrinkTimer > (s8)(90 + g_regHIO.mChild[14].mShortRegs[2])) { + fopAcM_delete(ac); + fopAcM_onActor(ac); + if (fopAcM_GetName(ac) != PROC_PZ) { + // If the actor is not Princess Zelda, drop an item ball. + // TODO: Why the Zelda check? Is she coded to be able to die to Light Arrows? + fopAcM_createIball(&pos, ac->mItemTableIdx, fopAcM_GetRoomNo(ac), &ac->current.angle, ac->mItemStealNum); + } + if (ei->mDeathSwitch != 0) { + dComIfGs_onSwitch(ei->mDeathSwitch, fopAcM_GetRoomNo(ac)); + } + ac->mHealth = -0x80; + } + } + } + + return TRUE; + } + + BOOL frozen = FALSE; + BOOL moveAndCollide = FALSE; + switch (ei->mState) { + case 0: // Not initialized + // Initialize the enemyice now. + ei->mStts.Init(0xFA, 0xFF, ac); + ei->mCyl.Set(cc_cyl_src); + ei->mCyl.SetStts(&ei->mStts); + ei->mCyl.SetR(ei->mWallRadius); + ei->mCyl.SetH(ei->mCylHeight); + ei->mBgAcch.Set(&ac->current.pos, &ac->next.pos, ac, 1, &ei->mBgAcchCir, &ei->mSpeed, NULL, NULL); + ei->mBgAcchCir.SetWall(40.0f, ei->mWallRadius); + + if (ei->mParticleScale < 0.1f) { + ei->mParticleScale = 1.0f; + } + if (fabsf(ei->mYOffset) < 0.1f) { + ei->mYOffset = 80.0f; + } + ei->mState = 1; + ei->mScaleY = 1.0f; + ei->mScaleXZ = 1.0f; + fopAcM_OnStatus(ac, fopAcStts_UNK8000000_e); + break; + case 1: // Idle + if (ei->mFreezeDuration != 0) { + // The enemy has signaled that it wants to be frozen for some length of time. + ei->mFreezeTimer = ei->mFreezeDuration; + ei->mFreezeDuration = 0; + ei->mState = 2; + if (ei->m00C == 0) { + ei->mSpeed.y = 30.0f; + ei->mAngularVelY = (s16)cM_rndFX(3000.0f); + } + ac->mHealth -= 4; + if (ac->mHealth <= 0) { + // If the enemy died instantly upon being frozen, don't let it fall and shatter instantly. + // Instead add a short delay where it will simply stay frozen in the air to emphasize that it froze. + ei->mMoveDelayTimer = 40; + ei->mSpeed.y = 0.0f; + } + fopAcM_seStart(ac, JA_SE_CM_FREEZE, 0); + + particleScale.setAll(ei->mParticleScale); + pos = ac->current.pos; + pos.y += ei->mYOffset; + dComIfGp_particle_set(0x274, &pos, NULL, &particleScale); + } else { + return FALSE; + } + // Fall-through + case 2: // Frozen + frozen = TRUE; + moveAndCollide = TRUE; + if (ei->m00C != 1) { + ac->mAttentionInfo.mFlags |= 0x10; + ac->mAttentionInfo.mDistances[4] = 0x12; + if (fopAcM_checkStatus(ac, fopAcStts_CARRY_e)) { + ac->mAttentionInfo.mFlags &= ~0x10; + ei->mState = 3; + if (ei->m00C == 2) { + ei->m00C = 0; + } + } + } + break; + case 3: // Frozen and being carried around by the player + frozen = TRUE; + if (!fopAcM_checkStatus(ac, fopAcStts_CARRY_e)) { + if (fopAcM_GetSpeedF(ac) > 0.0f) { + ei->mSpeedF = 25.0f + g_regHIO.mChild[0].mFloatRegs[5]; + ei->mSpeed.y = 20.0f + g_regHIO.mChild[0].mFloatRegs[6]; + } else { + ei->mSpeedF = 5.0f; + ei->mSpeed.y = -15.0; + } + ei->mAngleY = player->shape_angle.y; + ei->mState = 2; + } + break; + } + + if (moveAndCollide) { + if (ei->mMoveDelayTimer == 0) { + cMtx_YrotS(*calc_mtx, ei->mAngleY); + speedXZRel.x = 0.0f; + speedXZRel.y = 0.0f; + speedXZRel.z = ei->mSpeedF; + MtxPosition(&speedXZRel, &speedXZ); + ei->mSpeed.x = speedXZ.x; + ei->mSpeed.z = speedXZ.z; + if (ei->m00C == 2) { + ei->mSpeed.y = 0.0f; + } else { + ac->current.pos += ei->mSpeed; + ei->mSpeed.y -= 5.0f; + } + ac->shape_angle.y += ei->mAngularVelY; + + if (ice_bg_check(ei)) { + ei->mFreezeTimer = -1; + } + } else { + ei->mMoveDelayTimer--; + } + + cXyz* ccMove = ei->mStts.GetCCMoveP(); + if (ccMove) { + ac->current.pos += *ccMove; + } + + if (fabsf(ei->mSpeedF) > 5.0f) { + ei->mCyl.OnAtSetBit(); + } else { + ei->mCyl.OffAtSetBit(); + } + + ei->mCyl.SetC(ac->current.pos); + dComIfG_Ccsp()->Set(&ei->mCyl); + + if (ei->mFreezeTimer >= 23 && ei->mCyl.ChkTgHit()) { + CcAtInfo atInfo; + atInfo.mpObj = ei->mCyl.GetTgHitObj(); + if (atInfo.mpObj->ChkAtType(AT_TYPE_LIGHT_ARROW)) { + ei->mFreezeTimer = 1; + ei->mLightShrinkTimer = 1; + } else if (atInfo.mpObj->ChkAtType(AT_TYPE_FIRE)) { + ei->mFreezeTimer = 1; + } else if (atInfo.mpObj->ChkAtType(AT_TYPE_BOMB | AT_TYPE_SKULL_HAMMER | AT_TYPE_FIRE_ARROW)) { + if (atInfo.mpObj->ChkAtType(AT_TYPE_SKULL_HAMMER)) { + ei->mFreezeTimer = -2; // Shattered by Skull Hammer. + } else { + ei->mFreezeTimer = -1; // Shattered + } + } else { + def_se_set(ac, atInfo.mpObj, 0x42); + } + } + } + + if (frozen) { + // NOTE: These variables could theoretically be used uninitialized if mFreezeTimer was + // somehow zero while frozen is true. But in practice this shouldn't happen. + f32 shiverOffsetX; + f32 shiverOffsetZ; + + if (ei->mFreezeTimer != 0) { + if (ei->mFreezeTimer < 0) { + // Shattered. + particleScale.setAll(ei->mParticleScale); + pos = ac->current.pos; + pos.y += ei->mYOffset; + dComIfGp_particle_set(0x273, &pos, NULL, &particleScale); + dComIfGp_particle_set(0x274, &pos, NULL, &particleScale); + + if (ei->mFreezeTimer == -2) { + // Shattered by Skull Hammer. + dComIfGp_particle_set(0x10, &pos); + csXyz angle(0, fopAcM_searchPlayerAngleY(ac), 0); + particleScale.setAll(2.0f); + dComIfGp_particle_set(0xD, &pos, &angle, &particleScale); + dScnPly_ply_c::setPauseTimer(8); + } + + fopAcM_seStart(ac, JA_SE_CM_ICE_BREAK, 0); + fopAcM_createIball(&pos, ac->mItemTableIdx, fopAcM_GetRoomNo(ac), &ac->current.angle, ac->mItemStealNum); + ei->mFreezeTimer = 0; + if (ei->mDeathSwitch != 0) { + dComIfGs_onSwitch(ei->mDeathSwitch, fopAcM_GetRoomNo(ac)); + } + shattered = 1; + } else { + ei->mFreezeTimer--; + } + + if (ei->mFreezeTimer == 0) { + ei->mState = 1; + ei->mCyl.SetC(non_pos); + dComIfG_Ccsp()->Set(&ei->mCyl); + + if (fopAcM_checkCarryNow(ac)) { + fopAcM_cancelCarryNow(ac); + } + + if (shattered == 0) { + frozen = FALSE; + } else { + fopAcM_delete(ac); + fopAcM_onActor(ac); + ac->mHealth = -0x80; + } + } + + if (ei->mFreezeTimer < 50) { + shiverOffsetX = (ei->mFreezeTimer & 1)*2 - 1; + shiverOffsetZ = (ei->mFreezeTimer+1 & 1)*2 - 1; + } else { + shiverOffsetZ = 0.0f; + shiverOffsetX = 0.0f; + } + + if (ei->mFreezeTimer == 20) { + particleScale.setAll(ei->mParticleScale); + pos = ac->current.pos; + pos.y += ei->mYOffset; + dComIfGp_particle_set(0x277, &pos, NULL, &particleScale); + fopAcM_seStart(ac, JA_SE_CM_ICE_RECOVER, 0); + } + } + + ac->current.angle = ac->shape_angle; + + cLib_addCalc2(&ei->m028, ei->m02C, 1.0f, 3.0f); + mDoMtx_stack_c::transS( + ac->current.pos.x + shiverOffsetX, + ac->current.pos.y + ei->m02C, + ac->current.pos.z + shiverOffsetZ + ); + mDoMtx_stack_c::YrotM(ac->shape_angle.y); + mDoMtx_stack_c::XrotM(ac->shape_angle.x); + mDoMtx_stack_c::ZrotM(ac->shape_angle.z); + mDoMtx_stack_c::scaleM(ac->mScale); + fopAcM_OnStatus(ac, fopAcStts_FREEZE_e); + } else { + fopAcM_OffStatus(ac, fopAcStts_FREEZE_e); + cLib_addCalc0(&ei->m028, 1.0f, 3.0f); + } + + return frozen; } +dCcD_SrcSph fire_at_sph_src = { + // dCcD_SrcGObjInf + { + /* Flags */ 0, + /* SrcObjAt Type */ AT_TYPE_FIRE, + /* SrcObjAt Atp */ 0x02, + /* SrcObjAt SPrm */ 0x0F, + /* SrcObjTg Type */ 0, + /* SrcObjTg SPrm */ 0, + /* SrcObjCo SPrm */ 0, + /* SrcGObjAt Se */ 0, + /* SrcGObjAt HitMark */ 0, + /* SrcGObjAt Spl */ 0, + /* SrcGObjAt Mtrl */ 0, + /* SrcGObjAt GFlag */ 0x01, + /* SrcGObjTg Se */ 0, + /* SrcGObjTg HitMark */ 0, + /* SrcGObjTg Spl */ 0, + /* SrcGObjTg Mtrl */ 0, + /* SrcGObjTg GFlag */ 0, + /* SrcGObjCo GFlag */ 0, + }, + // cM3dGSphS + { + /* Center */ 0.0f, 0.0f, 0.0f, + /* Radius */ 50.0f, + }, +}; + /* 8001CDB8-8001D3B0 .text enemy_fire__FP9enemyfire */ -void enemy_fire(enemyfire*) { - /* Nonmatching */ +void enemy_fire(enemyfire* ef) { + fopAc_ac_c* ac = ef->mpActor; + cXyz offset; + cXyz pos; + offset.setAll(0.0f); + + switch (ef->mState) { + case 0: // Not on fire. + if (ef->mFireDuration == 0) { + return; + } + // The enemy has signaled that it wants to be lit on fire for some length of time. + ef->mFireTimer = ef->mFireDuration; + ef->mFireDuration = 0; + + ef->mState = 1; // On fire + + dKy_plight_set(&ef->mLight); + + for (int i = 0; i < 10; i++) { + if (ef->mFlameJntIdxs[i] < 0) { + continue; + } + if (ef->mpFlameEmitters[i]) { + continue; + } + cXyz scale; + scale.setAll(ef->mParticleScale[i]); + ef->mpFlameEmitters[i] = dComIfGp_particle_set(0x3F1, &ac->current.pos, NULL, &scale); + ef->mFlameTimers[i] = ef->mFireTimer - (s16)cM_rndF(60.0f); + if (ef->mFlameTimers[i] < 10) { + ef->mFlameTimers[i] = 10; + } + ef->mFlameScaleY = 2.0f; + } + + ef->mStts.Init(0xFA, 0xFF, ac); + ef->mSph.Set(fire_at_sph_src); + ef->mSph.SetStts(&ef->mStts); + break; + case 1: // On fire. + ef->mLight.mPos = ac->current.pos; + ef->mLight.mColor.r = 600; + ef->mLight.mColor.g = 400; + ef->mLight.mColor.b = 120; + s16 power = ef->mFlameScaleY * 150.0f; + ef->mLight.mPower = power; + ef->mLight.mFluctuation = 250.0f; + + JGeometry::TVec3 vel; + vel = ac->current.pos - ef->mPrevPos; + + ef->mPrevPos = ac->current.pos; + + f32 dirX = vel.x * (-0.02f + g_regHIO.mChild[0].mFloatRegs[4]); + if (dirX > 1.0f) { + dirX = 1.0f; + } else if (dirX < -1.0f) { + dirX = -1.0f; + } + + f32 dirZ = vel.z * (-0.02f + g_regHIO.mChild[0].mFloatRegs[4]); + if (dirZ > 1.0f) { + dirZ = 1.0f; + } else if (dirZ < -1.0f) { + dirZ = -1.0f; + } + + cLib_addCalc2(&ef->mDirection.x, dirX, 0.5f, 0.05f); + cLib_addCalc2(&ef->mDirection.z, dirZ, 0.5f, 0.05f); + + ef->mDirection.y = 0.2f + g_regHIO.mChild[0].mFloatRegs[11]; + + f32 speed = sqrtf(vel.x * vel.x + vel.y * vel.y + vel.z * vel.z); + speed = (0.03f + g_regHIO.mChild[0].mFloatRegs[12]) * speed + 1.0f; + if (speed > 1.5f + g_regHIO.mChild[0].mFloatRegs[13]) { + speed = 1.5f + g_regHIO.mChild[0].mFloatRegs[13]; + } + + cLib_addCalc2(&ef->mFlameScaleY, speed, 0.5f, 0.05f); + + u8 numFlamesLeft = 0; + for (int i = 0; i < 10; i++) { + if (ef->mFlameJntIdxs[i] < 0) { + continue; + } + if (!ef->mpFlameEmitters[i]) { + continue; + } + if (ef->mFlameTimers[i] == 0) { + ef->mpFlameEmitters[i]->becomeInvalidEmitter(); + ef->mpFlameEmitters[i] = NULL; + } else { + ef->mFlameTimers[i]--; + + cMtx_copy(ef->mpMcaMorf->getModel()->getAnmMtx(ef->mFlameJntIdxs[i]), *calc_mtx); + MtxPosition(&offset, &pos); + + ef->mpFlameEmitters[i]->setGlobalTranslation(pos.x, pos.y, pos.z); + ef->mpFlameEmitters[i]->setDirection(ef->mDirection); + + JGeometry::TVec3 scale; + scale.set( + ef->mParticleScale[i], + ef->mFlameScaleY * ef->mParticleScale[i], + ef->mParticleScale[i] + ); + ef->mpFlameEmitters[i]->setGlobalParticleScale(scale); + + if (ef->mHitboxFlameIdx == numFlamesLeft) { + // We don't want to give each flame a separate hitbox, so instead simply move the single hitbox to + // a single flame, and cycle through which flame that is every frame. + ef->mSph.SetC(pos); + dComIfG_Ccsp()->Set(&ef->mSph); + } + + numFlamesLeft++; + } + } + + ef->mHitboxFlameIdx++; + if (ef->mHitboxFlameIdx >= numFlamesLeft) { + ef->mHitboxFlameIdx = 0; + } + + fopAcM_seStart(ac, JA_SE_OBJ_TORCH_BURNING, 0); + + if (ef->mFireTimer == 0) { + ef->mState = 0; // Not on fire + dKy_plight_cut(&ef->mLight); + ef->mSph.SetC(non_pos); + dComIfG_Ccsp()->Set(&ef->mSph); + } else { + fopAcM_seStart(ac, JA_SE_CM_FIRE_ARROW_BURNING, 0); + } + + if (ef->mFireTimer != 0) { + ef->mFireTimer--; + } + break; + } } /* 8001D3B0-8001D428 .text enemy_fire_remove__FP9enemyfire */ -void enemy_fire_remove(enemyfire*) { - /* Nonmatching */ +void enemy_fire_remove(enemyfire* ef) { + ef->mState = 0; // Not on fire + dKy_plight_cut(&ef->mLight); + + for (int i = 0; i < 10; i++) { + if (ef->mpFlameEmitters[i]) { + ef->mpFlameEmitters[i]->becomeInvalidEmitter(); + ef->mpFlameEmitters[i] = NULL; + } + } } /* 8001D428-8001D48C .text enemy_piyo_set__FP10fopAc_ac_c */ -void enemy_piyo_set(fopAc_ac_c*) { - /* Nonmatching */ +void enemy_piyo_set(fopAc_ac_c* enemy) { + // Creates the rotating stars particle for when an enemy is stunned. + dComIfGp_particle_set(0x27A, &enemy->mAttentionInfo.mPosition); } /* 8001D48C-8001D890 .text wall_angle_get__FP10fopAc_ac_cs */ -void wall_angle_get(fopAc_ac_c*, short) { +void wall_angle_get(fopAc_ac_c*, s16) { /* Nonmatching */ } /* 8001DCC8-8001E244 .text dr_body_bg_check__FP14damagereaction */ -void dr_body_bg_check(damagereaction*) { +void dr_body_bg_check(damagereaction* dr) { /* Nonmatching */ } /* 8001E684-8001F6A0 .text dr_joint_bg_check__FP14damagereaction */ -void dr_joint_bg_check(damagereaction*) { +void dr_joint_bg_check(damagereaction* dr) { /* Nonmatching */ } /* 8001F808-8001FBA8 .text kado_check__FP14damagereaction */ -void kado_check(damagereaction*) { +void kado_check(damagereaction* dr) { /* Nonmatching */ } /* 8001FBA8-8001FFEC .text hang_ang_get__FP14damagereaction */ -void hang_ang_get(damagereaction*) { +void hang_ang_get(damagereaction* dr) { /* Nonmatching */ } /* 8001FFEC-80020FD8 .text dr_damage_set__FP14damagereaction */ -void dr_damage_set(damagereaction*) { +void dr_damage_set(damagereaction* dr) { /* Nonmatching */ } /* 80020FD8-80022460 .text dr_damage_anime__FP14damagereaction */ -void dr_damage_anime(damagereaction*) { +void dr_damage_anime(damagereaction* dr) { /* Nonmatching */ } /* 80022460-800225D0 .text dr_matrix_set__FP14damagereaction */ -void dr_matrix_set(damagereaction*) { +void dr_matrix_set(damagereaction* dr) { /* Nonmatching */ } /* 800225D0-800226C8 .text damage_reaction__FP14damagereaction */ -void damage_reaction(damagereaction*) { +void damage_reaction(damagereaction* dr) { /* Nonmatching */ } diff --git a/src/d/actor/d_a_agb.cpp b/src/d/actor/d_a_agb.cpp index 8b6594686..44fc4b656 100644 --- a/src/d/actor/d_a_agb.cpp +++ b/src/d/actor/d_a_agb.cpp @@ -349,8 +349,7 @@ int daAgb_c::uploadMessageSend() { field_0x664 = 60; dComIfGs_onEventBit(0x1A20); - dComIfGp_particle_set(0x2E7, ¤t.pos, NULL, NULL, 255, &field_0x684, -1, NULL, - NULL, NULL); + dComIfGp_particle_set(0x2E7, ¤t.pos, NULL, NULL, 255, &field_0x684); JKRHeap::free(l_gbaCommand->getMemAddress(), NULL); delete l_gbaCommand; diff --git a/src/d/actor/d_a_am.cpp b/src/d/actor/d_a_am.cpp index 90f4947cd..8145a7ecd 100644 --- a/src/d/actor/d_a_am.cpp +++ b/src/d/actor/d_a_am.cpp @@ -313,9 +313,9 @@ static BOOL medama_atari_check(am_class* i_this) { cc_at_check(i_this, &atInfo); i_this->mMaxHealth = 10; i_this->mHealth = 10; - dComIfGp_particle_set(0x27B, &i_this->mAttentionInfo.mPosition, NULL, NULL); + dComIfGp_particle_set(0x27B, &i_this->mAttentionInfo.mPosition); } else { - dComIfGp_particle_set(0xC, &hitPos, NULL, NULL); + dComIfGp_particle_set(0xC, &hitPos); } fopAcM_seStart(i_this, JA_SE_LK_MS_WEP_HIT, 0x42); } @@ -335,8 +335,8 @@ static BOOL medama_atari_check(am_class* i_this) { break; case AT_TYPE_LIGHT_ARROW: ret = true; - i_this->mEnemyIce.mNumFramesDyingToLightArrowsSoFar = 1; - i_this->mEnemyIce.m1AC = 1.0f; + i_this->mEnemyIce.mLightShrinkTimer = 1; + i_this->mEnemyIce.mParticleScale = 1.0f; i_this->mEnemyIce.mYOffset = 80.0f; i_this->mAttentionInfo.mFlags = 0; break; @@ -355,7 +355,7 @@ static BOOL medama_atari_check(am_class* i_this) { i_this->mAction = ACTION_DOUSA; i_this->mState = 2; } else { - dComIfGp_particle_set(0x10, &i_this->mEyeballPos, &player->shape_angle, NULL); + dComIfGp_particle_set(0x10, &i_this->mEyeballPos, &player->shape_angle); // fopAcM_seStart(i_this, JA_SE_CM_AM_EYE_DAMAGE, 0); mDoAud_seStart(JA_SE_CM_AM_EYE_DAMAGE, &i_this->mEyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); fopAcM_monsSeStart(i_this, JA_SE_CV_AM_EYE_DAMAGE, 0x42); @@ -364,7 +364,7 @@ static BOOL medama_atari_check(am_class* i_this) { } break; default: - dComIfGp_particle_set(0xC, &hitPos, NULL, NULL); + dComIfGp_particle_set(0xC, &hitPos); fopAcM_seStart(i_this, JA_SE_LK_MS_WEP_HIT, 0x42); break; } @@ -670,7 +670,7 @@ static void action_dousa(am_class* i_this) { i_this->mSmokeCbs[0].end(); dComIfGp_particle_setToon( 0xA125, &i_this->mWaistPos, &i_this->shape_angle, NULL, - 0xB9, &i_this->mSmokeCbs[0], fopAcM_GetRoomNo(i_this), NULL, NULL, NULL + 0xB9, &i_this->mSmokeCbs[0], fopAcM_GetRoomNo(i_this) ); dComIfGp_getVibration().StartShock(3, -0x21, cXyz(0.0f, 1.0f, 0.0f)); i_this->speedF = 0.0f; @@ -700,7 +700,7 @@ static void action_dousa(am_class* i_this) { if (i_this->mSmokeCbs[2].getEmitter() == NULL) { dComIfGp_particle_setToon( 0xA154, &i_this->mWaistPos, &i_this->shape_angle, NULL, - 0xB9, &i_this->mSmokeCbs[2], fopAcM_GetRoomNo(i_this), NULL, NULL, NULL + 0xB9, &i_this->mSmokeCbs[2], fopAcM_GetRoomNo(i_this) ); } i_this->mState = 8; @@ -773,7 +773,7 @@ static void action_modoru_move(am_class* i_this) { i_this->mSmokeCbs[0].end(); dComIfGp_particle_setToon( 0xA125, &i_this->mWaistPos, &i_this->shape_angle, NULL, - 0xB9, &i_this->mSmokeCbs[0], fopAcM_GetRoomNo(i_this), NULL, NULL, NULL + 0xB9, &i_this->mSmokeCbs[0], fopAcM_GetRoomNo(i_this) ); dComIfGp_getVibration().StartShock(1, -0x21, cXyz(0.0f, 1.0f, 0.0f)); @@ -903,7 +903,7 @@ static void action_itai_move(am_class* i_this) { i_this->mStts.SetWeight(0xFF); dComIfGp_particle_setToon( 0xA155, &i_this->mJawPos, &i_this->shape_angle, NULL, - 0xB9, &i_this->mSmokeCbs[3], fopAcM_GetRoomNo(i_this), NULL, NULL, NULL + 0xB9, &i_this->mSmokeCbs[3], fopAcM_GetRoomNo(i_this) ); fopAcM_seStart(i_this, JA_SE_CM_AM_MOUTH_CLOSE, 0); anm_init(i_this, AM_BCK_BOM_NOMI, 1.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, -1); @@ -928,16 +928,10 @@ static void action_itai_move(am_class* i_this) { i_this->mNeedleCyl.OnAtHitBit(); dComIfGp_particle_setToon( 0xA126, &i_this->mJawPos, &i_this->shape_angle, NULL, - 0xB9, &i_this->mSmokeCbs[1], fopAcM_GetRoomNo(i_this), NULL, NULL, NULL - ); - i_this->m033C = dComIfGp_particle_set( - 0x8157, &i_this->mJawPos, NULL, NULL, - 0xFF, NULL, -1, NULL, NULL, NULL - ); - i_this->m0340 = dComIfGp_particle_set( - 0x8156, &i_this->mJawPos, NULL, NULL, - 0xFF, NULL, -1, NULL, NULL, NULL + 0xB9, &i_this->mSmokeCbs[1], fopAcM_GetRoomNo(i_this) ); + i_this->m033C = dComIfGp_particle_set(0x8157, &i_this->mJawPos); + i_this->m0340 = dComIfGp_particle_set(0x8156, &i_this->mJawPos); } // Using the mDoExt_McaMorf::isStop inline causes regswap. @@ -962,7 +956,7 @@ static void action_itai_move(am_class* i_this) { mDoAud_seStart(JA_SE_CM_AM_JUMP, &i_this->mEyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); dComIfGp_particle_setToon( 0xA125, &i_this->mWaistPos, &i_this->shape_angle, NULL, - 0xB9, &i_this->mSmokeCbs[0], fopAcM_GetRoomNo(i_this), NULL, NULL, NULL + 0xB9, &i_this->mSmokeCbs[0], fopAcM_GetRoomNo(i_this) ); dComIfGp_getVibration().StartShock(1, -0x21, cXyz(0.0f, 1.0f, 0.0f)); // The fopAcM_seStart inline makes the codegen not match. @@ -978,14 +972,8 @@ static void action_itai_move(am_class* i_this) { break; } anm_init(i_this, AM_BCK_DEAD, 1.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, -1); - dComIfGp_particle_set( - 0x8127, &i_this->mWaistPos, NULL, NULL, - 0xFF, NULL, -1, NULL, NULL, NULL - ); - dComIfGp_particle_set( - 0x8128, &i_this->mWaistPos, NULL, NULL, - 0xFF, NULL, -1, NULL, NULL, NULL - ); + dComIfGp_particle_set(0x8127, &i_this->mWaistPos); + dComIfGp_particle_set(0x8128, &i_this->mWaistPos); // The fopAcM_seStart inline makes the codegen not match. // fopAcM_seStart(i_this, JA_SE_CM_AM_BEF_EXPLODE, 0); @@ -1087,8 +1075,8 @@ static BOOL daAM_Execute(am_class* i_this) { if (i_this->mAction != ACTION_ITAI_MOVE && i_this->mSpawnPosY - 1500.0f > i_this->current.pos.y) { anm_init(i_this, AM_BCK_DEAD, 1.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, -1); - dComIfGp_particle_set(0x8127, &i_this->mWaistPos, NULL, NULL); - dComIfGp_particle_set(0x8128, &i_this->mWaistPos, NULL, NULL); + dComIfGp_particle_set(0x8127, &i_this->mWaistPos); + dComIfGp_particle_set(0x8128, &i_this->mWaistPos); fopAcM_seStart(i_this, JA_SE_CM_AM_BEF_EXPLODE, 0); diff --git a/src/d/actor/d_a_arrow.cpp b/src/d/actor/d_a_arrow.cpp index 672cd6eb0..f219d67ac 100644 --- a/src/d/actor/d_a_arrow.cpp +++ b/src/d/actor/d_a_arrow.cpp @@ -191,7 +191,7 @@ void daArrow_c::setBlur() { /* 800D4994-800D4A04 .text createBlur__9daArrow_cFv */ void daArrow_c::createBlur() { if (!mPtclFollowCb.getEmitter()) { - dComIfGp_particle_setP1(0x48, ¤t.pos, NULL, NULL, 0xFF, &mPtclFollowCb, -1, NULL, NULL, NULL); + dComIfGp_particle_setP1(0x48, ¤t.pos, NULL, NULL, 0xFF, &mPtclFollowCb); } } @@ -347,7 +347,7 @@ void daArrow_c::ShieldReflect() { targetAngleX = -cLib_targetAngleX(&link->current.pos, &ganondorfChestPos); fpcM_SetParam(ganondorf, 0x23); field_0x608 = g_regHIO.mChild[0].mShortRegs[3] + 15; - mpSparkleEmitter = dComIfGp_particle_set(0x3EE, &link->current.pos, NULL, NULL, 0xFF, NULL, -1, NULL, NULL, NULL); + mpSparkleEmitter = dComIfGp_particle_set(0x3EE, &link->current.pos); } // // Regswaps without creating a fake inline. @@ -395,7 +395,7 @@ bool daArrow_c::check_water_in() { if (mArrowType == TYPE_FIRE) { mInWaterTimer = 1; - dComIfGp_particle_setP1(0x35A, &waterHitPos, NULL, NULL, 0xFF, NULL, -1, NULL, NULL, NULL); + dComIfGp_particle_setP1(0x35A, &waterHitPos); if (field_0x6e4 == 0) { dKy_arrowcol_chg_on(¤t.pos, 0); } @@ -409,7 +409,7 @@ bool daArrow_c::check_water_in() { dKy_arrowcol_chg_on(¤t.pos, 1); } } else if (mArrowType == TYPE_LIGHT) { - dComIfGp_particle_setP1(0x2A1, &waterHitPos, NULL, NULL, 0xFF, NULL, -1, NULL, NULL, NULL); + dComIfGp_particle_setP1(0x2A1, &waterHitPos); fopAcM_seStartCurrent(this, JA_SE_OBJ_LIGHT_ARW_EFF, 0); if (field_0x6e4 == 0) { dKy_arrowcol_chg_on(¤t.pos, 2); @@ -693,7 +693,7 @@ BOOL daArrow_c::procMove() { mDoMtx_stack_c::ZXYrotM(temp10.x, temp10.y, 0); cMtx_copy(mDoMtx_stack_c::get(), field_0x6b4); - dComIfGp_particle_setP1(0x2A1, &field_0x6a8, &temp10, NULL, 0xFF, NULL, -1, NULL, NULL, NULL); + dComIfGp_particle_setP1(0x2A1, &field_0x6a8, &temp10); fopAcM_seStartCurrent(this, JA_SE_OBJ_LIGHT_ARW_EFF, 0); fopAcM_delete(this); } else { @@ -794,15 +794,15 @@ BOOL daArrow_c::procMove() { cMtx_copy(mDoMtx_stack_c::get(), field_0x6b4); if (mArrowType == TYPE_FIRE) { - dComIfGp_particle_setP1(0x29A, &field_0x6a8, &temp10, NULL, 0xFF, NULL, -1, NULL, NULL, NULL); - dComIfGp_particle_setP1(0x29B, &field_0x6a8, &temp10, NULL, 0xFF, NULL, -1, NULL, NULL, NULL); + dComIfGp_particle_setP1(0x29A, &field_0x6a8, &temp10); + dComIfGp_particle_setP1(0x29B, &field_0x6a8, &temp10); fopAcM_seStartCurrent(this, JA_SE_OBJ_FIRE_ARW_EFF, 0); field_0x698 = 0; } else if (mArrowType == TYPE_ICE) { if (dComIfG_Bgsp()->ChkGrpInf(mLinChk, 0x200)) { fopAcM_create(PROC_Obj_Magmarock, NULL, &field_0x6a8, current.roomNo, NULL, NULL, -1, NULL); } else { - dComIfGp_particle_setP1(0x29E, &field_0x6a8, &temp10, NULL, 0xFF, NULL, -1, NULL, NULL, NULL); + dComIfGp_particle_setP1(0x29E, &field_0x6a8, &temp10); fopAcM_createChild( PROC_ARROW_ICEEFF, fpcM_GetID(this), @@ -813,7 +813,7 @@ BOOL daArrow_c::procMove() { fopAcM_seStartCurrent(this, JA_SE_OBJ_ICE_ARW_EFF, 0); } } else if (mArrowType == TYPE_LIGHT) { - dComIfGp_particle_setP1(0x2A1, &field_0x6a8, &temp10, NULL, 0xFF, NULL, -1, NULL, NULL, NULL); + dComIfGp_particle_setP1(0x2A1, &field_0x6a8, &temp10); fopAcM_seStartCurrent(this, JA_SE_OBJ_LIGHT_ARW_EFF, 0); field_0x698 = 0; } @@ -831,7 +831,7 @@ BOOL daArrow_c::procMove() { csXyz temp9; cM3d_CalcVecZAngle(triPla->mNormal, &temp9); - dComIfGp_particle_setP1(0xC, &field_0x6a8, &temp9, NULL, 0xFF, NULL, -1, NULL, NULL, NULL); + dComIfGp_particle_setP1(0xC, &field_0x6a8, &temp9); fopAcM_seStartCurrent(this, JA_SE_LK_ARROW_REBOUND, mtrlSndId); } else { fopAcM_seStartCurrent(this, JA_SE_LK_ARROW_HIT, mtrlSndId); diff --git a/src/d/actor/d_a_disappear.cpp b/src/d/actor/d_a_disappear.cpp index f329452e8..ab911114a 100644 --- a/src/d/actor/d_a_disappear.cpp +++ b/src/d/actor/d_a_disappear.cpp @@ -84,20 +84,20 @@ void set_disappear(disappear_class* i_this, float scale) { case 0xB: case 0xC: case 0xD: - dComIfGp_particle_set(0x14, &i_this->current.pos, 0, &particleScale, 0xFF, 0, -1, 0, 0, 0); + dComIfGp_particle_set(0x14, &i_this->current.pos, 0, &particleScale); case 3: - dComIfGp_particle_set(0x13, &i_this->current.pos, 0, &particleScale, 0xff, 0, -1, 0, 0, 0); + dComIfGp_particle_set(0x13, &i_this->current.pos, 0, &particleScale); dComIfGp_particle_setStripes(0x15, &i_this->current.pos, 0, &particleScale, 0xFF, 0x96); - dComIfGp_particle_set(0x16, &i_this->current.pos, 0, &particleScale, 0xff, 0, -1, 0, 0, 0); + dComIfGp_particle_set(0x16, &i_this->current.pos, 0, &particleScale); break; case 1: - dComIfGp_particle_set(0x13, &i_this->current.pos, 0, &particleScale, 0xff, 0, -1, 0, 0, 0); - dComIfGp_particle_set(0x16, &i_this->current.pos, 0, &particleScale, 0xff, 0, -1, 0, 0, 0); + dComIfGp_particle_set(0x13, &i_this->current.pos, 0, &particleScale); + dComIfGp_particle_set(0x16, &i_this->current.pos, 0, &particleScale); break; case 4: - dComIfGp_particle_set(0x043C, &i_this->current.pos, 0, 0, 0xff, 0, -1, 0, 0, 0); - dComIfGp_particle_set(0x043D, &i_this->current.pos, 0, 0, 0xff, 0, -1, 0, 0, 0); - dComIfGp_particle_set(0x043E, &i_this->current.pos, 0, 0, 0xff, 0, -1, 0, 0, 0); + dComIfGp_particle_set(0x043C, &i_this->current.pos); + dComIfGp_particle_set(0x043D, &i_this->current.pos); + dComIfGp_particle_set(0x043E, &i_this->current.pos); break; } } diff --git a/src/d/actor/d_a_item.cpp b/src/d/actor/d_a_item.cpp index 904876029..aabef656f 100644 --- a/src/d/actor/d_a_item.cpp +++ b/src/d/actor/d_a_item.cpp @@ -173,7 +173,7 @@ void daItem_c::CreateInit() { if (dItem_data::checkSpecialEffect(m_itemNo) && (m_itemNo != SMALL_KEY || (m_itemNo == SMALL_KEY && (mStatusFlags & 2)))) { u16 particleID = dItem_data::getSpecialEffect(m_itemNo); - dComIfGp_particle_set(particleID, ¤t.pos, NULL, NULL, 0xFF, &mPtclFollowCb, -1, NULL, NULL, NULL); + dComIfGp_particle_set(particleID, ¤t.pos, NULL, NULL, 0xFF, &mPtclFollowCb); } switch (m_itemNo) { @@ -217,7 +217,7 @@ void daItem_c::CreateInit() { animPlay(1.0f, 1.0f, 1.0f, 1.0f, 1.0f); if (fopAcM_SearchByName(PROC_BST)) { // Gohdan - mpParticleEmitter = dComIfGp_particle_set(0x81E1, ¤t.pos, NULL, NULL, 0xFF, NULL, -1, NULL, NULL, NULL); + mpParticleEmitter = dComIfGp_particle_set(0x81E1, ¤t.pos); } } @@ -810,7 +810,7 @@ BOOL daItem_c::checkItemDisappear() { if (mCurState == 4) { disappearing = false; } - if ((mStatusFlags & 0x08) || (mStatusFlags & 0x40) || (mStatus & 0x100000)) { + if ((mStatusFlags & 0x08) || (mStatusFlags & 0x40) || (mStatus & fopAcStts_HOOK_CARRY_e)) { disappearing = false; show(); } diff --git a/src/d/actor/d_a_obj_barrier.cpp b/src/d/actor/d_a_obj_barrier.cpp index 65cc39c82..4557ad119 100644 --- a/src/d/actor/d_a_obj_barrier.cpp +++ b/src/d/actor/d_a_obj_barrier.cpp @@ -486,7 +486,7 @@ void daObjBarrier_ef_c::birth(fopAc_ac_c* i_hitActor, f32 i_radius, cXyz i_cente mDoMtx_stack_c::ZXYrotM(0, angle.y, 0); mpModel[effect_idx]->setBaseTRMtx(mDoMtx_stack_c::get()); - dComIfGp_particle_set(0x81A9, &pos, &angle, NULL); + dComIfGp_particle_set(0x81A9, &pos, &angle); } } diff --git a/src/d/actor/d_a_obj_mknjd.cpp b/src/d/actor/d_a_obj_mknjd.cpp index 759f6b1c9..b777baef4 100644 --- a/src/d/actor/d_a_obj_mknjd.cpp +++ b/src/d/actor/d_a_obj_mknjd.cpp @@ -705,7 +705,7 @@ bool daObjMknjD::Act_c::daObjMknjD_break() { /* Particles and sound effects */ // After 1 frame, the particles for the statue splitting in half spawn. if (mBreakTimer == 1) { - mEmitters[0] = dComIfGp_particle_set(0x8185, ¤t.pos, ¤t.angle, NULL, 0xFF, NULL, -1, NULL, NULL, NULL); + mEmitters[0] = dComIfGp_particle_set(0x8185, ¤t.pos, ¤t.angle); GXColor emitter2Color; emitter2Color.r = mTevStr.mColorC0.r; @@ -713,9 +713,9 @@ bool daObjMknjD::Act_c::daObjMknjD_break() { emitter2Color.b = mTevStr.mColorC0.b; emitter2Color.a = mTevStr.mColorC0.a; - mEmitters[1] = dComIfGp_particle_setProjection(0x8186, ¤t.pos, ¤t.angle, NULL, 0xFF, NULL, current.roomNo, &mTevStr.mColorK0, &emitter2Color, NULL); + mEmitters[1] = dComIfGp_particle_setProjection(0x8186, ¤t.pos, ¤t.angle, NULL, 0xFF, NULL, current.roomNo, &mTevStr.mColorK0, &emitter2Color); - mEmitters[2] = dComIfGp_particle_setToon(0xA187, ¤t.pos, ¤t.angle, NULL, 0xFF, &mSmokeCBs[2], -1, NULL, NULL, NULL); + mEmitters[2] = dComIfGp_particle_setToon(0xA187, ¤t.pos, ¤t.angle, NULL, 0xFF, &mSmokeCBs[2]); mSmokeCBs[2].setRateOff(0); fopAcM_seStartCurrent(this, JA_SE_OBJ_SAGE_GATE_CREAK, 0); @@ -748,7 +748,7 @@ bool daObjMknjD::Act_c::daObjMknjD_break() { mBrokenPos = current.pos; mBrokenPos.y += 350.0f; - mEmitters[3] = dComIfGp_particle_setToon(0x2027, &mBrokenPos, ¤t.angle, NULL, 0xFF, &mSmokeCBs[3], -1, NULL, NULL, NULL); + mEmitters[3] = dComIfGp_particle_setToon(0x2027, &mBrokenPos, ¤t.angle, NULL, 0xFF, &mSmokeCBs[3]); if (mEmitters[3] != NULL) { mEmitters[3]->setVolumeSweep(0.5f); mEmitters[3]->setLifeTime(0x2D); @@ -758,10 +758,10 @@ bool daObjMknjD::Act_c::daObjMknjD_break() { JGeometry::TVec3 vec; vec.set(3.0f, 3.0f, 3.0f); - mEmitters[3]->setGlobalParticleScale(vec); + mEmitters[3]->setGlobalDynamicsScale(vec); vec.set(6.0f, 6.0f, 6.0f); - mEmitters[3]->setGlobalDynamicsScale(vec); + mEmitters[3]->setGlobalParticleScale(vec); } } // After 255 frames, the cutscene ends. diff --git a/src/d/actor/d_a_obj_toripost.cpp b/src/d/actor/d_a_obj_toripost.cpp index 4e24787ff..9b7c22cc7 100644 --- a/src/d/actor/d_a_obj_toripost.cpp +++ b/src/d/actor/d_a_obj_toripost.cpp @@ -445,7 +445,7 @@ int daObjTpost_c::getMsgXY() { col.b = g_regHIO.mChild[12].mShortRegs[2] + 0x80; mDoMtx_stack_c::copy(mMorf->getModel()->mpNodeMtx[2]); mDoMtx_stack_c::multVec(&pos, &pos); - dComIfGp_particle_set(0x57, &pos, &shape_angle, &scale, 0xFF, 0, -1, &col, 0, 0); + dComIfGp_particle_set(0x57, &pos, &shape_angle, &scale, 0xFF, 0, -1, &col); break; case 0x98: @@ -726,7 +726,7 @@ void daObjTpost_c::setAnm(s8 param_1, bool param_2) { cXyz scale; scale.setAll(1.0f); if(mMorf->getFrame() == 1.0f) { - dComIfGp_particle_set(0x8190, ¤t.pos, ¤t.angle, &scale, 0xFF, 0, -1, 0, 0, 0); + dComIfGp_particle_set(0x8190, ¤t.pos, ¤t.angle, &scale); mDoAud_seStart(0x6974, 0, 0, 0); } } diff --git a/src/d/actor/d_a_player.cpp b/src/d/actor/d_a_player.cpp index 000055a4a..3ec69f1d7 100644 --- a/src/d/actor/d_a_player.cpp +++ b/src/d/actor/d_a_player.cpp @@ -67,14 +67,14 @@ void daPy_mtxFollowEcallBack_c::end() { void daPy_mtxFollowEcallBack_c::makeEmitter(u16 particleID, MtxP mtx, const cXyz* pos, const cXyz* scale) { end(); mpMtx = mtx; - dComIfGp_particle_setP1(particleID, pos, NULL, scale, 0xFF, this, -1, NULL, NULL, NULL); + dComIfGp_particle_setP1(particleID, pos, NULL, scale, 0xFF, this); } /* 80102C84-80102D14 .text makeEmitterColor__25daPy_mtxFollowEcallBack_cFUsPA4_fPC4cXyzPC8_GXColorPC8_GXColor */ void daPy_mtxFollowEcallBack_c::makeEmitterColor(u16 particleID, MtxP mtx, const cXyz* pos, const _GXColor* prmColor, const _GXColor* envColor) { end(); mpMtx = mtx; - dComIfGp_particle_setP1(particleID, pos, NULL, NULL, 0xFF, this, -1, prmColor, envColor, NULL); + dComIfGp_particle_setP1(particleID, pos, NULL, NULL, 0xFF, this, -1, prmColor, envColor); } /* 80102D14-80102D90 .text setDoButtonQuake__9daPy_py_cFv */ diff --git a/src/d/actor/d_a_sea.cpp b/src/d/actor/d_a_sea.cpp index d960e1bc6..6956e07d4 100644 --- a/src/d/actor/d_a_sea.cpp +++ b/src/d/actor/d_a_sea.cpp @@ -3,16 +3,18 @@ // Translation Unit: d_a_sea.cpp // -#include "d_a_sea.h" +#include "d/actor/d_a_sea.h" #include "dolphin/types.h" +f32 daSea_packet_c::BASE_HEIGHT = 1.0; + /* 8015B0A4-8015B0FC .text Pos2Index__25daSea_WaterHeightInfo_MngFfPf */ -void daSea_WaterHeightInfo_Mng::Pos2Index(float, float*) { +void daSea_WaterHeightInfo_Mng::Pos2Index(f32, f32*) { /* Nonmatching */ } /* 8015B0FC-8015B164 .text GetHeight__25daSea_WaterHeightInfo_MngFff */ -void daSea_WaterHeightInfo_Mng::GetHeight(float, float) { +void daSea_WaterHeightInfo_Mng::GetHeight(f32, f32) { /* Nonmatching */ } @@ -27,12 +29,12 @@ void daSea_WaterHeightInfo_Mng::GetHeight(int, int) { } /* 8015B288-8015B2D0 .text calcMinMax__FiPfPf */ -void calcMinMax(int, float*, float*) { +void calcMinMax(int, f32*, f32*) { /* Nonmatching */ } /* 8015B2D0-8015B328 .text GetArea__25daSea_WaterHeightInfo_MngFiiPfPfPfPf */ -void daSea_WaterHeightInfo_Mng::GetArea(int, int, float*, float*, float*, float*) { +void daSea_WaterHeightInfo_Mng::GetArea(int, int, f32*, f32*, f32*, f32*) { /* Nonmatching */ } @@ -67,7 +69,7 @@ void daSea_WaveInfo::GetKm(int) { } /* 8015B54C-8015B56C .text GetScale__14daSea_WaveInfoFf */ -void daSea_WaveInfo::GetScale(float) { +void daSea_WaveInfo::GetScale(f32) { /* Nonmatching */ } @@ -112,17 +114,17 @@ void daSea_Init() { } /* 8015BAF8-8015BB60 .text daSea_ChkAreaBeforePos__Fff */ -void daSea_ChkAreaBeforePos(float, float) { +void daSea_ChkAreaBeforePos(f32, f32) { /* Nonmatching */ } /* 8015BB60-8015BBFC .text daSea_ChkArea__Fff */ -void daSea_ChkArea(float, float) { +bool daSea_ChkArea(f32, f32) { /* Nonmatching */ } /* 8015BBFC-8015BDB0 .text daSea_calcWave__Fff */ -void daSea_calcWave(float, float) { +f32 daSea_calcWave(f32, f32) { /* Nonmatching */ } @@ -186,18 +188,7 @@ void daSea_Create(fopAc_ac_c*) { /* Nonmatching */ } -/* 8015D99C-8015D9E4 .text __dt__25daSea_WaterHeightInfo_MngFv */ -daSea_WaterHeightInfo_Mng::~daSea_WaterHeightInfo_Mng() { - /* Nonmatching */ -} - /* 8015D9E4-8015DA70 .text __dt__14daSea_packet_cFv */ daSea_packet_c::~daSea_packet_c() { /* Nonmatching */ } - -/* 8015DAAC-8015DAF4 .text __dt__8cM2dGBoxFv */ -cM2dGBox::~cM2dGBox() { - /* Nonmatching */ -} - diff --git a/src/d/d_bg_s_acch.cpp b/src/d/d_bg_s_acch.cpp index 1ccc91fd8..099026b53 100644 --- a/src/d/d_bg_s_acch.cpp +++ b/src/d/d_bg_s_acch.cpp @@ -9,9 +9,12 @@ #include "JSystem/JUtility/JUTAssert.h" #include "f_op/f_op_actor_mng.h" #include "d/d_com_inf_game.h" +#include "d/actor/d_a_sea.h" -bool daSea_ChkArea(f32, f32); -f32 daSea_calcWave(f32, f32); +#define CHECK_FLOAT_CLASS(line, x) JUT_ASSERT(line, !(((sizeof(x) == sizeof(float)) ? __fpclassifyf((float)(x)) : __fpclassifyd((double)(x)) ) == 1)); +#define CHECK_FLOAT_RANGE(line, x) JUT_ASSERT(line, -1.0e32f < x && x < 1.0e32f); +#define CHECK_VEC3_RANGE(line, v) JUT_ASSERT(line, -1.0e32f < v.x && v.x < 1.0e32f && -1.0e32f < v.y && v.y < 1.0e32f && -1.0e32f < v.z && v.z < 1.0e32f) +#define CHECK_PVEC3_RANGE(line, v) JUT_ASSERT(line, -1.0e32f < v->x && v->x < 1.0e32f && -1.0e32f < v->y && v->y < 1.0e32f && -1.0e32f < v->z && v->z < 1.0e32f) /* 800A257C-800A25F4 .text __ct__12dBgS_AcchCirFv */ dBgS_AcchCir::dBgS_AcchCir() { @@ -56,7 +59,7 @@ dBgS_Acch::dBgS_Acch() { field_0xb4 = 0.0f; field_0xb8 = 0.0f; m_tbl_size = 0; - mp_acch_cir = NULL; + pm_acch_cir = NULL; m_roof_y = 0.0f; m_roof_height = 0.0f; m_roof_crr_height = 0.0f; @@ -78,19 +81,20 @@ void dBgS_Acch::Init() { } /* 800A2D78-800A2E80 .text Set__9dBgS_AcchFP4cXyzP4cXyzP10fopAc_ac_ciP12dBgS_AcchCirP4cXyzP5csXyzP5csXyz */ -void dBgS_Acch::Set(cXyz* param_1, cXyz* param_2, fopAc_ac_c* param_3, int param_4, dBgS_AcchCir* param_5, cXyz* param_6, csXyz* param_7, csXyz* param_8) { - pm_pos = param_1; - pm_old_pos = param_2; +void dBgS_Acch::Set(cXyz* pos, cXyz* old_pos, fopAc_ac_c* actor, int tbl_size, dBgS_AcchCir* acchCir, cXyz* speed, + csXyz* angle, csXyz* shape_angle) { + pm_pos = pos; + pm_old_pos = old_pos; JUT_ASSERT(221, pm_pos != 0); JUT_ASSERT(222, pm_old_pos != 0); - m_my_ac = param_3; - SetActorPid(fopAcM_GetID(param_3)); - pm_speed = param_6; - m_tbl_size = param_4; - mp_acch_cir = param_5; - pm_angle = param_7; - pm_shape_angle = param_8; + m_my_ac = actor; + SetActorPid(fopAcM_GetID(actor)); + pm_speed = speed; + m_tbl_size = tbl_size; + pm_acch_cir = acchCir; + pm_angle = angle; + pm_shape_angle = shape_angle; } /* 800A2E80-800A2EE8 .text GroundCheckInit__9dBgS_AcchFR4dBgS */ @@ -122,10 +126,10 @@ void dBgS_Acch::CrrPos(dBgS& i_bgs) { JUT_ASSERT(494, pm_pos != 0); JUT_ASSERT(495, pm_old_pos != 0); - JUT_ASSERT(535, !(((sizeof(pm_pos->x) == sizeof(float)) ? __fpclassifyf((float)(pm_pos->x)) : __fpclassifyd((double)(pm_pos->x)) ) == 1)); - JUT_ASSERT(536, !(((sizeof(pm_pos->y) == sizeof(float)) ? __fpclassifyf((float)(pm_pos->y)) : __fpclassifyd((double)(pm_pos->y)) ) == 1)); - JUT_ASSERT(537, !(((sizeof(pm_pos->z) == sizeof(float)) ? __fpclassifyf((float)(pm_pos->z)) : __fpclassifyd((double)(pm_pos->z)) ) == 1)); - JUT_ASSERT(541, -1.0e32f < pm_pos->x && pm_pos->x < 1.0e32f && -1.0e32f < pm_pos->y && pm_pos->y < 1.0e32f && -1.0e32f < pm_pos->z && pm_pos->z < 1.0e32f); + CHECK_FLOAT_CLASS(535, pm_pos->x); + CHECK_FLOAT_CLASS(536, pm_pos->y); + CHECK_FLOAT_CLASS(537, pm_pos->z); + CHECK_PVEC3_RANGE(541, pm_pos); i_bgs.MoveBgCrrPos(m_gnd, ChkGroundHit(), pm_pos, pm_angle, pm_shape_angle); @@ -240,10 +244,10 @@ void dBgS_Acch::CrrPos(dBgS& i_bgs) { } } - JUT_ASSERT(780, !(((sizeof(pm_pos->x) == sizeof(float)) ? __fpclassifyf((float)(pm_pos->x)) : __fpclassifyd((double)(pm_pos->x)) ) == 1)); - JUT_ASSERT(781, !(((sizeof(pm_pos->y) == sizeof(float)) ? __fpclassifyf((float)(pm_pos->y)) : __fpclassifyd((double)(pm_pos->y)) ) == 1)); - JUT_ASSERT(782, !(((sizeof(pm_pos->z) == sizeof(float)) ? __fpclassifyf((float)(pm_pos->z)) : __fpclassifyd((double)(pm_pos->z)) ) == 1)); - JUT_ASSERT(786, -1.0e32f < pm_pos->x && pm_pos->x < 1.0e32f && -1.0e32f < pm_pos->y && pm_pos->y < 1.0e32f && -1.0e32f < pm_pos->z && pm_pos->z < 1.0e32f); + CHECK_FLOAT_CLASS(780, pm_pos->x); + CHECK_FLOAT_CLASS(781, pm_pos->y); + CHECK_FLOAT_CLASS(782, pm_pos->z); + CHECK_PVEC3_RANGE(786, pm_pos); } static void dummy2() { @@ -295,13 +299,3 @@ f32 dBgS_Acch::GetWallAddY(Vec&, int) { dBgW* dStage_roomControl_c::getBgW(int i_roomNo) { return mStatus[i_roomNo].mpBgW; } - -// /* 800A444C-800A44BC .text __dt__12dBgS_ObjAcchFv */ -// dBgS_ObjAcch::~dBgS_ObjAcch() { -// /* Nonmatching */ -// } - -// /* 800A44BC-800A4544 .text __dt__12dBgS_AcchCirFv */ -// dBgS_AcchCir::~dBgS_AcchCir() { -// /* Nonmatching */ -// }