Skip to content
Draft
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
14 changes: 14 additions & 0 deletions alias_db.txt
Original file line number Diff line number Diff line change
Expand Up @@ -748,3 +748,17 @@ R_2_5_4180 = g_profile_DEMO_MESSAGE
R_2_5_72e0 = g_profile_LETTER_WINDOW
R_2_5_1a7f8 = g_profile_DUMMY_ACTOR
R_2_5_27460 = g_profile_LASTACTOR_STAGE
R_3_1_70 = __register_global_object
R_3_1_780 = getPlrNo__8dActor_cFv
R_3_1_2710 = GetActorType__12dBaseActor_cFv
R_3_1_2720 = funsuiMoveX__8dActor_cFv
R_3_1_2730 = setCarryFall__8dActor_cFP8dActor_ci
R_3_1_2750 = vf68__8dActor_cFP9dBg_ctr_c
R_3_1_2760 = isFunsui__5dEn_cCFv
R_3_1_2770 = endFunsui__5dEn_cFv
R_3_1_2780 = beginFunsui__5dEn_cFv
R_3_1_2790 = calcBoyonScale__5dEn_cFv
R_3_1_2870 = getType__Q23m3d8anmChr_cCFv
R_3_1_33e0 = isQuakeDamage__5dEn_cFv
R_3_1_b4b0 = __dt__8dIceInfoFv
R_3_5_320 = __vt__Q23m3d8anmChr_c
118 changes: 118 additions & 0 deletions include/game/bases/d_a_en_bomhei.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
#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>

class daEnBomhei_c : public daEnCarry_c {
public:
enum SpawnMode_e {
SPAWN_MODE_NORMAL,
SPAWN_MODE_WAKIDASHI,
SPAWN_MODE_ICE_LUMP,
SPAWN_MODE_CANNON,
};

daEnBomhei_c() : mTimer(-1), m_5f0(-1), m_620(3) {}
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 *cc1, dCc_c *cc2);
virtual void Normal_VsPlHitCheck(dCc_c *cc1, dCc_c *cc2);
virtual void Normal_VsYoshiHitCheck(dCc_c *cc1, dCc_c *cc2);
virtual void block_hit_init();
virtual bool hitCallback_Shell(dCc_c *cc1, dCc_c *cc2);
virtual bool hitCallback_Fire(dCc_c *cc1, dCc_c *cc2);
virtual bool hitCallback_Ice(dCc_c *cc1, dCc_c *cc2);
virtual void returnState_Ice();
virtual bool hitCallback_HipAttk(dCc_c *cc1, dCc_c *cc2);
virtual bool hitCallback_YoshiHipAttk(dCc_c *cc1, dCc_c *cc2);
virtual bool hitCallback_Spin(dCc_c *cc1, dCc_c *cc2) { return hitCallback_HipAttk(cc1, cc2); }
virtual bool createIceActor();
virtual bool EtcDamageCheck(dCc_c *cc1, dCc_c *cc2);

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

STATE_FUNC_DECLARE(daEnBomhei_c, Walk);
STATE_FUNC_DECLARE(daEnBomhei_c, Sleep);
STATE_VIRTUAL_FUNC_DECLARE(daEnBomhei_c, Carry);
STATE_FUNC_DECLARE(daEnBomhei_c, Slide);
STATE_FUNC_DECLARE(daEnBomhei_c, Kick);
STATE_FUNC_DECLARE(daEnBomhei_c, KickBom);
STATE_FUNC_DECLARE(daEnBomhei_c, Wakidashi);
STATE_FUNC_DECLARE(daEnBomhei_c, Explode);
STATE_FUNC_DECLARE(daEnBomhei_c, Turn);
STATE_FUNC_DECLARE(daEnBomhei_c, CannonHop_Upper);
STATE_FUNC_DECLARE(daEnBomhei_c, CannonHop_Under);
STATE_FUNC_DECLARE(daEnBomhei_c, AfterIce);
STATE_FUNC_DECLARE(daEnBomhei_c, InIceLump);
STATE_VIRTUAL_FUNC_DECLARE(daEnBomhei_c, EatOut);

virtual void vf28c();
virtual void vf290();
virtual void vf294();
virtual void vf298();
virtual void vf29c() {}

