Skip to content

Commit

Permalink
m_anmtexsrt
Browse files Browse the repository at this point in the history
  • Loading branch information
robojumper committed Jun 21, 2024
1 parent 0512d83 commit ebd0c04
Show file tree
Hide file tree
Showing 10 changed files with 394 additions and 12 deletions.
5 changes: 5 additions & 0 deletions config/SOUE01/splits.txt
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,11 @@ m/m3d/m3d.cpp:
m/m3d/m_anmchr.cpp:
.text start:0x802E48E0 end:0x802E4D98

m/m3d/m_anmtexsrt.cpp:
.text start:0x802E6EC0 end:0x802E7A54
.data start:0x80542598 end:0x805425C8
.sdata2 start:0x8057CD08 end:0x8057CD18

m/m3d/m_anmvis.cpp:
.text start:0x802E7A60 end:0x802E7D48
.data start:0x805425C8 end:0x805425E0
Expand Down
22 changes: 11 additions & 11 deletions config/SOUE01/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17514,8 +17514,8 @@ setRate__Q23m3d11anmTexPat_cFfl = .text:0x802E6E60; // type:function size:0x10
isStop__Q23m3d11anmTexPat_cCFl = .text:0x802E6E70; // type:function size:0x10
getFrameMax__Q23m3d11anmTexPat_cCFl = .text:0x802E6E80; // type:function size:0x14
fn_802E6EA0 = .text:0x802E6EA0; // type:function size:0x14
fn_802E6EC0 = .text:0x802E6EC0; // type:function size:0x8
__dt__Q33m3d11anmTexPat_c7child_cFv = .text:0x802E6ED0; // type:function size:0x58
getType__Q33m3d11anmTexSrt_c7child_cFv = .text:0x802E6EC0; // type:function size:0x8
__dt__Q33m3d11anmTexSrt_c7child_cFv = .text:0x802E6ED0; // type:function size:0x58
heapCost__Q33m3d11anmTexSrt_c7child_cFQ34nw4r3g3d6ResMdlQ34nw4r3g3d12ResAnmTexSrtb = .text:0x802E6F30; // type:function size:0x7C
create__Q33m3d11anmTexSrt_c7child_cFQ34nw4r3g3d6ResMdlQ34nw4r3g3d12ResAnmTexSrtP12mAllocator_cPUl = .text:0x802E6FB0; // type:function size:0x12C
setAnm__Q33m3d11anmTexSrt_c7child_cFRQ23m3d6bmdl_cQ34nw4r3g3d12ResAnmTexSrtQ23m3d10playMode_e = .text:0x802E70E0; // type:function size:0xB4
Expand All @@ -17524,7 +17524,7 @@ setFrmCtrlDefault__Q33m3d11anmTexSrt_c7child_cFRQ34nw4r3g3d12ResAnmTexSrtQ23m3d1
heapCost__Q23m3d11anmTexSrt_cFQ34nw4r3g3d6ResMdlQ34nw4r3g3d12ResAnmTexSrtlb = .text:0x802E7270; // type:function size:0xE0
create__Q23m3d11anmTexSrt_cFQ34nw4r3g3d6ResMdlQ34nw4r3g3d12ResAnmTexSrtP12mAllocator_cPUll = .text:0x802E7350; // type:function size:0x27C
__dt__Q23m3d11anmTexSrt_cFv = .text:0x802E75D0; // type:function size:0x6C
fn_802E7640 = .text:0x802E7640; // type:function size:0x8
getType__Q23m3d11anmTexSrt_cFv = .text:0x802E7640; // type:function size:0x8
remove__Q23m3d11anmTexSrt_cFv = .text:0x802E7650; // type:function size:0xEC
setAnm__Q23m3d11anmTexSrt_cFRQ23m3d6bmdl_cQ34nw4r3g3d12ResAnmTexSrtlQ23m3d10playMode_e = .text:0x802E7740; // type:function size:0x140
play__Q23m3d11anmTexSrt_cFv = .text:0x802E7880; // type:function size:0xAC
Expand All @@ -17533,11 +17533,11 @@ getFrame__Q23m3d11anmTexSrt_cCFl = .text:0x802E7990; // type:function size:0x10
setFrame__Q23m3d11anmTexSrt_cFfl = .text:0x802E79A0; // type:function size:0x10
setRate__Q23m3d11anmTexSrt_cFfl = .text:0x802E79B0; // type:function size:0x10
isStop__Q23m3d11anmTexSrt_cCFl = .text:0x802E79C0; // type:function size:0x10
fn_802E79D0 = .text:0x802E79D0; // type:function size:0x10
checkFrame__Q23m3d11anmTexSrt_cCFfl = .text:0x802E79D0; // type:function size:0x10
setPlayMode__Q23m3d11anmTexSrt_cFQ23m3d10playMode_el = .text:0x802E79E0; // type:function size:0x14
getFrameMax__Q23m3d11anmTexSrt_cCFl = .text:0x802E7A00; // type:function size:0x14
setFrameStart__Q23m3d11anmTexSrt_cFfl = .text:0x802E7A20; // type:function size:0x14
fn_802E7A40 = .text:0x802E7A40; // type:function size:0x14
getFrameStart__Q23m3d11anmTexSrt_cCFl = .text:0x802E7A40; // type:function size:0x14
__dt__Q23m3d8anmVis_cFv = .text:0x802E7A60; // type:function size:0x58
getType__Q23m3d8anmVis_cFv = .text:0x802E7AC0; // type:function size:0x8
create__Q23m3d8anmVis_cFQ34nw4r3g3d6ResMdlQ34nw4r3g3d9ResAnmVisP12mAllocator_cPUl = .text:0x802E7AD0; // type:function size:0x118
Expand Down Expand Up @@ -24561,9 +24561,9 @@ fn_80446910 = .text:0x80446910; // type:function size:0x54
fn_80446970 = .text:0x80446970; // type:function size:0xF4
fn_80446A70 = .text:0x80446A70; // type:function size:0xB8
fn_80446B30 = .text:0x80446B30; // type:function size:0x7C
fn_80446BB0 = .text:0x80446BB0; // type:function size:0x134
Construct__Q34nw4r3g3d20AnmObjTexSrtOverrideFP12MEMAllocatorPUlQ34nw4r3g3d6ResMdli = .text:0x80446BB0; // type:function size:0x134
fn_80446CF0 = .text:0x80446CF0; // type:function size:0xC0
fn_80446DB0 = .text:0x80446DB0; // type:function size:0x1F0
Construct__Q34nw4r3g3d15AnmObjTexSrtResFP12MEMAllocatorPUlQ34nw4r3g3d12ResAnmTexSrtQ34nw4r3g3d6ResMdlb = .text:0x80446DB0; // type:function size:0x1F0
fn_80446FA0 = .text:0x80446FA0; // type:function size:0xC0
fn_80447060 = .text:0x80447060; // type:function size:0x8
fn_80447070 = .text:0x80447070; // type:function size:0xB4
Expand Down Expand Up @@ -29099,8 +29099,8 @@ lbl_804F7130 = .rodata:0x804F7130; // type:object size:0x20
lbl_804F7150 = .rodata:0x804F7150; // type:object size:0x18
lbl_804F7168 = .rodata:0x804F7168; // type:object size:0x18
lbl_804F7180 = .rodata:0x804F7180; // type:object size:0x18
lbl_804F7198 = .rodata:0x804F7198; // type:object size:0x20
lbl_804F71B8 = .rodata:0x804F71B8; // type:object size:0x18
TYPE_NAME__Q34nw4r3g3d20AnmObjTexSrtOverride = .rodata:0x804F7198; // type:object size:0x20
TYPE_NAME__Q34nw4r3g3d15AnmObjTexSrtRes = .rodata:0x804F71B8; // type:object size:0x18
lbl_804F71D0 = .rodata:0x804F71D0; // type:object size:0x10
lbl_804F71E0 = .rodata:0x804F71E0; // type:object size:0x14
lbl_804F71F4 = .rodata:0x804F71F4; // type:object size:0x14
Expand Down Expand Up @@ -35690,8 +35690,8 @@ lbl_80542530 = .data:0x80542530; // type:object size:0x20
lbl_80542550 = .data:0x80542550; // type:object size:0x18
lbl_80542568 = .data:0x80542568; // type:object size:0x18
lbl_80542580 = .data:0x80542580; // type:object size:0x18
lbl_80542598 = .data:0x80542598; // type:object size:0x18
lbl_805425B0 = .data:0x805425B0; // type:object size:0x18
__vt__Q23m3d11anmTexSrt_c = .data:0x80542598; // type:object size:0x18
__vt__Q33m3d11anmTexSrt_c7child_c = .data:0x805425B0; // type:object size:0x18
__vt__Q23m3d8anmVis_c = .data:0x805425C8; // type:object size:0x18
lbl_805425E0 = .data:0x805425E0; // type:object size:0x30
__vt__Q23m3d6banm_c = .data:0x80542610; // type:object size:0x18
Expand Down
1 change: 1 addition & 0 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ def nw4rLib(lib_name, objects, extra_cflags=[]):
Object(Matching, "f/f_manager.cpp"),
Object(NonMatching, "m/m3d/m3d.cpp"),
Object(NonMatching, "m/m3d/m_anmchr.cpp"),
Object(Matching, "m/m3d/m_anmtexsrt.cpp"),
Object(Matching, "m/m3d/m_anmvis.cpp"),
Object(Matching, "m/m3d/m_banm.cpp"),
Object(NonMatching, "m/m3d/m_bmdl.cpp"),
Expand Down
56 changes: 56 additions & 0 deletions include/m/m3d/m_anmtexsrt.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#ifndef M_ANMTEXSRT_H
#define M_ANMTEXSRT_H

