Merge pull request #118 from robojumper/d_a_obj_dungeon_ship

An attempt at d_a_obj_dungeon_ship
This commit is contained in:
robojumper
2025-03-02 18:10:50 +01:00
committed by GitHub
10 changed files with 836 additions and 67 deletions
+81 -3
View File
@@ -1,15 +1,33 @@
#ifndef D_A_OBJ_DUNGEON_SHIP_H
#define D_A_OBJ_DUNGEON_SHIP_H
#include "common.h"
#include "d/a/obj/d_a_obj_base.h"
#include "d/col/bg/d_bg_w.h"
#include "d/col/cc/d_cc_d.h"
#include "m/m3d/m_anmchr.h"
#include "m/m3d/m_anmmatclr.h"
#include "m/m_vec.h"
#include "nw4r/g3d/res/g3d_resfile.h"
#include "s/s_State.hpp"
#include "s/s_StateMgr.hpp"
#include "toBeSorted/actor_event.h"
#include "toBeSorted/actor_on_rail.h"
#include "toBeSorted/dowsing_target.h"
#include "toBeSorted/effects_struct.h"
#include "toBeSorted/time_proc.h"
class dAcODungeonShip_c : public dAcObjBase_c {
public:
dAcODungeonShip_c() : mStateMgr(*this, sStateID::null) {}
dAcODungeonShip_c()
: mStateMgr(*this, sStateID::null), mDowsingTarget(this, DowsingTarget::SLOT_NONE), mEvent(*this, nullptr) {}
virtual ~dAcODungeonShip_c() {}
virtual bool createHeap() override;
virtual int create() override;
virtual int draw() override;
virtual int doDelete() override;
virtual int actorExecute() override;
STATE_FUNC_DECLARE(dAcODungeonShip_c, Wait);
STATE_FUNC_DECLARE(dAcODungeonShip_c, Transparency);
STATE_FUNC_DECLARE(dAcODungeonShip_c, AppearEvent);
@@ -17,7 +35,67 @@ public:
STATE_FUNC_DECLARE(dAcODungeonShip_c, End);
private:
/* 0x??? */ STATE_MGR_DECLARE(dAcODungeonShip_c);
static const f32 someFloats[18];
void updateMatrixAndScale();
void fn_485_1660();
void fn_485_1720();
bool fn_485_1830(s32 pathSegmentIndex, s32 direction, s32 *out);
u16 fn_485_1900();
u32 fn_485_1960();
f32 fn_485_1A50();
f32 fn_485_1A60();
static void fn_485_1A70(mVec3_c *);
void fn_485_1A90();
void fn_485_1BF0();
void fn_485_1DF0();
void fn_485_1EE0();
static void eventIn_Wrapper(void *arg);
void eventIn();
static void eventEnd_Wrapper(void *arg);
void eventEnd();
static dCcD_SrcCps sCcSrc;
/* 0x300 */ nw4r::g3d::ResFile mRes;
/* 0x334 */ MdlWithTimeProc mMdl;
/* 0x374 */ m3d::anmChr_c mAnmChr;
/* 0x3AC */ m3d::anmMatClr_c mAnmMatClr;
/* 0x3D8 */ dBgW mBg;
/* 0x5E8 */ dCcD_Cps mCc;
/* 0x758 */ STATE_MGR_DECLARE(dAcODungeonShip_c);
/* 0x794 */ DowsingTarget mDowsingTarget;
/* 0x7B4 */ mVec3_c mDowsingOffset;
/* 0x7C0 */ u8 mIsRoaming;
/* 0x7C4 */ ActorOnRail_Ext mPath;
/* 0x7F8 */ ActorEventRelated mEvent;
/* 0x848 */ u8 mAppearEventFromParam;
/* 0x849 */ u8 field_0x849;
/* 0x84A */ u8 mAppearEvent;
/* 0x84B */ u8 mPathIdx;
/* 0x84C */ u16 field_0x84C;
/* 0x850 */ u32 field_0x850;
/* 0x854 */ u8 mNumTimesHit;
/* 0x855 */ u8 field_0x855;
/* 0x856 */ s8 field_0x856;
/* 0x858 */ f32 field_0x858;
/* 0x85C */ UNKWORD field_0x85C;
/* 0x862 */ u8 field_0x860;
/* 0x862 */ u8 field_0x861;
/* 0x862 */ u8 field_0x862;
/* 0x863 */ u8 field_0x863;
/* 0x864 */ u8 field_0x864;
/* 0x865 */ u8 mIsDocked;
/* 0x868 */ s32 field_0x868;
/* 0x86C */ u32 field_0x86C;
/* 0x870 */ EffectsStruct mEffects[2];
/* 0x8D8 */ u8 field_0x8D8;
/* 0x8D9 */ u8 field_0x8D9;
/* 0x8DA */ u8 field_0x8DA;
};
#endif
+1
View File
@@ -18,6 +18,7 @@ public:
virtual cCcD_ShapeAttr *GetShapeAttr() override;
using cM3dGCps::Set;
void Set(const dCcD_SrcCps &src);
void unknownCalc();
};
+5
View File
@@ -4,6 +4,7 @@
#include "m/m3d/m_bmdl.h"
#include "m/m3d/m_fanm.h"
#include "nw4r/g3d/g3d_anmclr.h"
#include "nw4r/g3d/g3d_scnobj.h"
namespace m3d {
@@ -48,6 +49,10 @@ public:
void setFrameStart(f32, s32);
f32 getFrameStart(s32) const;
nw4r::g3d::AnmObjMatClrRes *getChild(s32 idx) {
return nw4r::g3d::ScnObj::DynamicCast<nw4r::g3d::AnmObjMatClrRes>(mpChildren[idx].getAnimObj());
}
private:
child_c *mpChildren;
};
+4
View File
@@ -3,6 +3,7 @@
#include "common.h"
#include "d/a/d_a_base.h"
#include "m/m_vec.h"
#include "toBeSorted/event.h"
class ActorEventRelated {
@@ -16,6 +17,9 @@ public:
void advanceNext();
bool isAdvance();
int getSingleFloatData(f32 *result, u32 code, u32);
int getSingleVecData(mVec3_c *result, u32 code, u32);
private:
u8 field_0x00[0x50 - 0x00];
};
+52
View File
@@ -2,6 +2,7 @@
#define ACTOR_ON_RAIL_H
#include "common.h"
#include "m/m_vec.h"
class ActorOnRail {
private:
@@ -19,6 +20,57 @@ public:
bool init(int pathIndex, int roomId, int pathSubtype);
/* 800A68B0 */
mVec3_c *getPntPosForIndex(int index);
void fn_800A7C80(int segmentIndex, mVec3_c &vec, f32 segmentFraction);
};
class ActorOnRail_Ext : public ActorOnRail {
public:
ActorOnRail_Ext();
virtual ~ActorOnRail_Ext();
void setSegment(u16 segmentIndex, f32 segmentFraction);
bool initExt(int pathIndex, int roomId, int, int pathSegment, int pathSubtype, f32, f32, f32);
void fn_800A9650();
s32 getSegmentIndex() const {
return mSegmentIndex;
}
f32 getSegmentFraction() const {
return mSegmentFraction;
}
bool CheckFlag(u32 flag) const {
return (field_0x1C & flag) != 0;
}
void ClearFlag(u32 flag) {
field_0x1C &= ~flag;
}
void SetFlag(u32 flag) {
field_0x1C |= flag;
}
const mVec3_c &getPosition() const {
return mPosition;
}
void setSpeed(f32 speed) {
mSpeed = speed;
}
private:
s32 mSegmentIndex;
f32 mSegmentFraction;
f32 mSpeed;
u32 field_0x1C;
f32 field_0x20;
UNKWORD field_0x24;
mVec3_c mPosition;
};
#endif
+45
View File
@@ -0,0 +1,45 @@
#ifndef TIME_PROC_H
#define TIME_PROC_H
/**
* A callback implementation that controls ???
*/
#include "m/m3d/m_proc.h"
#include "m/m3d/m_smdl.h"
#include "nw4r/g3d/g3d_scnobj.h"
class TimeCallback_c : public nw4r::g3d::IScnObjCallback {
public:
TimeCallback_c() : field_0x04(0), field_0x08(0), field_0x09(0) {}
virtual ~TimeCallback_c() {}
virtual void ExecCallback_CALC_VIEW(
nw4r::g3d::ScnObj::Timing /* timing */, nw4r::g3d::ScnObj * /* pObj */, u32 /* param */, void * /* pInfo */
) override;
/* 0x04 */ u32 field_0x04;
/* 0x08 */ u8 field_0x08;
/* 0x09 */ u8 field_0x09;
};
class TimeProcBase : public m3d::proc_c {
public:
virtual ~TimeProcBase() {}
};
class TimeProc : public TimeProcBase {
public:
TimeProc() {}
virtual ~TimeProc() {}
TimeCallback_c mCallback;
};
class MdlWithTimeProc : public m3d::smdl_c {
public:
int fn_8001F3B0(nw4r::g3d::ResMdl mdl, mAllocator_c *alloc, u32 bufferOption);
TimeProc mProc;
};
#endif // TIME_PROC_H