Skip to content

Commit

Permalink
d_t_time_area_check OK (and some dTimeAreaMgr)
Browse files Browse the repository at this point in the history
  • Loading branch information
robojumper committed Sep 14, 2024
1 parent 4438a39 commit ad57f22
Show file tree
Hide file tree
Showing 11 changed files with 209 additions and 25 deletions.
2 changes: 2 additions & 0 deletions config/SOUE01/rels/d_t_time_area_checkNP/splits.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ REL/executor.c:

REL/d/t/d_t_time_area_check.cpp:
.text start:0x00000070 end:0x0000030C
.rodata start:0x00000000 end:0x00000008
.data start:0x00000000 end:0x00000084
20 changes: 10 additions & 10 deletions config/SOUE01/rels/d_t_time_area_checkNP/symbols.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
_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
fn_597_70 = .text:0x00000070; // type:function size:0x4C
fn_597_C0 = .text:0x000000C0; // type:function size:0x18
fn_597_E0 = .text:0x000000E0; // type:function size:0x8
fn_597_F0 = .text:0x000000F0; // type:function size:0x1AC
fn_597_2A0 = .text:0x000002A0; // type:function size:0x8
fn_597_2B0 = .text:0x000002B0; // type:function size:0x5C
dTgTimeAreaCheck_c_classInit__Fv = .text:0x00000070; // type:function size:0x4C
create__18dTgTimeAreaCheck_cFv = .text:0x000000C0; // type:function size:0x18
doDelete__18dTgTimeAreaCheck_cFv = .text:0x000000E0; // type:function size:0x8
actorExecute__18dTgTimeAreaCheck_cFv = .text:0x000000F0; // type:function size:0x1AC
draw__18dTgTimeAreaCheck_cFv = .text:0x000002A0; // type:function size:0x8
__dt__18dTgTimeAreaCheck_cFv = .text:0x000002B0; // type:function size:0x5C
_ctors = .ctors:0x00000000; // type:label scope:global
_dtors = .dtors:0x00000000; // type:label scope:global
lbl_597_rodata_0 = .rodata:0x00000000; // type:object size:0x4 data:float
lbl_597_rodata_4 = .rodata:0x00000004; // type:object size:0x4 data:float
lbl_597_data_0 = .data:0x00000000; // type:object size:0x10
lbl_597_data_10 = .data:0x00000010; // type:object size:0x74
lbl_597_rodata_0 = .rodata:0x00000000; // type:object size:0x4 scope:local data:float
lbl_597_rodata_4 = .rodata:0x00000004; // type:object size:0x4 scope:local data:float
g_profile_TAG_TIME_AREA_CHECK = .data:0x00000000; // type:object size:0x10
__vt__18dTgTimeAreaCheck_c = .data:0x00000010; // type:object size:0x74
3 changes: 3 additions & 0 deletions config/SOUE01/splits.txt
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ toBeSorted/dowsing_target.cpp:
.sdata2 start:0x80579640 end:0x80579670
.bss start:0x805A2FB0 end:0x805A3010

toBeSorted/time_area_mgr.cpp:
.text start:0x800B9280 end:0x800BB2A0

