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
18 changes: 14 additions & 4 deletions build_modded.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@ def exec_cmd(*nargs, **kwargs):
if out.returncode != 0:
sys.exit(out.returncode)


def build_link_cmd(ldflags, file_names, ldscript, out_path):
if sys.platform == 'win32':
# Avoid Windows command length limits by passing object files via response file.
rsp_path = BUILDDIR / 'mod' / out_path.with_suffix('.rsp').name
rsp_path.write_text('\n'.join(f'"{Path(p)}"' for p in file_names), encoding='utf-8')
cmd = [LD, *ldflags.split(' '), f'@{rsp_path}']
else:
cmd = ['wine', LD, *ldflags.split(' '), *file_names]
cmd += ['-lcf', ldscript, '-o', out_path]
return cmd

Path(f'{BUILDDIR}/mod').mkdir(parents=True, exist_ok=True)

config_json = json.loads(open(BUILDDIR / 'dtkspl/config.json').read())
Expand All @@ -44,8 +56,7 @@ def build_main(module_name, ldscript, units):
o_file = Path(f'{BUILDDIR}/compiled/{module_name}/{unit['name']}').with_suffix('.o')
file_names.append(o_file)

cmd = [] if sys.platform == 'win32' else ['wine']
cmd.extend([LD, *ldflags.split(' '), *file_names, '-lcf', ldscript, '-o', BUILDDIR / (out_file + '.elf')])
cmd = build_link_cmd(ldflags, file_names, ldscript, BUILDDIR / (out_file + '.elf'))
exec_cmd(cmd)
print_success(f'Linked {module_name}.elf.')

Expand All @@ -63,8 +74,7 @@ def build_module_plf(module_name, ldscript, units):
o_file = Path(f'{BUILDDIR}/compiled/{module_name}/{unit['name']}').with_suffix('.o')
file_names.append(o_file)

cmd = [] if sys.platform == 'win32' else ['wine']
cmd.extend([LD, *ldflags.split(' '), *file_names, '-lcf', ldscript, '-o', out_plf])
cmd = build_link_cmd(ldflags, file_names, ldscript, out_plf)
exec_cmd(cmd)
print_success(f'Linked {module_name}.plf.')

