mirror of
https://github.com/zeldaret/ss
synced 2026-06-24 09:21:20 -04:00
Merge pull request #12 from robojumper/dungeonFlag_mgr
DungeonflagManager code match
This commit is contained in:
@@ -122,6 +122,10 @@ toBeSorted/unk_flag_stuff.cpp:
|
||||
toBeSorted/bitwise_flag_helper.cpp:
|
||||
.text start:0x800BF200 end:0x800BF264
|
||||
|
||||
toBeSorted/dungeonflag_manager.cpp:
|
||||
.text start:0x800BF8D0 end:0x800BFB9C
|
||||
.bss start:0x805A9C58 end:0x805A9C68
|
||||
|
||||
toBeSorted/skipflag_manager.cpp:
|
||||
.text start:0x800BFBA0 end:0x800BFE00
|
||||
.sbss start:0x80575408 end:0x8057540C
|
||||
|
||||
+11
-11
@@ -2228,7 +2228,7 @@ fn_80054CF0 = .text:0x80054CF0; // type:function size:0x88
|
||||
fn_80054D80 = .text:0x80054D80; // type:function size:0x98
|
||||
fn_80054E20 = .text:0x80054E20; // type:function size:0x88
|
||||
fn_80054EB0 = .text:0x80054EB0; // type:function size:0x4
|
||||
fn_80054EC0 = .text:0x80054EC0; // type:function size:0xC
|
||||
__nw__FUl = .text:0x80054EC0; // type:function size:0xC
|
||||
fn_80054ED0 = .text:0x80054ED0; // type:function size:0xC
|
||||
__dl__FPv = .text:0x80054EE0; // type:function size:0x8
|
||||
fn_80054EF0 = .text:0x80054EF0; // type:function size:0x8
|
||||
@@ -4171,15 +4171,15 @@ fn_800BF820 = .text:0x800BF820; // type:function size:0x3C
|
||||
fn_800BF860 = .text:0x800BF860; // type:function size:0x10
|
||||
fn_800BF870 = .text:0x800BF870; // type:function size:0x4
|
||||
fn_800BF880 = .text:0x800BF880; // type:function size:0x4C
|
||||
fn_800BF8D0 = .text:0x800BF8D0; // type:function size:0x54
|
||||
fn_800BF930 = .text:0x800BF930; // type:function size:0xC
|
||||
fn_800BF940 = .text:0x800BF940; // type:function size:0x3C
|
||||
fn_800BF980 = .text:0x800BF980; // type:function size:0x54
|
||||
fn_800BF9E0 = .text:0x800BF9E0; // type:function size:0xC
|
||||
fn_800BF9F0 = .text:0x800BF9F0; // type:function size:0x6C
|
||||
fn_800BFA60 = .text:0x800BFA60; // type:function size:0x60
|
||||
fn_800BFAC0 = .text:0x800BFAC0; // type:function size:0x50
|
||||
fn_800BFB10 = .text:0x800BFB10; // type:function size:0x8C
|
||||
copyFromSave__18DungeonflagManagerFUs = .text:0x800BF8D0; // type:function size:0x54
|
||||
setCommitFlag__18DungeonflagManagerFUs = .text:0x800BF930; // type:function size:0xC
|
||||
__ct__18DungeonflagManagerFv = .text:0x800BF940; // type:function size:0x3C
|
||||
setupFlagStuff__18DungeonflagManagerFv = .text:0x800BF980; // type:function size:0x54
|
||||
copyFromSave__18DungeonflagManagerFs = .text:0x800BF9E0; // type:function size:0xC
|
||||
setToValue__18DungeonflagManagerFUsUi = .text:0x800BF9F0; // type:function size:0x6C
|
||||
setFlag__18DungeonflagManagerFUs = .text:0x800BFA60; // type:function size:0x60
|
||||
getDungeonFlag__18DungeonflagManagerFUs = .text:0x800BFAC0; // type:function size:0x50
|
||||
doCommit__18DungeonflagManagerFv = .text:0x800BFB10; // type:function size:0x8C
|
||||
copyFromSave__15SkipflagManagerFv = .text:0x800BFBA0; // type:function size:0x44
|
||||
setCommitFlag__15SkipflagManagerFUs = .text:0x800BFBF0; // type:function size:0xC
|
||||
__ct__15SkipflagManagerFv = .text:0x800BFC00; // type:function size:0x2C
|
||||
@@ -48240,7 +48240,7 @@ lbl_805A78E0 = .bss:0x805A78E0; // type:object size:0x1F8
|
||||
sEnemyDefeatFlags__18EnemyDefeatManager = .bss:0x805A7AD8; // type:object size:0x2000
|
||||
lbl_805A9AD8 = .bss:0x805A9AD8; // type:object size:0x100
|
||||
lbl_805A9BD8 = .bss:0x805A9BD8; // type:object size:0x80
|
||||
lbl_805A9C58 = .bss:0x805A9C58; // type:object size:0x10
|
||||
sDungeonFlags__18DungeonflagManager = .bss:0x805A9C58; // type:object size:0x10
|
||||
sSkipFlags__15SkipflagManager = .bss:0x805A9C68; // type:object size:0x20
|
||||
lbl_805A9C88 = .bss:0x805A9C88; // type:object size:0x10 data:4byte
|
||||
lbl_805A9C98 = .bss:0x805A9C98; // type:object size:0x208
|
||||
|
||||
@@ -276,6 +276,7 @@ config.libs = [
|
||||
Object(Matching, "toBeSorted/sceneflag_manager.cpp"),
|
||||
Object(NonMatching, "toBeSorted/flag_space.cpp"),
|
||||
Object(NonMatching, "toBeSorted/misc_flag_managers.cpp"),
|
||||
Object(Matching, "toBeSorted/dungeonflag_manager.cpp"),
|
||||
Object(Matching, "toBeSorted/skipflag_manager.cpp"),
|
||||
Object(Matching, "c/c_list.cpp"),
|
||||
Object(Matching, "c/c_tree.cpp"),
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
#include "toBeSorted/bitwise_flag_helper.h"
|
||||
#include "toBeSorted/file_manager.h"
|
||||
#include "toBeSorted/flag_space.h"
|
||||
#include "toBeSorted/unk_flag_stuff.h"
|
||||
#include <libc.h>
|
||||
|
||||
// TODO move
|
||||
extern "C" UnkFlagDefinition lbl_80511AF0[];
|
||||
|
||||
class DungeonflagManager {
|
||||
public:
|
||||
bool mShouldCommit;
|
||||
u16 mStageIndex;
|
||||
UnkFlagStuff *mFlagStuff;
|
||||
FlagSpace mFlagSpace;
|
||||
|
||||
static u16 sDungeonFlags[8];
|
||||
// static DungeonflagManager *sInstance;
|
||||
|
||||
void copyFromSave(s16 flag);
|
||||
void copyFromSave(u16 flagIndex);
|
||||
void setCommitFlag(u16 flag);
|
||||
DungeonflagManager();
|
||||
void setupFlagStuff();
|
||||
void setToValue(u16 flag, u32 value);
|
||||
void setFlag(u16 flag);
|
||||
u32 getDungeonFlag(u16 flag);
|
||||
bool doCommit();
|
||||
|
||||
/** inline shenanigans to get copyFromSave to match */
|
||||
static inline u16 *saveFilePtr(u16 flagIndex) {
|
||||
u32 offset = (flagIndex & 0x1fff) * 8;
|
||||
return FileManager::sInstance->getDungeonFlagsConst() + offset;
|
||||
}
|
||||
};
|
||||
|
||||
/** 80575404 */
|
||||
// DungeonflagManager *DungeonflagManager::sInstance = nullptr;
|
||||
|
||||
/** 805a9c58 */
|
||||
u16 DungeonflagManager::sDungeonFlags[8] = {};
|
||||
|
||||
/** 800bf8d0 */
|
||||
void DungeonflagManager::copyFromSave(u16 flagIndex) {
|
||||
mFlagSpace.copyFromSaveFile(saveFilePtr(flagIndex), 0, 0x8);
|
||||
}
|
||||
|
||||
/** 800bf930 */
|
||||
void DungeonflagManager::setCommitFlag(u16 flag) {
|
||||
mShouldCommit = true;
|
||||
}
|
||||
|
||||
/** 0x800bf940 */
|
||||
DungeonflagManager::DungeonflagManager()
|
||||
: mShouldCommit(false), mStageIndex(-1), mFlagStuff(nullptr),
|
||||
mFlagSpace(sDungeonFlags, ARRAY_LENGTH(sDungeonFlags)) {}
|
||||
|
||||
/** 800bf980 */
|
||||
void DungeonflagManager::setupFlagStuff() {
|
||||
mFlagStuff = new UnkFlagStuff(0x11, lbl_80511AF0);
|
||||
mShouldCommit = false;
|
||||
}
|
||||
|
||||
/** 800bf9e0 */
|
||||
void DungeonflagManager::copyFromSave(s16 flag) {
|
||||
mStageIndex = flag;
|
||||
copyFromSave((u16)flag);
|
||||
}
|
||||
|
||||
/** 800bf9f0 */
|
||||
void DungeonflagManager::setToValue(u16 flag, u32 value) {
|
||||
u16 *data = mFlagSpace.getFlagPtrChecked();
|
||||
mFlagStuff->setCounterOrFlag(flag, data, 8, value);
|
||||
setCommitFlag(flag);
|
||||
}
|
||||
|
||||
/** 800bfa60 */
|
||||
void DungeonflagManager::setFlag(u16 flag) {
|
||||
u16 *data = mFlagSpace.getFlagPtrChecked();
|
||||
mFlagStuff->setCounterOrFlag(flag, data, 8, 1);
|
||||
setCommitFlag(flag);
|
||||
}
|
||||
|
||||
/** 800fbac0 */
|
||||
u32 DungeonflagManager::getDungeonFlag(u16 flag) {
|
||||
u16 *data = mFlagSpace.getFlagPtrUnchecked();
|
||||
return mFlagStuff->getCounterOrFlag(flag, data, 8);
|
||||
}
|
||||
|
||||
/** 800fbb10 */
|
||||
bool DungeonflagManager::doCommit() {
|
||||
FileManager *instance;
|
||||
u16 idx = mStageIndex;
|
||||
if (idx == 0xFFFF) {
|
||||
return false;
|
||||
} else if (mShouldCommit) {
|
||||
instance = FileManager::sInstance;
|
||||
u16 *ptr = mFlagSpace.getFlagPtrUnchecked();
|
||||
instance->setDungeonFlags(ptr, (idx & 0x1fff) * 8, 0x08);
|
||||
mShouldCommit = false;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
Reference in New Issue
Block a user