mirror of
https://github.com/zeldaret/ss
synced 2026-09-01 17:39:55 -04:00
@@ -0,0 +1,49 @@
|
||||
#ifndef D_FLAG_BASEFLAG_MANAGER_H
|
||||
#define D_FLAG_BASEFLAG_MANAGER_H
|
||||
|
||||
#include "d/flag/flag_index.h"
|
||||
#include "d/flag/flag_space.h"
|
||||
|
||||
class ItemStoryManagerBase {
|
||||
public:
|
||||
ItemStoryManagerBase();
|
||||
|
||||
/** 0x08 */ virtual ~ItemStoryManagerBase();
|
||||
/** 0x0C */ virtual void initFlagSpace();
|
||||
/** 0x10 */ virtual void onDirty();
|
||||
/** 0x14 */ virtual void copyFlagsFromSaveFirstTime() = 0;
|
||||
/** 0x18 */ virtual void setupFlagIndex() = 0;
|
||||
/** 0x1C */ virtual void doCommit() = 0;
|
||||
/** 0x20 */ virtual void setFlag(u16 flag);
|
||||
/** 0x24 */ virtual void unsetFlag(u16 flag);
|
||||
/** 0x28 */ virtual void setFlagOrCounterToValue(u16 flag, u16 value);
|
||||
/** 0x2C */ virtual u16 getCounterOrFlag(u16 flag) const;
|
||||
/** 0x30 */ virtual u16 getUncommittedValue(u16 flag);
|
||||
/** 0x34 */ virtual u16 unk3(u16 arg);
|
||||
/** 0x38 */ virtual const u16 *getSaveFlagSpace() const = 0;
|
||||
|
||||
|
||||
void init();
|
||||
void copyFromSave();
|
||||
void createFlagIndex(FlagDefinition *def, u16 count);
|
||||
void doCommit_Priv();
|
||||
void setOrClearFlag(u16 flag, u16 value);
|
||||
u16 getFlag(u16 flag) const;
|
||||
void onFlagChange(u16 flag);
|
||||
u16 getMaskForFlag(u16 flag);
|
||||
void postCommit();
|
||||
|
||||
u16 getUncommittedValue_Priv(u16 flag);
|
||||
|
||||
protected:
|
||||
|
||||
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,23 @@
|
||||
#ifndef D_FLAG_COMMITTABLE_FLAG_MANAGER_H
|
||||
#define D_FLAG_COMMITTABLE_FLAG_MANAGER_H
|
||||
|
||||
class CommittableFlagManager {
|
||||
public:
|
||||
bool mNeedsCommit;
|
||||
|
||||
virtual void doCommit() = 0;
|
||||
virtual ~CommittableFlagManager() {}
|
||||
bool commit();
|
||||
void setNeedsCommit(bool commit) {
|
||||
mNeedsCommit = commit;
|
||||
}
|
||||
CommittableFlagManager() {
|
||||
mNeedsCommit = false;
|
||||
}
|
||||
CommittableFlagManager(bool commit) {
|
||||
mNeedsCommit = commit;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#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 commit();
|
||||
|
||||
/** 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,41 @@
|
||||
#ifndef D_FLAG_ENEMYFLAG_MANAGER_H
|
||||
#define D_FLAG_ENEMYFLAG_MANAGER_H
|
||||
|
||||
#include "d/flag/bitwise_flag_helper.h"
|
||||
#include "d/flag/committable_flag_manager.h"
|
||||
#include "d/flag/flag_space.h"
|
||||
#include "toBeSorted/file_manager.h"
|
||||
|
||||
class EnemyflagManager : public CommittableFlagManager {
|
||||
public:
|
||||
FlagSpace mFlagSpace;
|
||||
BitwiseFlagHelper mFlagHelper;
|
||||
u16 mSceneIndex;
|
||||
|
||||
static u16 sEnemyDefeatFlags[4096];
|
||||
|
||||
static EnemyflagManager *sInstance;
|
||||
|
||||
void clearSavedFlags();
|
||||
bool checkUncommittedFlag(u16 flag);
|
||||
u16 checkUncommittedFlag2(u16 flag) {
|
||||
return checkUncommittedFlag(flag);
|
||||
}
|
||||
EnemyflagManager();
|
||||
void init();
|
||||
void copyFromSave(u16 sceneIndex);
|
||||
void updateFlagIndex(u16 sceneIndex);
|
||||
void clearAll();
|
||||
bool checkIsValidFlag(u16 flag);
|
||||
bool checkFlag(u16 flag);
|
||||
virtual ~EnemyflagManager() {}
|
||||
virtual u16 getFlagCount() const;
|
||||
void setFlag(u16 flag);
|
||||
|
||||
virtual void doCommit() override {
|
||||
FileManager *mgr = FileManager::sInstance;
|
||||
mgr->setEnemyDefeatFlags(mFlagSpace.getFlagPtrUnchecked(), 0, 0x1000);
|
||||
};
|
||||
};
|
||||
|
||||
#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
|
||||
@@ -0,0 +1,13 @@
|
||||
#ifndef D_FLAG_FLAG_MANAGERS_H
|
||||
#define D_FLAG_FLAG_MANAGERS_H
|
||||
|
||||
#include "egg/core/eggHeap.h"
|
||||
|
||||
void setupFlagManagers(EGG::Heap *heap);
|
||||
void copyAllFlagManagersFromSave();
|
||||
void updateFlagForFlagIndex(u16 stage);
|
||||
void commitAllFlagManagers();
|
||||
|
||||
bool checkedMemcpy(void *dest, u32 destLen, const void *src, u32 count);
|
||||
|
||||
#endif
|
||||
@@ -16,13 +16,13 @@ public:
|
||||
mCount = count;
|
||||
}
|
||||
FlagSpace(u16 *pFlags, u16 count) : BaseFlagSpace(pFlags, count) {}
|
||||
u16 *getFlagPtrChecked();
|
||||
u16 *getFlagPtrUnchecked();
|
||||
u16 *getFlagPtrChecked() const;
|
||||
u16 *getFlagPtrUnchecked() const;
|
||||
void unsetAll();
|
||||
void setAllToZero(u16 offset, u16 flagCount);
|
||||
void copyFromSaveFile2(u16 *pSaved, u16 offset, u16 flagCount);
|
||||
void copyFromSaveFile(u16 *pSaved, u16 offset, u16 flagCount);
|
||||
virtual void filemanagerCheck();
|
||||
void copyFromSaveFile2(const u16 *pSaved, u16 offset, u16 flagCount);
|
||||
void copyFromSaveFile(const u16 *pSaved, u16 offset, u16 flagCount);
|
||||
virtual void filemanagerCheck() const;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,60 @@
|
||||
|
||||
#ifndef D_FLAG_ITEMFLAG_MANAGER_H
|
||||
#define D_FLAG_ITEMFLAG_MANAGER_H
|
||||
|
||||
#include "d/flag/baseflag_manager.h"
|
||||
#include "toBeSorted/file_manager.h"
|
||||
|
||||
|
||||
class ItemflagManager : public ItemStoryManagerBase {
|
||||
public:
|
||||
FlagSpace mItemFlags;
|
||||
|
||||
ItemflagManager();
|
||||
virtual ~ItemflagManager() {}
|
||||
|
||||
bool commit();
|
||||
|
||||
/** 0x0C */ virtual void initFlagSpace() override {
|
||||
mpFlagSpace = &mItemFlags;
|
||||
}
|
||||
/** 0x10 */ virtual void onDirty() override;
|
||||
/** 0x14 */ virtual void copyFlagsFromSaveFirstTime();
|
||||
/** 0x18 */ virtual void setupFlagIndex();
|
||||
/** 0x1C */ virtual void doCommit() {
|
||||
u16 sz = mFlagCount;
|
||||
u16 *flags = mpFlagSpace->getFlagPtrUnchecked();
|
||||
FileManager::sInstance->setItemFlags(flags, 0, sz);
|
||||
}
|
||||
/** 0x20 */ virtual void setFlag(u16 flag) {
|
||||
ItemStoryManagerBase::setFlag(flag & ~0x4000);
|
||||
}
|
||||
/** 0x24 */ virtual void unsetFlag(u16 flag) {
|
||||
ItemStoryManagerBase::unsetFlag(flag & ~0x4000);
|
||||
}
|
||||
/** 0x28 */ virtual void setFlagOrCounterToValue(u16 flag, u16 value) {
|
||||
ItemStoryManagerBase::setFlagOrCounterToValue(flag & ~0x4000, value);
|
||||
}
|
||||
/** 0x2C */ virtual u16 getCounterOrFlag(u16 flag) const {
|
||||
return ItemStoryManagerBase::getCounterOrFlag(flag & ~0x4000);
|
||||
}
|
||||
/** 0x30 */ virtual u16 getUncommittedValue(u16 flag) {
|
||||
return ItemStoryManagerBase::getUncommittedValue(flag & ~0x4000);
|
||||
}
|
||||
/** 0x34 */ virtual u16 unk3(u16 arg) {
|
||||
return ItemStoryManagerBase::unk3(arg & ~0x4000);
|
||||
}
|
||||
/** 0x38 */ virtual const u16 *getSaveFlagSpace() const {
|
||||
return FileManager::sInstance->getItemFlagsConst();
|
||||
};
|
||||
|
||||
u16 getFlagDirect(u16 flag) {
|
||||
return ItemStoryManagerBase::getCounterOrFlag(flag);
|
||||
}
|
||||
|
||||
public:
|
||||
static ItemflagManager *sInstance;
|
||||
static u16 sFlags[0x40];
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -2,8 +2,8 @@
|
||||
#define SCENEFLAG_MANAGER_H
|
||||
|
||||
#include "common.h"
|
||||
#include "toBeSorted/bitwise_flag_helper.h"
|
||||
#include "toBeSorted/flag_space.h"
|
||||
#include "d/flag/bitwise_flag_helper.h"
|
||||
#include "d/flag/flag_space.h"
|
||||
|
||||
|
||||
class SceneflagManager {
|
||||
@@ -20,7 +20,7 @@ public:
|
||||
static u16 sZoneFlags[0xFC];
|
||||
|
||||
static SceneflagManager *sInstance;
|
||||
void doNothing();
|
||||
void init();
|
||||
void setShouldCommit(u16 flag);
|
||||
SceneflagManager();
|
||||
s32 isNotTempOrZoneFlag(u16 flag);
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
void unsetFlag(u16 roomId, u16 flag);
|
||||
void unsetSceneflagGlobal(u16 sceneIdx, u16 flag);
|
||||
void unsetTempOrSceneflag(u16 flag);
|
||||
s32 doCommit();
|
||||
s32 commit();
|
||||
|
||||
bool checkBoolFlag(u16 roomid, u16 flag) {
|
||||
return checkFlag(roomid, flag);
|
||||
@@ -0,0 +1,30 @@
|
||||
#ifndef D_FLAG_SKIPFLAG_MANAGER_H
|
||||
#define D_FLAG_SKIPFLAG_MANAGER_H
|
||||
|
||||
|
||||
#include "d/flag/bitwise_flag_helper.h"
|
||||
#include "d/flag/flag_space.h"
|
||||
|
||||
class SkipflagManager {
|
||||
public:
|
||||
SkipflagManager();
|
||||
void init();
|
||||
|
||||
void setCommitFlag(u16 flag);
|
||||
void copyFromSave();
|
||||
void setFlag(u16 flag);
|
||||
bool checkFlag(u16 flag);
|
||||
bool commit();
|
||||
static SkipflagManager *sInstance;
|
||||
|
||||
private:
|
||||
void doCopyFromSave();
|
||||
|
||||
static u16 sSkipFlags[16];
|
||||
|
||||
bool mShouldCommit;
|
||||
BitwiseFlagHelper mFlagHelper;
|
||||
FlagSpace mFlagSpace;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,38 @@
|
||||
#ifndef D_FLAG_STORYFLAG_MANAGER_H
|
||||
#define D_FLAG_STORYFLAG_MANAGER_H
|
||||
|
||||
#include "d/flag/baseflag_manager.h"
|
||||
#include "toBeSorted/file_manager.h"
|
||||
|
||||
class StoryflagManager : public ItemStoryManagerBase {
|
||||
public:
|
||||
StoryflagManager();
|
||||
|
||||
virtual ~StoryflagManager() {}
|
||||
|
||||
FlagSpace mStoryFlags;
|
||||
|
||||
bool commit();
|
||||
|
||||
/** 0x0C */ virtual void initFlagSpace() override {
|
||||
mpFlagSpace = &mStoryFlags;
|
||||
}
|
||||
/** 0x10 */ virtual void onDirty() override;
|
||||
/** 0x14 */ virtual void copyFlagsFromSaveFirstTime() override;
|
||||
/** 0x18 */ virtual void setupFlagIndex() override;
|
||||
/** 0x1C */ virtual void doCommit() override {
|
||||
u16 sz = mFlagCount;
|
||||
u16 *flags = mpFlagSpace->getFlagPtrUnchecked();
|
||||
FileManager::sInstance->setStoryFlags(flags, 0, sz);
|
||||
}
|
||||
/** 0x24 */ virtual void unsetFlag(u16 flag) override;
|
||||
/** 0x38 */ virtual const u16 *getSaveFlagSpace() const override {
|
||||
return FileManager::sInstance->getStoryFlagsConst();
|
||||
};
|
||||
|
||||
public:
|
||||
static StoryflagManager *sInstance;
|
||||
static u16 sFlags[0x80];
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,33 @@
|
||||
#ifndef D_FLAG_TBOXFLAG_MANAGER_H
|
||||
#define D_FLAG_TBOXFLAG_MANAGER_H
|
||||
|
||||
#include "d/flag/bitwise_flag_helper.h"
|
||||
#include "d/flag/committable_flag_manager.h"
|
||||
#include "d/flag/flag_space.h"
|
||||
|
||||
class TBoxflagManager : public CommittableFlagManager {
|
||||
public:
|
||||
FlagSpace mFlagSpace;
|
||||
u16 mSceneIndex;
|
||||
BitwiseFlagHelper mFlagHelper;
|
||||
|
||||
static u16 sTBoxFlags[2];
|
||||
|
||||
static TBoxflagManager *sInstance;
|
||||
|
||||
virtual void doCommit() override;
|
||||
bool checkUncommittedFlag(u16 flag);
|
||||
TBoxflagManager();
|
||||
virtual ~TBoxflagManager() {}
|
||||
void init();
|
||||
void copyFromSave(u32 sceneIndex);
|
||||
bool checkFlag(u16 sceneIndex, u16 flag);
|
||||
virtual u16 getFlagCount() const;
|
||||
void setFlag(u16 flag);
|
||||
bool checkUncommittedFlag(u16 sceneIndex, u16 flag);
|
||||
u16 checkUncommittedFlag2(u16 flag) {
|
||||
return checkUncommittedFlag(flag);
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -7,7 +7,6 @@ extern "C" {
|
||||
|
||||
// void *memset(void *dest, s32 value, u32 count);
|
||||
// void *memcpy(void *dest, const void *src, u32 count);
|
||||
void *checkedMemcpy(void *dest, u16 destLen, const void *src, u16 count);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#ifndef FILE_MANAGER_H
|
||||
#define FILE_MANAGER_H
|
||||
|
||||
#include "common.h"
|
||||
#include "egg/core/eggHeap.h"
|
||||
#include "m/m_angle.h"
|
||||
@@ -76,7 +79,7 @@ public:
|
||||
/* 8000A330 */ u16 *getStoryFlagsMut();
|
||||
/* 8000A360 */ const u16 *getStoryFlagsConst() const;
|
||||
/* 8000A3B0 */ u16 *getItemFlagsMut();
|
||||
/* 8000A3E0 */ u16 *getItemFlagsConst();
|
||||
/* 8000A3E0 */ const u16 *getItemFlagsConst();
|
||||
/* 8000A430 */ u16 *getDungeonFlagsMut();
|
||||
/* 8000A460 */ u16 *getDungeonFlagsConst();
|
||||
/* 8000A4B0 */ u16 *getSceneFlagsMut();
|
||||
@@ -210,7 +213,7 @@ public:
|
||||
/* 8000CAD0 */ bool isNew_FileA();
|
||||
|
||||
/* 8000CB00 */ void setSceneFlagIndex(u16 idx);
|
||||
/* 8000CB30 */ u16 getSceneFlagIndex();
|
||||
/* 8000CB30 */ u32 getSceneFlagIndex();
|
||||
/* 8000CB80 */ s32 getFileAreaIndex();
|
||||
|
||||
/* 8000CBD0 */ void fn_8000CBD0(u8);
|
||||
@@ -285,3 +288,5 @@ public:
|
||||
}
|
||||
static FileManager *sInstance;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
#ifndef ITEM_STORY_FLAG_MANAGER_H
|
||||
#define ITEM_STORY_FLAG_MANAGER_H
|
||||
|
||||
#include "toBeSorted/flag_space.h"
|
||||
#include "toBeSorted/unk_flag_stuff.h"
|
||||
|
||||
// TODO These classes have an interesting relation and there are like 5 vtables, so
|
||||
// the stuff in this header should not be relied upon for actually implementing these,
|
||||
// but we need the interface
|
||||
|
||||
class ItemStoryManagerBase {
|
||||
public:
|
||||
ItemStoryManagerBase();
|
||||
|
||||
/** 0x08 */ virtual ~ItemStoryManagerBase();
|
||||
/** 0x0C */ virtual void setFlagszptr();
|
||||
/** 0x10 */ virtual void onDirty();
|
||||
/** 0x14 */ virtual void copyFlagsFromSave() = 0;
|
||||
/** 0x18 */ virtual void setupUnkFlagsStuff() = 0;
|
||||
/** 0x1C */ virtual bool doCommit() = 0;
|
||||
/** 0x20 */ virtual void setFlag(u16 flag);
|
||||
/** 0x24 */ virtual void unsetFlag(u16 flag);
|
||||
/** 0x28 */ virtual void setFlagOrCounterToValue(u16 flag, u16 value);
|
||||
/** 0x2C */ virtual u16 getCounterOrFlag(u16 flag) const;
|
||||
/** 0x30 */ virtual u16 getUncommittedValue(u16 flag);
|
||||
/** 0x34 */ virtual void unk3();
|
||||
/** 0x38 */ virtual u16 *getSaveFlagSpace() = 0;
|
||||
|
||||
u16 getFlag(u16 flag) const;
|
||||
};
|
||||
|
||||
class StoryflagManager : public ItemStoryManagerBase {
|
||||
FlagSpace storyFlags;
|
||||
|
||||
public:
|
||||
static StoryflagManager *sInstance;
|
||||
};
|
||||
|
||||
class ItemflagManager : public ItemStoryManagerBase {
|
||||
FlagSpace itemFlags;
|
||||
|
||||
public:
|
||||
static ItemflagManager *sInstance;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,79 +0,0 @@
|
||||
#ifndef MISC_FLAG_MANAGERS_H
|
||||
#define MISC_FLAG_MANAGERS_H
|
||||
|
||||
#include "common.h"
|
||||
#include "toBeSorted/bitwise_flag_helper.h"
|
||||
#include "toBeSorted/flag_space.h"
|
||||
|
||||
class CommittableFlagManager {
|
||||
public:
|
||||
bool mNeedsCommit;
|
||||
|
||||
virtual void doCommit() = 0;
|
||||
bool commitIfNecessary();
|
||||
void setNeedsCommit(bool commit) {
|
||||
mNeedsCommit = commit;
|
||||
}
|
||||
CommittableFlagManager() {
|
||||
mNeedsCommit = false;
|
||||
}
|
||||
CommittableFlagManager(bool commit) {
|
||||
mNeedsCommit = commit;
|
||||
}
|
||||
};
|
||||
|
||||
class TBoxFlagManager : public CommittableFlagManager {
|
||||
public:
|
||||
FlagSpace mFlagSpace;
|
||||
u16 mSceneIndex;
|
||||
BitwiseFlagHelper mFlagHelper;
|
||||
|
||||
static u16 sTBoxFlags[2];
|
||||
|
||||
static TBoxFlagManager *sInstance;
|
||||
|
||||
virtual void doCommit() override;
|
||||
bool checkUncommittedFlag(u16 flag);
|
||||
TBoxFlagManager();
|
||||
virtual ~TBoxFlagManager() {}
|
||||
void init();
|
||||
void copyFromSave(s16 sceneIndex);
|
||||
bool checkFlag(u16 sceneIndex, u16 flag);
|
||||
virtual u16 getFlagCount() const;
|
||||
void setFlag(u16 flag);
|
||||
bool checkUncommittedFlag(u16 sceneIndex, u16 flag);
|
||||
u16 checkUncommittedFlag2(u16 flag) {
|
||||
return checkUncommittedFlag(flag);
|
||||
}
|
||||
};
|
||||
|
||||
// NOTE: Not actually Enemy Defeat.
|
||||
// This is a little more than that, it keeps track of live objects based on their id as a whole
|
||||
class EnemyDefeatManager : public CommittableFlagManager {
|
||||
public:
|
||||
FlagSpace mFlagSpace;
|
||||
BitwiseFlagHelper mFlagHelper;
|
||||
u16 mSceneIndex;
|
||||
|
||||
static u16 sEnemyDefeatFlags[4096];
|
||||
|
||||
static EnemyDefeatManager *sInstance;
|
||||
|
||||
void clearSavedFlags();
|
||||
bool checkUncommittedFlag(u16 flag);
|
||||
u16 checkUncommittedFlag2(u16 flag) {
|
||||
return checkUncommittedFlag(flag);
|
||||
}
|
||||
EnemyDefeatManager();
|
||||
void init();
|
||||
void copyFromSave(u16 sceneIndex);
|
||||
void updateFlagIndex(u16 sceneIndex);
|
||||
void clearAll();
|
||||
bool checkIsValidFlag(u16 flag);
|
||||
bool checkFlag(u16 flag);
|
||||
virtual ~EnemyDefeatManager() {}
|
||||
virtual u16 getFlagCount() const;
|
||||
void setFlag(u16 flag);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -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);
|
||||
u32 getCounterOrFlag(u16 counterIdx, 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