| 1 | #pragma once |
| 2 | |
| 3 | #include <container/seadPtrArray.h> |
| 4 | #include <math/seadVector.h> |
| 5 | #include <prim/seadSafeString.h> |
| 6 | |
| 7 | #include "Library/Scene/GameDataHolderBase.h" |
| 8 | |
| 9 | #include "Scene/SceneObjFactory.h" |
| 10 | |
| 11 | namespace al { |
| 12 | class PlacementId; |
| 13 | class PlacementInfo; |
| 14 | class LayoutInitInfo; |
| 15 | } // namespace al |
| 16 | |
| 17 | namespace ShopItem { |
| 18 | struct ItemInfo; |
| 19 | struct ShopItemInfo; |
| 20 | } // namespace ShopItem |
| 21 | |
| 22 | class AchievementInfoReader; |
| 23 | class AchievementHolder; |
| 24 | class CapMessageBossData; |
| 25 | class ChangeStageInfo; |
| 26 | class Coin; |
| 27 | class GameDataFile; |
| 28 | class GameConfigData; |
| 29 | class GameSequenceInfo; |
| 30 | class MapDataHolder; |
| 31 | class QuestInfoHolder; |
| 32 | class SaveDataAccessSequence; |
| 33 | class TemporaryScenarioCameraHolder; |
| 34 | class TempSaveData; |
| 35 | class TimeBalloonSequenceInfo; |
| 36 | class UniqObjInfo; |
| 37 | class WorldList; |
| 38 | |
| 39 | class GameDataHolder : public al::GameDataHolderBase, |
| 40 | public al::ISceneObj, |
| 41 | public al::HioNode, |
| 42 | public al::IUseMessageSystem { |
| 43 | public: |
| 44 | static constexpr s32 sSceneObjId = SceneObjID_GameDataHolder; |
| 45 | |
| 46 | struct ChangeStageItem { |
| 47 | sead::FixedSafeString<128> srcStageName; |
| 48 | sead::FixedSafeString<128> srcLabel; |
| 49 | sead::FixedSafeString<128> destStageName; |
| 50 | sead::FixedSafeString<128> destLabel; |
| 51 | }; |
| 52 | |
| 53 | static_assert(sizeof(ChangeStageItem) == 0x260); |
| 54 | |
| 55 | struct WorldWarpHoleInfo { |
| 56 | sead::FixedSafeString<128> stageName; |
| 57 | s32 worldId; |
| 58 | s32 scenarioNo; |
| 59 | sead::FixedSafeString<128> name; |
| 60 | }; |
| 61 | |
| 62 | static_assert(sizeof(WorldWarpHoleInfo) == 0x138); |
| 63 | |
| 64 | struct WorldItemTypeInfo { |
| 65 | sead::FixedSafeString<128> coinCollect; |
| 66 | sead::FixedSafeString<128> coinCollectEmpty; |
| 67 | sead::FixedSafeString<128> coinCollect2D; |
| 68 | sead::FixedSafeString<128> coinCollectEmpty2D; |
| 69 | s32 shineAnimFrame; |
| 70 | }; |
| 71 | |
| 72 | static_assert(sizeof(WorldItemTypeInfo) == 0x268); |
| 73 | |
| 74 | struct StageLockInfo { |
| 75 | s32* shineNumInfo; |
| 76 | s32 shineNumInfoNum; |
| 77 | bool isCountTotal; |
| 78 | bool isCrash; |
| 79 | }; |
| 80 | |
| 81 | static_assert(sizeof(StageLockInfo) == 0x10); |
| 82 | |
| 83 | struct HackObjInfo { |
| 84 | const char* hackName; |
| 85 | f32 guideHeight; |
| 86 | f32 stayGravityMargine; |
| 87 | bool isScare; |
| 88 | bool isNoCollisionMsg; |
| 89 | bool isNoSeparateCameraInput; |
| 90 | bool isUsePlayerCollision; |
| 91 | bool isUseCollisionPartsFilterActor; |
| 92 | bool isGuideEnable; |
| 93 | const char* tutorialName; |
| 94 | }; |
| 95 | |
| 96 | static_assert(sizeof(HackObjInfo) == 0x20); |
| 97 | |
| 98 | struct InvalidOpenMapInfo { |
| 99 | const char* name; |
| 100 | s32 scenario; |
| 101 | }; |
| 102 | |
| 103 | static_assert(sizeof(InvalidOpenMapInfo) == 0x10); |
| 104 | |
| 105 | GameDataHolder(const al::MessageSystem* messageSystem); |
| 106 | GameDataHolder(); |
| 107 | |
| 108 | ~GameDataHolder() override; |
| 109 | |
| 110 | const char* getSceneObjName() const override; |
| 111 | al::MessageSystem* getMessageSystem() const override; |
| 112 | |
| 113 | void setPlayingFileId(s32 fileId); |
| 114 | void initializeData(); |
| 115 | void initializeDataCommon(); |
| 116 | void resetTempSaveData(bool isSwap); |
| 117 | void initializeDataId(s32 fileId); |
| 118 | void readByamlData(s32 fileId, const char* fileName); |
| 119 | s32 tryFindEmptyFileId() const; |
| 120 | void createSaveDataAccessSequence(const al::LayoutInitInfo& layoutInitInfo); |
| 121 | void createSaveDataAccessSequenceDevelop(const al::LayoutInitInfo& layoutInitInfo); |
| 122 | bool isRequireSave() const; |
| 123 | void setRequireSave(); |
| 124 | void setRequireSaveFalse(); |
| 125 | void setRequireSaveFrame(); |
| 126 | void updateRequireSaveFrame(); |
| 127 | bool isInvalidSaveForMoonGet() const; |
| 128 | void invalidateSaveForMoonGet(); |
| 129 | void validateSaveForMoonGet(); |
| 130 | void setLanguage(const char* language); |
| 131 | const char* getLanguage() const; |
| 132 | void changeNextStage(const ChangeStageInfo* changeStageInfo, s32 raceType = 0); |
| 133 | void resetLocationName(); |
| 134 | void changeNextStageWithDemoWorldWarp(const char* stageName); |
| 135 | bool tryChangeNextStageWithWorldWarpHole(const char* changeStageId); |
| 136 | void returnPrevStage(); |
| 137 | const char* getNextStageName() const; |
| 138 | const char* getNextStageName(s32 fileId) const; |
| 139 | GameDataFile* getGameDataFile(s32 fileId) const; |
| 140 | const char* getNextPlayerStartId() const; |
| 141 | const char* getCurrentStageName() const; |
| 142 | const char* tryGetCurrentStageName() const; |
| 143 | const char* getCurrentStageName(s32 fileId) const; |
| 144 | void setCheckpointId(const al::PlacementId* placementId); |
| 145 | const char* tryGetRestartPointIdString() const; |
| 146 | void endStage(); |
| 147 | void startStage(const char* stageName, s32 scenarioNo); |
| 148 | void onObjNoWriteSaveData(const al::PlacementId* placementId); |
| 149 | void offObjNoWriteSaveData(const al::PlacementId* placementId); |
| 150 | bool isOnObjNoWriteSaveData(const al::PlacementId* placementId) const; |
| 151 | void onObjNoWriteSaveDataResetMiniGame(const al::PlacementId* placementId); |
| 152 | void offObjNoWriteSaveDataResetMiniGame(const al::PlacementId* placementId); |
| 153 | bool isOnObjNoWriteSaveDataResetMiniGame(const al::PlacementId* placementId) const; |
| 154 | void onObjNoWriteSaveDataInSameScenario(const al::PlacementId* placementId); |
| 155 | bool isOnObjNoWriteSaveDataInSameScenario(const al::PlacementId* placementId) const; |
| 156 | void writeTempSaveDataToHash(const char* hashName, bool value); |
| 157 | bool findValueFromTempSaveDataHash(const char* hashName); |
| 158 | void resetMiniGameData(); |
| 159 | s32 getPlayingFileId() const; |
| 160 | s32 getPlayingOrNextFileId() const; |
| 161 | void requestSetPlayingFileId(s32 fileId); |
| 162 | void receiveSetPlayingFileIdMsg(); |
| 163 | GameDataFile* findGameDataFile(const char* fileName) const; |
| 164 | GameDataFile* findFileByName(const char* fileName) const; |
| 165 | void resetScenarioStartCamera(); |
| 166 | void resetTempSaveDataInSameScenario(); |
| 167 | void readFromSaveDataBuffer(const char* fileName); |
| 168 | bool tryReadByamlDataCommon(const u8* byamlData); |
| 169 | void readFromSaveDataBufferCommonFileOnlyLanguage(); |
| 170 | void writeToSaveBuffer(const char* fileName); |
| 171 | void updateSaveInfoForDisp(const char* fileName); |
| 172 | void updateSaveTimeForDisp(const char* fileName); |
| 173 | s32 findUnlockShineNum(bool* isCountTotal, s32 worldId) const; |
| 174 | s32 calcBeforePhaseWorldNumMax(s32 worldId) const; |
| 175 | bool isFindKoopaNext(s32 worldId) const; |
| 176 | bool isBossAttackedHomeNext(s32 worldId) const; |
| 177 | void playScenarioStartCamera(s32 questNo); |
| 178 | bool isPlayAlreadyScenarioStartCamera(s32 questNo) const; |
| 179 | const sead::PtrArray<ShopItem::ItemInfo>& getShopItemInfoList() const; |
| 180 | bool checkNeedTreasureMessageStage(const char* stageName) const; |
| 181 | bool tryFindLinkDestStageInfo(const char** destStageName, const char** destLabel, |
| 182 | const char* srcStageName, const char* srcLabel) const; |
| 183 | bool isShowHackTutorial(const char* hackName, const char* suffix) const; |
| 184 | void setShowHackTutorial(const char* hackName, const char* suffix); |
| 185 | bool isShowBindTutorial(const char* bindName) const; |
| 186 | const char* getCoinCollectArchiveName(s32 worldId) const; |
| 187 | const char* getCoinCollectEmptyArchiveName(s32 worldId) const; |
| 188 | const char* getCoinCollect2DArchiveName(s32 worldId) const; |
| 189 | const char* getCoinCollect2DEmptyArchiveName(s32 worldId) const; |
| 190 | s32 getShineAnimFrame(s32 worldId) const; |
| 191 | s32 getCoinCollectNumMax(s32 worldId) const; |
| 192 | bool isInvalidOpenMapStage(const char* stageName, s32 scenarioNo) const; |
| 193 | void setShowBindTutorial(const char* bindName); |
| 194 | s32 tryCalcWorldWarpHoleSrcId(s32 destId) const; |
| 195 | s32 calcWorldWarpHoleDestId(s32 srcId) const; |
| 196 | s32 calcWorldWarpHoleIdFromWorldId(s32 worldId) const; |
| 197 | s32 calcWorldIdFromWorldWarpHoleId(s32 worldWarpHoleId) const; |
| 198 | void calcWorldWarpHoleLabelAndStageName(sead::BufferedSafeString* label, |
| 199 | sead::BufferedSafeString* stageName, |
| 200 | const char* srcLabel, s32 worldId) const; |
| 201 | // TODO: parameter name |
| 202 | const WorldWarpHoleInfo* findWorldWarpHoleInfo(s32 worldId, s32, const char* label) const; |
| 203 | bool checkIsOpenWorldWarpHoleInScenario(s32 worldId, s32 scenarioNo) const; |
| 204 | void setLocationName(const al::PlacementInfo* placementInfo); |
| 205 | bool isPrevLocation(const al::PlacementInfo* placementInfo) const; |
| 206 | void setCoinTransForDeadPlayer(const sead::PtrArray<Coin>& coins, s32 coinNum); |
| 207 | const sead::Vector3f& getCoinTransForDeadPlayer(s32 coinIdx); |
| 208 | void setSeparatePlay(bool isSeparatePlay); |
| 209 | CapMessageBossData* getCapMessageBossData() const; |
| 210 | s32 findUseScenarioNo(const char* stageName) const; |
| 211 | |
| 212 | GameDataFile* getGameDataFile() const { return mPlayingFile; } |
| 213 | |
| 214 | const sead::PtrArray<ShopItem::ItemInfo>& getClothList() const { return mItemCloth; } |
| 215 | |
| 216 | const sead::PtrArray<ShopItem::ItemInfo>& getCapList() const { return mItemCap; } |
| 217 | |
| 218 | const sead::PtrArray<ShopItem::ItemInfo>& getGiftList() const { return mItemGift; } |
| 219 | |
| 220 | const sead::PtrArray<ShopItem::ItemInfo>& getStickerList() const { return mItemSticker; } |
| 221 | |
| 222 | WorldList* getWorldList() const { return mWorldList; } |
| 223 | |
| 224 | GameSequenceInfo* getSequenceInfo() const { return mSequenceInfo; } |
| 225 | |
| 226 | private: |
| 227 | al::MessageSystem* mMessageSystem; |
| 228 | GameDataFile** mFiles; |
| 229 | GameDataFile* mPlayingFile; |
| 230 | GameDataFile* mNextFile; |
| 231 | s32 mPlayingFileId; |
| 232 | SaveDataAccessSequence* mSaveDataAccessSequence; |
| 233 | bool mIsRequireSave; |
| 234 | u32 mRequireSaveFrame; |
| 235 | bool mIsInvalidSaveForMoonGet; |
| 236 | bool _48; // related to changeNextStage(WithWorldDemoWarp) |
| 237 | bool _4a; // related to endStage |
| 238 | sead::FixedSafeString<32> mLanguage; |
| 239 | u64 mPlayTimeAcrossFiles; |
| 240 | sead::Heap* mSaveDataWriteThread; |
| 241 | const u8* mSaveDataWorkBuffer; |
| 242 | GameConfigData* mGameConfigData; |
| 243 | TempSaveData* mTempSaveData; |
| 244 | TempSaveData* mTempSaveDataBackup; |
| 245 | CapMessageBossData* mCapMessageBossData; |
| 246 | void* _c0; |
| 247 | void* _c8; |
| 248 | TemporaryScenarioCameraHolder* mTemporaryScenarioCameraHolder; |
| 249 | bool* mIsPlayAlreadyScenarioStartCamera; |
| 250 | sead::PtrArray<StageLockInfo> mStageLockList; |
| 251 | sead::PtrArray<ShopItem::ItemInfo> mShopItemList; |
| 252 | sead::PtrArray<ShopItem::ItemInfo> mShopItemListE3; |
| 253 | sead::PtrArray<ShopItem::ItemInfo> mItemCloth; |
| 254 | sead::PtrArray<ShopItem::ItemInfo> mItemCap; |
| 255 | sead::PtrArray<ShopItem::ItemInfo> mItemGift; |
| 256 | sead::PtrArray<ShopItem::ItemInfo> mItemSticker; |
| 257 | sead::PtrArray<HackObjInfo> mHackObjList; |
| 258 | sead::PtrArray<sead::FixedSafeString<64>> _160; |
| 259 | void* _170; |
| 260 | s32 _178; |
| 261 | AchievementInfoReader* mAchievementInfoReader; |
| 262 | AchievementHolder* mAchievementHolder; |
| 263 | WorldList* mWorldList; |
| 264 | sead::PtrArray<ChangeStageItem> mChangeStageList; |
| 265 | sead::PtrArray<sead::FixedSafeString<128>> mExStageList; |
| 266 | sead::PtrArray<InvalidOpenMapInfo> mInvalidOpenMapList; |
| 267 | sead::PtrArray<sead::FixedSafeString<128>> mShowHackTutorialList; |
| 268 | bool* mIsShowBindTutorial; |
| 269 | MapDataHolder* mMapDataHolder; |
| 270 | sead::PtrArray<WorldItemTypeInfo> mWorldItemTypeInfo; |
| 271 | s32* mCoinCollectNumMax; |
| 272 | s32* mWorldWarpHoleDestIds; |
| 273 | WorldWarpHoleInfo* mWorldWarpHoleInfos; |
| 274 | s32 mWorldWarpHoleInfoNum; |
| 275 | UniqObjInfo* mLocationName; |
| 276 | bool _220; |
| 277 | s32 _224; |
| 278 | bool mIsValidCheckpointWarp; |
| 279 | sead::Vector3f mStageMapPlayerPos; |
| 280 | sead::Vector3f* mCoinTransForDeadPlayer; |
| 281 | s32 mDeadPlayerCoinIdx; |
| 282 | bool _244; |
| 283 | bool mIsSeparatePlay; |
| 284 | bool mIsPlayDemoLavaErupt; |
| 285 | QuestInfoHolder* mQuestInfoHolder; |
| 286 | bool _250; // related to resetTempSaveData |
| 287 | GameSequenceInfo* mSequenceInfo; |
| 288 | TimeBalloonSequenceInfo* mTimeBalloonSequenceInfo; |
| 289 | }; |
| 290 | |
| 291 | static_assert(sizeof(GameDataHolder) == 0x268); |
| 292 | |