toBeSorted/sceneflag_manager.cpp:
.text start:0x800BD8C0 end:0x800BE7A8
.sbss start:0x805753E0 end:0x805753F0
Expand Down
26 changes: 13 additions & 13 deletions config/SOUE01/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3962,18 +3962,18 @@ fn_800B8B40 = .text:0x800B8B40; // type:function size:0x4C
fn_800B8B90 = .text:0x800B8B90; // type:function size:0x4C
fn_800B8BE0 = .text:0x800B8BE0; // type:function size:0x34
fn_800B8C20 = .text:0x800B8C20; // type:function size:0x654
fn_800B9280 = .text:0x800B9280; // type:function size:0xF0
fn_800B9370 = .text:0x800B9370; // type:function size:0x58
fn_800B93D0 = .text:0x800B93D0; // type:function size:0x58
fn_800B9430 = .text:0x800B9430; // type:function size:0x84
fn_800B94C0 = .text:0x800B94C0; // type:function size:0xA0
__ct__14dTimeAreaMgr_cFv = .text:0x800B9280; // type:function size:0xF0
__dt__19dTimeAreaMgrProcA_cFv = .text:0x800B9370; // type:function size:0x58
__dt__19dTimeAreaMgrProcB_cFv = .text:0x800B93D0; // type:function size:0x58
__dt__14dTimeAreaMgr_cFv = .text:0x800B9430; // type:function size:0x84
init__14dTimeAreaMgr_cFv = .text:0x800B94C0; // type:function size:0xA0
fn_800B9560 = .text:0x800B9560; // type:function size:0x1BC
fn_800B9720 = .text:0x800B9720; // type:function size:0x6C
draw__14dTimeAreaMgr_cFv = .text:0x800B9720; // type:function size:0x6C
fn_800B9790 = .text:0x800B9790; // type:function size:0x58
fn_800B97F0 = .text:0x800B97F0; // type:function size:0x88
fn_800B9880 = .text:0x800B9880; // type:function size:0xFC
fn_800B9980 = .text:0x800B9980; // type:function size:0xCC
fn_800B9A50 = .text:0x800B9A50; // type:function size:0x104
checkPositionIsInPastState__14dTimeAreaMgr_cFlRC7mVec3_cPff = .text:0x800B9A50; // type:function size:0x104
fn_800B9B60 = .text:0x800B9B60; // type:function size:0xB4
fn_800B9C20 = .text:0x800B9C20; // type:function size:0xB4
fn_800B9CE0 = .text:0x800B9CE0; // type:function size:0xA0
Expand All @@ -3984,10 +3984,10 @@ fn_800BA1F0 = .text:0x800BA1F0; // type:function size:0x124
fn_800BA320 = .text:0x800BA320; // type:function size:0x50C
fn_800BA830 = .text:0x800BA830; // type:function size:0xF8
fn_800BA930 = .text:0x800BA930; // type:function size:0x3BC
fn_800BACF0 = .text:0x800BACF0; // type:function size:0x244
fn_800BAF40 = .text:0x800BAF40; // type:function size:0x64
fn_800BAFB0 = .text:0x800BAFB0; // type:function size:0x26C
fn_800BB220 = .text:0x800BB220; // type:function size:0x80
drawOpa__19dTimeAreaMgrProcA_cFv = .text:0x800BACF0; // type:function size:0x244
create__19dTimeAreaMgrProcA_cFP16mHeapAllocator_c = .text:0x800BAF40; // type:function size:0x64
drawOpa__19dTimeAreaMgrProcB_cFv = .text:0x800BAFB0; // type:function size:0x26C
create__19dTimeAreaMgrProcB_cFP16mHeapAllocator_c = .text:0x800BB220; // type:function size:0x80
fn_800BB2A0 = .text:0x800BB2A0; // type:function size:0x60
fn_800BB300 = .text:0x800BB300; // type:function size:0x64
fn_800BB370 = .text:0x800BB370; // type:function size:0x20
Expand Down Expand Up @@ -11186,7 +11186,7 @@ fn_801BB2D0 = .text:0x801BB2D0; // type:function size:0x8
fn_801BB2E0 = .text:0x801BB2E0; // type:function size:0xC
fn_801BB2F0 = .text:0x801BB2F0; // type:function size:0x88
fn_801BB380 = .text:0x801BB380; // type:function size:0x34
fn_801BB3C0 = .text:0x801BB3C0; // type:function size:0x10
isCurrentStage__6ScGameFPCc = .text:0x801BB3C0; // type:function size:0x10
fn_801BB3D0 = .text:0x801BB3D0; // type:function size:0x54
fn_801BB430 = .text:0x801BB430; // type:function size:0x54
fn_801BB490 = .text:0x801BB490; // type:function size:0x78
Expand Down Expand Up @@ -39897,7 +39897,7 @@ lbl_805753AC = .sbss:0x805753AC; // type:object size:0x4 data:4byte
lbl_805753B0 = .sbss:0x805753B0; // type:object size:0x8 data:4byte
lbl_805753B8 = .sbss:0x805753B8; // type:object size:0x1 data:byte
lbl_805753BC = .sbss:0x805753BC; // type:object size:0x4 data:4byte
lbl_805753C0 = .sbss:0x805753C0; // type:object size:0x4 data:4byte
sInstance__14dTimeAreaMgr_c = .sbss:0x805753C0; // type:object size:0x4 data:4byte
lbl_805753C4 = .sbss:0x805753C4; // type:object size:0x1 data:byte
lbl_805753C8 = .sbss:0x805753C8; // type:object size:0x8 data:4byte
lbl_805753D0 = .sbss:0x805753D0; // type:object size:0x8 data:4byte
Expand Down
3 changes: 2 additions & 1 deletion configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ def nw4rLib(lib_name, objects, extra_cflags=[]):
Object(Matching, "toBeSorted/arc_managers/oarc_manager.cpp"),
Object(Matching, "toBeSorted/arc_managers/layout_arc_manager.cpp"),
Object(NonMatching, "toBeSorted/dowsing_target.cpp"),
Object(NonMatching, "toBeSorted/time_area_mgr.cpp"),
Object(Matching, "toBeSorted/save_file.cpp"),
Object(Matching, "toBeSorted/counters/counter.cpp"),
Object(Matching, "toBeSorted/counters/rupee_counter.cpp"),
Expand Down Expand Up @@ -1182,7 +1183,7 @@ def nw4rLib(lib_name, objects, extra_cflags=[]):
Rel(Matching, "d_t_tackle", "REL/d/t/d_t_tackle.cpp"),
Rel(NonMatching, "d_t_telop", "REL/d/t/d_t_telop.cpp"),
Rel(Matching, "d_t_timer", "REL/d/t/d_t_timer.cpp"),
Rel(NonMatching, "d_t_time_area_check", "REL/d/t/d_t_time_area_check.cpp"),
Rel(Matching, "d_t_time_area_check", "REL/d/t/d_t_time_area_check.cpp"),
Rel(NonMatching, "d_t_time_door_beam", "REL/d/t/d_t_time_door_beam.cpp"),
Rel(NonMatching, "d_t_touch", "REL/d/t/d_t_touch.cpp"),
Rel(NonMatching, "d_t_tumble_weed", "REL/d/t/d_t_tumble_weed.cpp"),
Expand Down
21 changes: 21 additions & 0 deletions include/d/tg/d_t_time_area_check.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#ifndef D_T_TIME_AREA_CHECK_H
#define D_T_TIME_AREA_CHECK_H

