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
9 changes: 9 additions & 0 deletions alias_db.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ R_3_1_100 = finalizeEpilog__Fv
R_4_1_F0 = finalizeProlog__Fv
R_4_1_100 = finalizeEpilog__Fv
R_2_1_70 = __register_global_object
R_2_1_1be0 = __dt__7mVec3_cFv
R_2_1_88b0 = __dt__Q26dWmLib19ForceInCourseList_tFv
R_2_1_49500 = finalUpdate__12dBaseActor_cFv
R_2_1_49510 = GetActorType__12dBaseActor_cFv
R_2_1_49520 = funsuiMoveX__8dActor_cFv
Expand All @@ -17,6 +19,13 @@ R_2_1_4ac20 = endFunsui__5dEn_cFv
R_2_1_4ac30 = beginFunsui__5dEn_cFv
R_2_1_4ac40 = calcBoyonScale__5dEn_cFv
R_2_1_4ac50 = isQuakeDamage__5dEn_cFv
R_2_1_15a8a0 = doDelete__14dWmDemoActor_cFv
R_2_1_15ab60 = setCutEnd__14dWmDemoActor_cFv
R_2_1_15ab70 = clearCutEnd__14dWmDemoActor_cFv
R_2_1_15ab80 = checkCutEnd__14dWmDemoActor_cFv
R_2_1_15ab90 = vf78__13dWmObjActor_cFv
R_2_1_15aba0 = vf74__13dWmObjActor_cFv
R_2_1_15abb0 = GetActorType__13dWmObjActor_cFv
R_2_5_4fa70 = g_profile_WORLD_MAP
R_2_5_4da38 = g_profile_WORLD_9_DEMO
R_2_5_4f238 = g_profile_STAGE
Expand Down
28 changes: 28 additions & 0 deletions include/game/bases/d_a_wm_cannon.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#pragma once
#include <game/bases/d_heap_allocator.hpp>
#include <game/mLib/m_3d/smdl.hpp>
#include <game/bases/d_wm_obj_actor.hpp>

/// @brief The actor for the Warp Cannons found on the World Map.
/// @ingroup bases
/// @paramtable
class daWmCannon_c : public dWmObjActor_c {
public:
daWmCannon_c(); ///< @copydoc dWmObjActor_c::dWmObjActor_c
~daWmCannon_c(); ///< @copydoc dWmObjActor_c::~dWmObjActor_c

virtual int create();
virtual int execute();
virtual int draw();
virtual int doDelete();

virtual void setCutEndSpecific(int cutsceneCommandId, bool param2);

void setClipSphere(); ///< Sets the @ref mClipSphere "clip sphere" for the actor.
void createModel(); ///< Initializes the resources for the actor.
void calcModel(); ///< Updates the model's transformation matrix.

dHeapAllocator_c mAllocator; ///< The allocator.
m3d::smdl_c mModel; ///< The model.
u32 mUnk200; ///< @unused
};
3 changes: 3 additions & 0 deletions include/game/bases/d_a_wm_map.hpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
#pragma once

#include <game/bases/d_wm_connect.hpp>
#include <game/bases/d_wm_csv_data.hpp>
#include <game/bases/d_wm_demo_actor.hpp>
#include <game/bases/d_heap_allocator.hpp>
#include <game/bases/d_wm_map_model.hpp>