#include <m/m3d/m_bmdl.h>
#include <m/m3d/m_fanm.h>
#include <nw4r/g3d/g3d_anmtexsrt.h>

namespace m3d {

class anmTexSrt_c : public banm_c {
class child_c : public fanm_c {
public:
child_c() {}
virtual ~child_c();
virtual int getType() override;

static u32 heapCost(nw4r::g3d::ResMdl, nw4r::g3d::ResAnmTexSrt, bool);
bool create(nw4r::g3d::ResMdl, nw4r::g3d::ResAnmTexSrt, mAllocator_c*, u32*);
void setAnm(m3d::bmdl_c&, nw4r::g3d::ResAnmTexSrt, m3d::playMode_e);
void releaseAnm();
void setFrmCtrlDefault(nw4r::g3d::ResAnmTexSrt&, playMode_e);
};

public:
anmTexSrt_c() {}
virtual ~anmTexSrt_c();

virtual int getType() override;
virtual void remove() override;
virtual void play() override;

bool create(nw4r::g3d::ResMdl, nw4r::g3d::ResAnmTexSrt, mAllocator_c*, u32*, s32);
static u32 heapCost(nw4r::g3d::ResMdl, nw4r::g3d::ResAnmTexSrt, s32, bool);

void setAnm(bmdl_c&, nw4r::g3d::ResAnmTexSrt, s32, playMode_e);

void play(s32);
f32 getFrame(s32) const;
void setFrame(f32, s32);
void setRate(f32, s32);
bool isStop(s32) const;

bool checkFrame(f32, s32) const;

void setPlayMode(playMode_e, s32);
f32 getFrameMax(s32) const;
void setFrameStart(f32, s32);
f32 getFrameStart(s32) const;

private:
child_c *mpChildren;
};

} // namespace m3d