#include <d/tg/d_tg.h>

class dTgTimeAreaCheck_c : public dTg_c {
public:
dTgTimeAreaCheck_c() {}
virtual ~dTgTimeAreaCheck_c() {}

virtual int create() override;
virtual int doDelete() override;
virtual int actorExecute() override;
virtual int draw() override;

private:
u8 mPastSceneFlag;
u8 mPresentSceneFlag;
};

#endif
2 changes: 2 additions & 0 deletions include/toBeSorted/scgame.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ class ScGame {
static SpawnInfo currentSpawnInfo;
static SpawnInfo nextSpawnInfo;
static ScGame *sInstance;

static bool isCurrentStage(const char *stageName);
};

#endif
56 changes: 56 additions & 0 deletions include/toBeSorted/time_area_mgr.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#ifndef D_TIME_AREA_MGR_H
#define D_TIME_AREA_MGR_H

#include <m/m3d/m_proc.h>
#include <m/m_allocator.h>
#include <m/m_vec.h>


class dTimeAreaMgrProcA_c : public m3d::proc_c {
public:
dTimeAreaMgrProcA_c() {}

bool create(mHeapAllocator_c *alloc);

void drawOpa() override;
};

class dTimeAreaMgrProcB_c : public m3d::proc_c {
public:
dTimeAreaMgrProcB_c() {}

bool create(mHeapAllocator_c *alloc);

void drawOpa() override;

private:
/* 0x18 */ u8 field_0x18;
/* 0x19 */ u8 field_0x19;
/* 0x1A */ u8 field_0x1A;
/* 0x1B */ u8 field_0x1B;
};

class dTimeAreaMgr_c {
public:
dTimeAreaMgr_c();
virtual ~dTimeAreaMgr_c();

bool init();
void draw();

f32 checkPositionIsInPastState(s32 roomId, const mVec3_c &position, float *, float);

static dTimeAreaMgr_c *sInstance;

private:
/* 0x04 */ u8 field_0x04[0x0C - 0x04];
/* 0x0C */ mHeapAllocator_c mAllocator;
/* 0x28 */ dTimeAreaMgrProcA_c mProcA;
/* 0x40 */ dTimeAreaMgrProcB_c mProcB;
/* 0x5C */ u8 field_0x5C[0x64 - 0x5C];
/* 0x64 */ s32 field_0x64;
/* 0x68 */ u8 field_0x68[0x7B - 0x68];
/* 0x7B */ bool mIsInLanayruMiningFacility;
};

#endif
39 changes: 39 additions & 0 deletions src/REL/d/t/d_t_time_area_check.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#include <d/tg/d_t_time_area_check.h>
#include <toBeSorted/time_area_mgr.h>
#include <toBeSorted/sceneflag_manager.h>

