Skip to content

Commit

Permalink
m_anmChrBlend OK
Browse files Browse the repository at this point in the history
  • Loading branch information
robojumper committed Jun 21, 2024
1 parent 66fec2e commit 9f9370c
Show file tree
Hide file tree
Showing 6 changed files with 105 additions and 14 deletions.
4 changes: 4 additions & 0 deletions config/SOUE01/splits.txt
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,10 @@ m/m3d/m_anmchr.cpp:
.data start:0x805424D0 end:0x805424E8
.sdata2 start:0x8057CCC0 end:0x8057CCD0

m/m3d/m_anmchrblend.cpp:
.text start:0x802E4DA0 end:0x802E5260
.data start:0x805424E8 end:0x80542500

m/m3d/m_anmtexsrt.cpp:
.text start:0x802E6EC0 end:0x802E7A54
.data start:0x80542598 end:0x805425C8
Expand Down
22 changes: 11 additions & 11 deletions config/SOUE01/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17446,14 +17446,14 @@ create__Q23m3d8anmChr_cFQ34nw4r3g3d6ResMdlQ34nw4r3g3d9ResAnmChrP12mAllocator_cPU
setAnm__Q23m3d8anmChr_cFRQ23m3d6bmdl_cQ34nw4r3g3d9ResAnmChrQ23m3d10playMode_e = .text:0x802E4A70; // type:function size:0x84
setAnmAfter__Q23m3d8anmChr_cFRQ23m3d6bmdl_cQ34nw4r3g3d9ResAnmChrQ23m3d10playMode_e = .text:0x802E4B00; // type:function size:0x22C
setFrmCtrlDefault__Q23m3d8anmChr_cFRQ34nw4r3g3d9ResAnmChrQ23m3d10playMode_e = .text:0x802E4D30; // type:function size:0x68
fn_802E4DA0 = .text:0x802E4DA0; // type:function size:0x58
fn_802E4E00 = .text:0x802E4E00; // type:function size:0x8
fn_802E4E10 = .text:0x802E4E10; // type:function size:0xB8
fn_802E4ED0 = .text:0x802E4ED0; // type:function size:0xD8
fn_802E4FB0 = .text:0x802E4FB0; // type:function size:0xB4
fn_802E5070 = .text:0x802E5070; // type:function size:0xA0
fn_802E5110 = .text:0x802E5110; // type:function size:0xB0
fn_802E51C0 = .text:0x802E51C0; // type:function size:0xA0
__dt__Q23m3d13anmChrBlend_cFv = .text:0x802E4DA0; // type:function size:0x58
getType__Q23m3d13anmChrBlend_cFv = .text:0x802E4E00; // type:function size:0x8
create__Q23m3d13anmChrBlend_cFQ34nw4r3g3d6ResMdliP12mAllocator_cPUl = .text:0x802E4E10; // type:function size:0xB8
attach__Q23m3d13anmChrBlend_cFiPQ34nw4r3g3d12AnmObjChrResf = .text:0x802E4ED0; // type:function size:0xD8
attach__Q23m3d13anmChrBlend_cFiPQ23m3d8anmChr_cf = .text:0x802E4FB0; // type:function size:0xB4
detach__Q23m3d13anmChrBlend_cFi = .text:0x802E5070; // type:function size:0xA0
setWeight__Q23m3d13anmChrBlend_cFif = .text:0x802E5110; // type:function size:0xB0
getWeight__Q23m3d13anmChrBlend_cCFi = .text:0x802E51C0; // type:function size:0xA0
fn_802E5260 = .text:0x802E5260; // type:function size:0x58
fn_802E52C0 = .text:0x802E52C0; // type:function size:0x8
fn_802E52D0 = .text:0x802E52D0; // type:function size:0x7C
Expand Down Expand Up @@ -24609,7 +24609,7 @@ fn_804480C0 = .text:0x804480C0; // type:function size:0x104
fn_804481D0 = .text:0x804481D0; // type:function size:0xB8
fn_80448290 = .text:0x80448290; // type:function size:0x148
fn_804483E0 = .text:0x804483E0; // type:function size:0x7C
fn_80448460 = .text:0x80448460; // type:function size:0x178
Construct__Q34nw4r3g3d14AnmObjChrBlendFP12MEMAllocatorPUlQ34nw4r3g3d6ResMdli = .text:0x80448460; // type:function size:0x178
fn_804485E0 = .text:0x804485E0; // type:function size:0x640
fn_80448C20 = .text:0x80448C20; // type:function size:0x10
fn_80448C30 = .text:0x80448C30; // type:function size:0x10
Expand Down Expand Up @@ -29103,7 +29103,7 @@ TYPE_NAME__Q34nw4r3g3d20AnmObjTexSrtOverride = .rodata:0x804F7198; // type:objec
TYPE_NAME__Q34nw4r3g3d15AnmObjTexSrtRes = .rodata:0x804F71B8; // type:object size:0x18
lbl_804F71D0 = .rodata:0x804F71D0; // type:object size:0x10
TYPE_NAME__Q34nw4r3g3d13AnmObjChrNode = .rodata:0x804F71E0; // type:object size:0x14
lbl_804F71F4 = .rodata:0x804F71F4; // type:object size:0x14
TYPE_NAME__Q34nw4r3g3d14AnmObjChrBlend = .rodata:0x804F71F4; // type:object size:0x14
TYPE_NAME__Q34nw4r3g3d12AnmObjChrRes = .rodata:0x804F7208; // type:object size:0x18
lbl_804F7220 = .rodata:0x804F7220; // type:object size:0x10
lbl_804F7230 = .rodata:0x804F7230; // type:object size:0x18
Expand Down Expand Up @@ -35683,7 +35683,7 @@ lbl_80542448 = .data:0x80542448; // type:object size:0x18
lbl_80542460 = .data:0x80542460; // type:object size:0x40
lbl_805424A0 = .data:0x805424A0; // type:object size:0x30
__vt__Q23m3d8anmChr_c = .data:0x805424D0; // type:object size:0x18
lbl_805424E8 = .data:0x805424E8; // type:object size:0x18
__vt__Q23m3d13anmChrBlend_c = .data:0x805424E8; // type:object size:0x18
lbl_80542500 = .data:0x80542500; // type:object size:0x18
lbl_80542518 = .data:0x80542518; // type:object size:0x18
lbl_80542530 = .data:0x80542530; // type:object size:0x20
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(Matching, "m/m3d/m_anmchr.cpp"),
Object(Matching, "m/m3d/m_anmchrblend.cpp"),
Object(Matching, "m/m3d/m_anmtexsrt.cpp"),
Object(Matching, "m/m3d/m_anmvis.cpp"),
Object(Matching, "m/m3d/m_banm.cpp"),
Expand Down
28 changes: 28 additions & 0 deletions include/m/m3d/m_anmchrblend.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#ifndef M3D_M_ANMCHRBLEND_H
#define M3D_M_ANMCHRBLEND_H

