lyt_common match

This commit is contained in:
elijah-thomas774
2024-05-12 20:23:22 -04:00
parent 62e0778390
commit fa9a9ce949
157 changed files with 5276 additions and 5580 deletions
+2 -1
View File
@@ -27,6 +27,7 @@
"xtr1common": "cpp",
"limits": "cpp",
"utility": "cpp",
"initializer_list": "cpp"
"initializer_list": "cpp",
"new": "cpp"
}
}
+6
View File
@@ -316,6 +316,12 @@ nw4r/db/db_directPrint.cpp:
.sbss start:0x805765E8 end:0x805765EC
.bss start:0x80636B80 end:0x80636BA4
nw4r/lyt/lyt_common.cpp:
.text start:0x80492780 end:0x804932E0
.sbss start:0x80576720 end:0x80576728
.sdata2 start:0x8057F2E0 end:0x8057F2E8
.bss start:0x80673AA8 end:0x80673AC8
egg/core/eggArchive.cpp:
.text start:0x80493510 end:0x80494254
.data start:0x8056E820 end:0x8056E830
+4 -4
View File
@@ -22589,7 +22589,7 @@ fn_803CDAD0 = .text:0x803CDAD0; // type:function size:0xD0
fn_803CDBA0 = .text:0x803CDBA0; // type:function size:0x10
fn_803CDBB0 = .text:0x803CDBB0; // type:function size:0x8
MEMAllocFromAllocator = .text:0x803CDBC0; // type:function size:0x10
fn_803CDBD0 = .text:0x803CDBD0; // type:function size:0x10
MEMFreeToAllocator = .text:0x803CDBD0; // type:function size:0x10
fn_803CDBE0 = .text:0x803CDBE0; // type:function size:0x1C
fn_803CDC00 = .text:0x803CDC00; // type:function size:0x18
fn_803CDC20 = .text:0x803CDC20; // type:function size:0x70
@@ -40878,12 +40878,12 @@ lbl_805766D8 = .sbss:0x805766D8; // type:object size:0x8 data:byte
lbl_805766E0 = .sbss:0x805766E0; // type:object size:0x8 data:byte
lbl_805766E8 = .sbss:0x805766E8; // type:object size:0x8 data:4byte
lbl_805766F0 = .sbss:0x805766F0; // type:object size:0x8 data:4byte
lbl_805766F8 = .sbss:0x805766F8; // type:object size:0x8 data:4byte
mspAllocator__Q34nw4r3lyt6Layout = .sbss:0x805766F8; // type:object size:0x8 data:4byte
lbl_80576700 = .sbss:0x80576700; // type:object size:0x8 data:4byte
lbl_80576708 = .sbss:0x80576708; // type:object size:0x8 data:4byte
lbl_80576710 = .sbss:0x80576710; // type:object size:0x8 data:4byte
lbl_80576718 = .sbss:0x80576718; // type:object size:0x8 data:4byte
lbl_80576720 = .sbss:0x80576720; // type:object size:0x8 data:byte
@GUARD@SetSize__Q44nw4r3lyt6detail11TexCoordAryFUc@texCoords = .sbss:0x80576720; // type:object size:0x1 data:byte
lbl_80576728 = .sbss:0x80576728; // type:object size:0x8 data:byte
lbl_80576730 = .sbss:0x80576730; // type:object size:0x8 data:byte
lbl_80576738 = .sbss:0x80576738; // type:object size:0x8 data:4byte
@@ -49350,7 +49350,7 @@ lbl_80673A38 = .bss:0x80673A38; // type:object size:0xC
lbl_80673A44 = .bss:0x80673A44; // type:object size:0x3C
lbl_80673A80 = .bss:0x80673A80; // type:object size:0xC
lbl_80673A8C = .bss:0x80673A8C; // type:object size:0x1C data:byte
lbl_80673AA8 = .bss:0x80673AA8; // type:object size:0x20 data:float
@LOCAL@SetSize__Q44nw4r3lyt6detail11TexCoordAryFUc@texCoords = .bss:0x80673AA8; // type:object size:0x20 scope:local data:float
lbl_80673AC8 = .bss:0x80673AC8; // type:object size:0x10
lbl_80673AD8 = .bss:0x80673AD8; // type:object size:0x10
sHeapList__Q23EGG4Heap = .bss:0x80673AE8; // type:object size:0xC
+7
View File
@@ -155,6 +155,7 @@ cflags_base = [
"-str reuse",
"-enc SJIS",
"-i include",
"-i include/MSL_C",
f"-i build/{config.version}/include",
f"-DVERSION={version_num}",
]
@@ -347,6 +348,12 @@ config.libs = [
Object(Matching, "nw4r/ut/ut_TextWriterBase.cpp"),
],
),
nw4rLib(
"lyt",
[
Object(Matching, "nw4r/lyt/lyt_common.cpp"),
],
),
# EGG
EGGLib(
"core",
+6 -8
View File
@@ -1,13 +1,11 @@
#ifndef NW4R_EF_ANIMCURVE_H
#define NW4R_EF_ANIMCURVE_H
#include "types_nw4r.h"
#include "common.h"
namespace nw4r
{
namespace ef
{
UNKTYPE AnimCurveExecuteF32(u8 *, float *, u32, u16, u32);
}
namespace nw4r {
namespace ef {
UNKTYPE AnimCurveExecuteF32(u8 *, float *, u32, u16, u32);
}
} // namespace nw4r
#endif
#endif
+33 -41
View File
@@ -1,46 +1,38 @@
#ifndef NW4R_EF_CREATIONQUEUE
#define NW4R_EF_CREATIONQUEUE
#include "common.h"
#include "ef_emitter.h"
#include "types_nw4r.h"
namespace nw4r
{
namespace ef
{
enum CreationType
{
CreationType_Particle,
CreationType_Emitter
};
//sizeof(UNK_CREATIONQUEUE) = 0x14
struct Creation
{
u8 mType; // at 0x0
u16 SHORT_0x2;
EmitterInheritSetting mInheritSetting; // at 0x4
Particle * mParticle; // at 0x8
EmitterResource * mResource; // at 0xc
};
struct CreationQueue
{
CreationQueue();
void AddParticleCreation(const EmitterInheritSetting *, Particle *, EmitterResource *, u16);
void AddEmitterCreation(const EmitterInheritSetting *, Particle *, EmitterResource *, u16);
int mSize;
Creation mCreations[0x400];
inline bool IsEmpty()
{
return mSize == 0;
}
void Execute();
};
}
}
#endif
namespace nw4r {
namespace ef {
enum CreationType { CreationType_Particle, CreationType_Emitter };
// sizeof(UNK_CREATIONQUEUE) = 0x14
struct Creation {
u8 mType; // at 0x0
u16 SHORT_0x2;
EmitterInheritSetting mInheritSetting; // at 0x4
Particle *mParticle; // at 0x8
EmitterResource *mResource; // at 0xc
};
struct CreationQueue {
CreationQueue();
void AddParticleCreation(const EmitterInheritSetting *, Particle *, EmitterResource *, u16);
void AddEmitterCreation(const EmitterInheritSetting *, Particle *, EmitterResource *, u16);
int mSize;
Creation mCreations[0x400];
inline bool IsEmpty() {
return mSize == 0;
}
void Execute();
};
} // namespace ef
} // namespace nw4r
#endif
+14 -17
View File
@@ -1,22 +1,19 @@
#ifndef NW4R_EF_DRAW_BILLBOARD_STRATEGY_H
#define NW4R_EF_DRAW_BILLBOARD_STRATEGY_H
#include "types_nw4r.h"
#include "common.h"
#include "ef_drawstrategyimpl.h"
namespace nw4r
{
namespace ef
{
class DrawBillboardStrategy : public DrawStrategyImpl
{
public:
DrawBillboardStrategy();
virtual ~DrawBillboardStrategy() {} // at 0x8
virtual UNKTYPE GetCalcAheadFunc(ParticleManager *); // at 0x18
void Draw(const DrawInfo &, ParticleManager *);
};
}
}
namespace nw4r {
namespace ef {
class DrawBillboardStrategy : public DrawStrategyImpl {
public:
DrawBillboardStrategy();
virtual ~DrawBillboardStrategy() {} // at 0x8
virtual UNKTYPE GetCalcAheadFunc(ParticleManager *); // at 0x18
#endif
void Draw(const DrawInfo &, ParticleManager *);
};
} // namespace ef
} // namespace nw4r
#endif
+14 -17
View File
@@ -1,22 +1,19 @@
#ifndef NW4R_EF_DRAW_DIRECTIONAL_STRATEGY_H
#define NW4R_EF_DRAW_DIRECTIONAL_STRATEGY_H
#include "types_nw4r.h"
#include "common.h"
#include "ef_drawstrategyimpl.h"
namespace nw4r
{
namespace ef
{
class DrawDirectionalStrategy : public DrawStrategyImpl
{
public:
DrawDirectionalStrategy();
virtual ~DrawDirectionalStrategy() {} // at 0x8
virtual UNKTYPE GetCalcAheadFunc(ParticleManager *); // at 0x18
void Draw(const DrawInfo &, ParticleManager *);
};
}
}
namespace nw4r {
namespace ef {
class DrawDirectionalStrategy : public DrawStrategyImpl {
public:
DrawDirectionalStrategy();
virtual ~DrawDirectionalStrategy() {} // at 0x8
virtual UNKTYPE GetCalcAheadFunc(ParticleManager *); // at 0x18
#endif
void Draw(const DrawInfo &, ParticleManager *);
};
} // namespace ef
} // namespace nw4r
#endif
+13 -16
View File
@@ -1,21 +1,18 @@
#ifndef NW4R_EF_DRAW_FREE_STRATEGY_H
#define NW4R_EF_DRAW_FREE_STRATEGY_H
#include "types_nw4r.h"
#include "common.h"
#include "ef_drawstrategyimpl.h"
namespace nw4r
{
namespace ef
{
class DrawFreeStrategy : public DrawStrategyImpl
{
public:
DrawFreeStrategy();
virtual ~DrawFreeStrategy() {} // at 0x8
UNKTYPE Draw(const DrawInfo &, ParticleManager *);
};
}
}
namespace nw4r {
namespace ef {
class DrawFreeStrategy : public DrawStrategyImpl {
public:
DrawFreeStrategy();
virtual ~DrawFreeStrategy() {} // at 0x8
#endif
UNKTYPE Draw(const DrawInfo &, ParticleManager *);
};
} // namespace ef
} // namespace nw4r
#endif
+7 -12
View File
@@ -1,16 +1,11 @@
#ifndef NW4R_EF_DRAWINFO
#define NW4R_EF_DRAWINFO
#include "types_nw4r.h"
#include "common.h"
namespace nw4r
{
namespace ef
{
struct DrawInfo
{
};
}
}
namespace nw4r {
namespace ef {
struct DrawInfo {};
} // namespace ef
} // namespace nw4r
#endif
#endif
+13 -16
View File
@@ -1,21 +1,18 @@
#ifndef NW4R_EF_DRAW_LINE_STRATEGY_H
#define NW4R_EF_DRAW_LINE_STRATEGY_H
#include "types_nw4r.h"
#include "common.h"
#include "ef_drawstrategyimpl.h"
namespace nw4r
{
namespace ef
{
class DrawLineStrategy : public DrawStrategyImpl
{
public:
DrawLineStrategy();
virtual ~DrawLineStrategy() {} // at 0x8
UNKTYPE Draw(const DrawInfo &, ParticleManager *);
};
}
}
namespace nw4r {
namespace ef {
class DrawLineStrategy : public DrawStrategyImpl {
public:
DrawLineStrategy();
virtual ~DrawLineStrategy() {} // at 0x8
#endif
UNKTYPE Draw(const DrawInfo &, ParticleManager *);
};
} // namespace ef
} // namespace nw4r
#endif
+12 -15
View File
@@ -1,20 +1,17 @@
#ifndef NW4R_EF_DRAWORDER
#define NW4R_EF_DRAWORDER
#include "types_nw4r.h"
#include "ef_particlemanager.h"
#include "common.h"
#include "ef_draworderbase.h"
#include "ef_particlemanager.h"
namespace nw4r
{
namespace ef
{
struct DrawOrder : DrawOrderBase
{
void Draw(Effect *, const DrawInfo &);
void Add(Effect *, ParticleManager *);
void Remove(Effect *, ParticleManager *);
};
}
}
namespace nw4r {
namespace ef {
struct DrawOrder : DrawOrderBase {
void Draw(Effect *, const DrawInfo &);
void Add(Effect *, ParticleManager *);
void Remove(Effect *, ParticleManager *);
};
} // namespace ef
} // namespace nw4r
#endif
#endif
+14 -17
View File
@@ -1,22 +1,19 @@
#ifndef NW4R_EF_DRAW_POINT_STRATEGY_H
#define NW4R_EF_DRAW_POINT_STRATEGY_H
#include "types_nw4r.h"
#include "common.h"
#include "ef_drawstrategyimpl.h"
namespace nw4r
{
namespace ef
{
class DrawPointStrategy : public DrawStrategyImpl
{
public:
DrawPointStrategy();
virtual ~DrawPointStrategy() {} // at 0x8
void Draw(const DrawInfo&, ParticleManager *);
void InitGraphics(const DrawInfo&, ParticleManager *);
};
}
}
namespace nw4r {
namespace ef {
class DrawPointStrategy : public DrawStrategyImpl {
public:
DrawPointStrategy();
virtual ~DrawPointStrategy() {} // at 0x8
#endif
void Draw(const DrawInfo &, ParticleManager *);
void InitGraphics(const DrawInfo &, ParticleManager *);
};
} // namespace ef
} // namespace nw4r
#endif
+14 -17
View File
@@ -1,22 +1,19 @@
#ifndef NW4R_EF_DRAW_SMOOTH_STRIPE_STRATEGY_H
#define NW4R_EF_DRAW_SMOOTH_STRIPE_STRATEGY_H
#include "types_nw4r.h"
#include "common.h"
#include "ef_drawstrategyimpl.h"
namespace nw4r
{
namespace ef
{
class DrawSmoothStripeStrategy : public DrawStrategyImpl
{
public:
DrawSmoothStripeStrategy();
virtual ~DrawSmoothStripeStrategy() {} // at 0x8
virtual UNKTYPE GetCalcAheadFunc(ParticleManager *); // at 0x18
UNKTYPE Draw(const DrawInfo &, ParticleManager *);
};
}
}
namespace nw4r {
namespace ef {
class DrawSmoothStripeStrategy : public DrawStrategyImpl {
public:
DrawSmoothStripeStrategy();
virtual ~DrawSmoothStripeStrategy() {} // at 0x8
virtual UNKTYPE GetCalcAheadFunc(ParticleManager *); // at 0x18
#endif
UNKTYPE Draw(const DrawInfo &, ParticleManager *);
};
} // namespace ef
} // namespace nw4r
#endif
+10 -13
View File
@@ -1,17 +1,14 @@
#ifndef NW4R_EF_DRAWSTRATEGY_H
#define NW4R_EF_DRAWSTRATEGY_H
#include "types_nw4r.h"
#include "common.h"
namespace nw4r
{
namespace ef
{
struct DrawStrategy
{
inline virtual ~DrawStrategy() {}
virtual UNKTYPE Draw(const DrawInfo &, ParticleManager *) = 0;
};
}
}
namespace nw4r {
namespace ef {
struct DrawStrategy {
inline virtual ~DrawStrategy() {}
virtual UNKTYPE Draw(const DrawInfo &, ParticleManager *) = 0;
};
} // namespace ef
} // namespace nw4r
#endif
#endif
+19 -23
View File
@@ -1,27 +1,23 @@
#ifndef NW4R_EF_DRAWSTRATEGYBUILDER_H
#define NW4R_EF_DRAWSTRATEGYBUILDER_H
#include "types_nw4r.h"
#include "common.h"
namespace nw4r
{
namespace ef
{
enum DrawStrategyType
{
DrawStratType_Point,
DrawStratType_Line,
DrawStratType_Free,
DrawStratType_Billboard,
DrawStratType_Directional,
DrawStratType_Stripe,
DrawStratType_SmoothStripe
};
struct DrawStrategyBuilder
{
virtual DrawStrategy * Create(u32);
};
}
}
namespace nw4r {
namespace ef {
enum DrawStrategyType {
DrawStratType_Point,
DrawStratType_Line,
DrawStratType_Free,
DrawStratType_Billboard,
DrawStratType_Directional,
DrawStratType_Stripe,
DrawStratType_SmoothStripe
};
#endif
struct DrawStrategyBuilder {
virtual DrawStrategy *Create(u32);
};
} // namespace ef
} // namespace nw4r
#endif
+31 -35
View File
@@ -1,44 +1,40 @@
#ifndef NW4R_EF_DRAW_STRATEGY_IMPL_H
#define NW4R_EF_DRAW_STRATEGY_IMPL_H
#include "types_nw4r.h"
#include "common.h"
#include "ef_drawstrategy.h"
#include "math_types.h"
namespace nw4r
{
namespace ef
{
class DrawStrategyImpl : public DrawStrategy
{
public:
struct PrevTexture
{
UNKWORD WORD_0x0;
f32 FLOAT_0x4;
f32 FLOAT_0x8;
f32 FLOAT_0xC;
f32 FLOAT_0x10;
UNKWORD WORD_0x14;
UNKWORD WORD_0x18;
math::VEC2 VEC2_0x1C;
f32 FLOAT_0x24;
math::VEC2 VEC2_0x28;
};
namespace nw4r {
namespace ef {
class DrawStrategyImpl : public DrawStrategy {
public:
struct PrevTexture {
UNKWORD WORD_0x0;
f32 FLOAT_0x4;
f32 FLOAT_0x8;
f32 FLOAT_0xC;
f32 FLOAT_0x10;
UNKWORD WORD_0x14;
UNKWORD WORD_0x18;
math::VEC2 VEC2_0x1C;
f32 FLOAT_0x24;
math::VEC2 VEC2_0x28;
};
public:
DrawStrategyImpl();
virtual UNKTYPE GetGetFirstDrawParticleFunc(int);
virtual UNKTYPE GetGetNextDrawParticleFunc(int);
public:
DrawStrategyImpl();
virtual UNKTYPE GetGetFirstDrawParticleFunc(int);
virtual UNKTYPE GetGetNextDrawParticleFunc(int);
void InitTexture(const EmitterDrawSetting &);
void InitTev(const EmitterDrawSetting &, const DrawInfo &);
void InitColor(ParticleManager *, const EmitterDrawSetting &, const DrawInfo &);
void InitTexture(const EmitterDrawSetting &);
void InitTev(const EmitterDrawSetting &, const DrawInfo &);
void InitColor(ParticleManager *, const EmitterDrawSetting &, const DrawInfo &);
private:
PrevTexture mPrevTextures[3]; // at 0x4
char UNK_0x94[0xBC - 0x94];
};
}
}
private:
PrevTexture mPrevTextures[3]; // at 0x4
char UNK_0x94[0xBC - 0x94];
};
} // namespace ef
} // namespace nw4r
#endif
#endif
+14 -17
View File
@@ -1,22 +1,19 @@
#ifndef NW4R_EF_DRAW_STRIPE_STRATEGY_H
#define NW4R_EF_DRAW_STRIPE_STRATEGY_H
#include "types_nw4r.h"
#include "common.h"
#include "ef_drawstrategyimpl.h"
namespace nw4r
{
namespace ef
{
class DrawStripeStrategy : public DrawStrategyImpl
{
public:
DrawStripeStrategy();
virtual ~DrawStripeStrategy() {} // at 0x8
virtual UNKTYPE GetCalcAheadFunc(ParticleManager *); // at 0x18
UNKTYPE Draw(const DrawInfo &, ParticleManager *);
};
}
}
namespace nw4r {
namespace ef {
class DrawStripeStrategy : public DrawStrategyImpl {
public:
DrawStripeStrategy();
virtual ~DrawStripeStrategy() {} // at 0x8
virtual UNKTYPE GetCalcAheadFunc(ParticleManager *); // at 0x18
#endif
UNKTYPE Draw(const DrawInfo &, ParticleManager *);
};
} // namespace ef
} // namespace nw4r
#endif
+50 -53
View File
@@ -1,59 +1,56 @@
#ifndef NW4R_EF_EFFECT
#define NW4R_EF_EFFECT
#include "types_nw4r.h"
#include "math_types.h"
#include "ef_ref.h"
#include "ut_list.h"
#include "common.h"
#include "ef_list.h"
#include "ef_ref.h"
#include "ef_util.h"
#include "math_types.h"
#include "ut_list.h"
namespace nw4r
{
namespace ef
{
struct Effect : ReferencedObject
{
EffectSystem * mSystem; // at 0x20
ActivityList mEmitters; // at 0x24
u32 INDEX_0x40;
void (* mEmissionPrologue)(Emitter *, ParticleManager *, int *, u32 *, float *, u16 *, float *, math::MTX34 *); // at 0x44
UNKWORD WORD_0x48;
UNKWORD WORD_0x4C;
u32 mFlags; // at 0x50
math::MTX34 mRootMtx; // at 0x54
math::VEC3 VEC_0x84;
ut::List UTLIST_0x90;
DrawOrder * mDrawOrder; // at 0x9c
Effect();
~Effect();
virtual bool Initialize(EffectSystem *, EmitterResource *, u16);
virtual Emitter * CreateEmitter(ResEmitter, u8, u16);
virtual void Calc(bool);
virtual void Draw(const DrawInfo &);
bool SendClosing();
UNKTYPE DestroyFunc();
bool Closing(Emitter *);
Emitter * CreateEmitter(EmitterResource *, u8, u16);
bool RetireEmitter(Emitter *);
u16 RetireEmitterAll();
u16 RetireParticleAll();
u16 GetNumEmitter() const;
Emitter * GetEmitter(u16);
u16 ForeachParticleManager(Action, u32, bool);
u16 ForeachEmitterFrom(Action, u32, bool, Emitter *);
UNKTYPE SetRootMtx(const math::MTX34 &);
inline bool GetFlagDisableDraw()
{
return mFlags & 2;
}
};
}
}
namespace nw4r {
namespace ef {
struct Effect : ReferencedObject {
EffectSystem *mSystem; // at 0x20
ActivityList mEmitters; // at 0x24
u32 INDEX_0x40;
#endif
void (*mEmissionPrologue)(Emitter *, ParticleManager *, int *, u32 *, float *, u16 *, float *,
math::MTX34 *); // at 0x44
UNKWORD WORD_0x48;
UNKWORD WORD_0x4C;
u32 mFlags; // at 0x50
math::MTX34 mRootMtx; // at 0x54
math::VEC3 VEC_0x84;
ut::List UTLIST_0x90;
DrawOrder *mDrawOrder; // at 0x9c
Effect();
~Effect();
virtual bool Initialize(EffectSystem *, EmitterResource *, u16);
virtual Emitter *CreateEmitter(ResEmitter, u8, u16);
virtual void Calc(bool);
virtual void Draw(const DrawInfo &);
bool SendClosing();
UNKTYPE DestroyFunc();
bool Closing(Emitter *);
Emitter *CreateEmitter(EmitterResource *, u8, u16);
bool RetireEmitter(Emitter *);
u16 RetireEmitterAll();
u16 RetireParticleAll();
u16 GetNumEmitter() const;
Emitter *GetEmitter(u16);
u16 ForeachParticleManager(Action, u32, bool);
u16 ForeachEmitterFrom(Action, u32, bool, Emitter *);
UNKTYPE SetRootMtx(const math::MTX34 &);
inline bool GetFlagDisableDraw() {
return mFlags & 2;
}
};
} // namespace ef
} // namespace nw4r
#endif
+47 -51
View File
@@ -1,57 +1,53 @@
#ifndef NW4R_EF_EFFECTSYSTEM
#define NW4R_EF_EFFECTSYSTEM
#include "types_nw4r.h"
#include "common.h"
#include "ef_creationqueue.h"
#include "ef_ref.h"
#include "ef_rand.h"
#include "ef_list.h"
#include "ef_rand.h"
#include "ef_ref.h"
namespace nw4r
{
namespace ef
{
struct EffectSystem
{
static bool mDisplayVersion;
static EffectSystem instance;
MemoryManager * mMemoryManager; // at 0x0
DrawOrder * mDrawOrder; // at 0x4
DrawStrategyBuilder * mDrawStrategyBuilder; // at 0x8
EmitFormBuilder * mEmitFormBuilder; // at 0xc
CreationQueue mCreationQueue; // at 0x10
u32 mNumGroup;
ActivityList * ARR_0x5018;
Random mRandom; // at 0x501C
math::VEC3 VEC_0x5020;
math::MTX34 MTX_0x502C;
float FLOAT_0x505C;
float FLOAT_0x5060;
char BYTE_0x5064;
inline MemoryManager * GetMemoryManager() const
{
return mMemoryManager;
}
EffectSystem();
~EffectSystem();
static EffectSystem * GetInstance();
bool Initialize(u32);
bool Closing(Effect *);
Effect * CreateEffect(const char *, u32, u16);
bool RetireEffect(Effect *);
u16 RetireEffectAll(u32);
u16 RetireEmitterAll(u32);
u16 RetireParticleAll(u32);
void Calc(u32, bool);
void Draw(const DrawInfo &, u32);
};
}
}
namespace nw4r {
namespace ef {
struct EffectSystem {
static bool mDisplayVersion;
#endif
static EffectSystem instance;
MemoryManager *mMemoryManager; // at 0x0
DrawOrder *mDrawOrder; // at 0x4
DrawStrategyBuilder *mDrawStrategyBuilder; // at 0x8
EmitFormBuilder *mEmitFormBuilder; // at 0xc
CreationQueue mCreationQueue; // at 0x10
u32 mNumGroup;
ActivityList *ARR_0x5018;
Random mRandom; // at 0x501C
math::VEC3 VEC_0x5020;
math::MTX34 MTX_0x502C;
float FLOAT_0x505C;
float FLOAT_0x5060;
char BYTE_0x5064;
inline MemoryManager *GetMemoryManager() const {
return mMemoryManager;
}
EffectSystem();
~EffectSystem();
static EffectSystem *GetInstance();
bool Initialize(u32);
bool Closing(Effect *);
Effect *CreateEffect(const char *, u32, u16);
bool RetireEffect(Effect *);
u16 RetireEffectAll(u32);
u16 RetireEmitterAll(u32);
u16 RetireParticleAll(u32);
void Calc(u32, bool);
void Draw(const DrawInfo &, u32);
};
} // namespace ef
} // namespace nw4r
#endif
+19 -23
View File
@@ -1,27 +1,23 @@
#ifndef NW4R_EF_EMFORM_H
#define NW4R_EF_EMFORM_H
#include "types_nw4r.h"
#include "common.h"
namespace nw4r
{
namespace ef
{
enum EmitFormType
{
EmitForm_Disc,
EmitForm_Line,
EmitForm_Cube = 5,
EmitForm_Cylinder = 7,
EmitForm_Sphere,
EmitForm_Point,
EmitForm_Torus
};
struct EmitFormBuilder
{
virtual EmitterForm * Create(EmitFormType);
};
}
}
namespace nw4r {
namespace ef {
enum EmitFormType {
EmitForm_Disc,
EmitForm_Line,
EmitForm_Cube = 5,
EmitForm_Cylinder = 7,
EmitForm_Sphere,
EmitForm_Point,
EmitForm_Torus
};
#endif
struct EmitFormBuilder {
virtual EmitterForm *Create(EmitFormType);
};
} // namespace ef
} // namespace nw4r
#endif
+239 -251
View File
@@ -1,259 +1,247 @@
#ifndef NW4R_EF_EMITTER
#define NW4R_EF_EMITTER
#include <math.h>
#include "types_nw4r.h"
#include "ef_ref.h"
#include "ut_list.h"
#include "ef_animcurve.h"
#include "ef_list.h"
#include "ef_rand.h"
#include "ef_ref.h"
#include "ef_util.h"
#include "ef_animcurve.h"
#include "ut_list.h"
#include <math.h>#include "common.h"
namespace nw4r
{
namespace ef
{
struct ResEmitter
{
EmitterResource * mPtr;
inline EmitterResource * ptr() { return mPtr; }
};
struct EmitterInheritSetting
{
s16 SHORT_0x0;
u8 BYTE_0x2;
u8 BYTE_0x3;
u8 BYTE_0x4;
u8 BYTE_0x5;
u8 BYTE_0x6;
u8 BYTE_0x7;
};
struct EmitterDesc
{
UNKWORD FLAGS_0x0; // at 0x0/0x8
UNKWORD EMFORMTYPE_0x4; // at 0x4/0xc
u16 SHORT_0x8; // at 0x8/0x10
u16 SHORT_0xA; // at 0xa/0x12
s8 SBYTE_0xC; // at 0xc/0x14
s8 SBYTE_0xD; // at 0xd/0x15
s8 SBYTE_0xE; // at 0xe/0x16
s8 SBYTE_0xF; // at 0xf/0x17
float FLOAT_0x10; // at 0x10/0x18
u16 SHORT_0x14; // at 0x14/0x1c
u16 SHORT_0x16; // at 0x16/0x1e
u16 SHORT_0x18; // at 0x18/0x20
s8 BYTE_0x1A; // at 0x1a/0x22
s8 BYTE_0x1B; // at 0x1b/0x23
float FLOAT_0x1C;
float FLOAT_0x20;
float FLOAT_0x24;
float FLOAT_0x28;
float FLOAT_0x2C;
float FLOAT_0x30;
u16 SHORT_0x34;
u8 BYTE_0x36;
u8 BYTE_0x37;
float FLOAT_0x38;
float FLOAT_0x3C;
float FLOAT_0x40;
float FLOAT_0x44;
float FLOAT_0x48;
float FLOAT_0x4C;
float FLOAT_0x50;
float FLOAT_0x54;
float FLOAT_0x58;
float FLOAT_0x5C;
float FLOAT_0x60;
float FLOAT_0x64;
float FLOAT_0x68;
float FLOAT_0x6C;
float FLOAT_0x70;
float FLOAT_0x74;
float FLOAT_0x78;
float FLOAT_0x7C;
float FLOAT_0x80;
u8 BYTE_0x84; // at 0x84/0x8c
u8 BYTE_0x85; // at 0x85/0x8d
u8 BYTE_0x86; // at 0x86/0x8e
UNKWORD WORD_0x88;
};
struct EmitTrack
{
u8 BYTE_0x0;
u8 BYTE_0x1;
u16 SHORT_0x2;
u8 BYTE_0x4;
};
struct EmitterResource
{
char UNK_0x0[0x4];
u32 OFFSET_0x4;
EmitterDesc STRUCT_0x8;
inline UNKTYPE * SkipEmitterDesc()
{
return (char *)&STRUCT_0x8 + OFFSET_0x4;
}
inline UNKTYPE * SkipParticleParameterDesc()
{
char * particleDesc = (char *)SkipEmitterDesc();
return particleDesc + *(int *)particleDesc;
}
inline u16 NumEmitInitTrack()
{
u16 * ptr = (u16 *)SkipParticleParameterDesc();
return ptr[(4**(ptr += 2))+3];
}
inline u16 NumEmitTrack()
{
u16 * ptr = (u16 *)SkipParticleParameterDesc();
return ptr[(4**(ptr += 2))+2];
}
inline EmitTrack * GetEmitTrack(u16 i)
{
u16 * ptr = (u16 *)SkipParticleParameterDesc();
return reinterpret_cast<EmitTrack **>(ptr)[(2**(ptr += 1))+1+i];
}
};
struct Emitter : ReferencedObject
{
virtual bool Initialize(Effect *, EmitterResource *, u8); // at 0x10
virtual Emitter * CreateEmitter(EmitterResource *, EmitterInheritSetting *, Particle *, u16); // at 0x14
virtual void CalcEmitter(); // at 0x18
virtual void CalcParticle(); // at 0x1c
virtual void CalcEmission(); // at 0x20
virtual void CalcBillboard(); // at 0x24
u32 mFlags;
UNKWORD WORD_0x24;
//char UNK_0x28[0x8C];
float FLOAT_0x28;
float FLOAT_0x2C;
short SHORT_0x30;
short SHORT_0x32;
float FLOAT_0x34;
float FLOAT_0x38;
short SHORT_0x3C;
float FLOAT_0x40;
float FLOAT_0x44;
float FLOAT_0x48;
float FLOAT_0x4C;
float FLOAT_0x50;
float FLOAT_0x54;
float FLOAT_0x58;
float FLOAT_0x5C;
float FLOAT_0x60;
u8 BYTE_0x64;
s8 BYTE_0x65;
u8 BYTE_0x66;
s8 BYTE_0x67;
float FLOAT_0x68;
float FLOAT_0x6C;
float FLOAT_0x70;
float FLOAT_0x74;
float FLOAT_0x78;
float FLOAT_0x7C;
float FLOAT_0x80;
float FLOAT_0x84;
float FLOAT_0x88;
float FLOAT_0x8C;
/*
float FLOAT_0x90;
float FLOAT_0x94;
float FLOAT_0x98;
*/
math::VEC3 VEC_0x90;
/*
float FLOAT_0x9C;
float FLOAT_0xA0;
float FLOAT_0xA4;
*/
math::VEC3 VEC_0x9C;
/*
float FLOAT_0xA8;
float FLOAT_0xAC;
float FLOAT_0xB0;
*/
math::VEC3 VEC_0xA8;
UNKWORD WORD_0xB4;
EmitterResource * mResource; // at 0xb8
Effect * mEffect; // at 0xbc
ActivityList mManagers; // at 0xc0
char UNK_0xDA[0x2];
u8 BYTE_0xDC;
u16 SHORT_0xDE;
u16 SHORT_0xE0;
UNKWORD WORD_0xE4;
u16 SHORT_0xE8;
u16 SHORT_0xEA;
Random mRandom; // at 0xec
EmitterForm * mForm; // at 0xf0
Emitter * mParent; // at 0xf4
Particle * REF_0xF8; // at 0xf8
EmitterInheritSetting mInheritSettings; // at 0xfc
bool mMtxDirtyFlag; // at 0x104
math::MTX34 mGlobalMtx; // at 0x108
Emitter();
~Emitter();
u16 RetireParticleAll();
bool SendClosing();
void DestroyFunc();
bool Closing(ParticleManager *);
bool RetireParticleManager(ParticleManager *);
u16 RetireParticleManagerAll();
bool InitializeDatas(EmitterResource *, Effect *);
ParticleManager * FindParticleManager(EmitterResource *, bool, bool, s8, u8);
UNKTYPE CreateEmitterTmp(EmitterResource *, EmitterInheritSetting *, Particle *, u16);
float GetLODratio(math::VEC3 &, math::VEC3 &, float, float, float, float);
u16 ForeachParticleManager(Action, u32, bool, bool);
UNKTYPE Emission(ParticleManager *, const math::MTX34 *);
math::MTX34 * CalcGlobalMtx(math::MTX34 *);
UNKTYPE SetMtxDirty();
static math::MTX34 * RestructMatrix(math::MTX34 *, math::MTX34 *, bool, bool, s8);
u16 GetNumParticleManager() const;
ParticleManager * GetParticleManager(u16);
inline bool GetFlagDisableCalc() const
{
return mFlags & 0x200;
}
};
}
}
namespace nw4r {
namespace ef {
struct ResEmitter {
EmitterResource *mPtr;
#endif
inline EmitterResource *ptr() {
return mPtr;
}
};
struct EmitterInheritSetting {
s16 SHORT_0x0;
u8 BYTE_0x2;
u8 BYTE_0x3;
u8 BYTE_0x4;
u8 BYTE_0x5;
u8 BYTE_0x6;
u8 BYTE_0x7;
};
struct EmitterDesc {
UNKWORD FLAGS_0x0; // at 0x0/0x8
UNKWORD EMFORMTYPE_0x4; // at 0x4/0xc
u16 SHORT_0x8; // at 0x8/0x10
u16 SHORT_0xA; // at 0xa/0x12
s8 SBYTE_0xC; // at 0xc/0x14
s8 SBYTE_0xD; // at 0xd/0x15
s8 SBYTE_0xE; // at 0xe/0x16
s8 SBYTE_0xF; // at 0xf/0x17
float FLOAT_0x10; // at 0x10/0x18
u16 SHORT_0x14; // at 0x14/0x1c
u16 SHORT_0x16; // at 0x16/0x1e
u16 SHORT_0x18; // at 0x18/0x20
s8 BYTE_0x1A; // at 0x1a/0x22
s8 BYTE_0x1B; // at 0x1b/0x23
float FLOAT_0x1C;
float FLOAT_0x20;
float FLOAT_0x24;
float FLOAT_0x28;
float FLOAT_0x2C;
float FLOAT_0x30;
u16 SHORT_0x34;
u8 BYTE_0x36;
u8 BYTE_0x37;
float FLOAT_0x38;
float FLOAT_0x3C;
float FLOAT_0x40;
float FLOAT_0x44;
float FLOAT_0x48;
float FLOAT_0x4C;
float FLOAT_0x50;
float FLOAT_0x54;
float FLOAT_0x58;
float FLOAT_0x5C;
float FLOAT_0x60;
float FLOAT_0x64;
float FLOAT_0x68;
float FLOAT_0x6C;
float FLOAT_0x70;
float FLOAT_0x74;
float FLOAT_0x78;
float FLOAT_0x7C;
float FLOAT_0x80;
u8 BYTE_0x84; // at 0x84/0x8c
u8 BYTE_0x85; // at 0x85/0x8d
u8 BYTE_0x86; // at 0x86/0x8e
UNKWORD WORD_0x88;
};
struct EmitTrack {
u8 BYTE_0x0;
u8 BYTE_0x1;
u16 SHORT_0x2;
u8 BYTE_0x4;
};
struct EmitterResource {
char UNK_0x0[0x4];
u32 OFFSET_0x4;
EmitterDesc STRUCT_0x8;
inline UNKTYPE *SkipEmitterDesc() {
return (char *)&STRUCT_0x8 + OFFSET_0x4;
}
inline UNKTYPE *SkipParticleParameterDesc() {
char *particleDesc = (char *)SkipEmitterDesc();
return particleDesc + *(int *)particleDesc;
}
inline u16 NumEmitInitTrack() {
u16 *ptr = (u16 *)SkipParticleParameterDesc();
return ptr[(4 * *(ptr += 2)) + 3];
}
inline u16 NumEmitTrack() {
u16 *ptr = (u16 *)SkipParticleParameterDesc();
return ptr[(4 * *(ptr += 2)) + 2];
}
inline EmitTrack *GetEmitTrack(u16 i) {
u16 *ptr = (u16 *)SkipParticleParameterDesc();
return reinterpret_cast<EmitTrack **>(ptr)[(2 * *(ptr += 1)) + 1 + i];
}
};
struct Emitter : ReferencedObject {
virtual bool Initialize(Effect *, EmitterResource *, u8); // at 0x10
virtual Emitter *CreateEmitter(EmitterResource *, EmitterInheritSetting *, Particle *, u16); // at 0x14
virtual void CalcEmitter(); // at 0x18
virtual void CalcParticle(); // at 0x1c
virtual void CalcEmission(); // at 0x20
virtual void CalcBillboard(); // at 0x24
u32 mFlags;
UNKWORD WORD_0x24;
// char UNK_0x28[0x8C];
float FLOAT_0x28;
float FLOAT_0x2C;
short SHORT_0x30;
short SHORT_0x32;
float FLOAT_0x34;
float FLOAT_0x38;
short SHORT_0x3C;
float FLOAT_0x40;
float FLOAT_0x44;
float FLOAT_0x48;
float FLOAT_0x4C;
float FLOAT_0x50;
float FLOAT_0x54;
float FLOAT_0x58;
float FLOAT_0x5C;
float FLOAT_0x60;
u8 BYTE_0x64;
s8 BYTE_0x65;
u8 BYTE_0x66;
s8 BYTE_0x67;
float FLOAT_0x68;
float FLOAT_0x6C;
float FLOAT_0x70;
float FLOAT_0x74;
float FLOAT_0x78;
float FLOAT_0x7C;
float FLOAT_0x80;
float FLOAT_0x84;
float FLOAT_0x88;
float FLOAT_0x8C;
/*
float FLOAT_0x90;
float FLOAT_0x94;
float FLOAT_0x98;
*/
math::VEC3 VEC_0x90;
/*
float FLOAT_0x9C;
float FLOAT_0xA0;
float FLOAT_0xA4;
*/
math::VEC3 VEC_0x9C;
/*
float FLOAT_0xA8;
float FLOAT_0xAC;
float FLOAT_0xB0;
*/
math::VEC3 VEC_0xA8;
UNKWORD WORD_0xB4;
EmitterResource *mResource; // at 0xb8
Effect *mEffect; // at 0xbc
ActivityList mManagers; // at 0xc0
char UNK_0xDA[0x2];
u8 BYTE_0xDC;
u16 SHORT_0xDE;
u16 SHORT_0xE0;
UNKWORD WORD_0xE4;
u16 SHORT_0xE8;
u16 SHORT_0xEA;
Random mRandom; // at 0xec
EmitterForm *mForm; // at 0xf0
Emitter *mParent; // at 0xf4
Particle *REF_0xF8; // at 0xf8
EmitterInheritSetting mInheritSettings; // at 0xfc
bool mMtxDirtyFlag; // at 0x104
math::MTX34 mGlobalMtx; // at 0x108
Emitter();
~Emitter();
u16 RetireParticleAll();
bool SendClosing();
void DestroyFunc();
bool Closing(ParticleManager *);
bool RetireParticleManager(ParticleManager *);
u16 RetireParticleManagerAll();
bool InitializeDatas(EmitterResource *, Effect *);
ParticleManager *FindParticleManager(EmitterResource *, bool, bool, s8, u8);
UNKTYPE CreateEmitterTmp(EmitterResource *, EmitterInheritSetting *, Particle *, u16);
float GetLODratio(math::VEC3 &, math::VEC3 &, float, float, float, float);
u16 ForeachParticleManager(Action, u32, bool, bool);
UNKTYPE Emission(ParticleManager *, const math::MTX34 *);
math::MTX34 *CalcGlobalMtx(math::MTX34 *);
UNKTYPE SetMtxDirty();
static math::MTX34 *RestructMatrix(math::MTX34 *, math::MTX34 *, bool, bool, s8);
u16 GetNumParticleManager() const;
ParticleManager *GetParticleManager(u16);
inline bool GetFlagDisableCalc() const {
return mFlags & 0x200;
}
};
} // namespace ef
} // namespace nw4r
#endif
+13 -15
View File
@@ -1,19 +1,17 @@
#ifndef NW4R_EF_EMITTERFORM_H
#define NW4R_EF_EMITTERFORM_H
#include "types_nw4r.h"
#include "common.h"
namespace nw4r
{
namespace ef
{
struct EmitterForm
{
virtual UNKTYPE Emission(Emitter *, ParticleManager *, int, u32, float *, u16, float, const math::MTX34 *) = 0;
UNKTYPE CalcVelocity(math::VEC3 *, Emitter *, const math::VEC3 &, const math::VEC3 &, const math::VEC3 &, const math::VEC3 &) const;
u16 CalcLife(u16, float, Emitter *);
};
}
}
namespace nw4r {
namespace ef {
struct EmitterForm {
virtual UNKTYPE Emission(Emitter *, ParticleManager *, int, u32, float *, u16, float, const math::MTX34 *) = 0;
#endif
UNKTYPE CalcVelocity(math::VEC3 *, Emitter *, const math::VEC3 &, const math::VEC3 &, const math::VEC3 &,
const math::VEC3 &) const;
u16 CalcLife(u16, float, Emitter *);
};
} // namespace ef
} // namespace nw4r
#endif
+21 -25
View File
@@ -1,29 +1,25 @@
#ifndef NW4R_EF_HANDLE_H
#define NW4R_EF_HANDLE_H
#include "types_nw4r.h"
#include "common.h"
namespace nw4r
{
namespace ef
{
struct LinkedObject
{
char UNK_0x0[8];
LinkedObject * PTR_0x8;
};
struct HandleBase
{
LinkedObject * PTR_0x0;
LinkedObject * mPtr;
HandleBase();
HandleBase & operator=(const HandleBase &);
HandleBase & operator=(LinkedObject *);
bool IsValid() const;
LinkedObject * GetPtr() const;
};
}
}
namespace nw4r {
namespace ef {
struct LinkedObject {
char UNK_0x0[8];
LinkedObject *PTR_0x8;
};
#endif
struct HandleBase {
LinkedObject *PTR_0x0;
LinkedObject *mPtr;
HandleBase();
HandleBase &operator=(const HandleBase &);
HandleBase &operator=(LinkedObject *);
bool IsValid() const;
LinkedObject *GetPtr() const;
};
} // namespace ef
} // namespace nw4r
#endif
+51 -61
View File
@@ -1,67 +1,57 @@
#ifndef NW4R_EF_LIST
#define NW4R_EF_LIST
#include "types_nw4r.h"
#include "common.h"
#include "ut_list.h"
namespace nw4r
{
namespace ef
{
//sizeof(ActivityList) = 0x1C
struct ActivityList
{
ut::List mActive;
ut::List mClosing;
u16 mNumActive;
inline void SetOffset(u16 offset)
{
ut::List_Init(&mActive, offset);
ut::List_Init(&mClosing, offset);
mNumActive = 0;
}
inline ActivityList(u16 offset)
{
SetOffset(offset);
}
inline ActivityList()
{
SetOffset(0);
}
inline void Initialize()
{
mActive.first = NULL;
mActive.size = 0;
mActive.last = NULL;
mClosing.first = NULL;
mClosing.size = 0;
mClosing.last = NULL;
mNumActive = 0;
}
inline void ToActive(void * pNode)
{
ut::List_Append(&mActive, pNode);
mNumActive++;
}
inline void ToClosing(void * pNode)
{
ut::List_Remove(&mActive, pNode);
ut::List_Append(&mClosing, pNode);
}
inline void ToWait(void * pNode)
{
mNumActive--;
}
};
}
}
namespace nw4r {
namespace ef {
// sizeof(ActivityList) = 0x1C
struct ActivityList {
ut::List mActive;
ut::List mClosing;
u16 mNumActive;
inline void SetOffset(u16 offset) {
ut::List_Init(&mActive, offset);
ut::List_Init(&mClosing, offset);
mNumActive = 0;
}
inline ActivityList(u16 offset) {
SetOffset(offset);
}
inline ActivityList() {
SetOffset(0);
}
inline void Initialize() {
mActive.first = NULL;
mActive.size = 0;
mActive.last = NULL;
mClosing.first = NULL;
mClosing.size = 0;
mClosing.last = NULL;
mNumActive = 0;
}
inline void ToActive(void *pNode) {
ut::List_Append(&mActive, pNode);
mNumActive++;
}
inline void ToClosing(void *pNode) {
ut::List_Remove(&mActive, pNode);
ut::List_Append(&mClosing, pNode);
}
inline void ToWait(void *pNode) {
mNumActive--;
}
};
} // namespace ef
} // namespace nw4r
#endif
+36 -39
View File
@@ -1,43 +1,40 @@
#ifndef NW4R_EF_MEMORYMANAGERBASE
#define NW4R_EF_MEMORYMANAGERBASE
#include "types_nw4r.h"
#include "common.h"
namespace nw4r
{
namespace ef
{
struct MemoryManagerBase
{
virtual ~MemoryManagerBase(); // at 0x8
virtual UNKTYPE GarbageCollection() = 0; // at 0xc
virtual Effect * AllocEffect() = 0; // at 0x10
virtual UNKTYPE FreeEffect(void *) = 0; // at 0x14
virtual UNKWORD GetNumAllocEffect() const = 0; // at 0x18
virtual UNKWORD GetNumActiveEffect() const = 0; // at 0x1c
virtual UNKWORD GetNumFreeEffect() const = 0; // at 0x20
virtual Emitter * AllocEmitter() = 0; // at 0x24
virtual UNKTYPE FreeEmitter(void *) = 0; // at 0x28
virtual UNKWORD GetNumAllocEmitter() const = 0; // at 0x2c
virtual UNKWORD GetNumActiveEmitter() const = 0; // at 0x30
virtual UNKWORD GetNumFreeEmitter() const = 0; // at 0x34
virtual ParticleManager * AllocParticleManager() = 0; // at 0x38
virtual UNKTYPE FreeParticleManager(void *) = 0; // at 0x3c
virtual UNKWORD GetNumAllocParticleManager() const = 0; // at 0x40
virtual UNKWORD GetNumActiveParticleManager() const = 0; // at 0x44
virtual UNKWORD GetNumFreeParticleManager() const = 0; // at 0x48
virtual Particle * AllocParticle() = 0; // at 0x4c
virtual UNKTYPE FreeParticle(void *) = 0; // at 0x50
virtual UNKWORD GetNumAllocParticle() const = 0; // at 0x54
virtual UNKWORD GetNumActiveParticle() const = 0; // at 0x58
virtual UNKWORD GetNumFreeParticle() const = 0; // at 0x5c
virtual void * AllocHeap(u32) = 0; // at 0x60
};
}
}
namespace nw4r {
namespace ef {
struct MemoryManagerBase {
virtual ~MemoryManagerBase(); // at 0x8
virtual UNKTYPE GarbageCollection() = 0; // at 0xc
#endif
virtual Effect *AllocEffect() = 0; // at 0x10
virtual UNKTYPE FreeEffect(void *) = 0; // at 0x14
virtual UNKWORD GetNumAllocEffect() const = 0; // at 0x18
virtual UNKWORD GetNumActiveEffect() const = 0; // at 0x1c
virtual UNKWORD GetNumFreeEffect() const = 0; // at 0x20
virtual Emitter *AllocEmitter() = 0; // at 0x24
virtual UNKTYPE FreeEmitter(void *) = 0; // at 0x28
virtual UNKWORD GetNumAllocEmitter() const = 0; // at 0x2c
virtual UNKWORD GetNumActiveEmitter() const = 0; // at 0x30
virtual UNKWORD GetNumFreeEmitter() const = 0; // at 0x34
virtual ParticleManager *AllocParticleManager() = 0; // at 0x38
virtual UNKTYPE FreeParticleManager(void *) = 0; // at 0x3c
virtual UNKWORD GetNumAllocParticleManager() const = 0; // at 0x40
virtual UNKWORD GetNumActiveParticleManager() const = 0; // at 0x44
virtual UNKWORD GetNumFreeParticleManager() const = 0; // at 0x48
virtual Particle *AllocParticle() = 0; // at 0x4c
virtual UNKTYPE FreeParticle(void *) = 0; // at 0x50
virtual UNKWORD GetNumAllocParticle() const = 0; // at 0x54
virtual UNKWORD GetNumActiveParticle() const = 0; // at 0x58
virtual UNKWORD GetNumFreeParticle() const = 0; // at 0x5c
virtual void *AllocHeap(u32) = 0; // at 0x60
};
} // namespace ef
} // namespace nw4r
#endif
+16 -19
View File
@@ -1,24 +1,21 @@
#ifndef NW4R_EF_PARTICLE_H
#define NW4R_EF_PARTICLE_H
#include "types_nw4r.h"
#include "common.h"
#include "ef_ref.h"
namespace nw4r
{
namespace ef
{
struct Particle : ReferencedObject
{
char UNK_0x20[0x8C];
math::VEC3 VEC_0xAC;
math::VEC3 VEC_0xB8;
char UNK_0xC4[0x4];
ParticleManager * mManager; // at 0xc8
};
}
}
namespace nw4r {
namespace ef {
struct Particle : ReferencedObject {
char UNK_0x20[0x8C];
#endif
math::VEC3 VEC_0xAC;
math::VEC3 VEC_0xB8;
char UNK_0xC4[0x4];
ParticleManager *mManager; // at 0xc8
};
} // namespace ef
} // namespace nw4r
#endif
+65 -73
View File
@@ -1,91 +1,83 @@
#ifndef NW4R_EF_PARTICLEMANAGER
#define NW4R_EF_PARTICLEMANAGER
#include "types_nw4r.h"
#include "math_types.h"
#include "common.h"
#include "ef_list.h"
#include "ef_ref.h"
#include "math_types.h"
#include "ut_Color.h"
namespace nw4r
{
namespace ef
{
struct ParticleManager : ReferencedObject
{
struct ParticleModifier
{
math::VEC2 mScale; // at 0x0
math::VEC3 mRotate; // at 0x8
namespace nw4r {
namespace ef {
struct ParticleManager : ReferencedObject {
struct ParticleModifier {
math::VEC2 mScale; // at 0x0
math::VEC3 mRotate; // at 0x8
struct SimpleLight
{
u8 mType; // at 0x0
ut::Color mAmbColor; // at 0x1
} mLight;
};
struct SimpleLight {
u8 mType; // at 0x0
ut::Color mAmbColor; // at 0x1
} mLight;
};
UNKTYPE BeginDraw();
UNKTYPE EndDraw();
UNKTYPE BeginCalc(bool);
UNKTYPE EndCalc();
bool SendClosing();
UNKTYPE DestroyFunc();
virtual bool Initialize(Emitter *, EmitterResource *);
virtual UNKTYPE CreateParticle(u16, math::VEC3, math::VEC3, const math::MTX34 *, float, const EmitterInheritSetting *, Particle *, u16);
virtual UNKTYPE Calc();
virtual UNKTYPE Draw(const DrawInfo &);
Emitter * mEmitter; // at 0x20
EmitterResource * mResource; // at 0x24
UNKWORD FLAGS_0x28;
char UNK_0x2C[0xC];
ActivityList EFLIST_0x38;
char UNK_0x54[0x4];
UNKTYPE BeginDraw();
UNKTYPE EndDraw();
UNKTYPE BeginCalc(bool);
UNKTYPE EndCalc();
ParticleModifier mMod; // at 0x58
bool SendClosing();
UNKTYPE DestroyFunc();
virtual bool Initialize(Emitter *, EmitterResource *);
virtual UNKTYPE CreateParticle(u16, math::VEC3, math::VEC3, const math::MTX34 *, float,
const EmitterInheritSetting *, Particle *, u16);
virtual UNKTYPE Calc();
virtual UNKTYPE Draw(const DrawInfo &);
char UNK_0x74[0x14];
Emitter *mEmitter; // at 0x20
EmitterResource *mResource; // at 0x24
UNKWORD FLAGS_0x28;
char UNK_0x2C[0xC];
ActivityList EFLIST_0x38;
char UNK_0x54[0x4];
s8 BYTE_0x88;
u8 BYTE_0x89;
bool BOOL_0x8A;
ParticleModifier mMod; // at 0x58
UNKWORD FLAGS_0xB4;
u16 RetireParticleAll();
UNKTYPE CalcGlobalMtx(math::MTX34 *);
char UNK_0x74[0x14];
static void ModifierTravFunc_SetSimpleLightType(void *p, u32 payload)
{
ParticleManager *mgr = (ParticleManager *)p;
u8 type = (u8)payload;
mgr->mMod.mLight.mType = type;
}
s8 BYTE_0x88;
u8 BYTE_0x89;
bool BOOL_0x8A;
static void ModifierTravFunc_SetSimpleLightAmbient(void *p, u32 payload)
{
ParticleManager *mgr = (ParticleManager *)p;
ut::Color *color = (ut::Color *)payload;
mgr->mMod.mLight.mAmbColor = *color;
}
UNKWORD FLAGS_0xB4;
static void ModifierTravFunc_SetScale(void *p, u32 payload)
{
ParticleManager *mgr = (ParticleManager *)p;
math::VEC2 *scale = (math::VEC2 *)payload;
mgr->mMod.mScale = *scale;
}
u16 RetireParticleAll();
static void ModifierTravFunc_SetRotate(void *p, u32 payload)
{
ParticleManager *mgr = (ParticleManager *)p;
math::VEC3 *rot = (math::VEC3 *)payload;
mgr->mMod.mRotate = *rot;
}
};
UNKTYPE CalcGlobalMtx(math::MTX34 *);
static void ModifierTravFunc_SetSimpleLightType(void *p, u32 payload) {
ParticleManager *mgr = (ParticleManager *)p;
u8 type = (u8)payload;
mgr->mMod.mLight.mType = type;
}
}
#endif
static void ModifierTravFunc_SetSimpleLightAmbient(void *p, u32 payload) {
ParticleManager *mgr = (ParticleManager *)p;
ut::Color *color = (ut::Color *)payload;
mgr->mMod.mLight.mAmbColor = *color;
}
static void ModifierTravFunc_SetScale(void *p, u32 payload) {
ParticleManager *mgr = (ParticleManager *)p;
math::VEC2 *scale = (math::VEC2 *)payload;
mgr->mMod.mScale = *scale;
}
static void ModifierTravFunc_SetRotate(void *p, u32 payload) {
ParticleManager *mgr = (ParticleManager *)p;
math::VEC3 *rot = (math::VEC3 *)payload;
mgr->mMod.mRotate = *rot;
}
};
} // namespace ef
} // namespace nw4r
#endif
+27 -34
View File
@@ -1,38 +1,31 @@
#ifndef NW4R_EF_RAND_H
#define NW4R_EF_RAND_H
#include "types_nw4r.h"
#include "common.h"
namespace nw4r
{
namespace ef
{
struct Random
{
u32 mSeed; // at 0x0
inline u32 MixRandomSeed()
{
return mSeed = mSeed * 0x343fd + 0x269ec3;
}
inline void Srand(u32 seed)
{
mSeed = seed;
}
inline u32 Rand()
{
//WARNING: THIS INLINE FUNCTION MAY NOT BE ACCURATE
return MixRandomSeed() >> 0x10;
}
inline float RandFloat()
{
//WARNING: THIS INLINE FUNCTION MAY NOT BE ACCURATE
return (float)Rand() / 0xFFFF;
}
};
}
}
namespace nw4r {
namespace ef {
struct Random {
u32 mSeed; // at 0x0
#endif
inline u32 MixRandomSeed() {
return mSeed = mSeed * 0x343fd + 0x269ec3;
}
inline void Srand(u32 seed) {
mSeed = seed;
}
inline u32 Rand() {
// WARNING: THIS INLINE FUNCTION MAY NOT BE ACCURATE
return MixRandomSeed() >> 0x10;
}
inline float RandFloat() {
// WARNING: THIS INLINE FUNCTION MAY NOT BE ACCURATE
return (float)Rand() / 0xFFFF;
}
};
} // namespace ef
} // namespace nw4r
#endif
+40 -43
View File
@@ -1,48 +1,45 @@
#ifndef NW4R_EF_REF
#define NW4R_EF_REF
#include "types_nw4r.h"
#include "common.h"
#include "math_types.h"
namespace nw4r
{
namespace ef
{
struct ReferencedObject
{
char UNK_0x0[0xC];
UNKWORD WORD_0xC;
u32 mRefCount; // at 0x10
char UNK_0x14[0x8];
virtual bool SendClosing();
virtual UNKTYPE DestroyFunc();
inline void Initialize()
{
mRefCount = 0;
WORD_0xC = 1;
}
inline void Ref()
{
mRefCount++;
}
inline void UnRef()
{
if (--mRefCount == 0 && WORD_0xC == 2) SendClosing();
}
inline void Destroy()
{
DestroyFunc();
WORD_0xC = 2;
if (mRefCount == 0) SendClosing();
}
};
typedef ReferencedObject UNKREF;
}
}
namespace nw4r {
namespace ef {
struct ReferencedObject {
char UNK_0x0[0xC];
UNKWORD WORD_0xC;
u32 mRefCount; // at 0x10
char UNK_0x14[0x8];
#endif
virtual bool SendClosing();
virtual UNKTYPE DestroyFunc();
inline void Initialize() {
mRefCount = 0;
WORD_0xC = 1;
}
inline void Ref() {
mRefCount++;
}
inline void UnRef() {
if (--mRefCount == 0 && WORD_0xC == 2) {
SendClosing();
}
}
inline void Destroy() {
DestroyFunc();
WORD_0xC = 2;
if (mRefCount == 0) {
SendClosing();
}
}
};
typedef ReferencedObject UNKREF;
} // namespace ef
} // namespace nw4r
#endif
+11 -14
View File
@@ -1,18 +1,15 @@
#ifndef NW4R_EF_RESOURCE
#define NW4R_EF_RESOURCE
#include "types_nw4r.h"
#include "common.h"
namespace nw4r
{
namespace ef
{
struct Resource
{
EmitterResource * _FindEmitter(const char *, EffectProject *) const;
static Resource * GetInstance();
};
}
}
namespace nw4r {
namespace ef {
struct Resource {
EmitterResource *_FindEmitter(const char *, EffectProject *) const;
#endif
static Resource *GetInstance();
};
} // namespace ef
} // namespace nw4r
#endif
+15 -17
View File
@@ -1,22 +1,20 @@
#ifndef NW4R_EF_UTIL
#define NW4R_EF_UTIL
#include "types_nw4r.h"
#include "common.h"
#include "ut_list.h"
namespace nw4r
{
namespace ef
{
typedef void (* Action)(void *, u32);
u16 UtlistToArray(const ut::List *, void **, int);
UNKTYPE GetDirMtxY(math::MTX34 *, const math::VEC3 &);
UNKTYPE MtxGetRotation(const math::MTX34 &, math::VEC3 *);
UNKTYPE MtxGetTranslate(const math::MTX34 &, math::VEC3 *);
UNKTYPE MtxGetRotationMtx(const math::MTX34 &, math::MTX34 *);
UNKTYPE MtxGetScale(const math::MTX34 &, math::VEC3 *);
}
}
namespace nw4r {
namespace ef {
typedef void (*Action)(void *, u32);
#endif
u16 UtlistToArray(const ut::List *, void **, int);
UNKTYPE GetDirMtxY(math::MTX34 *, const math::VEC3 &);
UNKTYPE MtxGetRotation(const math::MTX34 &, math::VEC3 *);
UNKTYPE MtxGetTranslate(const math::MTX34 &, math::VEC3 *);
UNKTYPE MtxGetRotationMtx(const math::MTX34 &, math::MTX34 *);
UNKTYPE MtxGetScale(const math::MTX34 &, math::VEC3 *);
} // namespace ef
} // namespace nw4r
#endif
+10 -14
View File
@@ -1,20 +1,16 @@
#ifndef NW4R_G3D_3DSMAX_H
#define NW4R_G3D_3DSMAX_H
#include "types_nw4r.h"
#include "common.h"
#include "g3d_anmtexsrt.h"
namespace nw4r
{
namespace g3d
{
namespace detail
{
namespace dcc
{
bool CalcTexMtx_3dsmax(math::MTX34 *, bool, const TexSrt &, TexSrt::Flag);
}
}
}
namespace nw4r {
namespace g3d {
namespace detail {
namespace dcc {
bool CalcTexMtx_3dsmax(math::MTX34 *, bool, const TexSrt &, TexSrt::Flag);
}
} // namespace detail
} // namespace g3d
} // namespace nw4r
#endif
#endif
+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 "types_nw4r.h"
#include <rvl/GX.h>
+16 -31
View File
@@ -1,40 +1,25 @@
#ifndef NW4R_G3D_ANMCHR_H
#define NW4R_G3D_ANMCHR_H
#include "types_nw4r.h"
#include "common.h"
#include "math_types.h"
namespace nw4r
{
namespace g3d
{
struct ChrAnmResult
{
u32 mFlags; // at 0x0
math::VEC3 VEC3_0x4;
math::VEC3 VEC3_0x10;
math::MTX34 mMtx; // at 0x1C
};
namespace nw4r {
namespace g3d {
struct ChrAnmResult {
u32 mFlags; // at 0x0
math::VEC3 VEC3_0x4;
math::VEC3 VEC3_0x10;
math::MTX34 mMtx; // at 0x1C
};
struct AnmObjChr
{
struct AnmObjChr {};
};
struct AnmObjChrNode
{
struct AnmObjChrNode {};
};
struct AnmObjChrBlend {};
struct AnmObjChrBlend
{
struct AnmObjChrRes {};
} // namespace g3d
} // namespace nw4r
};
struct AnmObjChrRes
{
};
}
}
#endif
#endif
+13 -19
View File
@@ -1,23 +1,17 @@
#ifndef NW4R_G3D_ANMCLR_H
#define NW4R_G3D_ANMCLR_H
#include "types_nw4r.h"
#include "common.h"
namespace nw4r
{
namespace g3d
{
struct ClrAnmResult
{
enum
{
ANM_COUNT = 11
};
u32 mFlags; // at 0x0
u32 COLORS_0x4[ANM_COUNT];
UNKWORD WORDS_0x30[ANM_COUNT];
};
}
}
namespace nw4r {
namespace g3d {
struct ClrAnmResult {
enum { ANM_COUNT = 11 };
#endif
u32 mFlags; // at 0x0
u32 COLORS_0x4[ANM_COUNT];
UNKWORD WORDS_0x30[ANM_COUNT];
};
} // namespace g3d
} // namespace nw4r
#endif
+1 -1
View File
@@ -1,6 +1,6 @@
#ifndef NW4R_G3D_ANMFOG_H
#define NW4R_G3D_ANMFOG_H
#include "types_nw4r.h"
#include "common.h"
#include "ut_Color.h"
#include <rvl/GX.h>
+94 -120
View File
@@ -1,129 +1,103 @@
#ifndef NW4R_G3D_ANMOBJ_H
#define NW4R_G3D_ANMOBJ_H
#include "types_nw4r.h"
#include "common.h"
#include "g3d_obj.h"
#include "g3d_rescommon.h"
#include "g3d_resmdl.h"
#include "g3d_obj.h"
namespace nw4r
{
namespace g3d
{
enum AnmPolicy
{
ANM_POLICY_ONETIME,
ANM_POLICY_LOOP,
ANM_POLICY_MAX
};
namespace nw4r {
namespace g3d {
enum AnmPolicy { ANM_POLICY_ONETIME, ANM_POLICY_LOOP, ANM_POLICY_MAX };
typedef f32 (* PlayPolicyFunc)(f32, f32, f32);
f32 PlayPolicy_Onetime(f32, f32, f32);
f32 PlayPolicy_Loop(f32, f32, f32);
typedef f32 (*PlayPolicyFunc)(f32, f32, f32);
f32 PlayPolicy_Onetime(f32, f32, f32);
f32 PlayPolicy_Loop(f32, f32, f32);
inline PlayPolicyFunc GetAnmPlayPolicy(AnmPolicy policy)
{
static PlayPolicyFunc policyTable[ANM_POLICY_MAX] = {
PlayPolicy_Onetime,
PlayPolicy_Loop
};
return policyTable[policy];
}
struct FrameCtrl
{
FrameCtrl(f32 f1, f32 f2, PlayPolicyFunc policy)
: mFrame(0.0f), mRate(1.0f), FLOAT_0x8(f1), mEndFrame(f2), mPolicy(policy) {}
f32 GetFrm() const
{
return mFrame;
}
f32 GetRate() const
{
return mRate;
}
void SetFrm(f32 frm)
{
f32 newFrm = mPolicy(FLOAT_0x8, mEndFrame, frm);
mFrame = newFrm;
}
void SetRate(f32 rate)
{
mRate = rate;
}
void SetPolicy(PlayPolicyFunc func)
{
mPolicy = func;
}
void UpdateFrm()
{
SetFrm(mFrame + mRate * smBaseUpdateRate);
}
f32 mFrame; // at 0x0
f32 mRate; // at 0x4
f32 FLOAT_0x8;
f32 mEndFrame;
PlayPolicyFunc mPolicy; // at 0x10
static f32 smBaseUpdateRate;
};
class AnmObj : public G3dObj
{
public:
enum AnmFlag
{
ANMFLAG_2 = 0x2,
ANMFLAG_ISBOUND = 0x4
};
public:
AnmObj(MEMAllocator *pAllocator, G3dObj *pParent)
: G3dObj(pAllocator, pParent), mFlags(0) {}
virtual bool IsDerivedFrom(TypeObj other) const // at 0x8
{
return (other == GetTypeObjStatic()) ? true
: G3dObj::IsDerivedFrom(other);
}
virtual void G3dProc(u32, u32, void *) = 0; // at 0xC
virtual ~AnmObj() {} // 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
static const TypeObj GetTypeObjStatic()
{
return TypeObj(TYPE_NAME);
}
void SetAnmFlag(AnmFlag, bool);
bool TestAnmFlag(AnmFlag) const;
private:
u32 mFlags; // at 0x4
NW4R_G3D_TYPE_OBJ_DECL(AnmObj);
};
}
inline PlayPolicyFunc GetAnmPlayPolicy(AnmPolicy policy) {
static PlayPolicyFunc policyTable[ANM_POLICY_MAX] = {PlayPolicy_Onetime, PlayPolicy_Loop};
return policyTable[policy];
}
#endif
struct FrameCtrl {
FrameCtrl(f32 f1, f32 f2, PlayPolicyFunc policy)
: mFrame(0.0f), mRate(1.0f), FLOAT_0x8(f1), mEndFrame(f2), mPolicy(policy) {}
f32 GetFrm() const {
return mFrame;
}
f32 GetRate() const {
return mRate;
}
void SetFrm(f32 frm) {
f32 newFrm = mPolicy(FLOAT_0x8, mEndFrame, frm);
mFrame = newFrm;
}
void SetRate(f32 rate) {
mRate = rate;
}
void SetPolicy(PlayPolicyFunc func) {
mPolicy = func;
}
void UpdateFrm() {
SetFrm(mFrame + mRate * smBaseUpdateRate);
}
f32 mFrame; // at 0x0
f32 mRate; // at 0x4
f32 FLOAT_0x8;
f32 mEndFrame;
PlayPolicyFunc mPolicy; // at 0x10
static f32 smBaseUpdateRate;
};
class AnmObj : public G3dObj {
public:
enum AnmFlag { ANMFLAG_2 = 0x2, ANMFLAG_ISBOUND = 0x4 };
public:
AnmObj(MEMAllocator *pAllocator, G3dObj *pParent) : G3dObj(pAllocator, pParent), mFlags(0) {}
virtual bool IsDerivedFrom(TypeObj other) const // at 0x8
{
return (other == GetTypeObjStatic()) ? true : G3dObj::IsDerivedFrom(other);
}
virtual void G3dProc(u32, u32, void *) = 0; // at 0xC
virtual ~AnmObj() {} // 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
static const TypeObj GetTypeObjStatic() {
return TypeObj(TYPE_NAME);
}
void SetAnmFlag(AnmFlag, bool);
bool TestAnmFlag(AnmFlag) const;
private:
u32 mFlags; // at 0x4
NW4R_G3D_TYPE_OBJ_DECL(AnmObj);
};
} // namespace g3d
} // namespace nw4r
#endif
+49 -53
View File
@@ -1,60 +1,56 @@
#ifndef NW4R_G3D_ANMSCN_H
#define NW4R_G3D_ANMSCN_H
#include "types_nw4r.h"
#include "g3d_obj.h"
#include "g3d_light.h"
#include "g3d_fog.h"
#include "common.h"
#include "g3d_camera.h"
#include "g3d_fog.h"
#include "g3d_light.h"
#include "g3d_obj.h"
namespace nw4r
{
namespace g3d
{
class AnmScnRes // : public AnmScn
{
};
namespace nw4r {
namespace g3d {
class AnmScnRes // : public AnmScn
{};
class AnmScn : G3dObj
{
public:
AnmScn(MEMAllocator *);
virtual bool IsDerivedFrom(TypeObj other) const; // at 0x8
virtual ~AnmScn(); // at 0x10
virtual const TypeObj GetTypeObj() const; // at 0x14
virtual const char * GetTypeName() const; // at 0x18
virtual void SetFrame(f32) = 0; // at 0x1C
virtual f32 GetFrame() const = 0; // at 0x20
virtual void SetUpdateRate(f32) = 0; // at 0x24
virtual f32 GetUpdateRate() const = 0; // at 0x28
virtual void UpdateFrame() = 0; // at 0x2C
virtual void Attach(int, AnmScnRes); // at 0x30
virtual void Detach(); // at 0x34
virtual int GetNumLightSet() const = 0; // at 0x38
virtual int GetNumAmbLight() const = 0; // at 0x3C
virtual int GetNumDiffuseLight() const = 0; // at 0x40
virtual int GetNumSpecularLight() const = 0; // at 0x44
virtual int GetNumFog() const = 0; // at 0x48
virtual int GetNumCamera() const = 0; // at 0x4C
virtual int GetLightSetMaxRefNumber() const = 0; // at 0x50
virtual int GetAmbLightMaxRefNumber() const = 0; // at 0x54
virtual int GetDiffuseLightMaxRefNumber() const = 0; // at 0x58
virtual int GetFogMaxRefNumber() const = 0; // at 0x5C
virtual int GetCameraMaxRefNumber() const = 0; // at 0x60
virtual void GetLightSet(LightSet, u32) = 0; // at 0x64
virtual ut::Color GetAmbLightColor(u32) = 0; // at 0x68
virtual void GetLight(LightObj *, LightObj *, u32) = 0; // at 0x6C
virtual void GetFog(Fog, u32) = 0; // at 0x70
virtual void GetCamera(Camera, u32) = 0; // at 0x74
virtual int GetSpecularLightID(u32) const = 0; // at 0x78
virtual bool HasSpecularLight(u32) const = 0; // at 0x7C
virtual void GetAmbLightResult(AmbLightAnmResult *, u32) = 0; // at 0x80
virtual void GetLightResult(LightAnmResult *, u32) = 0; // at 0x84
virtual void GetFogResult(FogAnmResult *, u32) = 0; // at 0x88
virtual void GetFogResult(CameraAnmResult *, u32) = 0; // at 0x8C
class AnmScn : G3dObj {
public:
AnmScn(MEMAllocator *);
virtual bool IsDerivedFrom(TypeObj other) const; // at 0x8
virtual ~AnmScn(); // at 0x10
virtual const TypeObj GetTypeObj() const; // at 0x14
virtual const char *GetTypeName() const; // at 0x18
virtual void SetFrame(f32) = 0; // at 0x1C
virtual f32 GetFrame() const = 0; // at 0x20
virtual void SetUpdateRate(f32) = 0; // at 0x24
virtual f32 GetUpdateRate() const = 0; // at 0x28
virtual void UpdateFrame() = 0; // at 0x2C
virtual void Attach(int, AnmScnRes); // at 0x30
virtual void Detach(); // at 0x34
virtual int GetNumLightSet() const = 0; // at 0x38
virtual int GetNumAmbLight() const = 0; // at 0x3C
virtual int GetNumDiffuseLight() const = 0; // at 0x40
virtual int GetNumSpecularLight() const = 0; // at 0x44
virtual int GetNumFog() const = 0; // at 0x48
virtual int GetNumCamera() const = 0; // at 0x4C
virtual int GetLightSetMaxRefNumber() const = 0; // at 0x50
virtual int GetAmbLightMaxRefNumber() const = 0; // at 0x54
virtual int GetDiffuseLightMaxRefNumber() const = 0; // at 0x58
virtual int GetFogMaxRefNumber() const = 0; // at 0x5C
virtual int GetCameraMaxRefNumber() const = 0; // at 0x60
virtual void GetLightSet(LightSet, u32) = 0; // at 0x64
virtual ut::Color GetAmbLightColor(u32) = 0; // at 0x68
virtual void GetLight(LightObj *, LightObj *, u32) = 0; // at 0x6C
virtual void GetFog(Fog, u32) = 0; // at 0x70
virtual void GetCamera(Camera, u32) = 0; // at 0x74
virtual int GetSpecularLightID(u32) const = 0; // at 0x78
virtual bool HasSpecularLight(u32) const = 0; // at 0x7C
virtual void GetAmbLightResult(AmbLightAnmResult *, u32) = 0; // at 0x80
virtual void GetLightResult(LightAnmResult *, u32) = 0; // at 0x84
virtual void GetFogResult(FogAnmResult *, u32) = 0; // at 0x88
virtual void GetFogResult(CameraAnmResult *, u32) = 0; // at 0x8C
void GetLightSetting(LightSetting *);
};
}
}
void GetLightSetting(LightSetting *);
};
} // namespace g3d
} // namespace nw4r
#endif
#endif
+162 -180
View File
@@ -1,188 +1,170 @@
#ifndef NW4R_G3D_ANMVIS_H
#define NW4R_G3D_ANMVIS_H
#include "types_nw4r.h"
#include "common.h"
#include "g3d_anmobj.h"
#include "g3d_resanmvis.h"
namespace nw4r
{
namespace g3d
namespace nw4r {
namespace g3d {
void ApplyVisAnmResult(ResMdl, AnmObjVis *);
void ApplyVisAnmResult(u8 *, ResMdl, AnmObjVis *);
class AnmObjVis : public AnmObj {
public:
AnmObjVis(MEMAllocator *, u16 *, int);
virtual bool IsDerivedFrom(TypeObj other) const // at 0x8
{
void ApplyVisAnmResult(ResMdl, AnmObjVis *);
void ApplyVisAnmResult(u8 *, ResMdl, AnmObjVis *);
class AnmObjVis : public AnmObj
{
public:
AnmObjVis(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 ~AnmObjVis() {} // 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 AnmObjVisRes * Attach(int, AnmObjVisRes *); // at 0x3C
virtual AnmObjVisRes * 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(AnmObjVis);
};
class AnmObjVisNode : public AnmObjVis
{
public:
AnmObjVisNode(MEMAllocator *allocator, u16 *bindBuffer, int numBinds)
: AnmObjVis(allocator, bindBuffer, numBinds)
{
mResources[0] = NULL;
mResources[1] = NULL;
mResources[2] = NULL;
mResources[3] = NULL;
}
virtual bool IsDerivedFrom(TypeObj other) const // at 0x8
{
return (other == GetTypeObjStatic()) ? true
: AnmObjVis::IsDerivedFrom(other);
}
virtual void G3dProc(u32, u32, void *); // at 0xC
virtual ~AnmObjVisNode(); // 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 void Release(); // at 0x34
virtual bool GetResult(u32) = 0; // at 0x38
virtual AnmObjVisRes * Attach(int, AnmObjVisRes *); // at 0x3C
virtual AnmObjVisRes * Detach(int); // at 0x40
static const TypeObj GetTypeObjStatic()
{
return TypeObj(TYPE_NAME);
}
protected:
AnmObjVisRes *mResources[MAX_RESOURCES]; // at 0x18
NW4R_G3D_TYPE_OBJ_DECL(AnmObjVisNode);
};
class AnmObjVisOR : public AnmObjVisNode
{
public:
AnmObjVisOR(MEMAllocator *allocator, u16 *bindBuffer, int numBinds)
: AnmObjVisNode(allocator, bindBuffer, numBinds)
{
}
virtual bool IsDerivedFrom(TypeObj other) const // at 0x8
{
return (other == GetTypeObjStatic()) ? true
: AnmObjVisNode::IsDerivedFrom(other);
}
virtual ~AnmObjVisOR() {} // at 0x10
virtual const TypeObj GetTypeObj() const // at 0x14
{
return TypeObj(TYPE_NAME);
}
virtual const char * GetTypeName() const // at 0x18
{
return GetTypeObj().GetTypeName();
}
virtual bool GetResult(u32); // at 0x38
static const TypeObj GetTypeObjStatic()
{
return TypeObj(TYPE_NAME);
}
static AnmObjVisOR * Construct(MEMAllocator *, u32 *, ResMdl);
private:
NW4R_G3D_TYPE_OBJ_DECL(AnmObjVisOR);
};
class AnmObjVisRes : public AnmObjVis, public FrameCtrl
{
public:
AnmObjVisRes(MEMAllocator *, ResAnmVis, u16 *, int);
virtual bool IsDerivedFrom(TypeObj other) const // at 0x8
{
return (other == GetTypeObjStatic()) ? true
: AnmObjVis::IsDerivedFrom(other);
}
virtual ~AnmObjVisRes() {} // 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 AnmObjVisRes * Construct(MEMAllocator *, u32 *, ResAnmVis, ResMdl);
private:
ResAnmVis mResAnmVis; // at 0x2C
NW4R_G3D_TYPE_OBJ_DECL(AnmObjVisRes);
};
return (other == GetTypeObjStatic()) ? true : AnmObj::IsDerivedFrom(other);
}
}
virtual void G3dProc(u32, u32, void *); // at 0xC
virtual ~AnmObjVis() {} // 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 AnmObjVisRes *Attach(int, AnmObjVisRes *); // at 0x3C
virtual AnmObjVisRes *Detach(int); // at 0x40
#endif
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(AnmObjVis);
};
class AnmObjVisNode : public AnmObjVis {
public:
AnmObjVisNode(MEMAllocator *allocator, u16 *bindBuffer, int numBinds) : AnmObjVis(allocator, bindBuffer, numBinds) {
mResources[0] = NULL;
mResources[1] = NULL;
mResources[2] = NULL;
mResources[3] = NULL;
}
virtual bool IsDerivedFrom(TypeObj other) const // at 0x8
{
return (other == GetTypeObjStatic()) ? true : AnmObjVis::IsDerivedFrom(other);
}
virtual void G3dProc(u32, u32, void *); // at 0xC
virtual ~AnmObjVisNode(); // 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 void Release(); // at 0x34
virtual bool GetResult(u32) = 0; // at 0x38
virtual AnmObjVisRes *Attach(int, AnmObjVisRes *); // at 0x3C
virtual AnmObjVisRes *Detach(int); // at 0x40
static const TypeObj GetTypeObjStatic() {
return TypeObj(TYPE_NAME);
}
protected:
AnmObjVisRes *mResources[MAX_RESOURCES]; // at 0x18
NW4R_G3D_TYPE_OBJ_DECL(AnmObjVisNode);
};
class AnmObjVisOR : public AnmObjVisNode {
public:
AnmObjVisOR(MEMAllocator *allocator, u16 *bindBuffer, int numBinds)
: AnmObjVisNode(allocator, bindBuffer, numBinds) {}
virtual bool IsDerivedFrom(TypeObj other) const // at 0x8
{
return (other == GetTypeObjStatic()) ? true : AnmObjVisNode::IsDerivedFrom(other);
}
virtual ~AnmObjVisOR() {} // at 0x10
virtual const TypeObj GetTypeObj() const // at 0x14
{
return TypeObj(TYPE_NAME);
}
virtual const char *GetTypeName() const // at 0x18
{
return GetTypeObj().GetTypeName();
}
virtual bool GetResult(u32); // at 0x38
static const TypeObj GetTypeObjStatic() {
return TypeObj(TYPE_NAME);
}
static AnmObjVisOR *Construct(MEMAllocator *, u32 *, ResMdl);
private:
NW4R_G3D_TYPE_OBJ_DECL(AnmObjVisOR);
};
class AnmObjVisRes : public AnmObjVis, public FrameCtrl {
public:
AnmObjVisRes(MEMAllocator *, ResAnmVis, u16 *, int);
virtual bool IsDerivedFrom(TypeObj other) const // at 0x8
{
return (other == GetTypeObjStatic()) ? true : AnmObjVis::IsDerivedFrom(other);
}
virtual ~AnmObjVisRes() {} // 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 AnmObjVisRes *Construct(MEMAllocator *, u32 *, ResAnmVis, ResMdl);
private:
ResAnmVis mResAnmVis; // at 0x2C
NW4R_G3D_TYPE_OBJ_DECL(AnmObjVisRes);
};
} // namespace g3d
} // namespace nw4r
#endif
+7 -9
View File
@@ -1,14 +1,12 @@
#ifndef NW4R_G3D_CALC_VIEW_H
#define NW4R_G3D_CALC_VIEW_H
#include "types_nw4r.h"
#include "common.h"
namespace nw4r
{
namespace g3d
{
void CalcView(math::MTX34 *, math::MTX33 *, const math::MTX34 *, const u32 *,
u32, const math::MTX34 *, ResMdl, math::MTX34 *);
}
namespace nw4r {
namespace g3d {
void CalcView(math::MTX34 *, math::MTX33 *, const math::MTX34 *, const u32 *, u32, const math::MTX34 *, ResMdl,
math::MTX34 *);
}
} // namespace nw4r
#endif
#endif
+9 -13
View File
@@ -1,19 +1,15 @@
#ifndef NW4R_G3D_CALC_WORLD_H
#define NW4R_G3D_CALC_WORLD_H
#include "types_nw4r.h"
#include "common.h"
namespace nw4r
{
namespace g3d
{
void CalcWorld(math::MTX34 *, u32 *, const u8 *, const math::MTX34 *,
ResMdl, AnmObjChr *, FuncObjCalcWorld *, u32);
namespace nw4r {
namespace g3d {
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 *);
void CalcWorld(math::MTX34 *, u32 *, const u8 *, const math::MTX34 *, ResMdl, AnmObjChr *, FuncObjCalcWorld *);
void CalcSkinning(math::MTX34 *, u32 *, ResMdl, const u8 *);
}
}
void CalcSkinning(math::MTX34 *, u32 *, ResMdl, const u8 *);
} // namespace g3d
} // namespace nw4r
#endif
#endif
+1 -1
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 "types_nw4r.h"
#include <rvl/MTX.h>
+10 -13
View File
@@ -1,17 +1,14 @@
#ifndef NW4R_G3D_CPU_H
#define NW4R_G3D_CPU_H
#include "types_nw4r.h"
#include "common.h"
namespace nw4r
{
namespace g3d
{
namespace detail
{
void Copy32ByteBlocks(void *, const void *, u32);
void ZeroMemory32ByteBlocks(void *, u32);
}
}
}
namespace nw4r {
namespace g3d {
namespace detail {
void Copy32ByteBlocks(void *, const void *, u32);
void ZeroMemory32ByteBlocks(void *, u32);
} // namespace detail
} // namespace g3d
} // namespace nw4r
#endif
#endif
+6 -9
View File
@@ -1,15 +1,12 @@
#ifndef NW4R_G3D_DCC_H
#define NW4R_G3D_DCC_H
#include "types_nw4r.h"
#include "common.h"
#include "g3d_anmtexsrt.h"
namespace nw4r
{
namespace g3d
{
void CalcTexMtx(math::MTX34 *, bool, const TexSrt &, TexSrt::Flag,
TexSrtTypedef::TexMatrixMode);
}
namespace nw4r {
namespace g3d {
void CalcTexMtx(math::MTX34 *, bool, const TexSrt &, TexSrt::Flag, TexSrtTypedef::TexMatrixMode);
}
} // namespace nw4r
#endif
#endif
+9 -13
View File
@@ -1,19 +1,15 @@
#ifndef NW4R_G3D_DRAW_H
#define NW4R_G3D_DRAW_H
#include "types_nw4r.h"
#include "common.h"
#include "g3d_resmdl.h"
namespace nw4r
{
namespace g3d
{
struct DrawResMdlReplacement
{
};
namespace nw4r {
namespace g3d {
struct DrawResMdlReplacement {};
void DrawResMdlDirectly(ResMdl, const math::MTX34 *, const math::MTX33 *,
const math::MTX34 *, const u8 *, const u8 *, DrawResMdlReplacement *, u32);
}
}
void DrawResMdlDirectly(ResMdl, const math::MTX34 *, const math::MTX33 *, const math::MTX34 *, const u8 *, const u8 *,
DrawResMdlReplacement *, u32);
} // namespace g3d
} // namespace nw4r
#endif
#endif
+9 -13
View File
@@ -1,20 +1,16 @@
#ifndef NW4R_G3D_DRAW1_MAT1_SHP_H
#define NW4R_G3D_DRAW1_MAT1_SHP_H
#include "types_nw4r.h"
#include "common.h"
#include "g3d_resmat.h"
#include "g3d_resshp.h"
namespace nw4r
{
namespace g3d
{
struct Draw1Mat1ShpSwap
{
};
namespace nw4r {
namespace g3d {
struct Draw1Mat1ShpSwap {};
void Draw1Mat1ShpDirectly(ResMat, ResShp, const math::MTX34 *,
const math::MTX34 *, u32, Draw1Mat1ShpSwap *, G3DState::IndMtxOp *);
}
}
void Draw1Mat1ShpDirectly(ResMat, ResShp, const math::MTX34 *, const math::MTX34 *, u32, Draw1Mat1ShpSwap *,
G3DState::IndMtxOp *);
} // namespace g3d
} // namespace nw4r
#endif
#endif
+1 -1
View File
@@ -1,8 +1,8 @@
#ifndef NW4R_G3D_FOG_H
#define NW4R_G3D_FOG_H
#include "common.h"
#include "g3d_rescommon.h"
#include "math_types.h"
#include "types_nw4r.h"
#include "ut_Color.h"
#include <rvl/GX.h>
+1 -1
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 "types_nw4r.h"
#include <rvl/GX.h>
+1 -1
View File
@@ -1,6 +1,6 @@
#ifndef NW4R_G3D_INIT_H
#define NW4R_G3D_INIT_H
#include "types_nw4r.h"
#include "common.h"
#include <rvl/OS.h>
namespace nw4r {
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef NW4R_G3D_LIGHT_H
#define NW4R_G3D_LIGHT_H
#include "common.h"
#include "g3d_rescommon.h"
#include "types_nw4r.h"
#include <rvl/GX.h>
+10 -14
View File
@@ -1,20 +1,16 @@
#ifndef NW4R_G3D_MAYA_H
#define NW4R_G3D_MAYA_H
#include "types_nw4r.h"
#include "common.h"
#include "g3d_anmtexsrt.h"
namespace nw4r
{
namespace g3d
{
namespace detail
{
namespace dcc
{
bool CalcTexMtx_Maya(math::MTX34 *, bool, const TexSrt &, TexSrt::Flag);
}
}
}
namespace nw4r {
namespace g3d {
namespace detail {
namespace dcc {
bool CalcTexMtx_Maya(math::MTX34 *, bool, const TexSrt &, TexSrt::Flag);
}
} // namespace detail
} // namespace g3d
} // namespace nw4r
#endif
#endif
+1 -1
View File
@@ -1,6 +1,6 @@
#ifndef NW4R_G3D_G3DOBJ_H
#define NW4R_G3D_G3DOBJ_H
#include "types_nw4r.h"
#include "common.h"
#include <rvl/MEM/mem_allocator.h>
#define NW4R_G3D_TYPE_OBJ_DECL(VAL) static const nw4r::g3d::G3dObj::ResNameDataT<sizeof(#VAL)> TYPE_NAME
+78 -83
View File
@@ -1,88 +1,83 @@
#ifndef NW4R_G3D_RESANM_H
#define NW4R_G3D_RESANM_H
#include "types_nw4r.h"
#include "common.h"
namespace nw4r
{
namespace g3d
{
struct ResKeyFrameAnmFramesData
{
float mTime; // at 0x0
float mValue; // at 0x4
float mDerivative; // at 0x8
};
struct ResKeyFrameAnmData
{
u16 mCount; // at 0x0
float FLOAT_0x4;
ResKeyFrameAnmFramesData mFrames[]; // at 0x8
};
struct ResColorAnmFramesData
{
u32 mColor; // at 0x0
};
union ResColorAnmData
{
u32 mColor;
s32 mOffset;
};
struct ResBoolAnmFramesData
{
u32 mFlags; // at 0x0
};
union ResAnmData
{
float mValue;
s32 mOffset;
};
namespace detail
{
float GetResKeyFrameAnmResult(const ResKeyFrameAnmData *, float);
u32 GetResColorAnmResult(const ResColorAnmFramesData *, float);
inline u32 GetResColorAnmResult(const ResColorAnmData * pData, float time, bool b)
{
if (b) return pData->mColor;
return GetResColorAnmResult((const ResColorAnmFramesData *)((u8 *)pData + pData->mOffset), time);
}
inline bool GetResBoolAnmFramesResult(const ResBoolAnmFramesData * pData, int i)
{
u32 index = i;
u32 mask = 0x80000000 >> (index % 32);
u32 flags = pData[index / 32].mFlags;
return flags & mask;
}
template <typename T>
inline float ClipFrame(T & info, float time)
{
if (time <= 0.0f) return 0.0f;
if (info.mNumFrames <= time) return info.mNumFrames;
return time;
}
inline float GetResAnmResult(const ResAnmData * pData, float time, bool b)
{
if (b) return pData->mValue;
return GetResKeyFrameAnmResult((const ResKeyFrameAnmData *)((u8 *)pData + pData->mOffset), time);
}
}
}
namespace nw4r {
namespace g3d {
struct ResKeyFrameAnmFramesData {
float mTime; // at 0x0
float mValue; // at 0x4
float mDerivative; // at 0x8
};
struct ResKeyFrameAnmData {
u16 mCount; // at 0x0
float FLOAT_0x4;
ResKeyFrameAnmFramesData mFrames[]; // at 0x8
};
struct ResColorAnmFramesData {
u32 mColor; // at 0x0
};
union ResColorAnmData {
u32 mColor;
s32 mOffset;
};
struct ResBoolAnmFramesData {
u32 mFlags; // at 0x0
};
union ResAnmData {
float mValue;
s32 mOffset;
};
namespace detail {
float GetResKeyFrameAnmResult(const ResKeyFrameAnmData *, float);
u32 GetResColorAnmResult(const ResColorAnmFramesData *, float);
inline u32 GetResColorAnmResult(const ResColorAnmData *pData, float time, bool b) {
if (b) {
return pData->mColor;
}
return GetResColorAnmResult((const ResColorAnmFramesData *)((u8 *)pData + pData->mOffset), time);
}
#endif
inline bool GetResBoolAnmFramesResult(const ResBoolAnmFramesData *pData, int i) {
u32 index = i;
u32 mask = 0x80000000 >> (index % 32);
u32 flags = pData[index / 32].mFlags;
return flags & mask;
}
template <typename T>
inline float ClipFrame(T &info, float time) {
if (time <= 0.0f) {
return 0.0f;
}
if (info.mNumFrames <= time) {
return info.mNumFrames;
}
return time;
}
inline float GetResAnmResult(const ResAnmData *pData, float time, bool b) {
if (b) {
return pData->mValue;
}
return GetResKeyFrameAnmResult((const ResKeyFrameAnmData *)((u8 *)pData + pData->mOffset), time);
}
} // namespace detail
} // namespace g3d
} // namespace nw4r
#endif
+19 -21
View File
@@ -1,30 +1,28 @@
#ifndef NW4R_G3D_RESANMCAMERA_H
#define NW4R_G3D_RESANMCAMERA_H
#include "types_nw4r.h"
#include "g3d_rescommon.h"
#include "common.h"
#include "g3d_anmcamera.h"
#include "g3d_rescommon.h"
namespace nw4r
{
namespace g3d
{
struct ResAnmCameraData
{
char UNK_0x0[0xC];
u32 mID; // at 0xC
};
namespace nw4r {
namespace g3d {
struct ResAnmCameraData {
char UNK_0x0[0xC];
u32 mID; // at 0xC
};
struct ResAnmCamera
{
ResCommon<ResAnmCameraData> mAnmCamera;
inline ResAnmCamera(void * vptr) : mAnmCamera(vptr) {}
struct ResAnmCamera {
ResCommon<ResAnmCameraData> mAnmCamera;
bool IsValid() const { return mAnmCamera.IsValid(); }
inline ResAnmCamera(void *vptr) : mAnmCamera(vptr) {}
void GetAnmResult(CameraAnmResult *, f32) const;
};
bool IsValid() const {
return mAnmCamera.IsValid();
}
}
#endif
void GetAnmResult(CameraAnmResult *, f32) const;
};
} // namespace g3d
} // namespace nw4r
#endif
+21 -29
View File
@@ -1,35 +1,27 @@
#ifndef NW4R_G3D_RESANMCHR_H
#define NW4R_G3D_RESANMCHR_H
#include "types_nw4r.h"
#include "common.h"
#include "g3d_rescommon.h"
namespace nw4r
{
namespace g3d
{
struct ResAnmChrData
{
char UNK_0x0[0x8];
u32 mRevision; // at 0x8
};
namespace nw4r {
namespace g3d {
struct ResAnmChrData {
char UNK_0x0[0x8];
u32 mRevision; // at 0x8
};
struct ResAnmChr
{
enum
{
REVISION = 4
};
ResCommon<ResAnmChrData> mAnmChr;
inline ResAnmChr(void * vptr) : mAnmChr(vptr) {}
inline bool CheckRevision() const
{
return mAnmChr.ref().mRevision == REVISION;
}
};
}
}
struct ResAnmChr {
enum { REVISION = 4 };
#endif
ResCommon<ResAnmChrData> mAnmChr;
inline ResAnmChr(void *vptr) : mAnmChr(vptr) {}
inline bool CheckRevision() const {
return mAnmChr.ref().mRevision == REVISION;
}
};
} // namespace g3d
} // namespace nw4r
#endif
+19 -21
View File
@@ -1,30 +1,28 @@
#ifndef NW4R_G3D_RESANMFOG_H
#define NW4R_G3D_RESANMFOG_H
#include "types_nw4r.h"
#include "g3d_rescommon.h"
#include "common.h"
#include "g3d_anmfog.h"
#include "g3d_rescommon.h"
namespace nw4r
{
namespace g3d
{
struct ResAnmFogData
{
char UNK_0x0[0xC];
u32 mID; // at 0xC
};
namespace nw4r {
namespace g3d {
struct ResAnmFogData {
char UNK_0x0[0xC];
u32 mID; // at 0xC
};
struct ResAnmFog
{
ResCommon<ResAnmFogData> mAnmFog;
inline ResAnmFog(void * vptr) : mAnmFog(vptr) {}
struct ResAnmFog {
ResCommon<ResAnmFogData> mAnmFog;
void GetAnmResult(FogAnmResult *, f32) const;
inline ResAnmFog(void *vptr) : mAnmFog(vptr) {}
bool IsValid() const { return mAnmFog.IsValid(); }
};
void GetAnmResult(FogAnmResult *, f32) const;
bool IsValid() const {
return mAnmFog.IsValid();
}
}
};
} // namespace g3d
} // namespace nw4r
#endif
#endif
+32 -36
View File
@@ -1,45 +1,41 @@
#ifndef NW4R_G3D_RESANMSCN_H
#define NW4R_G3D_RESANMSCN_H
#include "types_nw4r.h"
#include "g3d_rescommon.h"
#include "g3d_resanmfog.h"
#include "common.h"
#include "g3d_resanmcamera.h"
#include "g3d_resanmfog.h"
#include "g3d_rescommon.h"
namespace nw4r
{
namespace g3d
{
struct ResAnmScnData
{
char UNK_0x0[0x8];
u32 mRevision; // at 0x8
char UNK_0xC[0x3E - 0xC];
u16 mFogMaxRefNum; // at 0x3E
};
namespace nw4r {
namespace g3d {
struct ResAnmScnData {
char UNK_0x0[0x8];
u32 mRevision; // at 0x8
char UNK_0xC[0x3E - 0xC];
u16 mFogMaxRefNum; // at 0x3E
};
struct ResAnmScn
{
enum
{
REVISION = 4
};
ResCommon<ResAnmScnData> mAnmScn;
ResAnmFog GetResAnmFogByRefNumber(u32) const;
ResAnmCamera GetResAnmCameraByRefNumber(u32) const;
struct ResAnmScn {
enum { REVISION = 4 };
inline ResAnmScn(void * vptr) : mAnmScn(vptr) {}
ResCommon<ResAnmScnData> mAnmScn;
inline bool IsValid() const { return mAnmScn.IsValid(); }
inline bool CheckRevision() const
{
return mAnmScn.ref().mRevision == REVISION;
}
ResAnmFog GetResAnmFogByRefNumber(u32) const;
ResAnmCamera GetResAnmCameraByRefNumber(u32) const;
u16 GetResAnmFogMaxRefNumber() const { return mAnmScn.ref().mFogMaxRefNum; }
};
}
}
inline ResAnmScn(void *vptr) : mAnmScn(vptr) {}
#endif
inline bool IsValid() const {
return mAnmScn.IsValid();
}
inline bool CheckRevision() const {
return mAnmScn.ref().mRevision == REVISION;
}
u16 GetResAnmFogMaxRefNumber() const {
return mAnmScn.ref().mFogMaxRefNum;
}
};
} // namespace g3d
} // namespace nw4r
#endif
+21 -29
View File
@@ -1,35 +1,27 @@
#ifndef NW4R_G3D_RESANMSHP_H
#define NW4R_G3D_RESANMSHP_H
#include "types_nw4r.h"
#include "common.h"
#include "g3d_rescommon.h"
namespace nw4r
{
namespace g3d
{
struct ResAnmShpData
{
char UNK_0x0[0x8];
u32 mRevision; // at 0x8
};
namespace nw4r {
namespace g3d {
struct ResAnmShpData {
char UNK_0x0[0x8];
u32 mRevision; // at 0x8
};
struct ResAnmShp
{
enum
{
REVISION = 3
};
ResCommon<ResAnmShpData> mAnmShp;
inline ResAnmShp(void * vptr) : mAnmShp(vptr) {}
inline bool CheckRevision() const
{
return mAnmShp.ref().mRevision == REVISION;
}
};
}
}
struct ResAnmShp {
enum { REVISION = 3 };
#endif
ResCommon<ResAnmShpData> mAnmShp;
inline ResAnmShp(void *vptr) : mAnmShp(vptr) {}
inline bool CheckRevision() const {
return mAnmShp.ref().mRevision == REVISION;
}
};
} // namespace g3d
} // namespace nw4r
#endif
+116 -123
View File
@@ -1,141 +1,134 @@
#ifndef NW4R_G3D_RESCOMMON_H
#define NW4R_G3D_RESCOMMON_H
#include "types_nw4r.h"
#include "common.h"
#define NW4R_G3D_CREATE_RES_NAME_DATA(VAR,VAL) ResNameData ResNameData_##VAR = { sizeof(VAL) - 1, VAL }
#define NW4R_G3D_CREATE_RES_NAME_DATA(VAR, VAL) ResNameData ResNameData_##VAR = {sizeof(VAL) - 1, VAL}
#define FIFO_ACCESS_BP 0x61
#define FIFO_ACCESS_CP 0x8
#define FIFO_ACCESS_XF 0x10
namespace nw4r
{
namespace g3d
{
template <typename T>
class ResCommon
{
T * mPtr;
public:
inline ResCommon(void * vptr) : mPtr(static_cast<T *>(vptr)) {}
inline ResCommon(const void * vptr) : mPtr(static_cast<T *>(vptr)) {}
inline T & ref() const { return *mPtr; }
inline T * ptr() const { return mPtr; }
inline bool IsValid() const { return mPtr != NULL; }
namespace nw4r {
namespace g3d {
template <typename T>
class ResCommon {
T *mPtr;
template <typename TPtr>
inline const TPtr * ofs_to_ptr_raw(s32 ofs) const
{
return (const TPtr *)((u8 *)mPtr + ofs);
}
template <typename TPtr>
inline TPtr * ofs_to_ptr(s32 ofs)
{
if (ofs) return (TPtr *)((u8 *)mPtr + ofs);
return NULL;
}
template <typename TPtr>
inline const TPtr * ofs_to_ptr(s32 ofs) const
{
if (ofs) return (const TPtr *)((u8 *)mPtr + ofs);
return NULL;
}
template <typename TObj>
inline TObj ofs_to_obj(s32 ofs) const
{
if (ofs) return (u8 *)mPtr + ofs;
return NULL;
}
};
struct ResNameData
{
u32 mLength;
char mName[0x1C];
};
public:
inline ResCommon(void *vptr) : mPtr(static_cast<T *>(vptr)) {}
inline ResCommon(const void *vptr) : mPtr(static_cast<T *>(vptr)) {}
struct ResName
{
ResCommon<const ResNameData> mRes;
inline ResName(const void *vptr) : mRes(vptr) {}
inline T &ref() const {
return *mPtr;
}
inline T *ptr() const {
return mPtr;
}
inline bool IsValid() const {
return mPtr != NULL;
}
inline u32 GetLength() const
{
return mRes.ref().mLength;
}
inline const char * GetName() const
{
return mRes.ref().mName;
}
bool operator==(ResName) const;
};
template <typename TPtr>
inline const TPtr *ofs_to_ptr_raw(s32 ofs) const {
return (const TPtr *)((u8 *)mPtr + ofs);
}
namespace detail
{
typedef u8 CPCmd[6];
typedef u8 BPCmd[5];
inline void ResWrite_u8(u8 *res, u8 arg)
{
*res = arg;
}
template <typename TPtr>
inline TPtr *ofs_to_ptr(s32 ofs) {
if (ofs) {
return (TPtr *)((u8 *)mPtr + ofs);
}
inline void ResWrite_u16(u8 *res, u16 arg)
{
ResWrite_u8(res + 0, arg >> 8);
ResWrite_u8(res + 1, arg >> 0);
}
return NULL;
}
inline void ResWrite_u32(u8 *res, u32 arg)
{
ResWrite_u8(res + 0, arg >> 24);
ResWrite_u8(res + 1, arg >> 16);
ResWrite_u8(res + 2, arg >> 8);
ResWrite_u8(res + 3, arg >> 0);
}
template <typename TPtr>
inline const TPtr *ofs_to_ptr(s32 ofs) const {
if (ofs) {
return (const TPtr *)((u8 *)mPtr + ofs);
}
inline u8 ResRead_u8(const u8 *res)
{
return *res;
}
return NULL;
}
inline u32 ResRead_u32(const u8 *res)
{
int ret = ResRead_u8(res) << 24;
ret |= ResRead_u8(res + 1) << 16;
ret |= ResRead_u8(res + 2) << 8;
ret |= ResRead_u8(res + 3);
return ret;
}
inline void ResReadBPCmd(const u8 *res, u32 *out)
{
*out = ResRead_u32(res + 1);
}
inline void ResReadCPCmd(const u8 *res, u32 *out)
{
*out = ResRead_u32(res + 2);
}
void ResWriteBPCmd(u8 *, u32);
void ResWriteBPCmd(u8 *, u32, u32);
void ResWriteCPCmd(u8 *, u8, u32);
void ResWriteXFCmd(u8 *, u16, u32);
void ResWriteSSMask(u8 *, u32);
}
}
template <typename TObj>
inline TObj ofs_to_obj(s32 ofs) const {
if (ofs) {
return (u8 *)mPtr + ofs;
}
return NULL;
}
};
struct ResNameData {
u32 mLength;
char mName[0x1C];
};
struct ResName {
ResCommon<const ResNameData> mRes;
inline ResName(const void *vptr) : mRes(vptr) {}
inline u32 GetLength() const {
return mRes.ref().mLength;
}
inline const char *GetName() const {
return mRes.ref().mName;
}
bool operator==(ResName) const;
};
namespace detail {
typedef u8 CPCmd[6];
typedef u8 BPCmd[5];
inline void ResWrite_u8(u8 *res, u8 arg) {
*res = arg;
}
#endif
inline void ResWrite_u16(u8 *res, u16 arg) {
ResWrite_u8(res + 0, arg >> 8);
ResWrite_u8(res + 1, arg >> 0);
}
inline void ResWrite_u32(u8 *res, u32 arg) {
ResWrite_u8(res + 0, arg >> 24);
ResWrite_u8(res + 1, arg >> 16);
ResWrite_u8(res + 2, arg >> 8);
ResWrite_u8(res + 3, arg >> 0);
}
inline u8 ResRead_u8(const u8 *res) {
return *res;
}
inline u32 ResRead_u32(const u8 *res) {
int ret = ResRead_u8(res) << 24;
ret |= ResRead_u8(res + 1) << 16;
ret |= ResRead_u8(res + 2) << 8;
ret |= ResRead_u8(res + 3);
return ret;
}
inline void ResReadBPCmd(const u8 *res, u32 *out) {
*out = ResRead_u32(res + 1);
}
inline void ResReadCPCmd(const u8 *res, u32 *out) {
*out = ResRead_u32(res + 2);
}
void ResWriteBPCmd(u8 *, u32);
void ResWriteBPCmd(u8 *, u32, u32);
void ResWriteCPCmd(u8 *, u8, u32);
void ResWriteXFCmd(u8 *, u16, u32);
void ResWriteSSMask(u8 *, u32);
} // namespace detail
} // namespace g3d
} // namespace nw4r
#endif
+45 -48
View File
@@ -1,57 +1,54 @@
#ifndef NW4R_G3D_RESDICT_H
#define NW4R_G3D_RESDICT_H
#include "types_nw4r.h"
#include "common.h"
#include "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
};
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 ResDicData
{
u32 mSize; // at 0x0
u32 mNumData; // at 0x4
ResDicEntry mEntries[]; // 0x8
};
struct ResDicData {
u32 mSize; // at 0x0
u32 mNumData; // at 0x4
ResDicEntry mEntries[]; // 0x8
};
struct ResDic
{
ResCommon<ResDicData> mDict;
struct ResDic {
ResCommon<ResDicData> mDict;
ResDicEntry * Get(ResName) const;
ResDicEntry * Get(const char *, u32) const;
void * operator[](const char *) const;
void * operator[](ResName) const;
s32 GetIndex(ResName) const;
inline ResDic(void * vptr) : mDict(vptr) {}
inline void * operator[](int i) const
{
if (mDict.IsValid()) return (void *)mDict.ofs_to_ptr<void>(mDict.ref().mEntries[i + 1].INT_0xC);
return NULL;
}
inline u32 GetNumData() const
{
if (mDict.IsValid()) return mDict.ref().mNumData;
return 0;
}
};
}
}
ResDicEntry *Get(ResName) const;
ResDicEntry *Get(const char *, u32) const;
void *operator[](const char *) const;
void *operator[](ResName) const;
s32 GetIndex(ResName) const;
#endif
inline ResDic(void *vptr) : mDict(vptr) {}
inline void *operator[](int i) const {
if (mDict.IsValid()) {
return (void *)mDict.ofs_to_ptr<void>(mDict.ref().mEntries[i + 1].INT_0xC);
}
return NULL;
}
inline u32 GetNumData() const {
if (mDict.IsValid()) {
return mDict.ref().mNumData;
}
return 0;
}
};
} // namespace g3d
} // namespace nw4r
#endif
+81 -86
View File
@@ -1,92 +1,87 @@
#ifndef NW4R_G3D_RESFILE_H
#define NW4R_G3D_RESFILE_H
#include "ut_binaryFileFormat.h"
#include "common.h"
#include "g3d_rescommon.h"
#include "g3d_resdict.h"
#include "types_nw4r.h"
#include "ut_binaryFileFormat.h"
namespace nw4r
{
namespace g3d
{
struct ResFileData
{
ut::BinaryFileHeader mHeader; // at 0x0
ut::BinaryBlockHeader mRootHeader; // at 0x10
ResDicData mRootData; // at 0x18
};
struct ResFile
{
ResCommon<ResFileData> mFile; // at 0x0
inline ResFileData & ref() const
{
return mFile.ref();
}
ResMdl GetResMdl(const char *) const;
ResMdl GetResMdl(int) const;
ResMdl GetResMdl(u32) const; //inlined
ResPltt GetResPltt(const char *) const;
ResPltt GetResPltt(ResName) const;
ResPltt GetResPltt(int) const;
ResPltt GetResPltt(u32) const; //inlined
ResTex GetResTex(const char *) const;
ResTex GetResTex(ResName) const;
ResTex GetResTex(int) const;
ResTex GetResTex(u32) const; //inlined
ResAnmChr GetResAnmChr(const char *) const;
ResAnmChr GetResAnmChr(int) const;
ResAnmChr GetResAnmChr(u32) const; //inlined
ResAnmVis GetResAnmVis(const char *) const;
ResAnmVis GetResAnmVis(int) const;
ResAnmVis GetResAnmVis(u32) const; //inlined
ResAnmClr GetResAnmClr(const char *) const;
ResAnmClr GetResAnmClr(int) const;
ResAnmClr GetResAnmClr(u32) const; //inlined
ResAnmTexPat GetResAnmTexPat(const char *) const;
ResAnmTexPat GetResAnmTexPat(int) const;
ResAnmTexPat GetResAnmTexPat(u32) const; //inlined
ResAnmTexSrt GetResAnmTexSrt(const char *) const;
ResAnmTexSrt GetResAnmTexSrt(int) const;
ResAnmTexSrt GetResAnmTexSrt(u32) const; //inlined
ResAnmShp GetResAnmShp(const char *) const;
ResAnmShp GetResAnmShp(int) const;
ResAnmShp GetResAnmShp(u32) const; //inlined
ResAnmScn GetResAnmScn(const char *) const;
ResAnmScn GetResAnmScn(int) const;
ResAnmScn GetResAnmScn(u32) const; //inlined
u32 GetResMdlNumEntries() const; //inlined
u32 GetResPlttNumEntries() const; //inlined
u32 GetResTexNumEntries() const; //inlined
u32 GetResAnmChrNumEntries() const; //inlined
u32 GetResAnmVisNumEntries() const; //inlined
u32 GetResAnmClrNumEntries() const; //inlined
u32 GetResAnmTexPatNumEntries() const; //inlined
u32 GetResAnmTexSrtNumEntries() const; //inlined
u32 GetResAnmShpNumEntries() const; //inlined
u32 GetResAnmScnNumEntries() const;
bool Bind(ResFile);
void Release();
void Init();
void Terminate();
bool CheckRevision() const;
};
}
}
namespace nw4r {
namespace g3d {
#endif
struct ResFileData {
ut::BinaryFileHeader mHeader; // at 0x0
ut::BinaryBlockHeader mRootHeader; // at 0x10
ResDicData mRootData; // at 0x18
};
struct ResFile {
ResCommon<ResFileData> mFile; // at 0x0
inline ResFileData &ref() const {
return mFile.ref();
}
ResMdl GetResMdl(const char *) const;
ResMdl GetResMdl(int) const;
ResMdl GetResMdl(u32) const; // inlined
ResPltt GetResPltt(const char *) const;
ResPltt GetResPltt(ResName) const;
ResPltt GetResPltt(int) const;
ResPltt GetResPltt(u32) const; // inlined
ResTex GetResTex(const char *) const;
ResTex GetResTex(ResName) const;
ResTex GetResTex(int) const;
ResTex GetResTex(u32) const; // inlined
ResAnmChr GetResAnmChr(const char *) const;
ResAnmChr GetResAnmChr(int) const;
ResAnmChr GetResAnmChr(u32) const; // inlined
ResAnmVis GetResAnmVis(const char *) const;
ResAnmVis GetResAnmVis(int) const;
ResAnmVis GetResAnmVis(u32) const; // inlined
ResAnmClr GetResAnmClr(const char *) const;
ResAnmClr GetResAnmClr(int) const;
ResAnmClr GetResAnmClr(u32) const; // inlined
ResAnmTexPat GetResAnmTexPat(const char *) const;
ResAnmTexPat GetResAnmTexPat(int) const;
ResAnmTexPat GetResAnmTexPat(u32) const; // inlined
ResAnmTexSrt GetResAnmTexSrt(const char *) const;
ResAnmTexSrt GetResAnmTexSrt(int) const;
ResAnmTexSrt GetResAnmTexSrt(u32) const; // inlined
ResAnmShp GetResAnmShp(const char *) const;
ResAnmShp GetResAnmShp(int) const;
ResAnmShp GetResAnmShp(u32) const; // inlined
ResAnmScn GetResAnmScn(const char *) const;
ResAnmScn GetResAnmScn(int) const;
ResAnmScn GetResAnmScn(u32) const; // inlined
u32 GetResMdlNumEntries() const; // inlined
u32 GetResPlttNumEntries() const; // inlined
u32 GetResTexNumEntries() const; // inlined
u32 GetResAnmChrNumEntries() const; // inlined
u32 GetResAnmVisNumEntries() const; // inlined
u32 GetResAnmClrNumEntries() const; // inlined
u32 GetResAnmTexPatNumEntries() const; // inlined
u32 GetResAnmTexSrtNumEntries() const; // inlined
u32 GetResAnmShpNumEntries() const; // inlined
u32 GetResAnmScnNumEntries() const;
bool Bind(ResFile);
void Release();
void Init();
void Terminate();
bool CheckRevision() const;
};
} // namespace g3d
} // namespace nw4r
#endif
+1 -1
View File
@@ -1,8 +1,8 @@
#ifndef NW4R_G3D_RESMAT_H
#define NW4R_G3D_RESMAT_H
#include "common.h"
#include "g3d_rescommon.h"
#include "math_types.h"
#include "types_nw4r.h"
#include <rvl/GX.h>
+76 -83
View File
@@ -1,100 +1,93 @@
#ifndef NW4R_G3D_RESMDL_H
#define NW4R_G3D_RESMDL_H
#include "types_nw4r.h"
#include "common.h"
#include "g3d_rescommon.h"
#include "g3d_resnode.h"
#include "g3d_resdict.h"
#include "g3d_resnode.h"
namespace nw4r
{
namespace g3d
{
struct ResMdlData
{
char mMagic[4]; // "MDL0"
u32 INT_0x4;
u32 mRevision; // at 0x8
s32 INT_0xC;
u32 mByteCodeDictOfs; // at 0x10
u32 mNodeDictOfs; // at 0x14
u32 mVtxPosDictOfs; // at 0x18
u32 mVtxNrmDictOfs; // at 0x1C
u32 mVtxClrDictOfs; // at 0x20
u32 mVtxTexCoordDictOfs; // at 0x24
u32 mMatDictOfs; // at 0x28
u32 mTevDictOfs; // at 0x2C
u32 mShpDictOfs; // at 0x30
u32 mPlttTexInfoOfs; // at 0x34
};
namespace nw4r {
namespace g3d {
struct ResMdlData {
char mMagic[4]; // "MDL0"
u32 INT_0x4;
u32 mRevision; // at 0x8
s32 INT_0xC;
u32 mByteCodeDictOfs; // at 0x10
u32 mNodeDictOfs; // at 0x14
u32 mVtxPosDictOfs; // at 0x18
u32 mVtxNrmDictOfs; // at 0x1C
u32 mVtxClrDictOfs; // at 0x20
u32 mVtxTexCoordDictOfs; // at 0x24
u32 mMatDictOfs; // at 0x28
u32 mTevDictOfs; // at 0x2C
u32 mShpDictOfs; // at 0x30
u32 mPlttTexInfoOfs; // at 0x34
};
struct ResMdl
{
enum
{
REVISION = 9
};
ResCommon<ResMdlData> mMdl;
inline ResMdl(void * vptr) : mMdl(vptr) {}
bool IsValid() const { return mMdl.IsValid(); }
u8 * GetResByteCode(const char *) const;
struct ResMdl {
enum { REVISION = 9 };
ResNode GetResNode(const char *) const;
ResNode GetResNode(ResName) const;
ResNode GetResNode(int) const;
ResNode GetResNode(u32) const;
u32 GetResNodeNumEntries() const;
ResCommon<ResMdlData> mMdl;
ResVtxPos GetResVtxPos(ResName) const;
ResVtxPos GetResVtxPos(int) const;
ResVtxPos GetResVtxPos(u32) const;
u32 GetResVtxPosNumEntries() const;
inline ResMdl(void *vptr) : mMdl(vptr) {}
bool IsValid() const {
return mMdl.IsValid();
}
ResVtxNrm GetResVtxNrm(ResName) const;
ResVtxNrm GetResVtxNrm(int) const;
ResVtxNrm GetResVtxNrm(u32) const;
u32 GetResVtxNrmNumEntries() const;
u8 *GetResByteCode(const char *) const;
ResVtxClr GetResVtxClr(ResName) const;
ResVtxClr GetResVtxClr(int) const;
ResVtxClr GetResVtxClr(u32) const;
u32 GetResVtxClrNumEntries() const;
ResNode GetResNode(const char *) const;
ResNode GetResNode(ResName) const;
ResNode GetResNode(int) const;
ResNode GetResNode(u32) const;
u32 GetResNodeNumEntries() const;
ResVtxTexCoord GetResVtxTexCoord(int) const;
ResVtxPos GetResVtxPos(ResName) const;
ResVtxPos GetResVtxPos(int) const;
ResVtxPos GetResVtxPos(u32) const;
u32 GetResVtxPosNumEntries() const;
ResMat GetResMat(const char *) const;
ResMat GetResMat(ResName) const;
ResMat GetResMat(int) const;
ResMat GetResMat(u32) const;
u32 GetResMatNumEntries() const;
ResVtxNrm GetResVtxNrm(ResName) const;
ResVtxNrm GetResVtxNrm(int) const;
ResVtxNrm GetResVtxNrm(u32) const;
u32 GetResVtxNrmNumEntries() const;
ResShp GetResShp(const char *) const;
ResShp GetResShp(int) const;
ResShp GetResShp(u32) const;
u32 GetResShpNumEntries() const;
ResVtxClr GetResVtxClr(ResName) const;
ResVtxClr GetResVtxClr(int) const;
ResVtxClr GetResVtxClr(u32) const;
u32 GetResVtxClrNumEntries() const;
ResTexPlttInfo GetResTexPlttInfoOffsetFromTexName(int) const;
u32 GetResTexPlttInfoOffsetFromTexNameNumEntries() const;
ResVtxTexCoord GetResVtxTexCoord(int) const;
bool Bind(ResFile);
void Release();
void Init();
void Terminate();
inline bool CheckRevision() const
{
return mMdl.ref().mRevision == REVISION;
}
ResMat GetResMat(const char *) const;
ResMat GetResMat(ResName) const;
ResMat GetResMat(int) const;
ResMat GetResMat(u32) const;
u32 GetResMatNumEntries() const;
inline u32 GetResVtxTexCoordNumEntries() const
{
ResMdlData& ref = mMdl.ref();
return mMdl.ofs_to_obj<ResDic>(ref.mVtxTexCoordDictOfs).GetNumData();
}
};
}
}
ResShp GetResShp(const char *) const;
ResShp GetResShp(int) const;
ResShp GetResShp(u32) const;
u32 GetResShpNumEntries() const;
#endif
ResTexPlttInfo GetResTexPlttInfoOffsetFromTexName(int) const;
u32 GetResTexPlttInfoOffsetFromTexNameNumEntries() const;
bool Bind(ResFile);
void Release();
void Init();
void Terminate();
inline bool CheckRevision() const {
return mMdl.ref().mRevision == REVISION;
}
inline u32 GetResVtxTexCoordNumEntries() const {
ResMdlData &ref = mMdl.ref();
return mMdl.ofs_to_obj<ResDic>(ref.mVtxTexCoordDictOfs).GetNumData();
}
};
} // namespace g3d
} // namespace nw4r
#endif
+51 -57
View File
@@ -1,68 +1,62 @@
#ifndef NW4R_G3D_RESNODE_H
#define NW4R_G3D_RESNODE_H
#include "types_nw4r.h"
#include "g3d_rescommon.h"
#include "common.h"
#include "g3d_anmchr.h"
#include "g3d_rescommon.h"
#include "math_types.h"
namespace nw4r
{
namespace g3d
{
struct ResNodeData
{
u32 INT_0x0;
s32 INT_0x4;
u16 SHORT_0x8;
u16 SHORT_0xA;
UNKWORD WORD_0xC;
UNKWORD WORD_0x10;
u32 mFlags; // at 0x14
UNKWORD WORD_0x18;
UNKWORD WORD_0x1C;
math::VEC3 VEC3_0x20;
math::VEC3 VEC3_0x2C;
f32 FLOAT_0x38;
f32 FLOAT_0x3C;
f32 FLOAT_0x40;
// . . .
};
namespace nw4r {
namespace g3d {
struct ResNodeData {
u32 INT_0x0;
s32 INT_0x4;
u16 SHORT_0x8;
u16 SHORT_0xA;
UNKWORD WORD_0xC;
UNKWORD WORD_0x10;
u32 mFlags; // at 0x14
UNKWORD WORD_0x18;
UNKWORD WORD_0x1C;
math::VEC3 VEC3_0x20;
math::VEC3 VEC3_0x2C;
f32 FLOAT_0x38;
f32 FLOAT_0x3C;
f32 FLOAT_0x40;
// . . .
};
struct ResNode
{
enum ResNodeFlags
{
NODE_IS_VISIBLE = 0x100
};
struct ResNode {
enum ResNodeFlags { NODE_IS_VISIBLE = 0x100 };
ResCommon<ResNodeData> mNode;
ResCommon<ResNodeData> mNode;
inline ResNode(void * vptr) : mNode(vptr) {}
bool IsValid() const { return mNode.IsValid(); }
inline ResNode(void *vptr) : mNode(vptr) {}
UNKWORD GetID() const
{
if (IsValid())
return mNode.ptr()->WORD_0xC;
return 0;
}
void SetVisibility(bool visible)
{
if (IsValid())
{
if (visible)
mNode.ptr()->mFlags |= NODE_IS_VISIBLE;
else
mNode.ptr()->mFlags &= ~NODE_IS_VISIBLE;
}
}
void PatchChrAnmResult(ChrAnmResult *) const;
void CalcChrAnmResult(ChrAnmResult *) const;
};
bool IsValid() const {
return mNode.IsValid();
}
}
#endif
UNKWORD GetID() const {
if (IsValid()) {
return mNode.ptr()->WORD_0xC;
}
return 0;
}
void SetVisibility(bool visible) {
if (IsValid()) {
if (visible) {
mNode.ptr()->mFlags |= NODE_IS_VISIBLE;
} else {
mNode.ptr()->mFlags &= ~NODE_IS_VISIBLE;
}
}
}
void PatchChrAnmResult(ChrAnmResult *) const;
void CalcChrAnmResult(ChrAnmResult *) const;
};
} // namespace g3d
} // namespace nw4r
#endif
+102 -114
View File
@@ -1,122 +1,110 @@
#ifndef NW4R_G3D_RESSHP_H
#define NW4R_G3D_RESSHP_H
#include <GXAttr.h>
#include "types_nw4r.h"
#include "g3d_rescommon.h"
#include "g3d_resmdl.h"
#include "g3d_resvtx.h"
#include <GXAttr.h>#include "common.h"
namespace nw4r
{
namespace g3d
{
struct ResTagDLData
{
u32 mBufSize; // at 0x0
u32 mCmdSize; // at 0x4
u32 mOffset; // at 0x8
};
struct ResPrePrimDL
{
char UNK_0x0[0xA];
detail::CPCmd CP_CMD_0xA;
detail::CPCmd CP_CMD_0x10;
char UNK_0x16[0xA];
detail::CPCmd CP_CMD_0x20;
detail::CPCmd CP_CMD_0x26;
detail::CPCmd CP_CMD_0x2C;
detail::CPCmd CP_CMD_PAIRS_0x32[GX_POS_MTX_ARRAY - GX_VA_POS][2];
char UNK_0xC2[0x1E];
};
struct ResShpData
{
char UNK_0x0[0x4];
u32 mParentOffset; // at 0x4
char UNK_0x8[0x10];
ResTagDLData mPrePrimDLTag; // at 0x18
ResTagDLData mPrimDLTag; // at 0x24
char UNK_0x30[0x18];
s16 mVtxPosIndex; // at 0x48
s16 mVtxNrmIndex; // at 0x4a
s16 mVtxClrIndices[GX_VA_TEX0 - GX_VA_CLR0]; // at 0x4c
s16 mVtxTexCoordIndices[GX_POS_MTX_ARRAY - GX_VA_TEX0]; // at 0x50
};
struct ResTagDL
{
ResCommon<ResTagDLData> mData;
inline ResTagDL(void * vptr) : mData(vptr) {}
inline u8 * GetDL() const
{
return const_cast<u8 *>(mData.ofs_to_ptr<u8>(mData.ref().mOffset));
}
inline u32 GetBufSize() const
{
return mData.ref().mBufSize;
}
inline u32 GetCmdSize() const
{
return mData.ref().mCmdSize;
}
};
struct ResShpPrePrim
{
ResCommon<ResPrePrimDL> mDL;
inline ResShpPrePrim(void * vptr) : mDL(vptr) {}
inline ResPrePrimDL & ref() const
{
return mDL.ref();
}
};
struct ResShp
{
ResCommon<ResShpData> mShp;
inline ResShp(void * vptr) : mShp(vptr) {}
bool IsValid() const { return mShp.IsValid(); }
inline ResShpData & ref() const
{
return mShp.ref();
}
inline ResShpPrePrim GetResShpPrePrim() const
{
return ResTagDL(&ref().mPrePrimDLTag).GetDL();
}
bool GXGetVtxDescv(GXVtxDescList*) const;
bool GXGetVtxAttrFmtv(GXVtxAttrFmtList*) const;
ResMdl GetParent() const; //inlined
ResVtxPos GetResVtxPos() const;
ResVtxNrm GetResVtxNrm() const;
ResVtxClr GetResVtxClr(u32) const;
ResVtxTexCoord GetResVtxTexCoord(u32) const; //inlined
void GXSetArray(GXAttr, const void *, u8); //inlined
void Init();
void DisableSetArray(GXAttr); //inlined
void Terminate();
void CallPrePrimitiveDisplayList(bool, bool) const;
void CallPrimitiveDisplayList(bool) const;
};
}
}
namespace nw4r {
namespace g3d {
struct ResTagDLData {
u32 mBufSize; // at 0x0
u32 mCmdSize; // at 0x4
u32 mOffset; // at 0x8
};
#endif
struct ResPrePrimDL {
char UNK_0x0[0xA];
detail::CPCmd CP_CMD_0xA;
detail::CPCmd CP_CMD_0x10;
char UNK_0x16[0xA];
detail::CPCmd CP_CMD_0x20;
detail::CPCmd CP_CMD_0x26;
detail::CPCmd CP_CMD_0x2C;
detail::CPCmd CP_CMD_PAIRS_0x32[GX_POS_MTX_ARRAY - GX_VA_POS][2];
char UNK_0xC2[0x1E];
};
struct ResShpData {
char UNK_0x0[0x4];
u32 mParentOffset; // at 0x4
char UNK_0x8[0x10];
ResTagDLData mPrePrimDLTag; // at 0x18
ResTagDLData mPrimDLTag; // at 0x24
char UNK_0x30[0x18];
s16 mVtxPosIndex; // at 0x48
s16 mVtxNrmIndex; // at 0x4a
s16 mVtxClrIndices[GX_VA_TEX0 - GX_VA_CLR0]; // at 0x4c
s16 mVtxTexCoordIndices[GX_POS_MTX_ARRAY - GX_VA_TEX0]; // at 0x50
};
struct ResTagDL {
ResCommon<ResTagDLData> mData;
inline ResTagDL(void *vptr) : mData(vptr) {}
inline u8 *GetDL() const {
return const_cast<u8 *>(mData.ofs_to_ptr<u8>(mData.ref().mOffset));
}
inline u32 GetBufSize() const {
return mData.ref().mBufSize;
}
inline u32 GetCmdSize() const {
return mData.ref().mCmdSize;
}
};
struct ResShpPrePrim {
ResCommon<ResPrePrimDL> mDL;
inline ResShpPrePrim(void *vptr) : mDL(vptr) {}
inline ResPrePrimDL &ref() const {
return mDL.ref();
}
};
struct ResShp {
ResCommon<ResShpData> mShp;
inline ResShp(void *vptr) : mShp(vptr) {}
bool IsValid() const {
return mShp.IsValid();
}
inline ResShpData &ref() const {
return mShp.ref();
}
inline ResShpPrePrim GetResShpPrePrim() const {
return ResTagDL(&ref().mPrePrimDLTag).GetDL();
}
bool GXGetVtxDescv(GXVtxDescList *) const;
bool GXGetVtxAttrFmtv(GXVtxAttrFmtList *) const;
ResMdl GetParent() const; // inlined
ResVtxPos GetResVtxPos() const;
ResVtxNrm GetResVtxNrm() const;
ResVtxClr GetResVtxClr(u32) const;
ResVtxTexCoord GetResVtxTexCoord(u32) const; // inlined
void GXSetArray(GXAttr, const void *, u8); // inlined
void Init();
void DisableSetArray(GXAttr); // inlined
void Terminate();
void CallPrePrimitiveDisplayList(bool, bool) const;
void CallPrimitiveDisplayList(bool) const;
};
} // namespace g3d
} // namespace nw4r
#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 "types_nw4r.h"
#include <rvl/GX.h>
+31 -34
View File
@@ -1,42 +1,39 @@
#ifndef NW4R_G3D_SCN_MDL_H
#define NW4R_G3D_SCN_MDL_H
#include "types_nw4r.h"
#include "g3d_scnmdlsmpl.h"
#include "g3d_resmat.h"
#include "common.h"
#include "g3d_draw.h"
#include "g3d_resmat.h"
#include "g3d_scnmdlsmpl.h"
namespace nw4r
{
namespace g3d
{
class ScnMdl : public ScnMdlSimple
{
public:
class CopiedMatAccess
{
public:
CopiedMatAccess(ScnMdl *, u32);
ResTexSrt GetResTexSrtEx();
namespace nw4r {
namespace g3d {
class ScnMdl : public ScnMdlSimple {
public:
class CopiedMatAccess {
public:
CopiedMatAccess(ScnMdl *, u32);
ResTexSrt GetResTexSrtEx();
private:
char UNK_0x0[0x2C];
};
private:
char UNK_0x0[0x2C];
};
public:
static const G3dObj::TypeObj GetTypeObjStatic()
{
return TypeObj(TYPE_NAME);
}
DrawResMdlReplacement * GetDrawResMdlReplacement() { return &mDrawMdlReplace; }
private:
char UNK_0x118[0x144 - 0x118];
DrawResMdlReplacement mDrawMdlReplace; // at 0x144
NW4R_G3D_TYPE_OBJ_DECL(ScnMdl);
};
public:
static const G3dObj::TypeObj GetTypeObjStatic() {
return TypeObj(TYPE_NAME);
}
}
#endif
DrawResMdlReplacement *GetDrawResMdlReplacement() {
return &mDrawMdlReplace;
}
private:
char UNK_0x118[0x144 - 0x118];
DrawResMdlReplacement mDrawMdlReplace; // at 0x144
NW4R_G3D_TYPE_OBJ_DECL(ScnMdl);
};
} // namespace g3d
} // namespace nw4r
#endif
+25 -25
View File
@@ -1,32 +1,32 @@
#ifndef NW4R_G3D_SCN_MDL1_MAT1_SHP_H
#define NW4R_G3D_SCN_MDL1_MAT1_SHP_H
#include "types_nw4r.h"
#include "g3d_scnobj.h"
#include "common.h"
#include "g3d_resmat.h"
#include "g3d_resshp.h"
#include "g3d_scnobj.h"
namespace nw4r
{
namespace g3d
{
class ScnMdl1Mat1Shp : public ScnLeaf
{
public:
static const G3dObj::TypeObj GetTypeObjStatic()
{
return TypeObj(TYPE_NAME);
}
ResMat GetResMat() { return mResMat; }
ResShp GetResShp() { return mResShp; }
private:
ResMat mResMat; // at 0xE8
ResShp mResShp; // at 0xEC
NW4R_G3D_TYPE_OBJ_DECL(ScnMdl1Mat1Shp);
};
namespace nw4r {
namespace g3d {
class ScnMdl1Mat1Shp : public ScnLeaf {
public:
static const G3dObj::TypeObj GetTypeObjStatic() {
return TypeObj(TYPE_NAME);
}
}
#endif
ResMat GetResMat() {
return mResMat;
}
ResShp GetResShp() {
return mResShp;
}
private:
ResMat mResMat; // at 0xE8
ResShp mResShp; // at 0xEC
NW4R_G3D_TYPE_OBJ_DECL(ScnMdl1Mat1Shp);
};
} // namespace g3d
} // namespace nw4r
#endif
+70 -66
View File
@@ -1,73 +1,77 @@
#ifndef NW4R_G3D_SCN_MDL_SIMPLE_H
#define NW4R_G3D_SCN_MDL_SIMPLE_H
#include "types_nw4r.h"
#include "g3d_scnobj.h"
#include "common.h"
#include "g3d_resmdl.h"
#include "g3d_scnobj.h"
namespace nw4r
{
namespace g3d
namespace nw4r {
namespace g3d {
class ScnMdlSimple : public ScnLeaf {
public:
enum ByteCodeType {
BYTE_CODE_CALC,
BYTE_CODE_MIX,
BYTE_CODE_DRAW_OPA,
BYTE_CODE_DRAW_XLU,
};
public:
ScnMdlSimple(MEMAllocator *, ResMdl, math::MTX34 *, u32 *, math::MTX34 *, math::MTX33 *, math::MTX34 *, int, int);
virtual bool IsDerivedFrom(TypeObj other) const // at 0x8
{
class ScnMdlSimple : public ScnLeaf
{
public:
enum ByteCodeType
{
BYTE_CODE_CALC,
BYTE_CODE_MIX,
BYTE_CODE_DRAW_OPA,
BYTE_CODE_DRAW_XLU,
};
public:
ScnMdlSimple(MEMAllocator *, ResMdl, math::MTX34 *, u32 *,
math::MTX34 *, math::MTX33 *, math::MTX34 *, int, int);
virtual bool IsDerivedFrom(TypeObj other) const // at 0x8
{
return (other == GetTypeObjStatic()) ? true
: ScnLeaf::IsDerivedFrom(other);
}
virtual void G3dProc(u32, u32, void *); // at 0xC
virtual ~ScnMdlSimple(); // at 0x10
virtual const TypeObj GetTypeObj() const // at 0x14
{
return TypeObj(TYPE_NAME);
}
virtual const char * GetTypeName() const // at 0x18
{
return GetTypeObj().GetTypeName();
}
const u8 * GetByteCode(ByteCodeType) const;
const ResMdl GetResMdl() const { return mResMdl; }
ResMdl GetResMdl() { return mResMdl; }
math::MTX34 * GetWldMtxArray() { return mWldMatrixArray; }
u32 * GetWldMtxAttribArray() { return mWldMtxAttribArray; }
u16 GetNumViewMtx() const { return mNumViewMtx; }
private:
ResMdl mResMdl; // at 0xE8
math::MTX34 *mWldMatrixArray; // at 0xEC
u32 *mWldMtxAttribArray; // at 0xF0
math::MTX34 *PTR_0xF4;
math::MTX33 *PTR_0xF8;
math::MTX34 *PTR_0xFC;
u8 BYTE_0x100;
u8 BYTE_0x101;
u16 mNumViewMtx; // at 0x102
UNKWORD WORD_0x104;
void *mByteCodeCalc; // at 0x108
void *mByteCodeMix; // at 0x10C
void *mByteCodeDrawOpa; // at 0x110
void *mByteCodeDrawXlu; // at 0x114
NW4R_G3D_TYPE_OBJ_DECL(ScnMdlSimple);
};
return (other == GetTypeObjStatic()) ? true : ScnLeaf::IsDerivedFrom(other);
}
virtual void G3dProc(u32, u32, void *); // at 0xC
virtual ~ScnMdlSimple(); // at 0x10
virtual const TypeObj GetTypeObj() const // at 0x14
{
return TypeObj(TYPE_NAME);
}
virtual const char *GetTypeName() const // at 0x18
{
return GetTypeObj().GetTypeName();
}
}
#endif
const u8 *GetByteCode(ByteCodeType) const;
const ResMdl GetResMdl() const {
return mResMdl;
}
ResMdl GetResMdl() {
return mResMdl;
}
math::MTX34 *GetWldMtxArray() {
return mWldMatrixArray;
}
u32 *GetWldMtxAttribArray() {
return mWldMtxAttribArray;
}
u16 GetNumViewMtx() const {
return mNumViewMtx;
}
private:
ResMdl mResMdl; // at 0xE8
math::MTX34 *mWldMatrixArray; // at 0xEC
u32 *mWldMtxAttribArray; // at 0xF0
math::MTX34 *PTR_0xF4;
math::MTX33 *PTR_0xF8;
math::MTX34 *PTR_0xFC;
u8 BYTE_0x100;
u8 BYTE_0x101;
u16 mNumViewMtx; // at 0x102
UNKWORD WORD_0x104;
void *mByteCodeCalc; // at 0x108
void *mByteCodeMix; // at 0x10C
void *mByteCodeDrawOpa; // at 0x110
void *mByteCodeDrawXlu; // at 0x114
NW4R_G3D_TYPE_OBJ_DECL(ScnMdlSimple);
};
} // namespace g3d
} // namespace nw4r
#endif
+264 -326
View File
@@ -1,340 +1,278 @@
#ifndef NW4R_G3D_SCNOBJ_H
#define NW4R_G3D_SCNOBJ_H
#include "types_nw4r.h"
#include "math_types.h"
#include "math_geometry.h"
#include "common.h"
#include "g3d_obj.h"
#include "math_geometry.h"
#include "math_types.h"
namespace nw4r
{
namespace g3d
namespace nw4r {
namespace g3d {
namespace {
static inline u32 align4(u32 x) {
return x + 3 & ~3;
}
} // namespace
struct IScnObjGather {
virtual ~IScnObjGather();
virtual UNKWORD Add(ScnObj *, bool, bool) = 0;
};
class ScnObj : public G3dObj {
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
};
enum ScnObjMtxType { MTX_TYPE_0, MTX_TYPE_WORLD, MTX_TYPE_VIEW, MTX_TYPE_MAX };
enum Timing { TIMING_1 = 0x1, TIMING_2 = 0x2, TIMING_4 = 0x4 };
enum ExecOp { EXEC_OP_1 = 0x1, EXEC_OP_2 = 0x2, EXEC_OP_4 = 0x4 };
enum ScnObjBoundingVolumeType { BOUNDING_0, BOUNDING_1, BOUNDING_MAX };
enum ScnObjOption { OPTION_VISIBLE = (1 << 0) };
typedef ForEachResult (*ForEachAction)(ScnObj *, void *);
public:
ScnObj(MEMAllocator *);
virtual bool IsDerivedFrom(TypeObj other) const // at 0x8
{
namespace
{
static inline u32 align4(u32 x) { return x + 3 & ~3; }
return (other == GetTypeObjStatic()) ? true : G3dObj::IsDerivedFrom(other);
}
virtual void G3dProc(u32, u32, void *) = 0; // at 0xC
virtual ~ScnObj(); // at 0x10
virtual const TypeObj GetTypeObj() const // at 0x14
{
return TypeObj(TYPE_NAME);
}
virtual const char *GetTypeName() const // at 0x18
{
return GetTypeObj().GetTypeName();
}
virtual ForEachResult ForEach(ForEachAction, void *, bool) = 0; // at 0x1C
virtual bool SetScnObjOption(u32, u32); // at 0x20
virtual bool GetScnObjOption(u32, u32 *) const; // at 0x24
virtual f32 GetValueForSortOpa() const; // at 0x28
virtual f32 GetValueForSortXlu() const; // at 0x2C
virtual void CalcWorldMtx(const math::MTX34 *, u32 *); // at 0x30
static const G3dObj::TypeObj GetTypeObjStatic() {
return TypeObj(TYPE_NAME);
}
void CalcViewMtx(const math::MTX34 *);
bool SetMtx(ScnObjMtxType, const math::MTX34 *);
bool GetMtx(ScnObjMtxType, math::MTX34 *) const;
void SetPriorityDrawOpa(int);
void SetPriorityDrawXlu(int);
void EnableScnObjCallbackTiming(Timing);
void EnableScnObjCallbackExecOp(ExecOp);
bool SetBoundingVolume(ScnObjBoundingVolumeType, const math::AABB *);
bool GetBoundingVolume(ScnObjBoundingVolumeType, math::AABB *) const;
const math::MTX34 *GetMtxPtr(ScnObjMtxType type) const {
return &mMatrices[type];
}
void SetScnObjFlag(ScnObjFlag f, u32 set) {
if (set) {
mFlags |= f;
} else {
mFlags &= ~f;
}
}
bool TestScnObjFlag(ScnObjFlag f) const {
return mFlags & f;
}
struct IScnObjGather
{
virtual ~IScnObjGather();
virtual UNKWORD Add(ScnObj *, bool, bool) = 0;
};
inline void CheckCallback_CALC_VIEW(Timing timing, u32 r5, void *r6);
inline void CheckCallback_CALC_MAT(Timing timing, u32 r5, void *r6);
inline void CheckCallback_CALC_WORLD(Timing timing, u32 r5, void *r6);
class ScnObj : public G3dObj
{
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
};
enum ScnObjMtxType
{
MTX_TYPE_0,
MTX_TYPE_WORLD,
MTX_TYPE_VIEW,
MTX_TYPE_MAX
};
enum Timing
{
TIMING_1 = 0x1,
TIMING_2 = 0x2,
TIMING_4 = 0x4
};
enum ExecOp
{
EXEC_OP_1 = 0x1,
EXEC_OP_2 = 0x2,
EXEC_OP_4 = 0x4
};
enum ScnObjBoundingVolumeType
{
BOUNDING_0,
BOUNDING_1,
BOUNDING_MAX
};
enum ScnObjOption
{
OPTION_VISIBLE = (1 << 0)
};
typedef ForEachResult (* ForEachAction)(ScnObj *, void *);
public:
ScnObj(MEMAllocator *);
virtual bool IsDerivedFrom(TypeObj other) const // at 0x8
{
return (other == GetTypeObjStatic()) ? true
: G3dObj::IsDerivedFrom(other);
}
virtual void G3dProc(u32, u32, void *) = 0; // at 0xC
virtual ~ScnObj(); // at 0x10
virtual const TypeObj GetTypeObj() const // at 0x14
{
return TypeObj(TYPE_NAME);
}
virtual const char * GetTypeName() const // at 0x18
{
return GetTypeObj().GetTypeName();
}
virtual ForEachResult ForEach(ForEachAction, void *, bool) = 0; // at 0x1C
virtual bool SetScnObjOption(u32, u32); // at 0x20
virtual bool GetScnObjOption(u32, u32 *) const; // at 0x24
virtual f32 GetValueForSortOpa() const; // at 0x28
virtual f32 GetValueForSortXlu() const; // at 0x2C
virtual void CalcWorldMtx(const math::MTX34 *, u32 *); // at 0x30
static const G3dObj::TypeObj GetTypeObjStatic()
{
return TypeObj(TYPE_NAME);
}
void CalcViewMtx(const math::MTX34 *);
bool SetMtx(ScnObjMtxType, const math::MTX34 *);
bool GetMtx(ScnObjMtxType, math::MTX34 *) const;
void SetPriorityDrawOpa(int);
void SetPriorityDrawXlu(int);
void EnableScnObjCallbackTiming(Timing);
void EnableScnObjCallbackExecOp(ExecOp);
bool SetBoundingVolume(ScnObjBoundingVolumeType, const math::AABB *);
bool GetBoundingVolume(ScnObjBoundingVolumeType, math::AABB *) const;
const math::MTX34 * GetMtxPtr(ScnObjMtxType type) const
{
return &mMatrices[type];
}
void SetScnObjFlag(ScnObjFlag f, u32 set)
{
if (set)
{
mFlags |= f;
}
else
{
mFlags &= ~f;
}
}
bool TestScnObjFlag(ScnObjFlag f) const
{
return mFlags & f;
}
inline void CheckCallback_CALC_VIEW(Timing timing, u32 r5, void *r6);
inline void CheckCallback_CALC_MAT(Timing timing, u32 r5, void *r6);
inline void CheckCallback_CALC_WORLD(Timing timing, u32 r5, void *r6);
bool IsG3dProcDisabled(u32 task) const
{
if ((task < 9) && (1 << (task - 1) & mFlags)) return true;
return false;
}
protected:
math::MTX34 mMatrices[MTX_TYPE_MAX]; // at 0xC
math::AABB mBounds[BOUNDING_MAX]; // at 0x9C
u32 mFlags; // at 0xCC
u8 mPriorityDrawOpa; // at 0xD0
u8 mPriorityDrawXlu; // at 0xD1
u8 BYTE_0xD2;
u8 BYTE_0xD3;
IScnObjCallback *mCallback; // at 0xD4
u8 mTiming; // at 0xD8
u8 BYTE_0xD9;
u16 mExecOp; // at 0xDA
NW4R_G3D_TYPE_OBJ_DECL(ScnObj);
};
struct IScnObjCallback
{
virtual ~IScnObjCallback() {} // at 0x8
virtual void ExecCallback_CALC_WORLD(ScnObj::Timing, ScnObj *, u32, void *) {} // at 0xC
virtual void ExecCallback_CALC_MAT(ScnObj::Timing, ScnObj *, u32, void *) {} // at 0x10
virtual void ExecCallback_CALC_VIEW(ScnObj::Timing, ScnObj *, u32, void *) {} // at 0x14
};
// Is there a better way of resolving this dependency?
void ScnObj::CheckCallback_CALC_VIEW(Timing timing, u32 r5, void *r6)
{
if (mCallback != NULL)
{
if ((mExecOp & EXEC_OP_4) && (mTiming & timing))
{
mCallback->ExecCallback_CALC_VIEW(timing, this, r5, r6);
}
}
bool IsG3dProcDisabled(u32 task) const {
if ((task < 9) && (1 << (task - 1) & mFlags)) {
return true;
}
return false;
}
void ScnObj::CheckCallback_CALC_MAT(Timing timing, u32 r5, void *r6)
{
if (mCallback != NULL)
{
if ((mExecOp & EXEC_OP_2) && (mTiming & timing))
{
mCallback->ExecCallback_CALC_MAT(timing, this, r5, r6);
}
}
protected:
math::MTX34 mMatrices[MTX_TYPE_MAX]; // at 0xC
math::AABB mBounds[BOUNDING_MAX]; // at 0x9C
u32 mFlags; // at 0xCC
u8 mPriorityDrawOpa; // at 0xD0
u8 mPriorityDrawXlu; // at 0xD1
u8 BYTE_0xD2;
u8 BYTE_0xD3;
IScnObjCallback *mCallback; // at 0xD4
u8 mTiming; // at 0xD8
u8 BYTE_0xD9;
u16 mExecOp; // at 0xDA
NW4R_G3D_TYPE_OBJ_DECL(ScnObj);
};
struct IScnObjCallback {
virtual ~IScnObjCallback() {} // at 0x8
virtual void ExecCallback_CALC_WORLD(ScnObj::Timing, ScnObj *, u32, void *) {} // at 0xC
virtual void ExecCallback_CALC_MAT(ScnObj::Timing, ScnObj *, u32, void *) {} // at 0x10
virtual void ExecCallback_CALC_VIEW(ScnObj::Timing, ScnObj *, u32, void *) {} // at 0x14
};
// Is there a better way of resolving this dependency?
void ScnObj::CheckCallback_CALC_VIEW(Timing timing, u32 r5, void *r6) {
if (mCallback != NULL) {
if ((mExecOp & EXEC_OP_4) && (mTiming & timing)) {
mCallback->ExecCallback_CALC_VIEW(timing, this, r5, r6);
}
void ScnObj::CheckCallback_CALC_WORLD(Timing timing, u32 r5, void *r6)
{
if (mCallback != NULL)
{
if ((mExecOp & EXEC_OP_1) && (mTiming & timing))
{
mCallback->ExecCallback_CALC_WORLD(timing, this, r5, r6);
}
}
}
class ScnLeaf : public ScnObj
{
public:
// Unofficial name, however GetScaleProperty needs to return an enum to match
enum ScaleProperty
{
SCALE_PROPERTY_0,
SCALE_PROPERTY_1,
SCALE_PROPERTY_2,
};
public:
ScnLeaf(MEMAllocator *allocator) : ScnObj(allocator), mScale(1.0f, 1.0f, 1.0f) {}
virtual bool IsDerivedFrom(TypeObj other) const // at 0x8
{
return (other == GetTypeObjStatic()) ? true
: ScnObj::IsDerivedFrom(other);
}
virtual void G3dProc(u32, u32, void *) = 0; // at 0xC
virtual ~ScnLeaf() {} // at 0x10
virtual const TypeObj GetTypeObj() const // at 0x14
{
return TypeObj(TYPE_NAME);
}
virtual const char * GetTypeName() const // at 0x18
{
return GetTypeObj().GetTypeName();
}
virtual ForEachResult ForEach(ForEachAction, void *, bool); // at 0x1C
virtual bool SetScnObjOption(u32, u32); // at 0x20
virtual bool GetScnObjOption(u32, u32 *) const; // at 0x24
virtual void CalcWorldMtx(const math::MTX34 *, u32 *); // at 0x30
static const G3dObj::TypeObj GetTypeObjStatic()
{
return TypeObj(TYPE_NAME);
}
ScaleProperty GetScaleProperty() const;
void DefG3dProcScnLeaf(u32, u32, void *);
private:
math::VEC3 mScale;
NW4R_G3D_TYPE_OBJ_DECL(ScnLeaf);
};
class ScnGroup : public ScnObj
{
public:
ScnGroup(MEMAllocator *, ScnObj **, u32);
virtual bool IsDerivedFrom(TypeObj other) const // at 0x8
{
return (other == GetTypeObjStatic()) ? true
: ScnObj::IsDerivedFrom(other);
}
virtual void G3dProc(u32, u32, void *); // at 0xC
virtual ~ScnGroup(); // at 0x10
virtual const TypeObj GetTypeObj() const // at 0x14
{
return TypeObj(TYPE_NAME);
}
virtual const char * GetTypeName() const // at 0x18
{
return GetTypeObj().GetTypeName();
}
virtual ForEachResult ForEach(ForEachAction, void *, bool); // at 0x1C
virtual bool Insert(u32, ScnObj *); // at 0x34
virtual ScnObj * Remove(u32); // at 0x38
virtual bool Remove(ScnObj *); // at 0x3C
static const G3dObj::TypeObj GetTypeObjStatic()
{
return TypeObj(TYPE_NAME);
}
bool Empty() const
{
return mSize == 0;
}
u32 Size() const
{
return mSize;
}
ScnObj * PopBack()
{
if (!Empty())
{
return Remove(Size() - 1);
}
return NULL;
}
void Clear()
{
while (!Empty())
{
PopBack();
}
}
void ScnGroup_G3DPROC_GATHER_SCNOBJ(u32, IScnObjGather *);
void ScnGroup_G3DPROC_CALC_WORLD(u32, const math::MTX34 *);
void ScnGroup_G3DPROC_CALC_MAT(u32, void *);
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
private:
NW4R_G3D_TYPE_OBJ_DECL(ScnGroup);
};
}
}
#endif
void ScnObj::CheckCallback_CALC_MAT(Timing timing, u32 r5, void *r6) {
if (mCallback != NULL) {
if ((mExecOp & EXEC_OP_2) && (mTiming & timing)) {
mCallback->ExecCallback_CALC_MAT(timing, this, r5, r6);
}
}
}
void ScnObj::CheckCallback_CALC_WORLD(Timing timing, u32 r5, void *r6) {
if (mCallback != NULL) {
if ((mExecOp & EXEC_OP_1) && (mTiming & timing)) {
mCallback->ExecCallback_CALC_WORLD(timing, this, r5, r6);
}
}
}
class ScnLeaf : public ScnObj {
public:
// Unofficial name, however GetScaleProperty needs to return an enum to match
enum ScaleProperty {
SCALE_PROPERTY_0,
SCALE_PROPERTY_1,
SCALE_PROPERTY_2,
};
public:
ScnLeaf(MEMAllocator *allocator) : ScnObj(allocator), mScale(1.0f, 1.0f, 1.0f) {}
virtual bool IsDerivedFrom(TypeObj other) const // at 0x8
{
return (other == GetTypeObjStatic()) ? true : ScnObj::IsDerivedFrom(other);
}
virtual void G3dProc(u32, u32, void *) = 0; // at 0xC
virtual ~ScnLeaf() {} // at 0x10
virtual const TypeObj GetTypeObj() const // at 0x14
{
return TypeObj(TYPE_NAME);
}
virtual const char *GetTypeName() const // at 0x18
{
return GetTypeObj().GetTypeName();
}
virtual ForEachResult ForEach(ForEachAction, void *, bool); // at 0x1C
virtual bool SetScnObjOption(u32, u32); // at 0x20
virtual bool GetScnObjOption(u32, u32 *) const; // at 0x24
virtual void CalcWorldMtx(const math::MTX34 *, u32 *); // at 0x30
static const G3dObj::TypeObj GetTypeObjStatic() {
return TypeObj(TYPE_NAME);
}
ScaleProperty GetScaleProperty() const;
void DefG3dProcScnLeaf(u32, u32, void *);
private:
math::VEC3 mScale;
NW4R_G3D_TYPE_OBJ_DECL(ScnLeaf);
};
class ScnGroup : public ScnObj {
public:
ScnGroup(MEMAllocator *, ScnObj **, u32);
virtual bool IsDerivedFrom(TypeObj other) const // at 0x8
{
return (other == GetTypeObjStatic()) ? true : ScnObj::IsDerivedFrom(other);
}
virtual void G3dProc(u32, u32, void *); // at 0xC
virtual ~ScnGroup(); // at 0x10
virtual const TypeObj GetTypeObj() const // at 0x14
{
return TypeObj(TYPE_NAME);
}
virtual const char *GetTypeName() const // at 0x18
{
return GetTypeObj().GetTypeName();
}
virtual ForEachResult ForEach(ForEachAction, void *, bool); // at 0x1C
virtual bool Insert(u32, ScnObj *); // at 0x34
virtual ScnObj *Remove(u32); // at 0x38
virtual bool Remove(ScnObj *); // at 0x3C
static const G3dObj::TypeObj GetTypeObjStatic() {
return TypeObj(TYPE_NAME);
}
bool Empty() const {
return mSize == 0;
}
u32 Size() const {
return mSize;
}
ScnObj *PopBack() {
if (!Empty()) {
return Remove(Size() - 1);
}
return NULL;
}
void Clear() {
while (!Empty()) {
PopBack();
}
}
void ScnGroup_G3DPROC_GATHER_SCNOBJ(u32, IScnObjGather *);
void ScnGroup_G3DPROC_CALC_WORLD(u32, const math::MTX34 *);
void ScnGroup_G3DPROC_CALC_MAT(u32, void *);
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
private:
NW4R_G3D_TYPE_OBJ_DECL(ScnGroup);
};
} // namespace g3d
} // namespace nw4r
#endif
+69 -71
View File
@@ -1,78 +1,76 @@
#ifndef NW4R_G3D_SCNPROC_H
#define NW4R_G3D_SCNPROC_H
#include "types_nw4r.h"
#include "common.h"
#include "g3d_scnobj.h"
namespace nw4r
{
namespace g3d
{
class ScnProc : public ScnLeaf
{
public:
typedef void (* DrawProc)(ScnProc *, bool opa);
namespace nw4r {
namespace g3d {
class ScnProc : public ScnLeaf {
public:
typedef void (*DrawProc)(ScnProc *, bool opa);
ScnProc(MEMAllocator *allocator, DrawProc proc, void *userdata, bool set1, bool set2)
: ScnLeaf(allocator), mFlags(0), mDrawProc(proc), mUserData(userdata)
{
if (set1) mFlags |= 0x1;
if (set2) mFlags |= 0x2;
}
static ScnProc * Construct(MEMAllocator *, u32 *, DrawProc, bool, bool, u32);
virtual bool IsDerivedFrom(TypeObj other) const // at 0x8
{
return other == GetTypeObjStatic() ? true
: ScnLeaf::IsDerivedFrom(other);
};
virtual void G3dProc(u32, u32, void *); // at 0xC
virtual ~ScnProc() {} // at 0x10
virtual const TypeObj GetTypeObj() const // at 0x14
{
return TypeObj(TYPE_NAME);
}
virtual const char * GetTypeName() const // at 0x18
{
return GetTypeObj().GetTypeName();
}
static const G3dObj::TypeObj GetTypeObjStatic() { return TypeObj(TYPE_NAME); }
void * GetUserData() { return mUserData; }
void SetUserData(void *data) { mUserData = data; }
void SetDrawProc(DrawProc proc, bool r5, bool r6)
{
mDrawProc = proc;
if (r5)
{
mFlags |= 0x1;
}
else
{
mFlags &= ~0x1;
}
if (r6)
{
mFlags |= 0x2;
}
else
{
mFlags &= ~0x2;
}
}
private:
u32 mFlags; // at 0xE8
DrawProc mDrawProc; // at 0xEC
void *mUserData; // at 0xF0
NW4R_G3D_TYPE_OBJ_DECL(ScnProc);
};
ScnProc(MEMAllocator *allocator, DrawProc proc, void *userdata, bool set1, bool set2)
: ScnLeaf(allocator), mFlags(0), mDrawProc(proc), mUserData(userdata) {
if (set1) {
mFlags |= 0x1;
}
if (set2) {
mFlags |= 0x2;
}
}
}
#endif
static ScnProc *Construct(MEMAllocator *, u32 *, DrawProc, bool, bool, u32);
virtual bool IsDerivedFrom(TypeObj other) const // at 0x8
{
return other == GetTypeObjStatic() ? true : ScnLeaf::IsDerivedFrom(other);
};
virtual void G3dProc(u32, u32, void *); // at 0xC
virtual ~ScnProc() {} // at 0x10
virtual const TypeObj GetTypeObj() const // at 0x14
{
return TypeObj(TYPE_NAME);
}
virtual const char *GetTypeName() const // at 0x18
{
return GetTypeObj().GetTypeName();
}
static const G3dObj::TypeObj GetTypeObjStatic() {
return TypeObj(TYPE_NAME);
}
void *GetUserData() {
return mUserData;
}
void SetUserData(void *data) {
mUserData = data;
}
void SetDrawProc(DrawProc proc, bool r5, bool r6) {
mDrawProc = proc;
if (r5) {
mFlags |= 0x1;
} else {
mFlags &= ~0x1;
}
if (r6) {
mFlags |= 0x2;
} else {
mFlags &= ~0x2;
}
}
private:
u32 mFlags; // at 0xE8
DrawProc mDrawProc; // at 0xEC
void *mUserData; // at 0xF0
NW4R_G3D_TYPE_OBJ_DECL(ScnProc);
};
} // namespace g3d
} // namespace nw4r
#endif
+43 -48
View File
@@ -1,56 +1,51 @@
#ifndef NW4R_G3D_SCNRFL_H
#define NW4R_G3D_SCNRFL_H
#include "types_nw4r.h"
#include "common.h"
#include "g3d_scnleaf.h"
#include <RFL/RFL_Model.h>
#include <RFL/RFL_MiddleDatabase.h>
#include <RFL/RFL_Model.h>
namespace nw4r
{
namespace g3d
namespace nw4r {
namespace g3d {
class ScnRfl : public ScnLeaf {
public:
struct RflData {
bool SetupCharModel(RFLDataSource, u16, RFLMiddleDB *);
};
public:
static ScnRfl *Construct(MEMAllocator *, u32 *, RFLResolution, u32, u32);
ScnRfl(MEMAllocator *, ScnRfl *, RflData *, void *, u32);
virtual bool IsDerivedFrom(TypeObj other) const // at 0x8
{
class ScnRfl : public ScnLeaf
{
public:
struct RflData
{
bool SetupCharModel(RFLDataSource, u16, RFLMiddleDB *);
};
public:
static ScnRfl * Construct(MEMAllocator *, u32 *, RFLResolution, u32, u32);
ScnRfl(MEMAllocator *, ScnRfl *, RflData *, void *, u32);
virtual bool IsDerivedFrom(TypeObj other) const // at 0x8
{
return (other == GetTypeObjStatic());
}
virtual void G3dProc(u32, u32, void *); // at 0xC
virtual ~ScnRfl(); // at 0x10
virtual const TypeObj GetTypeObj() const // at 0x14
{
return TypeObj(TYPE_NAME);
}
virtual const char * GetTypeName() const // at 0x18
{
return GetTypeObj().GetTypeName();
}
bool GetExpression(RFLExpression *);
bool SetExpression(RFLExpression);
void SetFogIdx(int);
void SetLightSetIdx(int);
static const nw4r::g3d::G3dObj::TypeObj GetTypeObjStatic()
{
return TypeObj(TYPE_NAME);
}
private:
NW4R_G3D_TYPE_OBJ_DECL(ScnRfl);
};
return (other == GetTypeObjStatic());
}
virtual void G3dProc(u32, u32, void *); // at 0xC
virtual ~ScnRfl(); // at 0x10
virtual const TypeObj GetTypeObj() const // at 0x14
{
return TypeObj(TYPE_NAME);
}
virtual const char *GetTypeName() const // at 0x18
{
return GetTypeObj().GetTypeName();
}
}
#endif
bool GetExpression(RFLExpression *);
bool SetExpression(RFLExpression);
void SetFogIdx(int);
void SetLightSetIdx(int);
static const nw4r::g3d::G3dObj::TypeObj GetTypeObjStatic() {
return TypeObj(TYPE_NAME);
}
private:
NW4R_G3D_TYPE_OBJ_DECL(ScnRfl);
};
} // namespace g3d
} // namespace nw4r
#endif
+31 -32
View File
@@ -1,41 +1,40 @@
#ifndef NW4R_G3D_SCNROOT_H
#define NW4R_G3D_SCNROOT_H
#include "types_nw4r.h"
#include "g3d_scnobj.h"
#include "common.h"
#include "g3d_camera.h"
#include "g3d_fog.h"
#include "g3d_scnobj.h"
namespace nw4r
{
namespace g3d
{
class ScnRoot : public ScnGroup
{
public:
Camera GetCamera(int);
Camera GetCurrentCamera();
void SetCurrentCamera(int);
Fog GetFog(int);
namespace nw4r {
namespace g3d {
class ScnRoot : public ScnGroup {
public:
Camera GetCamera(int);
Camera GetCurrentCamera();
void SetCurrentCamera(int);
Fog GetFog(int);
void UpdateFrame();
void CalcWorld();
void CalcMaterial();
void CalcVtx();
void CalcView();
void GatherDrawScnObj();
void ZSort();
void DrawOpa();
void DrawXlu();
void UpdateFrame();
void CalcWorld();
void CalcMaterial();
void CalcVtx();
void CalcView();
void GatherDrawScnObj();
void ZSort();
void DrawOpa();
void DrawXlu();
u8 GetCurrentCameraID() const { return mCameraId; }
private:
UNKWORD WORD_0xE8;
UNKWORD WORD_0xEC;
UNKWORD WORD_0xF0;
u8 mCameraId;
};
u8 GetCurrentCameraID() const {
return mCameraId;
}
}
#endif
private:
UNKWORD WORD_0xE8;
UNKWORD WORD_0xEC;
UNKWORD WORD_0xF0;
u8 mCameraId;
};
} // namespace g3d
} // namespace nw4r
#endif
+1 -1
View File
@@ -1,6 +1,6 @@
#ifndef NW4R_G3D_STATE_H
#define NW4R_G3D_STATE_H
#include "types_nw4r.h"
#include "common.h"
#include <rvl/GX.h>
namespace nw4r {
+10 -17
View File
@@ -1,22 +1,15 @@
#ifndef NW4R_G3D_TMEM_H
#define NW4R_G3D_TMEM_H
#include "types_nw4r.h"
#include "common.h"
namespace nw4r
{
namespace g3d
{
namespace tmem
{
enum TMemLayout
{
TMEM_LAYOUT_0,
TMEM_LAYOUT_1
};
namespace nw4r {
namespace g3d {
namespace tmem {
enum TMemLayout { TMEM_LAYOUT_0, TMEM_LAYOUT_1 };
void SetTMemLayout(TMemLayout);
}
}
}
void SetTMemLayout(TMemLayout);
} // namespace tmem
} // namespace g3d
} // namespace nw4r
#endif
#endif
+16 -20
View File
@@ -1,26 +1,22 @@
#ifndef NW4R_G3D_WORKMEM_H
#define NW4R_G3D_WORKMEM_H
#include "types_nw4r.h"
#include "common.h"
#define G3D_WORKMEM_SIZE 0x18000
namespace nw4r
{
namespace g3d
{
namespace detail
{
namespace workmem
{
void * GetScaleTemporary();
void * GetMtxIDTemporary();
void * GetMdlZTemporary();
void * GetSkinningMtxTemporary();
void * GetBillboardMtxTemporary();
void * GetShpAnmResultBufTemporary();
}
}
}
}
namespace nw4r {
namespace g3d {
namespace detail {
namespace workmem {
void *GetScaleTemporary();
void *GetMtxIDTemporary();
void *GetMdlZTemporary();
void *GetSkinningMtxTemporary();
void *GetBillboardMtxTemporary();
void *GetShpAnmResultBufTemporary();
} // namespace workmem
} // namespace detail
} // namespace g3d
} // namespace nw4r
#endif
#endif
+10 -14
View File
@@ -1,20 +1,16 @@
#ifndef NW4R_G3D_XSI_H
#define NW4R_G3D_XSI_H
#include "types_nw4r.h"
#include "common.h"
#include "g3d_anmtexsrt.h"
namespace nw4r
{
namespace g3d
{
namespace detail
{
namespace dcc
{
bool CalcTexMtx_Xsi(math::MTX34 *, bool, const TexSrt &, TexSrt::Flag);
}
}
}
namespace nw4r {
namespace g3d {
namespace detail {
namespace dcc {
bool CalcTexMtx_Xsi(math::MTX34 *, bool, const TexSrt &, TexSrt::Flag);
}
} // namespace detail
} // namespace g3d
} // namespace nw4r
#endif
#endif
+57 -70
View File
@@ -1,82 +1,69 @@
#ifndef NW4R_LYT_ANIMATION_H
#define NW4R_LYT_ANIMATION_H
#include "types_nw4r.h"
#include "ut_LinkList.h"
#include "lyt_resourceAccessor.h"
#include "lyt_common.h"
#include "common.h"
#include "nw4r/lyt/lyt_common.h"
#include "nw4r/lyt/lyt_resourceAccessor.h"
#include "nw4r/ut/ut_LinkList.h"
namespace nw4r
{
namespace lyt
{
namespace res
{
struct AnimationBlock
{
};
}
namespace nw4r {
namespace lyt {
namespace res {
struct AnimationBlock {};
} // namespace res
struct AnimationBlock
{
res::DataBlockHeader header; // at 0x0
u16 frameSize; // at 0x8
bool loop; // at 0xA
// . . .
};
struct AnimationBlock {
res::DataBlockHeader header; // at 0x0
u16 frameSize; // at 0x8
bool loop; // at 0xA
// . . .
};
struct AnimTransform
{
inline AnimTransform() : mNode(), mResource(NULL), mFrame(0.0f) {}
struct AnimTransform {
inline AnimTransform() : mNode(), mResource(NULL), mFrame(0.0f) {}
u16 GetFrameSize() const;
bool IsLoopData() const;
u16 GetFrameSize() const;
bool IsLoopData() const;
ut::LinkListNode mNode; // at 0x0
AnimationBlock *mResource; // at 0xC
f32 mFrame; // at 0x10
};
ut::LinkListNode mNode; // at 0x0
AnimationBlock *mResource; // at 0xC
f32 mFrame; // at 0x10
};
struct AnimTransformBasic : AnimTransform
{
AnimTransformBasic();
virtual ~AnimTransformBasic();
virtual UNKTYPE SetResource(const res::AnimationBlock *, ResourceAccessor *);
virtual UNKTYPE Bind(Pane *, bool);
virtual UNKTYPE Bind(Material *);
virtual UNKTYPE Animate(u32, Pane *);
virtual UNKTYPE Animate(u32, Material *);
struct AnimTransformBasic : AnimTransform {
AnimTransformBasic();
virtual ~AnimTransformBasic();
virtual UNKTYPE SetResource(const res::AnimationBlock *, ResourceAccessor *);
virtual UNKTYPE Bind(Pane *, bool);
virtual UNKTYPE Bind(Material *);
virtual UNKTYPE Animate(u32, Pane *);
virtual UNKTYPE Animate(u32, Material *);
u32 INT_0x14;
u32 INT_0x18;
u16 INT_0x1C;
};
u32 INT_0x14;
u32 INT_0x18;
u16 INT_0x1C;
};
struct AnimationLink
{
inline AnimationLink() : mNode()
{
Reset();
}
inline void Reset()
{
Set(NULL, 0, false);
}
inline void Set(AnimTransform *pTransform, u16 us, bool b)
{
mTransform = pTransform;
SHORT_0xC = us;
BOOL_0xE = b;
}
ut::LinkListNode mNode; // at 0x0
AnimTransform *mTransform; // at 0x8
u16 SHORT_0xC;
bool BOOL_0xE;
};
struct AnimationLink {
inline AnimationLink() : mNode() {
Reset();
}
}
#endif
inline void Reset() {
Set(NULL, 0, false);
}
inline void Set(AnimTransform *pTransform, u16 us, bool b) {
mTransform = pTransform;
SHORT_0xC = us;
BOOL_0xE = b;
}
ut::LinkListNode mNode; // at 0x0
AnimTransform *mTransform; // at 0x8
u16 SHORT_0xC;
bool BOOL_0xE;
};
} // namespace lyt
} // namespace nw4r
#endif
+3 -4
View File
@@ -1,13 +1,12 @@
#ifndef NW4R_LYT_ARC_RESOURCE_ACCESSOR_H
#define NW4R_LYT_ARC_RESOURCE_ACCESSOR_H
#include "common.h"
#include "lyt_resourceAccessor.h"
#include "types_nw4r.h"
#include "ut_Font.h"
#include "ut_LinkList.h"
#include "nw4r/ut/ut_Font.h"
#include "nw4r/ut/ut_LinkList.h"
#include <rvl/ARC/arc.h>
#include <string.h>
#define FONTNAMEBUF_MAX 127
namespace nw4r {
+19 -29
View File
@@ -1,36 +1,26 @@
#ifndef NW4R_LYT_BOUNDING_H
#define NW4R_LYT_BOUNDING_H
#include "types_nw4r.h"
#include "lyt_pane.h"
#include "lyt_drawInfo.h"
#include "common.h"
#include "nw4r/lyt/lyt_drawInfo.h"
#include "nw4r/lyt/lyt_pane.h"
namespace nw4r
{
namespace lyt
{
namespace res
{
struct Bounding : Pane
{
namespace nw4r {
namespace lyt {
namespace res {
struct Bounding : Pane {};
} // namespace res
};
}
struct ResBlockSet {};
struct ResBlockSet
{
struct Bounding : Pane {
Bounding(const res::Bounding *, const ResBlockSet &);
virtual ~Bounding();
virtual const ut::detail::RuntimeTypeInfo *GetRuntimeTypeInfo() const;
virtual void DrawSelf(const DrawInfo &);
};
static ut::detail::RuntimeTypeInfo typeInfo;
};
} // namespace lyt
} // namespace nw4r
struct Bounding : Pane
{
Bounding(const res::Bounding *, const ResBlockSet&);
virtual ~Bounding();
virtual const ut::detail::RuntimeTypeInfo * GetRuntimeTypeInfo() const;
virtual void DrawSelf(const DrawInfo&);
static ut::detail::RuntimeTypeInfo typeInfo;
};
}
}
#endif
#endif
+39 -46
View File
@@ -1,60 +1,53 @@
#ifndef NW4R_LYT_COMMON_H
#define NW4R_LYT_COMMON_H
#include "types_nw4r.h"
#include "math_types.h"
#include "ut_binaryFileFormat.h"
#include "common.h"
#include "nw4r/math/math_types.h"
#include "nw4r/ut/ut_binaryFileFormat.h"
#define NW4R_RES_NAME_SIZE 16
#define NW4R_MAT_NAME_SIZE 20
#define TEXCOORD_VTX_COUNT 4
namespace nw4r
{
namespace lyt
{
namespace res
{
struct BinaryFileHeader : ut::BinaryFileHeader
{
namespace nw4r {
namespace lyt {
namespace res {
struct BinaryFileHeader : ut::BinaryFileHeader {};
};
struct DataBlockHeader {
u32 kind; // at 0x0
u32 size; // at 0x4
};
} // namespace res
struct DataBlockHeader {
u32 kind; // at 0x0
u32 size; // at 0x4
};
}
namespace detail {
typedef math::VEC2 TexCoordData[TEXCOORD_VTX_COUNT];
namespace detail
{
typedef math::VEC2 TexCoordData[TEXCOORD_VTX_COUNT];
struct TexCoordAry
{
TexCoordAry();
void Free();
void Reserve(u8);
void SetSize(u8);
void Copy(const void *, u8);
struct TexCoordAry {
TexCoordAry();
void Free();
void Reserve(u8);
void SetSize(u8);
void Copy(const void *, u8);
u8 mCap; // at 0x0
u8 mSize; // at 0x1
TexCoordData *mTexCoords; // at 0x4
};
u8 mCap; // at 0x0
u8 mNum; // at 0x1
TexCoordData *mpData; // at 0x4
};
bool EqualsResName(const char *, const char *);
bool EqualsMaterialName(const char *, const char *);
bool TestFileHeader(const res::BinaryFileHeader&);
bool TestFileHeader(const res::BinaryFileHeader&, u32);
bool IsModulateVertexColor(ut::Color *, u8);
void MultipleAlpha(ut::Color *, const ut::Color *, u8); // Inlined
ut::Color MultipleAlpha(ut::Color, u8);
void SetVertexFormat(bool, u8);
void DrawQuad(const math::VEC2&, const Size&, u8, const TexCoordData *, const ut::Color *);
void DrawQuad(const math::VEC2&, const Size&, u8, const TexCoordData *, const ut::Color *, u8);
}
}
}
bool EqualsResName(const char *, const char *);
bool EqualsMaterialName(const char *, const char *);
bool TestFileHeader(const res::BinaryFileHeader &);
bool TestFileHeader(const res::BinaryFileHeader &, u32);
bool IsModulateVertexColor(ut::Color *, u8);
void MultipleAlpha(ut::Color *, const ut::Color *, u8); // Inlined
ut::Color MultipleAlpha(ut::Color, u8);
void SetVertexFormat(bool, u8);
void DrawQuad(const math::VEC2 &, const Size &, u8, const TexCoordData *, const ut::Color *);
void DrawQuad(const math::VEC2 &, const Size &, u8, const TexCoordData *, const ut::Color *, u8);
void DrawLine(const math::VEC2 &pos, const Size &size, ut::Color color);
} // namespace detail
} // namespace lyt
} // namespace nw4r
#endif
#endif
+17 -20
View File
@@ -1,25 +1,22 @@
#ifndef NW4R_LYT_DRAWINFO_H
#define NW4R_LYT_DRAWINFO_H
#include "types_nw4r.h"
#include "math_types.h"
#include "ut_Rect.h"
#include "common.h"
#include "nw4r/math/math_types.h"
#include "nw4r/ut/ut_Rect.h"
namespace nw4r
{
namespace lyt
{
struct DrawInfo
{
virtual ~DrawInfo();
DrawInfo();
namespace nw4r {
namespace lyt {
struct DrawInfo {
virtual ~DrawInfo();
DrawInfo();
math::MTX34 mViewMtx; // at 0x0
ut::Rect mViewRect; // at 0x34
math::VEC2 mScale; // at 0x44
f32 mGlobalAlpha; // at 0x48
u8 mFlags; // at 0x50
};
}
}
math::MTX34 mViewMtx; // at 0x0
ut::Rect mViewRect; // at 0x34
math::VEC2 mScale; // at 0x44
f32 mGlobalAlpha; // at 0x48
u8 mFlags; // at 0x50
};
} // namespace lyt
} // namespace nw4r
#endif
#endif
+38 -46
View File
@@ -1,55 +1,47 @@
#ifndef NW4R_LYT_GROUP_H
#define NW4R_LYT_GROUP_H
#include "types_nw4r.h"
#include "lyt_pane.h"
#include "lyt_common.h"
#include "ut_LinkList.h"
#include "common.h"
#include "nw4r/lyt/lyt_common.h"
#include "nw4r/lyt/lyt_pane.h"
#include "nw4r/ut/ut_LinkList.h"
namespace nw4r
{
namespace lyt
{
namespace res
{
struct Group
{
char UNK_0x0[0x8];
char mName[NW4R_RES_NAME_SIZE]; // at 0x8
u16 SHORT_0x18;
};
}
namespace nw4r {
namespace lyt {
namespace res {
struct Group {
char UNK_0x0[0x8];
char mName[NW4R_RES_NAME_SIZE]; // at 0x8
u16 SHORT_0x18;
};
} // namespace res
namespace detail
{
struct PaneLink
{
ut::LinkListNode mNode; // at 0x0
Pane *PANE_0x8;
};
}
namespace detail {
struct PaneLink {
ut::LinkListNode mNode; // at 0x0
Pane *PANE_0x8;
};
} // namespace detail
struct Group
{
Group(const res::Group *, Pane *);
virtual ~Group();
void AppendPane(Pane *);
void Init();
struct Group {
Group(const res::Group *, Pane *);
virtual ~Group();
void AppendPane(Pane *);
void Init();
ut::LinkListNode mNode; // at 0x4
ut::LinkList<detail::PaneLink, 0> mPaneList; // at 0xC
char mName[NW4R_RES_NAME_SIZE]; // at 0x18
bool mIsUserAllocated; // at 0x29
};
ut::LinkListNode mNode; // at 0x4
ut::LinkList<detail::PaneLink, 0> mPaneList; // at 0xC
char mName[NW4R_RES_NAME_SIZE]; // at 0x18
bool mIsUserAllocated; // at 0x29
};
struct GroupContainer
{
~GroupContainer();
void AppendGroup(Group *);
Group * FindGroupByName(const char *);
struct GroupContainer {
~GroupContainer();
void AppendGroup(Group *);
Group *FindGroupByName(const char *);
ut::LinkList<Group, 4> mGroups; // at 0x4
};
}
}
ut::LinkList<Group, 4> mGroups; // at 0x4
};
} // namespace lyt
} // namespace nw4r
#endif
#endif
+8 -6
View File
@@ -1,7 +1,7 @@
#ifndef NW4R_LYT_LAYOUT_H
#define NW4R_LYT_LAYOUT_H
#include "types_nw4r.h"
#include <new>
#include "common.h"
#include <new.h>
#include <rvl/MEM/mem_allocator.h>
namespace nw4r {
@@ -19,11 +19,13 @@ struct Layout {
template <typename T>
static void DeleteArray(T *p, size_t n) {
for (size_t i = 0; i < n; i++) {
p[i].~T();
}
if (p) {
for (size_t i = 0; i < n; i++) {
p[i].~T();
}
FreeMemory(p);
FreeMemory(p);
}
}
template <typename T>
+2 -3
View File
@@ -1,10 +1,9 @@
#ifndef NW4R_LYT_MATERIAL_H
#define NW4R_LYT_MATERIAL_H
#include "lyt_animation.h"
#include "ut_LinkList.h"
#include "nw4r/lyt/lyt_animation.h"
#include "nw4r/ut/ut_LinkList.h"
#include <rvl/GX.h>
namespace nw4r {
namespace lyt {
// TO-DO
+128 -146
View File
@@ -1,157 +1,139 @@
#ifndef NW4R_LYT_PANE_H
#define NW4R_LYT_PANE_H
#include "types_nw4r.h"
#include "math_types.h"
#include "ut_LinkList.h"
#include "ut_RuntimeTypeInfo.h"
#include "ut_Color.h"
#include "ut_algorithm.h"
#include "lyt_animation.h"
#include <string.h>
#include "common.h"
#include "nw4r/lyt/lyt_animation.h"
#include "nw4r/math/math_types.h"
#include "nw4r/ut/ut_Color.h"
#include "nw4r/ut/ut_LinkList.h"
#include "nw4r/ut/ut_RuntimeTypeInfo.h"
#include "nw4r/ut/ut_algorithm.h"
#include <MSL_C/string.h>
#define PANE_NAME_SIZE 17
#define PANE_USERDATA_SIZE 9
#define ANIMTARGET_PANE_MAX 10
namespace nw4r
{
namespace lyt
{
void LytInit();
namespace nw4r {
namespace lyt {
void LytInit();
struct Size
{
inline Size() : x(), y() {}
struct Size {
inline Size() : x(), y() {}
inline Size& operator=(const Size& rhs)
{
x = rhs.x;
y = rhs.y;
return *this;
}
f32 x, y;
};
namespace detail
{
struct PaneBase
{
inline PaneBase() : mNode() {}
virtual ~PaneBase();
ut::LinkListNode mNode; // at 0x4
};
}
namespace res
{
struct Pane
{
u32 mMagic; // "pan1", at 0x0
u32 mLength; // at 0x4
u8 BYTE_0x8;
u8 BYTE_0x9;
u8 BYTE_0xA;
u8 BYTE_0xB; // NO REFERENCES
char mName[PANE_NAME_SIZE]; // at 0xC
char mUserData[PANE_USERDATA_SIZE]; // at 0x1C
math::VEC3 VEC3_0x24;
math::VEC3 VEC3_0x30;
math::VEC2 VEC2_0x3C;
Size mSize; // at 0x44
};
}
struct Pane : detail::PaneBase
{
// For use with TestBit<Uc>
enum PaneBits
{
VISIBLE,
INFLUENCED_ALPHA,
LOCATION_ADJUST
};
inline void Init()
{
mParent = NULL;
mMaterial = NULL;
BYTE_0xD6 = 0;
INT_0xB4 = 0;
}
inline void SetName(const char *pName)
{
strncpy(mName, pName, PANE_NAME_SIZE);
mName[PANE_NAME_SIZE - 1] = '\0';
}
inline void SetUserData(const char *pData)
{
strncpy(mUserData, pData, PANE_USERDATA_SIZE);
mUserData[PANE_USERDATA_SIZE - 1] = '\0';
}
inline void InsertChild(ut::LinkList<lyt::Pane, 4>::Iterator iter, lyt::Pane *pChild)
{
mChildren.Insert(iter, pChild);
pChild->mParent = this;
}
Pane(const res::Pane *);
virtual ~Pane(); // at 0x8
virtual const ut::detail::RuntimeTypeInfo * GetRuntimeTypeInfo() const; // at 0xC
virtual UNKTYPE CalculateMtx(const DrawInfo&); // at 0x10
virtual UNKTYPE Draw(const DrawInfo&); // at 0x14
virtual void DrawSelf(const DrawInfo&); // at 0x18
virtual UNKTYPE Animate(u32); // at 0x1C
virtual UNKTYPE AnimateSelf(u32); // at 0x20
virtual ut::Color GetVtxColor(u32) const; // at 0x24
virtual void SetVtxColor(u32, ut::Color); // at 0x28
virtual UNKTYPE GetColorElement(u32) const; // at 0x2C
virtual UNKTYPE SetColorElement(u32, u8); // at 0x30
virtual u8 GetVtxColorElement(u32) const; // at 0x34
virtual void SetVtxColorElement(u32, u8); // at 0x38
virtual Pane * FindPaneByName(const char *, bool); // at 0x3C
virtual UNKTYPE FindMaterialByName(const char *, bool); // at 0x40
virtual UNKTYPE BindAnimation(AnimTransform *, bool); // at 0x44
virtual UNKTYPE UnbindAnimation(AnimTransform *, bool); // at 0x48
virtual UNKTYPE UnbindAllAnimation(bool); // at 0x4C
virtual UNKTYPE UnbindAnimationSelf(AnimTransform *); // at 0x50
virtual UNKTYPE FindAnimationLink(AnimTransform *); // at 0x54
virtual UNKTYPE SetAnimationEnable(AnimTransform *, bool, bool); // at 0x58
virtual UNKTYPE GetMaterial() const; // at 0x5C
virtual UNKTYPE LoadMtx(const DrawInfo&); // at 0x60
void AppendChild(Pane *);
void RemoveChild(Pane *);
UNKTYPE GetPaneRect(const DrawInfo&) const;
UNKTYPE AddAnimationLink(AnimationLink *);
UNKTYPE GetVtxPos() const;
ut::LinkListNode mNode; // at 0x4
Pane *mParent; // at 0x8
ut::LinkList<Pane, 4> mChildren; // at 0x14
ut::LinkList<AnimationLink, 0> mAnims; // at 0x20;
Material *mMaterial; // at 0x2C
math::VEC3 mTranslate; // at 0x30
math::VEC3 VEC3_0x3C;
math::VEC2 mScale; // at 0x48
Size mSize; // at 0x50
math::MTX34 MTX34_0x58;
math::MTX34 mGlobalMtx; // at 0x84
int INT_0xB4;
u8 mAlpha; // at 0xB8
u8 BYTE_0xB9;
u8 BYTE_0xBA;
u8 mFlags; // at 0xBB
char mName[PANE_NAME_SIZE]; // at 0xBC
char mUserData[PANE_USERDATA_SIZE]; // at 0xCD
u8 BYTE_0xD6;
static ut::detail::RuntimeTypeInfo typeInfo;
};
inline Size &operator=(const Size &rhs) {
x = rhs.x;
y = rhs.y;
return *this;
}
}
#endif
f32 x, y;
};
namespace detail {
struct PaneBase {
inline PaneBase() : mNode() {}
virtual ~PaneBase();
ut::LinkListNode mNode; // at 0x4
};
} // namespace detail
namespace res {
struct Pane {
u32 mMagic; // "pan1", at 0x0
u32 mLength; // at 0x4
u8 BYTE_0x8;
u8 BYTE_0x9;
u8 BYTE_0xA;
u8 BYTE_0xB; // NO REFERENCES
char mName[PANE_NAME_SIZE]; // at 0xC
char mUserData[PANE_USERDATA_SIZE]; // at 0x1C
math::VEC3 VEC3_0x24;
math::VEC3 VEC3_0x30;
math::VEC2 VEC2_0x3C;
Size mSize; // at 0x44
};
} // namespace res
struct Pane : detail::PaneBase {
// For use with TestBit<Uc>
enum PaneBits { VISIBLE, INFLUENCED_ALPHA, LOCATION_ADJUST };
inline void Init() {
mParent = NULL;
mMaterial = NULL;
BYTE_0xD6 = 0;
INT_0xB4 = 0;
}
inline void SetName(const char *pName) {
strncpy(mName, pName, PANE_NAME_SIZE);
mName[PANE_NAME_SIZE - 1] = '\0';
}
inline void SetUserData(const char *pData) {
strncpy(mUserData, pData, PANE_USERDATA_SIZE);
mUserData[PANE_USERDATA_SIZE - 1] = '\0';
}
inline void InsertChild(ut::LinkList<lyt::Pane, 4>::Iterator iter, lyt::Pane *pChild) {
mChildren.Insert(iter, pChild);
pChild->mParent = this;
}
Pane(const res::Pane *);
virtual ~Pane(); // at 0x8
virtual const ut::detail::RuntimeTypeInfo *GetRuntimeTypeInfo() const; // at 0xC
virtual UNKTYPE CalculateMtx(const DrawInfo &); // at 0x10
virtual UNKTYPE Draw(const DrawInfo &); // at 0x14
virtual void DrawSelf(const DrawInfo &); // at 0x18
virtual UNKTYPE Animate(u32); // at 0x1C
virtual UNKTYPE AnimateSelf(u32); // at 0x20
virtual ut::Color GetVtxColor(u32) const; // at 0x24
virtual void SetVtxColor(u32, ut::Color); // at 0x28
virtual UNKTYPE GetColorElement(u32) const; // at 0x2C
virtual UNKTYPE SetColorElement(u32, u8); // at 0x30
virtual u8 GetVtxColorElement(u32) const; // at 0x34
virtual void SetVtxColorElement(u32, u8); // at 0x38
virtual Pane *FindPaneByName(const char *, bool); // at 0x3C
virtual UNKTYPE FindMaterialByName(const char *, bool); // at 0x40
virtual UNKTYPE BindAnimation(AnimTransform *, bool); // at 0x44
virtual UNKTYPE UnbindAnimation(AnimTransform *, bool); // at 0x48
virtual UNKTYPE UnbindAllAnimation(bool); // at 0x4C
virtual UNKTYPE UnbindAnimationSelf(AnimTransform *); // at 0x50
virtual UNKTYPE FindAnimationLink(AnimTransform *); // at 0x54
virtual UNKTYPE SetAnimationEnable(AnimTransform *, bool, bool); // at 0x58
virtual UNKTYPE GetMaterial() const; // at 0x5C
virtual UNKTYPE LoadMtx(const DrawInfo &); // at 0x60
void AppendChild(Pane *);
void RemoveChild(Pane *);
UNKTYPE GetPaneRect(const DrawInfo &) const;
UNKTYPE AddAnimationLink(AnimationLink *);
UNKTYPE GetVtxPos() const;
ut::LinkListNode mNode; // at 0x4
Pane *mParent; // at 0x8
ut::LinkList<Pane, 4> mChildren; // at 0x14
ut::LinkList<AnimationLink, 0> mAnims; // at 0x20;
Material *mMaterial; // at 0x2C
math::VEC3 mTranslate; // at 0x30
math::VEC3 VEC3_0x3C;
math::VEC2 mScale; // at 0x48
Size mSize; // at 0x50
math::MTX34 MTX34_0x58;
math::MTX34 mGlobalMtx; // at 0x84
int INT_0xB4;
u8 mAlpha; // at 0xB8
u8 BYTE_0xB9;
u8 BYTE_0xBA;
u8 mFlags; // at 0xBB
char mName[PANE_NAME_SIZE]; // at 0xBC
char mUserData[PANE_USERDATA_SIZE]; // at 0xCD
u8 BYTE_0xD6;
static ut::detail::RuntimeTypeInfo typeInfo;
};
} // namespace lyt
} // namespace nw4r
#endif
+14 -17
View File
@@ -1,21 +1,18 @@
#ifndef NW4R_LYT_RESOURCE_ACCESSOR_H
#define NW4R_LYT_RESOURCE_ACCESSOR_H
#include "types_nw4r.h"
#include "ut_Font.h"
#include "common.h"
#include "nw4r/ut/ut_Font.h"
namespace nw4r
{
namespace lyt
{
class ResourceAccessor
{
public:
ResourceAccessor();
virtual ~ResourceAccessor(); // at 0x8
virtual UNKTYPE * GetResource(u32, const char *, u32 *) = 0; // at 0xC
virtual ut::Font * GetFont(const char *); // at 0x10
};
}
}
namespace nw4r {
namespace lyt {
class ResourceAccessor {
public:
ResourceAccessor();
virtual ~ResourceAccessor(); // at 0x8
virtual UNKTYPE *GetResource(u32, const char *, u32 *) = 0; // at 0xC
virtual ut::Font *GetFont(const char *); // at 0x10
};
} // namespace lyt
} // namespace nw4r
#endif
#endif
+1 -1
View File
@@ -1,6 +1,6 @@
#ifndef NW4R_LYT_TEXMAP_H
#define NW4R_LYT_TEXMAP_H
#include "types_nw4r.h"
#include "common.h"
#include <rvl/GX.h>
#include <rvl/TPL/TPL.h>
+83 -95
View File
@@ -1,102 +1,90 @@
#ifndef NW4R_SND_BANK_FILE_H
#define NW4R_SND_BANK_FILE_H
#include "types_nw4r.h"
#include "ut_binaryFileFormat.h"
#include "ut_algorithm.h"
#include "common.h"
#include "snd_Util.h"
#include "snd_WaveFile.h"
#include "ut_algorithm.h"
#include "ut_binaryFileFormat.h"
namespace nw4r
{
namespace snd
{
namespace detail
{
struct InstInfo
{
int WORD_0x0;
u8 mAttack; // at 0x4
u8 mDecay; // at 0x5
u8 mSustain; // at 0x6
u8 mRelease; // at 0x7
u8 BYTE_0x8;
u8 BYTE_0x9;
u8 BYTE_0xA;
float FLOAT_0xC;
};
struct BankFile
{
struct InstParam
{
int WORD_0x0;
u8 mAttack; // at 0x4
u8 mDecay; // at 0x5
u8 mSustain; // at 0x6
u8 mRelease; // at 0x7
char UNK_0x8[0x4];
char BYTE_0xC;
u8 BYTE_0xD;
char BYTE_0xE;
float FLOAT_0x10;
};
struct RangeTable
{
u8 BYTE_0x0;
u8 BYTES_0x1[];
};
struct IndexTable
{
u8 BYTE_0x0;
u8 BYTE_0x1;
};
ut::BinaryFileHeader mHeader; // at 0x0
u32 OFFSET_0x10;
char UNK_0x14[0x4];
u32 OFFSET_0x18;
typedef Util::DataRef<void, InstParam, RangeTable, IndexTable> Region;
};
struct BankFileReader
{
struct UNKBLOCK_DATA
{
ut::BinaryBlockHeader mHeader; // at 0x0
int INT_0x8;
BankFile::Region ARR_0xC[];
};
struct UNKBLOCK_WAVE
{
ut::BinaryBlockHeader mHeader; // at 0x0
u32 INT_0x8;
WaveFile::Region ARR_0xC[];
};
bool IsValidFileHeader(const void *);
BankFileReader(const void *);
bool ReadInstInfo(InstInfo *, int, int, int) const;
const BankFile::Region * GetReferenceToSubRegion(const BankFile::Region *, int) const;
bool ReadWaveParam(WaveData *, int, const void *) const;
const BankFile * mFile; // at 0x0
const UNKBLOCK_DATA * PTR_0x4;
const UNKBLOCK_WAVE * PTR_0x8;
};
inline u8 ReadByte(const void * ptr)
{
return *static_cast<const u8 *>(ptr);
}
}
}
namespace nw4r {
namespace snd {
namespace detail {
struct InstInfo {
int WORD_0x0;
u8 mAttack; // at 0x4
u8 mDecay; // at 0x5
u8 mSustain; // at 0x6
u8 mRelease; // at 0x7
u8 BYTE_0x8;
u8 BYTE_0x9;
u8 BYTE_0xA;
float FLOAT_0xC;
};
struct BankFile {
struct InstParam {
int WORD_0x0;
u8 mAttack; // at 0x4
u8 mDecay; // at 0x5
u8 mSustain; // at 0x6
u8 mRelease; // at 0x7
char UNK_0x8[0x4];
char BYTE_0xC;
u8 BYTE_0xD;
char BYTE_0xE;
float FLOAT_0x10;
};
struct RangeTable {
u8 BYTE_0x0;
u8 BYTES_0x1[];
};
struct IndexTable {
u8 BYTE_0x0;
u8 BYTE_0x1;
};
ut::BinaryFileHeader mHeader; // at 0x0
u32 OFFSET_0x10;
char UNK_0x14[0x4];
u32 OFFSET_0x18;
typedef Util::DataRef<void, InstParam, RangeTable, IndexTable> Region;
};
struct BankFileReader {
struct UNKBLOCK_DATA {
ut::BinaryBlockHeader mHeader; // at 0x0
int INT_0x8;
BankFile::Region ARR_0xC[];
};
struct UNKBLOCK_WAVE {
ut::BinaryBlockHeader mHeader; // at 0x0
u32 INT_0x8;
WaveFile::Region ARR_0xC[];
};
bool IsValidFileHeader(const void *);
BankFileReader(const void *);
bool ReadInstInfo(InstInfo *, int, int, int) const;
const BankFile::Region *GetReferenceToSubRegion(const BankFile::Region *, int) const;
bool ReadWaveParam(WaveData *, int, const void *) const;
const BankFile *mFile; // at 0x0
const UNKBLOCK_DATA *PTR_0x4;
const UNKBLOCK_WAVE *PTR_0x8;
};
inline u8 ReadByte(const void *ptr) {
return *static_cast<const u8 *>(ptr);
}
} // namespace detail
} // namespace snd
} // namespace nw4r
#endif
#endif
+139 -155
View File
@@ -1,161 +1,145 @@
#ifndef NW4R_SND_CHANNEL_H
#define NW4R_SND_CHANNEL_H
#include "types_nw4r.h"
#include "ut_LinkList.h"
#include "snd_Voice.h"
#include "snd_Lfo.h"
#include "snd_InstancePool.h"
#include "snd_WaveFile.h"
#include "common.h"
#include "snd_EnvGenerator.h"
#include "snd_InstancePool.h"
#include "snd_Lfo.h"
#include "snd_MoveValue.h"
#include "snd_Voice.h"
#include "snd_WaveFile.h"
#include "ut_LinkList.h"
namespace nw4r
{
namespace snd
{
namespace detail
{
struct Channel
{
enum ChannelCallbackStatus
{
CALLBACK_STATUS_0,
CALLBACK_STATUS_1,
CALLBACK_STATUS_2,
CALLBACK_STATUS_3
};
typedef void (* ChannelCallback)(Channel *, ChannelCallbackStatus, u32);
static void VoiceCallbackFunc(Voice *, Voice::VoiceCallbackStatus, void *);
static Channel * AllocChannel(int, int, int, ChannelCallback, u32);
static void FreeChannel(Channel *);
Channel();
UNKTYPE InitParam(ChannelCallback, u32);
void Update(bool);
UNKTYPE Start(const WaveData &, int, u32);
UNKTYPE Release();
UNKTYPE Stop();
float GetSweepValue() const;
void UpdateSweep(int);
void SetSweepParam(float, int, bool);
EnvGenerator mEnvGenerator; // at 0x0
Lfo mLfo; // at 0x18
u8 BYTE_0x30;
bool mPauseFlag; // at 0x31
bool mActiveFlag; // at 0x32
bool BOOL_0x33;
bool mAutoUpdateSweepFlag; // at 0x34
bool mReleasePriorityFixFlag; // at 0x35
float FLOAT_0x38;
float FLOAT_0x3C;
float FLOAT_0x40;
float FLOAT_0x44;
float FLOAT_0x48;
int mRemoteFilter; // at 0x4c
int mOutputLine; // at 0x50
float FLOAT_0x54;
float FLOAT_0x58;
float ARR_0x5C[3];
float mRemoteOutVolumes[4]; // at 0x68
float ARR_0x78[4];
float ARR_0x88[4];
float FLOAT_0x98;
float FLOAT_0x9C;
int INT_0xA0;
int INT_0xA4;
float FLOAT_0xA8;
float FLOAT_0xAC;
float FLOAT_0xB0;
float FLOAT_0xB4;
MoveValue<u8, u16> MV_0xB8;
UNKWORD INT_0xC0;
UNKWORD INT_0xC4;
int mLength; // at 0xc8
PanMode mPanMode; // at 0xcc
PanCurve mPanCurve; // at 0xd0
ChannelCallback mCallback; // at 0xd4
u32 INT_0xD8;
Voice * mVoice; // at 0xdc
Channel * mNext; // at 0xe0
ut::LinkListNode mNode; // at 0xe4
inline bool IsActive() const
{
return mActiveFlag;
}
inline void SetRelease(int release)
{
if (release >= 0) mEnvGenerator.SetRelease(release);
Release();
}
inline bool IsAutoUpdateSweep() const
{
return mAutoUpdateSweepFlag;
}
inline bool IsPause() const
{
return mPauseFlag;
}
inline void Pause(bool flag)
{
mPauseFlag = flag;
mVoice->Pause(flag);
}
inline void SetLfoParam(const LfoParam & lfoParam)
{
mLfo.SetParam(lfoParam);
}
inline void SetSilence(bool silentFlag, int time)
{
MV_0xB8.SetTarget(silentFlag ? 0 : 0xFF, time);
}
};
struct ChannelManager
{
ChannelManager();
u32 GetRequiredMemSize();
void Setup(void *, u32);
void Shutdown();
UNKTYPE UpdateAllChannel();
static void Free(Channel *); //inlined
Channel * Alloc(); // inlined
static ChannelManager * GetInstance();
InstancePool<Channel> mPool; // at 0x0
ut::LinkList<Channel, 0xE4> mList; // at 0x4
bool BOOL_0x10;
u32 INT_0x14;
UNKTYPE * PTR_0x18;
u32 INT_0x1C;
};
}
}
}
namespace nw4r {
namespace snd {
namespace detail {
struct Channel {
enum ChannelCallbackStatus { CALLBACK_STATUS_0, CALLBACK_STATUS_1, CALLBACK_STATUS_2, CALLBACK_STATUS_3 };
#endif
typedef void (*ChannelCallback)(Channel *, ChannelCallbackStatus, u32);
static void VoiceCallbackFunc(Voice *, Voice::VoiceCallbackStatus, void *);
static Channel *AllocChannel(int, int, int, ChannelCallback, u32);
static void FreeChannel(Channel *);
Channel();
UNKTYPE InitParam(ChannelCallback, u32);
void Update(bool);
UNKTYPE Start(const WaveData &, int, u32);
UNKTYPE Release();
UNKTYPE Stop();
float GetSweepValue() const;
void UpdateSweep(int);
void SetSweepParam(float, int, bool);
EnvGenerator mEnvGenerator; // at 0x0
Lfo mLfo; // at 0x18
u8 BYTE_0x30;
bool mPauseFlag; // at 0x31
bool mActiveFlag; // at 0x32
bool BOOL_0x33;
bool mAutoUpdateSweepFlag; // at 0x34
bool mReleasePriorityFixFlag; // at 0x35
float FLOAT_0x38;
float FLOAT_0x3C;
float FLOAT_0x40;
float FLOAT_0x44;
float FLOAT_0x48;
int mRemoteFilter; // at 0x4c
int mOutputLine; // at 0x50
float FLOAT_0x54;
float FLOAT_0x58;
float ARR_0x5C[3];
float mRemoteOutVolumes[4]; // at 0x68
float ARR_0x78[4];
float ARR_0x88[4];
float FLOAT_0x98;
float FLOAT_0x9C;
int INT_0xA0;
int INT_0xA4;
float FLOAT_0xA8;
float FLOAT_0xAC;
float FLOAT_0xB0;
float FLOAT_0xB4;
MoveValue<u8, u16> MV_0xB8;
UNKWORD INT_0xC0;
UNKWORD INT_0xC4;
int mLength; // at 0xc8
PanMode mPanMode; // at 0xcc
PanCurve mPanCurve; // at 0xd0
ChannelCallback mCallback; // at 0xd4
u32 INT_0xD8;
Voice *mVoice; // at 0xdc
Channel *mNext; // at 0xe0
ut::LinkListNode mNode; // at 0xe4
inline bool IsActive() const {
return mActiveFlag;
}
inline void SetRelease(int release) {
if (release >= 0) {
mEnvGenerator.SetRelease(release);
}
Release();
}
inline bool IsAutoUpdateSweep() const {
return mAutoUpdateSweepFlag;
}
inline bool IsPause() const {
return mPauseFlag;
}
inline void Pause(bool flag) {
mPauseFlag = flag;
mVoice->Pause(flag);
}
inline void SetLfoParam(const LfoParam &lfoParam) {
mLfo.SetParam(lfoParam);
}
inline void SetSilence(bool silentFlag, int time) {
MV_0xB8.SetTarget(silentFlag ? 0 : 0xFF, time);
}
};
struct ChannelManager {
ChannelManager();
u32 GetRequiredMemSize();
void Setup(void *, u32);
void Shutdown();
UNKTYPE UpdateAllChannel();
static void Free(Channel *); // inlined
Channel *Alloc(); // inlined
static ChannelManager *GetInstance();
InstancePool<Channel> mPool; // at 0x0
ut::LinkList<Channel, 0xE4> mList; // at 0x4
bool BOOL_0x10;
u32 INT_0x14;
UNKTYPE *PTR_0x18;
u32 INT_0x1C;
};
} // namespace detail
} // namespace snd
} // namespace nw4r
#endif
+12 -16
View File
@@ -1,21 +1,17 @@
#ifndef NW4R_SND_CHANNEL_MANAGER_H
#define NW4R_SND_CHANNEL_MANAGER_H
#include "types_nw4r.h"
#include "common.h"
namespace nw4r
{
namespace snd
{
namespace detail
{
struct ChannelManager
{
static ChannelManager * GetInstance();
namespace nw4r {
namespace snd {
namespace detail {
struct ChannelManager {
static ChannelManager *GetInstance();
void UpdateAllChannel();
};
}
}
}
void UpdateAllChannel();
};
} // namespace detail
} // namespace snd
} // namespace nw4r
#endif
#endif
+15 -19
View File
@@ -1,24 +1,20 @@
#ifndef NW4R_SND_DISPOSE_CALLBACK_H
#define NW4R_SND_DISPOSE_CALLBACK_H
#include "types_nw4r.h"
#include "common.h"
#include "ut_LinkList.h"
namespace nw4r
{
namespace snd
{
namespace detail
{
struct DisposeCallback
{
ut::LinkListNode mNode; // at 0x0
inline virtual ~DisposeCallback() {} // at 0x8
virtual void InvalidateData(const void *, const void *) = 0; // at 0xc
virtual void InvalidateWaveData(const void *, const void *) = 0; // at 0x10
};
}
}
}
namespace nw4r {
namespace snd {
namespace detail {
struct DisposeCallback {
ut::LinkListNode mNode; // at 0x0
#endif
inline virtual ~DisposeCallback() {} // at 0x8
virtual void InvalidateData(const void *, const void *) = 0; // at 0xc
virtual void InvalidateWaveData(const void *, const void *) = 0; // at 0x10
};
} // namespace detail
} // namespace snd
} // namespace nw4r
#endif
+19 -23
View File
@@ -1,29 +1,25 @@
#ifndef NW4R_SND_DISPOSE_CALLBACK_MANAGER_H
#define NW4R_SND_DISPOSE_CALLBACK_MANAGER_H
#include "types_nw4r.h"
#include "common.h"
#include "snd_DisposeCallback.h"
#include "ut_LinkList.h"
namespace nw4r
{
namespace snd
{
namespace detail
{
struct DisposeCallbackManager
{
static DisposeCallbackManager * GetInstance();
ut::LinkList<DisposeCallback, 0x0> mList; // at 0x0
UNKTYPE RegisterDisposeCallback(DisposeCallback *);
UNKTYPE UnregisterDisposeCallback(DisposeCallback *);
UNKTYPE Dispose(void *, u32, void *);
UNKTYPE DisposeWave(void *, u32, void *);
};
}
}
}
namespace nw4r {
namespace snd {
namespace detail {
struct DisposeCallbackManager {
static DisposeCallbackManager *GetInstance();
#endif
ut::LinkList<DisposeCallback, 0x0> mList; // at 0x0
UNKTYPE RegisterDisposeCallback(DisposeCallback *);
UNKTYPE UnregisterDisposeCallback(DisposeCallback *);
UNKTYPE Dispose(void *, u32, void *);
UNKTYPE DisposeWave(void *, u32, void *);
};
} // namespace detail
} // namespace snd
} // namespace nw4r
#endif
+69 -84
View File
@@ -1,90 +1,75 @@
#ifndef NW4R_SND_FRAME_HEAP_H
#define NW4R_SND_FRAME_HEAP_H
#include "types_nw4r.h"
#include "common.h"
#include "ut_LinkList.h"
#include "ut_algorithm.h"
namespace nw4r
{
namespace snd
{
namespace detail
{
struct FrameHeap
{
typedef void (* AllocCallback)(void *, u32, void *);
struct Block
{
ut::LinkListNode mNode; // at 0x0
u32 mSize; // at 0x8
AllocCallback mCallback; // at 0xc
void * PTR_0x10;
inline Block(u32 size, AllocCallback callback, void * ptr)
:
mSize(size),
mCallback(callback),
PTR_0x10(ptr)
{}
inline void * GetBufferAddr()
{
return reinterpret_cast<u8 *>(this) + ut::RoundUp<u32>(sizeof(Block), 0x20);
}
inline ~Block()
{
if (mCallback) mCallback(PTR_0x10, mSize, GetBufferAddr());
}
};
struct Section
{
ut::LinkListNode mNode; // at 0x0
ut::LinkList<Block, 0x0> mList; // at 0x8
inline void AppendBlock(Block * pBlock)
{
mList.PushBack(pBlock);
}
inline ~Section()
{
ut::LinkList<Block, 0x0>::Iterator iter = mList.GetEndIter();
while (iter != mList.GetBeginIter())
{
(--iter)->~Block();
}
}
};
bool NewSection(); //inlined
UNKTYPE ClearSection(); //inlined
FrameHeap();
~FrameHeap();
bool Create(void *, u32);
UNKTYPE Destroy();
void Clear();
void * Alloc(u32, AllocCallback, void *);
int SaveState();
void LoadState(int);
int GetCurrentLevel() const;
u32 GetFreeSize() const;
UNKTYPE * PTR_0x0;
ut::LinkList<Section, 0x0> mList; // at 0x4
inline bool IsValid() const
{
return mList.GetSize();
}
};
}
}
}
namespace nw4r {
namespace snd {
namespace detail {
struct FrameHeap {
typedef void (*AllocCallback)(void *, u32, void *);
#endif
struct Block {
ut::LinkListNode mNode; // at 0x0
u32 mSize; // at 0x8
AllocCallback mCallback; // at 0xc
void *PTR_0x10;
inline Block(u32 size, AllocCallback callback, void *ptr) : mSize(size), mCallback(callback), PTR_0x10(ptr) {}
inline void *GetBufferAddr() {
return reinterpret_cast<u8 *>(this) + ut::RoundUp<u32>(sizeof(Block), 0x20);
}
inline ~Block() {
if (mCallback) {
mCallback(PTR_0x10, mSize, GetBufferAddr());
}
}
};
struct Section {
ut::LinkListNode mNode; // at 0x0
ut::LinkList<Block, 0x0> mList; // at 0x8
inline void AppendBlock(Block *pBlock) {
mList.PushBack(pBlock);
}
inline ~Section() {
ut::LinkList<Block, 0x0>::Iterator iter = mList.GetEndIter();
while (iter != mList.GetBeginIter()) {
(--iter)->~Block();
}
}
};
bool NewSection(); // inlined
UNKTYPE ClearSection(); // inlined
FrameHeap();
~FrameHeap();
bool Create(void *, u32);
UNKTYPE Destroy();
void Clear();
void *Alloc(u32, AllocCallback, void *);
int SaveState();
void LoadState(int);
int GetCurrentLevel() const;
u32 GetFreeSize() const;
UNKTYPE *PTR_0x0;
ut::LinkList<Section, 0x0> mList; // at 0x4
inline bool IsValid() const {
return mList.GetSize();
}
};
} // namespace detail
} // namespace snd
} // namespace nw4r
#endif
+17 -26
View File
@@ -1,33 +1,24 @@
#ifndef NW4R_SND_FX_BASE_H
#define NW4R_SND_FX_BASE_H
#include "types_nw4r.h"
#include "common.h"
#include "snd_Common.h"
#include "ut_LinkList.h"
namespace nw4r
{
namespace snd
{
enum SampleFormat
{
SAMPLE_FORMAT_PCM_S32,
SAMPLE_FORMAT_PCM_S16,
SAMPLE_FORMAT_PCM_S8,
SAMPLE_FORMAT_DSP_ADPCM
};
struct FxBase
{
inline virtual ~FxBase() {} // at 0x8
inline virtual bool StartUp() {} // at 0xc
inline virtual UNKTYPE Shutdown() {} // at 0x10
inline virtual UNKTYPE UpdateBuffer(int, void **, u32, SampleFormat, float, OutputMode) {} // at 0x14
NW4R_UT_LIST_NODE_DECL(); // at 0x4
};
namespace nw4r {
namespace snd {
enum SampleFormat { SAMPLE_FORMAT_PCM_S32, SAMPLE_FORMAT_PCM_S16, SAMPLE_FORMAT_PCM_S8, SAMPLE_FORMAT_DSP_ADPCM };
NW4R_UT_LIST_TYPEDEF_DECL(FxBase);
}
}
struct FxBase {
inline virtual ~FxBase() {} // at 0x8
inline virtual bool StartUp() {} // at 0xc
inline virtual UNKTYPE Shutdown() {} // at 0x10
inline virtual UNKTYPE UpdateBuffer(int, void **, u32, SampleFormat, float, OutputMode) {} // at 0x14
#endif
NW4R_UT_LIST_NODE_DECL(); // at 0x4
};
NW4R_UT_LIST_TYPEDEF_DECL(FxBase);
} // namespace snd
} // namespace nw4r
#endif
+37 -42
View File
@@ -1,47 +1,42 @@
#ifndef NW4R_SND_FX_CHORUS_H
#define NW4R_SND_FX_CHORUS_H
#include <AXFXChorus.h>
#include "types_nw4r.h"
#include "snd_FxBase.h"
#include "snd_AxfxImpl.h"
#include "snd_FxBase.h"
#include <AXFXChorus.h>#include "common.h"
namespace nw4r
{
namespace snd
{
struct FxChorus : FxBase
{
//sizeof(ChorusParam) = 0xc
struct ChorusParam
{
float FLOAT_0x0;
float FLOAT_0x4;
float FLOAT_0x8;
};
FxChorus();
inline ~FxChorus()
{
Shutdown();
ReleaseWorkBuffer();
}
u32 GetRequiredMemSize();
virtual UNKTYPE AssignWorkBuffer(void *, u32); // at 0x18
virtual UNKTYPE ReleaseWorkBuffer(); // at 0x1c
bool StartUp(); // at 0xc
UNKTYPE Shutdown(); // at 0x10
bool SetParam(const ChorusParam &);
UNKTYPE UpdateBuffer(int, void **, u32, SampleFormat, float, OutputMode); // at 0x14
detail::AxfxImpl mAxfxImpl;
ChorusParam mParam; // at 0x18
AXFX_CHORUS mAXFXChorus; // 0x24
};
}
}
#endif
namespace nw4r {
namespace snd {
struct FxChorus : FxBase {
// sizeof(ChorusParam) = 0xc
struct ChorusParam {
float FLOAT_0x0;
float FLOAT_0x4;
float FLOAT_0x8;
};
FxChorus();
inline ~FxChorus() {
Shutdown();
ReleaseWorkBuffer();
}
u32 GetRequiredMemSize();
virtual UNKTYPE AssignWorkBuffer(void *, u32); // at 0x18
virtual UNKTYPE ReleaseWorkBuffer(); // at 0x1c
bool StartUp(); // at 0xc
UNKTYPE Shutdown(); // at 0x10
bool SetParam(const ChorusParam &);
UNKTYPE UpdateBuffer(int, void **, u32, SampleFormat, float, OutputMode); // at 0x14
detail::AxfxImpl mAxfxImpl;
ChorusParam mParam; // at 0x18
AXFX_CHORUS mAXFXChorus; // 0x24
};
} // namespace snd
} // namespace nw4r
#endif
+37 -42
View File
@@ -1,47 +1,42 @@
#ifndef NW4R_SND_FX_DELAY_H
#define NW4R_SND_FX_DELAY_H
#include <AXFXDelay.h>
#include "snd_FxBase.h"
#include "common.h"
#include "snd_AxfxImpl.h"
#include "types_nw4r.h"
#include "snd_FxBase.h"
#include <AXFXDelay.h>
namespace nw4r
{
namespace snd
{
struct FxDelay : FxBase
{
//sizeof(FxDelayParam) = 0xc
struct DelayParam
{
float FLOAT_0x0;
float FLOAT_0x4;
float FLOAT_0x8;
};
FxDelay();
inline ~FxDelay()
{
Shutdown();
ReleaseWorkBuffer();
}
u32 GetRequiredMemSize();
virtual UNKTYPE AssignWorkBuffer(void *, u32); // at 0x18
virtual UNKTYPE ReleaseWorkBuffer(); // at 0x1c
bool StartUp(); // at 0xc
UNKTYPE Shutdown(); // at 0x10
bool SetParam(const DelayParam &);
UNKTYPE UpdateBuffer(int, void **, u32, SampleFormat, float, OutputMode); // at 0x14
detail::AxfxImpl mAxfxImpl; // at 0xc
DelayParam mParam; // at 0x18
AXFX_DELAY mAXFXDelay; // at 0x24
};
}
}
namespace nw4r {
namespace snd {
struct FxDelay : FxBase {
// sizeof(FxDelayParam) = 0xc
struct DelayParam {
float FLOAT_0x0;
float FLOAT_0x4;
float FLOAT_0x8;
};
#endif
FxDelay();
inline ~FxDelay() {
Shutdown();
ReleaseWorkBuffer();
}
u32 GetRequiredMemSize();
virtual UNKTYPE AssignWorkBuffer(void *, u32); // at 0x18
virtual UNKTYPE ReleaseWorkBuffer(); // at 0x1c
bool StartUp(); // at 0xc
UNKTYPE Shutdown(); // at 0x10
bool SetParam(const DelayParam &);
UNKTYPE UpdateBuffer(int, void **, u32, SampleFormat, float, OutputMode); // at 0x14
detail::AxfxImpl mAxfxImpl; // at 0xc
DelayParam mParam; // at 0x18
AXFX_DELAY mAXFXDelay; // at 0x24
};
} // namespace snd
} // namespace nw4r
#endif
+40 -45
View File
@@ -1,50 +1,45 @@
#ifndef NW4R_SND_FX_REVERB_HI_H
#define NW4R_SND_FX_REVERB_HI_H
#include <AXFXReverbHi.h>
#include "snd_FxBase.h"
#include "common.h"
#include "snd_AxfxImpl.h"
#include "types_nw4r.h"
#include "snd_FxBase.h"
#include <AXFXReverbHi.h>
namespace nw4r
{
namespace snd
{
struct FxReverbHi : FxBase
{
//sizeof(ReverbHiParam) = 0x18
struct ReverbHiParam
{
float FLOAT_0x0;
float FLOAT_0x4;
float FLOAT_0x8;
float FLOAT_0xC;
float FLOAT_0x10;
float FLOAT_0x14;
};
FxReverbHi();
inline ~FxReverbHi()
{
Shutdown();
ReleaseWorkBuffer();
}
u32 GetRequiredMemSize();
virtual UNKTYPE AssignWorkBuffer(void *, u32); // at 0x18
virtual UNKTYPE ReleaseWorkBuffer(); // at 0x1c
bool StartUp(); // at 0xc
UNKTYPE Shutdown(); // at 0x10
bool SetParam(const ReverbHiParam &);
UNKTYPE UpdateBuffer(int, void **, u32, SampleFormat, float, OutputMode); // at 0x14
detail::AxfxImpl mAxfxImpl; // at 0xc
ReverbHiParam mParam; // at 0x18
AXFX_REVERBHI mAXFXReverbHi; // at 0x30
};
}
}
namespace nw4r {
namespace snd {
struct FxReverbHi : FxBase {
// sizeof(ReverbHiParam) = 0x18
struct ReverbHiParam {
float FLOAT_0x0;
float FLOAT_0x4;
float FLOAT_0x8;
float FLOAT_0xC;
float FLOAT_0x10;
float FLOAT_0x14;
};
#endif
FxReverbHi();
inline ~FxReverbHi() {
Shutdown();
ReleaseWorkBuffer();
}
u32 GetRequiredMemSize();
virtual UNKTYPE AssignWorkBuffer(void *, u32); // at 0x18
virtual UNKTYPE ReleaseWorkBuffer(); // at 0x1c
bool StartUp(); // at 0xc
UNKTYPE Shutdown(); // at 0x10
bool SetParam(const ReverbHiParam &);
UNKTYPE UpdateBuffer(int, void **, u32, SampleFormat, float, OutputMode); // at 0x14
detail::AxfxImpl mAxfxImpl; // at 0xc
ReverbHiParam mParam; // at 0x18
AXFX_REVERBHI mAXFXReverbHi; // at 0x30
};
} // namespace snd
} // namespace nw4r
#endif
+1 -2
View File
@@ -1,9 +1,8 @@
#ifndef NW4R_SND_INSTANCE_POOL_H
#define NW4R_SND_INSTANCE_POOL_H
#include "types_nw4r.h"
#include "common.h"
#include <MSL_C/new.h>
namespace nw4r {
namespace snd {
namespace detail {

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