Files
ss/include/d/flag/dungeonflag_manager.h
T
Elijah Thomas 2ecf6509dd Tubo! (d_a_obj_tubo) (#95)
* begin work

* fixup modifications to d_a_base header

* progress

* update from main again (forgor to fetch)

* progress

* Basically done

* clean up some inlines

* some at/tg hit typing and tubo naming

* more naming
2024-11-12 22:30:01 -05:00

43 lines
1.1 KiB
C++

#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 commit();
/** inline shenanigans to get copyFromSave to match */
static inline u16 *saveFilePtr(u16 flagIndex) {
u32 offset = (flagIndex & 0x1fff) * 8;
return FileManager::sInstance->getDungeonFlagsConst() + offset;
}
u16 getCounterOrFlag(u16 idx, u32 count) const {
u16 offset = mStageIndex * 8;
const u16 *space = FileManager::sInstance->getDungeonFlagsConst() + offset;
return mpFlagIndex->getCounterOrFlag(idx, space, count);
}
static DungeonflagManager *sInstance;
};
#endif