Skip to content

Commit

Permalink
d_a_obj_megami_island OK
Browse files Browse the repository at this point in the history
  • Loading branch information
robojumper committed Oct 26, 2024
1 parent 361fed8 commit d52ca8f
Show file tree
Hide file tree
Showing 6 changed files with 159 additions and 18 deletions.
2 changes: 2 additions & 0 deletions config/SOUE01/rels/d_a_obj_megami_islandNP/splits.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ REL/executor.c:

REL/d/a/obj/d_a_obj_megami_island.cpp:
.text start:0x00000070 end:0x000005FC
.rodata start:0x00000000 end:0x00000048
.data start:0x00000000 end:0x00000150
34 changes: 17 additions & 17 deletions config/SOUE01/rels/d_a_obj_megami_islandNP/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@ _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
dAcOmegamiIsland_c_classInit__Fv = .text:0x00000070; // type:function size:0xB0
AcOmegamiIsland__initModels = .text:0x00000120; // type:function size:0x204
AcOmegamiIsland__init = .text:0x00000330; // type:function size:0x11C
AcOmegamiIsland__destroy = .text:0x00000450; // type:function size:0x38
AcOmegamiIsland__update = .text:0x00000490; // type:function size:0x30
AcOmegamiIsland__draw = .text:0x000004C0; // type:function size:0x60
AcOmegamiIsland__hasGoddessStatueFallen = .text:0x00000520; // type:function size:0x48
createHeap__18dAcOmegamiIsland_cFv = .text:0x00000120; // type:function size:0x204
create__18dAcOmegamiIsland_cFv = .text:0x00000330; // type:function size:0x11C
doDelete__18dAcOmegamiIsland_cFv = .text:0x00000450; // type:function size:0x38
actorExecute__18dAcOmegamiIsland_cFv = .text:0x00000490; // type:function size:0x30
draw__18dAcOmegamiIsland_cFv = .text:0x000004C0; // type:function size:0x60
hasGoddessStatueFallen__18dAcOmegamiIsland_cFv = .text:0x00000520; // type:function size:0x48
__dt__18dAcOmegamiIsland_cFv = .text:0x00000570; // type:function size:0x8C
_ctors = .ctors:0x00000000; // type:label scope:global
_dtors = .dtors:0x00000000; // type:label scope:global
lbl_397_rodata_0 = .rodata:0x00000000; // type:object size:0x48 data:float
lbl_397_data_0 = .data:0x00000000; // type:object size:0x10
lbl_397_data_10 = .data:0x00000010; // type:object size:0x10 data:string
lbl_397_data_20 = .data:0x00000020; // type:object size:0x10
lbl_397_data_30 = .data:0x00000030; // type:object size:0x14
lbl_397_data_44 = .data:0x00000044; // type:object size:0x14 data:string
lbl_397_data_58 = .data:0x00000058; // type:object size:0x18 data:string
lbl_397_data_70 = .data:0x00000070; // type:object size:0x18
lbl_397_data_88 = .data:0x00000088; // type:object size:0x18 data:string
lbl_397_rodata_0 = .rodata:0x00000000; // type:object size:0x48 scope:local data:float
lbl_397_data_0 = .data:0x00000000; // type:object size:0x10 scope:local
lbl_397_data_10 = .data:0x00000010; // type:object size:0x10 scope:local data:string
lbl_397_data_20 = .data:0x00000020; // type:object size:0x10 scope:local
lbl_397_data_30 = .data:0x00000030; // type:object size:0x14 scope:local
lbl_397_data_44 = .data:0x00000044; // type:object size:0x14 scope:local data:string
lbl_397_data_58 = .data:0x00000058; // type:object size:0x18 scope:local data:string
lbl_397_data_70 = .data:0x00000070; // type:object size:0x18 scope:local
lbl_397_data_88 = .data:0x00000088; // type:object size:0x18 scope:local data:string
g_profile_OBJ_MEGAMI_ISLAND = .data:0x000000A0; // type:object size:0x10
lbl_397_data_B0 = .data:0x000000B0; // type:object size:0x20 data:string
lbl_397_data_D0 = .data:0x000000D0; // type:object size:0x80
lbl_397_data_B0 = .data:0x000000B0; // type:object size:0x20 scope:local data:string
__vt__18dAcOmegamiIsland_c = .data:0x000000D0; // type:object size:0x80
2 changes: 1 addition & 1 deletion configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1473,7 +1473,7 @@ def nw4rLib(lib_name, objects, extra_cflags=[]):
Rel(NonMatching, "d_a_obj_lotus_flower", "REL/d/a/obj/d_a_obj_lotus_flower.cpp"),
Rel(NonMatching, "d_a_obj_lotus_seed", "REL/d/a/obj/d_a_obj_lotus_seed.cpp"),
Rel(NonMatching, "d_a_obj_mapparts", "REL/d/a/obj/d_a_obj_mapparts.cpp"),
Rel(NonMatching, "d_a_obj_megami_island", "REL/d/a/obj/d_a_obj_megami_island.cpp"),
Rel(Matching, "d_a_obj_megami_island", "REL/d/a/obj/d_a_obj_megami_island.cpp"),
Rel(NonMatching, "d_a_obj_mg_pumpkin", "REL/d/a/obj/d_a_obj_mg_pumpkin.cpp"),
Rel(NonMatching, "d_a_obj_mole_cover", "REL/d/a/obj/d_a_obj_mole_cover.cpp"),
Rel(Matching, "d_a_obj_mole_soil", "REL/d/a/obj/d_a_obj_mole_soil.cpp"),
Expand Down
20 changes: 20 additions & 0 deletions include/d/a/obj/d_a_obj_megami_island.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,33 @@
#define D_A_OBJ_MEGAMI_ISLAND_H

