mirror of
https://github.com/zeldaret/ss
synced 2026-06-13 13:56:38 -04:00
Renames
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#ifndef D_FLAG_BASEFLAG_MANAGER_H
|
||||
#define D_FLAG_BASEFLAG_MANAGER_H
|
||||
|
||||
#include "d/flag/unk_flag_stuff.h"
|
||||
#include "d/flag/flag_index.h"
|
||||
#include "d/flag/flag_space.h"
|
||||
|
||||
class ItemStoryManagerBase {
|
||||
@@ -24,24 +24,26 @@ public:
|
||||
|
||||
|
||||
void init();
|
||||
void setFlagSizes(u16 flagSizeMaybe, u16 anotherFlagSizeMaybe);
|
||||
void copyFlagsFromSave_Priv();
|
||||
void setupUnkFlagStuff(UnkFlagDefinition *def, u16 count);
|
||||
void setupFlagIndex(FlagDefinition *def, u16 count);
|
||||
void doCommit_Priv();
|
||||
void setOrClearFlag(u16 flag, u16 value);
|
||||
u16 getFlag(u16 flag) const;
|
||||
void FUN_800bf610(u16 flag);
|
||||
u16 FUN_800bf640(u16 flag);
|
||||
void FUN_800bf690();
|
||||
void onFlagChange(u16 flag);
|
||||
u16 getMaskForFlag(u16 flag);
|
||||
void postCommit();
|
||||
|
||||
u16 getUncommittedValue_Priv(u16 flag);
|
||||
|
||||
protected:
|
||||
/** 0x04 */ u16 flagSizeMaybe;
|
||||
/** 0x06 */ u16 anotherSizeMaybe;
|
||||
/** 0x08 */ FlagSpace *storyFlagsPtr;
|
||||
/** 0x0C */ UnkFlagStuff *unkFlagsPtr;
|
||||
/** 0x10 */ bool dirty;
|
||||
|
||||
void setFlagSizes(u16 flagCount, u16 flagSizeBytes);
|
||||
|
||||
/** 0x04 */ u16 mFlagCount;
|
||||
/** 0x06 */ u16 mFlagSizeBytes;
|
||||
/** 0x08 */ FlagSpace *mpFlagSpace;
|
||||
/** 0x0C */ FlagIndex *mpFlagIndex;
|
||||
/** 0x10 */ bool mDirty;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
#ifndef D_FLAG_DUNGEONFLAG_MANAGER_H
|
||||
#define D_FLAG_DUNGEONFLAG_MANAGER_H
|
||||
|
||||
#include "d/flag/flag_index.h"
|
||||
#include "d/flag/flag_space.h"
|
||||
#include "toBeSorted/file_manager.h"
|
||||
|
||||
class DungeonflagManager {
|
||||
public:
|
||||
bool mShouldCommit;
|
||||
u16 mStageIndex;
|
||||
FlagIndex *mpFlagIndex;
|
||||
FlagSpace mFlagSpace;
|
||||
|
||||
static u16 sDungeonFlags[8];
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,37 @@
|
||||
#ifndef D_FLAG_FLAG_INDEX_H
|
||||
#define D_FLAG_FLAG_INDEX_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
/**
|
||||
* @brief Defines a single story or item flag.
|
||||
*/
|
||||
struct FlagDefinition {
|
||||
u8 mIndex;
|
||||
u8 mShiftMask;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Helper class for packing and unpacking flag data.
|
||||
*
|
||||
* Some flag managers store their data in a packed format, where
|
||||
* flags have a variable number of bits and can appear in varied
|
||||
* locations within a halfword.
|
||||
*/
|
||||
class FlagIndex {
|
||||
u16 mDefinitionsCount;
|
||||
FlagDefinition *mpDefinitions;
|
||||
|
||||
public:
|
||||
u16 calculateMask(s32 shift);
|
||||
void doNothing(u32 unused);
|
||||
FlagIndex(u16 count, FlagDefinition *definitions);
|
||||
void prepareIndexShiftMask(u16 counterIdx, u32 flagCount, u16 *pIndex, u8 *pShift, u16 *pMask);
|
||||
u16 maskForIdx(u16 index, u16 flagCount);
|
||||
u16 getCounterOrFlag(u16 counterIdx, const u16 *pData, u32 flagCount);
|
||||
void setCounterOrFlag(u16 counterIdx, u16 *pData, u32 flagCount, u32 value);
|
||||
|
||||
u32 checkFlagValid(u16 counterIdx, u32 flagCount);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
class ItemflagManager : public ItemStoryManagerBase {
|
||||
public:
|
||||
FlagSpace itemFlags;
|
||||
FlagSpace mItemFlags;
|
||||
|
||||
ItemflagManager();
|
||||
virtual ~ItemflagManager() {}
|
||||
@@ -16,14 +16,14 @@ public:
|
||||
bool commit();
|
||||
|
||||
/** 0x0C */ virtual void setFlagszptr() override {
|
||||
storyFlagsPtr = &itemFlags;
|
||||
mpFlagSpace = &mItemFlags;
|
||||
}
|
||||
/** 0x10 */ virtual void onDirty() override;
|
||||
/** 0x14 */ virtual void copyFlagsFromSave();
|
||||
/** 0x18 */ virtual void setupUnkFlagsStuff();
|
||||
/** 0x1C */ virtual void doCommit() {
|
||||
u16 sz = flagSizeMaybe;
|
||||
u16 *flags = storyFlagsPtr->getFlagPtrUnchecked();
|
||||
u16 sz = mFlagCount;
|
||||
u16 *flags = mpFlagSpace->getFlagPtrUnchecked();
|
||||
FileManager::sInstance->setItemFlags(flags, 0, sz);
|
||||
}
|
||||
/** 0x20 */ virtual void setFlag(u16 flag) {
|
||||
|
||||
@@ -10,19 +10,19 @@ public:
|
||||
|
||||
virtual ~StoryflagManager() {}
|
||||
|
||||
FlagSpace storyFlags;
|
||||
FlagSpace mStoryFlags;
|
||||
|
||||
bool commit();
|
||||
|
||||
/** 0x0C */ virtual void setFlagszptr() override {
|
||||
storyFlagsPtr = &storyFlags;
|
||||
mpFlagSpace = &mStoryFlags;
|
||||
}
|
||||
/** 0x10 */ virtual void onDirty() override;
|
||||
/** 0x14 */ virtual void copyFlagsFromSave() override;
|
||||
/** 0x18 */ virtual void setupUnkFlagsStuff() override;
|
||||
/** 0x1C */ virtual void doCommit() override {
|
||||
u16 sz = flagSizeMaybe;
|
||||
u16 *flags = storyFlagsPtr->getFlagPtrUnchecked();
|
||||
u16 sz = mFlagCount;
|
||||
u16 *flags = mpFlagSpace->getFlagPtrUnchecked();
|
||||
FileManager::sInstance->setStoryFlags(flags, 0, sz);
|
||||
}
|
||||
/** 0x24 */ virtual void unsetFlag(u16 flag) override;
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
#ifndef UNK_FLAG_STUFF_H
|
||||
#define UNK_FLAG_STUFF_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
struct UnkFlagDefinition {
|
||||
u8 mIndex;
|
||||
u8 mShiftMask;
|
||||
};
|
||||
|
||||
class UnkFlagStuff {
|
||||
u16 mDefinitionsCount;
|
||||
UnkFlagDefinition *mpDefinitions;
|
||||
|
||||
public:
|
||||
u16 calculateMask(s32 shift);
|
||||
void doNothing(u32 unused);
|
||||
UnkFlagStuff(u16 count, UnkFlagDefinition *definitions);
|
||||
void prepareIndexShiftMask(u16 counterIdx, u32 flagCount, u16 *pIndex, u8 *pShift, u16 *pMask);
|
||||
u16 maskForIdx(u16 index, u16 flagSizeMaybe);
|
||||
u16 getCounterOrFlag(u16 counterIdx, const u16 *pData, u32 flagCount);
|
||||
void setCounterOrFlag(u16 counterIdx, u16 *pData, u32 flagCount, u32 value);
|
||||
u32 checkFlagValid(u16 counterIdx, u32 flagCount);
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user