-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ebd0c04
commit 95f5bbf
Showing
12 changed files
with
196 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#ifndef D_A_OBJ_SUN_LIGHT_H | ||
#define D_A_OBJ_SUN_LIGHT_H | ||
|
||
#include <d/a/obj/d_a_obj_base.h> | ||
#include <m/m3d/m_anmtexsrt.h> | ||
#include <m/m3d/m_smdl.h> | ||
#include <s/s_State.hpp> | ||
#include <s/s_StateMgr.hpp> | ||
|
||
class dAcOsunLight_c : public dAcObjBase_c { | ||
public: | ||
dAcOsunLight_c() : mStateMgr(*this, sStateID::null) {} | ||
virtual ~dAcOsunLight_c() {} | ||
virtual bool createHeap() override; | ||
virtual int create() override; | ||
virtual int actorExecute() override; | ||
virtual int draw() override; | ||
virtual int doDelete() override; | ||
|
||
// This inline fixes stack alloc | ||
inline bool createModel(nw4r::g3d::ResMdl mdl) { | ||
return mModel.create(mdl, &heap_allocator, 0x120, 1, nullptr); | ||
} | ||
|
||
bool isDay(); | ||
|
||
STATE_FUNC_DECLARE(dAcOsunLight_c, Wait); | ||
|
||
private: | ||
nw4r::g3d::ResFile mBrres; | ||
m3d::smdl_c mModel; | ||
STATE_MGR_DECLARE(dAcOsunLight_c); | ||
m3d::anmTexSrt_c mTexAnm; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#ifndef SPAWN_STRUCT_H | ||
#define SPAWN_STRUCT_H | ||
|
||
#include <common.h> | ||
|
||
struct SpawnStruct { | ||
/* 0x00 */ char mName[32]; // Could be SizedString<32> | ||
/* 0x20 */ u16 mTransitionFadeFrames; | ||
/* 0x22 */ s8 mRoom; | ||
/* 0x23 */ s8 mLayer; | ||
/* 0x24 */ s8 mEntrance; | ||
/* 0x25 */ bool mNight; | ||
/* 0x26 */ bool mTrial; | ||
/* 0x27 */ bool mTransitionType; | ||
/* 0x28 */ u8 UNK_0x28[0x2C - 0x28]; | ||
|
||
static SpawnStruct sInstance; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#include <d/a/obj/d_a_obj_sun_light.h> | ||
#include <toBeSorted/arc_managers/current_stage_arc_manager.h> | ||
#include <toBeSorted/spawn_struct.h> | ||
|
||
SPECIAL_ACTOR_PROFILE(OBJ_SUN_LIGHT, dAcOsunLight_c, fProfile::OBJ_SUN_LIGHT, 0x0219, 0, 3); | ||
|
||
STATE_DEFINE(dAcOsunLight_c, Wait); | ||
|
||
extern "C" void fn_801B42D0(nw4r::g3d::ResFile *); | ||
extern "C" void fn_801B4320(nw4r::g3d::ResFile *); | ||
|
||
bool dAcOsunLight_c::createHeap() { | ||
// TODO stack order shuffle | ||
mBrres = CurrentStageArcManager::sInstance->getData("g3d/stage.brres"); | ||
fn_801B42D0(&mBrres); | ||
fn_801B4320(&mBrres); | ||
nw4r::g3d::ResMdl mdl = mBrres.GetResMdl("StageF000Light"); | ||
// This whole code is a bit weird again | ||
bool success1 = createModel(mdl); | ||
if (!success1) { | ||
return success1; | ||
} | ||
nw4r::g3d::ResAnmTexSrt srt = mBrres.GetResAnmTexSrt("StageF000Light"); | ||
bool success2 = mTexAnm.create(mdl, srt, &heap_allocator, nullptr, 1); | ||
return success2 ? true : success2; | ||
} | ||
|
||
int dAcOsunLight_c::create() { | ||
if (!initAllocatorWork1Heap(-1, "dAcOsunLight_c::m_allocator", 0x20)) { | ||
return 2; | ||
} | ||
|
||
mModel.setAnm(mTexAnm); | ||
mStateMgr.changeState(StateID_Wait); | ||
mModel.setPriorityDraw(0x1C, 9); | ||
setBoundingBox(mVec3_c(-200.0f, -100.0f, -200.0f), mVec3_c(200.0f, 600.0f, 500.0f)); | ||
return 1; | ||
} | ||
|
||
int dAcOsunLight_c::doDelete() { | ||
return 1; | ||
} | ||
|
||
int dAcOsunLight_c::actorExecute() { | ||
mStateMgr.executeState(); | ||
if (isDay()) { | ||
mTexAnm.play(); | ||
} | ||
updateMatrix(); | ||
mModel.setLocalMtx(&worldMatrix.nw4rm); | ||
return 1; | ||
} | ||
|
||
int dAcOsunLight_c::draw() { | ||
if (isDay()) { | ||
drawModelType1(&mModel); | ||
} | ||
return 1; | ||
} | ||
|
||
void dAcOsunLight_c::initializeState_Wait() {} | ||
|
||
void dAcOsunLight_c::executeState_Wait() {} | ||
|
||
void dAcOsunLight_c::finalizeState_Wait() {} | ||
|
||
bool dAcOsunLight_c::isDay() { | ||
return !SpawnStruct::sInstance.mNight; | ||
} |