-
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
b652750
commit f2fe70b
Showing
16 changed files
with
257 additions
and
74 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#ifndef D_A_OBJ_MOLE_SOIL_H | ||
#define D_A_OBJ_MOLE_SOIL_H | ||
|
||
#include <d/a/obj/d_a_obj_base.h> | ||
#include <m/m3d/m_smdl.h> | ||
#include <s/s_State.hpp> | ||
#include <s/s_StateMgr.hpp> | ||
|
||
class dAcOmoleSoil_c : public dAcObjBase_c { | ||
public: | ||
dAcOmoleSoil_c() : mStateMgr(*this, sStateID::null) {} | ||
virtual ~dAcOmoleSoil_c() {} | ||
virtual bool createHeap() override; | ||
virtual int create() override; | ||
virtual int actorExecute() override; | ||
virtual int draw() override; | ||
virtual int doDelete() override; | ||
|
||
STATE_FUNC_DECLARE(dAcOmoleSoil_c, Wait); | ||
STATE_FUNC_DECLARE(dAcOmoleSoil_c, Appear); | ||
STATE_FUNC_DECLARE(dAcOmoleSoil_c, DisAppear); | ||
|
||
private: | ||
const static f32 sHalfScale; | ||
const static f32 sFullScale; | ||
|
||
u8 getNextState() { | ||
return mDesiredNextState; | ||
} | ||
|
||
nw4r::g3d::ResFile mBrres; | ||
m3d::smdl_c mModel; | ||
STATE_MGR_DECLARE(dAcOmoleSoil_c); | ||
f32 mScale; | ||
u8 mDesiredNextState; | ||
bool field_0x391; | ||
}; | ||
|
||
#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
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,128 @@ | ||
#include <d/a/obj/d_a_obj_mole_soil.h> | ||
#include <toBeSorted/arc_managers/current_stage_arc_manager.h> | ||
#include <toBeSorted/spawn_struct.h> | ||
|
||
SPECIAL_ACTOR_PROFILE(OBJ_MOLE_SOIL, dAcOmoleSoil_c, fProfile::OBJ_MOLE_SOIL, 0x008B, 0, 6); | ||
|
||
STATE_DEFINE(dAcOmoleSoil_c, Wait); | ||
STATE_DEFINE(dAcOmoleSoil_c, Appear); | ||
STATE_DEFINE(dAcOmoleSoil_c, DisAppear); | ||
|
||
const f32 dAcOmoleSoil_c::sHalfScale = 0.5f; | ||
const f32 dAcOmoleSoil_c::sFullScale = 1.0f; | ||
|
||
bool dAcOmoleSoil_c::createHeap() { | ||
nw4r::g3d::ResFile file = getOarcResFile("MogumaMud"); | ||
if (!file.mFile.IsValid()) { | ||
return false; | ||
} | ||
mBrres = file; | ||
nw4r::g3d::ResMdl mdl = mBrres.GetResMdl("MogumaMud"); | ||
// This whole code is a bit weird again | ||
bool success1 = mModel.create(mdl, &heap_allocator, 0x120, 1, nullptr); | ||
if (!success1) { | ||
return success1; | ||
} | ||
mModel.setPriorityDraw(0x1c, 9); | ||
return true; | ||
} | ||
|
||
bool intToBool(int a) { | ||
return a; | ||
} | ||
|
||
int dAcOmoleSoil_c::create() { | ||
if (!initAllocatorWork1Heap(-1, "dAcOmoleSoil_c::m_allocator", 0x20)) { | ||
return 2; | ||
} | ||
|
||
mScale = sHalfScale; | ||
scale.set(sHalfScale, sHalfScale, sHalfScale); | ||
mStateMgr.changeState(StateID_Wait); | ||
|
||
setBoundingBox(mVec3_c(-100.0f, -0.0f, -100.0f), mVec3_c(100.0f, 100.0f, 100.0f)); | ||
return 1; | ||
} | ||
|
||
int dAcOmoleSoil_c::doDelete() { | ||
return 1; | ||
} | ||
|
||
int dAcOmoleSoil_c::actorExecute() { | ||
switch (getNextState()) { | ||
case 1: | ||
if (!mStateMgr.isState(StateID_Appear)) { | ||
mStateMgr.changeState(StateID_Appear); | ||
} | ||
break; | ||
case 2: | ||
if (!mStateMgr.isState(StateID_DisAppear)) { | ||
mStateMgr.changeState(StateID_DisAppear); | ||
} | ||
break; | ||
case 3: | ||
if (!mStateMgr.isState(StateID_Appear)) { | ||
mStateMgr.changeState(StateID_Appear); | ||
} | ||
break; | ||
} | ||
mStateMgr.executeState(); | ||
updateMatrix(); | ||
mModel.setLocalMtx(worldMatrix); | ||
return 1; | ||
} | ||
|
||
int dAcOmoleSoil_c::draw() { | ||
if (field_0x391) { | ||
drawModelType1(&mModel); | ||
} | ||
return 1; | ||
} | ||
|
||
// sLib::chase | ||
extern "C" bool fn_802DECC0(f32 *, f32, f32); | ||
|
||
void dAcOmoleSoil_c::initializeState_Wait() { | ||
mDesiredNextState = 0; | ||
} | ||
void dAcOmoleSoil_c::executeState_Wait() {} | ||
void dAcOmoleSoil_c::finalizeState_Wait() {} | ||
|
||
void dAcOmoleSoil_c::initializeState_Appear() { | ||
field_0x391 = true; | ||
} | ||
void dAcOmoleSoil_c::executeState_Appear() { | ||
f32 stepSize = 0.05f; | ||
if (fn_802DECC0(&mScale, sFullScale, stepSize)) { | ||
mStateMgr.changeState(StateID_Wait); | ||
} else { | ||
mModel.setScale(mScale, mScale, mScale); | ||
} | ||
} | ||
void dAcOmoleSoil_c::finalizeState_Appear() { | ||
mDesiredNextState = 0; | ||
mScale = sFullScale; | ||
mModel.setScale(sFullScale, sFullScale, sFullScale); | ||
} | ||
|
||
void dAcOmoleSoil_c::initializeState_DisAppear() { | ||
field_0x391 = true; | ||
} | ||
|
||
void dAcOmoleSoil_c::executeState_DisAppear() { | ||
// Nothing about this makes sense but this creates the necessary casts | ||
// and operations. Note that Ghidra constant-folds this despite | ||
// all the stack operations for the cast. | ||
int scalar = 0; | ||
f32 stepSize = 0.01f * scalar + 0.05f; | ||
if (fn_802DECC0(&mScale, sHalfScale, stepSize)) { | ||
mStateMgr.changeState(StateID_Wait); | ||
} else { | ||
mModel.setScale(mScale, mScale, mScale); | ||
} | ||
} | ||
void dAcOmoleSoil_c::finalizeState_DisAppear() { | ||
mDesiredNextState = 0; | ||
mScale = sHalfScale; | ||
mModel.setScale(sHalfScale, sHalfScale, sHalfScale); | ||
} |
Oops, something went wrong.