* Initial M3d Pass
* `m_bmdl` and `m_bline` left

---------

Co-authored-by: elijah-thomas774 <elijahthomas774@gmail.com>
Co-authored-by: Elijah Thomas <42302100+elijah-thomas774@users.noreply.github.com>
This commit is contained in:
robojumper
2024-09-12 22:36:34 +02:00
committed by GitHub
parent e2c4bb7be7
commit 1180e1f486
150 changed files with 5890 additions and 818 deletions
+59
View File
@@ -0,0 +1,59 @@
#ifndef D_A_E_HB_LEAF_H
#define D_A_E_HB_LEAF_H
#include <c/c_math.h>
#include <d/a/obj/d_a_obj_base.h>
#include <m/m3d/m_anmmdl.h>
#include <m/m3d/m_anmtexpat.h>
extern "C" bool fn_800B9D80(f32, f32, f32 *, int, const mVec3_c &, u32);
class dAcEhb_leaf_c : public dAcObjBase_c {
public:
dAcEhb_leaf_c() : someFloat(unkFloat0), field_0x3CC(0), field_0x3DE(0) {}
virtual ~dAcEhb_leaf_c() {}
virtual bool createHeap() override;
virtual int create() override;
virtual int actorExecute() override;
virtual int draw() override;
virtual int doDelete() override;
void setAnm(const char *anm, f32 pos);
private:
const static f32 unkFloat0;
const static f32 unkFloat1;
m3d::mdlAnmChr mModel; // 0x330
m3d::anmTexPat_c mAnm; // 0x398
f32 someFloat; // 0x3C4
UNKWORD field_0x3C8; // 0x3C8
u8 field_0x3CC; // 0x3CC
mVec3_c mStartingPos; // 0x3D0
u16 someRot; // 0x3DC
u8 field_0x3DE; // 0x3DE
u8 mType; // 0x3DF
bool isNearZero() {
return fabsf(someFloat) <= FLT_EPSILON;
}
bool isHidden() {
return mType != 0 && isNearZero() ? true : false;
}
void doCheck() {
fn_800B9D80(10.0f, 0.2f, &someFloat, roomid, mStartingPos, 0);
}
int getParam1() {
return params & 7;
}
int getParam2() {
return params >> 7 & 3;
}
};
#endif
+45 -12
View File
@@ -4,7 +4,25 @@
#include "d/a/d_a_base.h"
#include "m/m_mtx.h"
#include "m/types_m.h"
#include "nw4r/g3d/g3d_resfile.h"
// Size: 0xA8
struct ActorCarryStruct {
/* 0x00 */ fLiNdBa_c actorLink;
/* 0x0C */ fLiNdBa_c *carriedActor;
/* 0x10 */ u32 carryFlags;
/* 0x14 */ int carryType;
/* 0x18 */ u16 field_0x18;
/* 0x1A */ u16 field_0x1A;
/* 0x1C */ mVec3_c field_0x1C;
/* 0x28 */ mMtx_c carryTransMtx;
/* 0x58 */ mMtx_c field_0x58;
/* 0x88 */ s32 isCarried;
/* 0x8C */ u8 field_0x8C[0x10]; // mQuat_c
/* 0x9C */ void *dtor; // ???
/* 0xA0 */ u32 field_0xA0;
/* 0xA4 */ u32 field_0xA4;
};
// Ghidra: ActorObjectBase
// size: 0x330
@@ -26,23 +44,29 @@ public:
f32 forwardSpeed;
f32 forwardAccel;
f32 forwardMaxSpeed;
// TODO: add the rest
u8 unk1[0x15C - 0x150];
mVec3_c velocity;
/* 0x15C */ mMtx_c worldMatrix;
nw4r::math::AABB boundingBox;
u8 unk_0x1A4[0x330 - 0x1A4];
u8 unk_0x1A4[0x1E8 - 0x1A4];
/* 0x1E8 */ mVec3_c posIncrements;
u8 unk_0x1F4[0x210 - 0x1F4];
/* 0x210 */ ActorCarryStruct mActorCarryInfo;
u8 unk_0x1EC[0x330 - 0x2B8];
public:
// could be their own thing?
/* 8002de40 */ static void *getOarcFile(char *oarcName, char *fileName);
/* 8002de60 */ static void *getOarcSubEntry(char *oarcName, char *fileName);
/* 8002de80 */ static void *getOarcResFile(char *oarcName);
/* 8002de90 */ static void *getOarcModelFile(char *oarcName);
/* 8002dea0 */ static void *getOarcZev(char *oarcName);
/* 8002deb0 */ static void *getOarcDZB(char *dzbName);
/* 8002ded0 */ static void *getOarcPLC(char *plcName);
/* 8002de40 */ static void *getOarcFile(const char *oarcName, const char *fileName);
/* 8002de60 */ static void *getOarcSubEntry(const char *oarcName, const char *fileName);
/* 8002de80 */ static void *getOarcResFile(const char *oarcName);
/* 8002de90 */ static void *getOarcModelFile(const char *oarcName);
/* 8002dea0 */ static void *getOarcZev(const char *oarcName);
/* 8002deb0 */ static void *getOarcDZB(const char *dzbName);
/* 8002ded0 */ static void *getOarcPLC(const char *plcName);
public:
/* 8002def0 */ dAcObjBase_c();
@@ -74,7 +98,7 @@ public:
/* 8002eb30 */ void fn_8002EB30(void *);
/* 8002eb90 */ void putInODesert(f32 depth, mVec3_c *position);
// Disabling makes Items and Link Disappear
/* 8002ec70 */ void drawModelType1();
/* 8002ec70 */ void drawModelType1(m3d::smdl_c *smdl);
// Disabling make Lava and other objects Disappear
/* 8002ecd0 */ void drawModel2();
/* 8002ed20 */ void fn_8002ed20();
@@ -93,6 +117,15 @@ public:
mVec3_c *pos, mAng3_c *rot, mVec3_c *scale, u32 params2);
/* 8002f260 */ static dAcBase_c *createActorUnkGroup3(char *name, u32 roomId, u32 params1, mVec3_c *pos,
mAng3_c *rot, mVec3_c *scale, u32 params2, u16 id, u8 viewclipId);
protected:
inline void setBoundingBox(mVec3_c min, mVec3_c max) {
boundingBox.min = min;
boundingBox.max = max;
}
};
// Actors' createHeap functions often have patterns that can be matched with this macro
#define TRY_CREATE(thing) do { bool result = (thing); if (!result) return result; } while (0);
#endif
+26
View File
@@ -0,0 +1,26 @@
#ifndef D_A_OBJ_LAVA_F200_H
#define D_A_OBJ_LAVA_F200_H
#include <d/a/obj/d_a_obj_base.h>
#include <m/m3d/m_anmmatclr.h>
#include <m/m3d/m_anmtexsrt.h>
#include <m/m3d/m_smdl.h>
class dAcOlavaF200_c : public dAcObjBase_c {
public:
dAcOlavaF200_c() {}
virtual ~dAcOlavaF200_c() {}
virtual bool createHeap() override;
virtual int create() override;
virtual int actorExecute() override;
virtual int draw() override;
virtual int doDelete() override;
private:
nw4r::g3d::ResFile mBrres;
m3d::smdl_c mModels[2];
m3d::anmTexSrt_c mTexAnms[2];
m3d::anmMatClr_c mClrAnms[2];
};
#endif
+39
View File
@@ -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
+38
View File
@@ -0,0 +1,38 @@
#ifndef D_A_OBJ_RING_H
#define D_A_OBJ_RING_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 dAcOring_c : public dAcObjBase_c {
public:
dAcOring_c() : mStateMgr(*this, sStateID::null) {}
virtual ~dAcOring_c() {}
virtual bool createHeap() override;
virtual int create() override;
virtual int actorExecute() override;
virtual int draw() override;
virtual int doDelete() override;
STATE_FUNC_DECLARE(dAcOring_c, Move);
u8 getArgFromParams() {
u32 p = (params & 3);
return p != 3 ? p : 0;
}
private:
static u32 ROT_PER_TICK;
m3d::smdl_c mModel;
STATE_MGR_DECLARE(dAcOring_c);
u8 field_0x388;
f32 field_0x38C;
};
#endif
+30
View File
@@ -0,0 +1,30 @@
#ifndef D_A_OBJ_SMOKE_H
#define D_A_OBJ_SMOKE_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 dAcOsmoke_c : public dAcObjBase_c {
public:
dAcOsmoke_c() : mStateMgr(*this, sStateID::null) {}
virtual ~dAcOsmoke_c() {}
virtual bool createHeap() override;
virtual int create() override;
virtual int actorExecute() override;
virtual int draw() override;
virtual int doDelete() override;
STATE_FUNC_DECLARE(dAcOsmoke_c, Wait);
private:
nw4r::g3d::ResFile mBrres;
m3d::smdl_c mModel;
m3d::anmTexSrt_c mTexAnm;
STATE_MGR_DECLARE(dAcOsmoke_c);
u8 mType;
};
#endif
+31
View File
@@ -0,0 +1,31 @@
#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;
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
+1 -1
View File
@@ -22,7 +22,7 @@ public:
public:
/* 80495fa0 */ FrmHeap(MEMiHeapHead *heapHead);
/* 80496060 */ static FrmHeap *create(void *block, size_t size, u16 attr);
/* 804962a0 */ void free(u32 flags);
/* 804962a0 */ void free(s32 flags);
/* 80496370 */ void recordState(u32 id); // non official for now
/* 80496380 */ void freeState(u32 id); // non official for now
};
+2 -2
View File
@@ -162,9 +162,9 @@ public:
} // namespace EGG
/* 80495a60 */ void *operator new(size_t, void *p);
/* 80495a70 */ void *operator new(size_t size, EGG::Heap *heap, int align);
/* 80495a70 */ void *operator new(size_t size, EGG::Heap *heap, int align = 4);
/* 80495a80 */ void *operator new(size_t size, EGG::Allocator *alloc);
/* 80495a90 */ void *operator new[](size_t size, int align);
/* 80495aa0 */ void *operator new[](size_t size, EGG::Heap *heap, int align);
/* 80495aa0 */ void *operator new[](size_t size, EGG::Heap *heap, int align = 4);
#endif
+3
View File
@@ -57,6 +57,9 @@ public:
}
};
template <class TVideo, class TDisplay, class TXfbManager, class TAudioManager, class TSceneManager, class TPerfView>
class TSystem : ConfigurationData {};
} // namespace EGG
#endif
+37
View File
@@ -0,0 +1,37 @@
#ifndef EGG_DRAWGX_H
#define EGG_DRAWGX_H
#include <common.h>
#include <egg/core/eggHeap.h>
#include <egg/gfx/eggTexture.h>
#include <egg/math/eggMatrix.h>
#include <rvl/GX.h>
namespace EGG {
class DrawGX {
public:
static void Initialize(Heap *);
static GXTexMapID GetTexMapDefault();
static void LoadTexture(const EGG::ResTIMG *, GXTexMapID);
// TODO MORE
/* static ?? s_DL */
static Matrix34f s_cameraMtx;
/* static ?? s_flag */
static GXColor BLACK;
static GXColor WHITE;
static GXColor GREEN;
static GXColor RED;
static GXColor BLUE;
};
} // namespace EGG
#endif
+28
View File
@@ -0,0 +1,28 @@
#ifndef EGG_FOG_H
#define EGG_FOG_H
#include <egg/prim/eggBinary.h>
#include <nw4r/types_nw4r.h>
namespace EGG {
// TODO: Add members
class FogManager : IBinary<FogManager> {
public:
FogManager(u16);
virtual ~FogManager();
virtual void SetBinaryInner(Bin &) override;
virtual void GetBinaryInner(Bin *) const override;
virtual size_t GetBinarySize() override;
virtual void SetBinaryInner(const Bin &, const Bin &, f32) override;
void Calc();
void CopyToG3D(nw4r::g3d::ScnRoot *) const;
/* 0x04 */ u8 mFlag;
/* 0x05 */ u8 TODO[0x10 - 0x05];
};
} // namespace EGG
#endif
+24
View File
@@ -0,0 +1,24 @@
#ifndef EGG_FRUSTUM_H
#define EGG_FRUSTUM_H
#include <common.h>
#include <nw4r/g3d/g3d_camera.h>
namespace EGG {
// TODO: Fill out more
class Frustum {
public:
enum CanvasMode {};
enum ProjectionType {};
u8 TODO_0x00[0x38];
// vt at 0x38
virtual ~Frustum();
virtual void SetProjectionGX() const;
virtual void CopyToG3D(nw4r::g3d::Camera) const;
};
} // namespace EGG
#endif
+30
View File
@@ -0,0 +1,30 @@
#ifndef EGG_GFXENGINE_H
#define EGG_GFXENGINE_H
#include <common.h>
#include <rvl/GX.h>
namespace EGG {
namespace GfxEngine {
struct Configuration {
/* 0x00 */ u16 efbWidth;
/* 0x02 */ u16 efbHeight;
/* 0x04 */ GXColor clearColor;
/* 0x08 */ u32 field_0x08;
/* 0x0C */ u16 field_0x0C;
/* 0x0E */ u16 field_0x0E;
/* 0x10 */ u32 bufferSize;
/* 0x14 */ u16 field_0x14;
/* 0x16 */ u16 field_0x16;
/* 0x18 */ u8 UNK_0x18[4];
Configuration();
virtual ~Configuration() {}
};
} // namespace GfxEngine
} // namespace EGG
#endif
+53
View File
@@ -0,0 +1,53 @@
#ifndef EGG_LIGHT_H
#define EGG_LIGHT_H
#include <egg/prim/eggBinary.h>
#include <nw4r/types_nw4r.h>
namespace EGG {
// TODO: Fill out more
class LightTexture {
public:
static void initialize(u16 textureSize, Heap *pHeap);
};
// TODO: Fill out more
class LightTextureManager : public IBinary<LightTextureManager> {
public:
virtual ~LightTextureManager();
virtual void SetBinaryInner(Bin &) override;
virtual void GetBinaryInner(Bin *) const override;
virtual size_t GetBinarySize() override;
virtual void SetBinaryInner(const Bin &, const Bin &, f32) override;
void drawAndCaptureTexture(f32, f32, f32, f32);
};
// TODO: Fill out more
class LightManager : public IBinary<LightManager> {
public:
// vt at 0x00
LightManager(u32, u32, u8);
virtual ~LightManager();
virtual void SetBinaryInner(Bin &) override;
virtual void GetBinaryInner(Bin *) const override;
virtual size_t GetBinarySize() override;
virtual void SetBinaryInner(const Bin &, const Bin &, f32) override;
virtual void Reset();
virtual void Calc(nw4r::g3d::ScnRoot *);
virtual void CalcView(const nw4r::math::MTX34 &, u8, nw4r::g3d::ScnRoot *);
virtual void DoneDraw();
LightTextureManager *GetTextureMgr() const {
return mTextureMgr;
}
u8 TODO_0x04[0x14 - 0x04];
LightTextureManager *mTextureMgr;
u8 TODO_0x18[0x28 - 0x18];
};
} // namespace EGG
#endif
+27
View File
@@ -0,0 +1,27 @@
#ifndef EGG_SCREEN_H
#define EGG_SCREEN_H
#include <common.h>
#include <egg/gfx/eggFrustum.h>
namespace EGG {
// TODO: Fill out more
class Screen : public Frustum {
public:
Screen();
Screen(f32, f32, f32, f32, Screen *, CanvasMode);
virtual ~Screen();
virtual void SetProjectionGX() const override;
virtual void CopyToG3D(nw4r::g3d::Camera) const override;
static void Initialize(const u16 *, const u16 *, Screen *);
static void SetTVModeDefault();
u8 TODO_0x3C[0x88 - 0x3C];
};
} // namespace EGG
#endif
+45
View File
@@ -0,0 +1,45 @@
#ifndef EGG_STATE_GX_H
#define EGG_STATE_GX_H
#include <common.h>
#include <rvl/GX.h>
namespace EGG {
class StateGX {
public:
static void initialize(u16, u16, GXColor, GXPixelFmt);
static void frameInit();
static void textureInit(); // Guess for 804b4810
static void resetGX();
static void resetVtx();
static void resetColorChannel();
static void resetIndirect();
static void resetTexture();
static void resetTexGen();
static void resetTev();
static void resetPE();
static void resetGXCache();
static void GXSetPixelFmt(GXPixelFmt pixelFmt, GXZFmt16 zFmt);
static void invalidateTexAllGX();
static bool GXSetColorUpdate(bool);
static bool GXSetAlphaUpdate(bool);
static bool GXSetDither();
static void GXCopyTex();
static bool GXSetDstAlpha();
// Unk func here
static void GXSetProjection(Mtx44, int);
static void GXSetProjectionv(const f32 *);
static void GXSetViewport(f32, f32, f32, f32, f32, f32);
static void GZSetScissor(u32, u32, u32, u32);
static void GZSetScissorBoxOffset(s32, s32);
};
} // namespace EGG
#endif
+11
View File
@@ -0,0 +1,11 @@
#ifndef EGG_TEXTURE_H
#define EGG_TEXTURE_H
namespace EGG {
// TODO: Implement Members
struct ResTIMG {};
} // namespace EGG
#endif
+1
View File
@@ -127,6 +127,7 @@ struct Vector3s {
s16 x, y, z;
public:
Vector3s() {}
Vector3s(s16 sx, s16 sy, s16 sz) {
x = sx;
y = sy;
+23
View File
@@ -0,0 +1,23 @@
#ifndef EGG_BINARY_H
#define EGG_BINARY_H
template <class T>
class IBinary {
public:
class Bin {};
virtual void SetBinaryInner(Bin &) = 0;
virtual void GetBinaryInner(Bin *) const = 0;
virtual size_t GetBinarySize() = 0;
virtual void SetBinaryInner(const Bin &, const Bin &, f32) = 0;
static const char *GetBinaryType();
int GetVersion();
void GetBinary(void *) const;
void SetBinary(const void *);
void SetBinaryBlend(const void *, const void *, f32);
};
#endif
+59
View File
@@ -0,0 +1,59 @@
#ifndef M3D_H
#define M3D_H
#include <egg/core/eggHeap.h>
#include <egg/gfx/eggFog.h>
#include <egg/gfx/eggLight.h>
#include <m/m_allocator.h>
#include <nw4r/g3d/g3d_scnroot.h>
namespace m3d {
namespace internal {
extern mAllocator_c *l_allocator_p;
extern nw4r::g3d::ScnRoot *l_scnRoot_p;
extern u32 l_numLightMgr;
extern EGG::LightManager **l_lightMgr_pp;
extern u32 l_numFogMgr;
extern EGG::FogManager **l_fogMgr_pp;
extern size_t l_alignment;
} // namespace internal
bool create(EGG::Heap *pHeap, u32 maxNumChildren, u32 maxNumScnObj, u32 numLightObj, u32 numLightSet);
bool create(EGG::Heap *pHeap, GXPixelFmt pxlFmt, GXColor clearColor, u32 maxNumChildren, u32 maxNumScnObj,
u32 numLightObj, u32 numLightSet, u32 numLightMgr, u32 numFogMgr);
bool createLightMgr(EGG::Heap *, u16, u16, u8, bool, int);
bool createFogMgr(EGG::Heap *, int, int);
nw4r::g3d::ScnRoot *getScnRoot();
nw4r::g3d::Camera getCamera(int id);
nw4r::g3d::Camera getCurrentCamera();
int getCurrentCameraID();
EGG::LightManager *getLightMgr(int idx);
EGG::FogManager *getFogMgr(int idx);
void drawDone(int idx);
void drawLightMapTexture(int idx);
void calcWorld(int idx);
void calcMaterial();
void calcView(int idx);
void drawOpa();
void drawXlu();
bool pushBack(nw4r::g3d::ScnObj *obj);
void clear();
void reset();
int getMatID(nw4r::g3d::ResMdl, const char *);
int getNodeID(nw4r::g3d::ResMdl, const char *);
void resetMaterial();
} // namespace m3d
#endif
+24
View File
@@ -0,0 +1,24 @@
#ifndef M3D_M_ANMCHR_H
#define M3D_M_ANMCHR_H
#include <m/m3d/m_bmdl.h>
#include <m/m3d/m_fanm.h>
#include <nw4r/g3d/g3d_resanmchr.h>
namespace m3d {
class anmChr_c : public fanm_c {
public:
virtual ~anmChr_c();
virtual int getType() const override;
bool create(nw4r::g3d::ResMdl, nw4r::g3d::ResAnmChr, mAllocator_c *, u32 *);
void setAnm(bmdl_c &, nw4r::g3d::ResAnmChr, playMode_e);
void setAnmAfter(bmdl_c &, nw4r::g3d::ResAnmChr, playMode_e);
void setFrmCtrlDefault(nw4r::g3d::ResAnmChr &, m3d::playMode_e);
};
} // namespace m3d
#endif
+28
View File
@@ -0,0 +1,28 @@
#ifndef M3D_M_ANMCHRBLEND_H
#define M3D_M_ANMCHRBLEND_H
#include <m/m3d/m_anmchr.h>
#include <m/m3d/m_banm.h>
#include <m/m3d/m_bmdl.h>
#include <nw4r/g3d/g3d_anmchr.h>
namespace m3d {
class anmChrBlend_c : public banm_c {
public:
virtual ~anmChrBlend_c();
virtual int getType() const override;
bool create(nw4r::g3d::ResMdl, int, mAllocator_c *, u32 *);
void attach(int, nw4r::g3d::AnmObjChrRes *, f32);
void attach(int, anmChr_c *, f32);
void detach(int);
// Not in NSMBW
void setWeight(int, f32);
f32 getWeight(int) const;
};
} // namespace m3d
#endif
+57
View File
@@ -0,0 +1,57 @@
#ifndef M3D_M_ANMMATCLR_H
#define M3D_M_ANMMATCLR_H
#include <m/m3d/m_bmdl.h>
#include <m/m3d/m_fanm.h>
#include <nw4r/g3d/g3d_anmclr.h>
namespace m3d {
class anmMatClr_c : public banm_c {
class child_c : public fanm_c {
public:
child_c() {}
virtual ~child_c();
virtual int getType() const override;
static u32 heapCost(nw4r::g3d::ResMdl, nw4r::g3d::ResAnmClr, bool);
bool create(nw4r::g3d::ResMdl, nw4r::g3d::ResAnmClr, mAllocator_c *, u32 *);
void setAnm(bmdl_c &, nw4r::g3d::ResAnmClr, playMode_e);
void releaseAnm();
void setFrmCtrlDefault(nw4r::g3d::ResAnmClr &, playMode_e);
};
public:
anmMatClr_c() : mpChildren(nullptr) {}
virtual ~anmMatClr_c();
virtual int getType() const override;
virtual void remove() override;
virtual void play() override;
bool create(nw4r::g3d::ResMdl, nw4r::g3d::ResAnmClr, mAllocator_c *, u32 *, s32);
static u32 heapCost(nw4r::g3d::ResMdl, nw4r::g3d::ResAnmClr, s32, bool);
void setAnm(bmdl_c &, nw4r::g3d::ResAnmClr, s32, playMode_e);
void play(s32);
f32 getFrame(s32) const;
void setFrame(f32, s32);
f32 getRate(s32) const;
void setRate(f32, s32);
bool isStop(s32) const;
bool checkFrame(f32, s32) const;
void setPlayMode(playMode_e, s32);
f32 getFrameMax(s32) const;
void setFrameStart(f32, s32);
f32 getFrameStart(s32) const;
private:
child_c *mpChildren;
};
} // namespace m3d
#endif
+50
View File
@@ -0,0 +1,50 @@
#ifndef M3D_M_ANMMDL_H
#define M3D_M_ANMMDL_H
#include <m/m3d/m_anmchr.h>
#include <m/m3d/m_mdl.h>
#include <nw4r/g3d/g3d_resfile.h>
namespace m3d {
// Not in NSMBW, name pulled from City Folk
class mdlAnmChr {
public:
mdlAnmChr() {}
virtual ~mdlAnmChr(); // 0x08
virtual void play(); // 0x0C
virtual void setFrame(f32); // 0x10
virtual void setAnm(const char *name, playMode_e mode, f32); // 0x14
virtual void setAnm(const char *name, playMode_e mode); // 0x18
virtual void setRate(f32); // 0x20
bool create(void *mdlFile, void *anmFile, const char *mdlName, const char *anmName, mAllocator_c *alloc,
u32 bufferOption, int nView, u32 *pSize);
// Unknown overload
bool create2(void *mdlFile, void *anmFile, const char *mdlName, const char *anmName, mAllocator_c *alloc,
u32 bufferOption, int nView, u32 *pSize);
bool create(void *resFile, const char *mdlName, const char *anmName, mAllocator_c *alloc, u32 bufferOption,
int nView, u32 *pSize);
bool create(void *mdlFile, void *anmFile, const char *mdlName, const char *anmName, mdl_c::mdlCallback_c *callback,
mAllocator_c *alloc, u32 bufferOption, int nView, u32 *pSize);
inline bool create(void *resFile, const char *mdlName, const char *anmName, mAllocator_c *alloc, u32 bufferOption) {
return create(resFile, mdlName, anmName, alloc, bufferOption, 1, nullptr);
}
inline mdl_c &getModel() {
return mMdl;
}
private:
nw4r::g3d::ResFile mMdlFile;
nw4r::g3d::ResFile mAnmFile;
mdl_c mMdl;
anmChr_c mAnm;
};
} // namespace m3d
#endif
+24
View File
@@ -0,0 +1,24 @@
#ifndef M_M3D_ANMSHP_H
#define M_M3D_ANMSHP_H
#include <common.h>
#include <m/m3d/m_bmdl.h>
#include <m/m3d/m_fanm.h>
#include <nw4r/g3d/g3d_resanmshp.h>
namespace m3d {
class anmShp_c : public fanm_c {
public:
virtual ~anmShp_c();
virtual int getType() const override;
bool create(nw4r::g3d::ResMdl, nw4r::g3d::ResAnmShp, mAllocator_c *, u32 *);
void setAnm(m3d::bmdl_c &, nw4r::g3d::ResAnmShp, m3d::playMode_e);
void setFrmCtrlDefault(nw4r::g3d::ResAnmShp &, m3d::playMode_e);
};
} // namespace m3d
#endif
+52
View File
@@ -0,0 +1,52 @@
#ifndef M3D_M_ANMTEXPAT_H
#define M3D_M_ANMTEXPAT_H
#include <m/m3d/m_bmdl.h>
#include <m/m3d/m_fanm.h>
#include <nw4r/g3d/g3d_anmtexpat.h>
namespace m3d {
class anmTexPat_c : public banm_c {
class child_c : public fanm_c {
public:
child_c() {}
virtual ~child_c();
virtual int getType() const override;
static u32 heapCost(nw4r::g3d::ResMdl, nw4r::g3d::ResAnmTexPat, bool);
bool create(nw4r::g3d::ResMdl, nw4r::g3d::ResAnmTexPat, mAllocator_c *, u32 *);
void setAnm(m3d::bmdl_c &, nw4r::g3d::ResAnmTexPat, m3d::playMode_e);
void releaseAnm();
void setFrmCtrlDefault(nw4r::g3d::ResAnmTexPat &, playMode_e);
};
public:
anmTexPat_c() : mpChildren(nullptr) {}
virtual ~anmTexPat_c();
virtual int getType() const override;
virtual void remove() override;
virtual void play() override;
bool create(nw4r::g3d::ResMdl, nw4r::g3d::ResAnmTexPat, mAllocator_c *, u32 *, s32);
static u32 heapCost(nw4r::g3d::ResMdl, nw4r::g3d::ResAnmTexPat, s32, bool);
void setAnm(bmdl_c &, nw4r::g3d::ResAnmTexPat, s32, playMode_e);
void play(s32);
f32 getFrame(s32) const;
void setFrame(f32, s32);
void setRate(f32, s32);
bool isStop(s32) const;
f32 getFrameMax(s32) const;
void setFrameStart(f32, s32);
private:
child_c *mpChildren;
};
} // namespace m3d
#endif
+56
View File
@@ -0,0 +1,56 @@
#ifndef M3D_M_ANMTEXSRT_H
#define M3D_M_ANMTEXSRT_H
#include <m/m3d/m_bmdl.h>
#include <m/m3d/m_fanm.h>
#include <nw4r/g3d/g3d_anmtexsrt.h>
namespace m3d {
class anmTexSrt_c : public banm_c {
class child_c : public fanm_c {
public:
child_c() {}
virtual ~child_c();
virtual int getType() const override;
static u32 heapCost(nw4r::g3d::ResMdl, nw4r::g3d::ResAnmTexSrt, bool);
bool create(nw4r::g3d::ResMdl, nw4r::g3d::ResAnmTexSrt, mAllocator_c *, u32 *);
void setAnm(m3d::bmdl_c &, nw4r::g3d::ResAnmTexSrt, m3d::playMode_e);
void releaseAnm();
void setFrmCtrlDefault(nw4r::g3d::ResAnmTexSrt &, playMode_e);
};
public:
anmTexSrt_c() : mpChildren(nullptr) {}
virtual ~anmTexSrt_c();
virtual int getType() const override;
virtual void remove() override;
virtual void play() override;
bool create(nw4r::g3d::ResMdl, nw4r::g3d::ResAnmTexSrt, mAllocator_c *, u32 *, s32);
static u32 heapCost(nw4r::g3d::ResMdl, nw4r::g3d::ResAnmTexSrt, s32, bool);
void setAnm(bmdl_c &, nw4r::g3d::ResAnmTexSrt, s32, playMode_e);
void play(s32);
f32 getFrame(s32) const;
void setFrame(f32, s32);
void setRate(f32, s32);
bool isStop(s32) const;
bool checkFrame(f32, s32) const;
void setPlayMode(playMode_e, s32);
f32 getFrameMax(s32) const;
void setFrameStart(f32, s32);
f32 getFrameStart(s32) const;
private:
child_c *mpChildren;
};
} // namespace m3d
#endif
+22
View File
@@ -0,0 +1,22 @@
#ifndef M3D_M_ANMVIS_H
#define M3D_M_ANMVIS_H
#include <m/m3d/m_bmdl.h>
#include <m/m3d/m_fanm.h>
namespace m3d {
class anmVis_c : public fanm_c {
public:
virtual ~anmVis_c();
virtual int getType() const override;
bool create(nw4r::g3d::ResMdl, nw4r::g3d::ResAnmVis, mAllocator_c *, u32 *);
void setAnm(m3d::bmdl_c &, nw4r::g3d::ResAnmVis, m3d::playMode_e);
void setFrmCtrlDefault(nw4r::g3d::ResAnmVis &, m3d::playMode_e);
};
} // namespace m3d
#endif
+38
View File
@@ -0,0 +1,38 @@
#ifndef M3D_M_BANM_H
#define M3D_M_BANM_H
#include <egg/core/eggFrmHeap.h>
#include <m/m_allocator.h>
#include <nw4r/g3d/g3d_anmobj.h>
namespace m3d {
class banm_c {
public:
banm_c() : mpAnmObj(nullptr), mpFrameHeap(nullptr) {}
virtual ~banm_c();
virtual int getType() const = 0;
virtual void remove();
virtual void play();
bool createAllocator(mAllocator_c *alloc, u32 *pSize);
bool IsBound() const;
f32 getFrame() const;
void setFrameOnly(f32);
f32 getRate() const;
void setRate(f32);
inline nw4r::g3d::AnmObj *getAnimObj() const {
return mpAnmObj;
}
protected:
nw4r::g3d::AnmObj *mpAnmObj;
EGG::FrmHeap *mpFrameHeap;
mAllocator_c mAllocator;
};
} // namespace m3d
#endif
+85
View File
@@ -0,0 +1,85 @@
#ifndef M3D_BLINE_H
#define M3D_BLINE_H
#include <egg/gfx/eggTexture.h>
#include <m/m3d/m_proc.h>
#include <m/m_math.h>
#include <nw4r/ut/ut_Color.h>
namespace m3d {
// The Actual line
class bline_c {
public:
bline_c() : mpPathArr(0), mpVtxPosArr(0), mpVtxNrmArr(0), mpVtxTexArr(0), mFlags(0) {}
// This is mainly a Guess, When the array is created, it has both a ctor/dtor
struct VtxPos {
mVec3_c pos1;
mVec3_c pos2;
};
struct Vec3u8 {
u8 x, y, z;
};
// This is mainly a Guess, When the array is created, it has only a ctor
struct VtxNrm {
union {
struct {
Vec3u8 nrm1;
Vec3u8 nrm2;
};
EGG::Vector3s nrm_u16; // There is a short by short copy later
};
};
// This is mainly a Guess, When the array is created, it doesnt use the array alloc
struct VtxTex {
f32 tex;
};
/* 0x00 */ u8 field_0x00[0x8];
bool create(EGG::Heap *pHeap, u16 numPts, f32 width, f32 repeat, const nw4r::ut::Color &color);
void update(mVec3_c *startPos);
void remove();
void draw();
// vt at 0x08
virtual ~bline_c();
/* 0x0C */ f32 mWidth; // could be a scale too
/* 0x10 */ nw4r::ut::Color mColor;
/* 0x14 */ mVec3_c *mpPathArr;
/* 0x18 */ VtxPos *mpVtxPosArr;
/* 0x1C */ VtxNrm *mpVtxNrmArr;
/* 0x20 */ VtxTex *mpVtxTexArr;
/* 0x24 */ f32 mTexRepeat; // Higher value causes the texture to repeat more often
/* 0x28 */ u16 mPathNum; // Guess
/* 0x2A */ u16 mVtxNum; // Guess
/* 0x2C */ u16 field_0x2C;
/* 0x2E */ u8 mFlags;
/* 0x2F u8 _pad; */
};
class blineMat_c : public proc_c {
public:
virtual ~blineMat_c();
virtual void remove() override;
virtual void drawOpa() override;
virtual void drawXlu() override;
virtual void setupGX(bool bTransparent);
bool create(mAllocator_c *pAllocator, int numLines, u16 numLinePts, f32 width, f32 repeat, nw4r::ut::Color &color,
EGG::ResTIMG *pTex, bool);
void update();
bline_c *getLine(u16 idx);
/* 0x1C */ mAllocator_c mAllocator;
/* 0x34 */ EGG::ResTIMG *mpTex;
/* 0x38 */ nw4r::ut::List mLines;
/* 0x44 */ bline_c *mpLineArr;
/* 0x48 */ short mLineArrNum;
/* 0x4A */ bool field_0x4A;
};
} // namespace m3d
#endif
+48
View File
@@ -0,0 +1,48 @@
#ifndef M3D_M_BMDL_H
#define M3D_M_BMDL_H
#include <m/m3d/m_banm.h>
#include <m/m3d/m_scnleaf.h>
#include <m/m_math.h>
#include <nw4r/g3d/g3d_scnmdlsmpl.h>
namespace m3d {
class bmdl_c : public scnLeaf_c {
public:
bmdl_c() : mpCurrentAnm(nullptr) {}
virtual ~bmdl_c();
virtual int getType() const override;
virtual void remove() override;
virtual void setAnm(banm_c &anm);
virtual void play();
int getMatID(const char *name) const;
int getNodeID(const char *name) const;
bool getNodeWorldMtx(u32 p1, nw4r::math::MTX34 *out) const;
bool getNodeWorldMtxMultVecZero(u32 p1, nw4r::math::VEC3 &out) const;
bool getNodeWorldMtxMultVec(u32, nw4r::math::VEC3 &, nw4r::math::VEC3 &) const;
nw4r::g3d::ResMdl getResMdl() const;
nw4r::g3d::ResMat getResMat(u32 index) const;
void removeAnm(nw4r::g3d::ScnMdlSimple::AnmObjType);
nw4r::g3d::AnmObj *getAnmObj(nw4r::g3d::ScnMdlSimple::AnmObjType) const;
void setTevColor(u32, GXTevRegID, GXColor, bool);
void setTevColorAll(GXTevRegID, GXColor, bool);
void setTevKColor(u32, GXTevKColorID, GXColor, bool);
void setTevKColorAll(GXTevKColorID, GXColor, bool);
void setBlendModeAll(GXBlendMode, GXBlendFactor, GXBlendFactor, GXLogicOp, bool bMarkDirty);
void setCullMode(u32 matId, GXCullMode cullMode, bool bMarkDirty);
void setCullModeAll(GXCullMode cullMode, bool bMarkDirty);
void setMatVisible(u32 matId, bool bVisble);
int setMatTexture(char *name, GXTexObj *texObj, bool copy, void *unk, int, int);
bool getBounds(mVec3_c *min, mVec3_c *max);
private:
banm_c *mpCurrentAnm;
};
} // namespace m3d
#endif
+49
View File
@@ -0,0 +1,49 @@
#ifndef M3D_M_CALC_RATIO_H
#define M3D_M_CALC_RATIO_H
#include <egg/core/eggFrmHeap.h>
#include <m/m_allocator.h>
namespace m3d {
class calcRatio_c {
public:
calcRatio_c();
virtual ~calcRatio_c();
void remove();
void reset();
void offUpdate();
void set(f32);
void calc();
bool isEnd() const;
f32 get0x10() const {
return mf4;
}
f32 get0x14() const {
return mf5;
}
bool is0x18() const {
return mb1;
}
bool is0x19() const {
return mb2;
}
private:
/* 0x04 */ f32 mf1;
/* 0x08 */ f32 mf2;
/* 0x0C */ f32 mf3;
/* 0x10 */ f32 mf4;
/* 0x14 */ f32 mf5;
/* 0x18 */ bool mb1;
/* 0x19 */ bool mb2;
};
} // namespace m3d
#endif
+58
View File
@@ -0,0 +1,58 @@
#ifndef M3D_M_FANM_H
#define M3D_M_FANM_H
#include <m/m3d/m_banm.h>
namespace m3d {
enum playMode_e {
PLAY_MODE_0,
PLAY_MODE_1,
PLAY_MODE_2,
PLAY_MODE_3,
PLAY_MODE_4,
};
class fanm_c : public banm_c {
public:
fanm_c();
virtual ~fanm_c();
virtual int getType() const = 0;
virtual void play();
void set(f32, playMode_e, f32, f32);
void set2(f32, playMode_e, f32, f32, f32);
void setFrame(f32);
void setFrameOnly(f32);
bool isStop() const;
bool checkFrame(f32) const;
bool unk_802EAE70() const;
inline void setPlayState(playMode_e state) {
mPlayState = state;
}
inline f32 getEndFrame() {
return mEndFrame;
}
// Something about this is wrong
inline void setStartFrame(f32 f) {
mEndFrame = f;
}
inline f32 getStartFrame() {
return mStartFrame;
}
private:
f32 mEndFrame;
f32 mStartFrame;
f32 mCurrentFrame;
u8 mPlayState;
};
} // namespace m3d
#endif
+76
View File
@@ -0,0 +1,76 @@
#ifndef M3D_M_MDL_H
#define M3D_M_MDL_H
#include <m/m3d/m_banm.h>
#include <m/m3d/m_calc_ratio.h>
#include <m/m3d/m_smdl.h>
#include <nw4r/g3d/g3d_anmchr.h>
#include <nw4r/g3d/g3d_calcworld.h>
#include <nw4r/g3d/g3d_resmdl.h>
namespace m3d {
class callback_c {
public:
virtual ~callback_c() {}
virtual void timingA(u32, nw4r::g3d::ChrAnmResult *, nw4r::g3d::ResMdl) {}
virtual void timingB(u32, nw4r::g3d::WorldMtxManip *, nw4r::g3d::ResMdl) {}
virtual void timingC(nw4r::math::MTX34 *, nw4r::g3d::ResMdl) {}
};
class mdl_c : public smdl_c {
public:
class mdlCallback_c : public nw4r::g3d::ICalcWorldCallback {
public:
mdlCallback_c();
virtual ~mdlCallback_c();
bool create(nw4r::g3d::ResMdl, mAllocator_c *, u32 *);
virtual void ExecCallbackA(nw4r::g3d::ChrAnmResult *, nw4r::g3d::ResMdl, nw4r::g3d::FuncObjCalcWorld *);
virtual void ExecCallbackB(nw4r::g3d::WorldMtxManip *, nw4r::g3d::ResMdl, nw4r::g3d::FuncObjCalcWorld *);
virtual void ExecCallbackC(nw4r::math::MTX34 *, nw4r::g3d::ResMdl, nw4r::g3d::FuncObjCalcWorld *);
void remove();
void setBlendFrame(f32);
void calcBlend();
mAllocator_c *getAllocator() {
return mpAlloc;
}
void setBaseCallback(callback_c *cb) {
mpBaseCallback = cb;
}
private:
/* 0x04 */ calcRatio_c mCalcRatio;
/* 0x20 */ int mNumNode;
/* 0x24 */ nw4r::g3d::ChrAnmResult *mpNodes;
/* 0x28 */ callback_c *mpBaseCallback;
/* 0x2C */ mAllocator_c *mpAlloc;
};
mdl_c();
virtual ~mdl_c();
bool create(nw4r::g3d::ResMdl, mAllocator_c *, u32, int, u32 *);
bool create(nw4r::g3d::ResMdl, mdlCallback_c *cb, mAllocator_c *, u32, int, u32 *);
virtual void remove();
void setCallback(callback_c *cb);
void play();
void setAnm(banm_c &);
void setAnm(banm_c &, f32);
private:
/** If we allocated the callback ourselves, this is what we need to free */
mdlCallback_c *mpOwnedCallback;
/** The actual callback to use */
mdlCallback_c *mpCallback;
};
} // namespace m3d
#endif
+21
View File
@@ -0,0 +1,21 @@
#ifndef M_M3D_PROC_H
#define M_M3D_PROC_H
#include <common.h>
#include <m/m3d/m_scnleaf.h>
namespace m3d {
class proc_c : public scnLeaf_c {
public:
virtual ~proc_c();
virtual int getType() const override;
bool create(mAllocator_c *, u32 *);
virtual void drawOpa();
virtual void drawXlu();
};
} // namespace m3d
#endif
+58
View File
@@ -0,0 +1,58 @@
#ifndef M3D_M_SCNLEAF_H
#define M3D_M_SCNLEAF_H
#include <egg/core/eggDisposer.h>
#include <m/m_allocator.h>
#include <nw4r/g3d/g3d_scnobj.h>
namespace m3d {
// NON-OFFICIAL
enum ScnLeafType_e {
SCN_LEAF_MODEL = 0,
SCN_LEAF_PROC = 2,
};
class UnkClass {
public:
UnkClass() {}
};
class scnLeaf_c : UnkClass, EGG::Disposer {
public:
scnLeaf_c();
virtual ~scnLeaf_c();
virtual int getType() const = 0;
virtual void remove();
virtual int entry();
void setOption(u32 flag, u32 set);
void setScale(f32, f32, f32);
void setScale(const nw4r::math::VEC3 &);
void getScale(nw4r::math::VEC3 *) const;
void setLocalMtx(const nw4r::math::MTX34 *);
void getLocalMtx(nw4r::math::MTX34 *) const;
const nw4r::math::MTX34 *getLocalMtx() const;
void getWorldMtx(nw4r::math::MTX34 *) const;
void getViewMtx(nw4r::math::MTX34 *) const;
void setCallback(nw4r::g3d::IScnObjCallback *cb);
nw4r::g3d::IScnObjCallback *swapCallback(nw4r::g3d::IScnObjCallback *cb);
void enableCallbackTiming(nw4r::g3d::ScnObj::Timing);
void enableCallbackOp(nw4r::g3d::ScnObj::ExecOp);
void calc(bool);
void calcVtx(bool);
void calcView(void *, bool);
void setPriorityDraw(int, int);
protected:
nw4r::g3d::ScnLeaf *mpScnLeaf;
};
} // namespace m3d
#endif
+25
View File
@@ -0,0 +1,25 @@
#ifndef M3D_M_SMDL_H
#define M3D_M_SMDL_H
#include <m/m3d/m_bmdl.h>
#include <m/m3d/m_scnleaf.h>
#include <nw4r/g3d/g3d_resmdl.h>
class UnkClass2 {};
namespace m3d {
class smdl_c : public bmdl_c, UnkClass2 {
public:
smdl_c();
virtual ~smdl_c();
bool create(nw4r::g3d::ResMdl mdl, mAllocator_c *alloc, u32 bufferOption, int nView, u32 *pSize);
bool create(nw4r::g3d::ResMdl mdl, mAllocator_c *alloc, u32 bufferOption) {
return create(mdl, alloc, bufferOption, 1, nullptr);
}
};
} // namespace m3d
#endif
+3 -1
View File
@@ -26,6 +26,8 @@ public:
s32 adjustExpHeap();
bool createNewTempFrmHeap(s32 size, EGG::Heap *newHeap, char *heapName, s32 align, u32 unk);
void adjustFrmHeapRestoreCurrent();
static void *allocOnHeap(u32 size, mHeapAllocator_c *allocator);
};
void *operator new[](size_t size, mAllocator_c *);
#endif
+9
View File
@@ -8,6 +8,8 @@
#include "nw4r/nw4r_types.h"
#include <common.h>
#pragma push
#pragma warning off(10402)
class mMtx_c {
public:
mMtx_c(){};
@@ -38,10 +40,15 @@ public:
/* 802f1c40 */ void rot(int, int); // does some werrd operation to rotate the matrix
/* 802f1e60 */ bool quatRelated();
operator nw4r::math::MTX34 *() {
return &nw4rm;
}
public:
union {
EGG::Matrix34f mat;
f32 m[3][4];
nw4r::math::MTX34 nw4rm;
struct {
f32 xx, xy, xz, xw;
f32 yx, yy, yz, yw;
@@ -53,4 +60,6 @@ public:
static mMtx_c Identity;
};
#pragma pop
#endif
+17
View File
@@ -0,0 +1,17 @@
#ifndef M_VIDEO_H
#define M_VIDEO_H
#include <egg/core/eggVideo.h>
namespace mVideo {
// 0x80065590
void create();
extern EGG::Video *m_video;
extern f32 l_fbAspect;
} // namespace mVideo
#endif
+2 -1
View File
@@ -1,7 +1,8 @@
#ifndef NW4R_G3D_3DSMAX_H
#define NW4R_G3D_3DSMAX_H
#include "common.h"
#include "g3d_anmtexsrt.h"
#include "nw4r/g3d/g3d_anmtexsrt.h"
#include "nw4r/math.h"
namespace nw4r {
namespace g3d {
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef NW4R_G3D_ANMCAMERA_H
#define NW4R_G3D_ANMCAMERA_H
#include "common.h"
#include "math_types.h"
#include "nw4r/math/math_types.h"
#include <rvl/GX.h>
+73 -5
View File
@@ -1,7 +1,8 @@
#ifndef NW4R_G3D_ANMCHR_H
#define NW4R_G3D_ANMCHR_H
#include "common.h"
#include "math_types.h"
#include "nw4r/g3d/g3d_anmobj.h"
#include "nw4r/math/math_types.h"
namespace nw4r {
namespace g3d {
@@ -12,13 +13,80 @@ struct ChrAnmResult {
math::MTX34 mMtx; // at 0x1C
};
struct AnmObjChr {};
class AnmObjChrRes;
struct AnmObjChrNode {};
class AnmObjChr : public AnmObj {
public:
struct AnmObjChrBlend {};
enum BindOption {};
static const TypeObj GetTypeObjStatic() {
return TypeObj(TYPE_NAME);
}
virtual ChrAnmResult *GetResult(ChrAnmResult *, u32); // at 0x38
virtual void Attach(int, AnmObjChrRes*); // at 0x3C
virtual void Detach(int); // at 0x40
virtual void DetachAll(); // at 0x44
virtual void SetWeight(int, f32); // at 0x48
virtual f32 GetWeight(int) const; // at 0x4C
virtual void Bind(ResMdl, u32, BindOption) = 0; // at 0x50
virtual void Release(ResMdl, u32, BindOption) = 0; // at 0x54
private:
UNKWORD field_0x10;
UNKWORD field_0x14;
protected:
NW4R_G3D_TYPE_OBJ_DECL(AnmObjChr);
};
class AnmObjChrNode : public AnmObjChr {
public:
static const TypeObj GetTypeObjStatic() {
return TypeObj(TYPE_NAME);
}
inline int Size() {
return mNodeArraySize;
}
AnmObjChrRes *GetNode(int i) {
return mpNodes[i];
}
private:
int mNodeArraySize;
AnmObjChrRes **mpNodes;
protected:
NW4R_G3D_TYPE_OBJ_DECL(AnmObjChrNode);
};
class AnmObjChrBlend : public AnmObjChrNode {
public:
static const TypeObj GetTypeObjStatic() {
return TypeObj(TYPE_NAME);
}
static AnmObjChrBlend *Construct(MEMAllocator*, u32*, ResMdl, int);
protected:
NW4R_G3D_TYPE_OBJ_DECL(AnmObjChrBlend);
};
class AnmObjChrRes : public AnmObjChr, public FrameCtrl {
public:
static const TypeObj GetTypeObjStatic() {
return TypeObj(TYPE_NAME);
}
static AnmObjChrRes *Construct(MEMAllocator*, u32*, ResAnmChr, ResMdl, bool);
protected:
NW4R_G3D_TYPE_OBJ_DECL(AnmObjChrRes);
};
struct AnmObjChrRes {};
} // namespace g3d
} // namespace nw4r
+69
View File
@@ -1,6 +1,8 @@
#ifndef NW4R_G3D_ANMCLR_H
#define NW4R_G3D_ANMCLR_H
#include "common.h"
#include "nw4r/g3d/g3d_anmobj.h"
#include "nw4r/g3d/g3d_resanmclr.h"
namespace nw4r {
namespace g3d {
@@ -11,6 +13,73 @@ struct ClrAnmResult {
u32 COLORS_0x4[ANM_COUNT];
UNKWORD WORDS_0x30[ANM_COUNT];
};
class AnmObjMatClrRes;
class AnmObjMatClr : public AnmObj {
public:
static const G3dObj::TypeObj GetTypeObjStatic() {
return TypeObj(TYPE_NAME);
}
virtual ClrAnmResult *GetResult(); // at 0x38
virtual void Attach(s32, AnmObjMatClrRes *res); // at 0x3C
virtual void Detach(s32); // at 0x40
private:
int mChildrenArraySize;
u16 *mpChildrenArray;
NW4R_G3D_TYPE_OBJ_DECL(AnmObjMatClr);
};
class AnmObjMatClrNode : public AnmObjMatClr {
public:
static const G3dObj::TypeObj GetTypeObjStatic() {
return TypeObj(TYPE_NAME);
}
inline int Size() {
return mNodeArraySize;
}
AnmObjMatClrRes *GetNode(int i) {
return mpNodes[i];
}
private:
int mNodeArraySize;
AnmObjMatClrRes **mpNodes;
NW4R_G3D_TYPE_OBJ_DECL(AnmObjMatClrNode);
};
class AnmObjMatClrRes : public AnmObjMatClr, public FrameCtrl {
public:
static const G3dObj::TypeObj GetTypeObjStatic() {
return TypeObj(TYPE_NAME);
}
static AnmObjMatClrRes *Construct(MEMAllocator *, u32 *, ResAnmClr, ResMdl, bool);
private:
ResAnmClr mRes;
TexSrtAnmResult *mpResultCache;
NW4R_G3D_TYPE_OBJ_DECL(AnmObjMatClrRes);
};
class AnmObjMatClrOverride : public AnmObjMatClrNode {
public:
static const G3dObj::TypeObj GetTypeObjStatic() {
return TypeObj(TYPE_NAME);
}
static AnmObjMatClrOverride *Construct(MEMAllocator *, u32 *, ResMdl, int);
NW4R_G3D_TYPE_OBJ_DECL(AnmObjMatClrOverride);
};
} // namespace g3d
} // namespace nw4r
+3 -3
View File
@@ -1,9 +1,9 @@
#ifndef NW4R_G3D_ANMOBJ_H
#define NW4R_G3D_ANMOBJ_H
#include "common.h"
#include "g3d_obj.h"
#include "g3d_rescommon.h"
#include "g3d_resmdl.h"
#include "nw4r/g3d/g3d_obj.h"
#include "nw4r/g3d/g3d_rescommon.h"
#include "nw4r/g3d/g3d_resmdl.h"
namespace nw4r {
namespace g3d {
+4 -4
View File
@@ -1,10 +1,10 @@
#ifndef NW4R_G3D_ANMSCN_H
#define NW4R_G3D_ANMSCN_H
#include "common.h"
#include "g3d_camera.h"
#include "g3d_fog.h"
#include "g3d_light.h"
#include "g3d_obj.h"
#include "nw4r/g3d/g3d_camera.h"
#include "nw4r/g3d/g3d_fog.h"
#include "nw4r/g3d/g3d_light.h"
#include "nw4r/g3d/g3d_obj.h"
namespace nw4r {
namespace g3d {
+99
View File
@@ -0,0 +1,99 @@
#ifndef NW4R_G3D_ANMSHP_H
#define NW4R_G3D_ANMSHP_H
#include "common.h"
#include "nw4r/g3d/g3d_anmobj.h"
#include "nw4r/g3d/g3d_resanmshp.h"
// This header is based on the SS ghidra, the TypeNames in the binary,
// and an assumed symmetry to AnmObjVis. Everything about it could be wrong.
namespace nw4r {
namespace g3d {
class AnmObjShpRes;
class AnmObjShp : public AnmObj {
public:
AnmObjShp(MEMAllocator *, u16 *, int);
virtual bool IsDerivedFrom(TypeObj other) const // at 0x8
{
return (other == GetTypeObjStatic()) ? true : AnmObj::IsDerivedFrom(other);
}
virtual void G3dProc(u32, u32, void *); // at 0xC
virtual ~AnmObjShp() {} // at 0x10
virtual const TypeObj GetTypeObj() const // at 0x14
{
return TypeObj(TYPE_NAME);
}
virtual const char *GetTypeName() const // at 0x18
{
return GetTypeObj().GetTypeName();
}
virtual void SetFrame(f32) = 0; // at 0x1C
virtual f32 GetFrame() const = 0; // at 0x20
virtual void UpdateFrame() = 0; // at 0x24
virtual void SetUpdateRate(f32) = 0; // at 0x28
virtual f32 GetUpdateRate() const = 0; // at 0x2C
virtual bool Bind(ResMdl) = 0; // at 0x30
virtual void Release(); // at 0x34
virtual bool GetResult(u32) = 0; // at 0x38
virtual AnmObjShpRes *Attach(int, AnmObjShpRes *); // at 0x3C
virtual AnmObjShpRes *Detach(int); // at 0x40
static const TypeObj GetTypeObjStatic() {
return TypeObj(TYPE_NAME);
}
bool TestDefined(u32 idx) const;
bool TestExistence(u32 idx) const;
void DetachAll();
protected:
static const int MAX_RESOURCES = 4;
int mNumBinds; // at 0x10
u16 *mBinds; // at 0x14
NW4R_G3D_TYPE_OBJ_DECL(AnmObjShp);
};
class AnmObjShpRes : public AnmObjShp, public FrameCtrl {
public:
AnmObjShpRes(MEMAllocator *, ResAnmShp, u16 *, int);
virtual bool IsDerivedFrom(TypeObj other) const // at 0x8
{
return (other == GetTypeObjStatic()) ? true : AnmObjShp::IsDerivedFrom(other);
}
virtual ~AnmObjShpRes() {} // at 0x10
virtual const TypeObj GetTypeObj() const // at 0x14
{
return TypeObj(TYPE_NAME);
}
virtual const char *GetTypeName() const // at 0x18
{
return GetTypeObj().GetTypeName();
}
virtual void SetFrame(f32); // at 0x1C
virtual f32 GetFrame() const; // at 0x20
virtual void UpdateFrame(); // at 0x24
virtual void SetUpdateRate(f32); // at 0x28
virtual f32 GetUpdateRate() const; // at 0x2C
virtual bool Bind(ResMdl); // at 0x30
virtual bool GetResult(u32); // at 0x38
static const TypeObj GetTypeObjStatic() {
return TypeObj(TYPE_NAME);
}
static AnmObjShpRes *Construct(MEMAllocator *, u32 *, ResAnmShp, ResMdl, int);
private:
ResAnmShp mResAnmShp; // at 0x2C
NW4R_G3D_TYPE_OBJ_DECL(AnmObjShpRes);
};
} // namespace g3d
} // namespace nw4r
#endif
+72 -2
View File
@@ -1,6 +1,8 @@
#ifndef NW4R_G3D_ANMTEXPAT_H
#define NW4R_G3D_ANMTEXPAT_H
#include "g3d_restex.h"
#include "nw4r/g3d/g3d_anmobj.h"
#include "nw4r/g3d/g3d_restex.h"
#include "nw4r/g3d/g3d_resanmtexpat.h"
namespace nw4r
{
@@ -18,7 +20,75 @@ namespace nw4r
ResTex mTexs[ANM_COUNT]; // at 0x4
ResPltt mPltts[ANM_COUNT]; // at 0x24
};
class AnmObjTexPatRes;
class AnmObjTexPat : public AnmObj {
public:
static const G3dObj::TypeObj GetTypeObjStatic() {
return TypeObj(TYPE_NAME);
}
virtual TexPatAnmResult *GetResult(); // at 0x38
virtual void Attach(s32, AnmObjTexPatRes *res); // at 0x3C
virtual void Detach(s32); // at 0x40
private:
int mChildrenArraySize;
u16 *mpChildrenArray;
NW4R_G3D_TYPE_OBJ_DECL(AnmObjTexPat);
};
class AnmObjTexPatNode : public AnmObjTexPat {
public:
static const G3dObj::TypeObj GetTypeObjStatic() {
return TypeObj(TYPE_NAME);
}
inline int Size() {
return mNodeArraySize;
}
AnmObjTexPatRes *GetNode(int i) {
return mpNodes[i];
}
private:
int mNodeArraySize;
AnmObjTexPatRes **mpNodes;
NW4R_G3D_TYPE_OBJ_DECL(AnmObjTexPatNode);
};
class AnmObjTexPatRes : public AnmObjTexPat, public FrameCtrl {
public:
static const G3dObj::TypeObj GetTypeObjStatic() {
return TypeObj(TYPE_NAME);
}
static AnmObjTexPatRes *Construct(MEMAllocator*, u32*, ResAnmTexPat, ResMdl, bool);
private:
ResAnmTexPat mRes;
TexPatAnmResult *mpResultCache;
NW4R_G3D_TYPE_OBJ_DECL(AnmObjTexPatRes);
};
class AnmObjTexPatOverride : public AnmObjTexPatNode {
public:
static const G3dObj::TypeObj GetTypeObjStatic() {
return TypeObj(TYPE_NAME);
}
static AnmObjTexPatOverride *Construct(MEMAllocator*, u32*, ResMdl, int);
NW4R_G3D_TYPE_OBJ_DECL(AnmObjTexPatOverride);
};
}
}
#endif
#endif
+72 -2
View File
@@ -1,11 +1,81 @@
#ifndef NW4R_G3D_ANMTEXSRT_H
#define NW4R_G3D_ANMTEXSRT_H
#include "g3d_restex.h"
#include "nw4r/g3d/g3d_restex.h"
#include "nw4r/g3d/g3d_resanmtexsrt.h"
namespace nw4r
{
namespace g3d
{
class AnmObjTexSrtRes;
struct TexSrtAnmResult;
class AnmObjTexSrt : public AnmObj {
public:
static const G3dObj::TypeObj GetTypeObjStatic() {
return TypeObj(TYPE_NAME);
}
virtual TexSrtAnmResult *GetResult(); // at 0x38
virtual void Attach(s32, AnmObjTexSrtRes *res); // at 0x3C
virtual void Detach(s32); // at 0x40
private:
int mChildrenArraySize;
u16 *mpChildrenArray;
NW4R_G3D_TYPE_OBJ_DECL(AnmObjTexSrt);
};
class AnmObjTexSrtNode : public AnmObjTexSrt {
public:
static const G3dObj::TypeObj GetTypeObjStatic() {
return TypeObj(TYPE_NAME);
}
inline int Size() {
return mNodeArraySize;
}
AnmObjTexSrtRes *GetNode(int i) {
return mpNodes[i];
}
private:
int mNodeArraySize;
AnmObjTexSrtRes **mpNodes;
NW4R_G3D_TYPE_OBJ_DECL(AnmObjTexSrtNode);
};
class AnmObjTexSrtRes : public AnmObjTexSrt, public FrameCtrl {
public:
static const G3dObj::TypeObj GetTypeObjStatic() {
return TypeObj(TYPE_NAME);
}
static AnmObjTexSrtRes *Construct(MEMAllocator*, u32*, ResAnmTexSrt, ResMdl, bool);
private:
ResAnmTexSrt mRes;
TexSrtAnmResult *mpResultCache;
NW4R_G3D_TYPE_OBJ_DECL(AnmObjTexSrtRes);
};
class AnmObjTexSrtOverride : public AnmObjTexSrtNode {
public:
static const G3dObj::TypeObj GetTypeObjStatic() {
return TypeObj(TYPE_NAME);
}
static AnmObjTexSrtOverride *Construct(MEMAllocator*, u32*, ResMdl, int);
NW4R_G3D_TYPE_OBJ_DECL(AnmObjTexSrtOverride);
};
struct TexSrtTypedef
{
enum TexMatrixMode
@@ -44,4 +114,4 @@ namespace nw4r
}
}
#endif
#endif
+2 -2
View File
@@ -1,8 +1,8 @@
#ifndef NW4R_G3D_ANMVIS_H
#define NW4R_G3D_ANMVIS_H
#include "common.h"
#include "g3d_anmobj.h"
#include "g3d_resanmvis.h"
#include "nw4r/g3d/g3d_anmobj.h"
#include "nw4r/g3d/g3d_resanmvis.h"
namespace nw4r {
namespace g3d {
+3 -3
View File
@@ -1,7 +1,7 @@
#ifndef NW4R_G3D_BASIC_H
#define NW4R_G3D_BASIC_H
#include "math_types.h"
#include "g3d_anmchr.h"
#include "nw4r/math/math_types.h"
#include "nw4r/g3d/g3d_anmchr.h"
namespace nw4r
{
@@ -45,4 +45,4 @@ namespace nw4r
}
}
#endif
#endif
+1
View File
@@ -1,6 +1,7 @@
#ifndef NW4R_G3D_CALC_VIEW_H
#define NW4R_G3D_CALC_VIEW_H
#include "common.h"
#include "nw4r/math.h"
namespace nw4r {
namespace g3d {
+30
View File
@@ -1,9 +1,39 @@
#ifndef NW4R_G3D_CALC_WORLD_H
#define NW4R_G3D_CALC_WORLD_H
#include "common.h"
#include "nw4r/math.h"
namespace nw4r {
namespace g3d {
struct FuncObjCalcWorld {
private:
u8 UNK_0x00[0x06];
/** 0x06 */ u16 mNodeId;
public:
u32 GetNodeId() const {
return mNodeId;
}
void SetNodeId(u32 n) {
mNodeId = n;
}
};
class WorldMtxManip {};
// Name from ketteiban
class ICalcWorldCallback {
public:
virtual ~ICalcWorldCallback() {}
virtual void ExecCallbackA(nw4r::g3d::ChrAnmResult *, nw4r::g3d::ResMdl, nw4r::g3d::FuncObjCalcWorld *) {}
virtual void ExecCallbackB(nw4r::g3d::WorldMtxManip *, nw4r::g3d::ResMdl, nw4r::g3d::FuncObjCalcWorld *) {}
virtual void ExecCallbackC(nw4r::math::MTX34 *, nw4r::g3d::ResMdl, nw4r::g3d::FuncObjCalcWorld *) {}
};
void CalcWorld(math::MTX34 *, u32 *, const u8 *, const math::MTX34 *, ResMdl, AnmObjChr *, FuncObjCalcWorld *, u32);
void CalcWorld(math::MTX34 *, u32 *, const u8 *, const math::MTX34 *, ResMdl, AnmObjChr *, FuncObjCalcWorld *);
+2 -2
View File
@@ -1,8 +1,8 @@
#ifndef NW4R_G3D_CAMERA_H
#define NW4R_G3D_CAMERA_H
#include "common.h"
#include "g3d_rescommon.h"
#include "math_types.h"
#include "nw4r/g3d/g3d_rescommon.h"
#include "nw4r/math/math_types.h"
#include <rvl/MTX.h>
+2 -1
View File
@@ -1,7 +1,8 @@
#ifndef NW4R_G3D_DCC_H
#define NW4R_G3D_DCC_H
#include "common.h"
#include "g3d_anmtexsrt.h"
#include "nw4r/math.h"
#include "nw4r/g3d/g3d_anmtexsrt.h"
namespace nw4r {
namespace g3d {
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef NW4R_G3D_DRAW_H
#define NW4R_G3D_DRAW_H
#include "common.h"
#include "g3d_resmdl.h"
#include "nw4r/g3d/g3d_resmdl.h"
namespace nw4r {
namespace g3d {
+2 -2
View File
@@ -1,8 +1,8 @@
#ifndef NW4R_G3D_DRAW1_MAT1_SHP_H
#define NW4R_G3D_DRAW1_MAT1_SHP_H
#include "common.h"
#include "g3d_resmat.h"
#include "g3d_resshp.h"
#include "nw4r/g3d/g3d_resmat.h"
#include "nw4r/g3d/g3d_resshp.h"
namespace nw4r {
namespace g3d {
+3 -3
View File
@@ -1,9 +1,9 @@
#ifndef NW4R_G3D_FOG_H
#define NW4R_G3D_FOG_H
#include "common.h"
#include "g3d_rescommon.h"
#include "math_types.h"
#include "ut_Color.h"
#include "nw4r/g3d/g3d_rescommon.h"
#include "nw4r/math/math_types.h"
#include "nw4r/ut/ut_Color.h"
#include <rvl/GX.h>
+2 -2
View File
@@ -1,8 +1,8 @@
#ifndef NW4R_G3D_GPU_H
#define NW4R_G3D_GPU_H
#include "common.h"
#include "g3d_rescommon.h"
#include "math_types.h"
#include "nw4r/g3d/g3d_rescommon.h"
#include "nw4r/math/math_types.h"
#include <rvl/GX.h>
-6
View File
@@ -5,12 +5,6 @@
namespace nw4r {
namespace g3d {
inline void InitFastCast() {
OSInitFastCast();
OSSetGQR6(7, 5);
OSSetGQR7(7, 8);
}
void G3dInit(bool);
void G3dReset();
} // namespace g3d
+2 -1
View File
@@ -1,7 +1,8 @@
#ifndef NW4R_G3D_LIGHT_H
#define NW4R_G3D_LIGHT_H
#include "common.h"
#include "g3d_rescommon.h"
#include "nw4r/g3d/g3d_rescommon.h"
#include "nw4r/math.h"
#include <rvl/GX.h>
+2 -1
View File
@@ -1,7 +1,8 @@
#ifndef NW4R_G3D_MAYA_H
#define NW4R_G3D_MAYA_H
#include "common.h"
#include "g3d_anmtexsrt.h"
#include "nw4r/g3d/g3d_anmtexsrt.h"
#include "nw4r/math.h"
namespace nw4r {
namespace g3d {
+5 -1
View File
@@ -90,6 +90,7 @@ public:
}
void Destroy();
void DetachFromParent();
G3dObj(MEMAllocator *pAllocator, G3dObj *pParent) : mAllocator(pAllocator), mParent(pParent) {}
@@ -115,7 +116,10 @@ public:
template <typename T>
static T *DynamicCast(G3dObj *obj) {
return (obj != NULL && obj->IsDerivedFrom(T::GetTypeObjStatic())) ? static_cast<T *>(obj) : NULL;
if (obj != nullptr && obj->IsDerivedFrom(T::GetTypeObjStatic())) {
return static_cast<T *>(obj);
}
return nullptr;
}
private:
+2 -2
View File
@@ -1,8 +1,8 @@
#ifndef NW4R_G3D_RESANMCAMERA_H
#define NW4R_G3D_RESANMCAMERA_H
#include "common.h"
#include "g3d_anmcamera.h"
#include "g3d_rescommon.h"
#include "nw4r/g3d/g3d_anmcamera.h"
#include "nw4r/g3d/g3d_rescommon.h"
namespace nw4r {
namespace g3d {
+16 -1
View File
@@ -1,13 +1,18 @@
#ifndef NW4R_G3D_RESANMCHR_H
#define NW4R_G3D_RESANMCHR_H
#include "common.h"
#include "g3d_rescommon.h"
#include "nw4r/g3d/g3d_rescommon.h"
namespace nw4r {
namespace g3d {
struct ResAnmChrData {
char UNK_0x0[0x8];
u32 mRevision; // at 0x8
char UNK_0xC[0x4];
s32 mMatDictOffset; // at 0x10
char UNK_0x14[0x0C];
u16 mNumFrames; // at 0x20
AnmPolicy mAnmPolicy; // at 0x24
};
struct ResAnmChr {
@@ -20,6 +25,16 @@ struct ResAnmChr {
inline bool CheckRevision() const {
return mAnmChr.ref().mRevision == REVISION;
}
AnmPolicy GetAnmPolicy() const
{
return mAnmChr.ref().mAnmPolicy;
}
int GetNumFrame() const
{
return mAnmChr.ref().mNumFrames;
}
};
} // namespace g3d
} // namespace nw4r
+17 -3
View File
@@ -1,7 +1,8 @@
#ifndef NW4R_G3D_RESANMCLR_H
#define NW4R_G3D_RESANMCLR_H
#include "g3d_resdict.h"
#include "g3d_resanm.h"
#include "nw4r/g3d/g3d_resdict.h"
#include "nw4r/g3d/g3d_resanm.h"
#include "nw4r/g3d/g3d_anmclr.h"
namespace nw4r
{
@@ -32,6 +33,9 @@ namespace nw4r
char UNK_0xC[0x4];
s32 mMatDictOffset; // at 0x10
ResAnmClrInfoData mInfo; // at 0x14
char UNK_0x1E[0x2];
u16 mNumFrames; // at 0x20
AnmPolicy mAnmPolicy; // at 0x24
};
struct ResAnmClr
@@ -54,6 +58,16 @@ namespace nw4r
{
return ref().mRevision == REVISION;
}
AnmPolicy GetAnmPolicy() const
{
return ref().mAnmPolicy;
}
int GetNumFrame() const
{
return ref().mNumFrames;
}
inline const ResAnmClrMatData * GetMatAnm(u32 i) const
{
@@ -65,4 +79,4 @@ namespace nw4r
}
}
#endif
#endif
+2 -2
View File
@@ -1,8 +1,8 @@
#ifndef NW4R_G3D_RESANMFOG_H
#define NW4R_G3D_RESANMFOG_H
#include "common.h"
#include "g3d_anmfog.h"
#include "g3d_rescommon.h"
#include "nw4r/g3d/g3d_anmfog.h"
#include "nw4r/g3d/g3d_rescommon.h"
namespace nw4r {
namespace g3d {
+3 -3
View File
@@ -1,9 +1,9 @@
#ifndef NW4R_G3D_RESANMSCN_H
#define NW4R_G3D_RESANMSCN_H
#include "common.h"
#include "g3d_resanmcamera.h"
#include "g3d_resanmfog.h"
#include "g3d_rescommon.h"
#include "nw4r/g3d/g3d_resanmcamera.h"
#include "nw4r/g3d/g3d_resanmfog.h"
#include "nw4r/g3d/g3d_rescommon.h"
namespace nw4r {
namespace g3d {
+13 -1
View File
@@ -1,13 +1,17 @@
#ifndef NW4R_G3D_RESANMSHP_H
#define NW4R_G3D_RESANMSHP_H
#include "common.h"
#include "g3d_rescommon.h"
#include "nw4r/g3d/g3d_anmobj.h"
#include "nw4r/g3d/g3d_rescommon.h"
namespace nw4r {
namespace g3d {
struct ResAnmShpData {
char UNK_0x0[0x8];
u32 mRevision; // at 0x8
char UNK_0xC[0x24 - 0xC];
u16 mNumFrames; // at 0x24
AnmPolicy mAnmPolicy; // at 0x28
};
struct ResAnmShp {
@@ -20,6 +24,14 @@ struct ResAnmShp {
inline bool CheckRevision() const {
return mAnmShp.ref().mRevision == REVISION;
}
AnmPolicy GetAnmPolicy() const {
return mAnmShp.ref().mAnmPolicy;
}
int GetNumFrame() const {
return mAnmShp.ref().mNumFrames;
}
};
} // namespace g3d
} // namespace nw4r
+16 -3
View File
@@ -1,7 +1,8 @@
#ifndef NW4R_G3D_RESANMTEXPAT_H
#define NW4R_G3D_RESANMTEXPAT_H
#include "g3d_resdict.h"
#include "g3d_resanm.h"
#include "nw4r/g3d/g3d_resdict.h"
#include "nw4r/g3d/g3d_resfile.h"
#include "nw4r/g3d/g3d_resanm.h"
namespace nw4r
{
@@ -51,6 +52,8 @@ namespace nw4r
char UNK_0x24[0xC];
u16 mTexCount; // at 0x30
u16 mPlttCount; // at 0x32
char UNK_0x34[0x4];
AnmPolicy mAnmPolicy; // at 0x38
};
struct ResAnmTexPat
@@ -78,6 +81,16 @@ namespace nw4r
{
return static_cast<const ResAnmTexPatMatData *>(mAnmTexPat.ofs_to_obj<ResDic>(ref().mMatDictOffset)[i]);
}
AnmPolicy GetAnmPolicy() const
{
return ref().mAnmPolicy;
}
int GetNumFrame() const
{
return ref().mTexCount;
}
void GetAnmResult(TexPatAnmResult *, u32, float) const;
@@ -87,4 +100,4 @@ namespace nw4r
}
}
#endif
#endif
+18 -3
View File
@@ -1,7 +1,8 @@
#ifndef NW4R_G3D_RESANMTEXSRT_H
#define NW4R_G3D_RESANMTEXSRT_H
#include "g3d_resanm.h"
#include "g3d_resdict.h"
#include "nw4r/g3d/g3d_resanm.h"
#include "nw4r/g3d/g3d_resdict.h"
#include "nw4r/g3d/g3d_anmtexsrt.h"
namespace nw4r
{
@@ -27,6 +28,10 @@ namespace nw4r
u32 mRevision; // at 0x8
char UNK_0xC[0x4];
s32 mMatDictOffset; // at 0x10
char UNK_0x14[0x0C];
u16 mNumFrames; // at 0x20
UNKWORD UNK_0x24;
AnmPolicy mAnmPolicy; // at 0x28
};
struct ResAnmTexSrt
@@ -54,10 +59,20 @@ namespace nw4r
{
return static_cast<const ResAnmTexSrtMatData *>(mAnmTexSrt.ofs_to_obj<ResDic>(ref().mMatDictOffset)[i]);
}
AnmPolicy GetAnmPolicy() const
{
return ref().mAnmPolicy;
}
int GetNumFrame() const
{
return ref().mNumFrames;
}
void GetAnmResult(TexSrtAnmResult *, u32, float) const;
};
}
}
#endif
#endif
+7 -7
View File
@@ -1,8 +1,8 @@
#ifndef NW4R_G3D_RESANMVIS_H
#define NW4R_G3D_RESANMVIS_H
#include "g3d_resdict.h"
#include "g3d_resanm.h"
#include "g3d_anmobj.h"
#include "nw4r/g3d/g3d_resdict.h"
#include "nw4r/g3d/g3d_resanm.h"
#include "nw4r/g3d/g3d_anmobj.h"
namespace nw4r
{
@@ -10,10 +10,10 @@ namespace nw4r
{
struct ResAnmVisInfoData
{
char UNK_0x0[0x8];
u16 mNumFrames; // at 0x1C
char UNK_0x0[0xC];
u16 mNumFrames; // at 0x20
u16 mNumNodes;
AnmPolicy mAnmPolicy; // at 0x20
AnmPolicy mAnmPolicy; // at 0x24
};
struct ResAnmVisNodeData
@@ -79,4 +79,4 @@ namespace nw4r
}
}
#endif
#endif
+15 -15
View File
@@ -1,31 +1,31 @@
#ifndef NW4R_G3D_RESDICT_H
#define NW4R_G3D_RESDICT_H
#include "common.h"
#include "g3d_rescommon.h"
#include "nw4r/g3d/g3d_rescommon.h"
#include <string.h>
namespace nw4r {
namespace g3d {
struct ResDicEntry {
u16 INT_0x0; // at 0x0
u16 INT_0x2; // at 0x2
u16 unk_index; // at 0x4
u16 unk_index2; // at 0x6
u32 INT_0x8; // at 0x8
u32 INT_0xC; // at 0xC
struct ResDicNodeData {
u16 ref; // at 0x0
u16 flag; // at 0x2
u16 idxLeft; // at 0x4
u16 idxRight; // at 0x6
u32 ofsString; // at 0x8
u32 ofsData; // at 0xC
};
struct ResDicData {
u32 mSize; // at 0x0
u32 mNumData; // at 0x4
ResDicEntry mEntries[]; // 0x8
u32 size; // at 0x0
u32 numData; // at 0x4
ResDicNodeData data[1]; // 0x8
};
struct ResDic {
ResCommon<ResDicData> mDict;
ResDicEntry *Get(ResName) const;
ResDicEntry *Get(const char *, u32) const;
ResDicNodeData *Get(ResName) const;
ResDicNodeData *Get(const char *, u32) const;
void *operator[](const char *) const;
void *operator[](ResName) const;
s32 GetIndex(ResName) const;
@@ -34,7 +34,7 @@ struct ResDic {
inline void *operator[](int i) const {
if (mDict.IsValid()) {
return (void *)mDict.ofs_to_ptr<void>(mDict.ref().mEntries[i + 1].INT_0xC);
return (void *)mDict.ofs_to_ptr<void>(mDict.ref().data[i + 1].ofsData);
}
return NULL;
@@ -42,7 +42,7 @@ struct ResDic {
inline u32 GetNumData() const {
if (mDict.IsValid()) {
return mDict.ref().mNumData;
return mDict.ref().numData;
}
return 0;
+6 -3
View File
@@ -1,9 +1,9 @@
#ifndef NW4R_G3D_RESFILE_H
#define NW4R_G3D_RESFILE_H
#include "common.h"
#include "g3d_rescommon.h"
#include "g3d_resdict.h"
#include "ut_binaryFileFormat.h"
#include "nw4r/g3d/g3d_rescommon.h"
#include "nw4r/g3d/g3d_resdict.h"
#include "nw4r/ut/ut_binaryFileFormat.h"
namespace nw4r {
namespace g3d {
@@ -18,6 +18,9 @@ struct ResFileData {
struct ResFile {
ResCommon<ResFileData> mFile; // at 0x0
ResFile(): mFile((void*)nullptr) {}
ResFile(void *ptr): mFile(ptr) {}
inline ResFileData &ref() const {
return mFile.ref();
}
+114 -30
View File
@@ -1,21 +1,63 @@
#ifndef NW4R_G3D_RESMAT_H
#define NW4R_G3D_RESMAT_H
#include "common.h"
#include "g3d_rescommon.h"
#include "math_types.h"
#include "nw4r/g3d/g3d_rescommon.h"
#include "nw4r/math/math_types.h"
#include <rvl/GX.h>
namespace nw4r {
namespace g3d {
struct ResMatTexCoordGenData {};
struct ResMatTexCoordGen {
ResCommon<ResMatTexCoordGenData> mTexGen; // at 0x0
struct ResTevColorDL {
union {
struct {
u8 tevColor[3][20]; // offset 0x0, size 0x3C
u8 _0[4]; // offset 0x3C, size 0x4
u8 tevKColor[4][10]; // offset 0x40, size 0x28
u8 _1[24]; // offset 0x68, size 0x18
} dl;
u8 data[128];
};
};
inline ResMatTexCoordGen(void *vptr) : mTexGen(vptr) {}
struct ResMatTevColor : public ResCommon<ResTevColorDL> {
ResMatTevColor(void *vptr) : ResCommon<ResTevColorDL>(vptr) {}
void DCStore(bool sync);
void CallDisplayList(bool bSync) const;
ResMatTevColor CopyTo(void *p) const;
void GXGetTevColor(GXTevRegID id, GXColor *color);
void GXSetTevColor(GXTevRegID id, GXColor color);
void GXSetTevKColor(GXTevKColorID id, GXColor color);
};
struct ResPixDL {
union {
struct {
unsigned char alphaCompare[5]; // offset 0x0, size 0x5
unsigned char zMode[5]; // offset 0x5, size 0x5
unsigned char blendMode[10]; // offset 0xA, size 0xA
unsigned char setDstAlpha[5]; // offset 0x14, size 0x5
unsigned char _[7]; // offset 0x19, size 0x7
} dl; // offset 0x0, size 0x20
unsigned char data[32]; // offset 0x0, size 0x20
};
};
struct ResMatPix : public ResCommon<ResPixDL> {
ResMatPix(void *vptr) : ResCommon(vptr) {}
void DCStore(bool sync);
void CallDisplayList(bool bSync) const;
ResMatPix CopyTo(void *p) const;
void GXSetBlendMode(GXBlendMode, GXBlendFactor, GXBlendFactor, GXLogicOp);
};
struct ResTexCoordGenDL {};
struct ResMatTexCoordGen : public ResCommon<ResTexCoordGenDL> {
inline ResMatTexCoordGen(void *vptr) : ResCommon(vptr) {}
bool IsValid() const {
return mTexGen.IsValid();
return ResCommon::IsValid();
}
bool GXGetTexCoordGen2(GXTexCoordID, GXTexGenType *, GXTexGenSrc *, u8 *, u32 *);
@@ -23,15 +65,18 @@ struct ResMatTexCoordGen {
void DCStore(bool);
};
struct ResTexSrtData {};
struct ResTexSrtData {
union {
struct {
unsigned char texCoordGen[8][18]; // offset 0x0, size 0x90
unsigned char _[16]; // offset 0x90, size 0x10
} dl; // offset 0x0, size 0xA0
unsigned char data[160]; // offset 0x0, size 0xA0
};
};
struct ResTexSrt {
ResCommon<ResTexSrtData> mTexSrt; // at 0x0
inline ResTexSrt(void *vptr) : mTexSrt(vptr) {}
bool IsValid() const {
return mTexSrt.IsValid();
}
struct ResTexSrt : public ResCommon<ResTexSrtData> {
inline ResTexSrt(void *vptr) : ResCommon(vptr) {}
void SetMapMode(u32, u32, int, int);
};
@@ -52,32 +97,71 @@ struct ResTexPlttInfo {
};
struct ResMatDLData {
char UNK_0x0[0xE0];
ResMatTexCoordGenData texCoordGenData; // at 0xE0
ResPixDL dlPix; // offset 0x0, size 0x20
ResTevColorDL dlTevColor; // offset 0x20, size 0x80
/* ResIndMtxAndScaleDL */ u8 dlIndMtxAndScale[0x40]; // offset 0xA0, size 0x40
ResTexCoordGenDL dlTexCoordGen; // offset 0xE0, size 0xA0
};
struct ResGenModeData {
u8 nTexGens; // offset 0x0, size 0x1
u8 nChans; // offset 0x1, size 0x1
u8 nTevs; // offset 0x2, size 0x1
u8 nInds; // offset 0x3, size 0x1
GXCullMode cullMode; // offset 0x4, size 0x4
};
struct ResGenMode : public ResCommon<ResGenModeData> {
ResGenMode(void *vptr) : ResCommon(vptr) {}
void DCStore(bool sync);
ResGenMode CopyTo(void *p) const;
GXCullMode GXGetCullMode();
u8 GXGetNumIndStages() const;
u8 GXGetNumTevStages() const;
u8 GXGetNumChans() const;
u8 GXGetNumTexGens() const;
void GXSetCullMode(GXCullMode);
};
struct ResMatData {
char UNK_0x0[0x38];
u32 resMatDLOfs; // at 0x38
char UNK_0x3C[0x1A4 - 0x3C];
ResTexSrtData texSrtData; // at 0x1A4
u32 size; // offset 0x0, size 0x4
s32 toResMdlData; // offset 0x4, size 0x4
s32 name; // offset 0x8, size 0x4
u32 id; // offset 0xC, size 0x4
u32 flag; // offset 0x10, size 0x
ResGenModeData genMode; // offset 0x14, size 0x8
/* ResMatMiscData */ u8 misc[0xC]; // offset 0x1C, size 0xC
s32 toResTevData; // offset 0x28, size 0x4
u32 numResTexPlttInfo; // offset 0x2C, size 0x4
s32 toResTexPlttInfo; // offset 0x30, size 0x4
s32 toResMatFurData; // offset 0x34, size 0x4
u32 toResUserData; // offset 0x38, size 0x4
u32 toResMatDLData; // offset 0x3C, size 0x4
/* ResTexObjData */ u8 texObjData[0x104]; // offset 0x40, size 0x104
/* ResTlutObjData */ u8 tlutObjData[0x64]; // offset 0x144, size 0x64
ResTexSrtData texSrtData; // offset 0x1A8, size 0x248
/* ResChanData */ u8 chan[0x20]; // offset 0x3F0, size 0x28
};
struct ResMat {
ResCommon<ResMatData> mMat;
struct ResMat : public ResCommon<ResMatData> {
ResMatTevColor GetResMatTevColor() {
return ResMatTevColor(&ofs_to_ptr<ResMatDLData>(ref().toResMatDLData)->dlTevColor);
}
inline ResMat(void *vptr) : mMat(vptr) {}
bool IsValid() const {
return mMat.IsValid();
ResMatPix GetResMatPix() {
return ResMatPix(&ofs_to_ptr<ResMatDLData>(ref().toResMatDLData)->dlPix);
}
ResGenMode GetResGenMode() {
return ResGenMode(&ref().genMode);
}
ResTexSrt GetResTexSrt() {
return ResTexSrt(&mMat.ref().texSrtData);
return ResTexSrt(&ref().texSrtData);
}
ResMatTexCoordGen GetResMatTexCoordGen() {
ResMatDLData *dlData = mMat.ofs_to_ptr<ResMatDLData>(mMat.ref().resMatDLOfs);
return ResMatTexCoordGen(&dlData->texCoordGenData);
return ResMatTexCoordGen(&ofs_to_ptr<ResMatDLData>(ref().toResMatDLData)->dlTexCoordGen);
}
bool Bind(ResFile);
+3 -3
View File
@@ -1,9 +1,9 @@
#ifndef NW4R_G3D_RESMDL_H
#define NW4R_G3D_RESMDL_H
#include "common.h"
#include "g3d_rescommon.h"
#include "g3d_resdict.h"
#include "g3d_resnode.h"
#include "nw4r/g3d/g3d_rescommon.h"
#include "nw4r/g3d/g3d_resdict.h"
#include "nw4r/g3d/g3d_resnode.h"
namespace nw4r {
namespace g3d {
+5 -3
View File
@@ -1,12 +1,14 @@
#ifndef NW4R_G3D_RESNODE_H
#define NW4R_G3D_RESNODE_H
#include "common.h"
#include "g3d_anmchr.h"
#include "g3d_rescommon.h"
#include "math_types.h"
#include "nw4r/g3d/g3d_rescommon.h"
#include "nw4r/math/math_types.h"
namespace nw4r {
namespace g3d {
class ChrAnmResult;
struct ResNodeData {
u32 INT_0x0;
s32 INT_0x4;
+3 -3
View File
@@ -1,8 +1,8 @@
#ifndef NW4R_G3D_RESSHP_H
#define NW4R_G3D_RESSHP_H
#include "g3d_rescommon.h"
#include "g3d_resmdl.h"
#include "g3d_resvtx.h"
#include "nw4r/g3d/g3d_rescommon.h"
#include "nw4r/g3d/g3d_resmdl.h"
#include "nw4r/g3d/g3d_resvtx.h"
#include <GXAttr.h>#include "common.h"
+3 -3
View File
@@ -2,8 +2,8 @@
#define NW4R_G3D_RESTEV_H
#include <GXTev.h>
#include <GXTexture.h>
#include "g3d_cpu.h"
#include "g3d_rescommon.h"
#include "nw4r/g3d/g3d_cpu.h"
#include "nw4r/g3d/g3d_rescommon.h"
namespace nw4r
{
@@ -58,4 +58,4 @@ namespace nw4r
}
}
#endif
#endif
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef NW4R_G3D_RESTEX_H
#define NW4R_G3D_RESTEX_H
#include "common.h"
#include "g3d_rescommon.h"
#include "nw4r/g3d/g3d_rescommon.h"
#include <rvl/GX.h>
+2 -2
View File
@@ -1,7 +1,7 @@
#ifndef NW4R_G3D_RESVTX_H
#define NW4R_G3D_RESVTX_H
#include <GXAttr.h>
#include "g3d_rescommon.h"
#include "nw4r/g3d/g3d_rescommon.h"
namespace nw4r
{
@@ -155,4 +155,4 @@ namespace nw4r
}
}
#endif
#endif
+12 -5
View File
@@ -1,9 +1,9 @@
#ifndef NW4R_G3D_SCN_MDL_H
#define NW4R_G3D_SCN_MDL_H
#include "common.h"
#include "g3d_draw.h"
#include "g3d_resmat.h"
#include "g3d_scnmdlsmpl.h"
#include "nw4r/g3d/g3d_draw.h"
#include "nw4r/g3d/g3d_resmat.h"
#include "nw4r/g3d/g3d_scnmdlsmpl.h"
namespace nw4r {
namespace g3d {
@@ -12,13 +12,20 @@ public:
class CopiedMatAccess {
public:
CopiedMatAccess(ScnMdl *, u32);
ResTexSrt GetResTexSrtEx();
ResTexSrt GetResTexSrtEx(bool);
ResMatPix GetResMatPix(bool);
ResMatTevColor GetResMatTevColor(bool);
ResGenMode GetResGenMode(bool);
private:
char UNK_0x0[0x2C];
char UNK_0x0[0x34];
};
public:
virtual bool SetAnmObj(AnmObj *p, AnmObjType type) override;
static ScnMdl *Construct(MEMAllocator *, unsigned long *, nw4r::g3d::ResMdl, u32 bufferOption, int);
static const G3dObj::TypeObj GetTypeObjStatic() {
return TypeObj(TYPE_NAME);
}
+3 -3
View File
@@ -1,9 +1,9 @@
#ifndef NW4R_G3D_SCN_MDL1_MAT1_SHP_H
#define NW4R_G3D_SCN_MDL1_MAT1_SHP_H
#include "common.h"
#include "g3d_resmat.h"
#include "g3d_resshp.h"
#include "g3d_scnobj.h"
#include "nw4r/g3d/g3d_resmat.h"
#include "nw4r/g3d/g3d_resshp.h"
#include "nw4r/g3d/g3d_scnobj.h"
namespace nw4r {
namespace g3d {
+35 -2
View File
@@ -1,8 +1,10 @@
#ifndef NW4R_G3D_SCN_MDL_SIMPLE_H
#define NW4R_G3D_SCN_MDL_SIMPLE_H
#include "common.h"
#include "g3d_resmdl.h"
#include "g3d_scnobj.h"
#include "nw4r/g3d/g3d_calcworld.h"
#include "nw4r/g3d/g3d_resmdl.h"
#include "nw4r/g3d/g3d_scnobj.h"
#include "nw4r/math/math_types.h"
namespace nw4r {
namespace g3d {
@@ -15,13 +17,31 @@ public:
BYTE_CODE_DRAW_XLU,
};
enum AnmObjType {
ANMOBJTYPE_CHR = 0,
ANMOBJTYPE_VIS = 1,
ANMOBJTYPE_MATCLR = 2,
ANMOBJTYPE_TEXPAT = 3,
ANMOBJTYPE_TEXSRT = 4,
ANMOBJTYPE_SHP = 5,
ANMOBJTYPE_NOT_SPECIFIED = 6,
ANMOBJTYPE_VTX = 5,
};
public:
ScnMdlSimple(MEMAllocator *, ResMdl, math::MTX34 *, u32 *, math::MTX34 *, math::MTX33 *, math::MTX34 *, int, int);
static ScnMdlSimple *Construct(MEMAllocator *, unsigned long *, nw4r::g3d::ResMdl, int);
bool GetScnMtxPos(math::MTX34 *pOut, ScnObjMtxType tp, u32 nodeID) const;
virtual bool IsDerivedFrom(TypeObj other) const // at 0x8
{
return (other == GetTypeObjStatic()) ? true : ScnLeaf::IsDerivedFrom(other);
}
static const TypeObj GetTypeObjStatic() {
return TypeObj(TYPE_NAME);
}
virtual void G3dProc(u32, u32, void *); // at 0xC
virtual ~ScnMdlSimple(); // at 0x10
virtual const TypeObj GetTypeObj() const // at 0x14
@@ -33,7 +53,14 @@ public:
return GetTypeObj().GetTypeName();
}
virtual bool SetAnmObj(AnmObj *p, AnmObjType type);
virtual bool RemoveAnmObj(AnmObj *p);
virtual bool RemoveAnmObj(AnmObjType type);
virtual AnmObj *GetAnmObj(AnmObjType type);
virtual AnmObj *GetAnmObj(AnmObjType type) const;
const u8 *GetByteCode(ByteCodeType) const;
void EnableScnMdlCallbackTiming(Timing);
const ResMdl GetResMdl() const {
return mResMdl;
@@ -53,6 +80,10 @@ public:
return mNumViewMtx;
}
void SetCalcWorldCallback(ICalcWorldCallback *cb) {
mpCalcWorldCallback = cb;
}
private:
ResMdl mResMdl; // at 0xE8
math::MTX34 *mWldMatrixArray; // at 0xEC
@@ -68,6 +99,8 @@ private:
void *mByteCodeMix; // at 0x10C
void *mByteCodeDrawOpa; // at 0x110
void *mByteCodeDrawXlu; // at 0x114
UNKWORD WORD_0x118;
ICalcWorldCallback *mpCalcWorldCallback; // at 0x11C
NW4R_G3D_TYPE_OBJ_DECL(ScnMdlSimple);
};
+46 -21
View File
@@ -1,9 +1,9 @@
#ifndef NW4R_G3D_SCNOBJ_H
#define NW4R_G3D_SCNOBJ_H
#include "common.h"
#include "g3d_obj.h"
#include "math_geometry.h"
#include "math_types.h"
#include "nw4r/g3d/g3d_obj.h"
#include "nw4r/math/math_geometry.h"
#include "nw4r/math/math_types.h"
namespace nw4r {
namespace g3d {
@@ -23,25 +23,25 @@ public:
enum ForEachResult { FOREACH_RESULT_0, FOREACH_RESULT_1 };
enum ScnObjFlag {
FLAG_1 = 0x1,
FLAG_2 = 0x2,
FLAG_4 = 0x4,
FLAG_8 = 0x8,
FLAG_10 = 0x10,
FLAG_20 = 0x20,
FLAG_40 = 0x40,
FLAG_80 = 0x80,
FLAG_10000000 = 0x10000000,
FLAG_20000000 = 0x20000000,
FLAG_40000000 = 0x40000000,
FLAG_80000000 = 0x80000000,
FLAG_60 = FLAG_40 | FLAG_20
SCNOBJFLAG_DISABLE_CALC_WORLD = 1,
SCNOBJFLAG_DISABLE_CALC_MAT = 2,
SCNOBJFLAG_DISABLE_CALC_VTX = 4,
SCNOBJFLAG_DISABLE_CALC_VIEW = 8,
SCNOBJFLAG_DISABLE_GATHER_SCNOBJ = 16,
SCNOBJFLAG_DISABLE_DRAW_OPA = 32,
SCNOBJFLAG_DISABLE_DRAW_XLU = 64,
SCNOBJFLAG_DISABLE_UPDATEFRAME = 128,
SCNOBJFLAG_IGNORE_ANMCHR_TRANS = 256,
SCNOBJFLAG_ENABLE_CULLING = 268435456,
SCNOBJFLAG_NOT_GATHER_DRAW_OPA = 536870912,
SCNOBJFLAG_NOT_GATHER_DRAW_XLU = 1073741824,
SCNOBJFLAG_MTX_LOCAL_IDENTITY = -2147483648,
SCNOBJFLAG_DISABLE_DRAW = 96,
};
enum ScnObjMtxType { MTX_TYPE_0, MTX_TYPE_WORLD, MTX_TYPE_VIEW, MTX_TYPE_MAX };
enum ScnObjMtxType { MTX_TYPE_LOCAL, MTX_TYPE_WORLD, MTX_TYPE_VIEW, MTX_TYPE_MAX };
enum Timing { TIMING_1 = 0x1, TIMING_2 = 0x2, TIMING_4 = 0x4 };
enum Timing { TIMING_1 = 0x1, TIMING_2 = 0x2, TIMING_4 = 0x4, TIMING_ALL = 0x7 };
enum ExecOp { EXEC_OP_1 = 0x1, EXEC_OP_2 = 0x2, EXEC_OP_4 = 0x4 };
@@ -88,6 +88,13 @@ public:
void EnableScnObjCallbackExecOp(ExecOp);
bool SetBoundingVolume(ScnObjBoundingVolumeType, const math::AABB *);
bool GetBoundingVolume(ScnObjBoundingVolumeType, math::AABB *) const;
void SetCallback(IScnObjCallback *cb) {
mCallback = cb;
}
IScnObjCallback *GetScnObjCallback() {
return mCallback;
}
const math::MTX34 *GetMtxPtr(ScnObjMtxType type) const {
return &mMatrices[type];
@@ -202,6 +209,22 @@ public:
ScaleProperty GetScaleProperty() const;
void DefG3dProcScnLeaf(u32, u32, void *);
inline void SetScale(f32 x, f32 y, f32 z) {
mScale.x = x;
mScale.y = y;
mScale.z = z;
}
inline void SetScale(const math::VEC3 &scale) {
mScale = scale;
}
inline void GetScale(math::VEC3 *scale) const {
if (scale) {
*scale = mScale;
}
}
private:
math::VEC3 mScale;
@@ -235,6 +258,10 @@ public:
return TypeObj(TYPE_NAME);
}
bool PushBack(ScnObj *obj) {
return Insert(Size(), obj);
}
bool Empty() const {
return mSize == 0;
}
@@ -263,8 +290,6 @@ public:
void ScnGroup_G3DPROC_CALC_VIEW(u32, const math::MTX34 *);
void DefG3dProcScnGroup(u32, u32, void *);
bool PushBack(ScnObj *);
ScnObj **mObjects; // at 0xDC
u32 mCapacity; // at 0xE0
u32 mSize; // at 0xE4
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef NW4R_G3D_SCNPROC_H
#define NW4R_G3D_SCNPROC_H
#include "common.h"
#include "g3d_scnobj.h"
#include "nw4r/g3d/g3d_scnobj.h"
namespace nw4r {
namespace g3d {
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef NW4R_G3D_SCNRFL_H
#define NW4R_G3D_SCNRFL_H
#include "common.h"
#include "g3d_scnleaf.h"
#include "nw4r/g3d/g3d_scnobj.h"
#include <RFL/RFL_MiddleDatabase.h>
#include <RFL/RFL_Model.h>
+14 -4
View File
@@ -1,9 +1,10 @@
#ifndef NW4R_G3D_SCNROOT_H
#define NW4R_G3D_SCNROOT_H
#include "common.h"
#include "g3d_camera.h"
#include "g3d_fog.h"
#include "g3d_scnobj.h"
#include "nw4r/g3d/g3d_camera.h"
#include "nw4r/g3d/g3d_fog.h"
#include "nw4r/g3d/g3d_light.h"
#include "nw4r/g3d/g3d_scnobj.h"
namespace nw4r {
namespace g3d {
@@ -14,6 +15,9 @@ public:
void SetCurrentCamera(int);
Fog GetFog(int);
static ScnRoot *Construct(MEMAllocator *pHeap, u32 *pSize, u32 maxNumChildren, u32 maxNumScnObj, u32 numLightObj,
u32 numLightSet);
void UpdateFrame();
void CalcWorld();
void CalcMaterial();
@@ -28,11 +32,17 @@ public:
return mCameraId;
}
inline LightSetting *getLightSetting() {
return &mLightSetting;
}
private:
UNKWORD WORD_0xE8;
UNKWORD WORD_0xEC;
UNKWORD WORD_0xF0;
u8 mCameraId;
/* 0x00F4 */ u8 mCameraId;
u8 unk1[0x2878 - 0x00F8];
/* 0x2878 */ LightSetting mLightSetting;
};
} // namespace g3d
} // namespace nw4r
+4
View File
@@ -1,6 +1,7 @@
#ifndef NW4R_G3D_STATE_H
#define NW4R_G3D_STATE_H
#include "common.h"
#include "nw4r/math.h"
#include <rvl/GX.h>
namespace nw4r {
@@ -12,6 +13,9 @@ void SetViewPosNrmMtxArray(const math::MTX34 *, const math::MTX33 *, const math:
void SetRenderModeObj(const GXRenderModeObj &);
GXRenderModeObj &GetRenderModeObj();
void LoadLightSet(int idx_lightset, u32 *mask_diff_color /* r1+0xC */, u32 *mask_diff_alpha, u32 *mask_spec_color,
u32 *mask_spec_alpha, AmbLightObj *amb);
void Invalidate(u32);
} // namespace G3DState
} // namespace g3d
+2 -1
View File
@@ -1,7 +1,8 @@
#ifndef NW4R_G3D_XSI_H
#define NW4R_G3D_XSI_H
#include "common.h"
#include "g3d_anmtexsrt.h"
#include "nw4r/math.h"
#include "nw4r/g3d/g3d_anmtexsrt.h"
namespace nw4r {
namespace g3d {
+2 -2
View File
@@ -2,7 +2,7 @@
#define NW4R_SND_SOUND_3D_ACTOR_H
#include "snd_BasicSound.h"
#include "snd_SoundActor.h"
#include "math_types.h"
#include "nw4r/math/math_types.h"
namespace nw4r
{
@@ -37,4 +37,4 @@ namespace nw4r
}
}
#endif
#endif
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef NW4R_SND_SOUND_3D_LISTENER_H
#define NW4R_SND_SOUND_3D_LISTENER_H
#include "common.h"
#include "math_types.h"
#include "nw4r/math/math_types.h"
namespace nw4r {
namespace snd {
+2 -2
View File
@@ -4,7 +4,7 @@
#include "snd_SoundArchive.h"
#include "snd_SoundActor.h"
#include "snd_InstancePool.h"
#include "math_types.h"
#include "nw4r/math/math_types.h"
namespace nw4r
{
@@ -50,4 +50,4 @@ namespace nw4r
}
}
#endif
#endif
+6
View File
@@ -16,3 +16,9 @@ In order for vtable ordering to match, some classes had to be extracted to a new
S_StateMethod_c's destructors calls back into another destructors. sStateMethodIf_c follows the example of
the other abstract interface classes and provides this dtor.
## operator== / != return BOOL instead of bool
We're observing a lot of word-to-bool casts in code after these
operators are invoked, and while there are ways to force the conversion,
this seems the most reasonable.
+2 -2
View File
@@ -27,8 +27,8 @@ public:
virtual bool isNull() const;
virtual bool isEqual(const sStateIDIf_c &other) const;
virtual bool operator==(const sStateIDIf_c &other) const;
virtual bool operator!=(const sStateIDIf_c &other) const;
virtual BOOL operator==(const sStateIDIf_c &other) const;
virtual BOOL operator!=(const sStateIDIf_c &other) const;
virtual bool isSameName(const char *name) const;
virtual const char *name() const;
+2 -2
View File
@@ -23,8 +23,8 @@ public:
virtual bool isNull() const = 0; ///< Returns whether this is a null state.
virtual bool isEqual(const sStateIDIf_c &other) const = 0; ///< Returns whether both states have the same number.
virtual bool operator==(const sStateIDIf_c &other) const = 0; ///< Overloaded equality operator, using ::isEqual.
virtual bool operator!=(const sStateIDIf_c &other) const = 0; ///< Overloaded inequality operator, using ::isEqual.
virtual BOOL operator==(const sStateIDIf_c &other) const = 0; ///< Overloaded equality operator, using ::isEqual.
virtual BOOL operator!=(const sStateIDIf_c &other) const = 0; ///< Overloaded inequality operator, using ::isEqual.
virtual bool isSameName(const char *name) const = 0; ///< Returns whether this state ID is called @p name.
virtual const char *name() const = 0; ///< Returns the name of this state ID.
+5
View File
@@ -35,6 +35,11 @@ public:
virtual const sStateIDIf_c *getStateID() const { return mMethod.getStateID(); }
virtual const sStateIDIf_c *getOldStateID() const { return mMethod.getOldStateID(); }
// SS addition
bool isState(const sStateIDIf_c& other) {
return *getStateID() == other;
}
private:
Check mCheck;
Factory<T> mFactory;
@@ -6,15 +6,10 @@
#include <sized_string.h>
class CurrentStageArcManager {
public:
CurrentStageArcManager();
virtual ~CurrentStageArcManager();
SizedString<32> mStageName;
SizedString<32> mCurrentLoadingStageArcName;
SizedString<32> mStageExtraLayerArcName;
dRawArcTable_c mArcTable;
static CurrentStageArcManager *sInstance;
static bool create(EGG::Heap *heap);
@@ -36,6 +31,13 @@ class CurrentStageArcManager {
const char *getRoomArcDirectory(int room) const;
static EGG::ExpHeap *getHeap();
private:
SizedString<32> mStageName;
SizedString<32> mCurrentLoadingStageArcName;
SizedString<32> mStageExtraLayerArcName;
dRawArcTable_c mArcTable;
};
#endif

Some files were not shown because too many files have changed in this diff Show More