class daWmMap_c : public dWmDemoActor_c {
public:
int GetNodeCount(int); ///< @unofficial
void GetNodePos(long nodeIdx, mVec3_c &pos);

dHeapAllocator_c mAllocator;
dWmMapModel_c mModels[4];
Expand Down
74 changes: 74 additions & 0 deletions include/game/bases/d_cs_seq_manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,80 @@

class dCsSeqMng_c {
public:
/// @unofficial
enum CUTSCENE_e {
SMC_DEMO_DEFAULT_CLR,
SMC_DEMO_DEFAULT_FAIL,
SMC_DEMO_ENEMY_CLR,
SMC_DEMO_ENEMY_FAIL,
SMC_DEMO_TORIDE_IN,
SMC_DEMO_TORIDE_CLR,
SMC_DEMO_TORIDE_FAIL,
SMC_DEMO_TORIDE_FAIL2,
SMC_DEMO_CASTLE_IN,
SMC_DEMO_CASTLE_CLR,
SMC_DEMO_CASTLE_FAIL,
SMC_DEMO_CASTLE_FAIL2,
SMC_DEMO_GHOST_IN,
SMC_DEMO_GHOST_CLR,
SMC_DEMO_GHOST_FAIL,
SMC_DEMO_GHOST_FAIL2,
SMC_DEMO_CANNON,
SMC_DEMO_TRSHIP_APPEAR,
SMC_DEMO_DOKAN,
SMC_DEMO_DOKAN_WARP,
SMC_DEMO_DOKAN_START,
SMC_DEMO_W_WALKING_IN,
SMC_DEMO_W_WALKING_IN_NORMAL,
SMC_DEMO_W_FLYING_IN,
SMC_DEMO_W_CANNON_IN,
SMC_DEMO_W_CANNON_IN_NORMAL,
SMC_DEMO_W1_TORIDE_CLR,
SMC_DEMO_W1_CASTLE_CLR,
SMC_DEMO_W3_CASTLE_CLR,
SMC_DEMO_FADE_TEST,
SMC_DEMO_VIEW_WORLD,
SMC_DEMO_COURSE_IN,
SMC_DEMO_KINOKO_OUT,
SMC_DEMO_AIRSHIP_COURSE_IN,
SMC_DEMO_AIRSHIP_COURSE_OUT,
SMC_DEMO_START_KINOKO_IN,
SMC_DEMO_AIRSHIP_GONEXT,
SMC_DEMO_W36_CLEAR_NORMAL,
SMC_DEMO_NULL,
SMC_DEMO_ANTLION,
SMC_DEMO_KILLER,
SMC_DEMO_START_BATTLE,
SMC_DEMO_SWITCH,
SMC_DEMO_KOOPACASTLEAPPEAR,
SMC_DEMO_KINOPIOSTART,
SMC_DEMO_WORLDIN_NOSHIP,
SMC_DEMO_WORLDIN_JUMP_NOSHIP,
SMC_DEMO_PAUSE_MENU,
SMC_DEMO_AIRSHIP_CLEAR,
SMC_DEMO_STOCK_MENU,
SMC_DEMO_WORLDSELECT_MENU,
SMC_DEMO_ANTLION_STAR,
SMC_DEMO_GAMESTART,
SMC_DEMO_END,
SMC_DEMO_COUNT
};

/// @unofficial
enum CUTSCENE_CMD_e {
CUTSCENE_CMD_NONE = -1,
CUTSCENE_CMD_4 = 4,
CUTSCENE_CMD_27 = 27,
CUTSCENE_CMD_28 = 28,
CUTSCENE_CMD_29 = 29,
CUTSCENE_CMD_56 = 56,
CUTSCENE_CMD_86 = 86,
CUTSCENE_CMD_87 = 87,
CUTSCENE_CMD_89 = 89,
CUTSCENE_CMD_91 = 91,
CUTSCENE_CMD_136 = 136,
};

int GetCutName();
void FUN_801017c0(int, dWmEnemy_c *, int, int); ///< @unofficial

Expand Down
2 changes: 1 addition & 1 deletion include/game/bases/d_wm_actor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ class dWmActor_c : public dBaseActor_c {
static void setSoftLight_Enemy(m3d::bmdl_c &mdl); ///< @copydoc dGameCom::SetSoftLight_Enemy
static void setSoftLight_Boss(m3d::bmdl_c &mdl); ///< @copydoc dGameCom::SetSoftLight_Boss

private:
protected:
mSphere_c mClipSphere; ///< A sphere representing the actor's visible area.
};
22 changes: 11 additions & 11 deletions include/game/bases/d_wm_csv_data.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ class dCsvData_c {
u8 mPad[0x16518];

public:
static int c_COURSE_ID;
static int c_GHOST_ID;
static int c_TOWER_ID;
static int c_CASTLE_ID;
static int c_KINOKO_ID;
static int c_ENEMY_ID;
static int c_CANON_ID;
static int c_TRSHIP_ID;
static int c_AIRSHIP_ID;
static int c_START_ID;
static int c_PEACH_ID;
static const int c_COURSE_ID;
static const int c_GHOST_ID;
static const int c_TOWER_ID;
static const int c_CASTLE_ID;
static const int c_KINOKO_ID;
static const int c_ENEMY_ID;
static const int c_CANON_ID;
static const int c_TRSHIP_ID;
static const int c_AIRSHIP_ID;
static const int c_START_ID;
static const int c_PEACH_ID;
};
6 changes: 3 additions & 3 deletions include/game/bases/d_wm_demo_actor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class dWmDemoActor_c : public dWmActor_c {
virtual int execute() = 0;
virtual int GetActorType() { return ACTOR_MAP_DEMO; }

virtual void setCutEndSpecific(int cutsceneId, bool param2); ///< @unofficial
virtual void setCutEndSpecific(int cutsceneCommandId, bool param2); ///< @unofficial
virtual bool checkCutEnd() { return mIsCutEnd; }
virtual void setCutEnd() { mIsCutEnd = true; }
virtual void clearCutEnd() { mIsCutEnd = false; }
Expand Down Expand Up @@ -47,9 +47,9 @@ class dWmDemoActor_c : public dWmActor_c {
void CsSPosSimple(int directionType, float yTarget);
void clearSpeedAll();
void adjustHeightBase(const mVec3_c &startPos, const mVec3_c &targetPos, int directionType);
bool isCutscenePlaying(const int *csList, int csCount); ///< @unofficial
bool isCutsceneCommandPlaying(const int *cmdList, int cmdCount); ///< @unofficial

static dBaseActor_c *GetChildDemoActor(dBaseActor_c *prev, dWmDemoActor_c *&next); ///< @unofficial
static dWmDemoActor_c *GetChildDemoActor(dBaseActor_c *prev, dWmDemoActor_c *&next); ///< @unofficial

protected:
bool m_00;
Expand Down
18 changes: 8 additions & 10 deletions include/game/bases/d_wm_lib.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,13 @@ namespace dWmLib {
};

struct ForceInCourseList_t {
~ForceInCourseList_t() {}

int nodeWorld;
const char *nodeName;
int world;
int level;
int entrance;
const char *levelNode;
mVec3_c nodePos;
int mNodeWorld;
const char *mNodeName;
int mWorld;
int mLevel;
int mEntrance;
const char *mLevelNode;
mVec3_c mNodePos;
};

int GetCourseTypeFromCourseNo(int courseNo);
Expand Down Expand Up @@ -78,7 +76,7 @@ namespace dWmLib {
int getEnemyRevivalCount(int, int);

static ForceInCourseList_t sc_ForceList[] = {
{WORLD_7, "F7C0", WORLD_7, dCsvData_c::c_CASTLE_ID, 4, "W7C0", mVec3_c(2160, -30, -478)}
{WORLD_7, "F7C0", WORLD_7, dCsvData_c::c_CASTLE_ID, 4, "W7C0", mVec3_c(2160.0f, -30.0f, -478.0f)}
};

static int c_StartPointKinokoHouseID = dCsvData_c::c_START_ID;
Expand Down
3 changes: 1 addition & 2 deletions include/game/bases/d_wm_obj_actor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ class dWmObjActor_c : public dWmDemoActor_c {
bool IsCourseUraClearSimple(); ///< @copybrief dWmLib::IsCourseUraClearSimple
bool IsCourseUraOtasukeClearSimple(); ///< @copybrief dWmLib::IsCourseUraOtasukeClearSimple

u8 mUnk174[0x10]; ///< @unused
int mResNodeIdx; ///< The index of the model's root resource node. Always set to @p -1.
int mResNodeIdx; ///< The index of the model's root resource node.

ACTOR_PARAM_CONFIG(CourseNo, 0, 8); ///< The level number associated to the object.
ACTOR_PARAM_CONFIG(PathNode, 8, 8); ///< The path node associated to the object.
Expand Down
2 changes: 1 addition & 1 deletion include/game/framework/f_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class fBase_c {
fBase_c(); ///< Constructs a new base.

/// @brief @p new operator override for all bases.
/// @details Bases are allocated in mHeap::g_gameHeaps[0] in a top-down direction, and are
/// @details Bases are allocated in mHeap::g_gameHeaps[mHeap::GAME_HEAP_DEFAULT] in a top-down direction, and are
/// zero-initialized.
static void *operator new(size_t);
static void operator delete(void *); ///< @p delete operator override for all bases.
Expand Down
10 changes: 10 additions & 0 deletions slices/d_basesNP.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,16 @@
".bss": "0xdd88-0xde48"
}
},
{
"source": "d_basesNP/bases/d_a_wm_cannon.cpp",
"memoryRanges": {
".text": "0x15e7e0-0x15ecc0",
".ctors": "0x3c4-0x3c8",
".rodata": "0x86d0-0x86e8",
".data": "0x43ef8-0x43fd0",
".bss": "0xfd38-0xfd48"
}
},
{
"source": "d_basesNP/bases/d_s_autoselect.cpp",
"memoryRanges": {
Expand Down
2 changes: 1 addition & 1 deletion source/d_basesNP/bases/d_a_obj_fruit_tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ int daObjFruitTree_c::create() {
nw4r::g3d::ResMdl model;
nw4r::g3d::ResAnmChr anim;
nw4r::g3d::ResFile res;
mHeapAllocator.createFrmHeap(-1, mHeap::g_gameHeaps[0], nullptr, 0x20);
mHeapAllocator.createFrmHeap(-1, mHeap::g_gameHeaps[mHeap::GAME_HEAP_DEFAULT], nullptr, 0x20);

int style = ACTOR_PARAM_LOCAL(param, Style);
if (style == STYLE_REGULAR) {
Expand Down
2 changes: 1 addition & 1 deletion source/d_basesNP/bases/d_a_remo_door.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ STATE_DEFINE(daRemoDoor_c, Open);
STATE_DEFINE(daRemoDoor_c, Close);

void daRemoDoor_c::init() {
mAllocator.createFrmHeap(-1, mHeap::g_gameHeaps[0], nullptr, 0x20);
mAllocator.createFrmHeap(-1, mHeap::g_gameHeaps[mHeap::GAME_HEAP_DEFAULT], nullptr, 0x20);
mRes = dResMng_c::m_instance->getRes("obj_door", "g3d/obj_door.brres");
nw4r::g3d::ResMdl mdl = mRes.GetResMdl("obj_doorA");
mDoorModel.create(mdl, &mAllocator, nw4r::g3d::ScnMdl::BUFFER_RESMATMISC, 1, nullptr);
Expand Down
87 changes: 87 additions & 0 deletions source/d_basesNP/bases/d_a_wm_cannon.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#include <game/bases/d_res_mng.hpp>
#include <game/bases/d_a_wm_map.hpp>
#include <game/bases/d_cs_seq_manager.hpp>
#include <game/bases/d_a_wm_cannon.hpp>
#include <game/bases/d_wm_lib.hpp>

ACTOR_PROFILE(WM_CANNON, daWmCannon_c, 0);

daWmCannon_c::daWmCannon_c() {}
daWmCannon_c::~daWmCannon_c() {}

int daWmCannon_c::create() {
float a = 0.0f; // [Needed for .rodata ordering]

setClipSphere();
createModel();
calcModel();

return SUCCEEDED;
}

int daWmCannon_c::execute() {
setCutEndSpecific(dCsSeqMng_c::ms_instance->GetCutName(), dCsSeqMng_c::ms_instance->m_164);

mModel.play();
daWmMap_c::m_instance->GetNodePos(mResNodeIdx, mPos);
calcModel();

return SUCCEEDED;
}

int daWmCannon_c::draw() {
mModel.entry();
return SUCCEEDED;
}

int daWmCannon_c::doDelete() {
return SUCCEEDED;
}

void daWmCannon_c::setClipSphere() {
mClipSphere.mCenter = mPos;
mClipSphere.mRadius = 120.0f;
}

void daWmCannon_c::createModel() {
mAllocator.createFrmHeap(-1, mHeap::g_gameHeaps[mHeap::GAME_HEAP_DEFAULT], nullptr, 0x20);

nw4r::g3d::ResFile resFile = dResMng_c::m_instance->getRes("cobCannon", "g3d/model.brres");
nw4r::g3d::ResMdl resMdl = resFile.GetResMdl("cobCannon");

mModel.create(resMdl, &mAllocator, nw4r::g3d::ScnMdl::BUFFER_RESMATMISC, 1, nullptr);
dWmActor_c::setSoftLight_MapObj(mModel);

mAllocator.adjustFrmHeap();
}

void daWmCannon_c::calcModel() {
mVec3_c pos = mPos;
mAng3_c angle = mAngle;
mMatrix.trans(pos);
mMatrix.ZXYrotM(angle);
mModel.setLocalMtx(&mMatrix);
mModel.setScale(mScale);
mModel.calc(false);
}

void daWmCannon_c::setCutEndSpecific(int cutsceneCommandId, bool param2) {
if (cutsceneCommandId == dCsSeqMng_c::CUTSCENE_CMD_NONE) {
return;
}

switch (cutsceneCommandId) {
case dCsSeqMng_c::CUTSCENE_CMD_27:
mIsCutEnd = true;
break;
case dCsSeqMng_c::CUTSCENE_CMD_28:
mIsCutEnd = true;
break;
case dCsSeqMng_c::CUTSCENE_CMD_29:
mIsCutEnd = true;
break;
default:
mIsCutEnd = true;
break;
}
}
2 changes: 1 addition & 1 deletion source/d_basesNP/bases/d_awa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ int dAwa_c::create() {
}

void dAwa_c::createModel() {
mAllocator.createFrmHeap(0x80000, mHeap::g_gameHeaps[0], nullptr, 0x20);
mAllocator.createFrmHeap(0x80000, mHeap::g_gameHeaps[mHeap::GAME_HEAP_DEFAULT], nullptr, 0x20);
mResFile = dResMng_c::m_instance->getRes("waterbubble", "g3d/waterbubble.brres");

nw4r::g3d::ResMdl model = mResFile.GetResMdl("waterbubble");
Expand Down
2 changes: 1 addition & 1 deletion source/dol/bases/d_res_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ dRes_c::info_c::LOAD_STATUS_e dRes_c::info_c::setRes(callback_c *callback) {
}

// Prepare the heap for the archive data
EGG::Heap *heap = (mpMountHeap != nullptr) ? mpMountHeap : mHeap::g_gameHeaps[0];
EGG::Heap *heap = (mpMountHeap != nullptr) ? mpMountHeap : mHeap::g_gameHeaps[mHeap::GAME_HEAP_DEFAULT];
mDataHeap = mHeap::createFrmHeapToCurrent(-1, heap, "dRes_c::info_c::mDataHeap", 0x20, mHeap::OPT_NONE);
if (mDataHeap == nullptr) {
return LOAD_ERROR;
Expand Down
Loading
Loading