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
57 changes: 57 additions & 0 deletions include/game/bases/d_a_boss_demo.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#pragma once

#include <game/bases/d_actor_state.hpp>
#include <game/bases/d_enemy_boss.hpp>
#include <game/sLib/s_GlobalData.hpp>

/// @brief Base class for boss battle cutscene managers.
/// @statetable
/// @ingroup bases
class daBossDemo_c : public dActorState_c {
public:
struct GlobalData_t {
bool mForceOtehonClear;
};

daBossDemo_c() : dActorState_c() {} ///< @copydoc dActorState_c::dActorState_c
~daBossDemo_c() {} ///< @copydoc dActorState_c::~dActorState_c

virtual int create() override;
virtual int doDelete() override;
virtual int execute() override;
virtual int draw() override;
virtual void deleteReady() override;

STATE_VIRTUAL_FUNC_DECLARE(daBossDemo_c, Ready); ///< Ready for the boss battle cutscene to start.
STATE_VIRTUAL_FUNC_DECLARE(daBossDemo_c, BattleStDemo); ///< In the boss battle starting cutscene.
STATE_VIRTUAL_FUNC_DECLARE(daBossDemo_c, BattleIn); ///< In the boss battle.
STATE_VIRTUAL_FUNC_DECLARE(daBossDemo_c, BattleEdDemo); ///< In the boss battle ending cutscene.

/// @brief Returns to the world map and clears the course after finishing it with Super Guide.
virtual bool abandonRetryAfterOtehonClear();

/// @brief Returns to the world map without clearing the course after finishing it with Super Guide.
virtual void retryAfterOtehonClear();

virtual void startBGM() {} ///< Starts the boss battle background music.
virtual void stopBGM() {} ///< Stops the boss battle background music.

virtual fBaseID_e getBossID() { return mBossID; }
virtual void setBossID(fBaseID_e bossID) { mBossID = bossID; }

virtual BOOL checkBattleStDemo() { return false; } ///< Returns whether the boss battle start cutscene is ready to play.
virtual BOOL checkBattleEdDemo() { return mBattleEnd; } ///< Returns whether the boss battle end cutscene is ready to play.
virtual bool demoScroll() { return true; } ///< Returns whether the camera has finished scrolling to the boss.
virtual dEnBoss_c *bossSearch() { return nullptr; } ///< Returns the corresponding boss actor.
virtual void initialize() {} ///< Subclass-specific initialization code.

void setBattleResult(); ///< Saves the star coins collected and the remaining lives of each player.
void setMultiCourseClear(); ///< Marks the course as cleared.
bool checkStartRetry(bool b); ///< Returns whether to show the "Want to try without Super Guide?" prompt.

bool isOtehonClear(); ///< Returns whether this course was only cleared by the Super Guide. @unofficial

u32 m_3d0;
BOOL mBattleEnd; ///< Whether the boss battle has ended.
fBaseID_e mBossID; ///< The ID of the boss actor.
};
4 changes: 4 additions & 0 deletions include/game/bases/d_a_en_noko.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,8 @@ class daEnNoko_c : public daEnShell_c {
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.

static const float smc_WALK_SPEED[];
static const s16 smc_TURN_SPEED[];
static const s16 smc_TURN_TARGET_ANGLE[];
};
1 change: 1 addition & 0 deletions include/game/bases/d_a_player_demo_manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class daPyDemoMng_c {
int getPoleBelowPlayer(int playerNo);
int getControlDemoPlayerNum() const;
int getNextDemoNo();
void releaseDemoMode(int);

void setBossDownPlayerNo(int plNo);
void setBossDown(daPlBase_c *player) {
Expand Down
3 changes: 2 additions & 1 deletion include/game/bases/d_a_player_manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class daPyMng_c {
static bool decNum(int);
static bool addRest(int);
static bool decRest(int);
static u32 getEntryNum();
static int getEntryNum();
static bool isEntryNum1() { return getEntryNum() == 1; }
static void startYoshiBGM();
static void stopYoshiBGM();
Expand All @@ -44,6 +44,7 @@ class daPyMng_c {
return res;
}

static int getNum() { return mNum; }
static bool checkPlayer(u8 plrNo) { return mActPlayerInfo & (1 << plrNo); }
static int getRest(PLAYER_TYPE_e plrNo) { return mRest[plrNo]; }
static PLAYER_TYPE_e getPlayerType(int plrNo) { return mPlayerType[plrNo]; }
Expand Down
8 changes: 6 additions & 2 deletions include/game/bases/d_actor_manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@

#include <game/mLib/m_vec.hpp>

class daBossDemo_c;

class dActorMng_c {
public:
u8 mPad1[0x28];
u8 mPad1[0x18];
daBossDemo_c *mpCurrBossDemo;
u8 mPad2[0xc];
int mGoombaZOrderThing;
u8 mPad2[0x218];
u8 mPad3[0x218];

void createUpCoin(const mVec3_c &pos, u8 dir, u8 count, u8 layer);
void allEnemyDeath(int);
Expand Down
1 change: 1 addition & 0 deletions include/game/bases/d_game_com.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ namespace dGameCom {
void LayoutDispNumber(const int &value, const int &fillLeft, LytTextBox_c *textBox, bool fillWidth);

bool isNowCourseClear();
void setMultiCourseClear(int);

void initGame();
void AreaLanguageFolder(const char *, char *);
Expand Down
12 changes: 12 additions & 0 deletions include/game/bases/d_otehon_clear.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#pragma once

#include <types.h>

class dOtehonClear_c {
public:
u8 mPad1[0xb5];
bool m_b5;
u8 mPad2[0x2];
bool m_b8;
bool m_b9;
};
4 changes: 3 additions & 1 deletion include/game/bases/d_s_stage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include <game/bases/d_scene.hpp>
#include <game/bases/d_info.hpp>
#include <game/bases/d_fader.hpp>
#include <game/bases/d_otehon_clear.hpp>
#include <game/mLib/m_vec.hpp>
#include <constants/game_constants.h>

Expand Down Expand Up @@ -29,7 +30,7 @@ class dScStage_c : public dScene_c {

static void setTitleReplayRandomTable();

static void setNextScene(u16, int, Exit_e, dFader_c::fader_type_e);
static void setNextScene(ProfileName, int, Exit_e, dFader_c::fader_type_e);

static void createReplayDataHeap(EGG::Heap *heap, ulong size, int options);

Expand All @@ -56,6 +57,7 @@ class dScStage_c : public dScene_c {
static const char mCdArcName[];

static bool m_isCourseOut; ///< Whether the game is transitioning from a stage scene to a non-stage scene.
static dOtehonClear_c *m_OtehonClear_p;
static bool m_KoopaJrEscape;
static dInfo_c::GameMode_e m_gameMode;
static Exit_e m_exitMode;
Expand Down
13 changes: 13 additions & 0 deletions slices/wiimj2d.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,19 @@
".sdata2": "0x180-0x188"
}
},
{
"source": "dol/bases/d_a_boss_demo.cpp",
"memoryRanges": {
".text": "0x16430-0x172d0",
".ctors": "0x20-0x24",
".data": "0x3140-0x3420",
".bss": "0xfd8-0x10e8",
".sdata": "0x180-0x190",
".sbss": "0x90-0x98",
".sdata2": "0x188-0x198",
".sbss2": "0x0-0x8"
}
},
{
"source": "dol/bases/d_a_bullet.cpp",
"memoryRanges": {
Expand Down
26 changes: 13 additions & 13 deletions source/d_enemiesNP/bases/d_a_en_noko.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ const sCcDatNewF l_noko_cc = {
dEn_c::normal_collcheck
};

const float l_walk_speed[2] = { 0.5f, -0.5f };
const s16 l_turn_speed[2] = { ANGLE_360_DIV(32), -ANGLE_360_DIV(32) };
const s16 l_turn_target_angle[2] = { DEG_TO_ANGLE(90), -DEG_TO_ANGLE(90) };
const float daEnNoko_c::smc_WALK_SPEED[2] = { 0.5f, -0.5f };
const s16 daEnNoko_c::smc_TURN_SPEED[2] = { ANGLE_360_DIV(32), -ANGLE_360_DIV(32) };
const s16 daEnNoko_c::smc_TURN_TARGET_ANGLE[2] = { DEG_TO_ANGLE(90), -DEG_TO_ANGLE(90) };

STATE_DEFINE(daEnNoko_c, BlockAppear);
STATE_DEFINE(daEnNoko_c, Walk);
Expand Down Expand Up @@ -52,7 +52,7 @@ int daEnNoko_c::create() {
u8 dir = getPl_LRflag(mPos);
mDirection = dir;
mAmiLayer = ACTOR_PARAM(SubLayer);
mAngle.y = l_turn_target_angle[dir];
mAngle.y = smc_TURN_TARGET_ANGLE[dir];
mCreatePos = mPos;
mFlags |= dEn_c::EN_FLAG_16;
mPos.z = l_Ami_Zpos[ACTOR_PARAM(SubLayer)];
Expand Down Expand Up @@ -269,7 +269,7 @@ bool daEnNoko_c::playerDamageTurn(dActor_c *actor) {
}

mDirection = dir;
mAngle.y = l_turn_target_angle[dir];
mAngle.y = smc_TURN_TARGET_ANGLE[dir];
mHeadAngle *= -1;
turnAround();

Expand Down Expand Up @@ -297,7 +297,7 @@ bool daEnNoko_c::turnProc() {
doTurn(&turnDir, &turnSpeed);
mAngle.y += turnSpeed;

mAng target = l_turn_target_angle[turnDir];
mAng target = smc_TURN_TARGET_ANGLE[turnDir];
if (mAngle.y.abs() >= target.abs()) {
mAngle.y = target;
return true;
Expand All @@ -308,7 +308,7 @@ bool daEnNoko_c::turnProc() {

void daEnNoko_c::doTurn(int *dir, s16 *turnSpeed) {
*dir = mDirection;
*turnSpeed = l_turn_speed[*dir];
*turnSpeed = smc_TURN_SPEED[*dir];
}

void daEnNoko_c::setZPos() {
Expand Down Expand Up @@ -473,9 +473,9 @@ void daEnNoko_c::initializeState_Walk() {
mShellMode = SHELL_MODE_NOKO_WALK;
mAccelY = -0.1875f;
mAccelF = 0.05f;
mSpeedMax.set(l_walk_speed[mDirection], -4.0f, 0.0f);
mSpeedMax.set(smc_WALK_SPEED[mDirection], -4.0f, 0.0f);
mSensorFootNormal = l_noko_foot;
mSpeed.x = l_walk_speed[mDirection];
mSpeed.x = smc_WALK_SPEED[mDirection];
m_8c8 = 0;
}

Expand All @@ -493,7 +493,7 @@ void daEnNoko_c::executeState_Walk() {
mSpeedMax.x = 0.0f;
}
} else {
mSpeedMax.x = l_walk_speed[mDirection];
mSpeedMax.x = smc_WALK_SPEED[mDirection];
}

calcSpeedX();
Expand Down Expand Up @@ -688,7 +688,7 @@ void daEnNoko_c::initializeState_BgmDanceEd() {
setMoveAnimation("walkA", m3d::FORWARD_ONCE, 4.0f);
mSpeed.x = 0.0f;
mDanceTimer = 4;
mBgmDanceRotSpeed = abs(l_turn_target_angle[mDirection]) / mDanceTimer;
mBgmDanceRotSpeed = abs(smc_TURN_TARGET_ANGLE[mDirection]) / mDanceTimer;
}

void daEnNoko_c::finalizeState_BgmDanceEd() {}
Expand All @@ -704,10 +704,10 @@ void daEnNoko_c::executeState_BgmDanceEd() {

if (mDanceTimer > 0) {
mDanceTimer--;
sLib::chaseAngle(&mAngle.y.mAngle, l_turn_target_angle[mDirection], mBgmDanceRotSpeed);
sLib::chaseAngle(&mAngle.y.mAngle, smc_TURN_TARGET_ANGLE[mDirection], mBgmDanceRotSpeed);

if (mDanceTimer <= 0) {
mAngle.y = l_turn_target_angle[mDirection];
mAngle.y = smc_TURN_TARGET_ANGLE[mDirection];
changeState(StateID_Walk);
}
}
Expand Down
Loading
Loading