Skip to content
Merged
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
1,356 changes: 691 additions & 665 deletions alias_db.txt

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,11 @@ def gen_rel_build_statements(writer: NinjaWriter, slices: list[SliceFile]):

# RELs need to come together to create the common linker script for the final stripped modules
# Pick the slice with the largest number of sections as the base
rel_slices = [x for x in slices if x.meta.type == SliceType.REL]
best_slice = max(rel_slices, key=lambda x: len(x.meta.sections))
rel_slices = [x.path for x in slices if x.meta.type == SliceType.REL]
writer.build('gen_linkerscript',
common_lcf,
[best_slice.path, *files_with_suffix(rel_files, '.preplf')])
rel_slices,
implicit_inputs=files_with_suffix(rel_files, '.preplf'))

######################
# Build Script Setup #
Expand Down
146 changes: 146 additions & 0 deletions include/game/bases/d_a_en_noko.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
#include <game/bases/d_a_en_shell.hpp>
#include <game/mLib/m_effect.hpp>
#include <lib/MSL/string.h>

/**
* @brief Koopa Troopa
* @statetable
* @paramtable
*/
class daEnNoko_c : public daEnShell_c {
public:
class nodeCallback_c : public m3d::mdl_c::callback_c {
public:
nodeCallback_c(daEnNoko_c *owner) : mpOwner(owner) {}
virtual void timingB(ulong nodeId, nw4r::g3d::WorldMtxManip *manip, nw4r::g3d::ResMdl resMdl);

daEnNoko_c *mpOwner;
};

enum NokoType_e {
NOKO_GREEN, ///< Green Koopas don't turn around on ledges.
NOKO_RED ///< Red Koopas turn around on ledges.
};

enum SPAWN_MODE_e {
SPAWN_MODE_WALK,
SPAWN_MODE_SLEEP,
};

enum DANCE_MOVE_e {
BGM_anim_walkA_1,
BGM_anim_walkA_2, ///< Actually uses the same animation as BGM_anim_walkA_1.
BGM_anim_walkA_3,
DANCE_MOVE_COUNT,
};

daEnNoko_c() : mMdlCallback(this) {}

int create() override;
int doDelete() override;
int execute() override;
int preExecute() override;
int draw() override;
void finalUpdate() override { calcMdl(); }
bool createIceActor() override;
void beginFunsui() override;
void endFunsui() override;

STATE_FUNC_DECLARE(daEnNoko_c, BlockAppear); ///< Spawning from a block.
STATE_FUNC_DECLARE(daEnNoko_c, Walk); ///< Walking on the ground.
STATE_FUNC_DECLARE(daEnNoko_c, Turn); ///< Turning around while walking.
STATE_FUNC_DECLARE(daEnNoko_c, WindTurn); ///< Being turned around by the wind.
STATE_FUNC_DECLARE(daEnNoko_c, SpitOut_Ready); ///< About to be spit out by Yoshi.
STATE_FUNC_DECLARE(daEnNoko_c, BgmDance); ///< Doing a dance move to the background music.
STATE_FUNC_DECLARE(daEnNoko_c, BgmDanceEd); ///< Returning from a dance move to walking.
STATE_VIRTUAL_FUNC_DECLARE(daEnNoko_c, Wakeup);
STATE_VIRTUAL_FUNC_DECLARE(daEnNoko_c, WakeupTurn);

bool setPlayerDamage(dActor_c *actor) override;
bool checkSleep() override;
bool turnProc() override;
void calcShellEffectPos() override;

void setEnemyTurn() override {
if (isState(StateID_Walk)) {
changeState(StateID_Turn);
}
}

virtual void checkWaterEntry() { WaterCheck(mPos, 1.0f); }

void setAfterSleepState() override { changeState(StateID_Walk); }

void slideEffect() override {
if (!mNokoType) {
mEffect.createEffect("Wm_en_shellgreentail", 0, &mSlideEffectPos, nullptr, nullptr);
} else {
mEffect.createEffect("Wm_en_shellredtail", 0, &mSlideEffectPos, nullptr, nullptr);
}
}

virtual void doTurn(int *dir, s16 *turnSpeed);
virtual bool isWalking() { return true; }
virtual void turnAround();
virtual void calcMdl();
virtual bool canDance();
virtual void danceWithMove(int move);
virtual void walkTurn();

/// @brief Initializes the state of the Koopa after creation.
virtual void setInitialState();

/// @brief Subclasses can override this function to create additional models.
virtual void createModelExtra() {}
virtual void vf328() {}

/// @brief Subclasses can override this function to delete additional resources.
virtual void deleteResExtra() {}

virtual mVec3_c getPos() { return mVec3_c(mPos.x, mPos.y, mPos.z); }

BOOL isFunsui() const override { return mIsFunsui; }

void createModel();
void updateAmiLine();
void setZPos();
bool checkRyusa(); ///< Checks if the actor is inside quicksand.
void ryusaEffect(); ///< Creates the quicksand effect.
bool playerDamageTurn(dActor_c *); ///< Returns whether the Koopa should turn around after damaging the player.
void setNokoBc(); ///< Reverts the collision to a regular Koopa.
float getWindStrength();
void setMoveAnimation(const char *name, m3d::playMode_e mode, float frame);
void setBaseAnimation(const char *name, m3d::playMode_e mode, float frame);
bool checkLedge(); ///< Checks if there is a ledge in front of the Koopa.
void landEffect();

u8 mPad0[4];

dHeapAllocator_c mNokoAllocator; ///< The allocator used for the resources of this actor.
nw4r::g3d::ResFile mNokoResFile; ///< The resource file containing the resources of this actor.
m3d::mdl_c mNokoModel; ///< The model of the Koopa.
m3d::anmChr_c mWalkAnim; ///< The walk animation of the Koopa.
nw4r::g3d::ResAnmTexPat mNokoResAnmTex; ///< The animated texture resource of the Koopa.
m3d::anmTexPat_c mNokoAnimTex; ///< The animated texture of the Koopa.

BOOL mIsFunsui; ///< Whether the Koopa is being blown upwards by a fountain.
s16 mHeadAngle;
u8 mNokoType; ///< Is a NOKO_TYPE_e.
mVec3_c mCreatePos; ///< The position where the Koopa was spawned.
float mXSpeedBeforeFunsui; ///< The horizontal speed of the Koopa before being blown by a fountain.
u8 mPad1[8];
float mBaseZPos;
u32 m_8c8;
int mDanceTimer; ///< Timer for starting and ending the dance.
mAng mBgmDanceRotSpeed; ///< The rotation speed for turning toward the target rotation for a dance.
u32 mDanceMove; ///< The dance move to perform.
mEf::levelOneEffect_c mQuicksandEffect;
nodeCallback_c mMdlCallback;

ACTOR_PARAM_CONFIG(NokoType, 0, 1); ///< See NOKO_TYPE_e.
ACTOR_PARAM_CONFIG(SpawnMode, 4, 1); ///< See SPAWN_MODE_e.
ACTOR_PARAM_CONFIG(SubLayer, 16, 1); ///< The sublayer to spawn on.
ACTOR_PARAM_CONFIG(BlockHitPlayer, 24, 2); ///< The player number that hit the block from which this Koopa spawned.
ACTOR_PARAM_CONFIG(BlockAppear, 28, 1); ///< Whether the Koopa should spawn from a block.
ACTOR_PARAM_CONFIG(SpitOut, 29, 1); ///< Whether this Koopa was spat out by Yoshi.
};
13 changes: 10 additions & 3 deletions include/game/bases/d_a_en_shell.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@
*/
class daEnShell_c : public daEnCarry_c {
public:
/// Other actors can extend this enum to add new modes.
/// @unofficial
enum ShellMode_e {
SHELL_MODE_BASE,
SHELL_MODE_NOKO_WALK
};

struct GlobalData_t {
s16 mSpinSpeed;
s16 mUnkSpeed;
Expand Down Expand Up @@ -98,15 +105,15 @@ class daEnShell_c : public daEnCarry_c {
m3d::anmChr_c mAnim;
nw4r::g3d::ResAnmTexPat mResAnmTexPat;
m3d::anmTexPat_c mAnimTex;
u8 mPad1[0x24];
sCcDatNewF mCcData;
sBcSensorPoint mSensorHead;
sBcSensorLine mSensorFootNormal;
sBcSensorLine mSensorWall;
sBcSensorLine mSensorFootSlide;
mEf::levelEffect_c mEffect;
int mYoshiKickable; ///< Whether the shell can be kicked in any state by Yoshi.
int mUseBaseIceBehaviour;
u8 mPad2[0xc];
ShellMode_e mShellMode;
mVec3_c mSlideEffectPos;
mVec3_c mCarryPos;
int mIsCarryFall;
int mSlideAirAfterThrow;
Expand Down
9 changes: 9 additions & 0 deletions include/game/bases/d_a_tag_wind.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#pragma once

#include <game/bases/d_actor.hpp>

class daTagWind_c : public dActor_c {
public:
float mStrength;
u8 mPad[32];
};
4 changes: 4 additions & 0 deletions include/game/bases/d_actor_manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

class dActorMng_c {
public:
u8 mPad1[0x28];
int mGoombaZOrderThing;
u8 mPad2[0x218];

void createUpCoin(const mVec3_c &pos, u8 dir, u8 count, u8 layer);

static dActorMng_c *m_instance;
Expand Down
24 changes: 12 additions & 12 deletions include/game/bases/d_bc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,29 @@ enum SensorFlags {
SENSOR_IS_LINE = 1
};

struct sBcSensorBase {
u32 mFlags;
};
class sBcSensorIf_c {};

/// @unofficial
struct sBcSensorPoint {
operator const sBcSensorBase *() const { return &mBase; }
operator const sBcSensorIf_c *() const { return (const sBcSensorIf_c *) this; }

sBcSensorBase mBase;
u32 mFlags;
int mX, mY;
};

/// @unofficial
struct sBcSensorLine {
operator const sBcSensorBase *() const { return &mBase; }
operator const sBcSensorIf_c *() const { return (const sBcSensorIf_c *) this; }

sBcSensorBase mBase;
u32 mFlags;
int mLineA, mLineB;
int mDistanceFromCenter;
};

/// @unofficial
class sBcPointData {
public:
operator const sBcSensorBase *() const { return (sBcSensorBase *) &mFlags; }
operator const sBcSensorIf_c *() const { return (sBcSensorIf_c *) &mFlags; }

u32 mFlags;
long mInfMargin;
Expand Down Expand Up @@ -127,7 +125,7 @@ class dBc_c {
virtual ~dBc_c();

void init();
void set(dActor_c *, const sBcSensorBase *, const sBcSensorBase *, const sBcSensorBase *); ///< @unofficial
void set(dActor_c *, const sBcSensorIf_c *, const sBcSensorIf_c *, const sBcSensorIf_c *); ///< @unofficial

void checkLink();
bool checkRide();
Expand Down Expand Up @@ -168,14 +166,16 @@ class dBc_c {

u32 isWallR() { return mFlags & FLAG_WALL_R; }
u32 isWallL() { return mFlags & FLAG_WALL_L; }
u32 isWall() { return mFlags & (FLAG_WALL_R | FLAG_WALL_L); }
u32 isWall(u8 dir) { return mFlags & (FLAG_WALL_R << dir); }
u32 isFoot(); // { return mFlags & FLAG_FOOT; }
u32 isHead() { return mFlags & FLAG_HEAD; }
u32 isCollision() { return mFlags & (FLAG_WALL_L | FLAG_WALL_R | FLAG_FOOT | FLAG_HEAD); }

dActor_c *mpOwner;
sBcSensorBase *mpSensorFoot;
sBcSensorBase *mpSensorHead;
sBcSensorBase *mpSensorWall;
sBcSensorIf_c *mpSensorFoot;
sBcSensorIf_c *mpSensorHead;
sBcSensorIf_c *mpSensorWall;
mVec3_c *mpOwnerPos;
mVec3_c *mpOwnerLastPos;
mVec3_c *mpOwnerSpeed;
Expand Down
15 changes: 15 additions & 0 deletions include/game/bases/d_cc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ struct sCcDatNew {
///< @brief The size of the collider.
///< Note: This is the distance from the center to the edge, so half the actual size.
mVec2_POD_c mSize;

void set(const sCcDatNew &other) {
mOffset = other.mOffset;
mSize = other.mSize;
}
};

/**
Expand All @@ -107,6 +112,16 @@ struct sCcDatNewF {
u16 mStatus; ///< Status flags for this collider. See CC_STATUS_FLAG_e.

void (*mCallback)(dCc_c *self, dCc_c *target); ///< The callback to execute when a collision occurs.

void set(const sCcDatNewF &other) {
mBase.set(other.mBase);
mKind = other.mKind;
mAttack = other.mAttack;
mVsKind = other.mVsKind;
mVsDamage = other.mVsDamage;
mStatus = other.mStatus;
mCallback = other.mCallback;
}
};

/**
Expand Down
2 changes: 1 addition & 1 deletion include/game/bases/d_enemy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ class dEn_c : public dActorMultiState_c {

virtual void beginFunsui();
virtual void endFunsui();
virtual bool isFunsui() const;
virtual BOOL isFunsui() const;

virtual bool checkComboClap(int max);

Expand Down
10 changes: 5 additions & 5 deletions include/game/mLib/m_3d/mdl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@

namespace m3d {
class mdl_c : public smdl_c {

public:
class callback_c {
public:
virtual ~callback_c();
virtual void timingA(ulong nodeId, nw4r::g3d::ChrAnmResult *anmRes, nw4r::g3d::ResMdl resMdl);
virtual void timingB(ulong nodeId, nw4r::g3d::WorldMtxManip *manip, nw4r::g3d::ResMdl resMdl);
virtual void timingC(nw4r::math::MTX34 *mtx, nw4r::g3d::ResMdl resMdl);
virtual ~callback_c() {}
virtual void timingA(ulong nodeId, nw4r::g3d::ChrAnmResult *anmRes, nw4r::g3d::ResMdl resMdl) {}
virtual void timingB(ulong nodeId, nw4r::g3d::WorldMtxManip *manip, nw4r::g3d::ResMdl resMdl) {}
virtual void timingC(nw4r::math::MTX34 *mtx, nw4r::g3d::ResMdl resMdl) {}
};

class mdlCallback_c {
Expand Down
10 changes: 5 additions & 5 deletions include/game/mLib/m_angle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
#include <types.h>
#include <game/sLib/s_lib.hpp>
#include <nw4r/math.h>
#include <lib/MSL/arith.h>

extern "C" {
int abs(int);
}
#define DEG_TO_ANGLE(x) (0x10000 * x / 360)
#define ANGLE_360_DIV(x) (0x10000 / x)

/// @brief A one-dimensional short angle vector.
/// @ingroup mlib
Expand All @@ -29,8 +29,8 @@ struct mAng {
return sLib::chase(&mAngle, target, step);
}

mAng abs() const {
return mAng(::abs(mAngle));
int abs() const {
return ::abs(mAngle);
}

/// @brief Augmented addition operator.
Expand Down
15 changes: 15 additions & 0 deletions include/game/mLib/m_effect.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#pragma once
#include <lib/nw4r/ef.h>
#include <lib/egg/util/eggEffect.hpp>
#include <game/mLib/m_vec.hpp>
#include <game/mLib/m_mtx.hpp>
Expand Down Expand Up @@ -45,6 +46,20 @@ class levelEffect_c : public effect_c {
u32 m_120, m_124;
};

class levelOneEffect_c : public levelEffect_c {
public:
levelOneEffect_c() { reset(); }
~levelOneEffect_c() {}

virtual void reset();
virtual void createEffect(const char *, int);
virtual void createEffect(const char *, ulong, const mVec3_c *, const mAng3_c *, const mVec3_c *);
virtual void createEffect(const char *, ulong, const mMtx_c *);

float mEmissionRateMaybe;
nw4r::ef::EmitterInheritSetting mSetting;
};

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

}; // namespace mEf
Loading
Loading