#include "d/a/obj/d_a_obj_base.h"
#include "d/col/bg/d_bg_w.h"
#include "m/m3d/m_anmtexsrt.h"
#include "m/m3d/m_smdl.h"
#include "nw4r/g3d/g3d_resfile.h"

class dAcOmegamiIsland_c : public dAcObjBase_c {
public:
dAcOmegamiIsland_c() {}
virtual ~dAcOmegamiIsland_c() {}

bool createHeap() override;
int create() override;
int doDelete() override;
int actorExecute() override;
int draw() override;

private:
bool hasGoddessStatueFallen();
inline u8 getVariant() const {
return params & 3;
}

/* 0x330 */ nw4r::g3d::ResFile mRes;
/* 0x334 */ m3d::smdl_c mMdls[2];
/* 0x36C */ dBgW mBgW;
/* 0x57C */ m3d::anmTexSrt_c mAnm;
/* 0x5A8 */ u8 mVariant;
};

#endif
4 changes: 4 additions & 0 deletions include/d/col/bg/d_bg_w_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@ class dBgW_Base : public cBgW_BgId {
field_0x24 |= 2;
}

void OnStick0x20() {
field_0x24 |= 0x20;
}

cPartition &GetPartition() {
return mPartitionInfo;
}
Expand Down
115 changes: 115 additions & 0 deletions src/REL/d/a/obj/d_a_obj_megami_island.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,118 @@
#include "d/a/obj/d_a_obj_megami_island.h"

#include "common.h"
#include "d/a/obj/d_a_obj_base.h"
#include "d/col/bg/d_bg_s.h"
#include "d/flag/storyflag_manager.h"
#include "f/f_base.h"
#include "m/m_vec.h"
#include "nw4r/g3d/g3d_resanmtexsrt.h"
#include "nw4r/g3d/g3d_resmdl.h"
#include "toBeSorted/room_manager.h"

static const char *const sResFiles[] = {
"F000Megami",
"F000LastDungeon",
};

static const char *const sMdl1[] = {
"F000Megami",
"F000LastDungeon",
};

static const char *const sMdl2[] = {
"F000Megami_s",
"F000LastDungeon_s",
};

static const char *const sDzb[] = {
"dzb/F000Meagami.dzb",
"dzb/F000LastDungeon.dzb",
};

static const char *const sPlc[] = {
"dat/F000Meagami.plc",
"dat/F000LastDungeon.plc",
};

static const char *const sAnm[] = {
"F000Megami",
"F000LastDungeon",
};

SPECIAL_ACTOR_PROFILE(OBJ_MEGAMI_ISLAND, dAcOmegamiIsland_c, fProfile::OBJ_MEGAMI_ISLAND, 0x1F3, 0, 2);

bool dAcOmegamiIsland_c::createHeap() {
mVariant = getVariant();

mRes = getOarcResFile(sResFiles[mVariant]);
RoomManager::bindStageResToFile(&mRes);
RoomManager::bindSkyCmnToResFile(&mRes);

nw4r::g3d::ResMdl mdl1 = mRes.GetResMdl(sMdl1[mVariant]);
TRY_CREATE(mMdls[0].create(mdl1, &heap_allocator, 0x120));

nw4r::g3d::ResAnmTexSrt anm = mRes.GetResAnmTexSrt(sAnm[mVariant]);
TRY_CREATE(mAnm.create(mdl1, anm, &heap_allocator, nullptr, 1));

nw4r::g3d::ResMdl mdl2 = mRes.GetResMdl(sMdl2[mVariant]);
TRY_CREATE(mMdls[1].create(mdl2, &heap_allocator, 0x120));

void *dzb = getOarcFile(sResFiles[mVariant], sDzb[mVariant]);
void *plc = getOarcFile(sResFiles[mVariant], sPlc[mVariant]);

updateMatrix();
for (int i = 0; i < 2; i++) {
mMdls[i].setLocalMtx(mWorldMtx);
}

TRY_CREATE(!mBgW.Set((cBgD_t *)dzb, (PLC *)plc, cBgW::MOVE_BG_e, &mWorldMtx, &mScale));
mBgW.Lock();

if (mVariant == 0) {
mBgW.OnStick0x20();
}

return (BOOL)mBgW.InitMapStuff(&heap_allocator);
}

int dAcOmegamiIsland_c::create() {
if (hasGoddessStatueFallen()) {
return FAILED;
}

CREATE_ALLOCATOR(dAcOmegamiIsland_c);

dBgS::GetInstance()->Regist(&mBgW, this);
dBgS::GetInstance()->RegistBg(&mBgW, this);
mMdls[0].setAnm(mAnm);

mMdls[0].setPriorityDraw(0x1C, 9);
mMdls[1].setPriorityDraw(0x22, 9);

boundingBox.Set(mVec3_c(-5000.0f, -5000.0f, -23000.0f), mVec3_c(5000.0f, 10000.0f, -9000.0f));
mCullingDistance = 500000.0f;

return SUCCEEDED;
}

int dAcOmegamiIsland_c::doDelete() {
dBgS::GetInstance()->UnRegist(&mBgW);
return SUCCEEDED;
}

int dAcOmegamiIsland_c::actorExecute() {
mAnm.play();
return SUCCEEDED;
}

int dAcOmegamiIsland_c::draw() {
for (int i = 0; i < 2; i++) {
drawModelType1(&mMdls[i]);
}
return SUCCEEDED;
}

bool dAcOmegamiIsland_c::hasGoddessStatueFallen() {
return StoryflagManager::sInstance->getCounterOrFlag(0x11);
}

0 comments on commit d52ca8f

Please sign in to comment.