mirror of
https://github.com/zeldaret/ss
synced 2026-06-09 12:36:09 -04:00
Renames
This commit is contained in:
@@ -1,37 +1,36 @@
|
||||
#include "d/flag/baseflag_manager.h"
|
||||
|
||||
ItemStoryManagerBase::ItemStoryManagerBase(): flagSizeMaybe(0), anotherSizeMaybe(0), storyFlagsPtr(nullptr), unkFlagsPtr(nullptr), dirty(false) {}
|
||||
ItemStoryManagerBase::ItemStoryManagerBase(): mFlagCount(0), mFlagSizeBytes(0), mpFlagSpace(nullptr), mpFlagIndex(nullptr), mDirty(false) {}
|
||||
ItemStoryManagerBase::~ItemStoryManagerBase() {
|
||||
if (unkFlagsPtr != nullptr) {
|
||||
delete unkFlagsPtr;
|
||||
if (mpFlagIndex != nullptr) {
|
||||
delete mpFlagIndex;
|
||||
}
|
||||
}
|
||||
|
||||
void ItemStoryManagerBase::setFlagSizes(u16 flagSizeMaybe, u16 anotherFlagSizeMaybe) {
|
||||
this->flagSizeMaybe = flagSizeMaybe;
|
||||
this->anotherSizeMaybe = anotherFlagSizeMaybe;
|
||||
void ItemStoryManagerBase::setFlagSizes(u16 flagCount, u16 flagSizeBytes) {
|
||||
mFlagCount = flagCount;
|
||||
mFlagSizeBytes = flagSizeBytes;
|
||||
}
|
||||
|
||||
/** 800bf320 */
|
||||
void ItemStoryManagerBase::setupUnkFlagStuff(UnkFlagDefinition *def, u16 count) {
|
||||
UnkFlagStuff *stuff = new UnkFlagStuff(count, def);
|
||||
this->unkFlagsPtr = stuff;
|
||||
void ItemStoryManagerBase::setupFlagIndex(FlagDefinition *def, u16 count) {
|
||||
mpFlagIndex = new FlagIndex(count, def);
|
||||
}
|
||||
|
||||
/** 800bf380 */
|
||||
void ItemStoryManagerBase::copyFlagsFromSave_Priv() {
|
||||
FlagSpace *current = this->storyFlagsPtr;
|
||||
const u16 *saved = this->getSaveFlagSpace();
|
||||
current->copyFromSaveFile(saved, 0, this->flagSizeMaybe);
|
||||
FlagSpace *current = mpFlagSpace;
|
||||
const u16 *saved = getSaveFlagSpace();
|
||||
current->copyFromSaveFile(saved, 0, mFlagCount);
|
||||
}
|
||||
|
||||
/** 800bf3e0 */
|
||||
void ItemStoryManagerBase::init() {
|
||||
const u16 *space = this->getSaveFlagSpace();
|
||||
if (space == nullptr || this->unkFlagsPtr == nullptr) {
|
||||
this->setFlagszptr();
|
||||
this->copyFlagsFromSave();
|
||||
this->setupUnkFlagsStuff();
|
||||
const u16 *space = getSaveFlagSpace();
|
||||
if (space == nullptr || mpFlagIndex == nullptr) {
|
||||
setFlagszptr();
|
||||
copyFlagsFromSave();
|
||||
setupUnkFlagsStuff();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,37 +41,37 @@ void ItemStoryManagerBase::setFlagszptr() {
|
||||
|
||||
/** 800bf480 */
|
||||
u16 ItemStoryManagerBase::getFlag(u16 flag) const {
|
||||
const u16 *data = this->getSaveFlagSpace();
|
||||
return this->unkFlagsPtr->getCounterOrFlag(flag, data, this->flagSizeMaybe);
|
||||
const u16 *data = getSaveFlagSpace();
|
||||
return mpFlagIndex->getCounterOrFlag(flag, data, mFlagCount);
|
||||
}
|
||||
|
||||
/** 800bf4e0 */
|
||||
u16 ItemStoryManagerBase::getUncommittedValue_Priv(u16 flag) {
|
||||
u16 *data = this->storyFlagsPtr->getFlagPtrUnchecked();
|
||||
return this->unkFlagsPtr->getCounterOrFlag(flag, data, this->flagSizeMaybe);
|
||||
u16 *data = mpFlagSpace->getFlagPtrUnchecked();
|
||||
return mpFlagIndex->getCounterOrFlag(flag, data, mFlagCount);
|
||||
}
|
||||
|
||||
/** 800bf530 */
|
||||
void ItemStoryManagerBase::setOrClearFlag(u16 flag, u16 value) {
|
||||
FlagSpace *storyFlagsPtr = this->storyFlagsPtr;
|
||||
FlagSpace *storyFlagsPtr = mpFlagSpace;
|
||||
u16 *pData = storyFlagsPtr->getFlagPtrChecked();
|
||||
this->unkFlagsPtr->setCounterOrFlag(flag, pData, storyFlagsPtr->mCount, value);
|
||||
this->FUN_800bf610(flag);
|
||||
mpFlagIndex->setCounterOrFlag(flag, pData, storyFlagsPtr->mCount, value);
|
||||
onFlagChange(flag);
|
||||
}
|
||||
|
||||
/** 800bf5b0 */
|
||||
void ItemStoryManagerBase::setFlag(u16 flag) {
|
||||
this->setOrClearFlag(flag, true);
|
||||
setOrClearFlag(flag, true);
|
||||
}
|
||||
|
||||
/** 800bf5c0 */
|
||||
void ItemStoryManagerBase::unsetFlag(u16 flag) {
|
||||
this->setOrClearFlag(flag, false);
|
||||
setOrClearFlag(flag, false);
|
||||
}
|
||||
|
||||
/** 800bf5d0 */
|
||||
void ItemStoryManagerBase::setFlagOrCounterToValue(u16 flag, u16 value) {
|
||||
this->setOrClearFlag(flag, value);
|
||||
setOrClearFlag(flag, value);
|
||||
}
|
||||
|
||||
/** 800bf5e0 */
|
||||
@@ -82,18 +81,18 @@ u16 ItemStoryManagerBase::getCounterOrFlag(u16 flag) const {
|
||||
|
||||
/** 800bf5f0 */
|
||||
u16 ItemStoryManagerBase::getUncommittedValue(u16 flag) {
|
||||
return this->getUncommittedValue_Priv(flag);
|
||||
return getUncommittedValue_Priv(flag);
|
||||
}
|
||||
|
||||
/** 800bf600 */
|
||||
u16 ItemStoryManagerBase::unk3(u16 flag) {
|
||||
return this->FUN_800bf640(flag);
|
||||
return getMaskForFlag(flag);
|
||||
}
|
||||
|
||||
/** 800bf610 */
|
||||
void ItemStoryManagerBase::FUN_800bf610(u16 flag) {
|
||||
this->dirty = true;
|
||||
this->onDirty();
|
||||
void ItemStoryManagerBase::onFlagChange(u16 flag) {
|
||||
mDirty = true;
|
||||
onDirty();
|
||||
}
|
||||
|
||||
/** 800bf630 */
|
||||
@@ -102,17 +101,17 @@ void ItemStoryManagerBase::onDirty() {
|
||||
}
|
||||
|
||||
/** 800bf640 */
|
||||
u16 ItemStoryManagerBase::FUN_800bf640(u16 flag) {
|
||||
return this->unkFlagsPtr->maskForIdx(flag, this->flagSizeMaybe);
|
||||
u16 ItemStoryManagerBase::getMaskForFlag(u16 flag) {
|
||||
return mpFlagIndex->maskForIdx(flag, mFlagCount);
|
||||
}
|
||||
|
||||
/** 800bf650 */
|
||||
void ItemStoryManagerBase::doCommit_Priv() {
|
||||
this->doCommit();
|
||||
this->dirty = false;
|
||||
doCommit();
|
||||
mDirty = false;
|
||||
}
|
||||
|
||||
/* 800bf690 */
|
||||
void ItemStoryManagerBase::FUN_800bf690() {
|
||||
void ItemStoryManagerBase::postCommit() {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,39 +1,9 @@
|
||||
#include "toBeSorted/file_manager.h"
|
||||
#include "d/flag/flag_space.h"
|
||||
#include "d/flag/unk_flag_stuff.h"
|
||||
#include "d/flag/dungeonflag_manager.h"
|
||||
#include "d/flag/flag_index.h"
|
||||
|
||||
|
||||
// TODO move
|
||||
extern "C" UnkFlagDefinition DungeonflagManager__FLAG_DEFINITIONS[];
|
||||
|
||||
class DungeonflagManager {
|
||||
public:
|
||||
bool mShouldCommit;
|
||||
u16 mStageIndex;
|
||||
UnkFlagStuff *mFlagStuff;
|
||||
FlagSpace mFlagSpace;
|
||||
|
||||
static u16 sDungeonFlags[8];
|
||||
// static DungeonflagManager *sInstance;
|
||||
|
||||
void copyFromSave(u32 flag);
|
||||
void copyFromSave_Internal(u16 flagIndex);
|
||||
void setCommitFlag(u16 flag);
|
||||
DungeonflagManager();
|
||||
void init();
|
||||
void setToValue(u16 flag, u32 value);
|
||||
void setFlag(u16 flag);
|
||||
u16 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;
|
||||
}
|
||||
|
||||
static DungeonflagManager *sInstance;
|
||||
};
|
||||
extern "C" FlagDefinition DungeonflagManager__FLAG_DEFINITIONS[];
|
||||
|
||||
/** 80575404 */
|
||||
DungeonflagManager *DungeonflagManager::sInstance = nullptr;
|
||||
@@ -53,12 +23,12 @@ void DungeonflagManager::setCommitFlag(u16 flag) {
|
||||
|
||||
/** 0x800bf940 */
|
||||
DungeonflagManager::DungeonflagManager()
|
||||
: mShouldCommit(false), mStageIndex(-1), mFlagStuff(nullptr),
|
||||
: mShouldCommit(false), mStageIndex(-1), mpFlagIndex(nullptr),
|
||||
mFlagSpace(sDungeonFlags, ARRAY_LENGTH(sDungeonFlags)) {}
|
||||
|
||||
/** 800bf980 */
|
||||
void DungeonflagManager::init() {
|
||||
mFlagStuff = new UnkFlagStuff(0x11, DungeonflagManager__FLAG_DEFINITIONS);
|
||||
mpFlagIndex = new FlagIndex(0x11, DungeonflagManager__FLAG_DEFINITIONS);
|
||||
mShouldCommit = false;
|
||||
}
|
||||
|
||||
@@ -71,21 +41,21 @@ void DungeonflagManager::copyFromSave(u32 flag) {
|
||||
/** 800bf9f0 */
|
||||
void DungeonflagManager::setToValue(u16 flag, u32 value) {
|
||||
u16 *data = mFlagSpace.getFlagPtrChecked();
|
||||
mFlagStuff->setCounterOrFlag(flag, data, 8, value);
|
||||
mpFlagIndex->setCounterOrFlag(flag, data, 8, value);
|
||||
setCommitFlag(flag);
|
||||
}
|
||||
|
||||
/** 800bfa60 */
|
||||
void DungeonflagManager::setFlag(u16 flag) {
|
||||
u16 *data = mFlagSpace.getFlagPtrChecked();
|
||||
mFlagStuff->setCounterOrFlag(flag, data, 8, 1);
|
||||
mpFlagIndex->setCounterOrFlag(flag, data, 8, 1);
|
||||
setCommitFlag(flag);
|
||||
}
|
||||
|
||||
/** 800fbac0 */
|
||||
u16 DungeonflagManager::getDungeonFlag(u16 flag) {
|
||||
u16 *data = mFlagSpace.getFlagPtrUnchecked();
|
||||
return mFlagStuff->getCounterOrFlag(flag, data, 8);
|
||||
return mpFlagIndex->getCounterOrFlag(flag, data, 8);
|
||||
}
|
||||
|
||||
/** 800fbb10 */
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
#include "d/flag/unk_flag_stuff.h"
|
||||
#include "d/flag/flag_index.h"
|
||||
|
||||
u16 UnkFlagStuff::calculateMask(s32 shift) {
|
||||
u16 FlagIndex::calculateMask(s32 shift) {
|
||||
return (2 << (shift & 0xF)) - 1;
|
||||
}
|
||||
|
||||
void UnkFlagStuff::doNothing(u32 unused) {}
|
||||
void FlagIndex::doNothing(u32 unused) {}
|
||||
|
||||
UnkFlagStuff::UnkFlagStuff(u16 count, UnkFlagDefinition *definitions) {
|
||||
FlagIndex::FlagIndex(u16 count, FlagDefinition *definitions) {
|
||||
this->mDefinitionsCount = count;
|
||||
this->mpDefinitions = definitions;
|
||||
}
|
||||
|
||||
void UnkFlagStuff::prepareIndexShiftMask(u16 counterIdx, u32 unused, u16 *indexPtr, u8 *shiftPtr, u16 *maskPtr) {
|
||||
void FlagIndex::prepareIndexShiftMask(u16 counterIdx, u32 unused, u16 *indexPtr, u8 *shiftPtr, u16 *maskPtr) {
|
||||
doNothing(counterIdx);
|
||||
*indexPtr = mpDefinitions[counterIdx].mIndex;
|
||||
*shiftPtr = mpDefinitions[counterIdx].mShiftMask >> 4;
|
||||
*maskPtr = calculateMask(mpDefinitions[counterIdx].mShiftMask);
|
||||
}
|
||||
|
||||
u16 UnkFlagStuff::maskForIdx(u16 index, u16 flagSizeMaybe) {
|
||||
u16 FlagIndex::maskForIdx(u16 index, u16 flagCount) {
|
||||
doNothing(index);
|
||||
|
||||
return calculateMask(mpDefinitions[index].mShiftMask);
|
||||
}
|
||||
|
||||
u16 UnkFlagStuff::getCounterOrFlag(u16 counterIdx, const u16 *dataPtr, u32 param4) {
|
||||
u16 FlagIndex::getCounterOrFlag(u16 counterIdx, const u16 *dataPtr, u32 param4) {
|
||||
u16 index = 0;
|
||||
u8 shift = 0;
|
||||
u16 mask = 0;
|
||||
@@ -32,7 +32,7 @@ u16 UnkFlagStuff::getCounterOrFlag(u16 counterIdx, const u16 *dataPtr, u32 param
|
||||
return mask & (dataPtr[index] >> shift);
|
||||
}
|
||||
|
||||
void UnkFlagStuff::setCounterOrFlag(u16 counterIdx, u16 *dataPtr, u32 flagCount, u32 value) {
|
||||
void FlagIndex::setCounterOrFlag(u16 counterIdx, u16 *dataPtr, u32 flagCount, u32 value) {
|
||||
u16 index = 0;
|
||||
u8 shift = 0;
|
||||
u16 mask = 0;
|
||||
@@ -45,7 +45,7 @@ inline bool isLessThan(int a, int b) {
|
||||
return a <= b;
|
||||
}
|
||||
|
||||
u32 UnkFlagStuff::checkFlagValid(u16 counterIdx, u32 flagCount) {
|
||||
u32 FlagIndex::checkFlagValid(u16 counterIdx, u32 flagCount) {
|
||||
if (mpDefinitions == nullptr) {
|
||||
return 0;
|
||||
}
|
||||
@@ -11,21 +11,21 @@
|
||||
#include "d/flag/enemyflag_manager.h"
|
||||
#include "d/flag/storyflag_manager.h"
|
||||
#include "d/flag/itemflag_manager.h"
|
||||
// clang-format on
|
||||
|
||||
// actual managers
|
||||
#include "d/flag/sceneflag_manager.inc"
|
||||
#include "d/flag/committable_flag_manager.inc"
|
||||
#include "d/flag/tboxflag_manager.inc"
|
||||
#include "d/flag/enemyflag_manager.inc"
|
||||
#include "d/flag/flag_space.inc"
|
||||
#include "d/flag/unk_flag_stuff.inc"
|
||||
#include "d/flag/flag_index.inc"
|
||||
#include "d/flag/bitwise_flag_helper.inc"
|
||||
|
||||
#include "d/flag/baseflag_manager.inc"
|
||||
#include "d/flag/storyflag_manager.inc"
|
||||
#include "d/flag/itemflag_manager.inc"
|
||||
#include "d/flag/dungeonflag_manager.inc"
|
||||
#include "d/flag/skipflag_manager.inc"
|
||||
// clang-format on
|
||||
|
||||
|
||||
static void postSetup();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "common.h"
|
||||
#include "d/flag/flag_managers.h"
|
||||
#include "d/flag/flag_space.h"
|
||||
#include "toBeSorted/file_manager.h"
|
||||
#include "common.h"
|
||||
|
||||
u16 *FlagSpace::getFlagPtrChecked() const {
|
||||
filemanagerCheck();
|
||||
|
||||
@@ -4,25 +4,25 @@ u16 ItemflagManager::sFlags[0x40];
|
||||
|
||||
ItemflagManager *ItemflagManager::sInstance = nullptr;
|
||||
|
||||
ItemflagManager::ItemflagManager() : itemFlags(sFlags, 0x40) {}
|
||||
ItemflagManager::ItemflagManager() : mItemFlags(sFlags, 0x40) {}
|
||||
|
||||
void ItemflagManager::copyFlagsFromSave() {
|
||||
setFlagSizes(0x40, 0x80);
|
||||
copyFlagsFromSave_Priv();
|
||||
ItemStoryManagerBase::copyFlagsFromSave_Priv();
|
||||
}
|
||||
|
||||
extern "C" UnkFlagDefinition ItemflagManager__ITEMFLAG_DEFINITIONS[];
|
||||
extern "C" FlagDefinition ItemflagManager__ITEMFLAG_DEFINITIONS[];
|
||||
|
||||
void ItemflagManager::setupUnkFlagsStuff() {
|
||||
setupUnkFlagStuff(ItemflagManager__ITEMFLAG_DEFINITIONS, 0x1FE);
|
||||
setupFlagIndex(ItemflagManager__ITEMFLAG_DEFINITIONS, 0x1FE);
|
||||
}
|
||||
|
||||
void ItemflagManager::onDirty() {}
|
||||
|
||||
bool ItemflagManager::commit() {
|
||||
if (dirty) {
|
||||
if (mDirty) {
|
||||
doCommit_Priv();
|
||||
FUN_800bf690();
|
||||
postCommit();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
#include "d/flag/sceneflag_manager.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "libc.h"
|
||||
#include "d/flag/sceneflag_manager.h"
|
||||
#include "toBeSorted/file_manager.h"
|
||||
|
||||
|
||||
SceneflagManager *SceneflagManager::sInstance = nullptr;
|
||||
u16 SceneflagManager::sTempFlags[] = {};
|
||||
u16 SceneflagManager::sSceneFlags[8] = {};
|
||||
@@ -20,14 +17,7 @@ SceneflagManager::SceneflagManager()
|
||||
mSceneIdx = 0xFFFF;
|
||||
mShouldCommit = 0;
|
||||
}
|
||||
// SceneflagManager::SceneflagManager()
|
||||
// {
|
||||
// mSceneflags.init(sSceneFlags, ARRAY_LENGTH(sSceneFlags));
|
||||
// mTempflags.init(sTempFlags, ARRAY_LENGTH(sTempFlags));
|
||||
// mZoneflags.init(sZoneFlags, ARRAY_LENGTH(sZoneFlags));
|
||||
// mSceneIdx = 0xFFFF;
|
||||
// mShouldCommit = 0;
|
||||
// }
|
||||
|
||||
s32 SceneflagManager::isNotTempOrZoneFlag(u16 flag) {
|
||||
// return ((s32)flag - 0x80) < 0;
|
||||
return flag < 0x80;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#include "common.h"
|
||||
#include "d/flag/flag_managers.h"
|
||||
#include "d/flag/skipflag_manager.h"
|
||||
#include "d/flag/bitwise_flag_helper.h"
|
||||
#include "toBeSorted/file_manager.h"
|
||||
#include "d/flag/flag_managers.h"
|
||||
#include "d/flag/flag_space.h"
|
||||
#include "d/flag/skipflag_manager.h"
|
||||
#include "toBeSorted/file_manager.h"
|
||||
|
||||
// 0x80575408
|
||||
SkipflagManager *SkipflagManager::sInstance = nullptr;
|
||||
|
||||
@@ -3,29 +3,25 @@
|
||||
u16 StoryflagManager::sFlags[0x80];
|
||||
StoryflagManager *StoryflagManager::sInstance = nullptr;
|
||||
|
||||
StoryflagManager::StoryflagManager() : storyFlags(sFlags, 0x80) {
|
||||
|
||||
}
|
||||
StoryflagManager::StoryflagManager() : mStoryFlags(sFlags, 0x80) {}
|
||||
|
||||
void StoryflagManager::copyFlagsFromSave() {
|
||||
setFlagSizes(0x80, 0x100);
|
||||
copyFlagsFromSave_Priv();
|
||||
ItemStoryManagerBase::copyFlagsFromSave_Priv();
|
||||
}
|
||||
|
||||
extern "C" UnkFlagDefinition StoryflagManager__STORYFLAG_DEFINITIONS[];
|
||||
extern "C" FlagDefinition StoryflagManager__STORYFLAG_DEFINITIONS[];
|
||||
|
||||
void StoryflagManager::setupUnkFlagsStuff() {
|
||||
setupUnkFlagStuff(StoryflagManager__STORYFLAG_DEFINITIONS, 0x4B1);
|
||||
setupFlagIndex(StoryflagManager__STORYFLAG_DEFINITIONS, 0x4B1);
|
||||
}
|
||||
|
||||
void StoryflagManager::onDirty() {
|
||||
|
||||
}
|
||||
void StoryflagManager::onDirty() {}
|
||||
|
||||
bool StoryflagManager::commit() {
|
||||
if (dirty) {
|
||||
if (mDirty) {
|
||||
doCommit_Priv();
|
||||
FUN_800bf690();
|
||||
postCommit();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user