d_a_obj_F400_gate_seal OK

This commit is contained in:
Swekka
2025-05-28 17:00:52 +02:00
parent 8b37860343
commit 3aab2a210d
6 changed files with 137 additions and 11 deletions
@@ -2,16 +2,16 @@ _prolog = .text:0x00000000; // type:function size:0x2C scope:global
_epilog = .text:0x00000030; // type:function size:0x2C scope:global
_unresolved = .text:0x00000060; // type:function size:0x4 scope:global
dAcOF400GateSeal_c_classInit__Fv = .text:0x00000070; // type:function size:0x98
AcOF400GateSeal__initModels = .text:0x00000110; // type:function size:0x11C
fn_629_230 = .text:0x00000230; // type:function size:0x8
AcOF400GateSeal__init = .text:0x00000240; // type:function size:0x1A4
fn_629_3F0 = .text:0x000003F0; // type:function size:0xD8
AcOF400GateSeal__draw = .text:0x000004D0; // type:function size:0x28
createHeap__18dAcOF400GateSeal_cFv = .text:0x00000110; // type:function size:0x11C
actorCreate__18dAcOF400GateSeal_cFv = .text:0x00000230; // type:function size:0x8
actorPostCreate__18dAcOF400GateSeal_cFv = .text:0x00000240; // type:function size:0x1A4
actorExecute__18dAcOF400GateSeal_cFv = .text:0x000003F0; // type:function size:0xD8
draw__18dAcOF400GateSeal_cFv = .text:0x000004D0; // type:function size:0x28
__dt__18dAcOF400GateSeal_cFv = .text:0x00000500; // type:function size:0x84
_ctors = .ctors:0x00000000; // type:label scope:global
_dtors = .dtors:0x00000000; // type:label scope:global
lbl_629_rodata_0 = .rodata:0x00000000; // type:object size:0x4 data:float
lbl_629_rodata_0 = .rodata:0x00000000; // type:object size:0x4 scope:local data:float
g_profile_OBJ_F400_GATE_SEAL = .data:0x00000000; // type:object size:0x10
lbl_629_data_10 = .data:0x00000010; // type:object size:0x10
lbl_629_data_20 = .data:0x00000020; // type:object size:0x20 data:string
AcOF400GateSeal__vtable = .data:0x00000040; // type:object size:0x80
lbl_629_data_10 = .data:0x00000010; // type:object size:0x10 scope:local
lbl_629_data_20 = .data:0x00000020; // type:object size:0x20 scope:local data:string
__vt__18dAcOF400GateSeal_c = .data:0x00000040; // type:object size:0x80
@@ -20,7 +20,7 @@ fn_572_1250 = .text:0x00001250; // type:function size:0x16C4
fn_572_2920 = .text:0x00002920; // type:function size:0x1C
AcODoor__update = .text:0x00002940; // type:function size:0x808
fn_572_3150 = .text:0x00003150; // type:function size:0x98
AcODoor__isLocked = .text:0x000031F0; // type:function size:0x158
isLocked__10dAcOdoor_cFv = .text:0x000031F0; // type:function size:0x158
fn_572_3350 = .text:0x00003350; // type:function size:0x84
fn_572_33E0 = .text:0x000033E0; // type:function size:0xC
fn_572_33F0 = .text:0x000033F0; // type:function size:0x78
+1 -1
View File
@@ -2047,7 +2047,7 @@ config.libs = [
NonMatching, "d_a_obj_F400_gate_leaf", "REL/d/a/obj/d_a_obj_F400_gate_leaf.cpp"
),
Rel(
NonMatching, "d_a_obj_F400_gate_seal", "REL/d/a/obj/d_a_obj_F400_gate_seal.cpp"
Matching, "d_a_obj_F400_gate_seal", "REL/d/a/obj/d_a_obj_F400_gate_seal.cpp"
),
Rel(NonMatching, "d_a_obj_farmland", "REL/d/a/obj/d_a_obj_farmland.cpp"),
Rel(NonMatching, "d_a_obj_fence", "REL/d/a/obj/d_a_obj_fence.cpp"),
+12
View File
@@ -2,13 +2,25 @@
#define D_A_OBJ_F400_GATE_SEAL_H
#include "d/a/obj/d_a_obj_base.h"
#include "d/a/obj/d_a_obj_door.h"
#include "m/m3d/m_anmmatclr.h"
#include "m/m3d/m_smdl.h"
class dAcOF400GateSeal_c : public dAcObjBase_c {
public:
dAcOF400GateSeal_c() {}
virtual ~dAcOF400GateSeal_c() {}
virtual bool createHeap() override;
virtual int actorCreate() override;
virtual int actorPostCreate() override;
virtual int actorExecute() override;
virtual int draw() override;
private:
/* 0x330 */ m3d::smdl_c mMdl;
/* 0x34C */ m3d::anmMatClr_c mAnmClr;
/* 0x378 */ dAcRef_c<dAcOdoor_c> mDoor;
};
#endif
+2
View File
@@ -8,6 +8,8 @@ public:
dAcOdoor_c() {}
virtual ~dAcOdoor_c() {}
bool isLocked();
private:
};
+112
View File
@@ -1,3 +1,115 @@
#include "d/a/obj/d_a_obj_F400_gate_seal.h"
#include "common.h"
#include "d/a/obj/d_a_obj_base.h"
#include "d/a/obj/d_a_obj_door.h"
#include "f/f_base.h"
#include "f/f_profile_name.h"
#include "m/m3d/m_anmmatclr.h"
#include "nw4r/g3d/res/g3d_resanmclr.h"
#include "nw4r/g3d/res/g3d_resfile.h"
#include "nw4r/g3d/res/g3d_resmdl.h"
#include "rvl/MTX/vec.h"
SPECIAL_ACTOR_PROFILE(OBJ_F400_GATE_SEAL, dAcOF400GateSeal_c, fProfile::OBJ_F400_GATE_SEAL, 0x287, 0, 6);
bool dAcOF400GateSeal_c::createHeap() {
void *data = dAcObjBase_c::getOarcResFile("F400GateSeal");
if (data == nullptr) {
return false;
}
nw4r::g3d::ResFile resFile(data);
if (!resFile.IsValid()) {
return false;
}
nw4r::g3d::ResMdl mdl = resFile.GetResMdl("F400GateSeal");
if (!mdl.IsValid()) {
return false;
}
if (!mMdl.create(mdl, &heap_allocator, 0)) {
return false;
}
nw4r::g3d::ResAnmClr anmClr = resFile.GetResAnmClr("F400GateSeal");
if (!anmClr.IsValid()) {
return false;
}
if (!mAnmClr.create(mdl, anmClr, &heap_allocator, 0, 1)) {
return false;
}
return mMdl.setAnm(mAnmClr);
}
int dAcOF400GateSeal_c::actorCreate() {
return SUCCEEDED;
}
int dAcOF400GateSeal_c::actorPostCreate() {
bool notDone = true;
dAcOdoor_c *parent = (dAcOdoor_c *)fManager_c::searchBaseByProfName(fProfile::OBJ_DOOR, nullptr);
dAcOdoor_c *door;
while (notDone && parent != nullptr) {
if (10000.0f < PSVECSquareDistance(position, parent->position)) {
parent = (dAcOdoor_c *)fManager_c::searchBaseByProfName(fProfile::OBJ_DOOR, parent);
door = parent;
} else {
notDone = false;
}
}
if (notDone) {
return FAILED;
}
mDoor.link(door);
CREATE_ALLOCATOR(dAcOF400GateSeal_c);
if (mDoor.get() == nullptr) {
return FAILED;
}
if (mDoor.get()->isLocked()) {
mAnmClr.setFrame(mAnmClr.getFrameStart(0), 0);
} else {
mAnmClr.setFrame(mAnmClr.getFrameMax(0), 0);
}
mMdl.setPriorityDraw(0x1C, 9);
updateMatrix();
mMdl.setLocalMtx(mWorldMtx);
mVec3_c min, max;
mMdl.getBounds(&min, &max);
boundingBox.Set(min, max);
return SUCCEEDED;
}
int dAcOF400GateSeal_c::actorExecute() {
if (mDoor.get() == nullptr) {
return SUCCEEDED;
}
if (mDoor.get()->isLocked()) {
f32 frame = mAnmClr.getFrameStart(0);
mAnmClr.setFrame(frame, 0);
} else {
if (checkObjectProperty(2)) {
f32 frame = mAnmClr.getFrameMax(0);
mAnmClr.setFrame(frame, 0);
} else {
mAnmClr.play();
}
}
if (mAnmClr.isStop(0)) {
setObjectProperty(0x200);
} else {
clearObjectProperty(0x200);
}
return SUCCEEDED;
}
int dAcOF400GateSeal_c::draw() {
dAcObjBase_c::drawModelType1(&mMdl);
return SUCCEEDED;
}