summaryrefslogtreecommitdiff
path: root/include/m/m3d/m_anmmdl.h
blob: d154a3eb3eba60c618a9a9e6c8c544a47f48afa2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#ifndef M3D_M_ANMMDL_H
#define M3D_M_ANMMDL_H

#include "m/m3d/m_anmchr.h"
#include "m/m3d/m_mdl.h"
#include "nw4r/g3d/res/g3d_resfile.h"

namespace m3d {

// Not in NSMBW, name pulled from City Folk
class mdlAnmChr {
public:
    mdlAnmChr() {}
    virtual ~mdlAnmChr(); // 0x08

    virtual void play();                                         // 0x0C
    virtual void setFrame(f32);                                  // 0x10
    virtual bool setAnm(const char *name, playMode_e mode, f32); // 0x14
    virtual bool setAnm(const char *name, playMode_e mode);      // 0x18
    virtual void setRate(f32);                                   // 0x1C

    bool create(
        void *mdlFile, void *anmFile, const char *mdlName, const char *anmName, mAllocator_c *alloc, u32 bufferOption,
        int nView, u32 *pSize
    );
    // Unknown overload
    bool create2(
        void *mdlFile, void *anmFile, const char *mdlName, const char *anmName, mAllocator_c *alloc, u32 bufferOption,
        int nView, u32 *pSize
    );
    bool create(
        void *resFile, const char *mdlName, const char *anmName, mAllocator_c *alloc, u32 bufferOption, int nView,
        u32 *pSize
    );
    bool create(
        void *mdlFile, void *anmFile, const char *mdlName, const char *anmName, mdl_c::mdlCallback_c *callback,
        mAllocator_c *alloc, u32 bufferOption, int nView, u32 *pSize
    );

    inline bool create(void *resFile, const char *mdlName, const char *anmName, mAllocator_c *alloc, u32 bufferOption) {
        return create(resFile, mdlName, anmName, alloc, bufferOption, 1, nullptr);
    }

    inline mdl_c &getModel() {
        return mMdl;
    }

    inline const mdl_c &getModel() const {
        return mMdl;
    }

    inline anmChr_c &getAnm() {
        return mAnm;
    }

    inline const anmChr_c &getAnm() const {
        return mAnm;
    }

    void setAnmFile(void *data) {
        mAnmFile = nw4r::g3d::ResFile(data);
    }
    nw4r::g3d::ResFile &getAnmFile() {
        return mAnmFile;
    }

    nw4r::g3d::ResFile &getMdlFile() {
        return mMdlFile;
    }

protected:
    nw4r::g3d::ResFile mMdlFile;
    nw4r::g3d::ResFile mAnmFile;

    mdl_c mMdl;
    anmChr_c mAnm;
};

} // namespace m3d

#endif