SPECIAL_ACTOR_PROFILE(TAG_TIME_AREA_CHECK, dTgTimeAreaCheck_c, fProfile::TAG_TIME_AREA_CHECK, 0x01AC, 0, 0);

int dTgTimeAreaCheck_c::create() {
mPastSceneFlag = params & 0xFF;
mPresentSceneFlag = (params >> 8) & 0xFF;
return SUCCEEDED;
}

int dTgTimeAreaCheck_c::doDelete() {
return 1;
}

int dTgTimeAreaCheck_c::actorExecute() {
f32 result = dTimeAreaMgr_c::sInstance->checkPositionIsInPastState(roomid, position, nullptr, 10.0f);
if (result > 0.0f) {
if (mPastSceneFlag < 0xFF && !SceneflagManager::sInstance->checkBoolFlag(roomid, mPastSceneFlag)) {
SceneflagManager::sInstance->setFlag(roomid, mPastSceneFlag);
}
if (mPresentSceneFlag < 0xFF && SceneflagManager::sInstance->checkBoolFlag(roomid, mPresentSceneFlag)) {
SceneflagManager::sInstance->unsetFlag(roomid, mPresentSceneFlag);
}
} else {
if (mPastSceneFlag < 0xFF && SceneflagManager::sInstance->checkBoolFlag(roomid, mPastSceneFlag)) {
SceneflagManager::sInstance->unsetFlag(roomid, mPastSceneFlag);
}
if (mPresentSceneFlag < 0xFF && !SceneflagManager::sInstance->checkBoolFlag(roomid, mPresentSceneFlag)) {
SceneflagManager::sInstance->setFlag(roomid, mPresentSceneFlag);
}
}
return 1;
}

int dTgTimeAreaCheck_c::draw() {
return 1;
}
61 changes: 61 additions & 0 deletions src/toBeSorted/time_area_mgr.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#include <toBeSorted/time_area_mgr.h>
#include <toBeSorted/scgame.h>
#include <nw4r/g3d/g3d_obj.h>
#include <d/d_heap.h>


dTimeAreaMgr_c::dTimeAreaMgr_c() {
sInstance = this;
}

dTimeAreaMgr_c::~dTimeAreaMgr_c() {
sInstance = nullptr;
}

bool dTimeAreaMgr_c::init() {
mAllocator.replaceWithNewFrmHeap(-1, dHeap::work1Heap.heap, "dTimeAreaMgr_c::m_allocator", 0x20, 0);
mProcA.create(&mAllocator);
mProcB.create(&mAllocator);
mAllocator.adjustFrmHeap();
mIsInLanayruMiningFacility = ScGame::isCurrentStage("D300") || ScGame::isCurrentStage("D300_1");
return true;
}

void dTimeAreaMgr_c::draw() {
if (field_0x64 != 0 && dTimeAreaMgr_c::sInstance->field_0x68[0x10] == 0) {
mProcA.entry();
mProcB.entry();
}
}

void dTimeAreaMgrProcA_c::drawOpa() {
// TODO
}

bool dTimeAreaMgrProcA_c::create(mHeapAllocator_c *alloc) {
if (!m3d::proc_c::create(alloc, nullptr)) {
return false;
}

setPriorityDraw(0x0C, 0);
setOption(/* DISABLE_DRAW_XLU */ 0x07, 1);
return true;
}

void dTimeAreaMgrProcB_c::drawOpa() {
// TODO
}

bool dTimeAreaMgrProcB_c::create(mHeapAllocator_c *alloc) {
if (!m3d::proc_c::create(alloc, nullptr)) {
return false;
}

setPriorityDraw(0x13, 0);
setOption(/* DISABLE_DRAW_XLU */ 0x07, 1);
field_0x18 = 0x8C;
field_0x19 = 0x64;
field_0x1A = 0x3C;
field_0x1B = 0x64;
return true;
}
1 change: 0 additions & 1 deletion tools/rel_sieve.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
['fn_801695F0', 'LytCommonTitle::ctor'],
['fn_80067020', 'matrixCreateFromPosRotYScale'],
['fn_800C43D0', 'ActorEventFlowManagerRelated *FUN_800c43d0'],
['fn_801BB3C0', 'isCurrentStage'],
['fn_8037DCC0', 'EnemySoundMgr'],
['fn_800A6690', 'ActorOnRail::ctor'],
['fn_80355080', 'getColliderManager'],
Expand Down

0 comments on commit ad57f22

Please sign in to comment.