#include <m/m3d/m_anmchr.h>
#include <m/m3d/m_banm.h>
#include <m/m3d/m_bmdl.h>
#include <nw4r/g3d/g3d_anmchr.h>

namespace m3d {

class anmChrBlend_c : public banm_c {
public:
virtual ~anmChrBlend_c();

virtual int getType() override;

bool create(nw4r::g3d::ResMdl, int, mAllocator_c *, u32 *);
bool attach(int, nw4r::g3d::AnmObjChrRes *, f32);
bool attach(int, anmChr_c *, f32);
void detach(int);
// Not in NSMBW
void setWeight(int, f32);
f32 getWeight(int) const;
};

} // namespace m3d

#endif
8 changes: 5 additions & 3 deletions include/nw4r/g3d/g3d_anmchr.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,23 +63,25 @@ class AnmObjChrNode : public AnmObjChr {
NW4R_G3D_TYPE_OBJ_DECL(AnmObjChrNode);
};

struct AnmObjChrBlend : public AnmObjChrNode {
class AnmObjChrBlend : public AnmObjChrNode {
public:
static const TypeObj GetTypeObjStatic() {
return TypeObj(TYPE_NAME);
}

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

protected:
NW4R_G3D_TYPE_OBJ_DECL(AnmObjChrBlend);
};

struct AnmObjChrRes : public AnmObjChr, public FrameCtrl {
class AnmObjChrRes : public AnmObjChr, public FrameCtrl {
public:
static const TypeObj GetTypeObjStatic() {
return TypeObj(TYPE_NAME);
}

static AnmObjChrRes *Construct(MEMAllocator*, u32*, nw4r::g3d::ResAnmChr, nw4r::g3d::ResMdl, bool);
static AnmObjChrRes *Construct(MEMAllocator*, u32*, ResAnmChr, ResMdl, bool);

protected:
NW4R_G3D_TYPE_OBJ_DECL(AnmObjChrRes);
Expand Down
56 changes: 56 additions & 0 deletions src/m/m3d/m_anmchrblend.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#include <m/m3d/m3d.h>
#include <m/m3d/m_anmchrblend.h>
#include <nw4r/g3d/g3d_anmchr.h>
#include <nw4r/g3d/g3d_resanmchr.h>

namespace m3d {

anmChrBlend_c::~anmChrBlend_c() {}

int anmChrBlend_c::getType() {
return 0;
}

bool anmChrBlend_c::create(nw4r::g3d::ResMdl mdl, int num, mAllocator_c *alloc, u32 *pSize) {
if (alloc == nullptr) {
alloc = internal::l_allocator_p;
}

u32 size;
if (pSize == nullptr) {
pSize = &size;
}

nw4r::g3d::AnmObjChrBlend::Construct(nullptr, pSize, mdl, num);
if (!createAllocator(alloc, pSize)) {
return false;
}

mpAnmObj = nw4r::g3d::AnmObjChrBlend::Construct(&mAllocator, &size, mdl, num);
return true;
}

bool anmChrBlend_c::attach(int idx, nw4r::g3d::AnmObjChrRes *anm, f32 weight) {
nw4r::g3d::AnmObjChrBlend *obj = nw4r::g3d::G3dObj::DynamicCast<nw4r::g3d::AnmObjChrBlend>(mpAnmObj);
obj->SetWeight(idx, weight);
obj->Attach(idx, anm);
}

bool anmChrBlend_c::attach(int idx, anmChr_c *anm, f32 weight) {
nw4r::g3d::AnmObjChrRes *res = nw4r::g3d::G3dObj::DynamicCast<nw4r::g3d::AnmObjChrRes>(anm->getAnimObj());
attach(idx, res, weight);
}

void anmChrBlend_c::detach(int idx) {
nw4r::g3d::G3dObj::DynamicCast<nw4r::g3d::AnmObjChrBlend>(mpAnmObj)->Detach(idx);
}

void anmChrBlend_c::setWeight(int idx, f32 weight) {
nw4r::g3d::G3dObj::DynamicCast<nw4r::g3d::AnmObjChrBlend>(mpAnmObj)->SetWeight(idx, weight);
}

f32 anmChrBlend_c::getWeight(int idx) const {
nw4r::g3d::G3dObj::DynamicCast<nw4r::g3d::AnmObjChrBlend>(mpAnmObj)->GetWeight(idx);
}

} // namespace m3d

0 comments on commit 9f9370c

Please sign in to comment.