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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 124 additions & 0 deletions include/game/bases/d_a_en_bomhei.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
#pragma once

#include <game/bases/d_a_en_carry.hpp>
#include <game/bases/d_audio.hpp>
#include <game/bases/d_heap_allocator.hpp>
#include <game/mLib/m_3d.hpp>
#include <game/mLib/m_effect.hpp>
#include <constants/sound_list.h>

/// @brief A bob-omb enemy.
/// @statetable
/// @paramtable
/// @ingroup bases
class daEnBomhei_c : public daEnCarry_c {
public:
/// @brief The different modes for spawning a bob-omb.
enum SpawnMode_e {
SPAWN_MODE_NORMAL, ///< Start walking immediately.
SPAWN_MODE_WAKIDASHI, ///< Walk out of a pipe.
SPAWN_MODE_ICE_LUMP, ///< Stuck in a large ice block.
SPAWN_MODE_CANNON_HOP ///< Shoot out of a cannon.
};

daEnBomhei_c() : mExplodeWaitTimer(-1), mExplodeTimer(-1), mFireCoinCount(smc_FireCountCount) {}
virtual ~daEnBomhei_c() {}

virtual int create();
virtual int execute();
virtual int preDraw();
virtual int draw();
virtual int doDelete();
virtual void deleteReady();
virtual void finalUpdate();
virtual bool ActorDrawCullCheck();
virtual void setSpinLiftUpActor(dActor_c *carryingActor);
virtual void Normal_VsEnHitCheck(dCc_c *self, dCc_c *other);
virtual void Normal_VsPlHitCheck(dCc_c *self, dCc_c *other);
virtual void Normal_VsYoshiHitCheck(dCc_c *self, dCc_c *other);
virtual void block_hit_init();
virtual bool hitCallback_Shell(dCc_c *self, dCc_c *other);
virtual bool hitCallback_Fire(dCc_c *self, dCc_c *other);
virtual bool hitCallback_Ice(dCc_c *self, dCc_c *other);
virtual void returnState_Ice();
virtual bool hitCallback_HipAttk(dCc_c *self, dCc_c *other);
virtual bool hitCallback_YoshiHipAttk(dCc_c *self, dCc_c *other);
virtual bool hitCallback_Spin(dCc_c *self, dCc_c *other) { return hitCallback_HipAttk(self, other); }
virtual bool createIceActor();
virtual bool EtcDamageCheck(dCc_c *self, dCc_c *other);

virtual void boyonBegin() {}
virtual bool isSpinLiftUpEnable() { return isState(StateID_Sleep); }

STATE_FUNC_DECLARE(daEnBomhei_c, Walk); ///< Walking on the ground.
STATE_FUNC_DECLARE(daEnBomhei_c, Sleep); ///< Sleeping, waiting to explode.
STATE_VIRTUAL_FUNC_DECLARE(daEnBomhei_c, Carry); ///< Being carried by a player.
STATE_FUNC_DECLARE(daEnBomhei_c, Slide); ///< Sliding along the ground after a ground pound.
STATE_FUNC_DECLARE(daEnBomhei_c, Kick); ///< Being kicked by the player.
STATE_FUNC_DECLARE(daEnBomhei_c, KickBom);
STATE_FUNC_DECLARE(daEnBomhei_c, Wakidashi); ///< Moving out of a pipe.
STATE_FUNC_DECLARE(daEnBomhei_c, Explode); ///< Exploding after the timer runs out.
STATE_FUNC_DECLARE(daEnBomhei_c, Turn); ///< Turning around
STATE_FUNC_DECLARE(daEnBomhei_c, CannonHop_Upper); ///< Being shot upwards out of a cannon.
STATE_FUNC_DECLARE(daEnBomhei_c, CannonHop_Under); ///< Being shot downwards out of a cannon.
STATE_FUNC_DECLARE(daEnBomhei_c, AfterIce);
STATE_FUNC_DECLARE(daEnBomhei_c, InIceLump); ///< Stuck in a large ice block.
STATE_VIRTUAL_FUNC_DECLARE(daEnBomhei_c, EatOut);

virtual void vf28c();
virtual void modelUpdate();
virtual void postMdlSetup();
virtual void initialStateSet();
virtual void vf29c() {}

void mdlSetup();

void bcSet1();
void bcSet2();
void setDeathInfo_Carry(dActor_c *killedBy);
void checkBombBreak();
void explodeBgUnit();
mVec2_c getExplodeTilePos();
void calcIgnitionPos();
void updateCarryCc();

void breakEffect() { mEf::createEffect("Wm_en_bombheibreak", 0, &mIgnitionPos, nullptr, nullptr); }
void explosionEffect() { mEf::createEffect("Wm_en_explosion", 0, &mIgnitionPos, nullptr, nullptr); }

dHeapAllocator_c mAllocator;
nw4r::g3d::ResFile mFile;
m3d::mdl_c mModel;
m3d::anmChr_c mAnm;
m3d::anmMatClr_c mAnmMat;
int mExplodeWaitTimer; ///< Timer counting down until the bob-omb explodes.
int mExplodeTimer; ///< Timer counting up while exploding.
int mWakidashiTimer; ///< Timer counting down until the bob-omb will beging walking normally.
int mCannonHopDir;
int mCannonHopTimer;
u8 mPad[4];
mVec3_c mLiftPos;
float mCcOffsetX;
float mCcOffsetY;
float mCcWidth;
float mCcHeight;
int mFireCoinCount; ///< How many more coins can be spawned by hitting the bob-omb with a fireball.
int mCarryingPlayer;
int mUnkTimer;
mVec3_c mIgnitionPos;
mEf::levelEffect_c mEffect;

ACTOR_PARAM_CONFIG(WakidashiSpawnDir, 0, 2); ///< The direction to move out of the pipe.
ACTOR_PARAM_CONFIG(CannonHopSpawnDir, 4, 2); ///< The direction to shoot out of the cannon.
ACTOR_PARAM_CONFIG(CannonHopType, 6, 1); ///< The trajectory to shoot out of the cannon. 0 is a flat arc, 1 is a high arc.
ACTOR_PARAM_CONFIG(ZLayer, 24, 4); ///< The Z layer to place the bob-omb on.
ACTOR_PARAM_CONFIG(SpawnMode, 28, 2); ///< See SpawnMode_e.

static const float smc_WalkSpeed;
static const float smc_SlideSpeedX;
static const float smc_KickSpeedX;
static const float smc_KickSpeedY;
static const int smc_ExplodeWaitFrames;
static const int smc_SoundEffectIDs[];

static const int smc_FireCountCount = 3;
};
9 changes: 9 additions & 0 deletions include/game/bases/d_a_fireball_base.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#pragma once