void mdlSetup();

void bcSet1();
void bcSet2();
void setDeathInfo_Carry(dActor_c *killedBy);
void checkBombBreak();
void someBgCheck();
mVec2_c getSomePos();
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); }

ACTOR_PARAM_CONFIG(wakidashiConfig, 0, 2);
ACTOR_PARAM_CONFIG(unk2, 4, 2);
ACTOR_PARAM_CONFIG(CannonHopDir, 6, 1);
ACTOR_PARAM_CONFIG(zLayer, 24, 4);
ACTOR_PARAM_CONFIG(spawnMode, 28, 2);

dHeapAllocator_c mAllocator;
nw4r::g3d::ResFile mFile;
m3d::mdl_c mModel;
m3d::anmChr_c mAnm;
m3d::anmMatClr_c mAnmMat;
int mTimer;
int m_5f0;
int m_5f4;
int m_5f8;
int m_5fc;
u8 mPad[4];
mVec3_c m_604;
// mVec2_c mCcOffset;
float mCcOffsetX;
float mCcOffsetY;
float mCcWidth;
float mCcHeight;
int m_620;
int m_624;
int m_628;
mVec3_c mIgnitionPos;
mEf::levelEffect_c mEffect;

static const float smc_WALK_SPEED;
static const float smc_SLIDE_SPEED_X;
static const float smc_KICK_SPEED_X;
static const float smc_KICK_SPEED_Y;
static const int smc_5EC_VALUE;
static const int smc_SOUND_EFFECTS[];
};
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();
};
2 changes: 1 addition & 1 deletion include/game/bases/d_actor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ class dActor_c : public dBaseActor_c {
u8 mEventNums[2]; ///< The event IDs the actor is tracking.
u64 mEventMask; ///< The event mask, generated from #mEventNums.

u32 m_23b; ///< @todo Figure out the purpose of this field.
int m_23b; ///< @todo Figure out the purpose of this field.
u16 mSpriteSpawnFlags; ///< The spawn flags from the sprite data entry.
bool mBlockHit; ///< Whether a block below the actor was hit.

Expand Down
40 changes: 34 additions & 6 deletions include/game/bases/d_audio.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@ class NMSndObject : NMSndObjectBase {
class SndObjctCmnEmy : public NMSndObject<4> {
public:
virtual void startSound(unsigned long, const nw4r::math::VEC2 &, unsigned long);
virtual void holdSound(unsigned long, int, const nw4r::math::VEC2 &, unsigned long);
};

class SndObjctCmnMap : public NMSndObject<4> {
public:
virtual void startSound(unsigned long, const nw4r::math::VEC2 &, unsigned long);
virtual void holdSound(unsigned long, int, const nw4r::math::VEC2 &, unsigned long);
};

namespace dAudio {
Expand All @@ -54,6 +56,12 @@ namespace dAudio {
void startSound(unsigned long soundID, const mVec3_c &pos, int remPlayer) {
SndObjctCmnEmy::startSound(soundID, dAudio::cvtSndObjctPos(pos), remPlayer);
}
void holdSound(unsigned long soundID, int i, const nw4r::math::VEC2 &pos, int remPlayer) {
SndObjctCmnEmy::holdSound(soundID, i, pos, remPlayer);
}
void holdSound(unsigned long soundID, int i, const mVec3_c &pos, int remPlayer) {
SndObjctCmnEmy::holdSound(soundID, i, dAudio::cvtSndObjctPos(pos), remPlayer);
}
};

class SndObjctCmnMap_c : SndObjctCmnMap {
Expand All @@ -64,6 +72,12 @@ namespace dAudio {
void startSound(unsigned long soundID, const mVec3_c &pos, int remPlayer) {
SndObjctCmnMap::startSound(soundID, dAudio::cvtSndObjctPos(pos), remPlayer);
}
void holdSound(unsigned long soundID, int i, const nw4r::math::VEC2 &pos, int remPlayer) {
SndObjctCmnMap::holdSound(soundID, i, pos, remPlayer);
}
void holdSound(unsigned long soundID, int i, const mVec3_c &pos, int remPlayer) {
SndObjctCmnMap::holdSound(soundID, i, dAudio::cvtSndObjctPos(pos), remPlayer);
}
};

extern SndObjctCmnEmy_c *g_pSndObjEmy;
Expand All @@ -88,20 +102,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
10 changes: 8 additions & 2 deletions include/game/bases/d_bc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class dBc_c {
dBc_c();
virtual ~dBc_c();

void set(dActor_c *, const sBcSensorBase *, const sBcSensorBase *, const sBcSensorBase *); ///< @unofficial
void set(dActor_c *owner, const sBcSensorBase *foot, const sBcSensorBase *head, const sBcSensorBase *wall); ///< @unofficial

void checkLink();
bool checkRide();
Expand All @@ -104,6 +104,8 @@ class dBc_c {
bool hasSensorHead() { return mpSensorHead != nullptr; }
bool hasSensorWall() { return mpSensorWall != nullptr; }

void checkBombBreak(mVec2_c, mVec2_c);

dActor_c *mpOwner;
sBcSensorBase *mpSensorFoot;
sBcSensorBase *mpSensorHead;
Expand Down Expand Up @@ -131,12 +133,16 @@ class dBc_c {
dBg_ctr_c *mLinkW[2];
u32 mFlags;
u32 mPrevFlags;
char pad3[0x55];
char mPad3[0x8];
s8 mOwningPlayerNo;
char mPad4[0x4c];
u8 mAmiLine;
char pad4[0x2];
u8 *mpLayer;

u8 mLayer;

static int getUnitType(float, float, u8);
static int checkWaterDepth(float, float, u8, u8, float *);
static WATER_TYPE_e checkWater(float, float, u8, float *);

Expand Down
1 change: 1 addition & 0 deletions include/game/bases/d_bg.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class dBg_c {
float getLiquidHeight() const { return mLiquidHeight; }

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

float getDispScale() { return mDispScale; }
float getPrevDispScale() { return mPrevDispScale; }
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 @@ -19,7 +19,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
4 changes: 3 additions & 1 deletion include/game/bases/d_enemy_manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ class dEnemyMng_c {

u8 mPad1[0x138];
int m_138;
u8 mPad2[0x18];
u8 mPad2[0x10];
int m_14c;
u8 mPad3[0x4];
int m_154;

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
9 changes: 3 additions & 6 deletions include/game/mLib/m_angle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
#include <types.h>
#include <game/sLib/s_lib.hpp>
#include <nw4r/math.h>

extern "C" {
int abs(int);
}
#include <MSL/arith.h>

/// @brief A one-dimensional short angle vector.
/// @ingroup mlib
Expand All @@ -19,8 +16,8 @@ struct mAng {

operator s16() { return mAngle; }

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

mAng abs() const {
Expand Down
28 changes: 28 additions & 0 deletions include/game/mLib/m_effect.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,35 @@
#pragma once

#include <game/mLib/m_vec.hpp>
#include <game/mLib/m_mtx.hpp>
#include <lib/egg/core/eggEffect.h>

class mEf {
public:
static void createEffect(const char *, unsigned long, const mVec3_c *, const mAng3_c *, const mVec3_c *);

class effect_c : public EGG::Effect {
public:
virtual void createEffect(const char *, int);
virtual void createEffect(const char *, unsigned long, const mVec3_c *, const mAng3_c *, const mVec3_c *);
virtual void createEffect(const char *, unsigned long, const mMtx_c *);

u8 mPad[0x92];
};

class levelEffect_c : public effect_c {
public:
levelEffect_c() : m_114(0), m_118(0), m_11c(0), m_11d(0), m_120(0), m_124(0) {}
virtual ~levelEffect_c() { cleanup(); }

virtual void createEffect(const char *, int);
virtual void createEffect(const char *, unsigned long, const mVec3_c *, const mAng3_c *, const mVec3_c *);
virtual void createEffect(const char *, unsigned long, const mMtx_c *);

void cleanup();

u32 m_114, m_118;
u8 m_11c, m_11d;
u32 m_120, m_124;
};
};
5 changes: 5 additions & 0 deletions include/game/mLib/m_vec.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
/// A plain-old-data structure version of mVec2_c.
/// @unofficial
struct mVec2_POD_c {
void set(float fx, float fy) {
x = fx;
y = fy;
}

float x;
float y;
};
Expand Down
Loading
Loading