Expand Down
6 changes: 4 additions & 2 deletions include/game/bases/d_a_en_shell.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ class daEnShell_c : public daEnCarry_c {
/// Other actors can extend this enum to add new modes.
/// @unofficial
enum ShellMode_e {
SHELL_MODE_BASE,
SHELL_MODE_NOKO_WALK
SHELL_MODE_BASE = 0,
SHELL_MODE_NOKO_WALK = 1,
SHELL_MODE_TOGEZO = 1,
SHELL_MODE_PAIPO
};

struct GlobalData_t {
Expand Down
94 changes: 94 additions & 0 deletions include/game/bases/d_a_en_togezo_base.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
#include <game/bases/d_a_en_shell.hpp>
#include <game/bases/d_effect.hpp>

/// @brief Base class for spinys.
/// @statetable
/// @paramtable
class daEnTogezoBase_c : public daEnShell_c {
public:
daEnTogezoBase_c() {}
virtual ~daEnTogezoBase_c() {}

virtual int create();
virtual int execute();
virtual int draw();
virtual int doDelete();
virtual void deleteReady();
virtual void block_hit_init();
virtual bool setEatSpitOut(dActor_c *eatingActor);
virtual bool hitCallback_Slip(dCc_c *self, dCc_c *other) { return false; }
virtual bool createIceActor();

virtual void finalUpdate() { calcMdl(); }

STATE_FUNC_DECLARE(daEnTogezoBase_c, Walk); ///< Walking on the ground.
STATE_FUNC_DECLARE(daEnTogezoBase_c, Pipo); ///< Rolled up in a ball.
STATE_FUNC_DECLARE(daEnTogezoBase_c, Change_Pipo); ///< Transforming into a ball.
STATE_FUNC_DECLARE(daEnTogezoBase_c, Change_Togezo); ///< Transforming into a regular spiny.
STATE_FUNC_DECLARE(daEnTogezoBase_c, Turn); ///< Turning around while walking.
STATE_VIRTUAL_FUNC_DECLARE(daEnTogezoBase_c, DieFall);
STATE_VIRTUAL_FUNC_DECLARE(daEnTogezoBase_c, Wakeup);
STATE_VIRTUAL_FUNC_DECLARE(daEnTogezoBase_c, WakeupReverse);
STATE_VIRTUAL_FUNC_DECLARE(daEnTogezoBase_c, WakeupTurn);

virtual bool setPlayerDamage(dActor_c *actor);
virtual bool specialFumiProc(dActor_c *actor);
virtual bool specialFumiProc_Yoshi(dActor_c *actor);
virtual bool isFumiInvalid() const { return !mIsFlipped; }
virtual void setAfterSleepState();
virtual bool turnProc();
virtual bool isDieShell();

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

virtual void initialize() {}
virtual bool isCullCheckOk() { return true; }
virtual void calcCatchPos() {}

void createModel();
void calcMdl();
void calcPaipoMdl();
void calcTogezoMdl();
void drawTogezo();
void drawPaipo();
bool checkRyusa();
void ryusaEffect();
void pipoRolling();
void pipoWallBound();
bool isBlockHitDeath() const;
void landonEffect(float height);

u8 mPad1[0x4];
dHeapAllocator_c mAllocator; ///< The allocator used for the resources of this actor.
nw4r::g3d::ResFile mTogezoResFile; ///< The resource file for the spiny.
m3d::mdl_c mTogezoModel; ///< The spiny model.
m3d::anmChr_c mTogezoAnim; ///< The spiny's animation.
nw4r::g3d::ResFile mPaipoResFile; ///< The resource file for the rolled up spiny.
m3d::smdl_c mPaipoMdl; ///< The model for the rolled up spiny.
u32 mChangeTimer; ///< Timer used for transforming between spiny and rolled up spiny.
u8 mPad2[0x2];
u8 mPipoDir; ///< The direction the rolled up spiny is moving. Used to determine if the spiny should turn around when it unrolls.
s16 mPipoRollSpeed; ///< The speed at which the spiny unrolls.
u8 mPad3[0x6];
s16 m_894;
u32 mPipoTouchedGround; ///< Whether the rolled up spiny has touched the ground since rolling up.
dEf::dLevelEffect_c mLevelEffect;

ACTOR_PARAM_CONFIG(DieOnBlockHit, 4, 1);

static const sBcSensorPoint smc_toge_head;
static const sBcSensorLine smc_toge_foot;
static const sBcSensorLine smc_toge_wall;
static const sBcSensorLine smc_sakasa_toge_foot;
static const sBcSensorPoint smc_pipo_head;
static const sBcSensorLine smc_pipo_foot;
static const sBcSensorLine smc_pipo_wall;
static const sCcDatNewF smc_toge_cc;
static const float smc_WALK_SPEED_DAT[2];
static const s16 smc_ROTATE_SPEED_DAT[2];
static const s16 smc_ANGLE_Y[2];
};
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
4 changes: 2 additions & 2 deletions include/game/bases/d_en_fumi_check.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class MugenComboFumiCheck_c : public FumiCheckBase_c {

class dEnFumiCheck_c {
public:
dEnFumiCheck_c(dEn_c *owner) : mUnused(0), mpFumiCheck(nullptr), mpOwner(owner) {}
dEnFumiCheck_c(dEn_c *owner) : m_00(0), mpFumiCheck(nullptr), mpOwner(owner) {}

virtual ~dEnFumiCheck_c() {
delete mpFumiCheck;
Expand All @@ -54,7 +54,7 @@ class dEnFumiCheck_c {
mpFumiCheck = newPtr;
}

int mUnused;
int m_00;
FumiCheckBase_c *mpFumiCheck;
dEn_c *mpOwner;
};
Expand Down
4 changes: 4 additions & 0 deletions include/game/mLib/m_3d/smdl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,9 @@ namespace m3d {
bool create(nw4r::g3d::ResMdl resMdl, mAllocator_c *allocator, ulong bufferOption, int viewCount) {
return create(resMdl, allocator, bufferOption, viewCount, nullptr);
}

bool create(nw4r::g3d::ResMdl resMdl, mAllocator_c *allocator, ulong bufferOption) {
return create(resMdl, allocator, bufferOption, 1);
}
};
}
13 changes: 13 additions & 0 deletions slices/wiimj2d.json
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,19 @@
".sdata2": "0x520-0x618"
}
},
{
"source": "dol/bases/d_a_en_togezo_base.cpp",
"memoryRanges": {
".text": "0x37450-0x3a1a0",
".ctors": "0x68-0x6c",
".data": "0x7fe8-0x8668",
".rodata": "0xac0-0xb60",
".bss": "0x2618-0x2880",
".sbss": "0xb0-0xb8",
".sdata": "0x250-0x268",
".sdata2": "0x630-0x6a8"
}
},
{
"source": "dol/bases/d_a_player_base.cpp",
"memoryRanges": {
Expand Down
Loading
Loading