#include <game/bases/d_actor_state.hpp>
#include <game/mLib/m_3d.hpp>

class daFireBall_Base_c : public dActorState_c {
public:
void kill();
};
91 changes: 71 additions & 20 deletions include/game/bases/d_audio.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,39 @@ class NMSndObject : public NMSndObjectBase {
nw4r::math::VEC2 mPos;
};

template<int T>
class NMSndObjectCmn : public NMSndObjectBase {
public:
class SoundHandlePrm : public nw4r::snd::SoundHandle {
public:
SoundHandlePrm() : m_04(1.0f) {}

float m_04;
};

NMSndObjectCmn() :
NMSndObjectBase(NMSndObjectBase::OBJ_TYPE_0, SndAudioMgr::sInstance->mArcPlayer),
m_64(1.0f), m_68(0), m_6c(1.0f), m_70(0.0f)
{
SetPlayableSoundCount(0, T);
mTotalCount = T + 2;
m_58 = 1;
}

virtual SoundHandlePrm *startSound(unsigned long p1, const nw4r::math::VEC2 &p2, unsigned long p3);
virtual SoundHandlePrm *startSound(unsigned long p1, const nw4r::math::VEC2 &p2, short p3, unsigned long p4);
virtual SoundHandlePrm *holdSound(unsigned long p1, const nw4r::math::VEC2 &p2, unsigned long p3);
virtual SoundHandlePrm *holdSound(unsigned long p1, int p2, const nw4r::math::VEC2 &p3, unsigned long p4);
virtual SoundHandlePrm *holdSound(unsigned long p1, int p2, const nw4r::math::VEC2 &p3, short p4, unsigned long p5);

float m_64;
int m_68;
float m_6c;
float m_70;
SoundHandlePrm mParams[T + 2];
nw4r::math::VEC2 mPos;
};