#endif
17 changes: 17 additions & 0 deletions include/m/m3d/m_fanm.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,23 @@ class fanm_c : public banm_c {
bool checkFrame(f32) const;
bool unk_802EAE70() const;

inline void setPlayState(playMode_e state) {
mPlayState = state;
}

inline f32 getEndFrame() {
return mEndFrame;
}

// Something about this is wrong
inline void setStartFrame(f32 f) {
mEndFrame = f;
}

inline f32 getStartFrame() {
return mStartFrame;
}

private:
f32 mEndFrame;
f32 mStartFrame;
Expand Down
70 changes: 70 additions & 0 deletions include/nw4r/g3d/g3d_anmtexsrt.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,81 @@
#ifndef NW4R_G3D_ANMTEXSRT_H
#define NW4R_G3D_ANMTEXSRT_H
#include "nw4r/g3d/g3d_restex.h"
#include "nw4r/g3d/g3d_resanmtexsrt.h"

namespace nw4r
{
namespace g3d
{

class AnmObjTexSrtRes;
struct TexSrtAnmResult;

class AnmObjTexSrt : public AnmObj {
public:
static const G3dObj::TypeObj GetTypeObjStatic() {
return TypeObj(TYPE_NAME);
}

virtual TexSrtAnmResult *GetResult(); // at 0x38
virtual void Attach(s32, AnmObjTexSrtRes *res); // at 0x3C
virtual void Detach(s32); // at 0x40

private:
int mChildrenArraySize;
u16 *mpChildrenArray;

NW4R_G3D_TYPE_OBJ_DECL(AnmObjTexSrt);
};

class AnmObjTexSrtNode : public AnmObjTexSrt {
public:
static const G3dObj::TypeObj GetTypeObjStatic() {
return TypeObj(TYPE_NAME);
}


inline int Size() {
return mNodeArraySize;
}

AnmObjTexSrtRes *GetNode(int i) {
return mpNodes[i];
}

private:
int mNodeArraySize;
AnmObjTexSrtRes **mpNodes;

NW4R_G3D_TYPE_OBJ_DECL(AnmObjTexSrtNode);
};

class AnmObjTexSrtRes : public AnmObjTexSrt, public FrameCtrl {
public:
static const G3dObj::TypeObj GetTypeObjStatic() {
return TypeObj(TYPE_NAME);
}


static AnmObjTexSrtRes *Construct(MEMAllocator*, u32*, ResAnmTexSrt, ResMdl, bool);
private:
ResAnmTexSrt mRes;
TexSrtAnmResult *mpResultCache;

NW4R_G3D_TYPE_OBJ_DECL(AnmObjTexSrtRes);
};

class AnmObjTexSrtOverride : public AnmObjTexSrtNode {
public:
static const G3dObj::TypeObj GetTypeObjStatic() {
return TypeObj(TYPE_NAME);
}

static AnmObjTexSrtOverride *Construct(MEMAllocator*, u32*, ResMdl, int);

NW4R_G3D_TYPE_OBJ_DECL(AnmObjTexSrtOverride);
};

struct TexSrtTypedef
{
enum TexMatrixMode
Expand Down
5 changes: 4 additions & 1 deletion include/nw4r/g3d/g3d_obj.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,10 @@ class G3dObj {

template <typename T>
static T *DynamicCast(G3dObj *obj) {
return (obj != NULL && obj->IsDerivedFrom(T::GetTypeObjStatic())) ? static_cast<T *>(obj) : NULL;
if (obj != nullptr && obj->IsDerivedFrom(T::GetTypeObjStatic())) {
return static_cast<T *>(obj);
}
return nullptr;
}

private:
Expand Down
14 changes: 14 additions & 0 deletions include/nw4r/g3d/g3d_resanmtexsrt.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ namespace nw4r
u32 mRevision; // at 0x8
char UNK_0xC[0x4];
s32 mMatDictOffset; // at 0x10
char UNK_0x14[0x0C];
u16 mNumFrames; // at 0x20
UNKWORD UNK_0x24;
AnmPolicy mAnmPolicy; // at 0x28
};

struct ResAnmTexSrt
Expand Down Expand Up @@ -55,6 +59,16 @@ namespace nw4r
{
return static_cast<const ResAnmTexSrtMatData *>(mAnmTexSrt.ofs_to_obj<ResDic>(ref().mMatDictOffset)[i]);
}

AnmPolicy GetAnmPolicy() const
{
return ref().mAnmPolicy;
}

int GetNumFrame() const
{
return ref().mNumFrames;
}

void GetAnmResult(TexSrtAnmResult *, u32, float) const;
};
Expand Down
Loading

0 comments on commit ebd0c04

Please sign in to comment.