class SndObjctPly : public NMSndObject<4> {
public:
void calculate(const nw4r::math::VEC2 &pos) {
Expand Down Expand Up @@ -260,24 +293,22 @@ class SndObjctEmy : public NMSndObject<4> {
virtual SoundHandlePrm *holdSound(ulong p1, const nw4r::math::VEC2 &p2, ulong p3);
};

class SndObjctCmnEmy : public NMSndObject<4> {
class SndObjctCmnEmy : public NMSndObjectCmn<12> {
public:
virtual SoundHandlePrm *startSound(ulong p1, ulong p2);
virtual SoundHandlePrm *holdSound(ulong p1, ulong p2);
virtual SoundHandlePrm *startSound(ulong p1, short p2, ulong p3);
virtual SoundHandlePrm *holdSound(ulong p1, short p2, ulong p3);
virtual SoundHandlePrm *startSound(ulong p1, const nw4r::math::VEC2 &p2, ulong p3);
virtual SoundHandlePrm *holdSound(ulong p1, const nw4r::math::VEC2 &p2, ulong p3);
virtual SoundHandlePrm *startSound(unsigned long p1, const nw4r::math::VEC2 &p2, unsigned long p3);
virtual SoundHandlePrm *startSound(unsigned long p1, const nw4r::math::VEC2 &p2, short p3, unsigned long p4);
virtual SoundHandlePrm *holdSound(unsigned long p1, const nw4r::math::VEC2 &p2, unsigned long p3);
virtual SoundHandlePrm *holdSound(unsigned long p1, int p2, const nw4r::math::VEC2 &p3, unsigned long p4);
virtual SoundHandlePrm *holdSound(unsigned long p1, int p2, const nw4r::math::VEC2 &p3, short p4, unsigned long p5);
};

class SndObjctCmnMap : public NMSndObject<4> {
class SndObjctCmnMap : public NMSndObjectCmn<12> {
public:
virtual SoundHandlePrm *startSound(ulong p1, ulong p2);
virtual SoundHandlePrm *holdSound(ulong p1, ulong p2);
virtual SoundHandlePrm *startSound(ulong p1, short p2, ulong p3);
virtual SoundHandlePrm *holdSound(ulong p1, short p2, ulong p3);
virtual SoundHandlePrm *startSound(ulong p1, const nw4r::math::VEC2 &p2, ulong p3);
virtual SoundHandlePrm *holdSound(ulong p1, const nw4r::math::VEC2 &p2, ulong p3);
virtual SoundHandlePrm *startSound(unsigned long p1, const nw4r::math::VEC2 &p2, unsigned long p3);
virtual SoundHandlePrm *startSound(unsigned long p1, const nw4r::math::VEC2 &p2, short p3, unsigned long p4);
virtual SoundHandlePrm *holdSound(unsigned long p1, const nw4r::math::VEC2 &p2, unsigned long p3);
virtual SoundHandlePrm *holdSound(unsigned long p1, int p2, const nw4r::math::VEC2 &p3, unsigned long p4);
virtual SoundHandlePrm *holdSound(unsigned long p1, int p2, const nw4r::math::VEC2 &p3, short p4, unsigned long p5);
};

namespace dAudio {
Expand Down Expand Up @@ -340,6 +371,12 @@ namespace dAudio {
SoundHandlePrm *startSound(unsigned long soundID, const mVec3_c &pos, int remPlayer) {
return SndObjctCmnEmy::startSound(soundID, dAudio::cvtSndObjctPos(pos), remPlayer);
}
SoundHandlePrm *holdSound(unsigned long soundID, int i, const nw4r::math::VEC2 &pos, int remPlayer) {
return SndObjctCmnEmy::holdSound(soundID, i, pos, remPlayer);
}
SoundHandlePrm *holdSound(unsigned long soundID, int i, const mVec3_c &pos, int remPlayer) {
return SndObjctCmnEmy::holdSound(soundID, i, dAudio::cvtSndObjctPos(pos), remPlayer);
}
};

class SndObjctEmy_c : public SndObjctEmy {
Expand Down Expand Up @@ -390,20 +427,34 @@ namespace dAudio {
obj->startSound(id, dAudio::cvtSndObjctPos(pos), playerNo);
}

void playEmySound(const mVec2_c &pos, int playerNo) const {
playObjSound(dAudio::g_pSndObjEmy, pos, playerNo);
template<class T>
void holdObjSound(T *obj, int i, const mVec2_c &pos, int playerNo) const {
obj->holdSound(id, i, dAudio::cvtSndObjctPos(pos), playerNo);
}

void playEmySound(const mVec3_c &pos, int playerNo) const {
template<class T>
void holdObjSound(T *obj, int i, const mVec3_c &pos, int playerNo) const {
obj->holdSound(id, i, dAudio::cvtSndObjctPos(pos), playerNo);
}

template <class T>
void playEmySound(const T &pos, int playerNo) const {
playObjSound(dAudio::g_pSndObjEmy, pos, playerNo);
}

void playMapSound(const mVec2_c &pos, int playerNo) const {
template <class T>
void playMapSound(const T &pos, int playerNo) const {
playObjSound(dAudio::g_pSndObjMap, pos, playerNo);
}

void playMapSound(const mVec3_c &pos, int playerNo) const {
playObjSound(dAudio::g_pSndObjMap, pos, playerNo);
template <class T>
void holdEmySound(int i, const T &pos, int playerNo) const {
holdObjSound(dAudio::g_pSndObjEmy, i, pos, playerNo);
}

template <class T>
void holdMapSound(int i, const T &pos, int playerNo) const {
holdObjSound(dAudio::g_pSndObjMap, i, pos, playerNo);
}

private:
Expand Down
1 change: 1 addition & 0 deletions include/game/bases/d_bc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ class dBc_c {
u16 getHeadAttr();
short getHeadSakaMoveAngle(u8 direction);
void clearBgcSaveAll();
void checkBombBreak(mVec2_c, mVec2_c);

bool getSakaUpDown(u8 direction);
short getSakaAngleBySpeed(float);
Expand Down
19 changes: 10 additions & 9 deletions include/game/bases/d_bg.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@ class dBg_c {
};

public:
float getLiquidHeight() const { return mLiquidHeight; }

float getDispScale() { return mDispScale; }
float getPrevDispScale() { return mPrevDispScale; }

void setWaterInWave(float x, float y, u8 type);
float getLeftLimit();
float getRightLimit();
void BgUnitChange(u16, u16, int, u16);

u8 mPad1[0x8fe70];
float m_8fe00;
u8 mPad2[0x2c];
Expand All @@ -34,14 +44,5 @@ class dBg_c {
u8 mPad7[0x1a];
u8 m_9008e;

float getLiquidHeight() const { return mLiquidHeight; }

void setWaterInWave(float x, float y, u8 type);
float getLeftLimit();
float getRightLimit();

float getDispScale() { return mDispScale; }
float getPrevDispScale() { return mPrevDispScale; }

static dBg_c *m_bg_p;
};
5 changes: 3 additions & 2 deletions include/game/bases/d_cc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ enum CC_STATUS_FLAG_e {
*/
CC_STATUS_NO_PASS_INFO = BIT_FLAG(2),
CC_STATUS_8 = BIT_FLAG(8),
CC_STATUS_9 = BIT_FLAG(9),
};

///< @unofficial
Expand All @@ -44,8 +45,8 @@ enum CC_KIND_e {
CC_KIND_ITEM,
CC_KIND_TAMA,
CC_KIND_KILLER,
CC_KIND_GOAL_POLE,
CC_KIND_COUNT = CC_KIND_GOAL_POLE // Goal pole is special and doesn't count
CC_KIND_COUNT,
CC_KIND_GOAL_POLE = CC_KIND_COUNT ///< [Unsure why this goes above the count]
};

///< @unofficial
Expand Down
1 change: 0 additions & 1 deletion include/game/bases/d_en_boyo_manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class dEnBoyoMng_c {
float mFactorDelta;
int mCounter;
dActor_c *mpOwner;
u8 mDirection;

static float smc_DELTA_SCALE;
static int smc_BOYON_TIME;
Expand Down
1 change: 1 addition & 0 deletions include/game/bases/d_enemy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ class dEn_c : public dActorMultiState_c {
bool mFootAttr1;
u8 mPad3[5];
dEnBoyoMng_c mBoyoMng;
u8 mIceDirection;
dIceMng_c mIceMng; ///< The ice manager for this enemy.
float mAirAccelY; ///< The Y acceleration before entering a liquid.
float mAirSpeedMaxY; ///< The maximum Y speed before entering a liquid.
Expand Down
6 changes: 4 additions & 2 deletions include/game/bases/d_enemy_manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ class dEnemyMng_c {

u8 mPad1[0x138];
int m_138;
u8 mPad2[0x18];
int m_154;
u8 mPad2[0x10];
int mBomheiCount;
u8 mPad3[0x4];
int m_154;
u8 mPad4[0x4];
int m_15c;

static dEnemyMng_c *m_instance;
Expand Down
2 changes: 1 addition & 1 deletion include/game/bases/d_ice_manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class dIceEfScale_c {

class dIceInfo {
public:
~dIceInfo();
~dIceInfo() {}

int mMode;
mVec3_c mPos;
Expand Down
2 changes: 2 additions & 0 deletions include/game/mLib/m_3d/anm_mat_clr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
namespace m3d {
class anmMatClr_c : public banm_c {
public:
anmMatClr_c() : children(nullptr) {}

virtual ~anmMatClr_c();
virtual void remove();
virtual void play();
Expand Down
4 changes: 4 additions & 0 deletions include/game/mLib/m_angle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ struct mAng {
return sLib::chase(&mAngle, target, step);
}

BOOL chaseAngle(short target, short step) {
return sLib::chaseAngle(&mAngle, target, step);
}

int abs() const {
return ::abs(mAngle);
}
Expand Down
2 changes: 1 addition & 1 deletion include/game/mLib/m_effect.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
#include <lib/nw4r/ef.h>
#include <lib/egg/util/eggEffect.hpp>
#include <lib/egg/util/eggEffect.h>
#include <game/mLib/m_vec.hpp>
#include <game/mLib/m_mtx.hpp>

Expand Down
File renamed without changes.
Loading
Loading