diff --git a/targets/app/common/AppGameServices.cpp b/targets/app/common/AppGameServices.cpp new file mode 100644 index 000000000..1795a00fb --- /dev/null +++ b/targets/app/common/AppGameServices.cpp @@ -0,0 +1,463 @@ +#include "app/common/AppGameServices.h" + +#include "app/common/Game.h" +#include "java/Class.h" // eINSTANCEOF + +AppGameServices::AppGameServices(Game& game, IMenuService& menus) + : game_(game), menus_(menus) {} + +// -- Strings -- + +const wchar_t* AppGameServices::getString(int id) { + return Game::GetString(id); +} + +// -- Debug settings -- + +bool AppGameServices::debugSettingsOn() { + return game_.DebugSettingsOn(); +} + +bool AppGameServices::debugArtToolsOn() { + return game_.DebugArtToolsOn(); +} + +unsigned int AppGameServices::debugGetMask(int iPad, bool overridePlayer) { + return game_.GetGameSettingsDebugMask(iPad, overridePlayer); +} + +bool AppGameServices::debugMobsDontAttack() { + return game_.GetMobsDontAttackEnabled(); +} + +bool AppGameServices::debugMobsDontTick() { + return game_.GetMobsDontTickEnabled(); +} + +bool AppGameServices::debugFreezePlayers() { + return game_.GetFreezePlayers(); +} + +// -- Game host options -- + +unsigned int AppGameServices::getGameHostOption(eGameHostOption option) { + return game_.GetGameHostOption(option); +} + +void AppGameServices::setGameHostOption(eGameHostOption option, + unsigned int value) { + game_.SetGameHostOption(option, value); +} + +// -- Level generation -- + +LevelGenerationOptions* AppGameServices::getLevelGenerationOptions() { + return game_.getLevelGenerationOptions(); +} + +LevelRuleset* AppGameServices::getGameRuleDefinitions() { + return game_.getGameRuleDefinitions(); +} + +// -- Texture cache -- + +void AppGameServices::addMemoryTextureFile(const std::wstring& name, + std::uint8_t* data, + unsigned int size) { + game_.AddMemoryTextureFile(name, data, size); +} + +void AppGameServices::removeMemoryTextureFile(const std::wstring& name) { + game_.RemoveMemoryTextureFile(name); +} + +void AppGameServices::getMemFileDetails(const std::wstring& name, + std::uint8_t** data, + unsigned int* size) { + game_.GetMemFileDetails(name, data, size); +} + +bool AppGameServices::isFileInMemoryTextures(const std::wstring& name) { + return game_.IsFileInMemoryTextures(name); +} + +// -- Player settings -- + +unsigned char AppGameServices::getGameSettings(int iPad, int setting) { + return game_.GetGameSettings(iPad, static_cast(setting)); +} + +unsigned char AppGameServices::getGameSettings(int setting) { + return game_.GetGameSettings(static_cast(setting)); +} + +// -- App time -- + +float AppGameServices::getAppTime() { + return game_.getAppTime(); +} + +// -- Game state -- + +bool AppGameServices::getGameStarted() { return game_.GetGameStarted(); } +void AppGameServices::setGameStarted(bool val) { game_.SetGameStarted(val); } +bool AppGameServices::getTutorialMode() { return game_.GetTutorialMode(); } +void AppGameServices::setTutorialMode(bool val) { game_.SetTutorialMode(val); } +bool AppGameServices::isAppPaused() { return game_.IsAppPaused(); } +int AppGameServices::getLocalPlayerCount() { return game_.GetLocalPlayerCount(); } +bool AppGameServices::autosaveDue() { return game_.AutosaveDue(); } +void AppGameServices::setAutosaveTimerTime() { game_.SetAutosaveTimerTime(); } +int64_t AppGameServices::secondsToAutosave() { return game_.SecondsToAutosave(); } + +void AppGameServices::setDisconnectReason( + DisconnectPacket::eDisconnectReason reason) { + game_.SetDisconnectReason(reason); +} + +void AppGameServices::lockSaveNotification() { game_.lockSaveNotification(); } +void AppGameServices::unlockSaveNotification() { game_.unlockSaveNotification(); } +bool AppGameServices::getResetNether() { return game_.GetResetNether(); } +bool AppGameServices::getUseDPadForDebug() { return game_.GetUseDPadForDebug(); } + +bool AppGameServices::getWriteSavesToFolderEnabled() { + return game_.GetWriteSavesToFolderEnabled(); +} + +bool AppGameServices::isLocalMultiplayerAvailable() { + return game_.IsLocalMultiplayerAvailable(); +} + +bool AppGameServices::dlcInstallPending() { + return game_.DLCInstallPending(); +} + +bool AppGameServices::dlcInstallProcessCompleted() { + return game_.DLCInstallProcessCompleted(); +} + +bool AppGameServices::canRecordStatsAndAchievements() { + return game_.CanRecordStatsAndAchievements(); +} + +bool AppGameServices::getTMSGlobalFileListRead() { + return game_.GetTMSGlobalFileListRead(); +} + +void AppGameServices::setRequiredTexturePackID(std::uint32_t id) { + game_.SetRequiredTexturePackID(id); +} + +void AppGameServices::setSpecialTutorialCompletionFlag(int iPad, int index) { + game_.SetSpecialTutorialCompletionFlag(iPad, index); +} + +void AppGameServices::setBanListCheck(int iPad, bool val) { + game_.SetBanListCheck(iPad, val); +} + +bool AppGameServices::getBanListCheck(int iPad) { + return game_.GetBanListCheck(iPad); +} + +unsigned int AppGameServices::getGameNewWorldSize() { + return game_.GetGameNewWorldSize(); +} + +unsigned int AppGameServices::getGameNewWorldSizeUseMoat() { + return game_.GetGameNewWorldSizeUseMoat(); +} + +unsigned int AppGameServices::getGameNewHellScale() { + return game_.GetGameNewHellScale(); +} + +// -- UI dispatch -- + +void AppGameServices::setAction(int iPad, eXuiAction action, void* param) { + game_.SetAction(iPad, action, param); +} + +void AppGameServices::setXuiServerAction(int iPad, eXuiServerAction action, + void* param) { + game_.SetXuiServerAction(iPad, action, param); +} + +eXuiAction AppGameServices::getXuiAction(int iPad) { + return game_.GetXuiAction(iPad); +} + +eXuiServerAction AppGameServices::getXuiServerAction(int iPad) { + return game_.GetXuiServerAction(iPad); +} + +void* AppGameServices::getXuiServerActionParam(int iPad) { + return game_.GetXuiServerActionParam(iPad); +} + +void AppGameServices::setGlobalXuiAction(eXuiAction action) { + game_.SetGlobalXuiAction(action); +} + +void AppGameServices::handleButtonPresses() { + game_.HandleButtonPresses(); +} + +void AppGameServices::setTMSAction(int iPad, eTMSAction action) { + game_.SetTMSAction(iPad, action); +} + +// -- Skin / cape / animation -- + +std::wstring AppGameServices::getPlayerSkinName(int iPad) { + return game_.GetPlayerSkinName(iPad); +} + +std::uint32_t AppGameServices::getPlayerSkinId(int iPad) { + return game_.GetPlayerSkinId(iPad); +} + +std::wstring AppGameServices::getPlayerCapeName(int iPad) { + return game_.GetPlayerCapeName(iPad); +} + +std::uint32_t AppGameServices::getPlayerCapeId(int iPad) { + return game_.GetPlayerCapeId(iPad); +} + +std::uint32_t AppGameServices::getAdditionalModelPartsForPad(int iPad) { + return game_.GetAdditionalModelParts(iPad); +} + +void AppGameServices::setAdditionalSkinBoxes(std::uint32_t dwSkinID, + SKIN_BOX* boxA, + unsigned int boxC) { + game_.SetAdditionalSkinBoxes(dwSkinID, boxA, boxC); +} + +std::vector* AppGameServices::getAdditionalSkinBoxes( + std::uint32_t dwSkinID) { + return game_.GetAdditionalSkinBoxes(dwSkinID); +} + +std::vector* AppGameServices::getAdditionalModelParts( + std::uint32_t dwSkinID) { + return game_.GetAdditionalModelParts(dwSkinID); +} + +std::vector* AppGameServices::setAdditionalSkinBoxesFromVec( + std::uint32_t dwSkinID, std::vector* pvSkinBoxA) { + return game_.SetAdditionalSkinBoxes(dwSkinID, pvSkinBoxA); +} + +void AppGameServices::setAnimOverrideBitmask(std::uint32_t dwSkinID, + unsigned int bitmask) { + game_.SetAnimOverrideBitmask(dwSkinID, bitmask); +} + +unsigned int AppGameServices::getAnimOverrideBitmask( + std::uint32_t dwSkinID) { + return game_.GetAnimOverrideBitmask(dwSkinID); +} + +std::uint32_t AppGameServices::getSkinIdFromPath(const std::wstring& skin) { + return Game::getSkinIdFromPath(skin); +} + +std::wstring AppGameServices::getSkinPathFromId(std::uint32_t skinId) { + return Game::getSkinPathFromId(skinId); +} + +bool AppGameServices::defaultCapeExists() { + return game_.DefaultCapeExists(); +} + +bool AppGameServices::isXuidNotch(PlayerUID xuid) { + return game_.isXuidNotch(xuid); +} + +bool AppGameServices::isXuidDeadmau5(PlayerUID xuid) { + return game_.isXuidDeadmau5(xuid); +} + +// -- Platform features -- + +void AppGameServices::fatalLoadError() { game_.FatalLoadError(); } + +void AppGameServices::setRichPresenceContext(int iPad, int contextId) { + game_.SetRichPresenceContext(iPad, contextId); +} + +void AppGameServices::captureSaveThumbnail() { game_.CaptureSaveThumbnail(); } + +void AppGameServices::getSaveThumbnail(std::uint8_t** data, + unsigned int* size) { + game_.GetSaveThumbnail(data, size); +} + +void AppGameServices::readBannedList(int iPad, eTMSAction action, + bool bCallback) { + game_.ReadBannedList(iPad, action, bCallback); +} + +void AppGameServices::updatePlayerInfo(std::uint8_t networkSmallId, + int16_t playerColourIndex, + unsigned int playerPrivileges) { + game_.UpdatePlayerInfo(networkSmallId, playerColourIndex, playerPrivileges); +} + +unsigned int AppGameServices::getPlayerPrivileges( + std::uint8_t networkSmallId) { + return game_.GetPlayerPrivileges(networkSmallId); +} + +void AppGameServices::setGameSettingsDebugMask(int iPad, unsigned int uiVal) { + game_.SetGameSettingsDebugMask(iPad, uiVal); +} + +// -- Schematics / terrain -- + +void AppGameServices::processSchematics(LevelChunk* chunk) { + game_.processSchematics(chunk); +} + +void AppGameServices::processSchematicsLighting(LevelChunk* chunk) { + game_.processSchematicsLighting(chunk); +} + +void AppGameServices::addTerrainFeaturePosition(_eTerrainFeatureType type, + int x, int z) { + game_.AddTerrainFeaturePosition(type, x, z); +} + +bool AppGameServices::getTerrainFeaturePosition(_eTerrainFeatureType type, + int* pX, int* pZ) { + return game_.GetTerrainFeaturePosition(type, pX, pZ); +} + +void AppGameServices::loadDefaultGameRules() { + game_.loadDefaultGameRules(); +} + +// -- Archive / resources -- + +bool AppGameServices::hasArchiveFile(const std::wstring& filename) { + return game_.hasArchiveFile(filename); +} + +std::vector AppGameServices::getArchiveFile( + const std::wstring& filename) { + return game_.getArchiveFile(filename); +} + +// -- Strings / formatting / misc queries -- + +int AppGameServices::getHTMLColour(eMinecraftColour colour) { + return game_.GetHTMLColour(colour); +} + +std::wstring AppGameServices::getEntityName(EntityTypeId type) { + return game_.getEntityName(static_cast(type)); +} + +const wchar_t* AppGameServices::getGameRulesString(const std::wstring& key) { + return game_.GetGameRulesString(key); +} + +unsigned int AppGameServices::createImageTextData(std::uint8_t* textMetadata, + int64_t seed, bool hasSeed, + unsigned int uiHostOptions, + unsigned int uiTexturePackId) { + return game_.CreateImageTextData(textMetadata, seed, hasSeed, + uiHostOptions, uiTexturePackId); +} + +std::wstring AppGameServices::getFilePath(std::uint32_t packId, + std::wstring filename, + bool bAddDataFolder, + std::wstring mountPoint) { + return game_.getFilePath(packId, filename, bAddDataFolder, mountPoint); +} + +char* AppGameServices::getUniqueMapName() { + return game_.GetUniqueMapName(); +} + +void AppGameServices::setUniqueMapName(char* name) { + game_.SetUniqueMapName(name); +} + +unsigned int AppGameServices::getOpacityTimer(int iPad) { + return game_.GetOpacityTimer(iPad); +} + +void AppGameServices::setOpacityTimer(int iPad) { + game_.SetOpacityTimer(iPad); +} + +void AppGameServices::tickOpacityTimer(int iPad) { + game_.TickOpacityTimer(iPad); +} + +bool AppGameServices::isInBannedLevelList(int iPad, PlayerUID xuid, + char* levelName) { + return game_.IsInBannedLevelList(iPad, xuid, levelName); +} + +MOJANG_DATA* AppGameServices::getMojangDataForXuid(PlayerUID xuid) { + return game_.GetMojangDataForXuid(xuid); +} + +void AppGameServices::debugPrintf(const char* msg) { + game_.DebugPrintf("%s", msg); +} + +// -- DLC -- + +DLCSkinFile* AppGameServices::getDLCSkinFile(const std::wstring& name) { + return game_.m_dlcManager.getSkinFile(name); +} +bool AppGameServices::dlcNeedsCorruptCheck() { + return game_.m_dlcManager.NeedsCorruptCheck(); +} +unsigned int AppGameServices::dlcCheckForCorrupt(bool showMessage) { + return game_.m_dlcManager.checkForCorruptDLCAndAlert(showMessage); +} +bool AppGameServices::dlcReadDataFile(unsigned int& filesProcessed, + const std::wstring& path, + DLCPack* pack, bool fromArchive) { + return game_.m_dlcManager.readDLCDataFile(filesProcessed, path, pack, + fromArchive); +} +void AppGameServices::dlcRemovePack(DLCPack* pack) { + game_.m_dlcManager.removePack(pack); +} + +// -- Game rules -- + +LevelGenerationOptions* AppGameServices::loadGameRules(std::uint8_t* data, + unsigned int size) { + return game_.m_gameRules.loadGameRules(data, size); +} +void AppGameServices::saveGameRules(std::uint8_t** data, unsigned int* size) { + game_.m_gameRules.saveGameRules(data, size); +} +void AppGameServices::unloadCurrentGameRules() { + game_.m_gameRules.unloadCurrentGameRules(); +} +void AppGameServices::setLevelGenerationOptions(LevelGenerationOptions* levelGen) { + game_.m_gameRules.setLevelGenerationOptions(levelGen); +} + +// -- Shared data -- + +std::vector& AppGameServices::getSkinNames() { + return game_.vSkinNames; +} + +std::vector& AppGameServices::getTerrainFeatures() { + return *game_.m_terrainFeatureManager.features(); +} + +// -- Menu service -- + +IMenuService& AppGameServices::menus() { return menus_; } diff --git a/targets/app/common/AppGameServices.h b/targets/app/common/AppGameServices.h new file mode 100644 index 000000000..754b2c92a --- /dev/null +++ b/targets/app/common/AppGameServices.h @@ -0,0 +1,185 @@ +#pragma once + +#include "minecraft/IGameServices.h" + +class Game; +class IMenuService; + +class AppGameServices : public IGameServices { +public: + AppGameServices(Game& game, IMenuService& menus); + + // -- Strings -- + const wchar_t* getString(int id) override; + + // -- Debug settings -- + bool debugSettingsOn() override; + bool debugArtToolsOn() override; + unsigned int debugGetMask(int iPad, bool overridePlayer) override; + bool debugMobsDontAttack() override; + bool debugMobsDontTick() override; + bool debugFreezePlayers() override; + + // -- Game host options -- + unsigned int getGameHostOption(eGameHostOption option) override; + void setGameHostOption(eGameHostOption option, + unsigned int value) override; + + // -- Level generation -- + LevelGenerationOptions* getLevelGenerationOptions() override; + LevelRuleset* getGameRuleDefinitions() override; + + // -- Texture cache -- + void addMemoryTextureFile(const std::wstring& name, std::uint8_t* data, + unsigned int size) override; + void removeMemoryTextureFile(const std::wstring& name) override; + void getMemFileDetails(const std::wstring& name, std::uint8_t** data, + unsigned int* size) override; + bool isFileInMemoryTextures(const std::wstring& name) override; + + // -- Player settings -- + unsigned char getGameSettings(int iPad, int setting) override; + unsigned char getGameSettings(int setting) override; + + // -- App time -- + float getAppTime() override; + + // -- Game state -- + bool getGameStarted() override; + void setGameStarted(bool val) override; + bool getTutorialMode() override; + void setTutorialMode(bool val) override; + bool isAppPaused() override; + int getLocalPlayerCount() override; + bool autosaveDue() override; + void setAutosaveTimerTime() override; + int64_t secondsToAutosave() override; + void setDisconnectReason( + DisconnectPacket::eDisconnectReason reason) override; + void lockSaveNotification() override; + void unlockSaveNotification() override; + bool getResetNether() override; + bool getUseDPadForDebug() override; + bool getWriteSavesToFolderEnabled() override; + bool isLocalMultiplayerAvailable() override; + bool dlcInstallPending() override; + bool dlcInstallProcessCompleted() override; + bool canRecordStatsAndAchievements() override; + bool getTMSGlobalFileListRead() override; + void setRequiredTexturePackID(std::uint32_t id) override; + void setSpecialTutorialCompletionFlag(int iPad, int index) override; + void setBanListCheck(int iPad, bool val) override; + bool getBanListCheck(int iPad) override; + unsigned int getGameNewWorldSize() override; + unsigned int getGameNewWorldSizeUseMoat() override; + unsigned int getGameNewHellScale() override; + + // -- UI dispatch -- + void setAction(int iPad, eXuiAction action, void* param) override; + void setXuiServerAction(int iPad, eXuiServerAction action, + void* param) override; + eXuiAction getXuiAction(int iPad) override; + eXuiServerAction getXuiServerAction(int iPad) override; + void* getXuiServerActionParam(int iPad) override; + void setGlobalXuiAction(eXuiAction action) override; + void handleButtonPresses() override; + void setTMSAction(int iPad, eTMSAction action) override; + + // -- Skin / cape / animation -- + std::wstring getPlayerSkinName(int iPad) override; + std::uint32_t getPlayerSkinId(int iPad) override; + std::wstring getPlayerCapeName(int iPad) override; + std::uint32_t getPlayerCapeId(int iPad) override; + std::uint32_t getAdditionalModelPartsForPad(int iPad) override; + void setAdditionalSkinBoxes(std::uint32_t dwSkinID, SKIN_BOX* boxA, + unsigned int boxC) override; + std::vector* getAdditionalSkinBoxes( + std::uint32_t dwSkinID) override; + std::vector* getAdditionalModelParts( + std::uint32_t dwSkinID) override; + std::vector* setAdditionalSkinBoxesFromVec( + std::uint32_t dwSkinID, std::vector* pvSkinBoxA) override; + void setAnimOverrideBitmask(std::uint32_t dwSkinID, + unsigned int bitmask) override; + unsigned int getAnimOverrideBitmask(std::uint32_t dwSkinID) override; + std::uint32_t getSkinIdFromPath(const std::wstring& skin) override; + std::wstring getSkinPathFromId(std::uint32_t skinId) override; + bool defaultCapeExists() override; + bool isXuidNotch(PlayerUID xuid) override; + bool isXuidDeadmau5(PlayerUID xuid) override; + + // -- Platform features -- + void fatalLoadError() override; + void setRichPresenceContext(int iPad, int contextId) override; + void captureSaveThumbnail() override; + void getSaveThumbnail(std::uint8_t** data, unsigned int* size) override; + void readBannedList(int iPad, eTMSAction action, + bool bCallback) override; + void updatePlayerInfo(std::uint8_t networkSmallId, + int16_t playerColourIndex, + unsigned int playerPrivileges) override; + unsigned int getPlayerPrivileges(std::uint8_t networkSmallId) override; + void setGameSettingsDebugMask(int iPad, unsigned int uiVal) override; + + // -- Schematics / terrain -- + void processSchematics(LevelChunk* chunk) override; + void processSchematicsLighting(LevelChunk* chunk) override; + void addTerrainFeaturePosition(_eTerrainFeatureType type, int x, + int z) override; + bool getTerrainFeaturePosition(_eTerrainFeatureType type, int* pX, + int* pZ) override; + void loadDefaultGameRules() override; + + // -- Archive / resources -- + bool hasArchiveFile(const std::wstring& filename) override; + std::vector getArchiveFile( + const std::wstring& filename) override; + + // -- Strings / formatting / misc queries -- + int getHTMLColour(eMinecraftColour colour) override; + std::wstring getEntityName(EntityTypeId type) override; + const wchar_t* getGameRulesString(const std::wstring& key) override; + unsigned int createImageTextData(std::uint8_t* textMetadata, + int64_t seed, bool hasSeed, + unsigned int uiHostOptions, + unsigned int uiTexturePackId) override; + std::wstring getFilePath(std::uint32_t packId, std::wstring filename, + bool bAddDataFolder, + std::wstring mountPoint) override; + char* getUniqueMapName() override; + void setUniqueMapName(char* name) override; + unsigned int getOpacityTimer(int iPad) override; + void setOpacityTimer(int iPad) override; + void tickOpacityTimer(int iPad) override; + bool isInBannedLevelList(int iPad, PlayerUID xuid, + char* levelName) override; + MOJANG_DATA* getMojangDataForXuid(PlayerUID xuid) override; + void debugPrintf(const char* msg) override; + + // -- DLC -- + DLCSkinFile* getDLCSkinFile(const std::wstring& name) override; + bool dlcNeedsCorruptCheck() override; + unsigned int dlcCheckForCorrupt(bool showMessage) override; + bool dlcReadDataFile(unsigned int& filesProcessed, + const std::wstring& path, DLCPack* pack, + bool fromArchive) override; + void dlcRemovePack(DLCPack* pack) override; + + // -- Game rules -- + LevelGenerationOptions* loadGameRules(std::uint8_t* data, + unsigned int size) override; + void saveGameRules(std::uint8_t** data, unsigned int* size) override; + void unloadCurrentGameRules() override; + void setLevelGenerationOptions(LevelGenerationOptions* levelGen) override; + + // -- Shared data -- + std::vector& getSkinNames() override; + std::vector& getTerrainFeatures() override; + + // -- Menu service -- + IMenuService& menus() override; + +private: + Game& game_; + IMenuService& menus_; +}; diff --git a/targets/app/common/App_structs.h b/targets/app/common/App_structs.h index c11531165..408db6ccf 100644 --- a/targets/app/common/App_structs.h +++ b/targets/app/common/App_structs.h @@ -4,12 +4,13 @@ #include "platform/sdl2/Storage.h" #include "app/common/App_Defines.h" -#include "app/common/App_enums.h" -#include "app/common/src/Tutorial/TutorialEnum.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/include/NetTypes.h" -#include "app/include/SkinBox.h" -#include "app/include/XboxStubs.h" +#include "minecraft/GameEnums.h" +#include "minecraft/GameTypes.h" +#include "app/common/Tutorial/TutorialEnum.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "platform/NetTypes.h" +#include "minecraft/client/model/SkinBox.h" +#include "platform/XboxStubs.h" typedef struct { wchar_t* wchFilename; @@ -144,12 +145,6 @@ typedef struct { int uiStringID; } TIPSTRUCT; -typedef struct { - eXUID eXuid; - wchar_t wchCape[MAX_CAPENAME_SIZE]; - wchar_t wchSkin[MAX_CAPENAME_SIZE]; -} MOJANG_DATA; - typedef struct { eDLCContentType eDLCType; @@ -162,11 +157,6 @@ typedef struct { unsigned int uiSortIndex; } DLC_INFO; -typedef struct { - int x, z; - _eTerrainFeatureType eTerrainFeature; -} FEATURE_DATA; - // banned list typedef struct { std::uint8_t* pBannedList; diff --git a/targets/app/common/ArchiveManager.cpp b/targets/app/common/ArchiveManager.cpp new file mode 100644 index 000000000..82f271460 --- /dev/null +++ b/targets/app/common/ArchiveManager.cpp @@ -0,0 +1,128 @@ +#include "app/common/ArchiveManager.h" + +#include +#include + +#include "app/common/UI/All Platforms/ArchiveFile.h" +#include "app/linux/LinuxGame.h" +#include "java/File.h" +#include "minecraft/client/Minecraft.h" +#include "minecraft/client/skins/TexturePack.h" +#include "minecraft/client/skins/TexturePackRepository.h" +#include "platform/PlatformServices.h" +#include "platform/PlatformTypes.h" + +ArchiveManager::ArchiveManager() + : m_mediaArchive(nullptr), m_dwRequiredTexturePackID(0) {} + +void ArchiveManager::loadMediaArchive() { + std::wstring mediapath = L""; + +#if _WINDOWS64 + mediapath = L"Common\\Media\\MediaWindows64.arc"; +#elif __linux__ + mediapath = L"app/common/Media/MediaLinux.arc"; +#endif + + if (!mediapath.empty()) { +#if defined(__linux__) + std::wstring exeDirW = PlatformFileIO.getBasePath().wstring(); + std::wstring candidate = exeDirW + File::pathSeparator + mediapath; + if (File(candidate).exists()) { + m_mediaArchive = new ArchiveFile(File(candidate)); + } else { + m_mediaArchive = new ArchiveFile(File(mediapath)); + } +#else + m_mediaArchive = new ArchiveFile(File(mediapath)); +#endif + } +} + +int ArchiveManager::getArchiveFileSize(const std::wstring& filename) { + TexturePack* tPack = nullptr; + Minecraft* pMinecraft = Minecraft::GetInstance(); + if (pMinecraft && pMinecraft->skins) + tPack = pMinecraft->skins->getSelected(); + if (tPack && tPack->hasData() && tPack->getArchiveFile() && + tPack->getArchiveFile()->hasFile(filename)) { + return tPack->getArchiveFile()->getFileSize(filename); + } else + return m_mediaArchive->getFileSize(filename); +} + +bool ArchiveManager::hasArchiveFile(const std::wstring& filename) { + TexturePack* tPack = nullptr; + Minecraft* pMinecraft = Minecraft::GetInstance(); + if (pMinecraft && pMinecraft->skins) + tPack = pMinecraft->skins->getSelected(); + if (tPack && tPack->hasData() && tPack->getArchiveFile() && + tPack->getArchiveFile()->hasFile(filename)) + return true; + else + return m_mediaArchive->hasFile(filename); +} + +std::vector ArchiveManager::getArchiveFile( + const std::wstring& filename) { + TexturePack* tPack = nullptr; + Minecraft* pMinecraft = Minecraft::GetInstance(); + if (pMinecraft && pMinecraft->skins) + tPack = pMinecraft->skins->getSelected(); + if (tPack && tPack->hasData() && tPack->getArchiveFile() && + tPack->getArchiveFile()->hasFile(filename)) { + return tPack->getArchiveFile()->getFile(filename); + } else + return m_mediaArchive->getFile(filename); +} + +void ArchiveManager::addMemoryTPDFile(int iConfig, std::uint8_t* pbData, + unsigned int byteCount) { + std::lock_guard lock(csMemTPDLock); + PMEMDATA pData = nullptr; + auto it = m_MEM_TPD.find(iConfig); + if (it == m_MEM_TPD.end()) { + pData = new MEMDATA(); + pData->pbData = pbData; + pData->byteCount = byteCount; + pData->ucRefCount = 1; + + m_MEM_TPD[iConfig] = pData; + } +} + +void ArchiveManager::removeMemoryTPDFile(int iConfig) { + std::lock_guard lock(csMemTPDLock); + PMEMDATA pData = nullptr; + auto it = m_MEM_TPD.find(iConfig); + if (it != m_MEM_TPD.end()) { + pData = m_MEM_TPD[iConfig]; + delete pData; + m_MEM_TPD.erase(iConfig); + } +} + +int ArchiveManager::getTPConfigVal(wchar_t* pwchDataFile) { return -1; } + +bool ArchiveManager::isFileInTPD(int iConfig) { + bool val = false; + + { + std::lock_guard lock(csMemTPDLock); + auto it = m_MEM_TPD.find(iConfig); + if (it != m_MEM_TPD.end()) val = true; + } + + return val; +} + +void ArchiveManager::getTPD(int iConfig, std::uint8_t** ppbData, + unsigned int* pByteCount) { + std::lock_guard lock(csMemTPDLock); + auto it = m_MEM_TPD.find(iConfig); + if (it != m_MEM_TPD.end()) { + PMEMDATA pData = (*it).second; + *ppbData = pData->pbData; + *pByteCount = pData->byteCount; + } +} diff --git a/targets/app/common/ArchiveManager.h b/targets/app/common/ArchiveManager.h new file mode 100644 index 000000000..cea9c01e5 --- /dev/null +++ b/targets/app/common/ArchiveManager.h @@ -0,0 +1,54 @@ +#pragma once + +#include +#include +#include +#include +#include + +#include "app/common/App_structs.h" + +class ArchiveFile; + +class ArchiveManager { +public: + ArchiveManager(); + + void loadMediaArchive(); + ArchiveFile* getMediaArchive() const { return m_mediaArchive; } + + int getArchiveFileSize(const std::wstring& filename); + bool hasArchiveFile(const std::wstring& filename); + std::vector getArchiveFile(const std::wstring& filename); + + // Texture Pack Data files (icon, banner, comparison shot & text) + void addMemoryTPDFile(int iConfig, std::uint8_t* pbData, + unsigned int byteCount); + void removeMemoryTPDFile(int iConfig); + bool isFileInTPD(int iConfig); + void getTPD(int iConfig, std::uint8_t** ppbData, unsigned int* pByteCount); + int getTPDSize() { return m_MEM_TPD.size(); } + int getTPConfigVal(wchar_t* pwchDataFile); + + void setRequiredTexturePackID(std::uint32_t texturePackId) { + m_dwRequiredTexturePackID = texturePackId; + } + std::uint32_t getRequiredTexturePackID() const { + return m_dwRequiredTexturePackID; + } + + virtual void getFileFromTPD(eTPDFileType eType, std::uint8_t* pbData, + unsigned int byteCount, std::uint8_t** ppbData, + unsigned int* pByteCount) { + *ppbData = nullptr; + *pByteCount = 0; + } + +protected: + ArchiveFile* m_mediaArchive; + +private: + std::unordered_map m_MEM_TPD; + std::mutex csMemTPDLock; + std::uint32_t m_dwRequiredTexturePackID; +}; diff --git a/targets/app/common/src/Audio/Consoles_SoundEngine.cpp b/targets/app/common/Audio/Consoles_SoundEngine.cpp similarity index 100% rename from targets/app/common/src/Audio/Consoles_SoundEngine.cpp rename to targets/app/common/Audio/Consoles_SoundEngine.cpp diff --git a/targets/app/common/src/Audio/Consoles_SoundEngine.h b/targets/app/common/Audio/Consoles_SoundEngine.h similarity index 100% rename from targets/app/common/src/Audio/Consoles_SoundEngine.h rename to targets/app/common/Audio/Consoles_SoundEngine.h diff --git a/targets/app/common/src/Audio/SoundEngine.cpp b/targets/app/common/Audio/SoundEngine.cpp similarity index 99% rename from targets/app/common/src/Audio/SoundEngine.cpp rename to targets/app/common/Audio/SoundEngine.cpp index 7e1848414..66ea8b8af 100644 --- a/targets/app/common/src/Audio/SoundEngine.cpp +++ b/targets/app/common/Audio/SoundEngine.cpp @@ -12,7 +12,7 @@ #include "platform/PlatformTypes.h" #include "app/common/App_Defines.h" -#include "app/common/src/Audio/Consoles_SoundEngine.h" +#include "app/common/Audio/Consoles_SoundEngine.h" #include "app/linux/Iggy/include/rrCore.h" #include "app/linux/LinuxGame.h" #include "platform/C4JThread.h" diff --git a/targets/app/common/src/Audio/SoundEngine.h b/targets/app/common/Audio/SoundEngine.h similarity index 99% rename from targets/app/common/src/Audio/SoundEngine.h rename to targets/app/common/Audio/SoundEngine.h index 7a401503d..659046f61 100644 --- a/targets/app/common/src/Audio/SoundEngine.h +++ b/targets/app/common/Audio/SoundEngine.h @@ -7,7 +7,7 @@ class Random; #include #include "app/common/App_Defines.h" -#include "app/common/src/Audio/Consoles_SoundEngine.h" +#include "app/common/Audio/Consoles_SoundEngine.h" #include "app/linux/Iggy/include/rrCore.h" #include "minecraft/sounds/SoundTypes.h" #include "miniaudio.h" diff --git a/targets/app/common/src/Audio/SoundNames.cpp b/targets/app/common/Audio/SoundNames.cpp similarity index 100% rename from targets/app/common/src/Audio/SoundNames.cpp rename to targets/app/common/Audio/SoundNames.cpp diff --git a/targets/app/common/BannedListManager.cpp b/targets/app/common/BannedListManager.cpp new file mode 100644 index 000000000..d7171781c --- /dev/null +++ b/targets/app/common/BannedListManager.cpp @@ -0,0 +1,131 @@ +#include "app/common/BannedListManager.h" + +#include + +#include "platform/XboxStubs.h" + +BannedListManager::BannedListManager() { + m_pBannedListFileBuffer = nullptr; + m_dwBannedListFileSize = 0; + std::memset(m_pszUniqueMapName, 0, 14); + + for (int i = 0; i < XUSER_MAX_COUNT; i++) { + m_bRead_BannedListA[i] = false; + m_BanListCheck[i] = false; + m_vBannedListA[i] = new std::vector; + } +} + +void BannedListManager::invalidate(int iPad) { + if (m_bRead_BannedListA[iPad] == true) { + m_bRead_BannedListA[iPad] = false; + setBanListCheck(iPad, false); + m_vBannedListA[iPad]->clear(); + + if (BannedListA[iPad].pBannedList) { + delete[] BannedListA[iPad].pBannedList; + BannedListA[iPad].pBannedList = nullptr; + } + } +} + +void BannedListManager::addLevel(int iPad, PlayerUID xuid, + char* pszLevelName, bool bWriteToTMS) { + // we will have retrieved the banned level list from TMS, so add this one to + // it and write it back to TMS + + BANNEDLISTDATA* pBannedListData = new BANNEDLISTDATA; + memset(pBannedListData, 0, sizeof(BANNEDLISTDATA)); + + memcpy(&pBannedListData->xuid, &xuid, sizeof(PlayerUID)); + strcpy(pBannedListData->pszLevelName, pszLevelName); + m_vBannedListA[iPad]->push_back(pBannedListData); + + if (bWriteToTMS) { + const std::size_t bannedListCount = m_vBannedListA[iPad]->size(); + const unsigned int dataBytes = + static_cast(sizeof(BANNEDLISTDATA) * bannedListCount); + PBANNEDLISTDATA pBannedList = new BANNEDLISTDATA[bannedListCount]; + int iCount = 0; + for (auto it = m_vBannedListA[iPad]->begin(); + it != m_vBannedListA[iPad]->end(); ++it) { + PBANNEDLISTDATA pData = *it; + memcpy(&pBannedList[iCount++], pData, sizeof(BANNEDLISTDATA)); + } + + // 4J-PB - write to TMS++ now + + // bool + // bRes=StorageManager.WriteTMSFile(iPad,C4JStorage::eGlobalStorage_TitleUser,L"BannedList",(std::uint8_t*)pBannedList, + // dwDataBytes); + + delete[] pBannedList; + } + // update telemetry too +} + +bool BannedListManager::isInList(int iPad, PlayerUID xuid, + char* pszLevelName) { + for (auto it = m_vBannedListA[iPad]->begin(); + it != m_vBannedListA[iPad]->end(); ++it) { + PBANNEDLISTDATA pData = *it; + if (IsEqualXUID(pData->xuid, xuid) && + (strcmp(pData->pszLevelName, pszLevelName) == 0)) { + return true; + } + } + + return false; +} + +void BannedListManager::removeLevel(int iPad, PlayerUID xuid, + char* pszLevelName) { + // bool bFound=false; + // bool bRes; + + // we will have retrieved the banned level list from TMS, so remove this one + // from it and write it back to TMS + for (auto it = m_vBannedListA[iPad]->begin(); + it != m_vBannedListA[iPad]->end();) { + PBANNEDLISTDATA pBannedListData = *it; + + if (pBannedListData != nullptr) { + if (IsEqualXUID(pBannedListData->xuid, xuid) && + (strcmp(pBannedListData->pszLevelName, pszLevelName) == 0)) { + // match found, so remove this entry + it = m_vBannedListA[iPad]->erase(it); + } else { + ++it; + } + } else { + ++it; + } + } + + const std::size_t bannedListCount = m_vBannedListA[iPad]->size(); + const unsigned int dataBytes = + static_cast(sizeof(BANNEDLISTDATA) * bannedListCount); + if (dataBytes == 0) { + // wipe the file + } else { + PBANNEDLISTDATA pBannedList = + (BANNEDLISTDATA*)(new std::uint8_t[dataBytes]); + + for (std::size_t i = 0; i < bannedListCount; ++i) { + PBANNEDLISTDATA pBannedListData = m_vBannedListA[iPad]->at(i); + + memcpy(&pBannedList[i], pBannedListData, sizeof(BANNEDLISTDATA)); + } + delete[] pBannedList; + } + + // update telemetry too +} + +void BannedListManager::setUniqueMapName(char* pszUniqueMapName) { + memcpy(m_pszUniqueMapName, pszUniqueMapName, 14); +} + +char* BannedListManager::getUniqueMapName() { + return m_pszUniqueMapName; +} diff --git a/targets/app/common/BannedListManager.h b/targets/app/common/BannedListManager.h new file mode 100644 index 000000000..23d2028b6 --- /dev/null +++ b/targets/app/common/BannedListManager.h @@ -0,0 +1,46 @@ +#pragma once + +#include +#include +#include + +#include "app/common/App_structs.h" +#include "platform/XboxStubs.h" + +class BannedListManager { +public: + BannedListManager(); + + void invalidate(int iPad); + void addLevel(int iPad, PlayerUID xuid, char* pszLevelName, + bool bWriteToTMS); + bool isInList(int iPad, PlayerUID xuid, char* pszLevelName); + void removeLevel(int iPad, PlayerUID xuid, char* pszLevelName); + + void setUniqueMapName(char* pszUniqueMapName); + char* getUniqueMapName(); + + void setBanListCheck(int iPad, bool bVal) { m_BanListCheck[iPad] = bVal; } + bool getBanListCheck(int iPad) const { return m_BanListCheck[iPad]; } + + bool getBanListRead(int iPad) const { return m_bRead_BannedListA[iPad]; } + void setBanListRead(int iPad, bool bVal) { + m_bRead_BannedListA[iPad] = bVal; + } + + void clearBanList(int iPad) { + BannedListA[iPad].pBannedList = nullptr; + BannedListA[iPad].byteCount = 0; + } + + BANNEDLIST BannedListA[XUSER_MAX_COUNT]; + + std::uint8_t* m_pBannedListFileBuffer; + unsigned int m_dwBannedListFileSize; + +private: + VBANNEDLIST* m_vBannedListA[XUSER_MAX_COUNT]; + bool m_bRead_BannedListA[XUSER_MAX_COUNT]; + char m_pszUniqueMapName[14]; + bool m_BanListCheck[XUSER_MAX_COUNT]; +}; diff --git a/targets/app/common/src/BuildVer/BuildVer.h b/targets/app/common/BuildVer/BuildVer.h similarity index 100% rename from targets/app/common/src/BuildVer/BuildVer.h rename to targets/app/common/BuildVer/BuildVer.h diff --git a/targets/app/common/src/Colours/ColourTable.cpp b/targets/app/common/Colours/ColourTable.cpp similarity index 99% rename from targets/app/common/src/Colours/ColourTable.cpp rename to targets/app/common/Colours/ColourTable.cpp index c739b8e14..f8e7fe237 100644 --- a/targets/app/common/src/Colours/ColourTable.cpp +++ b/targets/app/common/Colours/ColourTable.cpp @@ -4,7 +4,7 @@ #include #include -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "util/StringHelpers.h" #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/DataInputStream.h" diff --git a/targets/app/common/src/Colours/ColourTable.h b/targets/app/common/Colours/ColourTable.h similarity index 96% rename from targets/app/common/src/Colours/ColourTable.h rename to targets/app/common/Colours/ColourTable.h index 657ec9140..021e39c5c 100644 --- a/targets/app/common/src/Colours/ColourTable.h +++ b/targets/app/common/Colours/ColourTable.h @@ -3,7 +3,7 @@ #include #include -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" class ColourTable { private: diff --git a/targets/app/common/src/ConsoleGameMode.cpp b/targets/app/common/ConsoleGameMode.cpp similarity index 74% rename from targets/app/common/src/ConsoleGameMode.cpp rename to targets/app/common/ConsoleGameMode.cpp index 5c6fa6b93..0032dbd9b 100644 --- a/targets/app/common/src/ConsoleGameMode.cpp +++ b/targets/app/common/ConsoleGameMode.cpp @@ -1,7 +1,7 @@ #include "ConsoleGameMode.h" -#include "app/common/src/Tutorial/Tutorial.h" -#include "app/common/src/Tutorial/TutorialMode.h" +#include "app/common/Tutorial/Tutorial.h" +#include "app/common/Tutorial/TutorialMode.h" class ClientConnection; class Minecraft; diff --git a/targets/app/common/src/ConsoleGameMode.h b/targets/app/common/ConsoleGameMode.h similarity index 84% rename from targets/app/common/src/ConsoleGameMode.h rename to targets/app/common/ConsoleGameMode.h index ab8a3632e..c1dfb1bf5 100644 --- a/targets/app/common/src/ConsoleGameMode.h +++ b/targets/app/common/ConsoleGameMode.h @@ -1,5 +1,5 @@ #pragma once -#include "app/common/src/Tutorial/TutorialMode.h" +#include "app/common/Tutorial/TutorialMode.h" class ClientConnection; class Minecraft; diff --git a/targets/app/common/src/Console_Awards_enum.h b/targets/app/common/Console_Awards_enum.h similarity index 100% rename from targets/app/common/src/Console_Awards_enum.h rename to targets/app/common/Console_Awards_enum.h diff --git a/targets/app/common/src/Console_Debug_enum.h b/targets/app/common/Console_Debug_enum.h similarity index 100% rename from targets/app/common/src/Console_Debug_enum.h rename to targets/app/common/Console_Debug_enum.h diff --git a/targets/app/common/src/DLC/DLCAudioFile.cpp b/targets/app/common/DLC/DLCAudioFile.cpp similarity index 99% rename from targets/app/common/src/DLC/DLCAudioFile.cpp rename to targets/app/common/DLC/DLCAudioFile.cpp index 2c9260afe..b7042a45e 100644 --- a/targets/app/common/src/DLC/DLCAudioFile.cpp +++ b/targets/app/common/DLC/DLCAudioFile.cpp @@ -8,9 +8,9 @@ #include "platform/sdl2/Render.h" #include "platform/sdl2/Storage.h" #include "DLCManager.h" -#include "app/common/src/DLC/DLCFile.h" +#include "app/common/DLC/DLCFile.h" #include "app/linux/LinuxGame.h" -#include "app/include/XboxStubs.h" +#include "platform/XboxStubs.h" #if defined(_WINDOWS64) #include "app/windows/XML/ATGXmlParser.h" #include "app/windows/XML/xmlFilesCallback.h" diff --git a/targets/app/common/src/DLC/DLCAudioFile.h b/targets/app/common/DLC/DLCAudioFile.h similarity index 100% rename from targets/app/common/src/DLC/DLCAudioFile.h rename to targets/app/common/DLC/DLCAudioFile.h diff --git a/targets/app/common/src/DLC/DLCCapeFile.cpp b/targets/app/common/DLC/DLCCapeFile.cpp similarity index 88% rename from targets/app/common/src/DLC/DLCCapeFile.cpp rename to targets/app/common/DLC/DLCCapeFile.cpp index 5beb4e48a..e4dba5d4c 100644 --- a/targets/app/common/src/DLC/DLCCapeFile.cpp +++ b/targets/app/common/DLC/DLCCapeFile.cpp @@ -1,7 +1,7 @@ #include "DLCCapeFile.h" #include "DLCManager.h" -#include "app/common/src/DLC/DLCFile.h" +#include "app/common/DLC/DLCFile.h" #include "app/linux/LinuxGame.h" DLCCapeFile::DLCCapeFile(const std::wstring& path) diff --git a/targets/app/common/src/DLC/DLCCapeFile.h b/targets/app/common/DLC/DLCCapeFile.h similarity index 100% rename from targets/app/common/src/DLC/DLCCapeFile.h rename to targets/app/common/DLC/DLCCapeFile.h diff --git a/targets/app/common/src/DLC/DLCColourTableFile.cpp b/targets/app/common/DLC/DLCColourTableFile.cpp similarity index 90% rename from targets/app/common/src/DLC/DLCColourTableFile.cpp rename to targets/app/common/DLC/DLCColourTableFile.cpp index 83b082979..96aee1ae4 100644 --- a/targets/app/common/src/DLC/DLCColourTableFile.cpp +++ b/targets/app/common/DLC/DLCColourTableFile.cpp @@ -1,8 +1,8 @@ #include "DLCColourTableFile.h" #include "DLCManager.h" -#include "app/common/src/Colours/ColourTable.h" -#include "app/common/src/DLC/DLCFile.h" +#include "app/common/Colours/ColourTable.h" +#include "app/common/DLC/DLCFile.h" #include "app/linux/LinuxGame.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/skins/TexturePack.h" diff --git a/targets/app/common/src/DLC/DLCColourTableFile.h b/targets/app/common/DLC/DLCColourTableFile.h similarity index 100% rename from targets/app/common/src/DLC/DLCColourTableFile.h rename to targets/app/common/DLC/DLCColourTableFile.h diff --git a/targets/app/common/src/DLC/DLCFile.cpp b/targets/app/common/DLC/DLCFile.cpp similarity index 93% rename from targets/app/common/src/DLC/DLCFile.cpp rename to targets/app/common/DLC/DLCFile.cpp index 30424e957..2383b2954 100644 --- a/targets/app/common/src/DLC/DLCFile.cpp +++ b/targets/app/common/DLC/DLCFile.cpp @@ -3,7 +3,7 @@ #include #include "app/common/Minecraft_Macros.h" -#include "app/common/src/DLC/DLCManager.h" +#include "app/common/DLC/DLCManager.h" DLCFile::DLCFile(DLCManager::EDLCType type, const std::wstring& path) { m_type = type; diff --git a/targets/app/common/src/DLC/DLCFile.h b/targets/app/common/DLC/DLCFile.h similarity index 100% rename from targets/app/common/src/DLC/DLCFile.h rename to targets/app/common/DLC/DLCFile.h diff --git a/targets/app/common/src/DLC/DLCGameRules.h b/targets/app/common/DLC/DLCGameRules.h similarity index 70% rename from targets/app/common/src/DLC/DLCGameRules.h rename to targets/app/common/DLC/DLCGameRules.h index e1d34f70c..4a73f72c4 100644 --- a/targets/app/common/src/DLC/DLCGameRules.h +++ b/targets/app/common/DLC/DLCGameRules.h @@ -1,7 +1,7 @@ #pragma once #include "DLCFile.h" -#include "app/common/src/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" class DLCGameRules : public DLCFile { public: diff --git a/targets/app/common/src/DLC/DLCGameRulesFile.cpp b/targets/app/common/DLC/DLCGameRulesFile.cpp similarity index 91% rename from targets/app/common/src/DLC/DLCGameRulesFile.cpp rename to targets/app/common/DLC/DLCGameRulesFile.cpp index d523a9b89..eb90be010 100644 --- a/targets/app/common/src/DLC/DLCGameRulesFile.cpp +++ b/targets/app/common/DLC/DLCGameRulesFile.cpp @@ -1,7 +1,7 @@ #include "DLCGameRulesFile.h" #include "DLCManager.h" -#include "app/common/src/DLC/DLCGameRules.h" +#include "app/common/DLC/DLCGameRules.h" DLCGameRulesFile::DLCGameRulesFile(const std::wstring& path) : DLCGameRules(DLCManager::e_DLCType_GameRules, path) { diff --git a/targets/app/common/src/DLC/DLCGameRulesFile.h b/targets/app/common/DLC/DLCGameRulesFile.h similarity index 100% rename from targets/app/common/src/DLC/DLCGameRulesFile.h rename to targets/app/common/DLC/DLCGameRulesFile.h diff --git a/targets/app/common/src/DLC/DLCGameRulesHeader.cpp b/targets/app/common/DLC/DLCGameRulesHeader.cpp similarity index 91% rename from targets/app/common/src/DLC/DLCGameRulesHeader.cpp rename to targets/app/common/DLC/DLCGameRulesHeader.cpp index aa57c370b..8c00e32ec 100644 --- a/targets/app/common/src/DLC/DLCGameRulesHeader.cpp +++ b/targets/app/common/DLC/DLCGameRulesHeader.cpp @@ -3,8 +3,8 @@ #include #include "DLCManager.h" -#include "app/common/src/DLC/DLCGameRules.h" -#include "app/common/src/GameRules/GameRuleManager.h" +#include "app/common/DLC/DLCGameRules.h" +#include "app/common/GameRules/GameRuleManager.h" #include "app/linux/LinuxGame.h" class StringTable; diff --git a/targets/app/common/src/DLC/DLCGameRulesHeader.h b/targets/app/common/DLC/DLCGameRulesHeader.h similarity index 95% rename from targets/app/common/src/DLC/DLCGameRulesHeader.h rename to targets/app/common/DLC/DLCGameRulesHeader.h index 9063aa3d0..02e8443ee 100644 --- a/targets/app/common/src/DLC/DLCGameRulesHeader.h +++ b/targets/app/common/DLC/DLCGameRulesHeader.h @@ -4,7 +4,7 @@ #include #include "DLCGameRules.h" -#include "app/common/src/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" class StringTable; diff --git a/targets/app/common/src/DLC/DLCLocalisationFile.cpp b/targets/app/common/DLC/DLCLocalisationFile.cpp similarity index 80% rename from targets/app/common/src/DLC/DLCLocalisationFile.cpp rename to targets/app/common/DLC/DLCLocalisationFile.cpp index 3775c074d..b82884947 100644 --- a/targets/app/common/src/DLC/DLCLocalisationFile.cpp +++ b/targets/app/common/DLC/DLCLocalisationFile.cpp @@ -1,8 +1,8 @@ #include "DLCLocalisationFile.h" #include "DLCManager.h" -#include "app/common/src/DLC/DLCFile.h" -#include "app/common/src/Localisation/StringTable.h" +#include "app/common/DLC/DLCFile.h" +#include "app/common/Localisation/StringTable.h" DLCLocalisationFile::DLCLocalisationFile(const std::wstring& path) : DLCFile(DLCManager::e_DLCType_LocalisationData, path) { diff --git a/targets/app/common/src/DLC/DLCLocalisationFile.h b/targets/app/common/DLC/DLCLocalisationFile.h similarity index 100% rename from targets/app/common/src/DLC/DLCLocalisationFile.h rename to targets/app/common/DLC/DLCLocalisationFile.h diff --git a/targets/app/common/src/DLC/DLCManager.cpp b/targets/app/common/DLC/DLCManager.cpp similarity index 99% rename from targets/app/common/src/DLC/DLCManager.cpp rename to targets/app/common/DLC/DLCManager.cpp index d1ab657c3..795ac9508 100644 --- a/targets/app/common/src/DLC/DLCManager.cpp +++ b/targets/app/common/DLC/DLCManager.cpp @@ -17,7 +17,7 @@ #include "platform/sdl2/Storage.h" #include "DLCFile.h" #include "DLCPack.h" -#include "app/common/src/GameRules/GameRuleManager.h" +#include "app/common/GameRules/GameRuleManager.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "platform/PlatformServices.h" diff --git a/targets/app/common/src/DLC/DLCManager.h b/targets/app/common/DLC/DLCManager.h similarity index 100% rename from targets/app/common/src/DLC/DLCManager.h rename to targets/app/common/DLC/DLCManager.h diff --git a/targets/app/common/src/DLC/DLCPack.cpp b/targets/app/common/DLC/DLCPack.cpp similarity index 97% rename from targets/app/common/src/DLC/DLCPack.cpp rename to targets/app/common/DLC/DLCPack.cpp index 07e4d78ae..0347f9bcc 100644 --- a/targets/app/common/src/DLC/DLCPack.cpp +++ b/targets/app/common/DLC/DLCPack.cpp @@ -15,11 +15,11 @@ #include "DLCLocalisationFile.h" #include "DLCTextureFile.h" #include "DLCUIDataFile.h" -#include "app/common/src/Console_Debug_enum.h" -#include "app/common/src/DLC/DLCFile.h" -#include "app/common/src/DLC/DLCManager.h" -#include "app/common/src/DLC/DLCSkinFile.h" -#include "app/common/src/Localisation/StringTable.h" +#include "app/common/Console_Debug_enum.h" +#include "app/common/DLC/DLCFile.h" +#include "app/common/DLC/DLCManager.h" +#include "app/common/DLC/DLCSkinFile.h" +#include "app/common/Localisation/StringTable.h" #include "app/linux/LinuxGame.h" #include "app/linux/Stubs/winapi_stubs.h" #include "util/StringHelpers.h" diff --git a/targets/app/common/src/DLC/DLCPack.h b/targets/app/common/DLC/DLCPack.h similarity index 98% rename from targets/app/common/src/DLC/DLCPack.h rename to targets/app/common/DLC/DLCPack.h index 996afa32a..5048e91cf 100644 --- a/targets/app/common/src/DLC/DLCPack.h +++ b/targets/app/common/DLC/DLCPack.h @@ -7,7 +7,7 @@ #include "platform/PlatformTypes.h" #include "DLCManager.h" -#include "app/common/src/DLC/DLCSkinFile.h" +#include "app/common/DLC/DLCSkinFile.h" class DLCFile; class DLCSkinFile; diff --git a/targets/app/common/src/DLC/DLCSkinFile.cpp b/targets/app/common/DLC/DLCSkinFile.cpp similarity index 98% rename from targets/app/common/src/DLC/DLCSkinFile.cpp rename to targets/app/common/DLC/DLCSkinFile.cpp index c38e7d6b8..0f3a1612c 100644 --- a/targets/app/common/src/DLC/DLCSkinFile.cpp +++ b/targets/app/common/DLC/DLCSkinFile.cpp @@ -5,10 +5,10 @@ #include "platform/sdl2/Render.h" #include "DLCManager.h" -#include "app/common/src/DLC/DLCFile.h" +#include "app/common/DLC/DLCFile.h" #include "app/linux/LinuxGame.h" -#include "app/include/SkinBox.h" -#include "app/include/XboxStubs.h" +#include "minecraft/client/model/SkinBox.h" +#include "platform/XboxStubs.h" DLCSkinFile::DLCSkinFile(const std::wstring& path) : DLCFile(DLCManager::e_DLCType_Skin, path) { diff --git a/targets/app/common/src/DLC/DLCSkinFile.h b/targets/app/common/DLC/DLCSkinFile.h similarity index 92% rename from targets/app/common/src/DLC/DLCSkinFile.h rename to targets/app/common/DLC/DLCSkinFile.h index 350a2da66..ab925f7cd 100644 --- a/targets/app/common/src/DLC/DLCSkinFile.h +++ b/targets/app/common/DLC/DLCSkinFile.h @@ -5,8 +5,8 @@ #include #include "DLCFile.h" -#include "app/common/src/DLC/DLCManager.h" -#include "app/include/SkinBox.h" +#include "app/common/DLC/DLCManager.h" +#include "minecraft/client/model/SkinBox.h" #include "minecraft/client/model/HumanoidModel.h" class DLCSkinFile : public DLCFile { diff --git a/targets/app/common/src/DLC/DLCTextureFile.cpp b/targets/app/common/DLC/DLCTextureFile.cpp similarity index 97% rename from targets/app/common/src/DLC/DLCTextureFile.cpp rename to targets/app/common/DLC/DLCTextureFile.cpp index 964d497b7..52c9f1ade 100644 --- a/targets/app/common/src/DLC/DLCTextureFile.cpp +++ b/targets/app/common/DLC/DLCTextureFile.cpp @@ -1,7 +1,7 @@ #include "DLCTextureFile.h" #include "DLCManager.h" -#include "app/common/src/DLC/DLCFile.h" +#include "app/common/DLC/DLCFile.h" DLCTextureFile::DLCTextureFile(const std::wstring& path) : DLCFile(DLCManager::e_DLCType_Texture, path) { diff --git a/targets/app/common/src/DLC/DLCTextureFile.h b/targets/app/common/DLC/DLCTextureFile.h similarity index 94% rename from targets/app/common/src/DLC/DLCTextureFile.h rename to targets/app/common/DLC/DLCTextureFile.h index 71c6b5c11..015a2915c 100644 --- a/targets/app/common/src/DLC/DLCTextureFile.h +++ b/targets/app/common/DLC/DLCTextureFile.h @@ -3,7 +3,7 @@ #include #include "DLCFile.h" -#include "app/common/src/DLC/DLCManager.h" +#include "app/common/DLC/DLCManager.h" class DLCTextureFile : public DLCFile { private: diff --git a/targets/app/common/src/DLC/DLCUIDataFile.cpp b/targets/app/common/DLC/DLCUIDataFile.cpp similarity index 95% rename from targets/app/common/src/DLC/DLCUIDataFile.cpp rename to targets/app/common/DLC/DLCUIDataFile.cpp index 9b233c1a8..63b2d4a41 100644 --- a/targets/app/common/src/DLC/DLCUIDataFile.cpp +++ b/targets/app/common/DLC/DLCUIDataFile.cpp @@ -1,7 +1,7 @@ #include "DLCUIDataFile.h" #include "DLCManager.h" -#include "app/common/src/DLC/DLCFile.h" +#include "app/common/DLC/DLCFile.h" #include "app/linux/LinuxGame.h" DLCUIDataFile::DLCUIDataFile(const std::wstring& path) diff --git a/targets/app/common/src/DLC/DLCUIDataFile.h b/targets/app/common/DLC/DLCUIDataFile.h similarity index 100% rename from targets/app/common/src/DLC/DLCUIDataFile.h rename to targets/app/common/DLC/DLCUIDataFile.h diff --git a/targets/app/common/DLCController.cpp b/targets/app/common/DLCController.cpp new file mode 100644 index 000000000..c29963d71 --- /dev/null +++ b/targets/app/common/DLCController.cpp @@ -0,0 +1,719 @@ +#include "app/common/DLCController.h" + +#include "app/common/Game.h" +#include "app/common/DLC/DLCPack.h" +#include "app/common/DLC/DLCManager.h" +#include "app/common/DLC/DLCSkinFile.h" +#include "app/linux/LinuxGame.h" +#include "app/linux/Linux_UIController.h" +#include "minecraft/client/Minecraft.h" +#include "minecraft/client/skins/TexturePack.h" +#include "minecraft/client/skins/TexturePackRepository.h" +#include "platform/sdl2/Storage.h" +#include "platform/sdl2/Profile.h" +#include "platform/XboxStubs.h" + +#include +#include + +DLCController::DLCController() { + m_pDLCFileBuffer = nullptr; + m_dwDLCFileSize = 0; + m_bDefaultCapeInstallAttempted = false; + m_bDLCInstallProcessCompleted = false; + m_bDLCInstallPending = false; + m_iTotalDLC = 0; + m_iTotalDLCInstalled = 0; + m_bNewDLCAvailable = false; + m_bSeenNewDLCTip = false; + m_iDLCOfferC = 0; + m_bAllDLCContentRetrieved = true; + m_bAllTMSContentRetrieved = true; + m_bTickTMSDLCFiles = true; +} + +std::unordered_map DLCController::MojangData; +std::unordered_map DLCController::DLCTextures_PackID; +std::unordered_map DLCController::DLCInfo_Trial; +std::unordered_map DLCController::DLCInfo_Full; +std::unordered_map DLCController::DLCInfo_SkinName; + +std::uint32_t DLCController::m_dwContentTypeA[e_Marketplace_MAX] = { + XMARKETPLACE_OFFERING_TYPE_CONTENT, + XMARKETPLACE_OFFERING_TYPE_THEME, + XMARKETPLACE_OFFERING_TYPE_AVATARITEM, + XMARKETPLACE_OFFERING_TYPE_TILE, +}; + +int DLCController::marketplaceCountsCallback( + void* pParam, C4JStorage::DLC_TMS_DETAILS* pTMSDetails, int iPad) { + app.DebugPrintf("Marketplace Counts= New - %d Total - %d\n", + pTMSDetails->dwNewOffers, pTMSDetails->dwTotalOffers); + + if (pTMSDetails->dwNewOffers > 0) { + app.m_dlcController.m_bNewDLCAvailable = true; + app.m_dlcController.m_bSeenNewDLCTip = false; + } else { + app.m_dlcController.m_bNewDLCAvailable = false; + app.m_dlcController.m_bSeenNewDLCTip = true; + } + + return 0; +} + +bool DLCController::startInstallDLCProcess(int iPad) { + app.DebugPrintf("--- DLCController::startInstallDLCProcess: pad=%i.\n", + iPad); + + if ((dlcInstallProcessCompleted() == false) && + (m_bDLCInstallPending == false)) { + app.m_dlcManager.resetUnnamedCorruptCount(); + m_bDLCInstallPending = true; + m_iTotalDLC = 0; + m_iTotalDLCInstalled = 0; + app.DebugPrintf( + "--- DLCController::startInstallDLCProcess - " + "StorageManager.GetInstalledDLC\n"); + + StorageManager.GetInstalledDLC( + iPad, [this](int iInstalledC, int pad) { + return dlcInstalledCallback(iInstalledC, pad); + }); + return true; + } else { + app.DebugPrintf( + "--- DLCController::startInstallDLCProcess - nothing to do\n"); + return false; + } +} + +int DLCController::dlcInstalledCallback(int iInstalledC, int iPad) { + app.DebugPrintf( + "--- DLCController::dlcInstalledCallback: totalDLC=%i, pad=%i.\n", + iInstalledC, iPad); + m_iTotalDLC = iInstalledC; + mountNextDLC(iPad); + return 0; +} + +void DLCController::mountNextDLC(int iPad) { + app.DebugPrintf("--- DLCController::mountNextDLC: pad=%i.\n", iPad); + if (m_iTotalDLCInstalled < m_iTotalDLC) { + if (StorageManager.MountInstalledDLC( + iPad, m_iTotalDLCInstalled, + [this](int pad, std::uint32_t dwErr, + std::uint32_t dwLicenceMask) { + return dlcMountedCallback(pad, dwErr, dwLicenceMask); + }) != ERROR_IO_PENDING) { + app.DebugPrintf("Failed to mount DLC %d for pad %d\n", + m_iTotalDLCInstalled, iPad); + ++m_iTotalDLCInstalled; + mountNextDLC(iPad); + } else { + app.DebugPrintf("StorageManager.MountInstalledDLC ok\n"); + } + } else { + m_bDLCInstallPending = false; + m_bDLCInstallProcessCompleted = true; + ui.HandleDLCMountingComplete(); + } +} + +#if defined(_WINDOWS64) +#define CONTENT_DATA_DISPLAY_NAME(a) (a.szDisplayName) +#else +#define CONTENT_DATA_DISPLAY_NAME(a) (a.wszDisplayName) +#endif + +int DLCController::dlcMountedCallback(int iPad, std::uint32_t dwErr, + std::uint32_t dwLicenceMask) { +#if defined(_WINDOWS64) + app.DebugPrintf("--- DLCController::dlcMountedCallback\n"); + + if (dwErr != ERROR_SUCCESS) { + app.DebugPrintf("Failed to mount DLC for pad %d: %u\n", iPad, dwErr); + app.m_dlcManager.incrementUnnamedCorruptCount(); + } else { + XCONTENT_DATA ContentData = + StorageManager.GetDLC(m_iTotalDLCInstalled); + + DLCPack* pack = + app.m_dlcManager.getPack(CONTENT_DATA_DISPLAY_NAME(ContentData)); + + if (pack != nullptr && pack->IsCorrupt()) { + app.DebugPrintf( + "Pack '%ls' is corrupt, removing it from the DLC Manager.\n", + CONTENT_DATA_DISPLAY_NAME(ContentData)); + app.m_dlcManager.removePack(pack); + pack = nullptr; + } + + if (pack == nullptr) { + app.DebugPrintf("Pack \"%ls\" is not installed, so adding it\n", + CONTENT_DATA_DISPLAY_NAME(ContentData)); + +#if defined(_WINDOWS64) + pack = new DLCPack(ContentData.szDisplayName, dwLicenceMask); +#else + pack = new DLCPack(ContentData.wszDisplayName, dwLicenceMask); +#endif + pack->SetDLCMountIndex(m_iTotalDLCInstalled); + pack->SetDLCDeviceID(ContentData.DeviceID); + app.m_dlcManager.addPack(pack); + handleDLC(pack); + + if (pack->getDLCItemsCount(DLCManager::e_DLCType_Texture) > 0) { + Minecraft::GetInstance()->skins->addTexturePackFromDLC( + pack, pack->GetPackId()); + } + } else { + app.DebugPrintf( + "Pack \"%ls\" is already installed. Updating license to %u\n", + CONTENT_DATA_DISPLAY_NAME(ContentData), dwLicenceMask); + + pack->SetDLCMountIndex(m_iTotalDLCInstalled); + pack->SetDLCDeviceID(ContentData.DeviceID); + pack->updateLicenseMask(dwLicenceMask); + } + + StorageManager.UnmountInstalledDLC(); + } + ++m_iTotalDLCInstalled; + mountNextDLC(iPad); +#endif + return 0; +} +#undef CONTENT_DATA_DISPLAY_NAME + +void DLCController::handleDLC(DLCPack* pack) { + unsigned int dwFilesProcessed = 0; +#if defined(_WINDOWS64) || defined(__linux__) + std::vector dlcFilenames; +#endif + StorageManager.GetMountedDLCFileList("DLCDrive", dlcFilenames); + for (int i = 0; i < dlcFilenames.size(); i++) { + app.m_dlcManager.readDLCDataFile(dwFilesProcessed, dlcFilenames[i], + pack); + } + if (dwFilesProcessed == 0) app.m_dlcManager.removePack(pack); +} + +void DLCController::addCreditText(const wchar_t* lpStr) { + app.DebugPrintf("ADDING CREDIT - %ls\n", lpStr); + SCreditTextItemDef* pCreditStruct = new SCreditTextItemDef; + pCreditStruct->m_eType = eSmallText; + pCreditStruct->m_iStringID[0] = NO_TRANSLATED_STRING; + pCreditStruct->m_iStringID[1] = NO_TRANSLATED_STRING; + pCreditStruct->m_Text = new wchar_t[wcslen(lpStr) + 1]; + wcscpy((wchar_t*)pCreditStruct->m_Text, lpStr); + vDLCCredits.push_back(pCreditStruct); +} + +bool DLCController::alreadySeenCreditText(const std::wstring& wstemp) { + for (unsigned int i = 0; i < m_vCreditText.size(); i++) { + std::wstring temp = m_vCreditText.at(i); + if (temp.compare(wstemp) == 0) { + return true; + } + } + m_vCreditText.push_back((wchar_t*)wstemp.c_str()); + return false; +} + +unsigned int DLCController::getDLCCreditsCount() { + return (unsigned int)vDLCCredits.size(); +} + +SCreditTextItemDef* DLCController::getDLCCredits(int iIndex) { + return vDLCCredits.at(iIndex); +} + +#if defined(_WINDOWS64) +int32_t DLCController::registerDLCData(wchar_t* pType, wchar_t* pBannerName, + int iGender, uint64_t ullOfferID_Full, + uint64_t ullOfferID_Trial, + wchar_t* pFirstSkin, + unsigned int uiSortIndex, int iConfig, + wchar_t* pDataFile) { + int32_t hr = 0; + DLC_INFO* pDLCData = new DLC_INFO; + memset(pDLCData, 0, sizeof(DLC_INFO)); + pDLCData->ullOfferID_Full = ullOfferID_Full; + pDLCData->ullOfferID_Trial = ullOfferID_Trial; + pDLCData->eDLCType = e_DLC_NotDefined; + pDLCData->iGender = iGender; + pDLCData->uiSortIndex = uiSortIndex; + pDLCData->iConfig = iConfig; + + if (pBannerName != L"") { + wcsncpy_s(pDLCData->wchBanner, pBannerName, MAX_BANNERNAME_SIZE); + } + if (pDataFile[0] != 0) { + wcsncpy_s(pDLCData->wchDataFile, pDataFile, MAX_BANNERNAME_SIZE); + } + + if (pType != nullptr) { + if (wcscmp(pType, L"Skin") == 0) { + pDLCData->eDLCType = e_DLC_SkinPack; + } else if (wcscmp(pType, L"Gamerpic") == 0) { + pDLCData->eDLCType = e_DLC_Gamerpics; + } else if (wcscmp(pType, L"Theme") == 0) { + pDLCData->eDLCType = e_DLC_Themes; + } else if (wcscmp(pType, L"Avatar") == 0) { + pDLCData->eDLCType = e_DLC_AvatarItems; + } else if (wcscmp(pType, L"MashUpPack") == 0) { + pDLCData->eDLCType = e_DLC_MashupPacks; + DLCTextures_PackID[pDLCData->iConfig] = ullOfferID_Full; + } else if (wcscmp(pType, L"TexturePack") == 0) { + pDLCData->eDLCType = e_DLC_TexturePacks; + DLCTextures_PackID[pDLCData->iConfig] = ullOfferID_Full; + } + } + + if (ullOfferID_Trial != 0ll) DLCInfo_Trial[ullOfferID_Trial] = pDLCData; + if (ullOfferID_Full != 0ll) DLCInfo_Full[ullOfferID_Full] = pDLCData; + if (pFirstSkin[0] != 0) DLCInfo_SkinName[pFirstSkin] = ullOfferID_Full; + + return hr; +} +#elif defined(__linux__) +int32_t DLCController::registerDLCData(wchar_t* pType, wchar_t* pBannerName, + int iGender, uint64_t ullOfferID_Full, + uint64_t ullOfferID_Trial, + wchar_t* pFirstSkin, + unsigned int uiSortIndex, int iConfig, + wchar_t* pDataFile) { + fprintf(stderr, + "warning: DLCController::registerDLCData unimplemented for " + "platform `__linux__`\n"); + return 0; +} +#endif + +bool DLCController::getDLCFullOfferIDForSkinID(const std::wstring& FirstSkin, + uint64_t* pullVal) { + auto it = DLCInfo_SkinName.find(FirstSkin); + if (it == DLCInfo_SkinName.end()) { + return false; + } else { + *pullVal = (uint64_t)it->second; + return true; + } +} + +bool DLCController::getDLCFullOfferIDForPackID(const int iPackID, + uint64_t* pullVal) { + auto it = DLCTextures_PackID.find(iPackID); + if (it == DLCTextures_PackID.end()) { + *pullVal = (uint64_t)0; + return false; + } else { + *pullVal = (uint64_t)it->second; + return true; + } +} + +DLC_INFO* DLCController::getDLCInfoForTrialOfferID( + uint64_t ullOfferID_Trial) { + if (DLCInfo_Trial.size() > 0) { + auto it = DLCInfo_Trial.find(ullOfferID_Trial); + if (it == DLCInfo_Trial.end()) { + return nullptr; + } else { + return it->second; + } + } else + return nullptr; +} + +DLC_INFO* DLCController::getDLCInfoForFullOfferID(uint64_t ullOfferID_Full) { + if (DLCInfo_Full.size() > 0) { + auto it = DLCInfo_Full.find(ullOfferID_Full); + if (it == DLCInfo_Full.end()) { + return nullptr; + } else { + return it->second; + } + } else + return nullptr; +} + +DLC_INFO* DLCController::getDLCInfoTrialOffer(int iIndex) { + std::unordered_map::iterator it = + DLCInfo_Trial.begin(); + for (int i = 0; i < iIndex; i++) { + ++it; + } + return it->second; +} + +DLC_INFO* DLCController::getDLCInfoFullOffer(int iIndex) { + std::unordered_map::iterator it = DLCInfo_Full.begin(); + for (int i = 0; i < iIndex; i++) { + ++it; + } + return it->second; +} + +uint64_t DLCController::getDLCInfoTexturesFullOffer(int iIndex) { + std::unordered_map::iterator it = DLCTextures_PackID.begin(); + for (int i = 0; i < iIndex; i++) { + ++it; + } + return it->second; +} + +int DLCController::getDLCInfoTrialOffersCount() { + return (int)DLCInfo_Trial.size(); +} + +int DLCController::getDLCInfoFullOffersCount() { + return (int)DLCInfo_Full.size(); +} + +int DLCController::getDLCInfoTexturesOffersCount() { + return (int)DLCTextures_PackID.size(); +} + +unsigned int DLCController::addDLCRequest(eDLCMarketplaceType eType, + bool bPromote) { + { + std::lock_guard lock(csDLCDownloadQueue); + + int iPosition = 0; + for (auto it = m_DLCDownloadQueue.begin(); + it != m_DLCDownloadQueue.end(); ++it) { + DLCRequest* pCurrent = *it; + if (pCurrent->dwType == m_dwContentTypeA[eType]) { + if (pCurrent->eState == e_DLC_ContentState_Retrieving || + pCurrent->eState == e_DLC_ContentState_Retrieved) { + return 0; + } else { + if (bPromote) { + m_DLCDownloadQueue.erase(m_DLCDownloadQueue.begin() + + iPosition); + m_DLCDownloadQueue.insert(m_DLCDownloadQueue.begin(), + pCurrent); + } + return 0; + } + } + iPosition++; + } + + DLCRequest* pDLCreq = new DLCRequest; + pDLCreq->dwType = m_dwContentTypeA[eType]; + pDLCreq->eState = e_DLC_ContentState_Idle; + m_DLCDownloadQueue.push_back(pDLCreq); + m_bAllDLCContentRetrieved = false; + } + + app.DebugPrintf("[Consoles_App] Added DLC request.\n"); + return 1; +} + +bool DLCController::retrieveNextDLCContent() { + int primPad = ProfileManager.GetPrimaryPad(); + if (primPad == -1 || !ProfileManager.IsSignedInLive(primPad)) { + return true; + } + + { + std::lock_guard lock(csDLCDownloadQueue); + for (auto it = m_DLCDownloadQueue.begin(); + it != m_DLCDownloadQueue.end(); ++it) { + DLCRequest* pCurrent = *it; + if (pCurrent->eState == e_DLC_ContentState_Retrieving) { + return true; + } + } + + for (auto it = m_DLCDownloadQueue.begin(); + it != m_DLCDownloadQueue.end(); ++it) { + DLCRequest* pCurrent = *it; + if (pCurrent->eState == e_DLC_ContentState_Idle) { +#if defined(_DEBUG) + app.DebugPrintf("RetrieveNextDLCContent - type = %d\n", + pCurrent->dwType); +#endif + C4JStorage::EDLCStatus status = StorageManager.GetDLCOffers( + ProfileManager.GetPrimaryPad(), + [this](int iOfferC, std::uint32_t dwType, int pad) { + return dlcOffersReturned(iOfferC, dwType, pad); + }, + pCurrent->dwType); + if (status == C4JStorage::EDLC_Pending) { + pCurrent->eState = e_DLC_ContentState_Retrieving; + } else { + app.DebugPrintf("RetrieveNextDLCContent - PROBLEM\n"); + pCurrent->eState = e_DLC_ContentState_Retrieved; + } + return true; + } + } + } + + app.DebugPrintf("[Consoles_App] Finished downloading dlc content.\n"); + return false; +} + +bool DLCController::checkTMSDLCCanStop() { + std::lock_guard lock(csTMSPPDownloadQueue); + for (auto it = m_TMSPPDownloadQueue.begin(); + it != m_TMSPPDownloadQueue.end(); ++it) { + TMSPPRequest* pCurrent = *it; + if (pCurrent->eState == e_TMS_ContentState_Retrieving) { + return false; + } + } + return true; +} + +int DLCController::dlcOffersReturned(int iOfferC, std::uint32_t dwType, + int iPad) { + { + std::lock_guard lock(csTMSPPDownloadQueue); + for (auto it = m_DLCDownloadQueue.begin(); + it != m_DLCDownloadQueue.end(); ++it) { + DLCRequest* pCurrent = *it; + if (pCurrent->dwType == static_cast(dwType)) { + m_iDLCOfferC = iOfferC; + app.DebugPrintf( + "DLCOffersReturned - type %u, count %d - setting to " + "retrieved\n", + dwType, iOfferC); + pCurrent->eState = e_DLC_ContentState_Retrieved; + break; + } + } + } + return 0; +} + +eDLCContentType DLCController::find_eDLCContentType(std::uint32_t dwType) { + for (int i = 0; i < e_DLC_MAX; i++) { + if (m_dwContentTypeA[i] == dwType) { + return (eDLCContentType)i; + } + } + return (eDLCContentType)0; +} + +bool DLCController::dlcContentRetrieved(eDLCMarketplaceType eType) { + std::lock_guard lock(csDLCDownloadQueue); + for (auto it = m_DLCDownloadQueue.begin(); it != m_DLCDownloadQueue.end(); + ++it) { + DLCRequest* pCurrent = *it; + if ((pCurrent->dwType == m_dwContentTypeA[eType]) && + (pCurrent->eState == e_DLC_ContentState_Retrieved)) { + return true; + } + } + return false; +} + +void DLCController::tickDLCOffersRetrieved() { + if (!m_bAllDLCContentRetrieved) { + if (!retrieveNextDLCContent()) { + app.DebugPrintf("[Consoles_App] All content retrieved.\n"); + m_bAllDLCContentRetrieved = true; + } + } +} + +void DLCController::clearAndResetDLCDownloadQueue() { + app.DebugPrintf("[Consoles_App] Clear and reset download queue.\n"); + + int iPosition = 0; + { + std::lock_guard lock(csTMSPPDownloadQueue); + for (auto it = m_DLCDownloadQueue.begin(); + it != m_DLCDownloadQueue.end(); ++it) { + DLCRequest* pCurrent = *it; + delete pCurrent; + iPosition++; + } + m_DLCDownloadQueue.clear(); + m_bAllDLCContentRetrieved = true; + } +} + +bool DLCController::retrieveNextTMSPPContent() { return false; } + +void DLCController::tickTMSPPFilesRetrieved() { + if (m_bTickTMSDLCFiles && !m_bAllTMSContentRetrieved) { + if (retrieveNextTMSPPContent() == false) { + m_bAllTMSContentRetrieved = true; + } + } +} + +void DLCController::clearTMSPPFilesRetrieved() { + int iPosition = 0; + { + std::lock_guard lock(csTMSPPDownloadQueue); + for (auto it = m_TMSPPDownloadQueue.begin(); + it != m_TMSPPDownloadQueue.end(); ++it) { + TMSPPRequest* pCurrent = *it; + delete pCurrent; + iPosition++; + } + m_TMSPPDownloadQueue.clear(); + m_bAllTMSContentRetrieved = true; + } +} + +unsigned int DLCController::addTMSPPFileTypeRequest(eDLCContentType eType, + bool bPromote) { + std::lock_guard lock(csTMSPPDownloadQueue); + + if (eType == e_DLC_TexturePackData) { + int iCount = getDLCInfoFullOffersCount(); + + for (int i = 0; i < iCount; i++) { + DLC_INFO* pDLC = getDLCInfoFullOffer(i); + + if ((pDLC->eDLCType == e_DLC_TexturePacks) || + (pDLC->eDLCType == e_DLC_MashupPacks)) { + if (pDLC->wchDataFile[0] != 0) { + { + bool bPresent = app.IsFileInTPD(pDLC->iConfig); + + if (!bPresent) { + bool bAlreadyInQueue = false; + for (auto it = m_TMSPPDownloadQueue.begin(); + it != m_TMSPPDownloadQueue.end(); ++it) { + TMSPPRequest* pCurrent = *it; + if (wcscmp(pDLC->wchDataFile, + pCurrent->wchFilename) == 0) { + bAlreadyInQueue = true; + break; + } + } + + if (!bAlreadyInQueue) { + TMSPPRequest* pTMSPPreq = new TMSPPRequest; + pTMSPPreq->CallbackFunc = + &DLCController::tmsPPFileReturned; + pTMSPPreq->lpCallbackParam = this; + pTMSPPreq->eStorageFacility = + C4JStorage::eGlobalStorage_Title; + pTMSPPreq->eFileTypeVal = + C4JStorage::TMS_FILETYPE_BINARY; + memcpy(pTMSPPreq->wchFilename, + pDLC->wchDataFile, + sizeof(wchar_t) * MAX_BANNERNAME_SIZE); + pTMSPPreq->eType = e_DLC_TexturePackData; + pTMSPPreq->eState = e_TMS_ContentState_Queued; + m_bAllTMSContentRetrieved = false; + m_TMSPPDownloadQueue.push_back(pTMSPPreq); + } + } else { + app.DebugPrintf( + "Texture data already present in the TPD\n"); + } + } + } + } + } + } else { + int iCount; + iCount = getDLCInfoFullOffersCount(); + for (int i = 0; i < iCount; i++) { + DLC_INFO* pDLC = getDLCInfoFullOffer(i); + if (pDLC->eDLCType == eType) { + wchar_t* cString = pDLC->wchBanner; + { + bool bPresent = app.IsFileInMemoryTextures(cString); + + if (!bPresent) { + bool bAlreadyInQueue = false; + for (auto it = m_TMSPPDownloadQueue.begin(); + it != m_TMSPPDownloadQueue.end(); ++it) { + TMSPPRequest* pCurrent = *it; + if (wcscmp(pDLC->wchBanner, + pCurrent->wchFilename) == 0) { + bAlreadyInQueue = true; + break; + } + } + + if (!bAlreadyInQueue) { + TMSPPRequest* pTMSPPreq = new TMSPPRequest; + memset(pTMSPPreq, 0, sizeof(TMSPPRequest)); + pTMSPPreq->CallbackFunc = + &DLCController::tmsPPFileReturned; + pTMSPPreq->lpCallbackParam = this; + pTMSPPreq->eStorageFacility = + C4JStorage::eGlobalStorage_Title; + pTMSPPreq->eFileTypeVal = + C4JStorage::TMS_FILETYPE_BINARY; + memcpy(pTMSPPreq->wchFilename, pDLC->wchBanner, + sizeof(wchar_t) * MAX_BANNERNAME_SIZE); + pTMSPPreq->eType = eType; + pTMSPPreq->eState = e_TMS_ContentState_Queued; + m_bAllTMSContentRetrieved = false; + m_TMSPPDownloadQueue.push_back(pTMSPPreq); + app.DebugPrintf( + "===m_TMSPPDownloadQueue Adding %ls, q size is " + "%d\n", + pTMSPPreq->wchFilename, + m_TMSPPDownloadQueue.size()); + } + } + } + } + } + } + + return 1; +} + +int DLCController::tmsPPFileReturned(void* pParam, int iPad, int iUserData, + C4JStorage::PTMSPP_FILEDATA pFileData, + const char* szFilename) { + DLCController* pClass = (DLCController*)pParam; + + { + std::lock_guard lock(pClass->csTMSPPDownloadQueue); + for (auto it = pClass->m_TMSPPDownloadQueue.begin(); + it != pClass->m_TMSPPDownloadQueue.end(); ++it) { + TMSPPRequest* pCurrent = *it; +#if defined(_WINDOWS64) + char szFile[MAX_TMSFILENAME_SIZE]; + wcstombs(szFile, pCurrent->wchFilename, MAX_TMSFILENAME_SIZE); + + if (strcmp(szFilename, szFile) == 0) +#endif + { + pCurrent->eState = e_TMS_ContentState_Retrieved; + + if (pFileData != nullptr) { + switch (pCurrent->eType) { + case e_DLC_TexturePackData: { + app.DebugPrintf("--- Got texturepack data %ls\n", + pCurrent->wchFilename); + int iConfig = + app.GetTPConfigVal(pCurrent->wchFilename); + app.AddMemoryTPDFile(iConfig, pFileData->pbData, + pFileData->size); + } break; + default: + app.DebugPrintf("--- Got image data - %ls\n", + pCurrent->wchFilename); + app.AddMemoryTextureFile(pCurrent->wchFilename, + pFileData->pbData, + pFileData->size); + break; + } + } else { + app.DebugPrintf("TMSImageReturned failed (%s)...\n", + szFilename); + } + break; + } + } + } + + return 0; +} diff --git a/targets/app/common/DLCController.h b/targets/app/common/DLCController.h new file mode 100644 index 000000000..0fc5d7425 --- /dev/null +++ b/targets/app/common/DLCController.h @@ -0,0 +1,137 @@ +#pragma once + +#include +#include +#include +#include +#include + +#include "app/common/App_structs.h" +#include "app/common/DLC/DLCManager.h" +#include "platform/sdl2/Storage.h" +#include "platform/XboxStubs.h" + +struct SCreditTextItemDef; + +class DLCPack; + +class DLCController { +public: + DLCController(); + + // Install process + bool startInstallDLCProcess(int iPad); + int dlcInstalledCallback(int iInstalledC, int iPad); + void mountNextDLC(int iPad); + int dlcMountedCallback(int iPad, std::uint32_t dwErr, + std::uint32_t dwLicenceMask); + void handleDLC(DLCPack* pack); + + bool dlcInstallPending() { return m_bDLCInstallPending; } + bool dlcInstallProcessCompleted() { return m_bDLCInstallProcessCompleted; } + void clearDLCInstalled() { m_bDLCInstallProcessCompleted = false; } + + static int marketplaceCountsCallback(void* pParam, + C4JStorage::DLC_TMS_DETAILS*, + int iPad); + + // DLC info registration + static int32_t registerDLCData(wchar_t*, wchar_t*, int, uint64_t, uint64_t, + wchar_t*, unsigned int, int, + wchar_t* pDataFile); + bool getDLCFullOfferIDForSkinID(const std::wstring& FirstSkin, + uint64_t* pullVal); + bool getDLCFullOfferIDForPackID(const int iPackID, uint64_t* pullVal); + DLC_INFO* getDLCInfoForTrialOfferID(uint64_t ullOfferID_Trial); + DLC_INFO* getDLCInfoForFullOfferID(uint64_t ullOfferID_Full); + DLC_INFO* getDLCInfoTrialOffer(int iIndex); + DLC_INFO* getDLCInfoFullOffer(int iIndex); + uint64_t getDLCInfoTexturesFullOffer(int iIndex); + int getDLCInfoTrialOffersCount(); + int getDLCInfoFullOffersCount(); + int getDLCInfoTexturesOffersCount(); + + // DLC content/offers + unsigned int addDLCRequest(eDLCMarketplaceType eContentType, + bool bPromote = false); + bool retrieveNextDLCContent(); + bool checkTMSDLCCanStop(); + int dlcOffersReturned(int iOfferC, std::uint32_t dwType, int iPad); + std::uint32_t getDLCContentType(eDLCContentType eType) { + return m_dwContentTypeA[eType]; + } + eDLCContentType find_eDLCContentType(std::uint32_t dwType); + int getDLCOffersCount() { return m_iDLCOfferC; } + bool dlcContentRetrieved(eDLCMarketplaceType eType); + void tickDLCOffersRetrieved(); + void clearAndResetDLCDownloadQueue(); + + // TMS/TMSPP + bool retrieveNextTMSPPContent(); + void tickTMSPPFilesRetrieved(); + void clearTMSPPFilesRetrieved(); + unsigned int addTMSPPFileTypeRequest(eDLCContentType eType, + bool bPromote = false); + static int tmsPPFileReturned(void* pParam, int iPad, int iUserData, + C4JStorage::PTMSPP_FILEDATA pFileData, + const char* szFilename); + + // Credit text + void addCreditText(const wchar_t* lpStr); + bool alreadySeenCreditText(const std::wstring& wstemp); + unsigned int getDLCCreditsCount(); + SCreditTextItemDef* getDLCCredits(int iIndex); + + // New DLC available + void clearNewDLCAvailable() { + m_bNewDLCAvailable = false; + m_bSeenNewDLCTip = true; + } + bool getNewDLCAvailable() { return m_bNewDLCAvailable; } + void displayNewDLCTipAgain() { m_bSeenNewDLCTip = false; } + bool displayNewDLCTip() { + if (!m_bSeenNewDLCTip) { + m_bSeenNewDLCTip = true; + return true; + } else + return false; + } + + void setTickTMSDLCFiles(bool bVal) { m_bTickTMSDLCFiles = bVal; } + + // Public data needed by other parts + std::vector m_vCreditText; + std::uint8_t* m_pDLCFileBuffer; + unsigned int m_dwDLCFileSize; + + // DLC install counters (accessed by dlcMountedCallback) + int m_iTotalDLC; + int m_iTotalDLCInstalled; + + // Static maps + static std::unordered_map MojangData; + static std::unordered_map DLCTextures_PackID; + static std::unordered_map DLCInfo_Trial; + static std::unordered_map DLCInfo_Full; + static std::unordered_map DLCInfo_SkinName; + static std::uint32_t m_dwContentTypeA[e_Marketplace_MAX]; + +private: + std::vector vDLCCredits; + std::vector m_DLCDownloadQueue; + std::vector m_TMSPPDownloadQueue; + + int m_iDLCOfferC; + bool m_bAllDLCContentRetrieved; + bool m_bAllTMSContentRetrieved; + bool m_bTickTMSDLCFiles; + std::mutex csDLCDownloadQueue; + std::mutex csTMSPPDownloadQueue; + + bool m_bDLCInstallProcessCompleted; + bool m_bDLCInstallPending; + bool m_bDefaultCapeInstallAttempted; + + bool m_bNewDLCAvailable; + bool m_bSeenNewDLCTip; +}; diff --git a/targets/app/common/DebugOptions.cpp b/targets/app/common/DebugOptions.cpp new file mode 100644 index 000000000..b8a7bd099 --- /dev/null +++ b/targets/app/common/DebugOptions.cpp @@ -0,0 +1,33 @@ +#include "app/common/DebugOptions.h" + +DebugOptions::DebugOptions() { +#if defined(_DEBUG_MENUS_ENABLED) +#if defined(_CONTENT_PACKAGE) + m_bDebugOptions = + false; // make them off by default in a content package build +#else + m_bDebugOptions = true; +#endif +#else + m_bDebugOptions = false; +#endif + + m_bLoadSavesFromFolderEnabled = false; + m_bWriteSavesToFolderEnabled = false; + m_bMobsDontAttack = false; + m_bMobsDontTick = false; + m_bFreezePlayers = false; + +#if defined(_CONTENT_PACAKGE) + m_bUseDPadForDebug = false; +#else + m_bUseDPadForDebug = true; +#endif +} + +#if defined(_DEBUG_MENUS_ENABLED) +bool DebugOptions::debugArtToolsOn(unsigned int debugMask) { + return settingsOn() && + (debugMask & (1L << eDebugSetting_ArtTools)) != 0; +} +#endif diff --git a/targets/app/common/DebugOptions.h b/targets/app/common/DebugOptions.h new file mode 100644 index 000000000..de437d650 --- /dev/null +++ b/targets/app/common/DebugOptions.h @@ -0,0 +1,52 @@ +#pragma once + +#include "app/common/Console_Debug_enum.h" + +class DebugOptions { +public: + DebugOptions(); + + bool settingsOn() const { return m_bDebugOptions; } + void setDebugOptions(bool bVal) { m_bDebugOptions = bVal; } + + bool getLoadSavesFromFolderEnabled() const { + return m_bLoadSavesFromFolderEnabled; + } + void setLoadSavesFromFolderEnabled(bool bVal) { + m_bLoadSavesFromFolderEnabled = bVal; + } + + bool getWriteSavesToFolderEnabled() const { + return m_bWriteSavesToFolderEnabled; + } + void setWriteSavesToFolderEnabled(bool bVal) { + m_bWriteSavesToFolderEnabled = bVal; + } + + bool getMobsDontAttack() const { return m_bMobsDontAttack; } + void setMobsDontAttack(bool bVal) { m_bMobsDontAttack = bVal; } + + bool getUseDPadForDebug() const { return m_bUseDPadForDebug; } + void setUseDPadForDebug(bool bVal) { m_bUseDPadForDebug = bVal; } + + bool getMobsDontTick() const { return m_bMobsDontTick; } + void setMobsDontTick(bool bVal) { m_bMobsDontTick = bVal; } + + bool getFreezePlayers() const { return m_bFreezePlayers; } + void setFreezePlayers(bool bVal) { m_bFreezePlayers = bVal; } + +#if defined(_DEBUG_MENUS_ENABLED) + bool debugArtToolsOn(unsigned int debugMask); +#else + bool debugArtToolsOn(unsigned int) { return false; } +#endif + +private: + bool m_bDebugOptions; + bool m_bLoadSavesFromFolderEnabled; + bool m_bWriteSavesToFolderEnabled; + bool m_bMobsDontAttack; + bool m_bUseDPadForDebug; + bool m_bMobsDontTick; + bool m_bFreezePlayers; +}; diff --git a/targets/app/common/Game.cpp b/targets/app/common/Game.cpp index 82135eba4..04f9bdc53 100644 --- a/targets/app/common/Game.cpp +++ b/targets/app/common/Game.cpp @@ -1,3 +1,4 @@ +#include "minecraft/GameHostOptions.h" #include "app/common/Game.h" #include "platform/PlatformTypes.h" @@ -6,24 +7,24 @@ #include "platform/sdl2/Render.h" #include "platform/sdl2/Storage.h" #include "app/common/App_Defines.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/App_structs.h" -#include "app/common/src/Console_Debug_enum.h" -#include "app/common/src/DLC/DLCManager.h" -#include "app/common/src/DLC/DLCSkinFile.h" -#include "app/common/src/GameRules/GameRuleManager.h" -#include "app/common/src/Network/GameNetworkManager.h" -#include "app/common/src/Network/NetworkPlayerInterface.h" -#include "app/common/src/Tutorial/Tutorial.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/common/src/UI/Scenes/UIScene_FullscreenProgress.h" +#include "app/common/Console_Debug_enum.h" +#include "app/common/DLC/DLCManager.h" +#include "app/common/DLC/DLCSkinFile.h" +#include "app/common/GameRules/GameRuleManager.h" +#include "app/common/Network/GameNetworkManager.h" +#include "app/common/Network/NetworkPlayerInterface.h" +#include "app/common/Tutorial/Tutorial.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/Scenes/UIScene_FullscreenProgress.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "app/linux/Stubs/winapi_stubs.h" -#include "app/include/NetTypes.h" -#include "SkinBox.h" -#include "XboxStubs.h" +#include "platform/NetTypes.h" +#include "minecraft/client/model/SkinBox.h" +#include "platform/XboxStubs.h" #include "platform/PlatformServices.h" #include "java/Class.h" #include "java/File.h" @@ -74,12 +75,12 @@ #include #include "platform/sdl2/Input.h" -#include "app/common/src/Audio/SoundEngine.h" -#include "app/common/src/Colours/ColourTable.h" -#include "app/common/src/DLC/DLCPack.h" -#include "app/common/src/Localisation/StringTable.h" -#include "app/common/src/UI/All Platforms/ArchiveFile.h" -#include "app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.h" +#include "app/common/Audio/SoundEngine.h" +#include "app/common/Colours/ColourTable.h" +#include "app/common/DLC/DLCPack.h" +#include "app/common/Localisation/StringTable.h" +#include "app/common/UI/All Platforms/ArchiveFile.h" +#include "app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.h" #include "Minecraft_Macros.h" #include "util/Timer.h" #include "util/StringHelpers.h" @@ -115,20 +116,13 @@ class ModelPart; class SignTileEntity; // Game app; -unsigned int Game::m_uiLastSignInData = 0; const float Game::fSafeZoneX = 64.0f; // 5% of 1280 const float Game::fSafeZoneY = 36.0f; // 5% of 720 -int Game::s_iHTMLFontSizesA[eHTMLSize_COUNT] = { - // 20,15,20,24 - 20, 13, 20, 26}; - Game::Game() { ZoneScopedN("Game::Game"); if (GAME_SETTINGS_PROFILE_DATA_BYTES != sizeof(GAME_SETTINGS)) { - // 4J Stu - See comment for GAME_SETTINGS_PROFILE_DATA_BYTES in - // Xbox_App.h DebugPrintf( "WARNING: The size of the profile GAME_SETTINGS struct has " "changed, so all stat data is likely incorrect. Is: %d, Should be: " @@ -140,84 +134,19 @@ Game::Game() { } for (int i = 0; i < XUSER_MAX_COUNT; i++) { - m_eTMSAction[i] = eTMSAction_Idle; - m_eXuiAction[i] = eAppAction_Idle; - m_eXuiActionParam[i] = nullptr; - // m_dwAdditionalModelParts[i] = 0; - - if (FAILED(XUserGetSigninInfo(i, - XUSER_GET_SIGNIN_INFO_OFFLINE_XUID_ONLY, - &m_currentSigninInfo[i]))) { - m_currentSigninInfo[i].xuid = INVALID_XUID; - m_currentSigninInfo[i].dwGuestNumber = 0; - } DebugPrintf("Player at index %d has guest number %d\n", i, - m_currentSigninInfo[i].dwGuestNumber); - - m_bRead_BannedListA[i] = false; - SetBanListCheck(i, false); - - m_uiOpacityCountDown[i] = 0; + m_networkController.m_currentSigninInfo[i].dwGuestNumber); } - m_eGlobalXuiAction = eAppAction_Idle; - m_eGlobalXuiServerAction = eXuiServerAction_Idle; m_bResourcesLoaded = false; m_bGameStarted = false; m_bIsAppPaused = false; - // m_bSplitScreenEnabled = false; m_bIntroRunning = false; m_eGameMode = eMode_Singleplayer; - m_bLoadSavesFromFolderEnabled = false; - m_bWriteSavesToFolderEnabled = false; - // m_bInterfaceRenderingOff = false; - // m_bHandRenderingOff = false; m_bTutorialMode = false; - m_disconnectReason = DisconnectPacket::eDisconnect_None; - m_bLiveLinkRequired = false; - m_bChangingSessionType = false; - m_bReallyChangingSessionType = false; -#if defined(_DEBUG_MENUS_ENABLED) - -#if defined(_CONTENT_PACKAGE) - m_bDebugOptions = - false; // make them off by default in a content package build -#else - m_bDebugOptions = true; -#endif -#else - m_bDebugOptions = false; -#endif - - // memset(m_PreviewBuffer, 0, sizeof(XSOCIAL_PREVIEWIMAGE)*XUSER_MAX_COUNT); - - m_xuidNotch = INVALID_XUID; - - memset(&m_InviteData, 0, sizeof(JoinFromInviteData)); - - // m_bRead_TMS_XUIDS_XML=false; - // m_bRead_TMS_DLCINFO_XML=false; - - m_pDLCFileBuffer = nullptr; - m_dwDLCFileSize = 0; - m_pBannedListFileBuffer = nullptr; - m_dwBannedListFileSize = 0; - - m_bDefaultCapeInstallAttempted = false; - m_bDLCInstallProcessCompleted = false; - m_bDLCInstallPending = false; - m_iTotalDLC = 0; - m_iTotalDLCInstalled = 0; mfTrialPausedTime = 0.0f; - m_uiAutosaveTimer = {}; - memset(m_pszUniqueMapName, 0, 14); - - m_bNewDLCAvailable = false; - m_bSeenNewDLCTip = false; - - m_uiGameHostSettings = 0; #if defined(_LARGE_WORLDS) m_GameNewWorldSize = 0; @@ -225,28 +154,8 @@ Game::Game() { m_GameNewHellScale = 0; #endif - memset(m_playerColours, 0, MINECRAFT_NET_MAX_PLAYERS); - - m_iDLCOfferC = 0; - m_bAllDLCContentRetrieved = true; - m_bAllTMSContentRetrieved = true; - m_bTickTMSDLCFiles = true; - m_saveNotificationDepth = 0; - - m_dwRequiredTexturePackID = 0; - m_bResetNether = false; -#if defined(_CONTENT_PACAKGE) - m_bUseDPadForDebug = false; -#else - m_bUseDPadForDebug = true; -#endif - - for (int i = 0; i < XUSER_MAX_COUNT; i++) { - m_vBannedListA[i] = new std::vector; - } - LocaleAndLanguageInit(); } @@ -282,1819 +191,42 @@ const wchar_t* Game::GetString(int iID) { ZoneScopedN("Game::GetString"); // return L"Değişiklikler ve Yenilikler"; // return L"ÕÕÕÕÖÖÖÖ"; - return app.m_stringTable->getString(iID); + return app.m_localizationManager.getString(iID); } -void Game::SetAction(int iPad, eXuiAction action, void* param) { - ZoneScopedN("Game::SetAction"); - if ((m_eXuiAction[iPad] == eAppAction_ReloadTexturePack) && - (action == eAppAction_EthernetDisconnected)) { - app.DebugPrintf( - "Invalid change of App action for pad %d from %d to %d, ignoring\n", - iPad, m_eXuiAction[iPad], action); - } else if ((m_eXuiAction[iPad] == eAppAction_ReloadTexturePack) && - (action == eAppAction_ExitWorld)) { - app.DebugPrintf( - "Invalid change of App action for pad %d from %d to %d, ignoring\n", - iPad, m_eXuiAction[iPad], action); - } else if (m_eXuiAction[iPad] == eAppAction_ExitWorldCapturedThumbnail && - action != eAppAction_Idle) { - app.DebugPrintf( - "Invalid change of App action for pad %d from %d to %d, ignoring\n", - iPad, m_eXuiAction[iPad], action); - } else { - app.DebugPrintf("Changing App action for pad %d from %d to %d\n", iPad, - m_eXuiAction[iPad], action); - m_eXuiAction[iPad] = action; - m_eXuiActionParam[iPad] = param; - } -} +// SetAction moved to MenuController +// HandleButtonPresses moved to GameSettingsManager bool Game::IsAppPaused() { return m_bIsAppPaused; } void Game::SetAppPaused(bool val) { m_bIsAppPaused = val; } -void Game::HandleButtonPresses() { - ZoneScopedN("Game::HandleButtonPresses"); - for (int i = 0; i < 4; i++) { - HandleButtonPresses(i); - } -} +// Load*Menu methods moved to MenuController -void Game::HandleButtonPresses(int iPad) { - ZoneScopedN("Game::HandleButtonPresses"); - // // test an update of the profile data - // void *pData=ProfileManager.GetGameDefinedProfileData(iPad); - // - // unsigned char *pchData= (unsigned char *)pData; - // int iCount=0; - // for(int i=0;i player, - bool bNavigateBack) { - ZoneScopedN("Game::LoadInventoryMenu"); - bool success = true; - - InventoryScreenInput* initData = new InventoryScreenInput(); - initData->player = player; - initData->bNavigateBack = bNavigateBack; - initData->iPad = iPad; - - if (app.GetLocalPlayerCount() > 1) { - initData->bSplitscreen = true; - success = ui.NavigateToScene(iPad, eUIScene_InventoryMenu, initData); - } else { - initData->bSplitscreen = false; - success = ui.NavigateToScene(iPad, eUIScene_InventoryMenu, initData); - } - - return success; -} - -bool Game::LoadCreativeMenu(int iPad, - std::shared_ptr player, - bool bNavigateBack) { - ZoneScopedN("Game::LoadCreativeMenu"); - bool success = true; - - InventoryScreenInput* initData = new InventoryScreenInput(); - initData->player = player; - initData->bNavigateBack = bNavigateBack; - initData->iPad = iPad; - - if (app.GetLocalPlayerCount() > 1) { - initData->bSplitscreen = true; - success = ui.NavigateToScene(iPad, eUIScene_CreativeMenu, initData); - } else { - initData->bSplitscreen = false; - success = ui.NavigateToScene(iPad, eUIScene_CreativeMenu, initData); - } - - return success; -} - -bool Game::LoadCrafting2x2Menu(int iPad, - std::shared_ptr player) { - ZoneScopedN("Game::LoadCrafting2x2Menu"); - bool success = true; - - CraftingPanelScreenInput* initData = new CraftingPanelScreenInput(); - initData->player = player; - initData->iContainerType = RECIPE_TYPE_2x2; - initData->iPad = iPad; - initData->x = 0; - initData->y = 0; - initData->z = 0; - - if (app.GetLocalPlayerCount() > 1) { - initData->bSplitscreen = true; - success = ui.NavigateToScene(iPad, eUIScene_Crafting2x2Menu, initData); - } else { - initData->bSplitscreen = false; - success = ui.NavigateToScene(iPad, eUIScene_Crafting2x2Menu, initData); - } - - return success; -} - -bool Game::LoadCrafting3x3Menu(int iPad, - std::shared_ptr player, - int x, int y, int z) { - ZoneScopedN("Game::LoadCrafting3x3Menu"); - bool success = true; - - CraftingPanelScreenInput* initData = new CraftingPanelScreenInput(); - initData->player = player; - initData->iContainerType = RECIPE_TYPE_3x3; - initData->iPad = iPad; - initData->x = x; - initData->y = y; - initData->z = z; - - if (app.GetLocalPlayerCount() > 1) { - initData->bSplitscreen = true; - success = ui.NavigateToScene(iPad, eUIScene_Crafting3x3Menu, initData); - } else { - initData->bSplitscreen = false; - success = ui.NavigateToScene(iPad, eUIScene_Crafting3x3Menu, initData); - } - - return success; -} - -bool Game::LoadFireworksMenu(int iPad, - std::shared_ptr player, - int x, int y, int z) { - ZoneScopedN("Game::LoadFireworksMenu"); - bool success = true; - - FireworksScreenInput* initData = new FireworksScreenInput(); - initData->player = player; - initData->iPad = iPad; - initData->x = x; - initData->y = y; - initData->z = z; - - if (app.GetLocalPlayerCount() > 1) { - initData->bSplitscreen = true; - success = ui.NavigateToScene(iPad, eUIScene_FireworksMenu, initData); - } else { - initData->bSplitscreen = false; - success = ui.NavigateToScene(iPad, eUIScene_FireworksMenu, initData); - } - - return success; -} - -bool Game::LoadEnchantingMenu(int iPad, - std::shared_ptr inventory, - int x, int y, int z, Level* level, - const std::wstring& name) { - ZoneScopedN("Game::LoadEnchantingMenu"); - bool success = true; - - EnchantingScreenInput* initData = new EnchantingScreenInput(); - initData->inventory = inventory; - initData->level = level; - initData->x = x; - initData->y = y; - initData->z = z; - initData->iPad = iPad; - initData->name = name; - - if (app.GetLocalPlayerCount() > 1) { - initData->bSplitscreen = true; - success = ui.NavigateToScene(iPad, eUIScene_EnchantingMenu, initData); - } else { - initData->bSplitscreen = false; - success = ui.NavigateToScene(iPad, eUIScene_EnchantingMenu, initData); - } - - return success; -} - -bool Game::LoadFurnaceMenu( - int iPad, std::shared_ptr inventory, - std::shared_ptr furnace) { - ZoneScopedN("Game::LoadFurnaceMenu"); - bool success = true; - - FurnaceScreenInput* initData = new FurnaceScreenInput(); - - initData->furnace = furnace; - initData->inventory = inventory; - initData->iPad = iPad; - - // Load the scene. - if (app.GetLocalPlayerCount() > 1) { - initData->bSplitscreen = true; - success = ui.NavigateToScene(iPad, eUIScene_FurnaceMenu, initData); - } else { - initData->bSplitscreen = false; - success = ui.NavigateToScene(iPad, eUIScene_FurnaceMenu, initData); - } - - return success; -} - -bool Game::LoadBrewingStandMenu( - int iPad, std::shared_ptr inventory, - std::shared_ptr brewingStand) { - ZoneScopedN("Game::LoadBrewingStandMenu"); - bool success = true; - - BrewingScreenInput* initData = new BrewingScreenInput(); - - initData->brewingStand = brewingStand; - initData->inventory = inventory; - initData->iPad = iPad; - - // Load the scene. - if (app.GetLocalPlayerCount() > 1) { - initData->bSplitscreen = true; - success = ui.NavigateToScene(iPad, eUIScene_BrewingStandMenu, initData); - } else { - initData->bSplitscreen = false; - success = ui.NavigateToScene(iPad, eUIScene_BrewingStandMenu, initData); - } - - return success; -} - -bool Game::LoadContainerMenu(int iPad, - std::shared_ptr inventory, - std::shared_ptr container) { - ZoneScopedN("Game::LoadContainerMenu"); - bool success = true; - - ContainerScreenInput* initData = new ContainerScreenInput(); - - initData->inventory = inventory; - initData->container = container; - initData->iPad = iPad; - - // Load the scene. - if (app.GetLocalPlayerCount() > 1) { - initData->bSplitscreen = true; - - bool bLargeChest = - (initData->container->getContainerSize() > 3 * 9) ? true : false; - if (bLargeChest) { - success = - ui.NavigateToScene(iPad, eUIScene_LargeContainerMenu, initData); - } else { - success = - ui.NavigateToScene(iPad, eUIScene_ContainerMenu, initData); - } - } else { - initData->bSplitscreen = false; - success = ui.NavigateToScene(iPad, eUIScene_ContainerMenu, initData); - } - - return success; -} - -bool Game::LoadTrapMenu(int iPad, std::shared_ptr inventory, - std::shared_ptr trap) { - ZoneScopedN("Game::LoadTrapMenu"); - bool success = true; - - TrapScreenInput* initData = new TrapScreenInput(); - - initData->inventory = inventory; - initData->trap = trap; - initData->iPad = iPad; - - // Load the scene. - if (app.GetLocalPlayerCount() > 1) { - initData->bSplitscreen = true; - success = ui.NavigateToScene(iPad, eUIScene_DispenserMenu, initData); - } else { - initData->bSplitscreen = false; - success = ui.NavigateToScene(iPad, eUIScene_DispenserMenu, initData); - } - - return success; -} - -bool Game::LoadSignEntryMenu(int iPad, - std::shared_ptr sign) { - ZoneScopedN("Game::LoadSignEntryMenu"); - bool success = true; - - SignEntryScreenInput* initData = new SignEntryScreenInput(); - - initData->sign = sign; - initData->iPad = iPad; - - success = ui.NavigateToScene(iPad, eUIScene_SignEntryMenu, initData); - - delete initData; - - return success; -} - -bool Game::LoadRepairingMenu(int iPad, - std::shared_ptr inventory, - Level* level, int x, int y, int z) { - ZoneScopedN("Game::LoadRepairingMenu"); - bool success = true; - - AnvilScreenInput* initData = new AnvilScreenInput(); - initData->inventory = inventory; - initData->level = level; - initData->x = x; - initData->y = y; - initData->z = z; - initData->iPad = iPad; - if (app.GetLocalPlayerCount() > 1) - initData->bSplitscreen = true; - else - initData->bSplitscreen = false; - - success = ui.NavigateToScene(iPad, eUIScene_AnvilMenu, initData); - - return success; -} - -bool Game::LoadTradingMenu(int iPad, - std::shared_ptr inventory, - std::shared_ptr trader, - Level* level, const std::wstring& name) { - ZoneScopedN("Game::LoadTradingMenu"); - bool success = true; - - TradingScreenInput* initData = new TradingScreenInput(); - initData->inventory = inventory; - initData->trader = trader; - initData->level = level; - initData->iPad = iPad; - if (app.GetLocalPlayerCount() > 1) - initData->bSplitscreen = true; - else - initData->bSplitscreen = false; - - success = ui.NavigateToScene(iPad, eUIScene_TradingMenu, initData); - - return success; -} - -bool Game::LoadHopperMenu(int iPad, - std::shared_ptr inventory, - std::shared_ptr hopper) { - ZoneScopedN("Game::LoadHopperMenu"); - bool success = true; - - HopperScreenInput* initData = new HopperScreenInput(); - initData->inventory = inventory; - initData->hopper = hopper; - initData->iPad = iPad; - if (app.GetLocalPlayerCount() > 1) - initData->bSplitscreen = true; - else - initData->bSplitscreen = false; - - success = ui.NavigateToScene(iPad, eUIScene_HopperMenu, initData); - - return success; -} - -bool Game::LoadHopperMenu(int iPad, - std::shared_ptr inventory, - std::shared_ptr hopper) { - ZoneScopedN("Game::LoadHopperMenu"); - bool success = true; - - HopperScreenInput* initData = new HopperScreenInput(); - initData->inventory = inventory; - initData->hopper = std::dynamic_pointer_cast(hopper); - initData->iPad = iPad; - if (app.GetLocalPlayerCount() > 1) - initData->bSplitscreen = true; - else - initData->bSplitscreen = false; - - success = ui.NavigateToScene(iPad, eUIScene_HopperMenu, initData); - - return success; -} - -bool Game::LoadHorseMenu(int iPad, - std::shared_ptr inventory, - std::shared_ptr container, - std::shared_ptr horse) { - ZoneScopedN("Game::LoadHorseMenu"); - bool success = true; - - HorseScreenInput* initData = new HorseScreenInput(); - initData->inventory = inventory; - initData->container = container; - initData->horse = horse; - initData->iPad = iPad; - if (app.GetLocalPlayerCount() > 1) - initData->bSplitscreen = true; - else - initData->bSplitscreen = false; - - success = ui.NavigateToScene(iPad, eUIScene_HorseMenu, initData); - - return success; -} - -bool Game::LoadBeaconMenu(int iPad, - std::shared_ptr inventory, - std::shared_ptr beacon) { - ZoneScopedN("Game::LoadBeaconMenu"); - bool success = true; - - BeaconScreenInput* initData = new BeaconScreenInput(); - initData->inventory = inventory; - initData->beacon = beacon; - initData->iPad = iPad; - if (app.GetLocalPlayerCount() > 1) - initData->bSplitscreen = true; - else - initData->bSplitscreen = false; - - success = ui.NavigateToScene(iPad, eUIScene_BeaconMenu, initData); - - return success; -} ////////////////////////////////////////////// // GAME SETTINGS ////////////////////////////////////////////// -void Game::InitGameSettings() { - ZoneScopedN("Game::InitGameSettings"); - for (int i = 0; i < XUSER_MAX_COUNT; i++) { - GameSettingsA[i] = - (GAME_SETTINGS*)ProfileManager.GetGameDefinedProfileData(i); - // clear the flag to say the settings have changed - GameSettingsA[i]->bSettingsChanged = false; - // SetDefaultGameSettings(i); - done on a callback from the profile - // manager - // 4J-PB - adding in for Windows & PS3 to set the defaults for the - // joypad -#if defined(_WINDOWS64) - C_4JProfile::PROFILESETTINGS* pProfileSettings = - ProfileManager.GetDashboardProfileSettings(i); - // clear this for now - it will come from reading the system values - memset(pProfileSettings, 0, sizeof(C_4JProfile::PROFILESETTINGS)); - SetDefaultOptions(pProfileSettings, i); -#else - // 4jcrqaft: Linux (and any other platform): profile data is - // zero-initialised, so explicitly apply defaults - C_4JProfile::PROFILESETTINGS* pProfileSettings = - ProfileManager.GetDashboardProfileSettings(i); - memset(pProfileSettings, 0, sizeof(C_4JProfile::PROFILESETTINGS)); - SetDefaultOptions(pProfileSettings, i); -#endif - } -} -int Game::SetDefaultOptions(C_4JProfile::PROFILESETTINGS* pSettings, - const int iPad) { - ZoneScopedN("Game::SetDefaultOptions"); - SetGameSettings(iPad, eGameSetting_MusicVolume, DEFAULT_VOLUME_LEVEL); - SetGameSettings(iPad, eGameSetting_SoundFXVolume, DEFAULT_VOLUME_LEVEL); - SetGameSettings(iPad, eGameSetting_Gamma, 50); - // 4J-PB - Don't reset the difficult level if we're in-game - if (Minecraft::GetInstance()->level == nullptr) { - app.DebugPrintf("SetDefaultOptions - Difficulty = 1\n"); - SetGameSettings(iPad, eGameSetting_Difficulty, 1); - } - SetGameSettings(iPad, eGameSetting_Sensitivity_InGame, 100); - SetGameSettings(iPad, eGameSetting_ViewBob, 1); - SetGameSettings(iPad, eGameSetting_ControlScheme, 0); - SetGameSettings(iPad, eGameSetting_ControlInvertLook, - (pSettings->iYAxisInversion != 0) ? 1 : 0); - SetGameSettings(iPad, eGameSetting_ControlSouthPaw, - pSettings->bSwapSticks ? 1 : 0); - SetGameSettings(iPad, eGameSetting_SplitScreenVertical, 0); - SetGameSettings(iPad, eGameSetting_GamertagsVisible, 1); - // Interim TU 1.6.6 - SetGameSettings(iPad, eGameSetting_Sensitivity_InMenu, 100); - SetGameSettings(iPad, eGameSetting_DisplaySplitscreenGamertags, 1); - SetGameSettings(iPad, eGameSetting_Hints, 1); - SetGameSettings(iPad, eGameSetting_Autosave, 2); - SetGameSettings(iPad, eGameSetting_Tooltips, 1); - SetGameSettings(iPad, eGameSetting_InterfaceOpacity, 80); - // TU 5 - SetGameSettings(iPad, eGameSetting_Clouds, 1); - SetGameSettings(iPad, eGameSetting_Online, 1); - SetGameSettings(iPad, eGameSetting_InviteOnly, 0); - SetGameSettings(iPad, eGameSetting_FriendsOfFriends, 1); - - // default the update changes message to zero - // 4J-PB - We'll only display the message if the profile is pre-TU5 - // SetGameSettings(iPad,eGameSetting_DisplayUpdateMessage,0); - - // TU 6 - SetGameSettings(iPad, eGameSetting_BedrockFog, 0); - SetGameSettings(iPad, eGameSetting_DisplayHUD, 1); - SetGameSettings(iPad, eGameSetting_DisplayHand, 1); - - // TU 7 - SetGameSettings(iPad, eGameSetting_CustomSkinAnim, 1); - - // TU 9 - SetGameSettings(iPad, eGameSetting_DeathMessages, 1); - SetGameSettings(iPad, eGameSetting_UISize, 1); - SetGameSettings(iPad, eGameSetting_UISizeSplitscreen, 2); - SetGameSettings(iPad, eGameSetting_AnimatedCharacter, 1); - - // TU 12 - GameSettingsA[iPad]->ucCurrentFavoriteSkinPos = 0; - for (int i = 0; i < MAX_FAVORITE_SKINS; i++) { - GameSettingsA[iPad]->uiFavoriteSkinA[i] = 0xFFFFFFFF; - } - - // TU 13 - GameSettingsA[iPad]->uiMashUpPackWorldsDisplay = 0xFFFFFFFF; - - // 1.6.4 - app.SetGameHostOption(eGameHostOption_MobGriefing, 1); - app.SetGameHostOption(eGameHostOption_KeepInventory, 0); - app.SetGameHostOption(eGameHostOption_DoMobSpawning, 1); - app.SetGameHostOption(eGameHostOption_DoMobLoot, 1); - app.SetGameHostOption(eGameHostOption_DoTileDrops, 1); - app.SetGameHostOption(eGameHostOption_NaturalRegeneration, 1); - app.SetGameHostOption(eGameHostOption_DoDaylightCycle, 1); - - // 4J-PB - leave these in, or remove from everywhere they are referenced! - // Although probably best to leave in unless we split the profile settings - // into platform specific classes - having different meaning per platform - // for the same bitmask could get confusing - // #ifdef 0 - // PS3DEC13 - SetGameSettings(iPad, eGameSetting_PS3_EULA_Read, 0); // EULA not read - - // PS3 1.05 - added Greek - - // 4J-JEV: We cannot change these in-game, as they could affect localised - // strings and font. XB1: Fix for #172947 - Content: Gameplay: While playing - // in language different form system default one and resetting options to - // their defaults in active gameplay causes in-game language to change and - // HUD to disappear - if (!app.GetGameStarted()) { - GameSettingsA[iPad]->ucLanguage = - MINECRAFT_LANGUAGE_DEFAULT; // use the system language - GameSettingsA[iPad]->ucLocale = - MINECRAFT_LANGUAGE_DEFAULT; // use the system locale - } - - // #endif - - return 0; -} - -int Game::DefaultOptionsCallback( - void* pParam, C_4JProfile::PROFILESETTINGS* pSettings, const int iPad) { - ZoneScopedN("Game::DefaultOptionsCallback"); - Game* pApp = (Game*)pParam; - - // flag the default options to be set - - pApp->DebugPrintf("Setting default options for player %d", iPad); - pApp->SetAction(iPad, eAppAction_SetDefaultOptions, (void*)pSettings); - // pApp->SetDefaultOptions(pSettings,iPad); - - // if the profile data has been changed, then force a profile write - // It seems we're allowed to break the 5 minute rule if it's the result of a - // user action - // pApp->CheckGameSettingsChanged(); - - return 0; -} - -int Game::OldProfileVersionCallback(void* pParam, - unsigned char* pucData, - const unsigned short usVersion, - const int iPad) { - ZoneScopedN("Game::OldProfileVersionCallback"); - // check what needs to be done with this version to update to the current - // one - - switch (usVersion) { - case PROFILE_VERSION_8: { - GAME_SETTINGS* pGameSettings = (GAME_SETTINGS*)pucData; - // reset the display new message counter - pGameSettings->uiBitmaskValues |= - GAMESETTING_DISPLAYUPDATEMSG; // eGameSetting_DisplayUpdateMessage - // (counter) - - // Added a bitmask in TU13 to enable/disable display of the Mash-up - // pack worlds in the saves list - pGameSettings->uiMashUpPackWorldsDisplay = 0xFFFFFFFF; - - // PS3DEC13 - pGameSettings->uiBitmaskValues &= - ~GAMESETTING_PS3EULAREAD; // eGameSetting_PS3_EULA_Read - off - - // PS3 1.05 - added Greek - pGameSettings->ucLanguage = - MINECRAFT_LANGUAGE_DEFAULT; // use the system language - - } break; - case PROFILE_VERSION_9: - // PS3DEC13 - { - GAME_SETTINGS* pGameSettings = (GAME_SETTINGS*)pucData; - pGameSettings->uiBitmaskValues |= - GAMESETTING_DISPLAYUPDATEMSG; // eGameSetting_DisplayUpdateMessage - // (counter) - pGameSettings->uiBitmaskValues &= - ~GAMESETTING_PS3EULAREAD; // eGameSetting_PS3_EULA_Read - - // off - - // PS3 1.05 - added Greek - pGameSettings->ucLanguage = - MINECRAFT_LANGUAGE_DEFAULT; // use the system language - } - break; - case PROFILE_VERSION_10: { - GAME_SETTINGS* pGameSettings = (GAME_SETTINGS*)pucData; - pGameSettings->uiBitmaskValues |= - GAMESETTING_DISPLAYUPDATEMSG; // eGameSetting_DisplayUpdateMessage - // (counter) - pGameSettings->ucLanguage = - MINECRAFT_LANGUAGE_DEFAULT; // use the system language - } break; - case PROFILE_VERSION_11: { - GAME_SETTINGS* pGameSettings = (GAME_SETTINGS*)pucData; - pGameSettings->uiBitmaskValues |= - GAMESETTING_DISPLAYUPDATEMSG; // eGameSetting_DisplayUpdateMessage - // (counter) - } break; - case PROFILE_VERSION_12: { - GAME_SETTINGS* pGameSettings = (GAME_SETTINGS*)pucData; - pGameSettings->uiBitmaskValues |= - GAMESETTING_DISPLAYUPDATEMSG; // eGameSetting_DisplayUpdateMessage - // (counter) - } break; - default: { - // This might be from a version during testing of new profile - // updates - app.DebugPrintf( - "Don't know what to do with this profile version!\n"); - - GAME_SETTINGS* pGameSettings = (GAME_SETTINGS*)pucData; - pGameSettings->ucMenuSensitivity = - 100; // eGameSetting_Sensitivity_InMenu - pGameSettings->ucInterfaceOpacity = - 80; // eGameSetting_Sensitivity_InMenu - pGameSettings->usBitmaskValues |= - 0x0200; // eGameSetting_DisplaySplitscreenGamertags - on - pGameSettings->usBitmaskValues |= 0x0400; // eGameSetting_Hints - - // on - pGameSettings->usBitmaskValues |= - 0x1000; // eGameSetting_Autosave - 2 - pGameSettings->usBitmaskValues |= - 0x8000; // eGameSetting_Tooltips - on - - pGameSettings->uiBitmaskValues = 0L; // reset - pGameSettings->uiBitmaskValues |= - GAMESETTING_CLOUDS; // eGameSetting_Clouds - on - pGameSettings->uiBitmaskValues |= - GAMESETTING_ONLINE; // eGameSetting_GameSetting_Online - on - // eGameSetting_GameSetting_Invite - off - pGameSettings->uiBitmaskValues |= - GAMESETTING_FRIENDSOFFRIENDS; // eGameSetting_GameSetting_FriendsOfFriends - // - on - pGameSettings->uiBitmaskValues |= - GAMESETTING_DISPLAYUPDATEMSG; // eGameSetting_DisplayUpdateMessage - // (counter) - pGameSettings->uiBitmaskValues &= - ~GAMESETTING_BEDROCKFOG; // eGameSetting_BedrockFog - off - pGameSettings->uiBitmaskValues |= - GAMESETTING_DISPLAYHUD; // eGameSetting_DisplayHUD - on - pGameSettings->uiBitmaskValues |= - GAMESETTING_DISPLAYHAND; // eGameSetting_DisplayHand - on - pGameSettings->uiBitmaskValues |= - GAMESETTING_CUSTOMSKINANIM; // eGameSetting_CustomSkinAnim - on - pGameSettings->uiBitmaskValues |= - GAMESETTING_DEATHMESSAGES; // eGameSetting_DeathMessages - on - pGameSettings->uiBitmaskValues |= - (GAMESETTING_UISIZE & 0x00000800); // uisize 2 - pGameSettings->uiBitmaskValues |= - (GAMESETTING_UISIZE_SPLITSCREEN & - 0x00004000); // splitscreen ui size 3 - pGameSettings->uiBitmaskValues |= - GAMESETTING_ANIMATEDCHARACTER; // eGameSetting_AnimatedCharacter - // - on - // TU12 - // favorite skins added, but only set in TU12 - set to FFs - for (int i = 0; i < MAX_FAVORITE_SKINS; i++) { - pGameSettings->uiFavoriteSkinA[i] = 0xFFFFFFFF; - } - pGameSettings->ucCurrentFavoriteSkinPos = 0; - // Added a bitmask in TU13 to enable/disable display of the Mash-up - // pack worlds in the saves list - pGameSettings->uiMashUpPackWorldsDisplay = 0xFFFFFFFF; - - // PS3DEC13 - pGameSettings->uiBitmaskValues &= - ~GAMESETTING_PS3EULAREAD; // eGameSetting_PS3_EULA_Read - off - - // PS3 1.05 - added Greek - pGameSettings->ucLanguage = - MINECRAFT_LANGUAGE_DEFAULT; // use the system language - - } break; - } - - return 0; -} - -void Game::ApplyGameSettingsChanged(int iPad) { - ZoneScopedN("Game::ApplyGameSettingsChanged"); - ActionGameSettings(iPad, eGameSetting_MusicVolume); - ActionGameSettings(iPad, eGameSetting_SoundFXVolume); - ActionGameSettings(iPad, eGameSetting_Gamma); - ActionGameSettings(iPad, eGameSetting_Difficulty); - ActionGameSettings(iPad, eGameSetting_Sensitivity_InGame); - ActionGameSettings(iPad, eGameSetting_ViewBob); - ActionGameSettings(iPad, eGameSetting_ControlScheme); - ActionGameSettings(iPad, eGameSetting_ControlInvertLook); - ActionGameSettings(iPad, eGameSetting_ControlSouthPaw); - ActionGameSettings(iPad, eGameSetting_SplitScreenVertical); - ActionGameSettings(iPad, eGameSetting_GamertagsVisible); - - // Interim TU 1.6.6 - ActionGameSettings(iPad, eGameSetting_Sensitivity_InMenu); - ActionGameSettings(iPad, eGameSetting_DisplaySplitscreenGamertags); - ActionGameSettings(iPad, eGameSetting_Hints); - ActionGameSettings(iPad, eGameSetting_InterfaceOpacity); - ActionGameSettings(iPad, eGameSetting_Tooltips); - - ActionGameSettings(iPad, eGameSetting_Clouds); - ActionGameSettings(iPad, eGameSetting_BedrockFog); - ActionGameSettings(iPad, eGameSetting_DisplayHUD); - ActionGameSettings(iPad, eGameSetting_DisplayHand); - ActionGameSettings(iPad, eGameSetting_CustomSkinAnim); - ActionGameSettings(iPad, eGameSetting_DeathMessages); - ActionGameSettings(iPad, eGameSetting_UISize); - ActionGameSettings(iPad, eGameSetting_UISizeSplitscreen); - ActionGameSettings(iPad, eGameSetting_AnimatedCharacter); - - ActionGameSettings(iPad, eGameSetting_PS3_EULA_Read); -} - -void Game::ActionGameSettings(int iPad, eGameSetting eVal) { - ZoneScopedN("Game::ActionGameSettings"); - Minecraft* pMinecraft = Minecraft::GetInstance(); - switch (eVal) { - case eGameSetting_MusicVolume: - if (iPad == ProfileManager.GetPrimaryPad()) { - pMinecraft->options->set( - Options::Option::MUSIC, - ((float)GameSettingsA[iPad]->ucMusicVolume) / 100.0f); - } - break; - case eGameSetting_SoundFXVolume: - if (iPad == ProfileManager.GetPrimaryPad()) { - pMinecraft->options->set( - Options::Option::SOUND, - ((float)GameSettingsA[iPad]->ucSoundFXVolume) / 100.0f); - } - break; - case eGameSetting_Gamma: - if (iPad == ProfileManager.GetPrimaryPad()) { - // ucGamma range is 0-100, UpdateGamma is 0 - 32768 - float fVal = ((float)GameSettingsA[iPad]->ucGamma) * 327.68f; - RenderManager.UpdateGamma((unsigned short)fVal); - } - - break; - case eGameSetting_Difficulty: - if (iPad == ProfileManager.GetPrimaryPad()) { - pMinecraft->options->toggle( - Options::Option::DIFFICULTY, - GameSettingsA[iPad]->usBitmaskValues & 0x03); - app.DebugPrintf("Difficulty toggle to %d\n", - GameSettingsA[iPad]->usBitmaskValues & 0x03); - - // Update the Game Host setting - app.SetGameHostOption(eGameHostOption_Difficulty, - pMinecraft->options->difficulty); - - // send this to the other players if we are in-game - bool bInGame = pMinecraft->level != nullptr; - - // Game Host only (and for now we can't change the diff while in - // game, so this shouldn't happen) - if (bInGame && g_NetworkManager.IsHost() && - (iPad == ProfileManager.GetPrimaryPad())) { - app.SetXuiServerAction( - iPad, eXuiServerAction_ServerSettingChanged_Difficulty); - } - } else { - app.DebugPrintf( - "NOT ACTIONING DIFFICULTY - Primary pad is %d, This pad is " - "%d\n", - ProfileManager.GetPrimaryPad(), iPad); - } - - break; - case eGameSetting_Sensitivity_InGame: - // 4J-PB - we don't use the options value - // tell the input that we've changed the sensitivity - range of the - // slider is 0 to 200, default is 100 - pMinecraft->options->set( - Options::Option::SENSITIVITY, - ((float)GameSettingsA[iPad]->ucSensitivity) / 100.0f); - // InputManager.SetJoypadSensitivity(iPad,((float)GameSettingsA[iPad]->ucSensitivity)/100.0f); - - break; - case eGameSetting_ViewBob: - // 4J-PB - not handled here any more - it's read from the - // gamesettings per player - // pMinecraft->options->toggle(Options::Option::VIEW_BOBBING,GameSettingsA[iPad]->usBitmaskValues&0x04); - break; - case eGameSetting_ControlScheme: - InputManager.SetJoypadMapVal( - iPad, (GameSettingsA[iPad]->usBitmaskValues & 0x30) >> 4); - break; - - case eGameSetting_ControlInvertLook: - // Nothing specific to do for this setting. - break; - - case eGameSetting_ControlSouthPaw: - // What is the setting? - if (GameSettingsA[iPad]->usBitmaskValues & 0x80) { - // Southpaw. - InputManager.SetJoypadStickAxisMap(iPad, AXIS_MAP_LX, - AXIS_MAP_RX); - InputManager.SetJoypadStickAxisMap(iPad, AXIS_MAP_LY, - AXIS_MAP_RY); - InputManager.SetJoypadStickAxisMap(iPad, AXIS_MAP_RX, - AXIS_MAP_LX); - InputManager.SetJoypadStickAxisMap(iPad, AXIS_MAP_RY, - AXIS_MAP_LY); - InputManager.SetJoypadStickTriggerMap(iPad, TRIGGER_MAP_0, - TRIGGER_MAP_1); - InputManager.SetJoypadStickTriggerMap(iPad, TRIGGER_MAP_1, - TRIGGER_MAP_0); - } else { - // Right handed. - InputManager.SetJoypadStickAxisMap(iPad, AXIS_MAP_LX, - AXIS_MAP_LX); - InputManager.SetJoypadStickAxisMap(iPad, AXIS_MAP_LY, - AXIS_MAP_LY); - InputManager.SetJoypadStickAxisMap(iPad, AXIS_MAP_RX, - AXIS_MAP_RX); - InputManager.SetJoypadStickAxisMap(iPad, AXIS_MAP_RY, - AXIS_MAP_RY); - InputManager.SetJoypadStickTriggerMap(iPad, TRIGGER_MAP_0, - TRIGGER_MAP_0); - InputManager.SetJoypadStickTriggerMap(iPad, TRIGGER_MAP_1, - TRIGGER_MAP_1); - } - break; - case eGameSetting_SplitScreenVertical: - if (iPad == ProfileManager.GetPrimaryPad()) { - pMinecraft->updatePlayerViewportAssignments(); - } - break; - case eGameSetting_GamertagsVisible: { - bool bInGame = pMinecraft->level != nullptr; - - // Game Host only - if (bInGame && g_NetworkManager.IsHost() && - (iPad == ProfileManager.GetPrimaryPad())) { - // Update the Game Host setting if you are the host and you are - // in-game - app.SetGameHostOption( - eGameHostOption_Gamertags, - ((GameSettingsA[iPad]->usBitmaskValues & 0x0008) != 0) ? 1 - : 0); - app.SetXuiServerAction( - iPad, eXuiServerAction_ServerSettingChanged_Gamertags); - - PlayerList* players = - MinecraftServer::getInstance()->getPlayerList(); - for (auto it3 = players->players.begin(); - it3 != players->players.end(); ++it3) { - std::shared_ptr decorationPlayer = *it3; - decorationPlayer->setShowOnMaps( - (app.GetGameHostOption(eGameHostOption_Gamertags) != 0) - ? true - : false); - } - } - } break; - // Interim TU 1.6.6 - case eGameSetting_Sensitivity_InMenu: - // 4J-PB - we don't use the options value - // tell the input that we've changed the sensitivity - range of the - // slider is 0 to 200, default is 100 - // pMinecraft->options->set(Options::Option::SENSITIVITY,((float)GameSettingsA[iPad]->ucSensitivity)/100.0f); - // InputManager.SetJoypadSensitivity(iPad,((float)GameSettingsA[iPad]->ucSensitivity)/100.0f); - - break; - - case eGameSetting_DisplaySplitscreenGamertags: - for (std::uint8_t idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if (pMinecraft->localplayers[idx] != nullptr) { - if (pMinecraft->localplayers[idx]->m_iScreenSection == - C4JRender::VIEWPORT_TYPE_FULLSCREEN) { - ui.DisplayGamertag(idx, false); - } else { - ui.DisplayGamertag(idx, true); - } - } - } - - break; - case eGameSetting_InterfaceOpacity: - // update the tooltips display - ui.RefreshTooltips(iPad); - - break; - case eGameSetting_Hints: - // nothing to do here - break; - case eGameSetting_Tooltips: - if ((GameSettingsA[iPad]->usBitmaskValues & 0x8000) != 0) { - ui.SetEnableTooltips(iPad, true); - } else { - ui.SetEnableTooltips(iPad, false); - } - break; - case eGameSetting_Clouds: - // nothing to do here - break; - case eGameSetting_Online: - // nothing to do here - break; - case eGameSetting_InviteOnly: - // nothing to do here - break; - case eGameSetting_FriendsOfFriends: - // nothing to do here - break; - case eGameSetting_BedrockFog: { - bool bInGame = pMinecraft->level != nullptr; - - // Game Host only - if (bInGame && g_NetworkManager.IsHost() && - (iPad == ProfileManager.GetPrimaryPad())) { - // Update the Game Host setting if you are the host and you are - // in-game - app.SetGameHostOption( - eGameHostOption_BedrockFog, - GetGameSettings(iPad, eGameSetting_BedrockFog) ? 1 : 0); - app.SetXuiServerAction( - iPad, eXuiServerAction_ServerSettingChanged_BedrockFog); - } - } break; - case eGameSetting_DisplayHUD: - // nothing to do here - break; - case eGameSetting_DisplayHand: - // nothing to do here - break; - case eGameSetting_CustomSkinAnim: - // nothing to do here - break; - case eGameSetting_DeathMessages: - // nothing to do here - break; - case eGameSetting_UISize: - // nothing to do here - break; - case eGameSetting_UISizeSplitscreen: - // nothing to do here - break; - case eGameSetting_AnimatedCharacter: - // nothing to do here - break; - case eGameSetting_PS3_EULA_Read: - // nothing to do here - break; - case eGameSetting_PSVita_NetworkModeAdhoc: - // nothing to do here - break; - default: - break; - } -} - -void Game::SetPlayerSkin(int iPad, const std::wstring& name) { - ZoneScopedN("Game::SetPlayerSkin"); - std::uint32_t skinId = app.getSkinIdFromPath(name); - - SetPlayerSkin(iPad, skinId); -} - -void Game::SetPlayerSkin(int iPad, std::uint32_t dwSkinId) { - ZoneScopedN("Game::SetPlayerSkin"); - DebugPrintf("Setting skin for %d to %08X\n", iPad, dwSkinId); - - GameSettingsA[iPad]->dwSelectedSkin = dwSkinId; - GameSettingsA[iPad]->bSettingsChanged = true; - - if (Minecraft::GetInstance()->localplayers[iPad] != nullptr) - Minecraft::GetInstance()->localplayers[iPad]->setAndBroadcastCustomSkin( - dwSkinId); -} - -std::wstring Game::GetPlayerSkinName(int iPad) { - ZoneScopedN("Game::GetPlayerSkinName"); - return app.getSkinPathFromId(GameSettingsA[iPad]->dwSelectedSkin); -} - -std::uint32_t Game::GetPlayerSkinId(int iPad) { - ZoneScopedN("Game::GetPlayerSkinId"); - // 4J-PB -check the user has rights to use this skin - they may have had at - // some point but the entitlement has been removed. - DLCPack* Pack = nullptr; - DLCSkinFile* skinFile = nullptr; - std::uint32_t dwSkin = GameSettingsA[iPad]->dwSelectedSkin; - wchar_t chars[256]; - - if (GET_IS_DLC_SKIN_FROM_BITMASK(dwSkin)) { - // 4J Stu - DLC skins are numbered using decimal rather than hex to make - // it easier to number manually - swprintf(chars, 256, L"dlcskin%08d.png", - GET_DLC_SKIN_ID_FROM_BITMASK(dwSkin)); - - Pack = app.m_dlcManager.getPackContainingSkin(chars); - - if (Pack) { - skinFile = Pack->getSkinFile(chars); - - bool bSkinIsFree = - skinFile->getParameterAsBool(DLCManager::e_DLCParamType_Free); - bool bLicensed = Pack->hasPurchasedFile(DLCManager::e_DLCType_Skin, - skinFile->getPath()); - - if (bSkinIsFree || bLicensed) { - return dwSkin; - } else { - return 0; - } - } - } - - return dwSkin; -} - -std::uint32_t Game::GetAdditionalModelParts(int iPad) { - ZoneScopedN("Game::GetAdditionalModelParts"); - return m_dwAdditionalModelParts[iPad]; -} - -void Game::SetPlayerCape(int iPad, const std::wstring& name) { - ZoneScopedN("Game::SetPlayerCape"); - std::uint32_t capeId = Player::getCapeIdFromPath(name); - - SetPlayerCape(iPad, capeId); -} - -void Game::SetPlayerCape(int iPad, std::uint32_t dwCapeId) { - ZoneScopedN("Game::SetPlayerCape"); - DebugPrintf("Setting cape for %d to %08X\n", iPad, dwCapeId); - - GameSettingsA[iPad]->dwSelectedCape = dwCapeId; - GameSettingsA[iPad]->bSettingsChanged = true; - - // SentientManager.RecordSkinChanged(iPad, - // GameSettingsA[iPad]->dwSelectedSkin); - - if (Minecraft::GetInstance()->localplayers[iPad] != nullptr) - Minecraft::GetInstance()->localplayers[iPad]->setAndBroadcastCustomCape( - dwCapeId); -} - -std::wstring Game::GetPlayerCapeName(int iPad) { - ZoneScopedN("Game::GetPlayerCapeName"); - return Player::getCapePathFromId(GameSettingsA[iPad]->dwSelectedCape); -} - -std::uint32_t Game::GetPlayerCapeId(int iPad) { - ZoneScopedN("Game::GetPlayerCapeId"); - return GameSettingsA[iPad]->dwSelectedCape; -} - -void Game::SetPlayerFavoriteSkin(int iPad, int iIndex, - unsigned int uiSkinID) { - ZoneScopedN("Game::SetPlayerFavoriteSkin"); - DebugPrintf("Setting favorite skin for %d to %08X\n", iPad, uiSkinID); - - GameSettingsA[iPad]->uiFavoriteSkinA[iIndex] = uiSkinID; - GameSettingsA[iPad]->bSettingsChanged = true; -} - -unsigned int Game::GetPlayerFavoriteSkin(int iPad, int iIndex) { - ZoneScopedN("Game::GetPlayerFavoriteSkin"); - return GameSettingsA[iPad]->uiFavoriteSkinA[iIndex]; -} - -unsigned char Game::GetPlayerFavoriteSkinsPos(int iPad) { - ZoneScopedN("Game::GetPlayerFavoriteSkinsPos"); - return GameSettingsA[iPad]->ucCurrentFavoriteSkinPos; -} - -void Game::SetPlayerFavoriteSkinsPos(int iPad, int iPos) { - ZoneScopedN("Game::SetPlayerFavoriteSkinsPos"); - GameSettingsA[iPad]->ucCurrentFavoriteSkinPos = (unsigned char)iPos; - GameSettingsA[iPad]->bSettingsChanged = true; -} - -unsigned int Game::GetPlayerFavoriteSkinsCount(int iPad) { - ZoneScopedN("Game::GetPlayerFavoriteSkinsCount"); - unsigned int uiCount = 0; - for (int i = 0; i < MAX_FAVORITE_SKINS; i++) { - if (GameSettingsA[iPad]->uiFavoriteSkinA[i] != 0xFFFFFFFF) { - uiCount++; - } else { - break; - } - } - return uiCount; -} - -void Game::ValidateFavoriteSkins(int iPad) { - ZoneScopedN("Game::ValidateFavoriteSkins"); - unsigned int uiCount = GetPlayerFavoriteSkinsCount(iPad); - - // remove invalid skins - unsigned int uiValidSkin = 0; - wchar_t chars[256]; - - for (unsigned int i = 0; i < uiCount; i++) { - // get the pack number from the skin id - swprintf(chars, 256, L"dlcskin%08d.png", - app.GetPlayerFavoriteSkin(iPad, i)); - - // Also check they haven't reverted to a trial pack - DLCPack* pDLCPack = app.m_dlcManager.getPackContainingSkin(chars); - - if (pDLCPack != nullptr) { - // 4J-PB - We should let players add the free skins to their - // favourites as well! - // DLCFile - // *pDLCFile=pDLCPack->getFile(DLCManager::e_DLCType_Skin,chars); - DLCSkinFile* pSkinFile = pDLCPack->getSkinFile(chars); - - if (pDLCPack->hasPurchasedFile(DLCManager::e_DLCType_Skin, L"") || - (pSkinFile && pSkinFile->isFree())) { - GameSettingsA[iPad]->uiFavoriteSkinA[uiValidSkin++] = - GameSettingsA[iPad]->uiFavoriteSkinA[i]; - } - } - } - - for (unsigned int i = uiValidSkin; i < MAX_FAVORITE_SKINS; i++) { - GameSettingsA[iPad]->uiFavoriteSkinA[i] = 0xFFFFFFFF; - } -} +// Skin/Cape/FavoriteSkin methods moved to SkinManager // Mash-up pack worlds -void Game::HideMashupPackWorld(int iPad, unsigned int iMashupPackID) { - ZoneScopedN("Game::HideMashupPackWorld"); - unsigned int uiPackID = iMashupPackID - 1024; // mash-up ids start at 1024 - GameSettingsA[iPad]->uiMashUpPackWorldsDisplay &= ~(1 << uiPackID); - GameSettingsA[iPad]->bSettingsChanged = true; -} -void Game::EnableMashupPackWorlds(int iPad) { - ZoneScopedN("Game::EnableMashupPackWorlds"); - GameSettingsA[iPad]->uiMashUpPackWorldsDisplay = 0xFFFFFFFF; - GameSettingsA[iPad]->bSettingsChanged = true; -} -unsigned int Game::GetMashupPackWorlds(int iPad) { - ZoneScopedN("Game::GetMashupPackWorlds"); - return GameSettingsA[iPad]->uiMashUpPackWorldsDisplay; -} -void Game::SetMinecraftLanguage(int iPad, unsigned char ucLanguage) { - ZoneScopedN("Game::SetMinecraftLanguage"); - GameSettingsA[iPad]->ucLanguage = ucLanguage; - GameSettingsA[iPad]->bSettingsChanged = true; -} -unsigned char Game::GetMinecraftLanguage(int iPad) { - ZoneScopedN("Game::GetMinecraftLanguage"); - // if there are no game settings read yet, return the default language - if (GameSettingsA[iPad] == nullptr) { - return 0; - } else { - return GameSettingsA[iPad]->ucLanguage; - } -} -void Game::SetMinecraftLocale(int iPad, unsigned char ucLocale) { - ZoneScopedN("Game::SetMinecraftLocale"); - GameSettingsA[iPad]->ucLocale = ucLocale; - GameSettingsA[iPad]->bSettingsChanged = true; -} -unsigned char Game::GetMinecraftLocale(int iPad) { - ZoneScopedN("Game::GetMinecraftLocale"); - // if there are no game settings read yet, return the default language - if (GameSettingsA[iPad] == nullptr) { - return 0; - } else { - return GameSettingsA[iPad]->ucLocale; - } -} -void Game::SetGameSettings(int iPad, eGameSetting eVal, - unsigned char ucVal) { - ZoneScopedN("Game::SetGameSettings"); - // Minecraft *pMinecraft=Minecraft::GetInstance(); - switch (eVal) { - case eGameSetting_MusicVolume: - if (GameSettingsA[iPad]->ucMusicVolume != ucVal) { - GameSettingsA[iPad]->ucMusicVolume = ucVal; - if (iPad == ProfileManager.GetPrimaryPad()) { - ActionGameSettings(iPad, eVal); - } - GameSettingsA[iPad]->bSettingsChanged = true; - } - break; - case eGameSetting_SoundFXVolume: - if (GameSettingsA[iPad]->ucSoundFXVolume != ucVal) { - GameSettingsA[iPad]->ucSoundFXVolume = ucVal; - if (iPad == ProfileManager.GetPrimaryPad()) { - ActionGameSettings(iPad, eVal); - } - GameSettingsA[iPad]->bSettingsChanged = true; - } - break; - case eGameSetting_Gamma: - if (GameSettingsA[iPad]->ucGamma != ucVal) { - GameSettingsA[iPad]->ucGamma = ucVal; - if (iPad == ProfileManager.GetPrimaryPad()) { - ActionGameSettings(iPad, eVal); - } - GameSettingsA[iPad]->bSettingsChanged = true; - } - break; - case eGameSetting_Difficulty: - if ((GameSettingsA[iPad]->usBitmaskValues & 0x03) != - (ucVal & 0x03)) { - GameSettingsA[iPad]->usBitmaskValues &= ~0x03; - GameSettingsA[iPad]->usBitmaskValues |= ucVal & 0x03; - if (iPad == ProfileManager.GetPrimaryPad()) { - ActionGameSettings(iPad, eVal); - } - GameSettingsA[iPad]->bSettingsChanged = true; - } - break; - case eGameSetting_Sensitivity_InGame: - if (GameSettingsA[iPad]->ucSensitivity != ucVal) { - GameSettingsA[iPad]->ucSensitivity = ucVal; - ActionGameSettings(iPad, eVal); - GameSettingsA[iPad]->bSettingsChanged = true; - } - break; - case eGameSetting_ViewBob: - if ((GameSettingsA[iPad]->usBitmaskValues & 0x0004) != - ((ucVal & 0x01) << 2)) { - if (ucVal != 0) { - GameSettingsA[iPad]->usBitmaskValues |= 0x0004; - } else { - GameSettingsA[iPad]->usBitmaskValues &= ~0x0004; - } - ActionGameSettings(iPad, eVal); - GameSettingsA[iPad]->bSettingsChanged = true; - } - break; - case eGameSetting_ControlScheme: // bits 5 and 6 - if ((GameSettingsA[iPad]->usBitmaskValues & 0x30) != - ((ucVal & 0x03) << 4)) { - GameSettingsA[iPad]->usBitmaskValues &= ~0x0030; - if (ucVal != 0) { - GameSettingsA[iPad]->usBitmaskValues |= (ucVal & 0x03) << 4; - } - ActionGameSettings(iPad, eVal); - GameSettingsA[iPad]->bSettingsChanged = true; - } - break; - case eGameSetting_ControlInvertLook: - if ((GameSettingsA[iPad]->usBitmaskValues & 0x0040) != - ((ucVal & 0x01) << 6)) { - if (ucVal != 0) { - GameSettingsA[iPad]->usBitmaskValues |= 0x0040; - } else { - GameSettingsA[iPad]->usBitmaskValues &= ~0x0040; - } - ActionGameSettings(iPad, eVal); - GameSettingsA[iPad]->bSettingsChanged = true; - } - break; - case eGameSetting_ControlSouthPaw: - if ((GameSettingsA[iPad]->usBitmaskValues & 0x0080) != - ((ucVal & 0x01) << 7)) { - if (ucVal != 0) { - GameSettingsA[iPad]->usBitmaskValues |= 0x0080; - } else { - GameSettingsA[iPad]->usBitmaskValues &= ~0x0080; - } - ActionGameSettings(iPad, eVal); - GameSettingsA[iPad]->bSettingsChanged = true; - } - break; - case eGameSetting_SplitScreenVertical: - if ((GameSettingsA[iPad]->usBitmaskValues & 0x0100) != - ((ucVal & 0x01) << 8)) { - if (ucVal != 0) { - GameSettingsA[iPad]->usBitmaskValues |= 0x0100; - } else { - GameSettingsA[iPad]->usBitmaskValues &= ~0x0100; - } - ActionGameSettings(iPad, eVal); - GameSettingsA[iPad]->bSettingsChanged = true; - } - break; - case eGameSetting_GamertagsVisible: - if ((GameSettingsA[iPad]->usBitmaskValues & 0x0008) != - ((ucVal & 0x01) << 3)) { - if (ucVal != 0) { - GameSettingsA[iPad]->usBitmaskValues |= 0x0008; - } else { - GameSettingsA[iPad]->usBitmaskValues &= ~0x0008; - } - ActionGameSettings(iPad, eVal); - GameSettingsA[iPad]->bSettingsChanged = true; - } - break; - // 4J-PB - Added for Interim TU for 1.6.6 - case eGameSetting_Sensitivity_InMenu: - if (GameSettingsA[iPad]->ucMenuSensitivity != ucVal) { - GameSettingsA[iPad]->ucMenuSensitivity = ucVal; - ActionGameSettings(iPad, eVal); - GameSettingsA[iPad]->bSettingsChanged = true; - } - break; - case eGameSetting_DisplaySplitscreenGamertags: - if ((GameSettingsA[iPad]->usBitmaskValues & 0x0200) != - ((ucVal & 0x01) << 9)) { - if (ucVal != 0) { - GameSettingsA[iPad]->usBitmaskValues |= 0x0200; - } else { - GameSettingsA[iPad]->usBitmaskValues &= ~0x0200; - } - ActionGameSettings(iPad, eVal); - GameSettingsA[iPad]->bSettingsChanged = true; - } - break; - case eGameSetting_Hints: - if ((GameSettingsA[iPad]->usBitmaskValues & 0x0400) != - ((ucVal & 0x01) << 10)) { - if (ucVal != 0) { - GameSettingsA[iPad]->usBitmaskValues |= 0x0400; - } else { - GameSettingsA[iPad]->usBitmaskValues &= ~0x0400; - } - ActionGameSettings(iPad, eVal); - GameSettingsA[iPad]->bSettingsChanged = true; - } - break; - case eGameSetting_Autosave: - if ((GameSettingsA[iPad]->usBitmaskValues & 0x7800) != - ((ucVal & 0x0F) << 11)) { - GameSettingsA[iPad]->usBitmaskValues &= ~0x7800; - if (ucVal != 0) { - GameSettingsA[iPad]->usBitmaskValues |= (ucVal & 0x0F) - << 11; - } - ActionGameSettings(iPad, eVal); - GameSettingsA[iPad]->bSettingsChanged = true; - } - break; - - case eGameSetting_Tooltips: - if ((GameSettingsA[iPad]->usBitmaskValues & 0x8000) != - ((ucVal & 0x01) << 15)) { - if (ucVal != 0) { - GameSettingsA[iPad]->usBitmaskValues |= 0x8000; - } else { - GameSettingsA[iPad]->usBitmaskValues &= ~0x8000; - } - ActionGameSettings(iPad, eVal); - GameSettingsA[iPad]->bSettingsChanged = true; - } - break; - case eGameSetting_InterfaceOpacity: - if (GameSettingsA[iPad]->ucInterfaceOpacity != ucVal) { - GameSettingsA[iPad]->ucInterfaceOpacity = ucVal; - ActionGameSettings(iPad, eVal); - GameSettingsA[iPad]->bSettingsChanged = true; - } - - break; - case eGameSetting_Clouds: - if ((GameSettingsA[iPad]->uiBitmaskValues & GAMESETTING_CLOUDS) != - (ucVal & 0x01)) { - if (ucVal == 1) { - GameSettingsA[iPad]->uiBitmaskValues |= GAMESETTING_CLOUDS; - } else { - GameSettingsA[iPad]->uiBitmaskValues &= ~GAMESETTING_CLOUDS; - } - ActionGameSettings(iPad, eVal); - GameSettingsA[iPad]->bSettingsChanged = true; - } - - break; - - case eGameSetting_Online: - if ((GameSettingsA[iPad]->uiBitmaskValues & GAMESETTING_ONLINE) != - (ucVal & 0x01) << 1) { - if (ucVal == 1) { - GameSettingsA[iPad]->uiBitmaskValues |= GAMESETTING_ONLINE; - } else { - GameSettingsA[iPad]->uiBitmaskValues &= ~GAMESETTING_ONLINE; - } - ActionGameSettings(iPad, eVal); - GameSettingsA[iPad]->bSettingsChanged = true; - } - - break; - case eGameSetting_InviteOnly: - if ((GameSettingsA[iPad]->uiBitmaskValues & - GAMESETTING_INVITEONLY) != (ucVal & 0x01) << 2) { - if (ucVal == 1) { - GameSettingsA[iPad]->uiBitmaskValues |= - GAMESETTING_INVITEONLY; - } else { - GameSettingsA[iPad]->uiBitmaskValues &= - ~GAMESETTING_INVITEONLY; - } - ActionGameSettings(iPad, eVal); - GameSettingsA[iPad]->bSettingsChanged = true; - } - - break; - case eGameSetting_FriendsOfFriends: - if ((GameSettingsA[iPad]->uiBitmaskValues & - GAMESETTING_FRIENDSOFFRIENDS) != (ucVal & 0x01) << 3) { - if (ucVal == 1) { - GameSettingsA[iPad]->uiBitmaskValues |= - GAMESETTING_FRIENDSOFFRIENDS; - } else { - GameSettingsA[iPad]->uiBitmaskValues &= - ~GAMESETTING_FRIENDSOFFRIENDS; - } - ActionGameSettings(iPad, eVal); - GameSettingsA[iPad]->bSettingsChanged = true; - } - - break; - case eGameSetting_DisplayUpdateMessage: - if ((GameSettingsA[iPad]->uiBitmaskValues & - GAMESETTING_DISPLAYUPDATEMSG) != (ucVal & 0x03) << 4) { - GameSettingsA[iPad]->uiBitmaskValues &= - ~GAMESETTING_DISPLAYUPDATEMSG; - if (ucVal > 0) { - GameSettingsA[iPad]->uiBitmaskValues |= (ucVal & 0x03) << 4; - } - - ActionGameSettings(iPad, eVal); - GameSettingsA[iPad]->bSettingsChanged = true; - } - - break; - - case eGameSetting_BedrockFog: - if ((GameSettingsA[iPad]->uiBitmaskValues & - GAMESETTING_BEDROCKFOG) != (ucVal & 0x01) << 6) { - if (ucVal == 1) { - GameSettingsA[iPad]->uiBitmaskValues |= - GAMESETTING_BEDROCKFOG; - } else { - GameSettingsA[iPad]->uiBitmaskValues &= - ~GAMESETTING_BEDROCKFOG; - } - ActionGameSettings(iPad, eVal); - GameSettingsA[iPad]->bSettingsChanged = true; - } - - break; - case eGameSetting_DisplayHUD: - if ((GameSettingsA[iPad]->uiBitmaskValues & - GAMESETTING_DISPLAYHUD) != (ucVal & 0x01) << 7) { - if (ucVal == 1) { - GameSettingsA[iPad]->uiBitmaskValues |= - GAMESETTING_DISPLAYHUD; - } else { - GameSettingsA[iPad]->uiBitmaskValues &= - ~GAMESETTING_DISPLAYHUD; - } - ActionGameSettings(iPad, eVal); - GameSettingsA[iPad]->bSettingsChanged = true; - } - - break; - case eGameSetting_DisplayHand: - if ((GameSettingsA[iPad]->uiBitmaskValues & - GAMESETTING_DISPLAYHAND) != (ucVal & 0x01) << 8) { - if (ucVal == 1) { - GameSettingsA[iPad]->uiBitmaskValues |= - GAMESETTING_DISPLAYHAND; - } else { - GameSettingsA[iPad]->uiBitmaskValues &= - ~GAMESETTING_DISPLAYHAND; - } - ActionGameSettings(iPad, eVal); - GameSettingsA[iPad]->bSettingsChanged = true; - } - - break; - - case eGameSetting_CustomSkinAnim: - if ((GameSettingsA[iPad]->uiBitmaskValues & - GAMESETTING_CUSTOMSKINANIM) != (ucVal & 0x01) << 9) { - if (ucVal == 1) { - GameSettingsA[iPad]->uiBitmaskValues |= - GAMESETTING_CUSTOMSKINANIM; - } else { - GameSettingsA[iPad]->uiBitmaskValues &= - ~GAMESETTING_CUSTOMSKINANIM; - } - ActionGameSettings(iPad, eVal); - GameSettingsA[iPad]->bSettingsChanged = true; - } - - break; - // TU9 - case eGameSetting_DeathMessages: - if ((GameSettingsA[iPad]->uiBitmaskValues & - GAMESETTING_DEATHMESSAGES) != (ucVal & 0x01) << 10) { - if (ucVal == 1) { - GameSettingsA[iPad]->uiBitmaskValues |= - GAMESETTING_DEATHMESSAGES; - } else { - GameSettingsA[iPad]->uiBitmaskValues &= - ~GAMESETTING_DEATHMESSAGES; - } - ActionGameSettings(iPad, eVal); - GameSettingsA[iPad]->bSettingsChanged = true; - } - break; - case eGameSetting_UISize: - if ((GameSettingsA[iPad]->uiBitmaskValues & GAMESETTING_UISIZE) != - ((ucVal & 0x03) << 11)) { - GameSettingsA[iPad]->uiBitmaskValues &= ~GAMESETTING_UISIZE; - if (ucVal != 0) { - GameSettingsA[iPad]->uiBitmaskValues |= (ucVal & 0x03) - << 11; - } - ActionGameSettings(iPad, eVal); - GameSettingsA[iPad]->bSettingsChanged = true; - } - break; - case eGameSetting_UISizeSplitscreen: - if ((GameSettingsA[iPad]->uiBitmaskValues & - GAMESETTING_UISIZE_SPLITSCREEN) != ((ucVal & 0x03) << 13)) { - GameSettingsA[iPad]->uiBitmaskValues &= - ~GAMESETTING_UISIZE_SPLITSCREEN; - if (ucVal != 0) { - GameSettingsA[iPad]->uiBitmaskValues |= (ucVal & 0x03) - << 13; - } - ActionGameSettings(iPad, eVal); - GameSettingsA[iPad]->bSettingsChanged = true; - } - break; - case eGameSetting_AnimatedCharacter: - if ((GameSettingsA[iPad]->uiBitmaskValues & - GAMESETTING_ANIMATEDCHARACTER) != (ucVal & 0x01) << 15) { - if (ucVal == 1) { - GameSettingsA[iPad]->uiBitmaskValues |= - GAMESETTING_ANIMATEDCHARACTER; - } else { - GameSettingsA[iPad]->uiBitmaskValues &= - ~GAMESETTING_ANIMATEDCHARACTER; - } - ActionGameSettings(iPad, eVal); - GameSettingsA[iPad]->bSettingsChanged = true; - } - break; - case eGameSetting_PS3_EULA_Read: - if ((GameSettingsA[iPad]->uiBitmaskValues & - GAMESETTING_PS3EULAREAD) != (ucVal & 0x01) << 16) { - if (ucVal == 1) { - GameSettingsA[iPad]->uiBitmaskValues |= - GAMESETTING_PS3EULAREAD; - } else { - GameSettingsA[iPad]->uiBitmaskValues &= - ~GAMESETTING_PS3EULAREAD; - } - ActionGameSettings(iPad, eVal); - GameSettingsA[iPad]->bSettingsChanged = true; - } - break; - case eGameSetting_PSVita_NetworkModeAdhoc: - if ((GameSettingsA[iPad]->uiBitmaskValues & - GAMESETTING_PSVITANETWORKMODEADHOC) != (ucVal & 0x01) << 17) { - if (ucVal == 1) { - GameSettingsA[iPad]->uiBitmaskValues |= - GAMESETTING_PSVITANETWORKMODEADHOC; - } else { - GameSettingsA[iPad]->uiBitmaskValues &= - ~GAMESETTING_PSVITANETWORKMODEADHOC; - } - ActionGameSettings(iPad, eVal); - GameSettingsA[iPad]->bSettingsChanged = true; - } - break; - } -} - -unsigned char Game::GetGameSettings(eGameSetting eVal) { - ZoneScopedN("Game::GetGameSettings"); - int iPad = ProfileManager.GetPrimaryPad(); - - return GetGameSettings(iPad, eVal); -} - -unsigned char Game::GetGameSettings(int iPad, eGameSetting eVal) { - ZoneScopedN("Game::GetGameSettings"); - switch (eVal) { - case eGameSetting_MusicVolume: - return GameSettingsA[iPad]->ucMusicVolume; - break; - case eGameSetting_SoundFXVolume: - return GameSettingsA[iPad]->ucSoundFXVolume; - break; - case eGameSetting_Gamma: - return GameSettingsA[iPad]->ucGamma; - break; - case eGameSetting_Difficulty: - return GameSettingsA[iPad]->usBitmaskValues & 0x0003; - break; - case eGameSetting_Sensitivity_InGame: - return GameSettingsA[iPad]->ucSensitivity; - break; - case eGameSetting_ViewBob: - return ((GameSettingsA[iPad]->usBitmaskValues & 0x0004) >> 2); - break; - case eGameSetting_GamertagsVisible: - return ((GameSettingsA[iPad]->usBitmaskValues & 0x0008) >> 3); - break; - case eGameSetting_ControlScheme: - return ((GameSettingsA[iPad]->usBitmaskValues & 0x0030) >> - 4); // 2 bits - break; - case eGameSetting_ControlInvertLook: - return ((GameSettingsA[iPad]->usBitmaskValues & 0x0040) >> 6); - break; - case eGameSetting_ControlSouthPaw: - return ((GameSettingsA[iPad]->usBitmaskValues & 0x0080) >> 7); - break; - case eGameSetting_SplitScreenVertical: - return ((GameSettingsA[iPad]->usBitmaskValues & 0x0100) >> 8); - break; - // 4J-PB - Added for Interim TU for 1.6.6 - case eGameSetting_Sensitivity_InMenu: - return GameSettingsA[iPad]->ucMenuSensitivity; - break; - - case eGameSetting_DisplaySplitscreenGamertags: - return ((GameSettingsA[iPad]->usBitmaskValues & 0x0200) >> 9); - break; - - case eGameSetting_Hints: - return ((GameSettingsA[iPad]->usBitmaskValues & 0x0400) >> 10); - break; - case eGameSetting_Autosave: { - unsigned char ucVal = - (GameSettingsA[iPad]->usBitmaskValues & 0x7800) >> 11; - return ucVal; - } break; - case eGameSetting_Tooltips: - return ((GameSettingsA[iPad]->usBitmaskValues & 0x8000) >> 15); - break; - - case eGameSetting_InterfaceOpacity: - return GameSettingsA[iPad]->ucInterfaceOpacity; - break; - - case eGameSetting_Clouds: - return (GameSettingsA[iPad]->uiBitmaskValues & GAMESETTING_CLOUDS); - break; - case eGameSetting_Online: - return (GameSettingsA[iPad]->uiBitmaskValues & - GAMESETTING_ONLINE) >> - 1; - break; - case eGameSetting_InviteOnly: - return (GameSettingsA[iPad]->uiBitmaskValues & - GAMESETTING_INVITEONLY) >> - 2; - break; - case eGameSetting_FriendsOfFriends: - return (GameSettingsA[iPad]->uiBitmaskValues & - GAMESETTING_FRIENDSOFFRIENDS) >> - 3; - break; - case eGameSetting_DisplayUpdateMessage: - return (GameSettingsA[iPad]->uiBitmaskValues & - GAMESETTING_DISPLAYUPDATEMSG) >> - 4; - break; - case eGameSetting_BedrockFog: - return (GameSettingsA[iPad]->uiBitmaskValues & - GAMESETTING_BEDROCKFOG) >> - 6; - break; - case eGameSetting_DisplayHUD: - return (GameSettingsA[iPad]->uiBitmaskValues & - GAMESETTING_DISPLAYHUD) >> - 7; - break; - case eGameSetting_DisplayHand: - return (GameSettingsA[iPad]->uiBitmaskValues & - GAMESETTING_DISPLAYHAND) >> - 8; - break; - case eGameSetting_CustomSkinAnim: - return (GameSettingsA[iPad]->uiBitmaskValues & - GAMESETTING_CUSTOMSKINANIM) >> - 9; - break; - // TU9 - case eGameSetting_DeathMessages: - return (GameSettingsA[iPad]->uiBitmaskValues & - GAMESETTING_DEATHMESSAGES) >> - 10; - break; - case eGameSetting_UISize: { - unsigned char ucVal = - (GameSettingsA[iPad]->uiBitmaskValues & GAMESETTING_UISIZE) >> - 11; - return ucVal; - } break; - case eGameSetting_UISizeSplitscreen: { - unsigned char ucVal = (GameSettingsA[iPad]->uiBitmaskValues & - GAMESETTING_UISIZE_SPLITSCREEN) >> - 13; - return ucVal; - } break; - case eGameSetting_AnimatedCharacter: - return (GameSettingsA[iPad]->uiBitmaskValues & - GAMESETTING_ANIMATEDCHARACTER) >> - 15; - - case eGameSetting_PS3_EULA_Read: - return (GameSettingsA[iPad]->uiBitmaskValues & - GAMESETTING_PS3EULAREAD) >> - 16; - - case eGameSetting_PSVita_NetworkModeAdhoc: - return (GameSettingsA[iPad]->uiBitmaskValues & - GAMESETTING_PSVITANETWORKMODEADHOC) >> - 17; - } - return 0; -} - -void Game::CheckGameSettingsChanged(bool bOverride5MinuteTimer, - int iPad) { - ZoneScopedN("Game::CheckGameSettingsChanged"); - // If the settings have changed, write them to the profile - - if (iPad == XUSER_INDEX_ANY) { - for (int i = 0; i < XUSER_MAX_COUNT; i++) { - if (GameSettingsA[i]->bSettingsChanged) { - ProfileManager.WriteToProfile(i, true, bOverride5MinuteTimer); - GameSettingsA[i]->bSettingsChanged = false; - } - } - } else { - if (GameSettingsA[iPad]->bSettingsChanged) { - ProfileManager.WriteToProfile(iPad, true, bOverride5MinuteTimer); - GameSettingsA[iPad]->bSettingsChanged = false; - } - } -} - -void Game::ClearGameSettingsChangedFlag(int iPad) { - ZoneScopedN("Game::ClearGameSettingsChangedFlag"); - GameSettingsA[iPad]->bSettingsChanged = false; -} /////////////////////////// // @@ -2102,1602 +234,20 @@ void Game::ClearGameSettingsChangedFlag(int iPad) { // //////////////////////////// #if !defined(_DEBUG_MENUS_ENABLED) -unsigned int Game::GetGameSettingsDebugMask( - int iPad, bool bOverridePlayer) // bOverridePlayer is to force the send for - // the server to get the read options -{ - ZoneScopedN("Game::GetGameSettingsDebugMask"); - return 0; -} -void Game::SetGameSettingsDebugMask(int iPad, unsigned int uiVal) {} -void Game::ActionDebugMask(int iPad, bool bSetAllClear) {} #else -unsigned int Game::GetGameSettingsDebugMask( - int iPad, bool bOverridePlayer) // bOverridePlayer is to force the send for - // the server to get the read options -{ - ZoneScopedN("Game::GetGameSettingsDebugMask"); - if (iPad == -1) { - iPad = ProfileManager.GetPrimaryPad(); - } - if (iPad < 0) iPad = 0; - std::shared_ptr player = - Minecraft::GetInstance()->localplayers[iPad]; - if (bOverridePlayer || player == nullptr) { - return GameSettingsA[iPad]->uiDebugBitmask; - } else { - return player->GetDebugOptions(); - } -} - -void Game::SetGameSettingsDebugMask(int iPad, unsigned int uiVal) { - ZoneScopedN("Game::SetGameSettingsDebugMask"); -#if !defined(_CONTENT_PACKAGE) - GameSettingsA[iPad]->bSettingsChanged = true; - GameSettingsA[iPad]->uiDebugBitmask = uiVal; - - // update the value so the network server can use it - std::shared_ptr player = - Minecraft::GetInstance()->localplayers[iPad]; - - if (player) { - Minecraft::GetInstance()->localgameModes[iPad]->handleDebugOptions( - uiVal, player); - } -#endif -} - -void Game::ActionDebugMask(int iPad, bool bSetAllClear) { - ZoneScopedN("Game::ActionDebugMask"); - unsigned int ulBitmask = app.GetGameSettingsDebugMask(iPad); - - if (bSetAllClear) ulBitmask = 0L; - - // these settings should only be actioned for the primary player - if (ProfileManager.GetPrimaryPad() != iPad) return; - - for (int i = 0; i < eDebugSetting_Max; i++) { - switch (i) { - case eDebugSetting_LoadSavesFromDisk: - if (ulBitmask & (1 << i)) { - app.SetLoadSavesFromFolderEnabled(true); - } else { - app.SetLoadSavesFromFolderEnabled(false); - } - break; - - case eDebugSetting_WriteSavesToDisk: - if (ulBitmask & (1 << i)) { - app.SetWriteSavesToFolderEnabled(true); - } else { - app.SetWriteSavesToFolderEnabled(false); - } - break; - - case eDebugSetting_FreezePlayers: // eDebugSetting_InterfaceOff: - if (ulBitmask & (1 << i)) { - app.SetFreezePlayers(true); - - // Turn off interface rendering. - // app.SetInterfaceRenderingOff( true ); - } else { - app.SetFreezePlayers(false); - - // Turn on interface rendering. - // app.SetInterfaceRenderingOff( false ); - } - break; - case eDebugSetting_Safearea: - if (ulBitmask & (1 << i)) { - app.ShowSafeArea(true); - } else { - app.ShowSafeArea(false); - } - break; - - // case eDebugSetting_HandRenderingOff: - // if(ulBitmask&(1<iPad, actionInfo->action); -} - -void Game::HandleXuiActions(void) { - ZoneScopedN("Game::HandleXuiActions"); - eXuiAction eAction; - eTMSAction eTMS; - void* param; - Minecraft* pMinecraft = Minecraft::GetInstance(); - std::shared_ptr player; - - // are there any global actions to deal with? - eAction = app.GetGlobalXuiAction(); - if (eAction != eAppAction_Idle) { - switch (eAction) { - case eAppAction_DisplayLavaMessage: - // Display a warning about placing lava in the spawn area - { - unsigned int uiIDA[1]; - uiIDA[0] = IDS_CONFIRM_OK; - C4JStorage::EMessageResult result = - ui.RequestErrorMessage(IDS_CANT_PLACE_NEAR_SPAWN_TITLE, - IDS_CANT_PLACE_NEAR_SPAWN_TEXT, - uiIDA, 1, XUSER_INDEX_ANY); - if (result != C4JStorage::EMessage_Busy) - SetGlobalXuiAction(eAppAction_Idle); - } - break; - default: - break; - } - } - - // are there any app actions to deal with? - for (int i = 0; i < XUSER_MAX_COUNT; i++) { - eAction = app.GetXuiAction(i); - param = m_eXuiActionParam[i]; - - if (eAction != eAppAction_Idle) { - switch (eAction) { - // // the renderer will capture a screenshot - // case eAppAction_SocialPost: - // if (ProfileManager.IsFullVersion()) { - // // Facebook Share - // if (CSocialManager::Instance() - // ->IsTitleAllowedToPostImages() && - // CSocialManager::Instance() - // ->AreAllUsersAllowedToPostImages()) { - // // disable character name tags for the shot - // // m_bwasHidingGui = - // pMinecraft->options->hideGui; - // // // 4J Stu - Removed 1.8.2 bug fix (TU6) as - // don't - // // need this - // pMinecraft->options->hideGui = true; - - // SetAction(i, eAppAction_SocialPostScreenshot); - // } else { - // SetAction(i, eAppAction_Idle); - // } - // } else { - // SetAction(i, eAppAction_Idle); - // } - // break; - // case eAppAction_SocialPostScreenshot: { - // SetAction(i, eAppAction_Idle); - // bool bKeepHiding = false; - // for (int j = 0; j < XUSER_MAX_COUNT; ++j) { - // if (app.GetXuiAction(j) == - // eAppAction_SocialPostScreenshot) { - // bKeepHiding = true; - // break; - // } - // } - // pMinecraft->options->hideGui = bKeepHiding; - - // // Facebook Share - - // if (app.GetLocalPlayerCount() > 1) { - // ui.NavigateToScene(i, eUIScene_SocialPost); - // } else { - // ui.NavigateToScene(i, eUIScene_SocialPost); - // } - // } break; - case eAppAction_SaveGame: - SetAction(i, eAppAction_Idle); - if (!GetChangingSessionType()) { - // flag the render to capture the screenshot for the - // save - SetAction(i, eAppAction_SaveGameCapturedThumbnail); - } - - break; - case eAppAction_AutosaveSaveGame: { - // Need to run a check to see if the save exists in order to - // stop the dialog asking if we want to overwrite it coming - // up on an autosave - bool bSaveExists; - StorageManager.DoesSaveExist(&bSaveExists); - - SetAction(i, eAppAction_Idle); - if (!GetChangingSessionType()) { - // flag the render to capture the screenshot for the - // save - SetAction(i, - eAppAction_AutosaveSaveGameCapturedThumbnail); - } - } - - break; - - case eAppAction_SaveGameCapturedThumbnail: - // reset the autosave timer - app.SetAutosaveTimerTime(); - SetAction(i, eAppAction_Idle); - // Check that there is a name for the save - if we're saving - // from the tutorial and this is the first save from the - // tutorial, we'll not have a name - /*if(StorageManager.GetSaveName()==nullptr) - { - app.NavigateToScene(i,eUIScene_SaveWorld); - } - else*/ - { - // turn off the gamertags in splitscreen for the primary - // player, since they are about to be made fullscreen - ui.HideAllGameUIElements(); - - // Hide the other players scenes - ui.ShowOtherPlayersBaseScene( - ProfileManager.GetPrimaryPad(), false); - - // int saveOrCheckpointId = 0; - // bool validSave = - // StorageManager.GetSaveUniqueNumber(&saveOrCheckpointId); - // SentientManager.RecordLevelSaveOrCheckpoint(ProfileManager.GetPrimaryPad(), - // saveOrCheckpointId); - - LoadingInputParams* loadingParams = - new LoadingInputParams(); - loadingParams->func = - &UIScene_PauseMenu::SaveWorldThreadProc; - loadingParams->lpParam = (void*)false; - - // 4J-JEV - PS4: Fix for #5708 - [ONLINE] - If the user - // pulls their network cable out while saving the title - // will hang. - loadingParams->waitForThreadToDelete = true; - - UIFullscreenProgressCompletionData* completionData = - new UIFullscreenProgressCompletionData(); - completionData->bShowBackground = true; - completionData->bShowLogo = true; - completionData->type = - e_ProgressCompletion_NavigateBackToScene; - completionData->iPad = ProfileManager.GetPrimaryPad(); - - if (ui.IsSceneInStack(ProfileManager.GetPrimaryPad(), - eUIScene_EndPoem)) { - completionData->scene = eUIScene_EndPoem; - } else { - completionData->scene = eUIScene_PauseMenu; - } - - loadingParams->completionData = completionData; - - // 4J Stu - Xbox only - - ui.NavigateToScene(ProfileManager.GetPrimaryPad(), - eUIScene_FullscreenProgress, - loadingParams, eUILayer_Fullscreen, - eUIGroup_Fullscreen); - } - break; - case eAppAction_AutosaveSaveGameCapturedThumbnail: - - { - app.SetAutosaveTimerTime(); - SetAction(i, eAppAction_Idle); - - // turn off the gamertags in splitscreen for the primary - // player, since they are about to be made fullscreen - ui.HideAllGameUIElements(); - - // app.CloseAllPlayersXuiScenes(); - // Hide the other players scenes - ui.ShowOtherPlayersBaseScene(ProfileManager.GetPrimaryPad(), - false); - - // This just allows it to be shown - if (pMinecraft - ->localgameModes[ProfileManager.GetPrimaryPad()] != - nullptr) - pMinecraft - ->localgameModes[ProfileManager.GetPrimaryPad()] - ->getTutorial() - ->showTutorialPopup(false); - - // int saveOrCheckpointId = 0; - // bool validSave = - // StorageManager.GetSaveUniqueNumber(&saveOrCheckpointId); - // SentientManager.RecordLevelSaveOrCheckpoint(ProfileManager.GetPrimaryPad(), - // saveOrCheckpointId); - - LoadingInputParams* loadingParams = - new LoadingInputParams(); - loadingParams->func = - &UIScene_PauseMenu::SaveWorldThreadProc; - - loadingParams->lpParam = (void*)true; - - UIFullscreenProgressCompletionData* completionData = - new UIFullscreenProgressCompletionData(); - completionData->bShowBackground = true; - completionData->bShowLogo = true; - completionData->type = - e_ProgressCompletion_AutosaveNavigateBack; - completionData->iPad = ProfileManager.GetPrimaryPad(); - // completionData->bAutosaveWasMenuDisplayed=ui.GetMenuDisplayed(ProfileManager.GetPrimaryPad()); - loadingParams->completionData = completionData; - - // 4J Stu - Xbox only - - ui.NavigateToScene(ProfileManager.GetPrimaryPad(), - eUIScene_FullscreenProgress, - loadingParams, eUILayer_Fullscreen, - eUIGroup_Fullscreen); - } break; - case eAppAction_ExitPlayer: - // a secondary player has chosen to quit - { - int iPlayerC = g_NetworkManager.GetPlayerCount(); - - // Since the player is exiting, let's flush any profile - // writes for them, and hope we're not breaking TCR - // 136... - ProfileManager.ForceQueuedProfileWrites(i); - - // not required - it's done within the - // removeLocalPlayerIdx - // if(pMinecraft->level->isClientSide) - // { - // // we need to - // remove the qnetplayer, or this player won't be able - // to get back into the game until qnet times out and - // removes them - // g_NetworkManager.NotifyPlayerLeaving(g_NetworkManager.GetLocalPlayerByUserIndex(i)); - // } - - // if there are any tips showing, we need to close them - - pMinecraft->gui->clearMessages(i); - - // Make sure we've not got this player selected as - // current - this shouldn't be the case anyway - pMinecraft->setLocalPlayerIdx( - ProfileManager.GetPrimaryPad()); - pMinecraft->removeLocalPlayerIdx(i); - - // Wipe out the tooltips - ui.SetTooltips(i, -1); - - // Change the presence info - // Are we offline or online, and how many players are - // there - if (iPlayerC > 2) // one player is about to leave here - // - they'll be set to idle in the - // qnet manager player leave - { - for (int iPlayer = 0; iPlayer < XUSER_MAX_COUNT; - iPlayer++) { - if ((iPlayer != i) && - pMinecraft->localplayers[iPlayer]) { - if (g_NetworkManager.IsLocalGame()) { - ProfileManager.SetCurrentGameActivity( - iPlayer, - CONTEXT_PRESENCE_MULTIPLAYEROFFLINE, - false); - } else { - ProfileManager.SetCurrentGameActivity( - iPlayer, - CONTEXT_PRESENCE_MULTIPLAYER, - false); - } - } - } - } else { - for (int iPlayer = 0; iPlayer < XUSER_MAX_COUNT; - iPlayer++) { - if ((iPlayer != i) && - pMinecraft->localplayers[iPlayer]) { - if (g_NetworkManager.IsLocalGame()) { - ProfileManager.SetCurrentGameActivity( - iPlayer, - CONTEXT_PRESENCE_MULTIPLAYER_1POFFLINE, - false); - } else { - ProfileManager.SetCurrentGameActivity( - iPlayer, - CONTEXT_PRESENCE_MULTIPLAYER_1P, - false); - } - } - } - } - - SetAction(i, eAppAction_Idle); - } - break; - case eAppAction_ExitPlayerPreLogin: { - int iPlayerC = g_NetworkManager.GetPlayerCount(); - // Since the player is exiting, let's flush any profile - // writes for them, and hope we're not breaking TCR 136... - ProfileManager.ForceQueuedProfileWrites(i); - // if there are any tips showing, we need to close them - - pMinecraft->gui->clearMessages(i); - - // Make sure we've not got this player selected as current - - // this shouldn't be the case anyway - pMinecraft->setLocalPlayerIdx( - ProfileManager.GetPrimaryPad()); - pMinecraft->removeLocalPlayerIdx(i); - - // Wipe out the tooltips - ui.SetTooltips(i, -1); - - // Change the presence info - // Are we offline or online, and how many players are there - if (iPlayerC > - 2) // one player is about to leave here - they'll be - // set to idle in the qnet manager player leave - { - for (int iPlayer = 0; iPlayer < XUSER_MAX_COUNT; - iPlayer++) { - if ((iPlayer != i) && - pMinecraft->localplayers[iPlayer]) { - if (g_NetworkManager.IsLocalGame()) { - ProfileManager.SetCurrentGameActivity( - iPlayer, - CONTEXT_PRESENCE_MULTIPLAYEROFFLINE, - false); - } else { - ProfileManager.SetCurrentGameActivity( - iPlayer, CONTEXT_PRESENCE_MULTIPLAYER, - false); - } - } - } - } else { - for (int iPlayer = 0; iPlayer < XUSER_MAX_COUNT; - iPlayer++) { - if ((iPlayer != i) && - pMinecraft->localplayers[iPlayer]) { - if (g_NetworkManager.IsLocalGame()) { - ProfileManager.SetCurrentGameActivity( - iPlayer, - CONTEXT_PRESENCE_MULTIPLAYER_1POFFLINE, - false); - } else { - ProfileManager.SetCurrentGameActivity( - iPlayer, - CONTEXT_PRESENCE_MULTIPLAYER_1P, false); - } - } - } - } - SetAction(i, eAppAction_Idle); - } break; - - case eAppAction_ExitWorld: - pMinecraft->exitingWorldRightNow = true; - - SetAction(i, eAppAction_Idle); - - // If we're already leaving don't exit - if (g_NetworkManager.IsLeavingGame()) { - break; - } - - pMinecraft->gui->clearMessages(); - - // turn off the gamertags in splitscreen for the primary - // player, since they are about to be made fullscreen - ui.HideAllGameUIElements(); - - // reset the flag stopping new dlc message being shown if - // you've seen the message before - DisplayNewDLCTipAgain(); - - // clear the autosave timer that might be on screen - ui.ShowAutosaveCountdownTimer(false); - - // Hide the selected item text - ui.HideAllGameUIElements(); - - // Since the player forced the exit, let's flush any profile - // writes, and hope we're not breaking TCR 136... - - // 4J-PB - cancel any possible std::string verifications - // queued with LIVE - // InputManager.CancelAllVerifyInProgress(); - - // In a split screen, only the primary player actually - // quits the game, others just remove their players - if (i != ProfileManager.GetPrimaryPad()) { - // Make sure we've not got this player selected as - // current - this shouldn't be the case anyway - pMinecraft->setLocalPlayerIdx( - ProfileManager.GetPrimaryPad()); - pMinecraft->removeLocalPlayerIdx(i); - - SetAction(i, eAppAction_Idle); - return; - } - // flag to capture the save thumbnail - SetAction(i, eAppAction_ExitWorldCapturedThumbnail, param); - - // Change the presence info - // Are we offline or online, and how many players are there - - if (g_NetworkManager.GetPlayerCount() > 1) { - for (int j = 0; j < XUSER_MAX_COUNT; j++) { - if (pMinecraft->localplayers[j]) { - if (g_NetworkManager.IsLocalGame()) { - app.SetRichPresenceContext( - j, CONTEXT_GAME_STATE_BLANK); - ProfileManager.SetCurrentGameActivity( - j, CONTEXT_PRESENCE_MULTIPLAYEROFFLINE, - false); - } else { - app.SetRichPresenceContext( - j, CONTEXT_GAME_STATE_BLANK); - ProfileManager.SetCurrentGameActivity( - j, CONTEXT_PRESENCE_MULTIPLAYER, false); - } - } - } - } else { - app.SetRichPresenceContext(i, CONTEXT_GAME_STATE_BLANK); - if (g_NetworkManager.IsLocalGame()) { - ProfileManager.SetCurrentGameActivity( - i, CONTEXT_PRESENCE_MULTIPLAYER_1POFFLINE, - false); - } else { - ProfileManager.SetCurrentGameActivity( - i, CONTEXT_PRESENCE_MULTIPLAYER_1P, false); - } - } - break; - case eAppAction_ExitWorldCapturedThumbnail: { - SetAction(i, eAppAction_Idle); - // Stop app running - SetGameStarted(false); - SetChangingSessionType( - true); // Added to stop handling ethernet disconnects - - ui.CloseAllPlayersScenes(); - - // turn off the gamertags in splitscreen for the primary - // player, since they are about to be made fullscreen - ui.HideAllGameUIElements(); - - // 4J Stu - Fix for #12368 - Crash: Game crashes when saving - // then exiting and selecting to save - for (unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - // 4J Stu - Fix for #13257 - CRASH: Gameplay: Title - // crashed after exiting the tutorial It doesn't matter - // if they were in the tutorial already - pMinecraft->playerLeftTutorial(idx); - } - - LoadingInputParams* loadingParams = - new LoadingInputParams(); - loadingParams->func = - &UIScene_PauseMenu::ExitWorldThreadProc; - loadingParams->lpParam = param; - - UIFullscreenProgressCompletionData* completionData = - new UIFullscreenProgressCompletionData(); - // If param is non-null then this is a forced exit by the - // server, so make sure the player knows why 4J Stu - - // Changed - Don't use the FullScreenProgressScreen for - // action, use a dialog instead - completionData->bRequiresUserAction = - false; //(param != nullptr) ? true : false; - completionData->bShowTips = - (param != nullptr) ? false : true; - completionData->bShowBackground = true; - completionData->bShowLogo = true; - completionData->type = - e_ProgressCompletion_NavigateToHomeMenu; - completionData->iPad = DEFAULT_XUI_MENU_USER; - loadingParams->completionData = completionData; - - ui.NavigateToScene(ProfileManager.GetPrimaryPad(), - eUIScene_FullscreenProgress, - loadingParams); - } break; - case eAppAction_ExitWorldTrial: { - SetAction(i, eAppAction_Idle); - - pMinecraft->gui->clearMessages(); - - // turn off the gamertags in splitscreen for the primary - // player, since they are about to be made fullscreen - ui.HideAllGameUIElements(); - - // Stop app running - SetGameStarted(false); - - ui.CloseAllPlayersScenes(); - - // 4J Stu - Fix for #12368 - Crash: Game crashes when saving - // then exiting and selecting to save - for (unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - // 4J Stu - Fix for #13257 - CRASH: Gameplay: Title - // crashed after exiting the tutorial It doesn't matter - // if they were in the tutorial already - pMinecraft->playerLeftTutorial(idx); - } - - LoadingInputParams* loadingParams = - new LoadingInputParams(); - loadingParams->func = - &UIScene_PauseMenu::ExitWorldThreadProc; - loadingParams->lpParam = param; - - UIFullscreenProgressCompletionData* completionData = - new UIFullscreenProgressCompletionData(); - completionData->bShowBackground = true; - completionData->bShowLogo = true; - completionData->type = - e_ProgressCompletion_NavigateToHomeMenu; - completionData->iPad = DEFAULT_XUI_MENU_USER; - loadingParams->completionData = completionData; - - ui.NavigateToScene(ProfileManager.GetPrimaryPad(), - eUIScene_FullscreenProgress, - loadingParams); - } - - break; - case eAppAction_ExitTrial: - // XLaunchNewImage(XLAUNCH_KEYWORD_DASH_ARCADE, 0); - ExitGame(); - break; - - case eAppAction_Respawn: { - ConnectionProgressParams* param = - new ConnectionProgressParams(); - param->iPad = i; - param->stringId = IDS_PROGRESS_RESPAWNING; - param->showTooltips = false; - param->setFailTimer = false; - ui.NavigateToScene(i, eUIScene_ConnectingProgress, param); - - // Need to reset this incase the player has already died and - // respawned - pMinecraft->localplayers[i]->SetPlayerRespawned(false); - - SetAction(i, eAppAction_WaitForRespawnComplete); - if (app.GetLocalPlayerCount() > 1) { - // In split screen mode, we don't want to do any async - // loading or flushing of the cache, just a simple - // respawn - pMinecraft->localplayers[i]->respawn(); - - // If the respawn requires a dimension change then the - // action will have changed - // if(app.GetXuiAction(i) == eAppAction_Respawn) - //{ - // SetAction(i,eAppAction_Idle); - // CloseXuiScenes(i); - //} - } else { - // SetAction(i,eAppAction_WaitForRespawnComplete); - - // LoadingInputParams *loadingParams = new - // LoadingInputParams(); loadingParams->func = - // &CScene_Death::RespawnThreadProc; - // loadingParams->lpParam = (void*)i; - - // Disable game & update thread whilst we do any of this - // app.SetGameStarted(false); - pMinecraft->gameRenderer->DisableUpdateThread(); - - // 4J Stu - We don't need this on a thread in - // multiplayer as respawning is asynchronous. - pMinecraft->localplayers[i]->respawn(); - - // app.SetGameStarted(true); - pMinecraft->gameRenderer->EnableUpdateThread(); - - // UIFullscreenProgressCompletionData *completionData = - // new UIFullscreenProgressCompletionData(); - // completionData->bShowBackground=true; - // completionData->bShowLogo=true; - // completionData->type = - // e_ProgressCompletion_CloseUIScenes; - // completionData->iPad = i; - // loadingParams->completionData = completionData; - - // app.NavigateToScene(i,eUIScene_FullscreenProgress, - // loadingParams, true); - } - } break; - case eAppAction_WaitForRespawnComplete: - player = pMinecraft->localplayers[i]; - if (player != nullptr && player->GetPlayerRespawned()) { - SetAction(i, eAppAction_Idle); - - if (ui.IsSceneInStack(i, eUIScene_EndPoem)) { - ui.NavigateBack(i, false, eUIScene_EndPoem); - } else { - ui.CloseUIScenes(i); - } - - // clear the progress messages - - // pMinecraft->progressRenderer->progressStart(-1); - // pMinecraft->progressRenderer->progressStage(-1); - } else if (!g_NetworkManager.IsInGameplay()) { - SetAction(i, eAppAction_Idle); - } - break; - case eAppAction_WaitForDimensionChangeComplete: - player = pMinecraft->localplayers[i]; - if (player != nullptr && player->connection && - player->connection->isStarted()) { - SetAction(i, eAppAction_Idle); - ui.CloseUIScenes(i); - } else if (!g_NetworkManager.IsInGameplay()) { - SetAction(i, eAppAction_Idle); - } - break; - case eAppAction_PrimaryPlayerSignedOut: { - // SetAction(i,eAppAction_Idle); - - // clear the autosavetimer that might be displayed - ui.ShowAutosaveCountdownTimer(false); - - // If the player signs out before the game started the - // server can be killed a bit earlier to stop the loading or - // saving of a new game continuing running while the - // UI/Guide is up - if (!app.GetGameStarted()) - MinecraftServer::HaltServer(true); - - // inform the player they are being returned to the menus - // because they signed out - StorageManager.SetSaveDeviceSelected(i, false); - // need to clear the player stats - can't assume it'll be - // done in setlevel - we may not be in the game - StatsCounter* pStats = Minecraft::GetInstance()->stats[i]; - pStats->clear(); - - // 4J-PB - the libs will display the Returned to Title - // screen unsigned int - // uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; - // - // ui.RequestMessageBox(IDS_RETURNEDTOMENU_TITLE, - // IDS_RETURNEDTOTITLESCREEN_TEXT, uiIDA, 1, - // i,&Game::PrimaryPlayerSignedOutReturned,this,app.GetStringTable()); - if (g_NetworkManager.IsInSession()) { - app.SetAction( - i, eAppAction_PrimaryPlayerSignedOutReturned); - } else { - app.SetAction( - i, eAppAction_PrimaryPlayerSignedOutReturned_Menus); - MinecraftServer::resetFlags(); - } - } break; - case eAppAction_EthernetDisconnected: { - app.DebugPrintf( - "Handling eAppAction_EthernetDisconnected\n"); - SetAction(i, eAppAction_Idle); - - // 4J Stu - Fix for #12530 -TCR 001 BAS Game Stability: - // Title will crash if the player disconnects while starting - // a new world and then opts to play the tutorial once they - // have been returned to the Main Menu. - if (!g_NetworkManager.IsLeavingGame()) { - app.DebugPrintf( - "Handling eAppAction_EthernetDisconnected - Not " - "leaving game\n"); - // 4J-PB - not the same as a signout. We should only - // leave the game if this machine is not the host. We - // shouldn't get rid of the save device either. - if (g_NetworkManager.IsHost()) { - app.DebugPrintf( - "Handling eAppAction_EthernetDisconnected - Is " - "Host\n"); - // If it's already a local game, then an ethernet - // disconnect should have no effect - if (!g_NetworkManager.IsLocalGame() && - g_NetworkManager.IsInGameplay()) { - // Change the session to an offline session - SetAction(i, eAppAction_ChangeSessionType); - } else if (!g_NetworkManager.IsLocalGame() && - !g_NetworkManager.IsInGameplay()) { - // There are two cases here, either: - // 1. We're early enough in the - // create/load game that we can do a really - // minimal shutdown or - // 2. We're far enough in (game has started - // but the actual game started flag hasn't - // been set) that we should just wait until - // we're in the game and switch to offline - // mode - - // If there's a non-null level then, for our - // purposes, the game has started - bool gameStarted = false; - for (int j = 0; j < pMinecraft->levels.size(); - j++) { - if (pMinecraft->levels.data()[j] != - nullptr) { - gameStarted = true; - break; - } - } - - if (!gameStarted) { - // 1. Exit - MinecraftServer::HaltServer(); - - // Fix for #12530 - TCR 001 BAS Game - // Stability: Title will crash if the player - // disconnects while starting a new world - // and then opts to play the tutorial once - // they have been returned to the Main Menu. - // 4J Stu - Leave the session - g_NetworkManager.LeaveGame(false); - - // need to clear the player stats - can't - // assume it'll be done in setlevel - we may - // not be in the game - StatsCounter* pStats = - Minecraft::GetInstance()->stats[i]; - pStats->clear(); - unsigned int uiIDA[1]; - uiIDA[0] = IDS_CONFIRM_OK; - - ui.RequestErrorMessage( - g_NetworkManager.CorrectErrorIDS( - IDS_CONNECTION_LOST), - g_NetworkManager.CorrectErrorIDS( - IDS_CONNECTION_LOST_LIVE), - uiIDA, 1, i, - &Game:: - EthernetDisconnectReturned, - this); - } else { - // 2. Switch to offline - SetAction(i, eAppAction_ChangeSessionType); - } - } - } else { - { - app.DebugPrintf( - "Handling eAppAction_EthernetDisconnected " - "- Not host\n"); - // need to clear the player stats - can't assume - // it'll be done in setlevel - we may not be in - // the game - StatsCounter* pStats = - Minecraft::GetInstance()->stats[i]; - pStats->clear(); - unsigned int uiIDA[1]; - uiIDA[0] = IDS_CONFIRM_OK; - - ui.RequestErrorMessage( - g_NetworkManager.CorrectErrorIDS( - IDS_CONNECTION_LOST), - g_NetworkManager.CorrectErrorIDS( - IDS_CONNECTION_LOST_LIVE), - uiIDA, 1, i, - &Game::EthernetDisconnectReturned, - this); - } - } - } - } break; - // We currently handle both these returns the same way. - case eAppAction_EthernetDisconnectedReturned: - case eAppAction_PrimaryPlayerSignedOutReturned: { - SetAction(i, eAppAction_Idle); - - pMinecraft->gui->clearMessages(); - - // turn off the gamertags in splitscreen for the primary - // player, since they are about to be made fullscreen - ui.HideAllGameUIElements(); - - // set the state back to pre-game - ProfileManager.ResetProfileProcessState(); - - if (g_NetworkManager.IsLeavingGame()) { - // 4J Stu - If we are already leaving the game, then we - // just need to signal that the player signed out to - // stop saves - pMinecraft->progressRenderer->progressStartNoAbort( - IDS_EXITING_GAME); - pMinecraft->progressRenderer->progressStage(-1); - // This has no effect on client machines - MinecraftServer::HaltServer(true); - } else { - // Stop app running - SetGameStarted(false); - - // turn off the gamertags in splitscreen for the primary - // player, since they are about to be made fullscreen - ui.HideAllGameUIElements(); - - ui.CloseAllPlayersScenes(); - - // 4J Stu - Fix for #12368 - Crash: Game crashes when - // saving then exiting and selecting to save - for (unsigned int idx = 0; idx < XUSER_MAX_COUNT; - ++idx) { - // 4J Stu - Fix for #13257 - CRASH: Gameplay: Title - // crashed after exiting the tutorial It doesn't - // matter if they were in the tutorial already - pMinecraft->playerLeftTutorial(idx); - } - - LoadingInputParams* loadingParams = - new LoadingInputParams(); - loadingParams->func = - &Game::SignoutExitWorldThreadProc; - - UIFullscreenProgressCompletionData* completionData = - new UIFullscreenProgressCompletionData(); - completionData->bShowBackground = true; - completionData->bShowLogo = true; - completionData->iPad = DEFAULT_XUI_MENU_USER; - completionData->type = - e_ProgressCompletion_NavigateToHomeMenu; - loadingParams->completionData = completionData; - - ui.NavigateToScene(ProfileManager.GetPrimaryPad(), - eUIScene_FullscreenProgress, - loadingParams); - } - } break; - case eAppAction_PrimaryPlayerSignedOutReturned_Menus: - SetAction(i, eAppAction_Idle); - // set the state back to pre-game - ProfileManager.ResetProfileProcessState(); - // clear the save device - StorageManager.SetSaveDeviceSelected(i, false); - - ui.UpdatePlayerBasePositions(); - // there are multiple layers in the help menu, so a navigate - // back isn't enough - ui.NavigateToHomeMenu(); - - break; - case eAppAction_EthernetDisconnectedReturned_Menus: - SetAction(i, eAppAction_Idle); - // set the state back to pre-game - ProfileManager.ResetProfileProcessState(); - - ui.UpdatePlayerBasePositions(); - - // there are multiple layers in the help menu, so a navigate - // back isn't enough - ui.NavigateToHomeMenu(); - - break; - - case eAppAction_TrialOver: { - SetAction(i, eAppAction_Idle); - unsigned int uiIDA[2]; - uiIDA[0] = IDS_UNLOCK_TITLE; - uiIDA[1] = IDS_EXIT_GAME; - - ui.RequestErrorMessage( - IDS_TRIALOVER_TITLE, IDS_TRIALOVER_TEXT, uiIDA, 2, i, - &Game::TrialOverReturned, this); - } break; - - // INVITES - case eAppAction_DashboardTrialJoinFromInvite: { - SetAction(i, eAppAction_Idle); - unsigned int uiIDA[2]; - uiIDA[0] = IDS_CONFIRM_OK; - uiIDA[1] = IDS_CONFIRM_CANCEL; - - ui.RequestErrorMessage( - IDS_UNLOCK_TITLE, IDS_UNLOCK_ACCEPT_INVITE, uiIDA, 2, i, - &Game::UnlockFullInviteReturned, this); - } break; - case eAppAction_ExitAndJoinFromInvite: { - unsigned int uiIDA[3]; - - SetAction(i, eAppAction_Idle); - // Check the player really wants to do this - - if (!StorageManager.GetSaveDisabled() && - i == ProfileManager.GetPrimaryPad() && - g_NetworkManager.IsHost() && GetGameStarted()) { - uiIDA[0] = IDS_CONFIRM_CANCEL; - uiIDA[1] = IDS_EXIT_GAME_SAVE; - uiIDA[2] = IDS_EXIT_GAME_NO_SAVE; - - ui.RequestAlertMessage( - IDS_EXIT_GAME, IDS_CONFIRM_LEAVE_VIA_INVITE, uiIDA, - 3, i, - &Game:: - ExitAndJoinFromInviteSaveDialogReturned, - this); - } else { - uiIDA[0] = IDS_CONFIRM_CANCEL; - uiIDA[1] = IDS_CONFIRM_OK; - ui.RequestAlertMessage( - IDS_EXIT_GAME, IDS_CONFIRM_LEAVE_VIA_INVITE, uiIDA, - 2, i, &Game::ExitAndJoinFromInvite, this); - } - } break; - case eAppAction_ExitAndJoinFromInviteConfirmed: { - SetAction(i, eAppAction_Idle); - - pMinecraft->gui->clearMessages(); - - // turn off the gamertags in splitscreen for the primary - // player, since they are about to be made fullscreen - ui.HideAllGameUIElements(); - - // Stop app running - SetGameStarted(false); - - ui.CloseAllPlayersScenes(); - - // 4J Stu - Fix for #12368 - Crash: Game crashes when saving - // then exiting and selecting to save - for (unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - // 4J Stu - Fix for #13257 - CRASH: Gameplay: Title - // crashed after exiting the tutorial It doesn't matter - // if they were in the tutorial already - pMinecraft->playerLeftTutorial(idx); - } - - // 4J-PB - may have been using a texture pack with audio , - // so clean up anything texture pack related here - - // unload any texture pack audio - // if there is audio in use, clear out the audio, and - // unmount the pack - TexturePack* pTexPack = - Minecraft::GetInstance()->skins->getSelected(); - DLCTexturePack* pDLCTexPack = nullptr; - - if (pTexPack->hasAudio()) { - // get the dlc texture pack, and store it - pDLCTexPack = (DLCTexturePack*)pTexPack; - } - - // change to the default texture pack - pMinecraft->skins->selectTexturePackById( - TexturePackRepository::DEFAULT_TEXTURE_PACK_ID); - - if (pTexPack->hasAudio()) { - // need to stop the streaming audio - by playing - // streaming audio from the default texture pack now - // reset the streaming sounds back to the normal ones - pMinecraft->soundEngine->SetStreamingSounds( - eStream_Overworld_Calm1, eStream_Overworld_piano3, - eStream_Nether1, eStream_Nether4, - eStream_end_dragon, eStream_end_end, eStream_CD_1); - pMinecraft->soundEngine->playStreaming(L"", 0, 0, 0, 1, - 1); - - const unsigned int result = - StorageManager.UnmountInstalledDLC("TPACK"); - app.DebugPrintf("Unmount result is %d\n", result); - } - - LoadingInputParams* loadingParams = - new LoadingInputParams(); - loadingParams->func = - &CGameNetworkManager::ExitAndJoinFromInviteThreadProc; - loadingParams->lpParam = (void*)&m_InviteData; - - UIFullscreenProgressCompletionData* completionData = - new UIFullscreenProgressCompletionData(); - completionData->bShowBackground = true; - completionData->bShowLogo = true; - completionData->iPad = DEFAULT_XUI_MENU_USER; - completionData->type = e_ProgressCompletion_NoAction; - loadingParams->completionData = completionData; - - ui.NavigateToScene(ProfileManager.GetPrimaryPad(), - eUIScene_FullscreenProgress, - loadingParams); - } - - break; - case eAppAction_JoinFromInvite: { - SetAction(i, eAppAction_Idle); - - // 4J Stu - Move this state block from - // IPlatformNetwork::ExitAndJoinFromInviteThreadProc, - // as g_NetworkManager.JoinGameFromInviteInfo ultimately can - // call NavigateToScene, - /// and we should only be calling that from the main thread - app.SetTutorialMode(false); - - g_NetworkManager.SetLocalGame(false); - - JoinFromInviteData* inviteData = (JoinFromInviteData*)param; - // 4J-PB - clear any previous connection errors - Minecraft::GetInstance()->clearConnectionFailed(); - - app.DebugPrintf( - "Changing Primary Pad on an invite accept - pad was " - "%d, and is now %d\n", - ProfileManager.GetPrimaryPad(), - inviteData->dwUserIndex); - ProfileManager.SetLockedProfile(inviteData->dwUserIndex); - ProfileManager.SetPrimaryPad(inviteData->dwUserIndex); - - // change the minecraft player name - Minecraft::GetInstance()->user->name = - convStringToWstring(ProfileManager.GetGamertag( - ProfileManager.GetPrimaryPad())); - - bool success = g_NetworkManager.JoinGameFromInviteInfo( - inviteData->dwUserIndex, // dwUserIndex - inviteData->dwLocalUsersMask, // dwUserMask - inviteData->pInviteInfo); // pInviteInfo - - if (!success) { - app.DebugPrintf("Failed joining game from invite\n"); - // return hr; - - // 4J Stu - Copied this from XUI_FullScreenProgress to - // properly handle the fail case, as the thread will no - // longer be failing - unsigned int uiIDA[1]; - uiIDA[0] = IDS_CONFIRM_OK; - ui.RequestErrorMessage( - IDS_CONNECTION_FAILED, IDS_CONNECTION_LOST_SERVER, - uiIDA, 1, ProfileManager.GetPrimaryPad()); - - ui.NavigateToHomeMenu(); - ui.UpdatePlayerBasePositions(); - } - } break; - case eAppAction_ChangeSessionType: { - // If we are not in gameplay yet, then wait until the server - // is setup before changing the session type - if (g_NetworkManager.IsInGameplay()) { - // This kicks off a thread that waits for the server to - // end, then closes the current session, starts a new - // one and joins the local players into it - - SetAction(i, eAppAction_Idle); - - if (!GetChangingSessionType() && - !g_NetworkManager.IsLocalGame()) { - SetGameStarted(false); - SetChangingSessionType(true); - SetReallyChangingSessionType(true); - - // turn off the gamertags in splitscreen for the - // primary player, since they are about to be made - // fullscreen - ui.HideAllGameUIElements(); - - if (!ui.IsSceneInStack( - ProfileManager.GetPrimaryPad(), - eUIScene_EndPoem)) { - ui.CloseAllPlayersScenes(); - } - ui.ShowOtherPlayersBaseScene( - ProfileManager.GetPrimaryPad(), true); - - // Remove this line to fix: - // #49084 - TU5: Code: Gameplay: The title crashes - // every time client navigates to 'Play game' menu - // and loads/creates new game after a "Connection to - // Xbox LIVE was lost" message has appeared. - // app.NavigateToScene(0,eUIScene_Main); - - LoadingInputParams* loadingParams = - new LoadingInputParams(); - loadingParams->func = - &CGameNetworkManager:: - ChangeSessionTypeThreadProc; - loadingParams->lpParam = nullptr; - - UIFullscreenProgressCompletionData* completionData = - new UIFullscreenProgressCompletionData(); - completionData->bRequiresUserAction = true; - completionData->bShowBackground = true; - completionData->bShowLogo = true; - completionData->iPad = DEFAULT_XUI_MENU_USER; - if (ui.IsSceneInStack( - ProfileManager.GetPrimaryPad(), - eUIScene_EndPoem)) { - completionData->type = - e_ProgressCompletion_NavigateBackToScene; - completionData->scene = eUIScene_EndPoem; - } else { - completionData->type = - e_ProgressCompletion_CloseAllPlayersUIScenes; - } - loadingParams->completionData = completionData; - - ui.NavigateToScene(ProfileManager.GetPrimaryPad(), - eUIScene_FullscreenProgress, - loadingParams); - } - } else if (g_NetworkManager.IsLeavingGame()) { - // If we are leaving the game, then ignore the state - // change - SetAction(i, eAppAction_Idle); - } - } break; - case eAppAction_SetDefaultOptions: - SetAction(i, eAppAction_Idle); - SetDefaultOptions((C_4JProfile::PROFILESETTINGS*)param, i); - - // if the profile data has been changed, then force a - // profile write It seems we're allowed to break the 5 - // minute rule if it's the result of a user action - CheckGameSettingsChanged(true, i); - - break; - - case eAppAction_RemoteServerSave: { - // If the remote server save has already finished, don't - // complete the action - if (GetGameStarted()) { - SetAction(ProfileManager.GetPrimaryPad(), - eAppAction_Idle); - break; - } - - SetAction(i, eAppAction_WaitRemoteServerSaveComplete); - - for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { - ui.CloseUIScenes(i, true); - } - - // turn off the gamertags in splitscreen for the primary - // player, since they are about to be made fullscreen - ui.HideAllGameUIElements(); - - LoadingInputParams* loadingParams = - new LoadingInputParams(); - loadingParams->func = &Game::RemoteSaveThreadProc; - loadingParams->lpParam = nullptr; - - UIFullscreenProgressCompletionData* completionData = - new UIFullscreenProgressCompletionData(); - completionData->bRequiresUserAction = false; - completionData->bShowBackground = true; - completionData->bShowLogo = true; - completionData->iPad = DEFAULT_XUI_MENU_USER; - if (ui.IsSceneInStack(ProfileManager.GetPrimaryPad(), - eUIScene_EndPoem)) { - completionData->type = - e_ProgressCompletion_NavigateBackToScene; - completionData->scene = eUIScene_EndPoem; - } else { - completionData->type = - e_ProgressCompletion_CloseAllPlayersUIScenes; - } - loadingParams->completionData = completionData; - - loadingParams->cancelFunc = - &Game::ExitGameFromRemoteSave; - loadingParams->cancelText = IDS_TOOLTIPS_EXIT; - - ui.NavigateToScene(ProfileManager.GetPrimaryPad(), - eUIScene_FullscreenProgress, - loadingParams); - } break; - case eAppAction_WaitRemoteServerSaveComplete: - // Do nothing - break; - case eAppAction_FailedToJoinNoPrivileges: { - unsigned int uiIDA[1]; - uiIDA[0] = IDS_CONFIRM_OK; - C4JStorage::EMessageResult result = ui.RequestErrorMessage( - IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, - IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA, 1, - ProfileManager.GetPrimaryPad()); - if (result != C4JStorage::EMessage_Busy) - SetAction(i, eAppAction_Idle); - } break; - case eAppAction_ProfileReadError: - // Return player to the main menu - code largely copied from - // that for handling eAppAction_PrimaryPlayerSignedOut, - // although I don't think we should have got as far as - // needing to halt the server, or running the game, before - // returning to the menu - if (!app.GetGameStarted()) - MinecraftServer::HaltServer(true); - - if (g_NetworkManager.IsInSession()) { - app.SetAction( - i, eAppAction_PrimaryPlayerSignedOutReturned); - } else { - app.SetAction( - i, eAppAction_PrimaryPlayerSignedOutReturned_Menus); - MinecraftServer::resetFlags(); - } - break; - - case eAppAction_BanLevel: { - // It's possible that this state can get set after the game - // has been exited (e.g. by network disconnection) so we - // can't ban the level at that point - if (g_NetworkManager.IsInGameplay() && - !g_NetworkManager.IsLeavingGame()) { - // primary player would exit the world, secondary would - // exit the player - if (ProfileManager.GetPrimaryPad() == i) { - SetAction(i, eAppAction_ExitWorld); - } else { - SetAction(i, eAppAction_ExitPlayer); - } - } - } break; - case eAppAction_LevelInBanLevelList: { - unsigned int uiIDA[2]; - uiIDA[0] = IDS_BUTTON_REMOVE_FROM_BAN_LIST; - uiIDA[1] = IDS_EXIT_GAME; - - // pass in the gamertag format std::string - wchar_t wchFormat[40]; - INetworkPlayer* player = - g_NetworkManager.GetLocalPlayerByUserIndex(i); - - // If not the primary player, but the primary player has - // banned this level and decided not to unban then we may - // have left the game by now - if (player) { - swprintf(wchFormat, 40, L"%ls\n\n%%ls", - player->GetOnlineName()); - - C4JStorage::EMessageResult result = - ui.RequestErrorMessage( - IDS_BANNED_LEVEL_TITLE, IDS_PLAYER_BANNED_LEVEL, - uiIDA, 2, i, - &Game::BannedLevelDialogReturned, this, - wchFormat); - if (result != C4JStorage::EMessage_Busy) - SetAction(i, eAppAction_Idle); - } else { - SetAction(i, eAppAction_Idle); - } - } break; - case eAppAction_DebugText: - // launch the xui for text entry - { - SetAction(i, eAppAction_Idle); - } - break; - - case eAppAction_ReloadTexturePack: { - SetAction(i, eAppAction_Idle); - Minecraft* pMinecraft = Minecraft::GetInstance(); - pMinecraft->textures->reloadAll(); - pMinecraft->skins->updateUI(); - - if (!pMinecraft->skins->isUsingDefaultSkin()) { - TexturePack* pTexturePack = - pMinecraft->skins->getSelected(); - - DLCPack* pDLCPack = pTexturePack->getDLCPack(); - - bool purchased = false; - // do we have a license? - if (pDLCPack && - pDLCPack->hasPurchasedFile( - DLCManager::e_DLCType_Texture, L"")) { - purchased = true; - } - } - - // 4J-PB - If the texture pack has audio, we need to switch - // to this - if (pMinecraft->skins->getSelected()->hasAudio()) { - Minecraft::GetInstance()->soundEngine->playStreaming( - L"", 0, 0, 0, 1, 1); - } - } break; - - case eAppAction_ReloadFont: { - app.DebugPrintf( - "[Consoles_App] eAppAction_ReloadFont, ingame='%s'.\n", - app.GetGameStarted() ? "Yes" : "No"); - - SetAction(i, eAppAction_Idle); - - ui.SetTooltips(i, -1); - - ui.ReloadSkin(); - ui.StartReloadSkinThread(); - - ui.setCleanupOnReload(); - } break; - - case eAppAction_TexturePackRequired: { - unsigned int uiIDA[2]; - - uiIDA[0] = IDS_TEXTUREPACK_FULLVERSION; - uiIDA[1] = IDS_TEXTURE_PACK_TRIALVERSION; - - // Give the player a warning about the texture pack missing - ui.RequestErrorMessage( - IDS_DLC_TEXTUREPACK_NOT_PRESENT_TITLE, - IDS_DLC_TEXTUREPACK_NOT_PRESENT, uiIDA, 2, - ProfileManager.GetPrimaryPad(), - &Game::TexturePackDialogReturned, this); - SetAction(i, eAppAction_Idle); - } - - break; - default: - break; - } - } - - // Any TMS actions? - - eTMS = app.GetTMSAction(i); - - if (eTMS != eTMSAction_Idle) { - switch (eTMS) { - // TMS++ actions - case eTMSAction_TMSPP_RetrieveFiles_CreateLoad_SignInReturned: - case eTMSAction_TMSPP_RetrieveFiles_RunPlayGame: - SetTMSAction(i, eTMSAction_TMSPP_UserFileList); - break; - - case eTMSAction_TMSPP_UserFileList: - // retrieve the file list first - SetTMSAction(i, eTMSAction_TMSPP_XUIDSFile); - break; - case eTMSAction_TMSPP_XUIDSFile: - SetTMSAction(i, eTMSAction_TMSPP_DLCFile); - - break; - case eTMSAction_TMSPP_DLCFile: - SetTMSAction(i, eTMSAction_TMSPP_BannedListFile); - break; - case eTMSAction_TMSPP_BannedListFile: - // If we have one in TMSPP, then we can assume we can ignore - // TMS - SetTMSAction(i, eTMSAction_TMS_RetrieveFiles_Complete); - break; - - // SPECIAL CASE - where the user goes directly in to Help & - // Options from the main menu - case eTMSAction_TMSPP_RetrieveFiles_HelpAndOptions: - case eTMSAction_TMSPP_RetrieveFiles_DLCMain: - // retrieve the file list first - SetTMSAction(i, eTMSAction_TMSPP_DLCFileOnly); - break; - case eTMSAction_TMSPP_RetrieveUserFilelist_DLCFileOnly: - SetTMSAction(i, eTMSAction_TMSPP_DLCFileOnly); - - break; - - case eTMSAction_TMSPP_DLCFileOnly: - SetTMSAction(i, eTMSAction_TMSPP_RetrieveFiles_Complete); - break; - - case eTMSAction_TMSPP_RetrieveFiles_Complete: - SetTMSAction(i, eTMSAction_Idle); - break; - - // TMS files - /* case - eTMSAction_TMS_RetrieveFiles_CreateLoad_SignInReturned: case - eTMSAction_TMS_RetrieveFiles_RunPlayGame: #ifdef 0 - SetTMSAction(i,eTMSAction_TMS_XUIDSFile_Waiting); - // pass in the next app action on the call or callback - completing - app.ReadXuidsFileFromTMS(i,eTMSAction_TMS_DLCFile,true); - #else - SetTMSAction(i,eTMSAction_TMS_DLCFile); - #endif - break; - - case eTMSAction_TMS_DLCFile: - SetTMSAction(i,eTMSAction_TMS_BannedListFile); - - break; - - case eTMSAction_TMS_RetrieveFiles_HelpAndOptions: - case eTMSAction_TMS_RetrieveFiles_DLCMain: - SetTMSAction(i,eTMSAction_Idle); - - break; - case eTMSAction_TMS_BannedListFile: - - break; - - */ - case eTMSAction_TMS_RetrieveFiles_Complete: - SetTMSAction(i, eTMSAction_Idle); - // if(StorageManager.SetSaveDevice(&CScene_Main::DeviceSelectReturned,pClass)) - // { - // // save device already - // selected - // // ensure we've applied - // this player's settings - // app.ApplyGameSettingsChanged(ProfileManager.GetPrimaryPad()); - // app.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_MultiGameJoinLoad); - // } - break; - default: - break; - } - } - } -} int Game::BannedLevelDialogReturned( void* pParam, int iPad, const C4JStorage::EMessageResult result) { - ZoneScopedN("Game::BannedLevelDialogReturned"); Game* pApp = (Game*)pParam; - // Minecraft *pMinecraft=Minecraft::GetInstance(); if (result == C4JStorage::EMessage_ResultAccept) { } else { @@ -3710,517 +260,18 @@ int Game::BannedLevelDialogReturned( return 0; } -void Game::loadMediaArchive() { - ZoneScopedN("Game::loadMediaArchive"); - std::wstring mediapath = L""; - -#if _WINDOWS64 - mediapath = L"Common\\Media\\MediaWindows64.arc"; -#elif __linux__ - mediapath = L"app/common/Media/MediaLinux.arc"; -#endif - - if (!mediapath.empty()) { - // boom headshot -#if defined(__linux__) - std::wstring exeDirW = PlatformFileIO.getBasePath().wstring(); - std::wstring candidate = exeDirW + File::pathSeparator + mediapath; - if (File(candidate).exists()) { - m_mediaArchive = new ArchiveFile(File(candidate)); - } else { - m_mediaArchive = new ArchiveFile(File(mediapath)); - } -#else - m_mediaArchive = new ArchiveFile(File(mediapath)); -#endif - } -} - -void Game::loadStringTable() { - ZoneScopedN("Game::loadStringTable"); - if (m_stringTable != nullptr) { - // we need to unload the current std::string table, this is a reload - delete m_stringTable; - } - std::wstring localisationFile = L"languages.loc"; - if (m_mediaArchive->hasFile(localisationFile)) { - std::vector locFile = - m_mediaArchive->getFile(localisationFile); - m_stringTable = new StringTable(locFile.data(), locFile.size()); - } else { - m_stringTable = nullptr; - assert(false); - // AHHHHHHHHH. - } -} - -int Game::PrimaryPlayerSignedOutReturned( - void* pParam, int iPad, const C4JStorage::EMessageResult) { - ZoneScopedN("Game::PrimaryPlayerSignedOutReturned"); - // Game* pApp = (Game*)pParam; - // Minecraft *pMinecraft=Minecraft::GetInstance(); - - // if the player is null, we're in the menus - // if(Minecraft::GetInstance()->player!=nullptr) - - // We always create a session before kicking of any of the game code, so - // even though we may still be joining/creating a game at this point we want - // to handle it differently from just being in a menu - if (g_NetworkManager.IsInSession()) { - app.SetAction(iPad, eAppAction_PrimaryPlayerSignedOutReturned); - } else { - app.SetAction(iPad, eAppAction_PrimaryPlayerSignedOutReturned_Menus); - } - return 0; -} - -int Game::EthernetDisconnectReturned( - void* pParam, int iPad, const C4JStorage::EMessageResult) { - ZoneScopedN("Game::EthernetDisconnectReturned"); - // Game* pApp = (Game*)pParam; - Minecraft* pMinecraft = Minecraft::GetInstance(); - - // if the player is null, we're in the menus - if (Minecraft::GetInstance()->player != nullptr) { - app.SetAction(pMinecraft->player->GetXboxPad(), - eAppAction_EthernetDisconnectedReturned); - } else { - // 4J-PB - turn off the PSN store icon just in case this happened when - // we were in one of the DLC menus - app.SetAction(iPad, eAppAction_EthernetDisconnectedReturned_Menus); - } - return 0; -} - -int Game::SignoutExitWorldThreadProc(void* lpParameter) { - ZoneScopedN("Game::SignoutExitWorldThreadProc"); - // Share AABB & Vec3 pools with default (main thread) - should be ok as long - // as we don't tick the main thread whilst this thread is running - Compression::UseDefaultThreadStorage(); - - // app.SetGameStarted(false); - - Minecraft* pMinecraft = Minecraft::GetInstance(); - - int exitReasonStringId = -1; - - bool saveStats = false; - if (pMinecraft->isClientSide() || g_NetworkManager.IsInSession()) { - if (lpParameter != nullptr) { - switch (app.GetDisconnectReason()) { - case DisconnectPacket::eDisconnect_Kicked: - exitReasonStringId = IDS_DISCONNECTED_KICKED; - break; - case DisconnectPacket::eDisconnect_NoUGC_AllLocal: - exitReasonStringId = - IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_ALL_LOCAL; - break; - case DisconnectPacket::eDisconnect_NoUGC_Single_Local: - exitReasonStringId = - IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_SINGLE_LOCAL; - break; - case DisconnectPacket::eDisconnect_NoFlying: - exitReasonStringId = IDS_DISCONNECTED_FLYING; - break; - case DisconnectPacket::eDisconnect_OutdatedServer: - exitReasonStringId = IDS_DISCONNECTED_SERVER_OLD; - break; - case DisconnectPacket::eDisconnect_OutdatedClient: - exitReasonStringId = IDS_DISCONNECTED_CLIENT_OLD; - break; - default: - exitReasonStringId = IDS_DISCONNECTED; - } - pMinecraft->progressRenderer->progressStartNoAbort( - exitReasonStringId); - // 4J - Force a disconnection, this handles the situation that the - // server has already disconnected - if (pMinecraft->levels[0] != nullptr) - pMinecraft->levels[0]->disconnect(false); - if (pMinecraft->levels[1] != nullptr) - pMinecraft->levels[1]->disconnect(false); - } else { - exitReasonStringId = IDS_EXITING_GAME; - pMinecraft->progressRenderer->progressStartNoAbort( - IDS_EXITING_GAME); - - if (pMinecraft->levels[0] != nullptr) - pMinecraft->levels[0]->disconnect(); - if (pMinecraft->levels[1] != nullptr) - pMinecraft->levels[1]->disconnect(); - } - - // 4J Stu - This only does something if we actually have a server, so - // don't need to do any other checks - MinecraftServer::HaltServer(true); - - // We need to call the stats & leaderboards save before we exit the - // session - // pMinecraft->forceStatsSave(); - saveStats = false; - - // 4J Stu - Leave the session once the disconnect packet has been sent - g_NetworkManager.LeaveGame(false); - } else { - if (lpParameter != nullptr) { - switch (app.GetDisconnectReason()) { - case DisconnectPacket::eDisconnect_Kicked: - exitReasonStringId = IDS_DISCONNECTED_KICKED; - break; - case DisconnectPacket::eDisconnect_NoUGC_AllLocal: - exitReasonStringId = - IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_ALL_LOCAL; - break; - case DisconnectPacket::eDisconnect_NoUGC_Single_Local: - exitReasonStringId = - IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_SINGLE_LOCAL; - break; - case DisconnectPacket::eDisconnect_OutdatedServer: - exitReasonStringId = IDS_DISCONNECTED_SERVER_OLD; - break; - case DisconnectPacket::eDisconnect_OutdatedClient: - exitReasonStringId = IDS_DISCONNECTED_CLIENT_OLD; - default: - exitReasonStringId = IDS_DISCONNECTED; - } - pMinecraft->progressRenderer->progressStartNoAbort( - exitReasonStringId); - } - } - pMinecraft->setLevel(nullptr, exitReasonStringId, nullptr, saveStats, true); - - // 4J-JEV: Fix for #106402 - TCR #014 BAS Debug Output: - // TU12: Mass Effect Mash-UP: Save file "Default_DisplayName" is created on - // all storage devices after signing out from a re-launched pre-generated - // world - app.m_gameRules.unloadCurrentGameRules(); // - - MinecraftServer::resetFlags(); - - // We can't start/join a new game until the session is destroyed, so wait - // for it to be idle again - while (g_NetworkManager.IsInSession()) { - std::this_thread::sleep_for(std::chrono::milliseconds(1)); - } - - return 0; -} - -int Game::UnlockFullInviteReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result) { - ZoneScopedN("Game::UnlockFullInviteReturned"); - // Game* pApp = (Game*)pParam; - Minecraft* pMinecraft = Minecraft::GetInstance(); - bool bNoPlayer; - - // bug 11285 - TCR 001: BAS Game Stability: CRASH - When trying to join a - // full version game with a trial version, the trial crashes 4J-PB - we may - // be in the main menus here, and we don't have a pMinecraft->player - - if (pMinecraft->player == nullptr) { - bNoPlayer = true; - } - - return 0; -} - -int Game::UnlockFullSaveReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result) { - ZoneScopedN("Game::UnlockFullSaveReturned"); - return 0; -} - -int Game::UnlockFullExitReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result) { - ZoneScopedN("Game::UnlockFullExitReturned"); - Game* pApp = (Game*)pParam; - Minecraft* pMinecraft = Minecraft::GetInstance(); - - if (result != C4JStorage::EMessage_ResultAccept) { - pApp->SetAction(pMinecraft->player->GetXboxPad(), - eAppAction_ExitWorldTrial); - } - - return 0; -} - -int Game::TrialOverReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result) { - ZoneScopedN("Game::TrialOverReturned"); - Game* pApp = (Game*)pParam; - Minecraft* pMinecraft = Minecraft::GetInstance(); - - if (result != C4JStorage::EMessage_ResultAccept) { - pApp->SetAction(pMinecraft->player->GetXboxPad(), eAppAction_ExitTrial); - } - - return 0; -} - -void Game::ProfileReadErrorCallback(void* pParam) { - ZoneScopedN("Game::ProfileReadErrorCallback"); - Game* pApp = (Game*)pParam; - int iPrimaryPlayer = ProfileManager.GetPrimaryPad(); - pApp->SetAction(iPrimaryPlayer, eAppAction_ProfileReadError); -} - -void Game::ClearSignInChangeUsersMask() { - ZoneScopedN("Game::ClearSignInChangeUsersMask"); - // 4J-PB - When in the main menu, the user is on pad 0, and any change they - // make to their profile will be to pad 0 data If they then go in as a - // secondary player to a splitscreen game, their profile will not be read - // again on pad 1 if they were previously in a splitscreen game This is - // because m_uiLastSignInData remembers they were in previously, and doesn't - // read the profile data for them again Fix this by resetting the - // m_uiLastSignInData on pressing play game for secondary users. The Primary - // user does a read profile on play game anyway - int iPrimaryPlayer = ProfileManager.GetPrimaryPad(); - - if (m_uiLastSignInData != 0) { - if (iPrimaryPlayer >= 0) { - m_uiLastSignInData = 1 << iPrimaryPlayer; - } else { - m_uiLastSignInData = 0; - } - } -} -void Game::SignInChangeCallback(void* pParam, - bool bPrimaryPlayerChanged, - unsigned int uiSignInData) { - ZoneScopedN("Game::SignInChangeCallback"); - Game* pApp = (Game*)pParam; - // check if the primary player signed out - int iPrimaryPlayer = ProfileManager.GetPrimaryPad(); - - if ((ProfileManager.GetLockedProfile() != -1) && iPrimaryPlayer != -1) { - if (((uiSignInData & (1 << iPrimaryPlayer)) == 0) || - bPrimaryPlayerChanged) { - // Primary Player gone or there's been a sign out and sign in of the - // primary player, so kick them out - pApp->SetAction(iPrimaryPlayer, eAppAction_PrimaryPlayerSignedOut); - - // 4J-PB - invalidate their banned level list - pApp->InvalidateBannedList(iPrimaryPlayer); - - // need to ditch any DLCOffers info - StorageManager.ClearDLCOffers(); - pApp->ClearAndResetDLCDownloadQueue(); - pApp->ClearDLCInstalled(); - } else { - unsigned int uiChangedPlayers = uiSignInData ^ m_uiLastSignInData; - - if (g_NetworkManager.IsInSession()) { - bool hasGuestIdChanged = false; - for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { - unsigned int guestNumber = 0; - if (ProfileManager.IsSignedIn(i)) { - XUSER_SIGNIN_INFO info; - XUserGetSigninInfo( - i, XUSER_GET_SIGNIN_INFO_OFFLINE_XUID_ONLY, &info); - pApp->DebugPrintf( - "Player at index %d has guest number %d\n", i, - info.dwGuestNumber); - guestNumber = info.dwGuestNumber; - } - if (pApp->m_currentSigninInfo[i].dwGuestNumber != 0 && - guestNumber != 0 && - pApp->m_currentSigninInfo[i].dwGuestNumber != - guestNumber) { - hasGuestIdChanged = true; - } - } - - if (hasGuestIdChanged) { - unsigned int uiIDA[1]; - uiIDA[0] = IDS_CONFIRM_OK; - ui.RequestErrorMessage(IDS_GUEST_ORDER_CHANGED_TITLE, - IDS_GUEST_ORDER_CHANGED_TEXT, uiIDA, - 1, ProfileManager.GetPrimaryPad()); - } - - // 4J Stu - On PS4 we can also cause to exit players if they are - // signed out here, but we shouldn't do that if we are going to - // switch to an offline game as it will likely crash due to - // incompatible parallel processes - bool switchToOffline = false; - // If it's an online game, and the primary profile is no longer - // signed into LIVE then we act as if disconnected - if (!ProfileManager.IsSignedInLive( - ProfileManager.GetLockedProfile()) && - !g_NetworkManager.IsLocalGame()) { - switchToOffline = true; - } - - // printf("Old: %x, New: %x, Changed: %x\n", m_ulLastSignInData, - // ulSignInData, changedPlayers); - for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { - // Primary player shouldn't be subjected to these checks, - // and shouldn't call ExitPlayer - if (i == iPrimaryPlayer) continue; - - // A guest a signed in or out, out of order which - // invalidates all the guest players we have in the game - if (hasGuestIdChanged && - pApp->m_currentSigninInfo[i].dwGuestNumber != 0 && - g_NetworkManager.GetLocalPlayerByUserIndex(i) != - nullptr) { - pApp->DebugPrintf( - "Recommending removal of player at index %d " - "because their guest id changed\n", - i); - pApp->SetAction(i, eAppAction_ExitPlayer); - } else { - XUSER_SIGNIN_INFO info; - XUserGetSigninInfo( - i, XUSER_GET_SIGNIN_INFO_OFFLINE_XUID_ONLY, &info); - // 4J Stu - Also need to detect the case where the sign - // in mask is the same, but the player has swapped users - // (eg still signed in but xuid different) Fix for - // #48451 - TU5: Code: UI: Splitscreen: Title crashes - // when switching to a profile previously signed out via - // splitscreen profile selection - - // 4J-PB - compiler complained about if below ('&&' - // within '||') - making it easier to read - bool bPlayerChanged = - (uiChangedPlayers & (1 << i)) == (1 << i); - bool bPlayerSignedIn = ((uiSignInData & (1 << i)) != 0); - - if (bPlayerChanged && - (!bPlayerSignedIn || - (bPlayerSignedIn && - !ProfileManager.AreXUIDSEqual( - pApp->m_currentSigninInfo[i].xuid, - info.xuid)))) { - // 4J-PB - invalidate their banned level list - pApp->DebugPrintf( - "Player at index %d Left - invalidating their " - "banned list\n", - i); - pApp->InvalidateBannedList(i); - - // 4J-HG: If either the player is in the network - // manager or in the game, need to exit player - // TODO: Do we need to check the network manager? - if (g_NetworkManager.GetLocalPlayerByUserIndex(i) != - nullptr || - Minecraft::GetInstance()->localplayers[i] != - nullptr) { - pApp->DebugPrintf("Player %d signed out\n", i); - pApp->SetAction(i, eAppAction_ExitPlayer); - } - } - } - } - - // If it's an online game, and the primary profile is no longer - // signed into LIVE then we act as if disconnected - if (switchToOffline) { - pApp->SetAction(iPrimaryPlayer, - eAppAction_EthernetDisconnected); - } - - g_NetworkManager.HandleSignInChange(); - } - // Some menus require the player to be signed in to live, so if this - // callback happens and the primary player is no longer signed in - // then nav back - else if (pApp->GetLiveLinkRequired() && - !ProfileManager.IsSignedInLive( - ProfileManager.GetLockedProfile())) { - { - pApp->SetAction(iPrimaryPlayer, - eAppAction_EthernetDisconnected); - } - } - } - m_uiLastSignInData = uiSignInData; - } else if (iPrimaryPlayer != -1) { - // make sure the TMS banned list data is ditched - the player may have - // gone in to help & options, backed out, and signed out - pApp->InvalidateBannedList(iPrimaryPlayer); - - // need to ditch any DLCOffers info - StorageManager.ClearDLCOffers(); - pApp->ClearAndResetDLCDownloadQueue(); - pApp->ClearDLCInstalled(); - } - - // Update the guest numbers to the current state - for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { - if (FAILED(XUserGetSigninInfo(i, - XUSER_GET_SIGNIN_INFO_OFFLINE_XUID_ONLY, - &pApp->m_currentSigninInfo[i]))) { - pApp->m_currentSigninInfo[i].xuid = INVALID_XUID; - pApp->m_currentSigninInfo[i].dwGuestNumber = 0; - } - app.DebugPrintf("Player at index %d has guest number %d\n", i, - pApp->m_currentSigninInfo[i].dwGuestNumber); - } -} - -void Game::NotificationsCallback(void* pParam, - std::uint32_t dwNotification, - unsigned int uiParam) { - ZoneScopedN("Game::NotificationsCallback"); - Game* pClass = (Game*)pParam; - - // push these on to the notifications to be handled in qnet's dowork - - PNOTIFICATION pNotification = new NOTIFICATION; - - pNotification->dwNotification = dwNotification; - pNotification->uiParam = uiParam; - - switch (dwNotification) { - case XN_SYS_SIGNINCHANGED: { - pClass->DebugPrintf("Signing changed - %d\n", uiParam); - } break; - case XN_SYS_INPUTDEVICESCHANGED: - if (app.GetGameStarted() && g_NetworkManager.IsInSession()) { - for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { - if (!InputManager.IsPadConnected(i) && - Minecraft::GetInstance()->localplayers[i] != nullptr && - !ui.IsPauseMenuDisplayed(i) && - !ui.IsSceneInStack(i, eUIScene_EndPoem)) { - ui.CloseUIScenes(i); - ui.NavigateToScene(i, eUIScene_PauseMenu); - } - } - } - break; - case XN_LIVE_CONTENT_INSTALLED: - // Need to inform xuis that we've possibly had DLC installed - { - // app.m_dlcManager.SetNeedsUpdated(true); - // Clear the DLC installed flag to cause a GetDLC to run if - // it's called - app.ClearDLCInstalled(); - - ui.HandleDLCInstalled(ProfileManager.GetPrimaryPad()); - } - break; - case XN_SYS_STORAGEDEVICESCHANGED: { - } break; - } - - pClass->m_vNotifications.push_back(pNotification); -} #if defined(_DEBUG_MENUS_ENABLED) bool Game::DebugArtToolsOn() { - ZoneScopedN("Game::DebugArtToolsOn"); - return DebugSettingsOn() && - (GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad()) & - (1L << eDebugSetting_ArtTools)) != 0; + return m_debugOptions.debugArtToolsOn( + GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad())); } #endif void Game::SetDebugSequence(const char* pchSeq) { - ZoneScopedN("Game::SetDebugSequence"); InputManager.SetDebugSequence(pchSeq, [this]() -> int { // printf("sequence matched\n"); - m_bDebugOptions = !m_bDebugOptions; + m_debugOptions.setDebugOptions(!m_debugOptions.settingsOn()); for (int i = 0; i < XUSER_MAX_COUNT; i++) { if (app.DebugSettingsOn()) { @@ -4236,7 +287,6 @@ void Game::SetDebugSequence(const char* pchSeq) { } int Game::GetLocalPlayerCount(void) { - ZoneScopedN("Game::GetLocalPlayerCount"); int iPlayerC = 0; Minecraft* pMinecraft = Minecraft::GetInstance(); for (int i = 0; i < XUSER_MAX_COUNT; i++) { @@ -4248,104 +298,10 @@ int Game::GetLocalPlayerCount(void) { return iPlayerC; } -int Game::MarketplaceCountsCallback( - void* pParam, C4JStorage::DLC_TMS_DETAILS* pTMSDetails, int iPad) { - ZoneScopedN("Game::MarketplaceCountsCallback"); - app.DebugPrintf("Marketplace Counts= New - %d Total - %d\n", - pTMSDetails->dwNewOffers, pTMSDetails->dwTotalOffers); - if (pTMSDetails->dwNewOffers > 0) { - app.m_bNewDLCAvailable = true; - app.m_bSeenNewDLCTip = false; - } else { - app.m_bNewDLCAvailable = false; - app.m_bSeenNewDLCTip = true; - } - - return 0; -} - -bool Game::StartInstallDLCProcess(int iPad) { - ZoneScopedN("Game::StartInstallDLCProcess"); - app.DebugPrintf("--- Game::StartInstallDLCProcess: pad=%i.\n", - iPad); - - // If there is already a call to this in progress, then do nothing - // If the app says dlc is installed, then there has been no new system - // message to tell us there's new DLC since the last call to - // StartInstallDLCProcess - if ((app.DLCInstallProcessCompleted() == false) && - (m_bDLCInstallPending == false)) { - app.m_dlcManager.resetUnnamedCorruptCount(); - m_bDLCInstallPending = true; - m_iTotalDLC = 0; - m_iTotalDLCInstalled = 0; - app.DebugPrintf( - "--- Game::StartInstallDLCProcess - " - "StorageManager.GetInstalledDLC\n"); - - StorageManager.GetInstalledDLC( - iPad, [this](int iInstalledC, int pad) { - return dlcInstalledCallback(iInstalledC, pad); - }); - return true; - } else { - app.DebugPrintf( - "--- Game::StartInstallDLCProcess - nothing to do\n"); - - return false; - } -} // Installed DLC callback -int Game::dlcInstalledCallback(int iInstalledC, int iPad) { - ZoneScopedN("Game::dlcInstalledCallback"); - DebugPrintf( - "--- Game::dlcInstalledCallback: totalDLC=%i, pad=%i.\n", - iInstalledC, iPad); - m_iTotalDLC = iInstalledC; - MountNextDLC(iPad); - return 0; -} -void Game::MountNextDLC(int iPad) { - ZoneScopedN("Game::MountNextDLC"); - app.DebugPrintf("--- Game::MountNextDLC: pad=%i.\n", iPad); - if (m_iTotalDLCInstalled < m_iTotalDLC) { - // Mount it - // We also need to match the ones the user wants to mount with the - // installed DLC We're supposed to use a generic save game as a cache of - // these to do this, with XUSER_ANY - - if (StorageManager.MountInstalledDLC( - iPad, m_iTotalDLCInstalled, - [this](int pad, std::uint32_t dwErr, - std::uint32_t dwLicenceMask) { - return dlcMountedCallback(pad, dwErr, dwLicenceMask); - }) != ERROR_IO_PENDING) { - // corrupt DLC - app.DebugPrintf("Failed to mount DLC %d for pad %d\n", - m_iTotalDLCInstalled, iPad); - ++m_iTotalDLCInstalled; - app.MountNextDLC(iPad); - } else { - app.DebugPrintf("StorageManager.MountInstalledDLC ok\n"); - } - } else { - /* Removed - now loading these on demand instead of as each pack is - mounted if(m_iTotalDLCInstalled > 0) - { - Minecraft *pMinecraft=Minecraft::GetInstance(); - pMinecraft->levelRenderer->AddDLCSkinsToMemTextures(); - } - */ - - m_bDLCInstallPending = false; - m_bDLCInstallProcessCompleted = true; - - ui.HandleDLCMountingComplete(); - } -} // 4J-JEV: For the sake of clarity in DLCMountedCallback. #if defined(_WINDOWS64) @@ -4354,69 +310,6 @@ void Game::MountNextDLC(int iPad) { #define CONTENT_DATA_DISPLAY_NAME(a) (a.wszDisplayName) #endif -int Game::dlcMountedCallback(int iPad, std::uint32_t dwErr, - std::uint32_t dwLicenceMask) { - ZoneScopedN("Game::dlcMountedCallback"); -#if defined(_WINDOWS64) - DebugPrintf("--- Game::dlcMountedCallback\n"); - - if (dwErr != ERROR_SUCCESS) { - // corrupt DLC - app.DebugPrintf("Failed to mount DLC for pad %d: %u\n", iPad, dwErr); - app.m_dlcManager.incrementUnnamedCorruptCount(); - } else { - XCONTENT_DATA ContentData = - StorageManager.GetDLC(app.m_iTotalDLCInstalled); - - DLCPack* pack = - app.m_dlcManager.getPack(CONTENT_DATA_DISPLAY_NAME(ContentData)); - - if (pack != nullptr && pack->IsCorrupt()) { - app.DebugPrintf( - "Pack '%ls' is corrupt, removing it from the DLC Manager.\n", - CONTENT_DATA_DISPLAY_NAME(ContentData)); - - app.m_dlcManager.removePack(pack); - pack = nullptr; - } - - if (pack == nullptr) { - app.DebugPrintf("Pack \"%ls\" is not installed, so adding it\n", - CONTENT_DATA_DISPLAY_NAME(ContentData)); - -#if defined(_WINDOWS64) - pack = new DLCPack(ContentData.szDisplayName, dwLicenceMask); -#else - pack = new DLCPack(ContentData.wszDisplayName, dwLicenceMask); -#endif - pack->SetDLCMountIndex(app.m_iTotalDLCInstalled); - pack->SetDLCDeviceID(ContentData.DeviceID); - app.m_dlcManager.addPack(pack); - - app.HandleDLC(pack); - - if (pack->getDLCItemsCount(DLCManager::e_DLCType_Texture) > 0) { - Minecraft::GetInstance()->skins->addTexturePackFromDLC( - pack, pack->GetPackId()); - } - } else { - app.DebugPrintf( - "Pack \"%ls\" is already installed. Updating license to %u\n", - CONTENT_DATA_DISPLAY_NAME(ContentData), dwLicenceMask); - - pack->SetDLCMountIndex(app.m_iTotalDLCInstalled); - pack->SetDLCDeviceID(ContentData.DeviceID); - pack->updateLicenseMask(dwLicenceMask); - } - - StorageManager.UnmountInstalledDLC(); - } - ++app.m_iTotalDLCInstalled; - app.MountNextDLC(iPad); - -#endif - return 0; -} #undef CONTENT_DATA_DISPLAY_NAME // void Game::InstallDefaultCape() @@ -4447,19 +340,6 @@ int Game::dlcMountedCallback(int iPad, std::uint32_t dwErr, // } // } -void Game::HandleDLC(DLCPack* pack) { - ZoneScopedN("Game::HandleDLC"); - unsigned int dwFilesProcessed = 0; -#if defined(_WINDOWS64) || defined(__linux__) - std::vector dlcFilenames; -#endif - StorageManager.GetMountedDLCFileList("DLCDrive", dlcFilenames); - for (int i = 0; i < dlcFilenames.size(); i++) { - m_dlcManager.readDLCDataFile(dwFilesProcessed, dlcFilenames[i], pack); - } - - if (dwFilesProcessed == 0) m_dlcManager.removePack(pack); -} // int Game::DLCReadCallback(void* // pParam,C4JStorage::DLC_FILE_DETAILS *pDLCData) @@ -4474,7 +354,6 @@ void Game::HandleDLC(DLCPack* pack) { // Desc: Initializes the timer variables //------------------------------------------------------------------------------------- void Game::InitTime() { - ZoneScopedN("Game::InitTime"); // Save the start time m_Time.qwTime = time_util::clock::now(); @@ -4489,7 +368,6 @@ void Game::InitTime() { // Desc: Updates the elapsed time since our last frame. //------------------------------------------------------------------------------------- void Game::UpdateTime() { - ZoneScopedN("Game::UpdateTime"); auto qwNewTime = time_util::clock::now(); auto qwDeltaTime = qwNewTime - m_Time.qwTime; @@ -4500,20 +378,11 @@ void Game::UpdateTime() { m_Time.fAppTime = std::chrono::duration(m_Time.qwAppTime).count(); } -bool Game::isXuidNotch(PlayerUID xuid) { - ZoneScopedN("Game::isXuidNotch"); - if (m_xuidNotch != INVALID_XUID && xuid != INVALID_XUID) { - return ProfileManager.AreXUIDSEqual(xuid, m_xuidNotch); - } - return false; -} - bool Game::isXuidDeadmau5(PlayerUID xuid) { - ZoneScopedN("Game::isXuidDeadmau5"); - auto it = MojangData.find(xuid); // 4J Stu - The .at and [] accessors + auto it = DLCController::MojangData.find(xuid); // 4J Stu - The .at and [] accessors // insert elements if they don't exist - if (it != MojangData.end()) { - MOJANG_DATA* pMojangData = MojangData[xuid]; + if (it != DLCController::MojangData.end()) { + MOJANG_DATA* pMojangData = DLCController::MojangData[xuid]; if (pMojangData && pMojangData->eXuid == eXUID_Deadmau5) { return true; } @@ -4522,365 +391,17 @@ bool Game::isXuidDeadmau5(PlayerUID xuid) { return false; } -void Game::AddMemoryTextureFile(const std::wstring& wName, - std::uint8_t* pbData, - unsigned int byteCount) { - ZoneScopedN("Game::AddMemoryTextureFile"); - std::lock_guard lock(csMemFilesLock); - // check it's not already in - PMEMDATA pData = nullptr; - auto it = m_MEM_Files.find(wName); - if (it != m_MEM_Files.end()) { -#if !defined(_CONTENT_PACKAGE) - wprintf(L"Incrementing the memory texture file count for %ls\n", - wName.c_str()); -#endif - pData = (*it).second; - - if (pData->byteCount == 0 && byteCount != 0) { - // This should never be nullptr if dwBytes is 0 - if (pData->pbData != nullptr) delete[] pData->pbData; - - pData->pbData = pbData; - pData->byteCount = byteCount; - } - - ++pData->ucRefCount; - return; - } - // this is a texture (png) file - - // add this texture to the list of memory texture files - it will then be - // picked up by the level renderer's AddEntity - - pData = new MEMDATA(); - pData->pbData = pbData; - pData->byteCount = byteCount; - pData->ucRefCount = 1; - - // use the xuid to access the skin data - m_MEM_Files[wName] = pData; -} - -void Game::RemoveMemoryTextureFile(const std::wstring& wName) { - ZoneScopedN("Game::RemoveMemoryTextureFile"); - std::lock_guard lock(csMemFilesLock); - - auto it = m_MEM_Files.find(wName); - if (it != m_MEM_Files.end()) { -#if !defined(_CONTENT_PACKAGE) - wprintf(L"Decrementing the memory texture file count for %ls\n", - wName.c_str()); -#endif - PMEMDATA pData = (*it).second; - --pData->ucRefCount; - if (pData->ucRefCount <= 0) { -#if !defined(_CONTENT_PACKAGE) - wprintf(L"Erasing the memory texture file data for %ls\n", - wName.c_str()); -#endif - delete pData; - m_MEM_Files.erase(wName); - } - } -} - -bool Game::DefaultCapeExists() { - ZoneScopedN("Game::DefaultCapeExists"); - std::wstring wTex = L"Special_Cape.png"; - bool val = false; - - { - std::lock_guard lock(csMemFilesLock); - auto it = m_MEM_Files.find(wTex); - if (it != m_MEM_Files.end()) val = true; - } - - return val; -} - -bool Game::IsFileInMemoryTextures(const std::wstring& wName) { - ZoneScopedN("Game::IsFileInMemoryTextures"); - bool val = false; - - { - std::lock_guard lock(csMemFilesLock); - auto it = m_MEM_Files.find(wName); - if (it != m_MEM_Files.end()) val = true; - } - - return val; -} - -void Game::GetMemFileDetails(const std::wstring& wName, - std::uint8_t** ppbData, - unsigned int* pByteCount) { - ZoneScopedN("Game::GetMemFileDetails"); - std::lock_guard lock(csMemFilesLock); - auto it = m_MEM_Files.find(wName); - if (it != m_MEM_Files.end()) { - PMEMDATA pData = (*it).second; - *ppbData = pData->pbData; - *pByteCount = pData->byteCount; - } -} - -void Game::AddMemoryTPDFile(int iConfig, std::uint8_t* pbData, - unsigned int byteCount) { - ZoneScopedN("Game::AddMemoryTPDFile"); - std::lock_guard lock(csMemTPDLock); - // check it's not already in - PMEMDATA pData = nullptr; - auto it = m_MEM_TPD.find(iConfig); - if (it == m_MEM_TPD.end()) { - pData = new MEMDATA(); - pData->pbData = pbData; - pData->byteCount = byteCount; - pData->ucRefCount = 1; - - m_MEM_TPD[iConfig] = pData; - } -} - -void Game::RemoveMemoryTPDFile(int iConfig) { - ZoneScopedN("Game::RemoveMemoryTPDFile"); - std::lock_guard lock(csMemTPDLock); - // check it's not already in - PMEMDATA pData = nullptr; - auto it = m_MEM_TPD.find(iConfig); - if (it != m_MEM_TPD.end()) { - pData = m_MEM_TPD[iConfig]; - delete pData; - m_MEM_TPD.erase(iConfig); - } -} - -#if defined(_WINDOWS64) -int Game::GetTPConfigVal(wchar_t* pwchDataFile) { return -1; } -#endif -bool Game::IsFileInTPD(int iConfig) { - ZoneScopedN("Game::IsFileInTPD"); - bool val = false; - - { - std::lock_guard lock(csMemTPDLock); - auto it = m_MEM_TPD.find(iConfig); - if (it != m_MEM_TPD.end()) val = true; - } - - return val; -} - -void Game::GetTPD(int iConfig, std::uint8_t** ppbData, - unsigned int* pByteCount) { - ZoneScopedN("Game::GetTPD"); - std::lock_guard lock(csMemTPDLock); - auto it = m_MEM_TPD.find(iConfig); - if (it != m_MEM_TPD.end()) { - PMEMDATA pData = (*it).second; - *ppbData = pData->pbData; - *pByteCount = pData->byteCount; - } -} - -// bool Game::UploadFileToGlobalStorage(int iQuadrant, -// C4JStorage::eGlobalStorage eStorageFacility, std::wstring *wsFile ) -// { -// bool bRes=false; -// #ifndef _CONTENT_PACKAGE -// // read the local file -// File gtsFile( wsFile->c_str() ); -// -// int64_t fileSize = gtsFile.length(); -// -// if(fileSize!=0) -// { -// FileInputStream fis(gtsFile); -// std::vector ba((int)fileSize); -// fis.read(ba); -// fis.close(); -// -// bRes=StorageManager.WriteTMSFile(iQuadrant,eStorageFacility,(wchar_t -// *)wsFile->c_str(),ba.data(), ba.size()); -// -// } -// #endif -// return bRes; -// } - void Game::StoreLaunchData() {} void Game::ExitGame() {} // Invites -void Game::ProcessInvite(std::uint32_t dwUserIndex, - std::uint32_t dwLocalUsersMask, - const INVITE_INFO* pInviteInfo) { - ZoneScopedN("Game::ProcessInvite"); - m_InviteData.dwUserIndex = dwUserIndex; - m_InviteData.dwLocalUsersMask = dwLocalUsersMask; - m_InviteData.pInviteInfo = pInviteInfo; - // memcpy(&m_InviteData,pJoinData,sizeof(JoinFromInviteData)); - SetAction(dwUserIndex, eAppAction_ExitAndJoinFromInvite); -} -int Game::ExitAndJoinFromInvite(void* pParam, int iPad, - C4JStorage::EMessageResult result) { - ZoneScopedN("Game::ExitAndJoinFromInvite"); - Game* pApp = (Game*)pParam; - // Minecraft *pMinecraft=Minecraft::GetInstance(); - // buttons are swapped on this menu - if (result == C4JStorage::EMessage_ResultDecline) { - pApp->SetAction(iPad, eAppAction_ExitAndJoinFromInviteConfirmed); - } - return 0; -} -int Game::ExitAndJoinFromInviteSaveDialogReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { - ZoneScopedN("Game::ExitAndJoinFromInviteSaveDialogReturned"); - Game* pClass = (Game*)pParam; - // Exit with or without saving - // Decline means save in this dialog - if (result == C4JStorage::EMessage_ResultDecline || - result == C4JStorage::EMessage_ResultThirdOption) { - if (result == C4JStorage::EMessage_ResultDecline) // Save - { - // Check they have the full texture pack if they are using one - // 4J-PB - Is the player trying to save but they are using a trial - // texturepack ? - if (!Minecraft::GetInstance()->skins->isUsingDefaultSkin()) { - TexturePack* tPack = - Minecraft::GetInstance()->skins->getSelected(); - DLCPack* pDLCPack = tPack->getDLCPack(); - if (!pDLCPack->hasPurchasedFile(DLCManager::e_DLCType_Texture, - L"")) { - // upsell - // get the dlc texture pack - - unsigned int uiIDA[2]; - uiIDA[0] = IDS_CONFIRM_OK; - uiIDA[1] = IDS_CONFIRM_CANCEL; - - // Give the player a warning about the trial version of the - // texture pack - ui.RequestErrorMessage( - IDS_WARNING_DLC_TRIALTEXTUREPACK_TITLE, - IDS_WARNING_DLC_TRIALTEXTUREPACK_TEXT, uiIDA, 2, iPad, - &Game::WarningTrialTexturePackReturned, - pClass); - - return 0; - } - } - // does the save exist? - bool bSaveExists; - StorageManager.DoesSaveExist(&bSaveExists); - // 4J-PB - we check if the save exists inside the libs - // we need to ask if they are sure they want to overwrite the - // existing game - if (bSaveExists) { - unsigned int uiIDA[2]; - uiIDA[0] = IDS_CONFIRM_CANCEL; - uiIDA[1] = IDS_CONFIRM_OK; - ui.RequestErrorMessage( - IDS_TITLE_SAVE_GAME, IDS_CONFIRM_SAVE_GAME, uiIDA, 2, - ProfileManager.GetPrimaryPad(), - &Game::ExitAndJoinFromInviteAndSaveReturned, - pClass); - return 0; - } else { - MinecraftServer::getInstance()->setSaveOnExit(true); - } - } else { - // been a few requests for a confirm on exit without saving - unsigned int uiIDA[2]; - uiIDA[0] = IDS_CONFIRM_CANCEL; - uiIDA[1] = IDS_CONFIRM_OK; - ui.RequestErrorMessage( - IDS_TITLE_DECLINE_SAVE_GAME, IDS_CONFIRM_DECLINE_SAVE_GAME, - uiIDA, 2, ProfileManager.GetPrimaryPad(), - &Game::ExitAndJoinFromInviteDeclineSaveReturned, - pClass); - return 0; - } - - app.SetAction(ProfileManager.GetPrimaryPad(), - eAppAction_ExitAndJoinFromInviteConfirmed); - } - return 0; -} - -int Game::WarningTrialTexturePackReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { - ZoneScopedN("Game::WarningTrialTexturePackReturned"); - // 4J Stu - I added this in when fixing an X1 bug. We should probably add - // this as well but I don't have time to test all platforms atm - - return 0; -} - -int Game::ExitAndJoinFromInviteAndSaveReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { - ZoneScopedN("Game::ExitAndJoinFromInviteAndSaveReturned"); - // Game* pClass = (Game*)pParam; - - // results switched for this dialog - if (result == C4JStorage::EMessage_ResultDecline) { - int saveOrCheckpointId = 0; - - // Check they have the full texture pack if they are using one - // 4J-PB - Is the player trying to save but they are using a trial - // texturepack ? - if (!Minecraft::GetInstance()->skins->isUsingDefaultSkin()) { - TexturePack* tPack = Minecraft::GetInstance()->skins->getSelected(); - - DLCPack* pDLCPack = tPack->getDLCPack(); - if (!pDLCPack->hasPurchasedFile(DLCManager::e_DLCType_Texture, - L"")) { - // upsell - // get the dlc texture pack - - unsigned int uiIDA[2]; - uiIDA[0] = IDS_CONFIRM_OK; - uiIDA[1] = IDS_CONFIRM_CANCEL; - - // Give the player a warning about the trial version of the - // texture pack - ui.RequestErrorMessage( - IDS_WARNING_DLC_TRIALTEXTUREPACK_TITLE, - IDS_WARNING_DLC_TRIALTEXTUREPACK_TEXT, uiIDA, 2, iPad, - &Game::WarningTrialTexturePackReturned, nullptr); - - return 0; - } - } - // bool validSave = - // StorageManager.GetSaveUniqueNumber(&saveOrCheckpointId); - // SentientManager.RecordLevelSaveOrCheckpoint(ProfileManager.GetPrimaryPad(), - // saveOrCheckpointId); - MinecraftServer::getInstance()->setSaveOnExit(true); - // flag a app action of exit and join game from invite - app.SetAction(iPad, eAppAction_ExitAndJoinFromInviteConfirmed); - } - return 0; -} - -int Game::ExitAndJoinFromInviteDeclineSaveReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { - ZoneScopedN("Game::ExitAndJoinFromInviteDeclineSaveReturned"); - // results switched for this dialog - if (result == C4JStorage::EMessage_ResultDecline) { - MinecraftServer::getInstance()->setSaveOnExit(false); - // flag a app action of exit and join game from invite - app.SetAction(iPad, eAppAction_ExitAndJoinFromInviteConfirmed); - } - return 0; -} ////////////////////////////////////////////////////////////////////////// // @@ -4893,1424 +414,25 @@ int Game::ExitAndJoinFromInviteDeclineSaveReturned( ////////////////////////////////////////////////////////////////////////// void Game::FatalLoadError() {} -TIPSTRUCT Game::m_GameTipA[MAX_TIPS_GAMETIP] = { - {0, IDS_TIPS_GAMETIP_1}, {0, IDS_TIPS_GAMETIP_2}, - {0, IDS_TIPS_GAMETIP_3}, {0, IDS_TIPS_GAMETIP_4}, - {0, IDS_TIPS_GAMETIP_5}, {0, IDS_TIPS_GAMETIP_6}, - {0, IDS_TIPS_GAMETIP_7}, {0, IDS_TIPS_GAMETIP_8}, - {0, IDS_TIPS_GAMETIP_9}, {0, IDS_TIPS_GAMETIP_10}, - {0, IDS_TIPS_GAMETIP_11}, {0, IDS_TIPS_GAMETIP_12}, - {0, IDS_TIPS_GAMETIP_13}, {0, IDS_TIPS_GAMETIP_14}, - {0, IDS_TIPS_GAMETIP_15}, {0, IDS_TIPS_GAMETIP_16}, - {0, IDS_TIPS_GAMETIP_17}, {0, IDS_TIPS_GAMETIP_18}, - {0, IDS_TIPS_GAMETIP_19}, {0, IDS_TIPS_GAMETIP_20}, - {0, IDS_TIPS_GAMETIP_21}, {0, IDS_TIPS_GAMETIP_22}, - {0, IDS_TIPS_GAMETIP_23}, {0, IDS_TIPS_GAMETIP_24}, - {0, IDS_TIPS_GAMETIP_25}, {0, IDS_TIPS_GAMETIP_26}, - {0, IDS_TIPS_GAMETIP_27}, {0, IDS_TIPS_GAMETIP_28}, - {0, IDS_TIPS_GAMETIP_29}, {0, IDS_TIPS_GAMETIP_30}, - {0, IDS_TIPS_GAMETIP_31}, {0, IDS_TIPS_GAMETIP_32}, - {0, IDS_TIPS_GAMETIP_33}, {0, IDS_TIPS_GAMETIP_34}, - {0, IDS_TIPS_GAMETIP_35}, {0, IDS_TIPS_GAMETIP_36}, - {0, IDS_TIPS_GAMETIP_37}, {0, IDS_TIPS_GAMETIP_38}, - {0, IDS_TIPS_GAMETIP_39}, {0, IDS_TIPS_GAMETIP_40}, - {0, IDS_TIPS_GAMETIP_41}, {0, IDS_TIPS_GAMETIP_42}, - {0, IDS_TIPS_GAMETIP_43}, {0, IDS_TIPS_GAMETIP_44}, - {0, IDS_TIPS_GAMETIP_45}, {0, IDS_TIPS_GAMETIP_46}, - {0, IDS_TIPS_GAMETIP_47}, {0, IDS_TIPS_GAMETIP_48}, - {0, IDS_TIPS_GAMETIP_49}, {0, IDS_TIPS_GAMETIP_50}, -}; -TIPSTRUCT Game::m_TriviaTipA[MAX_TIPS_TRIVIATIP] = { - {0, IDS_TIPS_TRIVIA_1}, {0, IDS_TIPS_TRIVIA_2}, {0, IDS_TIPS_TRIVIA_3}, - {0, IDS_TIPS_TRIVIA_4}, {0, IDS_TIPS_TRIVIA_5}, {0, IDS_TIPS_TRIVIA_6}, - {0, IDS_TIPS_TRIVIA_7}, {0, IDS_TIPS_TRIVIA_8}, {0, IDS_TIPS_TRIVIA_9}, - {0, IDS_TIPS_TRIVIA_10}, {0, IDS_TIPS_TRIVIA_11}, {0, IDS_TIPS_TRIVIA_12}, - {0, IDS_TIPS_TRIVIA_13}, {0, IDS_TIPS_TRIVIA_14}, {0, IDS_TIPS_TRIVIA_15}, - {0, IDS_TIPS_TRIVIA_16}, {0, IDS_TIPS_TRIVIA_17}, {0, IDS_TIPS_TRIVIA_18}, - {0, IDS_TIPS_TRIVIA_19}, {0, IDS_TIPS_TRIVIA_20}, -}; -Random* Game::TipRandom = new Random(); -int Game::TipsSortFunction(const void* a, const void* b) { - ZoneScopedN("Game::TipsSortFunction"); - // 4jcraft, scince the sortvalues can be negative, i changed it - // to a three way comparison, - // scince subtracting of signed integers can cause overflow. - int s1 = ((TIPSTRUCT*)a)->iSortValue; - int s2 = ((TIPSTRUCT*)b)->iSortValue; - - if (s1 > s2) { - return 1; - - } else if (s1 == s2) { - return 0; - } - - return -1; -} - -void Game::InitialiseTips() { - ZoneScopedN("Game::InitialiseTips"); - // We'll randomise the tips at start up based on their priority - - memset(m_TipIDA, 0, sizeof(m_TipIDA)); - - // Make the first tip tell you that you can play splitscreen in HD modes if - // you are in SD - if (!RenderManager.IsHiDef()) { - m_GameTipA[0].uiStringID = IDS_TIPS_GAMETIP_0; - } - // randomise then quicksort - // going to leave the multiplayer tip so it is always first - - // Only randomise the content package build -#if defined(_CONTENT_PACKAGE) - - for (int i = 1; i < MAX_TIPS_GAMETIP; i++) { - m_GameTipA[i].iSortValue = TipRandom->nextInt(); - } - qsort(&m_GameTipA[1], MAX_TIPS_GAMETIP - 1, sizeof(TIPSTRUCT), - TipsSortFunction); -#endif - - for (int i = 0; i < MAX_TIPS_TRIVIATIP; i++) { - m_TriviaTipA[i].iSortValue = TipRandom->nextInt(); - } - qsort(m_TriviaTipA, MAX_TIPS_TRIVIATIP, sizeof(TIPSTRUCT), - TipsSortFunction); - - int iCurrentGameTip = 0; - int iCurrentTriviaTip = 0; - - for (int i = 0; i < MAX_TIPS_GAMETIP + MAX_TIPS_TRIVIATIP; i++) { - // Add a trivia one every third tip (if there are any left) - if ((i % 3 == 2) && (iCurrentTriviaTip < MAX_TIPS_TRIVIATIP)) { - // Add a trivia one - m_TipIDA[i] = m_TriviaTipA[iCurrentTriviaTip++].uiStringID; - } else { - if (iCurrentGameTip < MAX_TIPS_GAMETIP) { - // Add a gametip - m_TipIDA[i] = m_GameTipA[iCurrentGameTip++].uiStringID; - } else { - // Add a trivia one - m_TipIDA[i] = m_TriviaTipA[iCurrentTriviaTip++].uiStringID; - } - } - - if (m_TipIDA[i] == 0) { - // the m_TriviaTipA or the m_GameTipA are out of sync -#if !defined(_CONTENT_PACKAGE) - __debugbreak(); -#endif - } - } - - m_uiCurrentTip = 0; -} - -int Game::GetNextTip() { - ZoneScopedN("Game::GetNextTip"); - static bool bShowSkinDLCTip = true; - if (app.GetNewDLCAvailable() && app.DisplayNewDLCTip()) { - return IDS_TIPS_GAMETIP_NEWDLC; - } else { - if (bShowSkinDLCTip) { - bShowSkinDLCTip = false; - if (app.DLCInstallProcessCompleted()) { - if (app.m_dlcManager.getPackCount(DLCManager::e_DLCType_Skin) == - 0) { - return IDS_TIPS_GAMETIP_SKINPACKS; - } - } else { - return IDS_TIPS_GAMETIP_SKINPACKS; - } - } - } - - if (m_uiCurrentTip == MAX_TIPS_GAMETIP + MAX_TIPS_TRIVIATIP) - m_uiCurrentTip = 0; - - return m_TipIDA[m_uiCurrentTip++]; -} - -int Game::GetHTMLColour(eMinecraftColour colour) { - ZoneScopedN("Game::GetHTMLColour"); - Minecraft* pMinecraft = Minecraft::GetInstance(); - return pMinecraft->skins->getSelected()->getColourTable()->getColour( - colour); -} - -int Game::GetHTMLFontSize(EHTMLFontSize size) { - ZoneScopedN("Game::GetHTMLFontSize"); - return s_iHTMLFontSizesA[size]; -} - -std::wstring Game::FormatHTMLString( - int iPad, const std::wstring& desc, int shadowColour /*= 0xFFFFFFFF*/) { - ZoneScopedN("Game::FormatHTMLString"); - std::wstring text(desc); - - wchar_t replacements[64]; - // We will also insert line breaks here as couldn't figure out how to get - // them to come through from strings.resx ! - text = replaceAll(text, L"{*B*}", L"
"); - swprintf(replacements, 64, L"", - GetHTMLColour(eHTMLColor_T1)); - text = replaceAll(text, L"{*T1*}", replacements); - swprintf(replacements, 64, L"", - GetHTMLColour(eHTMLColor_T2)); - text = replaceAll(text, L"{*T2*}", replacements); - swprintf(replacements, 64, L"", - GetHTMLColour(eHTMLColor_T3)); - text = replaceAll(text, L"{*T3*}", replacements); // for How To Play - swprintf(replacements, 64, L"", - GetHTMLColour(eHTMLColor_Black)); - text = replaceAll(text, L"{*ETB*}", replacements); - swprintf(replacements, 64, L"", - GetHTMLColour(eHTMLColor_White)); - text = replaceAll(text, L"{*ETW*}", replacements); - text = replaceAll(text, L"{*EF*}", L""); - - swprintf(replacements, 64, L"", - GetHTMLColour(eHTMLColor_0), shadowColour); - text = replaceAll(text, L"{*C0*}", replacements); - swprintf(replacements, 64, L"", - GetHTMLColour(eHTMLColor_1), shadowColour); - text = replaceAll(text, L"{*C1*}", replacements); - swprintf(replacements, 64, L"", - GetHTMLColour(eHTMLColor_2), shadowColour); - text = replaceAll(text, L"{*C2*}", replacements); - swprintf(replacements, 64, L"", - GetHTMLColour(eHTMLColor_3), shadowColour); - text = replaceAll(text, L"{*C3*}", replacements); - swprintf(replacements, 64, L"", - GetHTMLColour(eHTMLColor_4), shadowColour); - text = replaceAll(text, L"{*C4*}", replacements); - swprintf(replacements, 64, L"", - GetHTMLColour(eHTMLColor_5), shadowColour); - text = replaceAll(text, L"{*C5*}", replacements); - swprintf(replacements, 64, L"", - GetHTMLColour(eHTMLColor_6), shadowColour); - text = replaceAll(text, L"{*C6*}", replacements); - swprintf(replacements, 64, L"", - GetHTMLColour(eHTMLColor_7), shadowColour); - text = replaceAll(text, L"{*C7*}", replacements); - swprintf(replacements, 64, L"", - GetHTMLColour(eHTMLColor_8), shadowColour); - text = replaceAll(text, L"{*C8*}", replacements); - swprintf(replacements, 64, L"", - GetHTMLColour(eHTMLColor_9), shadowColour); - text = replaceAll(text, L"{*C9*}", replacements); - swprintf(replacements, 64, L"", - GetHTMLColour(eHTMLColor_a), shadowColour); - text = replaceAll(text, L"{*CA*}", replacements); - swprintf(replacements, 64, L"", - GetHTMLColour(eHTMLColor_b), shadowColour); - text = replaceAll(text, L"{*CB*}", replacements); - swprintf(replacements, 64, L"", - GetHTMLColour(eHTMLColor_c), shadowColour); - text = replaceAll(text, L"{*CC*}", replacements); - swprintf(replacements, 64, L"", - GetHTMLColour(eHTMLColor_d), shadowColour); - text = replaceAll(text, L"{*CD*}", replacements); - swprintf(replacements, 64, L"", - GetHTMLColour(eHTMLColor_e), shadowColour); - text = replaceAll(text, L"{*CE*}", replacements); - swprintf(replacements, 64, L"", - GetHTMLColour(eHTMLColor_f), shadowColour); - text = replaceAll(text, L"{*CF*}", replacements); - - // Swap for southpaw. - if (app.GetGameSettings(iPad, eGameSetting_ControlSouthPaw)) { - text = - replaceAll(text, L"{*CONTROLLER_ACTION_MOVE*}", - GetActionReplacement(iPad, MINECRAFT_ACTION_LOOK_RIGHT)); - text = replaceAll(text, L"{*CONTROLLER_ACTION_LOOK*}", - GetActionReplacement(iPad, MINECRAFT_ACTION_RIGHT)); - - text = replaceAll(text, L"{*CONTROLLER_MENU_NAVIGATE*}", - GetVKReplacement(VK_PAD_RTHUMB_LEFT)); - } else // Normal right handed. - { - text = replaceAll(text, L"{*CONTROLLER_ACTION_MOVE*}", - GetActionReplacement(iPad, MINECRAFT_ACTION_RIGHT)); - text = - replaceAll(text, L"{*CONTROLLER_ACTION_LOOK*}", - GetActionReplacement(iPad, MINECRAFT_ACTION_LOOK_RIGHT)); - - text = replaceAll(text, L"{*CONTROLLER_MENU_NAVIGATE*}", - GetVKReplacement(VK_PAD_LTHUMB_LEFT)); - } - - text = replaceAll(text, L"{*CONTROLLER_ACTION_JUMP*}", - GetActionReplacement(iPad, MINECRAFT_ACTION_JUMP)); - text = - replaceAll(text, L"{*CONTROLLER_ACTION_SNEAK*}", - GetActionReplacement(iPad, MINECRAFT_ACTION_SNEAK_TOGGLE)); - text = replaceAll(text, L"{*CONTROLLER_ACTION_USE*}", - GetActionReplacement(iPad, MINECRAFT_ACTION_USE)); - text = replaceAll(text, L"{*CONTROLLER_ACTION_ACTION*}", - GetActionReplacement(iPad, MINECRAFT_ACTION_ACTION)); - text = replaceAll(text, L"{*CONTROLLER_ACTION_LEFT_SCROLL*}", - GetActionReplacement(iPad, MINECRAFT_ACTION_LEFT_SCROLL)); - text = - replaceAll(text, L"{*CONTROLLER_ACTION_RIGHT_SCROLL*}", - GetActionReplacement(iPad, MINECRAFT_ACTION_RIGHT_SCROLL)); - text = replaceAll(text, L"{*CONTROLLER_ACTION_INVENTORY*}", - GetActionReplacement(iPad, MINECRAFT_ACTION_INVENTORY)); - text = replaceAll(text, L"{*CONTROLLER_ACTION_CRAFTING*}", - GetActionReplacement(iPad, MINECRAFT_ACTION_CRAFTING)); - text = replaceAll(text, L"{*CONTROLLER_ACTION_DROP*}", - GetActionReplacement(iPad, MINECRAFT_ACTION_DROP)); - text = replaceAll( - text, L"{*CONTROLLER_ACTION_CAMERA*}", - GetActionReplacement(iPad, MINECRAFT_ACTION_RENDER_THIRD_PERSON)); - text = replaceAll(text, L"{*CONTROLLER_ACTION_MENU_PAGEDOWN*}", - GetActionReplacement(iPad, ACTION_MENU_PAGEDOWN)); - text = - replaceAll(text, L"{*CONTROLLER_ACTION_DISMOUNT*}", - GetActionReplacement(iPad, MINECRAFT_ACTION_SNEAK_TOGGLE)); - text = replaceAll(text, L"{*CONTROLLER_VK_A*}", GetVKReplacement(VK_PAD_A)); - text = replaceAll(text, L"{*CONTROLLER_VK_B*}", GetVKReplacement(VK_PAD_B)); - text = replaceAll(text, L"{*CONTROLLER_VK_X*}", GetVKReplacement(VK_PAD_X)); - text = replaceAll(text, L"{*CONTROLLER_VK_Y*}", GetVKReplacement(VK_PAD_Y)); - text = replaceAll(text, L"{*CONTROLLER_VK_LB*}", - GetVKReplacement(VK_PAD_LSHOULDER)); - text = replaceAll(text, L"{*CONTROLLER_VK_RB*}", - GetVKReplacement(VK_PAD_RSHOULDER)); - text = replaceAll(text, L"{*CONTROLLER_VK_LS*}", - GetVKReplacement(VK_PAD_LTHUMB_UP)); - text = replaceAll(text, L"{*CONTROLLER_VK_RS*}", - GetVKReplacement(VK_PAD_RTHUMB_UP)); - text = replaceAll(text, L"{*CONTROLLER_VK_LT*}", - GetVKReplacement(VK_PAD_LTRIGGER)); - text = replaceAll(text, L"{*CONTROLLER_VK_RT*}", - GetVKReplacement(VK_PAD_RTRIGGER)); - text = replaceAll(text, L"{*ICON_SHANK_01*}", - GetIconReplacement(XZP_ICON_SHANK_01)); - text = replaceAll(text, L"{*ICON_SHANK_03*}", - GetIconReplacement(XZP_ICON_SHANK_03)); - text = replaceAll(text, L"{*CONTROLLER_ACTION_DPAD_UP*}", - GetActionReplacement(iPad, MINECRAFT_ACTION_DPAD_UP)); - text = replaceAll(text, L"{*CONTROLLER_ACTION_DPAD_DOWN*}", - GetActionReplacement(iPad, MINECRAFT_ACTION_DPAD_DOWN)); - text = replaceAll(text, L"{*CONTROLLER_ACTION_DPAD_RIGHT*}", - GetActionReplacement(iPad, MINECRAFT_ACTION_DPAD_RIGHT)); - text = replaceAll(text, L"{*CONTROLLER_ACTION_DPAD_LEFT*}", - GetActionReplacement(iPad, MINECRAFT_ACTION_DPAD_LEFT)); - - // Fix for #8903 - UI: Localization: KOR/JPN/CHT: Button Icons are rendered - // with padding space, which looks no good - std::uint32_t dwLanguage = XGetLanguage(); - switch (dwLanguage) { - case XC_LANGUAGE_KOREAN: - case XC_LANGUAGE_JAPANESE: - case XC_LANGUAGE_TCHINESE: - text = replaceAll(text, L" ", L""); - break; - } - - return text; -} - -std::wstring Game::GetActionReplacement(int iPad, - unsigned char ucAction) { - ZoneScopedN("Game::GetActionReplacement"); - unsigned int input = InputManager.GetGameJoypadMaps( - InputManager.GetJoypadMapVal(iPad), ucAction); - - std::wstring replacement = L""; - - // 4J Stu - Some of our actions can be mapped to multiple physical buttons, - // so replaces the switch that was here - if (input & _360_JOY_BUTTON_A) - replacement = L"ButtonA"; - else if (input & _360_JOY_BUTTON_B) - replacement = L"ButtonB"; - else if (input & _360_JOY_BUTTON_X) - replacement = L"ButtonX"; - else if (input & _360_JOY_BUTTON_Y) - replacement = L"ButtonY"; - else if ((input & _360_JOY_BUTTON_LSTICK_UP) || - (input & _360_JOY_BUTTON_LSTICK_DOWN) || - (input & _360_JOY_BUTTON_LSTICK_LEFT) || - (input & _360_JOY_BUTTON_LSTICK_RIGHT)) { - replacement = L"ButtonLeftStick"; - } else if ((input & _360_JOY_BUTTON_RSTICK_LEFT) || - (input & _360_JOY_BUTTON_RSTICK_RIGHT) || - (input & _360_JOY_BUTTON_RSTICK_UP) || - (input & _360_JOY_BUTTON_RSTICK_DOWN)) { - replacement = L"ButtonRightStick"; - } else if (input & _360_JOY_BUTTON_DPAD_LEFT) - replacement = L"ButtonDpadL"; - else if (input & _360_JOY_BUTTON_DPAD_RIGHT) - replacement = L"ButtonDpadR"; - else if (input & _360_JOY_BUTTON_DPAD_UP) - replacement = L"ButtonDpadU"; - else if (input & _360_JOY_BUTTON_DPAD_DOWN) - replacement = L"ButtonDpadD"; - else if (input & _360_JOY_BUTTON_LT) - replacement = L"ButtonLeftTrigger"; - else if (input & _360_JOY_BUTTON_RT) - replacement = L"ButtonRightTrigger"; - else if (input & _360_JOY_BUTTON_RB) - replacement = L"ButtonRightBumper"; - else if (input & _360_JOY_BUTTON_LB) - replacement = L"ButtonLeftBumper"; - else if (input & _360_JOY_BUTTON_BACK) - replacement = L"ButtonBack"; - else if (input & _360_JOY_BUTTON_START) - replacement = L"ButtonStart"; - else if (input & _360_JOY_BUTTON_RTHUMB) - replacement = L"ButtonRS"; - else if (input & _360_JOY_BUTTON_LTHUMB) - replacement = L"ButtonLS"; - - wchar_t string[128]; - -#if defined(_WIN64) - int size = 45; - if (ui.getScreenWidth() < 1920) size = 30; -#else - int size = 45; -#endif - - swprintf(string, 128, - L"", - replacement.c_str(), size, size); - - return string; -} - -std::wstring Game::GetVKReplacement(unsigned int uiVKey) { - ZoneScopedN("Game::GetVKReplacement"); - std::wstring replacement = L""; - switch (uiVKey) { - case VK_PAD_A: - replacement = L"ButtonA"; - break; - case VK_PAD_B: - replacement = L"ButtonB"; - break; - case VK_PAD_X: - replacement = L"ButtonX"; - break; - case VK_PAD_Y: - replacement = L"ButtonY"; - break; - case VK_PAD_LSHOULDER: - replacement = L"ButtonLeftBumper"; - break; - case VK_PAD_RSHOULDER: - replacement = L"ButtonRightBumper"; - break; - case VK_PAD_LTRIGGER: - replacement = L"ButtonLeftTrigger"; - break; - case VK_PAD_RTRIGGER: - replacement = L"ButtonRightTrigger"; - break; - case VK_PAD_LTHUMB_UP: - case VK_PAD_LTHUMB_DOWN: - case VK_PAD_LTHUMB_RIGHT: - case VK_PAD_LTHUMB_LEFT: - case VK_PAD_LTHUMB_UPLEFT: - case VK_PAD_LTHUMB_UPRIGHT: - case VK_PAD_LTHUMB_DOWNRIGHT: - case VK_PAD_LTHUMB_DOWNLEFT: - replacement = L"ButtonLeftStick"; - break; - case VK_PAD_RTHUMB_UP: - case VK_PAD_RTHUMB_DOWN: - case VK_PAD_RTHUMB_RIGHT: - case VK_PAD_RTHUMB_LEFT: - case VK_PAD_RTHUMB_UPLEFT: - case VK_PAD_RTHUMB_UPRIGHT: - case VK_PAD_RTHUMB_DOWNRIGHT: - case VK_PAD_RTHUMB_DOWNLEFT: - replacement = L"ButtonRightStick"; - break; - default: - break; - } - wchar_t string[128]; - -#if defined(_WIN64) - int size = 45; - if (ui.getScreenWidth() < 1920) size = 30; -#else - int size = 45; -#endif - - swprintf(string, 128, - L"", - replacement.c_str(), size, size); - - return string; -} - -std::wstring Game::GetIconReplacement(unsigned int uiIcon) { - ZoneScopedN("Game::GetIconReplacement"); - wchar_t string[128]; - -#if defined(_WIN64) - int size = 33; - if (ui.getScreenWidth() < 1920) size = 22; -#else - int size = 33; -#endif - - swprintf(string, 128, - L"", - size, size); - std::wstring result = L""; - switch (uiIcon) { - case XZP_ICON_SHANK_01: - result = string; - break; - case XZP_ICON_SHANK_03: - result.append(string).append(string).append(string); - break; - default: - break; - } - return result; -} - -std::unordered_map Game::MojangData; -std::unordered_map Game::DLCTextures_PackID; -std::unordered_map Game::DLCInfo_Trial; -std::unordered_map Game::DLCInfo_Full; -std::unordered_map Game::DLCInfo_SkinName; - -int32_t Game::RegisterMojangData(wchar_t* pXuidName, PlayerUID xuid, - wchar_t* pSkin, wchar_t* pCape) { - ZoneScopedN("Game::RegisterMojangData"); - int32_t hr = 0; - eXUID eTempXuid = eXUID_Undefined; - MOJANG_DATA* pMojangData = nullptr; - - // ignore the names if we don't recognize them - if (pXuidName != nullptr) { - if (wcscmp(pXuidName, L"XUID_NOTCH") == 0) { - eTempXuid = - eXUID_Notch; // might be needed for the apple at some point - } else if (wcscmp(pXuidName, L"XUID_DEADMAU5") == 0) { - eTempXuid = eXUID_Deadmau5; // Needed for the deadmau5 ears - } else { - eTempXuid = eXUID_NoName; - } - } - - if (eTempXuid != eXUID_Undefined) { - pMojangData = new MOJANG_DATA; - memset(pMojangData, 0, sizeof(MOJANG_DATA)); - pMojangData->eXuid = eTempXuid; - - wcsncpy(pMojangData->wchSkin, pSkin, MAX_CAPENAME_SIZE); - wcsncpy(pMojangData->wchCape, pCape, MAX_CAPENAME_SIZE); - MojangData[xuid] = pMojangData; - } - - return hr; -} - -MOJANG_DATA* Game::GetMojangDataForXuid(PlayerUID xuid) { - ZoneScopedN("Game::GetMojangDataForXuid"); - return MojangData[xuid]; -} - -int32_t Game::RegisterConfigValues(wchar_t* pType, int iValue) { - ZoneScopedN("Game::RegisterConfigValues"); - int32_t hr = 0; - - // #ifdef 0 - // if(pType!=nullptr) - // { - // if(wcscmp(pType,L"XboxOneTransfer")==0) - // { - // if(iValue>0) - // { - // app.m_bTransferSavesToXboxOne=true; - // } - // else - // { - // app.m_bTransferSavesToXboxOne=false; - // } - // } - // else if(wcscmp(pType,L"TransferSlotCount")==0) - // { - // app.m_uiTransferSlotC=iValue; - // } - // - // } - // #endif - - return hr; -} - -#if defined(_WINDOWS64) -int32_t Game::RegisterDLCData(wchar_t* pType, wchar_t* pBannerName, - int iGender, uint64_t ullOfferID_Full, - uint64_t ullOfferID_Trial, - wchar_t* pFirstSkin, - unsigned int uiSortIndex, int iConfig, - wchar_t* pDataFile) { - ZoneScopedN("Game::RegisterDLCData"); - int32_t hr = 0; - DLC_INFO* pDLCData = new DLC_INFO; - memset(pDLCData, 0, sizeof(DLC_INFO)); - pDLCData->ullOfferID_Full = ullOfferID_Full; - pDLCData->ullOfferID_Trial = ullOfferID_Trial; - pDLCData->eDLCType = e_DLC_NotDefined; - pDLCData->iGender = iGender; - pDLCData->uiSortIndex = uiSortIndex; - pDLCData->iConfig = iConfig; - - // ignore the names if we don't recognize them - if (pBannerName != L"") { - wcsncpy_s(pDLCData->wchBanner, pBannerName, MAX_BANNERNAME_SIZE); - } - - if (pDataFile[0] != 0) { - wcsncpy_s(pDLCData->wchDataFile, pDataFile, MAX_BANNERNAME_SIZE); - } - - if (pType != nullptr) { - if (wcscmp(pType, L"Skin") == 0) { - pDLCData->eDLCType = e_DLC_SkinPack; - } else if (wcscmp(pType, L"Gamerpic") == 0) { - pDLCData->eDLCType = e_DLC_Gamerpics; - } else if (wcscmp(pType, L"Theme") == 0) { - pDLCData->eDLCType = e_DLC_Themes; - } else if (wcscmp(pType, L"Avatar") == 0) { - pDLCData->eDLCType = e_DLC_AvatarItems; - } else if (wcscmp(pType, L"MashUpPack") == 0) { - pDLCData->eDLCType = e_DLC_MashupPacks; - DLCTextures_PackID[pDLCData->iConfig] = ullOfferID_Full; - } else if (wcscmp(pType, L"TexturePack") == 0) { - pDLCData->eDLCType = e_DLC_TexturePacks; - DLCTextures_PackID[pDLCData->iConfig] = ullOfferID_Full; - } - } - - if (ullOfferID_Trial != 0ll) DLCInfo_Trial[ullOfferID_Trial] = pDLCData; - if (ullOfferID_Full != 0ll) DLCInfo_Full[ullOfferID_Full] = pDLCData; - if (pFirstSkin[0] != 0) DLCInfo_SkinName[pFirstSkin] = ullOfferID_Full; - - return hr; -} -#elif defined(__linux__) -int32_t Game::RegisterDLCData(wchar_t* pType, wchar_t* pBannerName, - int iGender, uint64_t ullOfferID_Full, - uint64_t ullOfferID_Trial, - wchar_t* pFirstSkin, - unsigned int uiSortIndex, int iConfig, - wchar_t* pDataFile) { - ZoneScopedN("Game::RegisterDLCData"); - fprintf(stderr, - "warning: Game::RegisterDLCData unimplemented for " - "platform `__linux__`\n"); - return 0; -} -#else - -int32_t Game::RegisterDLCData(char* pchDLCName, - unsigned int uiSortIndex, - char* pchImageURL) { - ZoneScopedN("Game::RegisterDLCData"); - // on PS3 we get all the required info from the name - char chDLCType[3]; - int32_t hr = 0; - DLC_INFO* pDLCData = new DLC_INFO; - memset(pDLCData, 0, sizeof(DLC_INFO)); - - chDLCType[0] = pchDLCName[0]; - chDLCType[1] = pchDLCName[1]; - chDLCType[2] = 0; - - pDLCData->iConfig = app.GetiConfigFromName(pchDLCName); - pDLCData->uiSortIndex = uiSortIndex; - pDLCData->eDLCType = app.GetDLCTypeFromName(pchDLCName); - strcpy(pDLCData->chImageURL, pchImageURL); - // bool bIsTrialDLC = app.GetTrialFromName(pchDLCName); - - switch (pDLCData->eDLCType) { - case e_DLC_TexturePacks: { - char* pchName = (char*)malloc(strlen(pchDLCName) + 1); - strcpy(pchName, pchDLCName); - DLCTextures_PackID[pDLCData->iConfig] = pchName; - } break; - case e_DLC_MashupPacks: { - char* pchName = (char*)malloc(strlen(pchDLCName) + 1); - strcpy(pchName, pchDLCName); - DLCTextures_PackID[pDLCData->iConfig] = pchName; - } break; - default: - break; - } - - app.DebugPrintf(5, "Adding DLC - %s\n", pchDLCName); - DLCInfo[pchDLCName] = pDLCData; - - // if(ullOfferID_Trial!=0ll) DLCInfo_Trial[ullOfferID_Trial]=pDLCData; - // if(ullOfferID_Full!=0ll) DLCInfo_Full[ullOfferID_Full]=pDLCData; - // if(pFirstSkin[0]!=0) DLCInfo_SkinName[pFirstSkin]=ullOfferID_Full; - - // DLCInfo[ullOfferID_Trial]=pDLCData; - - return hr; -} -#endif - -bool Game::GetDLCFullOfferIDForSkinID(const std::wstring& FirstSkin, - uint64_t* pullVal) { - ZoneScopedN("Game::GetDLCFullOfferIDForSkinID"); - auto it = DLCInfo_SkinName.find(FirstSkin); - if (it == DLCInfo_SkinName.end()) { - return false; - } else { - *pullVal = (uint64_t)it->second; - return true; - } -} -bool Game::GetDLCFullOfferIDForPackID(const int iPackID, - uint64_t* pullVal) { - ZoneScopedN("Game::GetDLCFullOfferIDForPackID"); - auto it = DLCTextures_PackID.find(iPackID); - if (it == DLCTextures_PackID.end()) { - *pullVal = (uint64_t)0; - return false; - } else { - *pullVal = (uint64_t)it->second; - return true; - } -} -DLC_INFO* Game::GetDLCInfoForTrialOfferID(uint64_t ullOfferID_Trial) { - ZoneScopedN("Game::GetDLCInfoForTrialOfferID"); - // DLC_INFO *pDLCInfo=NULL; - if (DLCInfo_Trial.size() > 0) { - auto it = DLCInfo_Trial.find(ullOfferID_Trial); - - if (it == DLCInfo_Trial.end()) { - // nothing for this - return nullptr; - } else { - return it->second; - } - } else - return nullptr; -} - -DLC_INFO* Game::GetDLCInfoTrialOffer(int iIndex) { - ZoneScopedN("Game::GetDLCInfoTrialOffer"); - std::unordered_map::iterator it = - DLCInfo_Trial.begin(); - - for (int i = 0; i < iIndex; i++) { - ++it; - } - - return it->second; -} -DLC_INFO* Game::GetDLCInfoFullOffer(int iIndex) { - ZoneScopedN("Game::GetDLCInfoFullOffer"); - std::unordered_map::iterator it = DLCInfo_Full.begin(); - - for (int i = 0; i < iIndex; i++) { - ++it; - } - - return it->second; -} -uint64_t Game::GetDLCInfoTexturesFullOffer(int iIndex) { - ZoneScopedN("Game::GetDLCInfoTexturesFullOffer"); - std::unordered_map::iterator it = DLCTextures_PackID.begin(); - - for (int i = 0; i < iIndex; i++) { - ++it; - } - - return it->second; -} - -DLC_INFO* Game::GetDLCInfoForFullOfferID(uint64_t ullOfferID_Full) { - ZoneScopedN("Game::GetDLCInfoForFullOfferID"); - if (DLCInfo_Full.size() > 0) { - auto it = DLCInfo_Full.find(ullOfferID_Full); - - if (it == DLCInfo_Full.end()) { - // nothing for this - return nullptr; - } else { - return it->second; - } - } else - return nullptr; -} - -void Game::lockSaveNotification() { - ZoneScopedN("Game::lockSaveNotification"); - std::lock_guard lock(m_saveNotificationMutex); - if (m_saveNotificationDepth++ == 0) { - if (g_NetworkManager - .IsInSession()) // this can be triggered from the front end if - // we're downloading a save - { - MinecraftServer::getInstance()->broadcastStartSavingPacket(); - - if (g_NetworkManager.IsLocalGame() && - g_NetworkManager.GetPlayerCount() == 1) { - app.SetXuiServerAction(ProfileManager.GetPrimaryPad(), - eXuiServerAction_PauseServer, - (void*)true); - } - } - } -} - -void Game::unlockSaveNotification() { - ZoneScopedN("Game::unlockSaveNotification"); - std::lock_guard lock(m_saveNotificationMutex); - if (--m_saveNotificationDepth == 0) { - if (g_NetworkManager - .IsInSession()) // this can be triggered from the front end if - // we're downloading a save - { - MinecraftServer::getInstance()->broadcastStopSavingPacket(); - - if (g_NetworkManager.IsLocalGame() && - g_NetworkManager.GetPlayerCount() == 1) { - app.SetXuiServerAction(ProfileManager.GetPrimaryPad(), - eXuiServerAction_PauseServer, - (void*)false); - } - } - } -} - -int Game::RemoteSaveThreadProc(void* lpParameter) { - ZoneScopedN("Game::RemoteSaveThreadProc"); - // The game should be stopped while we are doing this, but the connections - // ticks may try to create some AABB's or Vec3's - Compression::UseDefaultThreadStorage(); - - // 4J-PB - Xbox 360 - 163153 - [CRASH] TU17: Code: Multiplayer: During the - // Autosave in an online Multiplayer session, the game occasionally crashes - // for one or more Clients callstack - > if(tls->tileId != this->id) - // updateDefaultShape(); callstack - > - // default.exe!WaterlilyTile::getAABB(Level * level, int x, int y, int z) - // line 38 + 8 bytes C++ - // ... - // default.exe!Game::RemoteSaveThreadProc(void * - // lpParameter) line 6694 C++ - // host autosave, and the clients can crash on receiving handleMoveEntity - // when it's a tile within this thread, so need to do the tls for tiles - Tile::CreateNewThreadStorage(); - - Minecraft* pMinecraft = Minecraft::GetInstance(); - - pMinecraft->progressRenderer->progressStartNoAbort( - IDS_PROGRESS_HOST_SAVING); - pMinecraft->progressRenderer->progressStage(-1); - pMinecraft->progressRenderer->progressStagePercentage(0); - - while (!app.GetGameStarted() && - app.GetXuiAction(ProfileManager.GetPrimaryPad()) == - eAppAction_WaitRemoteServerSaveComplete) { - // Tick all the games connections - pMinecraft->tickAllConnections(); - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - } - - if (app.GetXuiAction(ProfileManager.GetPrimaryPad()) != - eAppAction_WaitRemoteServerSaveComplete) { - // Something cancelled us? - return ERROR_CANCELLED; - } - app.SetAction(ProfileManager.GetPrimaryPad(), eAppAction_Idle); - - ui.UpdatePlayerBasePositions(); - - Tile::ReleaseThreadStorage(); - - return 0; -} - -void Game::ExitGameFromRemoteSave(void* lpParameter) { - ZoneScopedN("Game::ExitGameFromRemoteSave"); - int primaryPad = ProfileManager.GetPrimaryPad(); - - unsigned int uiIDA[3]; - uiIDA[0] = IDS_CONFIRM_CANCEL; - uiIDA[1] = IDS_CONFIRM_OK; - - ui.RequestAlertMessage( - IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME, uiIDA, 2, primaryPad, - &Game::ExitGameFromRemoteSaveDialogReturned, nullptr); -} - -int Game::ExitGameFromRemoteSaveDialogReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { - ZoneScopedN("Game::ExitGameFromRemoteSaveDialogReturned"); - // CScene_Pause* pClass = (CScene_Pause*)pParam; - - // results switched for this dialog - if (result == C4JStorage::EMessage_ResultDecline) { - app.SetAction(iPad, eAppAction_ExitWorld); - } else { - // Inform fullscreen progress scene that it's not being cancelled after - // all - UIScene_FullscreenProgress* pScene = - (UIScene_FullscreenProgress*)ui.FindScene( - eUIScene_FullscreenProgress); - if (pScene != nullptr) { - pScene->SetWasCancelled(false); - } - } - return 0; -} - -void Game::SetSpecialTutorialCompletionFlag(int iPad, int index) { - ZoneScopedN("Game::SetSpecialTutorialCompletionFlag"); - if (index >= 0 && index < 32 && GameSettingsA[iPad] != nullptr) { - GameSettingsA[iPad]->uiSpecialTutorialBitmask |= (1 << index); - } -} - -// BANNED LIST FUNCTIONS - -void Game::SetUniqueMapName(char* pszUniqueMapName) { - ZoneScopedN("Game::SetUniqueMapName"); - memcpy(m_pszUniqueMapName, pszUniqueMapName, 14); -} - -char* Game::GetUniqueMapName(void) { return m_pszUniqueMapName; } - -void Game::InvalidateBannedList(int iPad) { - ZoneScopedN("Game::InvalidateBannedList"); - if (m_bRead_BannedListA[iPad] == true) { - m_bRead_BannedListA[iPad] = false; - SetBanListCheck(iPad, false); - m_vBannedListA[iPad]->clear(); - - if (BannedListA[iPad].pBannedList) { - delete[] BannedListA[iPad].pBannedList; - BannedListA[iPad].pBannedList = nullptr; - } - } -} - -void Game::AddLevelToBannedLevelList(int iPad, PlayerUID xuid, - char* pszLevelName, - bool bWriteToTMS) { - ZoneScopedN("Game::AddLevelToBannedLevelList"); - // we will have retrieved the banned level list from TMS, so add this one to - // it and write it back to TMS - - BANNEDLISTDATA* pBannedListData = new BANNEDLISTDATA; - memset(pBannedListData, 0, sizeof(BANNEDLISTDATA)); - - memcpy(&pBannedListData->xuid, &xuid, sizeof(PlayerUID)); - strcpy(pBannedListData->pszLevelName, pszLevelName); - m_vBannedListA[iPad]->push_back(pBannedListData); - - if (bWriteToTMS) { - const std::size_t bannedListCount = m_vBannedListA[iPad]->size(); - const unsigned int dataBytes = - static_cast(sizeof(BANNEDLISTDATA) * bannedListCount); - PBANNEDLISTDATA pBannedList = new BANNEDLISTDATA[bannedListCount]; - int iCount = 0; - for (auto it = m_vBannedListA[iPad]->begin(); - it != m_vBannedListA[iPad]->end(); ++it) { - PBANNEDLISTDATA pData = *it; - memcpy(&pBannedList[iCount++], pData, sizeof(BANNEDLISTDATA)); - } - - // 4J-PB - write to TMS++ now - - // bool - // bRes=StorageManager.WriteTMSFile(iPad,C4JStorage::eGlobalStorage_TitleUser,L"BannedList",(std::uint8_t*)pBannedList, - // dwDataBytes); - - delete[] pBannedList; - } - // update telemetry too -} - -bool Game::IsInBannedLevelList(int iPad, PlayerUID xuid, - char* pszLevelName) { - ZoneScopedN("Game::IsInBannedLevelList"); - for (auto it = m_vBannedListA[iPad]->begin(); - it != m_vBannedListA[iPad]->end(); ++it) { - PBANNEDLISTDATA pData = *it; - if (IsEqualXUID(pData->xuid, xuid) && - (strcmp(pData->pszLevelName, pszLevelName) == 0)) { - return true; - } - } - - return false; -} - -void Game::RemoveLevelFromBannedLevelList(int iPad, PlayerUID xuid, - char* pszLevelName) { - ZoneScopedN("Game::RemoveLevelFromBannedLevelList"); - // bool bFound=false; - // bool bRes; - - // we will have retrieved the banned level list from TMS, so remove this one - // from it and write it back to TMS - for (auto it = m_vBannedListA[iPad]->begin(); - it != m_vBannedListA[iPad]->end();) { - PBANNEDLISTDATA pBannedListData = *it; - - if (pBannedListData != nullptr) { - if (IsEqualXUID(pBannedListData->xuid, xuid) && - (strcmp(pBannedListData->pszLevelName, pszLevelName) == 0)) { - // match found, so remove this entry - it = m_vBannedListA[iPad]->erase(it); - } else { - ++it; - } - } else { - ++it; - } - } - - const std::size_t bannedListCount = m_vBannedListA[iPad]->size(); - const unsigned int dataBytes = - static_cast(sizeof(BANNEDLISTDATA) * bannedListCount); - if (dataBytes == 0) { - // wipe the file - } else { - PBANNEDLISTDATA pBannedList = - (BANNEDLISTDATA*)(new std::uint8_t[dataBytes]); - - for (std::size_t i = 0; i < bannedListCount; ++i) { - PBANNEDLISTDATA pBannedListData = m_vBannedListA[iPad]->at(i); - - memcpy(&pBannedList[i], pBannedListData, sizeof(BANNEDLISTDATA)); - } - delete[] pBannedList; - } - - // update telemetry too -} - -// function to add credits for the DLC packs -void Game::AddCreditText(const wchar_t* lpStr) { - ZoneScopedN("Game::AddCreditText"); - DebugPrintf("ADDING CREDIT - %ls\n", lpStr); - // add a std::string from the DLC to a credits std::vector - SCreditTextItemDef* pCreditStruct = new SCreditTextItemDef; - pCreditStruct->m_eType = eSmallText; - pCreditStruct->m_iStringID[0] = NO_TRANSLATED_STRING; - pCreditStruct->m_iStringID[1] = NO_TRANSLATED_STRING; - pCreditStruct->m_Text = new wchar_t[wcslen(lpStr) + 1]; - wcscpy((wchar_t*)pCreditStruct->m_Text, lpStr); - - vDLCCredits.push_back(pCreditStruct); -} - -bool Game::AlreadySeenCreditText(const std::wstring& wstemp) { - ZoneScopedN("Game::AlreadySeenCreditText"); - for (unsigned int i = 0; i < m_vCreditText.size(); i++) { - std::wstring temp = m_vCreditText.at(i); - - // if they are the same, break out of the case - if (temp.compare(wstemp) == 0) { - return true; - } - } - - // add this text - m_vCreditText.push_back((wchar_t*)wstemp.c_str()); - return false; -} - -unsigned int Game::GetDLCCreditsCount() { - ZoneScopedN("Game::GetDLCCreditsCount"); - return (unsigned int)vDLCCredits.size(); -} - -SCreditTextItemDef* Game::GetDLCCredits(int iIndex) { - ZoneScopedN("Game::GetDLCCredits"); - return vDLCCredits.at(iIndex); -} // Game Host options void Game::SetGameHostOption(eGameHostOption eVal, unsigned int uiVal) { - ZoneScopedN("Game::SetGameHostOption"); - SetGameHostOption(m_uiGameHostSettings, eVal, uiVal); + GameHostOptions::set(m_uiGameHostSettings, eVal, uiVal); } -void Game::SetGameHostOption(unsigned int& uiHostSettings, - eGameHostOption eVal, - unsigned int uiVal) { - ZoneScopedN("Game::SetGameHostOption"); - switch (eVal) { - case eGameHostOption_FriendsOfFriends: - if (uiVal != 0) { - uiHostSettings |= GAME_HOST_OPTION_BITMASK_FRIENDSOFFRIENDS; - } else { - // off - uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_FRIENDSOFFRIENDS; - } - break; - case eGameHostOption_Difficulty: - // clear the difficulty first - uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_DIFFICULTY; - uiHostSettings |= (GAME_HOST_OPTION_BITMASK_DIFFICULTY & uiVal); - break; - case eGameHostOption_Gamertags: - if (uiVal != 0) { - uiHostSettings |= GAME_HOST_OPTION_BITMASK_GAMERTAGS; - } else { - // off - uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_GAMERTAGS; - } - - break; - case eGameHostOption_GameType: - // clear the game type first - uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_GAMETYPE; - uiHostSettings |= - (GAME_HOST_OPTION_BITMASK_GAMETYPE & (uiVal << 4)); - break; - case eGameHostOption_LevelType: - if (uiVal != 0) { - uiHostSettings |= GAME_HOST_OPTION_BITMASK_LEVELTYPE; - } else { - // off - uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_LEVELTYPE; - } - - break; - case eGameHostOption_Structures: - if (uiVal != 0) { - uiHostSettings |= GAME_HOST_OPTION_BITMASK_STRUCTURES; - } else { - // off - uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_STRUCTURES; - } - - break; - case eGameHostOption_BonusChest: - if (uiVal != 0) { - uiHostSettings |= GAME_HOST_OPTION_BITMASK_BONUSCHEST; - } else { - // off - uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_BONUSCHEST; - } - - break; - case eGameHostOption_HasBeenInCreative: - if (uiVal != 0) { - uiHostSettings |= GAME_HOST_OPTION_BITMASK_BEENINCREATIVE; - } else { - // off - uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_BEENINCREATIVE; - } - - break; - case eGameHostOption_PvP: - if (uiVal != 0) { - uiHostSettings |= GAME_HOST_OPTION_BITMASK_PVP; - } else { - // off - uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_PVP; - } - - break; - case eGameHostOption_TrustPlayers: - if (uiVal != 0) { - uiHostSettings |= GAME_HOST_OPTION_BITMASK_TRUSTPLAYERS; - } else { - // off - uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_TRUSTPLAYERS; - } - - break; - case eGameHostOption_TNT: - if (uiVal != 0) { - uiHostSettings |= GAME_HOST_OPTION_BITMASK_TNT; - } else { - // off - uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_TNT; - } - - break; - case eGameHostOption_FireSpreads: - if (uiVal != 0) { - uiHostSettings |= GAME_HOST_OPTION_BITMASK_FIRESPREADS; - } else { - // off - uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_FIRESPREADS; - } - break; - case eGameHostOption_CheatsEnabled: - if (uiVal != 0) { - uiHostSettings |= GAME_HOST_OPTION_BITMASK_HOSTFLY; - uiHostSettings |= GAME_HOST_OPTION_BITMASK_HOSTHUNGER; - uiHostSettings |= GAME_HOST_OPTION_BITMASK_HOSTINVISIBLE; - } else { - // off - uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_HOSTFLY; - uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_HOSTHUNGER; - uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_HOSTINVISIBLE; - } - break; - case eGameHostOption_HostCanFly: - if (uiVal != 0) { - uiHostSettings |= GAME_HOST_OPTION_BITMASK_HOSTFLY; - } else { - // off - uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_HOSTFLY; - } - break; - case eGameHostOption_HostCanChangeHunger: - if (uiVal != 0) { - uiHostSettings |= GAME_HOST_OPTION_BITMASK_HOSTHUNGER; - } else { - // off - uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_HOSTHUNGER; - } - break; - case eGameHostOption_HostCanBeInvisible: - if (uiVal != 0) { - uiHostSettings |= GAME_HOST_OPTION_BITMASK_HOSTINVISIBLE; - } else { - // off - uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_HOSTINVISIBLE; - } - break; - - case eGameHostOption_BedrockFog: - if (uiVal != 0) { - uiHostSettings |= GAME_HOST_OPTION_BITMASK_BEDROCKFOG; - } else { - // off - uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_BEDROCKFOG; - } - break; - case eGameHostOption_DisableSaving: - if (uiVal != 0) { - uiHostSettings |= GAME_HOST_OPTION_BITMASK_DISABLESAVE; - } else { - // off - uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_DISABLESAVE; - } - break; - case eGameHostOption_WasntSaveOwner: - if (uiVal != 0) { - uiHostSettings |= GAME_HOST_OPTION_BITMASK_NOTOWNER; - } else { - // off - uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_NOTOWNER; - } - break; - case eGameHostOption_MobGriefing: - if (uiVal != 1) { - uiHostSettings |= GAME_HOST_OPTION_BITMASK_MOBGRIEFING; - } else { - // off - uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_MOBGRIEFING; - } - break; - case eGameHostOption_KeepInventory: - if (uiVal != 0) { - uiHostSettings |= GAME_HOST_OPTION_BITMASK_KEEPINVENTORY; - } else { - // off - uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_KEEPINVENTORY; - } - break; - case eGameHostOption_DoMobSpawning: - if (uiVal != 1) { - uiHostSettings |= GAME_HOST_OPTION_BITMASK_DOMOBSPAWNING; - } else { - // off - uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_DOMOBSPAWNING; - } - break; - case eGameHostOption_DoMobLoot: - if (uiVal != 1) { - uiHostSettings |= GAME_HOST_OPTION_BITMASK_DOMOBLOOT; - } else { - // off - uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_DOMOBLOOT; - } - break; - case eGameHostOption_DoTileDrops: - if (uiVal != 1) { - uiHostSettings |= GAME_HOST_OPTION_BITMASK_DOTILEDROPS; - } else { - // off - uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_DOTILEDROPS; - } - break; - case eGameHostOption_NaturalRegeneration: - if (uiVal != 1) { - uiHostSettings |= GAME_HOST_OPTION_BITMASK_NATURALREGEN; - } else { - // off - uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_NATURALREGEN; - } - break; - case eGameHostOption_DoDaylightCycle: - if (uiVal != 1) { - uiHostSettings |= GAME_HOST_OPTION_BITMASK_DODAYLIGHTCYCLE; - } else { - // off - uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_DODAYLIGHTCYCLE; - } - break; - case eGameHostOption_WorldSize: - // clear the difficulty first - uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_WORLDSIZE; - uiHostSettings |= - (GAME_HOST_OPTION_BITMASK_WORLDSIZE & - (uiVal << GAME_HOST_OPTION_BITMASK_WORLDSIZE_BITSHIFT)); - break; - case eGameHostOption_All: - uiHostSettings = uiVal; - break; - default: - break; - } -} unsigned int Game::GetGameHostOption(eGameHostOption eVal) { - ZoneScopedN("Game::GetGameHostOption"); - return GetGameHostOption(m_uiGameHostSettings, eVal); + return GameHostOptions::get(m_uiGameHostSettings, eVal); } -unsigned int Game::GetGameHostOption(unsigned int uiHostSettings, - eGameHostOption eVal) { - ZoneScopedN("Game::GetGameHostOption"); - // unsigned int uiVal=0; - switch (eVal) { - case eGameHostOption_FriendsOfFriends: - return (uiHostSettings & GAME_HOST_OPTION_BITMASK_FRIENDSOFFRIENDS); - break; - case eGameHostOption_Difficulty: - return (uiHostSettings & GAME_HOST_OPTION_BITMASK_DIFFICULTY); - break; - case eGameHostOption_Gamertags: - return (uiHostSettings & GAME_HOST_OPTION_BITMASK_GAMERTAGS); - break; - case eGameHostOption_GameType: - return (uiHostSettings & GAME_HOST_OPTION_BITMASK_GAMETYPE) >> 4; - break; - case eGameHostOption_All: - return (uiHostSettings & GAME_HOST_OPTION_BITMASK_ALL); - break; - case eGameHostOption_Tutorial: - // special case - tutorial is offline, but we want the gamertag - // option, and set Easy mode, structures on, fire on, tnt on, pvp - // on, trust players on - return ((uiHostSettings & GAME_HOST_OPTION_BITMASK_GAMERTAGS) | - GAME_HOST_OPTION_BITMASK_TRUSTPLAYERS | - GAME_HOST_OPTION_BITMASK_FIRESPREADS | - GAME_HOST_OPTION_BITMASK_TNT | - GAME_HOST_OPTION_BITMASK_PVP | - GAME_HOST_OPTION_BITMASK_STRUCTURES | 1); - break; - case eGameHostOption_LevelType: - return (uiHostSettings & GAME_HOST_OPTION_BITMASK_LEVELTYPE); - break; - case eGameHostOption_Structures: - return (uiHostSettings & GAME_HOST_OPTION_BITMASK_STRUCTURES); - break; - case eGameHostOption_BonusChest: - return (uiHostSettings & GAME_HOST_OPTION_BITMASK_BONUSCHEST); - break; - case eGameHostOption_HasBeenInCreative: - return (uiHostSettings & GAME_HOST_OPTION_BITMASK_BEENINCREATIVE); - break; - case eGameHostOption_PvP: - return (uiHostSettings & GAME_HOST_OPTION_BITMASK_PVP); - break; - case eGameHostOption_TrustPlayers: - return (uiHostSettings & GAME_HOST_OPTION_BITMASK_TRUSTPLAYERS); - break; - case eGameHostOption_TNT: - return (uiHostSettings & GAME_HOST_OPTION_BITMASK_TNT); - break; - case eGameHostOption_FireSpreads: - return (uiHostSettings & GAME_HOST_OPTION_BITMASK_FIRESPREADS); - break; - case eGameHostOption_CheatsEnabled: - return (uiHostSettings & (GAME_HOST_OPTION_BITMASK_HOSTFLY | - GAME_HOST_OPTION_BITMASK_HOSTHUNGER | - GAME_HOST_OPTION_BITMASK_HOSTINVISIBLE)); - break; - case eGameHostOption_HostCanFly: - return (uiHostSettings & GAME_HOST_OPTION_BITMASK_HOSTFLY); - break; - case eGameHostOption_HostCanChangeHunger: - return (uiHostSettings & GAME_HOST_OPTION_BITMASK_HOSTHUNGER); - break; - case eGameHostOption_HostCanBeInvisible: - return (uiHostSettings & GAME_HOST_OPTION_BITMASK_HOSTINVISIBLE); - break; - case eGameHostOption_BedrockFog: - return (uiHostSettings & GAME_HOST_OPTION_BITMASK_BEDROCKFOG); - break; - case eGameHostOption_DisableSaving: - return (uiHostSettings & GAME_HOST_OPTION_BITMASK_DISABLESAVE); - break; - case eGameHostOption_WasntSaveOwner: - return (uiHostSettings & GAME_HOST_OPTION_BITMASK_NOTOWNER); - case eGameHostOption_WorldSize: - return (uiHostSettings & GAME_HOST_OPTION_BITMASK_WORLDSIZE) >> - GAME_HOST_OPTION_BITMASK_WORLDSIZE_BITSHIFT; - case eGameHostOption_MobGriefing: - return !(uiHostSettings & GAME_HOST_OPTION_BITMASK_MOBGRIEFING); - case eGameHostOption_KeepInventory: - return (uiHostSettings & GAME_HOST_OPTION_BITMASK_KEEPINVENTORY); - case eGameHostOption_DoMobSpawning: - return !(uiHostSettings & GAME_HOST_OPTION_BITMASK_DOMOBSPAWNING); - case eGameHostOption_DoMobLoot: - return !(uiHostSettings & GAME_HOST_OPTION_BITMASK_DOMOBLOOT); - case eGameHostOption_DoTileDrops: - return !(uiHostSettings & GAME_HOST_OPTION_BITMASK_DOTILEDROPS); - case eGameHostOption_NaturalRegeneration: - return !(uiHostSettings & GAME_HOST_OPTION_BITMASK_NATURALREGEN); - case eGameHostOption_DoDaylightCycle: - return !(uiHostSettings & GAME_HOST_OPTION_BITMASK_DODAYLIGHTCYCLE); - break; - default: - return 0; - } - return false; -} -bool Game::CanRecordStatsAndAchievements() { - ZoneScopedN("Game::CanRecordStatsAndAchievements"); - bool isTutorial = Minecraft::GetInstance() != nullptr && - Minecraft::GetInstance()->isTutorial(); - // 4J Stu - All of these options give the host player some advantage, so - // should not allow achievements - return !(app.GetGameHostOption(eGameHostOption_HasBeenInCreative) || - app.GetGameHostOption(eGameHostOption_HostCanBeInvisible) || - app.GetGameHostOption(eGameHostOption_HostCanChangeHunger) || - app.GetGameHostOption(eGameHostOption_HostCanFly) || - app.GetGameHostOption(eGameHostOption_WasntSaveOwner) || - !app.GetGameHostOption(eGameHostOption_MobGriefing) || - app.GetGameHostOption(eGameHostOption_KeepInventory) || - !app.GetGameHostOption(eGameHostOption_DoMobSpawning) || - (!app.GetGameHostOption(eGameHostOption_DoDaylightCycle) && - !isTutorial)); -} void Game::processSchematics(LevelChunk* levelChunk) { ZoneScopedN("Game::processSchematics"); @@ -6338,256 +460,16 @@ const wchar_t* Game::GetGameRulesString(const std::wstring& key) { return m_gameRules.GetGameRulesString(key); } -unsigned char Game::m_szPNG[8] = {137, 80, 78, 71, 13, 10, 26, 10}; -#define PNG_TAG_tEXt 0x74455874 -unsigned int Game::FromBigEndian(unsigned int uiValue) { - ZoneScopedN("Game::FromBigEndian"); - unsigned int uiReturn = - ((uiValue >> 24) & 0x000000ff) | ((uiValue >> 8) & 0x0000ff00) | - ((uiValue << 8) & 0x00ff0000) | ((uiValue << 24) & 0xff000000); - return uiReturn; -} +// PNG_TAG_tEXt, FromBigEndian, GetImageTextData, CreateImageTextData moved to MenuController -void Game::GetImageTextData(std::uint8_t* imageData, - unsigned int imageBytes, - unsigned char* seedText, - unsigned int& uiHostOptions, - bool& bHostOptionsRead, - std::uint32_t& uiTexturePack) { - ZoneScopedN("Game::GetImageTextData"); - auto readPngUInt32 = [](const std::uint8_t* data) -> unsigned int { - unsigned int value = 0; - std::memcpy(&value, data, sizeof(value)); - return value; - }; - std::uint8_t* ucPtr = imageData; - unsigned int uiCount = 0; - unsigned int uiChunkLen; - unsigned int uiChunkType; - unsigned int uiCRC; - char szKeyword[80]; - // check it's a png - for (int i = 0; i < 8; i++) { - if (m_szPNG[i] != ucPtr[i]) return; - } - uiCount += 8; - while (uiCount < imageBytes) { - uiChunkLen = FromBigEndian(readPngUInt32(&ucPtr[uiCount])); - uiCount += sizeof(int); - uiChunkType = FromBigEndian(readPngUInt32(&ucPtr[uiCount])); - uiCount += sizeof(int); - if (uiChunkType == PNG_TAG_tEXt) // tEXt - { - // check that it's the 4J text - unsigned char* pszKeyword = &ucPtr[uiCount]; - while (pszKeyword < ucPtr + uiCount + uiChunkLen) { - memset(szKeyword, 0, 80); - unsigned int uiKeywordC = 0; - while (*pszKeyword != 0) { - szKeyword[uiKeywordC++] = *pszKeyword; - pszKeyword++; - } - pszKeyword++; - if (strcmp(szKeyword, "4J_SEED") == 0) { - // read the seed value - unsigned int uiValueC = 0; - while (*pszKeyword != 0 && - (pszKeyword < ucPtr + uiCount + uiChunkLen)) { - seedText[uiValueC++] = *pszKeyword; - pszKeyword++; - } - // memcpy(seedText,pszKeyword,uiChunkLen-8); - } else if (strcmp(szKeyword, "4J_HOSTOPTIONS") == 0) { - bHostOptionsRead = true; - // read the host options value - unsigned int uiValueC = 0; - unsigned char pszHostOptions[9]; // Hex representation of - // unsigned int - memset(&pszHostOptions, 0, 9); - while (*pszKeyword != 0 && - (pszKeyword < ucPtr + uiCount + uiChunkLen) && - uiValueC < 8) { - pszHostOptions[uiValueC++] = *pszKeyword; - pszKeyword++; - } - uiHostOptions = 0; - std::stringstream ss; - ss << pszHostOptions; - ss >> std::hex >> uiHostOptions; - } else if (strcmp(szKeyword, "4J_TEXTUREPACK") == 0) { - // read the texture pack value - unsigned int uiValueC = 0; - unsigned char pszTexturePack[9]; // Hex representation of - // unsigned int - memset(&pszTexturePack, 0, 9); - while (*pszKeyword != 0 && - (pszKeyword < ucPtr + uiCount + uiChunkLen) && - uiValueC < 8) { - pszTexturePack[uiValueC++] = *pszKeyword; - pszKeyword++; - } - - std::stringstream ss; - ss << pszTexturePack; - ss >> std::hex >> uiTexturePack; - } - } - } - uiCount += uiChunkLen; - uiCRC = FromBigEndian(readPngUInt32(&ucPtr[uiCount])); - uiCount += sizeof(int); - } - - return; -} - -unsigned int Game::CreateImageTextData(std::uint8_t* textMetadata, - int64_t seed, bool hasSeed, - unsigned int uiHostOptions, - unsigned int uiTexturePackId) { - ZoneScopedN("Game::CreateImageTextData"); - int iTextMetadataBytes = 0; - if (hasSeed) { - strcpy((char*)textMetadata, "4J_SEED"); - snprintf((char*)&textMetadata[8], 42, "%lld", (long long)seed); - - // get the length - iTextMetadataBytes += 8; - while (textMetadata[iTextMetadataBytes] != 0) iTextMetadataBytes++; - ++iTextMetadataBytes; // Add a null terminator at the end of the seed - // value - } - - // Save the host options that this world was last played with - strcpy((char*)&textMetadata[iTextMetadataBytes], "4J_HOSTOPTIONS"); - snprintf((char*)&textMetadata[iTextMetadataBytes + 15], 9, "%X", - uiHostOptions); - - iTextMetadataBytes += 15; - while (textMetadata[iTextMetadataBytes] != 0) iTextMetadataBytes++; - ++iTextMetadataBytes; // Add a null terminator at the end of the host - // options value - - // Save the texture pack id - strcpy((char*)&textMetadata[iTextMetadataBytes], "4J_TEXTUREPACK"); - snprintf((char*)&textMetadata[iTextMetadataBytes + 15], 9, "%X", - uiHostOptions); - - iTextMetadataBytes += 15; - while (textMetadata[iTextMetadataBytes] != 0) iTextMetadataBytes++; - - return iTextMetadataBytes; -} - -void Game::AddTerrainFeaturePosition(_eTerrainFeatureType eFeatureType, - int x, int z) { - ZoneScopedN("Game::AddTerrainFeaturePosition"); - // check we don't already have this in - for (auto it = m_vTerrainFeatures.begin(); it < m_vTerrainFeatures.end(); - ++it) { - FEATURE_DATA* pFeatureData = *it; - - if ((pFeatureData->eTerrainFeature == eFeatureType) && - (pFeatureData->x == x) && (pFeatureData->z == z)) - return; - } - - FEATURE_DATA* pFeatureData = new FEATURE_DATA; - pFeatureData->eTerrainFeature = eFeatureType; - pFeatureData->x = x; - pFeatureData->z = z; - - m_vTerrainFeatures.push_back(pFeatureData); -} - -_eTerrainFeatureType Game::IsTerrainFeature(int x, int z) { - ZoneScopedN("Game::IsTerrainFeature"); - for (auto it = m_vTerrainFeatures.begin(); it < m_vTerrainFeatures.end(); - ++it) { - FEATURE_DATA* pFeatureData = *it; - - if ((pFeatureData->x == x) && (pFeatureData->z == z)) - return pFeatureData->eTerrainFeature; - } - - return eTerrainFeature_None; -} - -bool Game::GetTerrainFeaturePosition(_eTerrainFeatureType eType, - int* pX, int* pZ) { - ZoneScopedN("Game::GetTerrainFeaturePosition"); - for (auto it = m_vTerrainFeatures.begin(); it < m_vTerrainFeatures.end(); - ++it) { - FEATURE_DATA* pFeatureData = *it; - - if (pFeatureData->eTerrainFeature == eType) { - *pX = pFeatureData->x; - *pZ = pFeatureData->z; - return true; - } - } - - return false; -} - -void Game::ClearTerrainFeaturePosition() { - ZoneScopedN("Game::ClearTerrainFeaturePosition"); - FEATURE_DATA* pFeatureData; - while (m_vTerrainFeatures.size() > 0) { - pFeatureData = m_vTerrainFeatures.back(); - m_vTerrainFeatures.pop_back(); - delete pFeatureData; - } -} - -void Game::UpdatePlayerInfo(std::uint8_t networkSmallId, - int16_t playerColourIndex, - unsigned int playerGamePrivileges) { - ZoneScopedN("Game::UpdatePlayerInfo"); - for (unsigned int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; ++i) { - if (m_playerColours[i] == networkSmallId) { - m_playerColours[i] = 0; - m_playerGamePrivileges[i] = 0; - } - } - if (playerColourIndex >= 0 && - playerColourIndex < MINECRAFT_NET_MAX_PLAYERS) { - m_playerColours[playerColourIndex] = networkSmallId; - m_playerGamePrivileges[playerColourIndex] = playerGamePrivileges; - } -} - -short Game::GetPlayerColour(std::uint8_t networkSmallId) { - ZoneScopedN("Game::GetPlayerColour"); - short index = -1; - for (unsigned int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; ++i) { - if (m_playerColours[i] == networkSmallId) { - index = i; - break; - } - } - return index; -} - -unsigned int Game::GetPlayerPrivileges(std::uint8_t networkSmallId) { - ZoneScopedN("Game::GetPlayerPrivileges"); - unsigned int privileges = 0; - for (unsigned int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; ++i) { - if (m_playerColours[i] == networkSmallId) { - privileges = m_playerGamePrivileges[i]; - break; - } - } - return privileges; -} std::wstring Game::getEntityName(eINSTANCEOF type) { ZoneScopedN("Game::getEntityName"); @@ -6642,745 +524,110 @@ std::wstring Game::getEntityName(eINSTANCEOF type) { return L""; } -std::uint32_t Game::m_dwContentTypeA[e_Marketplace_MAX] = { - XMARKETPLACE_OFFERING_TYPE_CONTENT, // e_DLC_SkinPack, e_DLC_TexturePacks, - // e_DLC_MashupPacks - XMARKETPLACE_OFFERING_TYPE_THEME, // e_DLC_Themes - XMARKETPLACE_OFFERING_TYPE_AVATARITEM, // e_DLC_AvatarItems - XMARKETPLACE_OFFERING_TYPE_TILE, // e_DLC_Gamerpics -}; +// m_dwContentTypeA moved to DLCController -unsigned int Game::AddDLCRequest(eDLCMarketplaceType eType, - bool bPromote) { - ZoneScopedN("Game::AddDLCRequest"); - // lock access - { - std::lock_guard lock(csDLCDownloadQueue); - // If it's already in there, promote it to the top of the list - int iPosition = 0; - for (auto it = m_DLCDownloadQueue.begin(); - it != m_DLCDownloadQueue.end(); ++it) { - DLCRequest* pCurrent = *it; - if (pCurrent->dwType == m_dwContentTypeA[eType]) { - // already got this in the list - if (pCurrent->eState == e_DLC_ContentState_Retrieving || - pCurrent->eState == e_DLC_ContentState_Retrieved) { - // already retrieved this - return 0; - } else { - // promote - if (bPromote) { - m_DLCDownloadQueue.erase(m_DLCDownloadQueue.begin() + - iPosition); - m_DLCDownloadQueue.insert(m_DLCDownloadQueue.begin(), - pCurrent); - } - return 0; - } - } - iPosition++; - } - DLCRequest* pDLCreq = new DLCRequest; - pDLCreq->dwType = m_dwContentTypeA[eType]; - pDLCreq->eState = e_DLC_ContentState_Idle; - m_DLCDownloadQueue.push_back(pDLCreq); +int32_t Game::RegisterMojangData(wchar_t* pXuidName, PlayerUID xuid, + wchar_t* pSkin, wchar_t* pCape) { + int32_t hr = 0; + eXUID eTempXuid = eXUID_Undefined; + MOJANG_DATA* pMojangData = nullptr; - m_bAllDLCContentRetrieved = false; - } - - app.DebugPrintf("[Consoles_App] Added DLC request.\n"); - return 1; -} - -unsigned int Game::AddTMSPPFileTypeRequest(eDLCContentType eType, - bool bPromote) { - ZoneScopedN("Game::AddTMSPPFileTypeRequest"); - // lock access - std::lock_guard lock(csTMSPPDownloadQueue); - - // If it's already in there, promote it to the top of the list - int iPosition = 0; - // ignore promoting for now - /* - bool bPromoted=false; - - - for(auto it = m_TMSPPDownloadQueue.begin(); it != - m_TMSPPDownloadQueue.end(); ++it) - { - TMSPPRequest *pCurrent = *it; - - if(pCurrent->eType==eType) - { - if(!(pCurrent->eState == e_TMS_ContentState_Retrieving || pCurrent->eState - == e_TMS_ContentState_Retrieved)) - { - // promote - if(bPromote) - { - m_TMSPPDownloadQueue.erase(m_TMSPPDownloadQueue.begin()+iPosition); - m_TMSPPDownloadQueue.insert(m_TMSPPDownloadQueue.begin(),pCurrent); - bPromoted=true; - } - } - } - iPosition++; - } - - if(bPromoted) - { - // re-ordered the list, so leave now - return 0; - } - */ - - // special case for data files (not image files) - if (eType == e_DLC_TexturePackData) { - int iCount = GetDLCInfoFullOffersCount(); - - for (int i = 0; i < iCount; i++) { - DLC_INFO* pDLC = GetDLCInfoFullOffer(i); - - if ((pDLC->eDLCType == e_DLC_TexturePacks) || - (pDLC->eDLCType == e_DLC_MashupPacks)) { - // first check if the image is already in the memory textures, - // since we might be loading some from the Title Update - // partition - if (pDLC->wchDataFile[0] != 0) { - // wchar_t *cString = pDLC->wchDataFile; - // 4J-PB - shouldn't check this here - let the TMS files - // override it, so if they are on TMS, we'll take them - // first - // int iIndex = - // app.GetLocalTMSFileIndex(pDLC->wchDataFile,true); - - // if(iIndex!=-1) - { - bool bPresent = app.IsFileInTPD(pDLC->iConfig); - - if (!bPresent) { - // this may already be present in the vector because - // of a previous trial/full offer - - bool bAlreadyInQueue = false; - for (auto it = m_TMSPPDownloadQueue.begin(); - it != m_TMSPPDownloadQueue.end(); ++it) { - TMSPPRequest* pCurrent = *it; - - if (wcscmp(pDLC->wchDataFile, - pCurrent->wchFilename) == 0) { - bAlreadyInQueue = true; - break; - } - } - - if (!bAlreadyInQueue) { - TMSPPRequest* pTMSPPreq = new TMSPPRequest; - - pTMSPPreq->CallbackFunc = - &Game::TMSPPFileReturned; - pTMSPPreq->lpCallbackParam = this; - pTMSPPreq->eStorageFacility = - C4JStorage::eGlobalStorage_Title; - pTMSPPreq->eFileTypeVal = - C4JStorage::TMS_FILETYPE_BINARY; - memcpy(pTMSPPreq->wchFilename, - pDLC->wchDataFile, - sizeof(wchar_t) * MAX_BANNERNAME_SIZE); - pTMSPPreq->eType = e_DLC_TexturePackData; - pTMSPPreq->eState = e_TMS_ContentState_Queued; - m_bAllTMSContentRetrieved = false; - m_TMSPPDownloadQueue.push_back(pTMSPPreq); - } - } else { - app.DebugPrintf( - "Texture data already present in the TPD\n"); - } - } - } - } - } - } else { // for all the files of type eType, add them to the download list - - // run through the trial offers first, then the full offers. Any - // duplicates won't be added to the download queue - int iCount; - // and the full offers - - iCount = GetDLCInfoFullOffersCount(); - for (int i = 0; i < iCount; i++) { - DLC_INFO* pDLC = GetDLCInfoFullOffer(i); - // if(wcscmp(pDLC->wchType,wchDLCTypeNames[eType])==0) - if (pDLC->eDLCType == eType) { - // first check if the image is already in the memory textures, - // since we might be loading some from the Title Update - // partition - - wchar_t* cString = pDLC->wchBanner; - // 4J-PB - shouldn't check this here - let the TMS files - // override it, so if they are on TMS, we'll take them first - // int iIndex = app.GetLocalTMSFileIndex(cString,true); - - // if(iIndex!=-1) - { - bool bPresent = app.IsFileInMemoryTextures(cString); - - if (!bPresent) { - // this may already be present in the vector because of - // a previous trial/full offer - - bool bAlreadyInQueue = false; - for (auto it = m_TMSPPDownloadQueue.begin(); - it != m_TMSPPDownloadQueue.end(); ++it) { - TMSPPRequest* pCurrent = *it; - - if (wcscmp(pDLC->wchBanner, - pCurrent->wchFilename) == 0) { - bAlreadyInQueue = true; - break; - } - } - - if (!bAlreadyInQueue) { - // app.DebugPrintf("Adding a request to the TMSPP - // download queue - %ls\n",pDLC->wchBanner); - TMSPPRequest* pTMSPPreq = new TMSPPRequest; - memset(pTMSPPreq, 0, sizeof(TMSPPRequest)); - - pTMSPPreq->CallbackFunc = - &Game::TMSPPFileReturned; - pTMSPPreq->lpCallbackParam = this; - // 4J-PB - testing for now - // pTMSPPreq->eStorageFacility=C4JStorage::eGlobalStorage_TitleUser; - pTMSPPreq->eStorageFacility = - C4JStorage::eGlobalStorage_Title; - pTMSPPreq->eFileTypeVal = - C4JStorage::TMS_FILETYPE_BINARY; - // wcstombs(pTMSPPreq->szFilename,pDLC->wchBanner,MAX_TMSFILENAME_SIZE); - - memcpy(pTMSPPreq->wchFilename, pDLC->wchBanner, - sizeof(wchar_t) * MAX_BANNERNAME_SIZE); - pTMSPPreq->eType = eType; - pTMSPPreq->eState = e_TMS_ContentState_Queued; - m_bAllTMSContentRetrieved = false; - m_TMSPPDownloadQueue.push_back(pTMSPPreq); - app.DebugPrintf( - "===m_TMSPPDownloadQueue Adding %ls, q size is " - "%d\n", - pTMSPPreq->wchFilename, - m_TMSPPDownloadQueue.size()); - } - } - } - } - } - } - - return 1; -} - -bool Game::CheckTMSDLCCanStop() { - ZoneScopedN("Game::CheckTMSDLCCanStop"); - std::lock_guard lock(csTMSPPDownloadQueue); - for (auto it = m_TMSPPDownloadQueue.begin(); - it != m_TMSPPDownloadQueue.end(); ++it) { - TMSPPRequest* pCurrent = *it; - - if (pCurrent->eState == e_TMS_ContentState_Retrieving) { - return false; - } - } - - return true; -} - -bool Game::RetrieveNextDLCContent() { - ZoneScopedN("Game::RetrieveNextDLCContent"); - // If there's already a retrieve in progress, quit - // we may have re-ordered the list, so need to check every item - - // is there a primary player and a network connection? - int primPad = ProfileManager.GetPrimaryPad(); - if (primPad == -1 || !ProfileManager.IsSignedInLive(primPad)) { - return true; // 4J-JEV: We need to wait until the primary player is - // online. - } - - { - std::lock_guard lock(csDLCDownloadQueue); - for (auto it = m_DLCDownloadQueue.begin(); - it != m_DLCDownloadQueue.end(); ++it) { - DLCRequest* pCurrent = *it; - - if (pCurrent->eState == e_DLC_ContentState_Retrieving) { - return true; - } - } - - // Now look for the next retrieval - for (auto it = m_DLCDownloadQueue.begin(); - it != m_DLCDownloadQueue.end(); ++it) { - DLCRequest* pCurrent = *it; - - if (pCurrent->eState == e_DLC_ContentState_Idle) { -#if defined(_DEBUG) - app.DebugPrintf("RetrieveNextDLCContent - type = %d\n", - pCurrent->dwType); -#endif - - C4JStorage::EDLCStatus status = StorageManager.GetDLCOffers( - ProfileManager.GetPrimaryPad(), - [this](int iOfferC, std::uint32_t dwType, int pad) { - return dlcOffersReturned(iOfferC, dwType, pad); - }, - pCurrent->dwType); - if (status == C4JStorage::EDLC_Pending) { - pCurrent->eState = e_DLC_ContentState_Retrieving; - } else { - // no content of this type, or some other problem - app.DebugPrintf("RetrieveNextDLCContent - PROBLEM\n"); - pCurrent->eState = e_DLC_ContentState_Retrieved; - } - return true; - } - } - } - - app.DebugPrintf("[Consoles_App] Finished downloading dlc content.\n"); - return false; -} - -int Game::TMSPPFileReturned(void* pParam, int iPad, int iUserData, - C4JStorage::PTMSPP_FILEDATA pFileData, - const char* szFilename) { - ZoneScopedN("Game::TMSPPFileReturned"); - Game* pClass = (Game*)pParam; - - // find the right one in the vector - { - std::lock_guard lock(pClass->csTMSPPDownloadQueue); - for (auto it = pClass->m_TMSPPDownloadQueue.begin(); - it != pClass->m_TMSPPDownloadQueue.end(); ++it) { - TMSPPRequest* pCurrent = *it; -#if defined(_WINDOWS64) - char szFile[MAX_TMSFILENAME_SIZE]; - wcstombs(szFile, pCurrent->wchFilename, MAX_TMSFILENAME_SIZE); - - if (strcmp(szFilename, szFile) == 0) -#endif - { - // set this to retrieved whether it found it or not - pCurrent->eState = e_TMS_ContentState_Retrieved; - - if (pFileData != nullptr) { - switch (pCurrent->eType) { - case e_DLC_TexturePackData: { - app.DebugPrintf("--- Got texturepack data %ls\n", - pCurrent->wchFilename); - // get the config value for the texture pack - int iConfig = - app.GetTPConfigVal(pCurrent->wchFilename); - app.AddMemoryTPDFile(iConfig, pFileData->pbData, - pFileData->size); - } break; - default: - app.DebugPrintf("--- Got image data - %ls\n", - pCurrent->wchFilename); - app.AddMemoryTextureFile(pCurrent->wchFilename, - pFileData->pbData, - pFileData->size); - break; - } - } else { - app.DebugPrintf("TMSImageReturned failed (%s)...\n", - szFilename); - } - break; - } - } - } - - return 0; -} - -bool Game::RetrieveNextTMSPPContent() { return false; } - -void Game::TickDLCOffersRetrieved() { - ZoneScopedN("Game::TickDLCOffersRetrieved"); - if (!m_bAllDLCContentRetrieved) { - if (!app.RetrieveNextDLCContent()) { - app.DebugPrintf("[Consoles_App] All content retrieved.\n"); - m_bAllDLCContentRetrieved = true; - } - } -} -void Game::ClearAndResetDLCDownloadQueue() { - ZoneScopedN("Game::ClearAndResetDLCDownloadQueue"); - app.DebugPrintf("[Consoles_App] Clear and reset download queue.\n"); - - int iPosition = 0; - { - std::lock_guard lock(csTMSPPDownloadQueue); - for (auto it = m_DLCDownloadQueue.begin(); - it != m_DLCDownloadQueue.end(); ++it) { - DLCRequest* pCurrent = *it; - - delete pCurrent; - iPosition++; - } - m_DLCDownloadQueue.clear(); - m_bAllDLCContentRetrieved = true; - } -} - -void Game::TickTMSPPFilesRetrieved() { - ZoneScopedN("Game::TickTMSPPFilesRetrieved"); - if (m_bTickTMSDLCFiles && !m_bAllTMSContentRetrieved) { - if (app.RetrieveNextTMSPPContent() == false) { - m_bAllTMSContentRetrieved = true; - } - } -} -void Game::ClearTMSPPFilesRetrieved() { - ZoneScopedN("Game::ClearTMSPPFilesRetrieved"); - int iPosition = 0; - { - std::lock_guard lock(csTMSPPDownloadQueue); - for (auto it = m_TMSPPDownloadQueue.begin(); - it != m_TMSPPDownloadQueue.end(); ++it) { - TMSPPRequest* pCurrent = *it; - - delete pCurrent; - iPosition++; - } - m_TMSPPDownloadQueue.clear(); - m_bAllTMSContentRetrieved = true; - } -} - -int Game::dlcOffersReturned(int iOfferC, std::uint32_t dwType, - int iPad) { - ZoneScopedN("Game::dlcOffersReturned"); - // find the right one in the vector - { - std::lock_guard lock(csTMSPPDownloadQueue); - for (auto it = m_DLCDownloadQueue.begin(); - it != m_DLCDownloadQueue.end(); ++it) { - DLCRequest* pCurrent = *it; - - // avatar items are coming back as type Content, so we can't trust - // the type setting - if (pCurrent->dwType == static_cast(dwType)) { - m_iDLCOfferC = iOfferC; - DebugPrintf( - "DLCOffersReturned - type %u, count %d - setting to " - "retrieved\n", - dwType, iOfferC); - pCurrent->eState = e_DLC_ContentState_Retrieved; - break; - } - } - } - return 0; -} - -eDLCContentType Game::Find_eDLCContentType(std::uint32_t dwType) { - ZoneScopedN("Game::Find_eDLCContentType"); - for (int i = 0; i < e_DLC_MAX; i++) { - if (m_dwContentTypeA[i] == dwType) { - return (eDLCContentType)i; - } - } - return (eDLCContentType)0; -} -bool Game::DLCContentRetrieved(eDLCMarketplaceType eType) { - ZoneScopedN("Game::DLCContentRetrieved"); - // If there's already a retrieve in progress, quit - // we may have re-ordered the list, so need to check every item - std::lock_guard lock(csDLCDownloadQueue); - for (auto it = m_DLCDownloadQueue.begin(); it != m_DLCDownloadQueue.end(); - ++it) { - DLCRequest* pCurrent = *it; - - if ((pCurrent->dwType == m_dwContentTypeA[eType]) && - (pCurrent->eState == e_DLC_ContentState_Retrieved)) { - return true; - } - } - return false; -} - -void Game::SetAdditionalSkinBoxes(std::uint32_t dwSkinID, - SKIN_BOX* SkinBoxA, - unsigned int dwSkinBoxC) { - ZoneScopedN("Game::SetAdditionalSkinBoxes"); - EntityRenderer* renderer = - EntityRenderDispatcher::instance->getRenderer(eTYPE_PLAYER); - Model* pModel = renderer->getModel(); - std::vector* pvModelPart = new std::vector; - std::vector* pvSkinBoxes = new std::vector; - - { - std::lock_guard lock_mp(csAdditionalModelParts); - std::lock_guard lock_sb(csAdditionalSkinBoxes); - - app.DebugPrintf( - "*** SetAdditionalSkinBoxes - Inserting model parts for skin %d " - "from " - "array of Skin Boxes\n", - dwSkinID & 0x0FFFFFFF); - - // convert the skin boxes into model parts, and add to the humanoid - // model - for (unsigned int i = 0; i < dwSkinBoxC; i++) { - if (pModel) { - ModelPart* pModelPart = pModel->AddOrRetrievePart(&SkinBoxA[i]); - pvModelPart->push_back(pModelPart); - pvSkinBoxes->push_back(&SkinBoxA[i]); - } - } - - m_AdditionalModelParts.insert( - std::pair*>(dwSkinID, - pvModelPart)); - m_AdditionalSkinBoxes.insert( - std::pair*>(dwSkinID, - pvSkinBoxes)); - } -} - -std::vector* Game::SetAdditionalSkinBoxes( - std::uint32_t dwSkinID, std::vector* pvSkinBoxA) { - ZoneScopedN("Game::SetAdditionalSkinBoxes"); - EntityRenderer* renderer = - EntityRenderDispatcher::instance->getRenderer(eTYPE_PLAYER); - Model* pModel = renderer->getModel(); - std::vector* pvModelPart = new std::vector; - - { - std::lock_guard lock_mp(csAdditionalModelParts); - std::lock_guard lock_sb(csAdditionalSkinBoxes); - app.DebugPrintf( - "*** SetAdditionalSkinBoxes - Inserting model parts for skin %d " - "from " - "array of Skin Boxes\n", - dwSkinID & 0x0FFFFFFF); - - // convert the skin boxes into model parts, and add to the humanoid - // model - for (auto it = pvSkinBoxA->begin(); it != pvSkinBoxA->end(); ++it) { - if (pModel) { - ModelPart* pModelPart = pModel->AddOrRetrievePart(*it); - pvModelPart->push_back(pModelPart); - } - } - - m_AdditionalModelParts.insert( - std::pair*>(dwSkinID, - pvModelPart)); - m_AdditionalSkinBoxes.insert( - std::pair*>(dwSkinID, - pvSkinBoxA)); - } - return pvModelPart; -} - -std::vector* Game::GetAdditionalModelParts( - std::uint32_t dwSkinID) { - ZoneScopedN("Game::GetAdditionalModelParts"); - std::lock_guard lock(csAdditionalModelParts); - std::vector* pvModelParts = nullptr; - if (m_AdditionalModelParts.size() > 0) { - auto it = m_AdditionalModelParts.find(dwSkinID); - if (it != m_AdditionalModelParts.end()) { - pvModelParts = (*it).second; - } - } - - return pvModelParts; -} - -std::vector* Game::GetAdditionalSkinBoxes( - std::uint32_t dwSkinID) { - ZoneScopedN("Game::GetAdditionalSkinBoxes"); - std::lock_guard lock(csAdditionalSkinBoxes); - std::vector* pvSkinBoxes = nullptr; - if (m_AdditionalSkinBoxes.size() > 0) { - auto it = m_AdditionalSkinBoxes.find(dwSkinID); - if (it != m_AdditionalSkinBoxes.end()) { - pvSkinBoxes = (*it).second; - } - } - - return pvSkinBoxes; -} - -unsigned int Game::GetAnimOverrideBitmask(std::uint32_t dwSkinID) { - ZoneScopedN("Game::GetAnimOverrideBitmask"); - std::lock_guard lock(csAnimOverrideBitmask); - unsigned int uiAnimOverrideBitmask = 0L; - - if (m_AnimOverrides.size() > 0) { - auto it = m_AnimOverrides.find(dwSkinID); - if (it != m_AnimOverrides.end()) { - uiAnimOverrideBitmask = (*it).second; - } - } - - return uiAnimOverrideBitmask; -} - -void Game::SetAnimOverrideBitmask(std::uint32_t dwSkinID, - unsigned int uiAnimOverrideBitmask) { - ZoneScopedN("Game::SetAnimOverrideBitmask"); - // Make thread safe - std::lock_guard lock(csAnimOverrideBitmask); - - if (m_AnimOverrides.size() > 0) { - auto it = m_AnimOverrides.find(dwSkinID); - if (it != m_AnimOverrides.end()) { - return; // already in here - } - } - m_AnimOverrides.insert(std::pair( - dwSkinID, uiAnimOverrideBitmask)); -} - -std::uint32_t Game::getSkinIdFromPath(const std::wstring& skin) { - ZoneScopedN("Game::getSkinIdFromPath"); - bool dlcSkin = false; - unsigned int skinId = 0; - - if (skin.size() >= 14) { - dlcSkin = skin.substr(0, 3).compare(L"dlc") == 0; - - std::wstring skinValue = skin.substr(7, skin.size()); - skinValue = skinValue.substr(0, skinValue.find_first_of(L'.')); - - std::wstringstream ss; - // 4J Stu - dlc skins are numbered using decimal to make it easier for - // artists/people to number manually Everything else is numbered using - // hex - if (dlcSkin) - ss << std::dec << skinValue.c_str(); - else - ss << std::hex << skinValue.c_str(); - ss >> skinId; - - skinId = MAKE_SKIN_BITMASK(dlcSkin, skinId); - } - return skinId; -} - -std::wstring Game::getSkinPathFromId(std::uint32_t skinId) { - ZoneScopedN("Game::getSkinPathFromId"); - // 4J Stu - This function maps the encoded uint32_t we store in the player - // profile to a filename that is stored as a memory texture and shared - // between systems in game - wchar_t chars[256]; - if (GET_IS_DLC_SKIN_FROM_BITMASK(skinId)) { - // 4J Stu - DLC skins are numbered using decimal rather than hex to make - // it easier to number manually - swprintf(chars, 256, L"dlcskin%08d.png", - GET_DLC_SKIN_ID_FROM_BITMASK(skinId)); - - } else { - std::uint32_t ugcSkinIndex = GET_UGC_SKIN_ID_FROM_BITMASK(skinId); - std::uint32_t defaultSkinIndex = - GET_DEFAULT_SKIN_ID_FROM_BITMASK(skinId); - if (ugcSkinIndex == 0) { - swprintf(chars, 256, L"defskin%08X.png", defaultSkinIndex); + // ignore the names if we don't recognize them + if (pXuidName != nullptr) { + if (wcscmp(pXuidName, L"XUID_NOTCH") == 0) { + eTempXuid = + eXUID_Notch; // might be needed for the apple at some point + } else if (wcscmp(pXuidName, L"XUID_DEADMAU5") == 0) { + eTempXuid = eXUID_Deadmau5; // Needed for the deadmau5 ears } else { - swprintf(chars, 256, L"ugcskin%08X.png", ugcSkinIndex); + eTempXuid = eXUID_NoName; } } - return chars; + + if (eTempXuid != eXUID_Undefined) { + pMojangData = new MOJANG_DATA; + memset(pMojangData, 0, sizeof(MOJANG_DATA)); + pMojangData->eXuid = eTempXuid; + + wcsncpy(pMojangData->wchSkin, pSkin, MAX_CAPENAME_SIZE); + wcsncpy(pMojangData->wchCape, pCape, MAX_CAPENAME_SIZE); + DLCController::MojangData[xuid] = pMojangData; + } + + return hr; } -int Game::TexturePackDialogReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { - ZoneScopedN("Game::TexturePackDialogReturned"); - return 0; +MOJANG_DATA* Game::GetMojangDataForXuid(PlayerUID xuid) { + return DLCController::MojangData[xuid]; } -int Game::getArchiveFileSize(const std::wstring& filename) { - ZoneScopedN("Game::getArchiveFileSize"); - TexturePack* tPack = nullptr; - Minecraft* pMinecraft = Minecraft::GetInstance(); - if (pMinecraft && pMinecraft->skins) - tPack = pMinecraft->skins->getSelected(); - if (tPack && tPack->hasData() && tPack->getArchiveFile() && - tPack->getArchiveFile()->hasFile(filename)) { - return tPack->getArchiveFile()->getFileSize(filename); - } else - return m_mediaArchive->getFileSize(filename); +int32_t Game::RegisterConfigValues(wchar_t* pType, int iValue) { + int32_t hr = 0; + + // #ifdef 0 + // if(pType!=nullptr) + // { + // if(wcscmp(pType,L"XboxOneTransfer")==0) + // { + // if(iValue>0) + // { + // app.m_bTransferSavesToXboxOne=true; + // } + // else + // { + // app.m_bTransferSavesToXboxOne=false; + // } + // } + // else if(wcscmp(pType,L"TransferSlotCount")==0) + // { + // app.m_uiTransferSlotC=iValue; + // } + // + // } + // #endif + + return hr; } -bool Game::hasArchiveFile(const std::wstring& filename) { - ZoneScopedN("Game::hasArchiveFile"); - TexturePack* tPack = nullptr; - Minecraft* pMinecraft = Minecraft::GetInstance(); - if (pMinecraft && pMinecraft->skins) - tPack = pMinecraft->skins->getSelected(); - if (tPack && tPack->hasData() && tPack->getArchiveFile() && - tPack->getArchiveFile()->hasFile(filename)) - return true; - else - return m_mediaArchive->hasFile(filename); -} +#if defined(_WINDOWS64) +#elif defined(__linux__) +#else + +#endif + + + + + + + + + + + + + + + + + + -std::vector Game::getArchiveFile( - const std::wstring& filename) { - ZoneScopedN("Game::getArchiveFile"); - TexturePack* tPack = nullptr; - Minecraft* pMinecraft = Minecraft::GetInstance(); - if (pMinecraft && pMinecraft->skins) - tPack = pMinecraft->skins->getSelected(); - if (tPack && tPack->hasData() && tPack->getArchiveFile() && - tPack->getArchiveFile()->hasFile(filename)) { - return tPack->getArchiveFile()->getFile(filename); - } else - return m_mediaArchive->getFile(filename); -} // DLC -int Game::GetDLCInfoTrialOffersCount() { - ZoneScopedN("Game::GetDLCInfoTrialOffersCount"); - return (int)DLCInfo_Trial.size(); -} -int Game::GetDLCInfoFullOffersCount() { - ZoneScopedN("Game::GetDLCInfoFullOffersCount"); - return (int)DLCInfo_Full.size(); -} -int Game::GetDLCInfoTexturesOffersCount() { - ZoneScopedN("Game::GetDLCInfoTexturesOffersCount"); - return (int)DLCTextures_PackID.size(); -} // AUTOSAVE void Game::SetAutosaveTimerTime(void) { ZoneScopedN("Game::SetAutosaveTimerTime"); int settingValue = GetGameSettings(ProfileManager.GetPrimaryPad(), eGameSetting_Autosave); - m_uiAutosaveTimer = - time_util::clock::now() + - std::chrono::minutes(settingValue * 15); -} // value x 15 to get mins - -bool Game::AutosaveDue(void) { - ZoneScopedN("Game::AutosaveDue"); - return (time_util::clock::now() > m_uiAutosaveTimer); -} - -int64_t Game::SecondsToAutosave() { - ZoneScopedN("Game::SecondsToAutosave"); - return std::chrono::duration_cast(m_uiAutosaveTimer - time_util::clock::now()).count(); + m_saveManager.setAutosaveTimerTime(settingValue); } void Game::SetTrialTimerStart(void) { @@ -7429,384 +676,7 @@ bool Game::IsLocalMultiplayerAvailable() { // 4J-PB - language and locale function -void Game::getLocale(std::vector& vecWstrLocales) { - ZoneScopedN("Game::getLocale"); - std::vector locales; - - const unsigned int systemLanguage = XGetLanguage(); - - // 4J-PB - restrict the 360 language until we're ready to have them in - - switch (systemLanguage) { - case XC_LANGUAGE_ENGLISH: - switch (XGetLocale()) { - case XC_LOCALE_AUSTRALIA: - case XC_LOCALE_CANADA: - case XC_LOCALE_CZECH_REPUBLIC: - case XC_LOCALE_GREECE: - case XC_LOCALE_HONG_KONG: - case XC_LOCALE_HUNGARY: - case XC_LOCALE_INDIA: - case XC_LOCALE_IRELAND: - case XC_LOCALE_ISRAEL: - case XC_LOCALE_NEW_ZEALAND: - case XC_LOCALE_SAUDI_ARABIA: - case XC_LOCALE_SINGAPORE: - case XC_LOCALE_SLOVAK_REPUBLIC: - case XC_LOCALE_SOUTH_AFRICA: - case XC_LOCALE_UNITED_ARAB_EMIRATES: - case XC_LOCALE_GREAT_BRITAIN: - locales.push_back(eMCLang_enGB); - break; - default: // XC_LOCALE_UNITED_STATES - break; - } - break; - case XC_LANGUAGE_JAPANESE: - locales.push_back(eMCLang_jaJP); - break; - case XC_LANGUAGE_GERMAN: - switch (XGetLocale()) { - case XC_LOCALE_AUSTRIA: - locales.push_back(eMCLang_deAT); - break; - case XC_LOCALE_SWITZERLAND: - locales.push_back(eMCLang_deCH); - break; - default: // XC_LOCALE_GERMANY: - break; - } - locales.push_back(eMCLang_deDE); - break; - case XC_LANGUAGE_FRENCH: - switch (XGetLocale()) { - case XC_LOCALE_BELGIUM: - locales.push_back(eMCLang_frBE); - break; - case XC_LOCALE_CANADA: - locales.push_back(eMCLang_frCA); - break; - case XC_LOCALE_SWITZERLAND: - locales.push_back(eMCLang_frCH); - break; - default: // XC_LOCALE_FRANCE: - break; - } - locales.push_back(eMCLang_frFR); - break; - case XC_LANGUAGE_SPANISH: - switch (XGetLocale()) { - case XC_LOCALE_MEXICO: - case XC_LOCALE_ARGENTINA: - case XC_LOCALE_CHILE: - case XC_LOCALE_COLOMBIA: - case XC_LOCALE_UNITED_STATES: - case XC_LOCALE_LATIN_AMERICA: - locales.push_back(eMCLang_laLAS); - locales.push_back(eMCLang_esMX); - break; - default: // XC_LOCALE_SPAIN - break; - } - locales.push_back(eMCLang_esES); - break; - case XC_LANGUAGE_ITALIAN: - locales.push_back(eMCLang_itIT); - break; - case XC_LANGUAGE_KOREAN: - locales.push_back(eMCLang_koKR); - break; - case XC_LANGUAGE_TCHINESE: - switch (XGetLocale()) { - case XC_LOCALE_HONG_KONG: - locales.push_back(eMCLang_zhHK); - locales.push_back(eMCLang_zhTW); - break; - case XC_LOCALE_TAIWAN: - locales.push_back(eMCLang_zhTW); - locales.push_back(eMCLang_zhHK); - default: - break; - } - locales.push_back(eMCLang_hant); - locales.push_back(eMCLang_zhCHT); - break; - case XC_LANGUAGE_PORTUGUESE: - if (XGetLocale() == XC_LOCALE_BRAZIL) { - locales.push_back(eMCLang_ptBR); - } - locales.push_back(eMCLang_ptPT); - break; - case XC_LANGUAGE_POLISH: - locales.push_back(eMCLang_plPL); - break; - case XC_LANGUAGE_RUSSIAN: - locales.push_back(eMCLang_ruRU); - break; - case XC_LANGUAGE_SWEDISH: - locales.push_back(eMCLang_svSV); - locales.push_back(eMCLang_svSE); - break; - case XC_LANGUAGE_TURKISH: - locales.push_back(eMCLang_trTR); - break; - case XC_LANGUAGE_BNORWEGIAN: - locales.push_back(eMCLang_nbNO); - locales.push_back(eMCLang_noNO); - locales.push_back(eMCLang_nnNO); - break; - case XC_LANGUAGE_DUTCH: - switch (XGetLocale()) { - case XC_LOCALE_BELGIUM: - locales.push_back(eMCLang_nlBE); - break; - default: - break; - } - locales.push_back(eMCLang_nlNL); - break; - case XC_LANGUAGE_SCHINESE: - switch (XGetLocale()) { - case XC_LOCALE_SINGAPORE: - locales.push_back(eMCLang_zhSG); - break; - default: - break; - } - locales.push_back(eMCLang_hans); - locales.push_back(eMCLang_csCS); - locales.push_back(eMCLang_zhCN); - break; - } - - locales.push_back(eMCLang_enUS); - locales.push_back(eMCLang_null); - - for (int i = 0; i < locales.size(); i++) { - eMCLang lang = locales.at(i); - vecWstrLocales.push_back(m_localeA[lang]); - } -} - -int Game::get_eMCLang(wchar_t* pwchLocale) { - ZoneScopedN("Game::get_eMCLang"); - return m_eMCLangA[pwchLocale]; -} - -int Game::get_xcLang(wchar_t* pwchLocale) { - ZoneScopedN("Game::get_xcLang"); - return m_xcLangA[pwchLocale]; -} - -void Game::LocaleAndLanguageInit() { - ZoneScopedN("Game::LocaleAndLanguageInit"); - m_localeA[eMCLang_zhCHT] = L"zh-CHT"; - m_localeA[eMCLang_csCS] = L"cs-CS"; - m_localeA[eMCLang_laLAS] = L"la-LAS"; - m_localeA[eMCLang_null] = L"en-EN"; - m_localeA[eMCLang_enUS] = L"en-US"; - m_localeA[eMCLang_enGB] = L"en-GB"; - m_localeA[eMCLang_enIE] = L"en-IE"; - m_localeA[eMCLang_enAU] = L"en-AU"; - m_localeA[eMCLang_enNZ] = L"en-NZ"; - m_localeA[eMCLang_enCA] = L"en-CA"; - m_localeA[eMCLang_jaJP] = L"ja-JP"; - m_localeA[eMCLang_deDE] = L"de-DE"; - m_localeA[eMCLang_deAT] = L"de-AT"; - m_localeA[eMCLang_frFR] = L"fr-FR"; - m_localeA[eMCLang_frCA] = L"fr-CA"; - m_localeA[eMCLang_esES] = L"es-ES"; - m_localeA[eMCLang_esMX] = L"es-MX"; - m_localeA[eMCLang_itIT] = L"it-IT"; - m_localeA[eMCLang_koKR] = L"ko-KR"; - m_localeA[eMCLang_ptPT] = L"pt-PT"; - m_localeA[eMCLang_ptBR] = L"pt-BR"; - m_localeA[eMCLang_ruRU] = L"ru-RU"; - m_localeA[eMCLang_nlNL] = L"nl-NL"; - m_localeA[eMCLang_fiFI] = L"fi-FI"; - m_localeA[eMCLang_svSV] = L"sv-SV"; - m_localeA[eMCLang_daDA] = L"da-DA"; - m_localeA[eMCLang_noNO] = L"no-NO"; - m_localeA[eMCLang_plPL] = L"pl-PL"; - m_localeA[eMCLang_trTR] = L"tr-TR"; - m_localeA[eMCLang_elEL] = L"el-EL"; - - m_localeA[eMCLang_zhSG] = L"zh-SG"; - m_localeA[eMCLang_zhCN] = L"zh-CN"; - m_localeA[eMCLang_zhHK] = L"zh-HK"; - m_localeA[eMCLang_zhTW] = L"zh-TW"; - m_localeA[eMCLang_nlBE] = L"nl-BE"; - m_localeA[eMCLang_daDK] = L"da-DK"; - m_localeA[eMCLang_frBE] = L"fr-BE"; - m_localeA[eMCLang_frCH] = L"fr-CH"; - m_localeA[eMCLang_deCH] = L"de-CH"; - m_localeA[eMCLang_nbNO] = L"nb-NO"; - m_localeA[eMCLang_enGR] = L"en-GR"; - m_localeA[eMCLang_enHK] = L"en-HK"; - m_localeA[eMCLang_enSA] = L"en-SA"; - m_localeA[eMCLang_enHU] = L"en-HU"; - m_localeA[eMCLang_enIN] = L"en-IN"; - m_localeA[eMCLang_enIL] = L"en-IL"; - m_localeA[eMCLang_enSG] = L"en-SG"; - m_localeA[eMCLang_enSK] = L"en-SK"; - m_localeA[eMCLang_enZA] = L"en-ZA"; - m_localeA[eMCLang_enCZ] = L"en-CZ"; - m_localeA[eMCLang_enAE] = L"en-AE"; - m_localeA[eMCLang_esAR] = L"es-AR"; - m_localeA[eMCLang_esCL] = L"es-CL"; - m_localeA[eMCLang_esCO] = L"es-CO"; - m_localeA[eMCLang_esUS] = L"es-US"; - m_localeA[eMCLang_svSE] = L"sv-SE"; - - m_localeA[eMCLang_csCZ] = L"cs-CZ"; - m_localeA[eMCLang_elGR] = L"el-GR"; - m_localeA[eMCLang_nnNO] = L"nn-NO"; - m_localeA[eMCLang_skSK] = L"sk-SK"; - - m_localeA[eMCLang_hans] = L"zh-HANS"; - m_localeA[eMCLang_hant] = L"zh-HANT"; - - m_eMCLangA[L"zh-CHT"] = eMCLang_zhCHT; - m_eMCLangA[L"cs-CS"] = eMCLang_csCS; - m_eMCLangA[L"la-LAS"] = eMCLang_laLAS; - m_eMCLangA[L"en-EN"] = eMCLang_null; - m_eMCLangA[L"en-US"] = eMCLang_enUS; - m_eMCLangA[L"en-GB"] = eMCLang_enGB; - m_eMCLangA[L"en-IE"] = eMCLang_enIE; - m_eMCLangA[L"en-AU"] = eMCLang_enAU; - m_eMCLangA[L"en-NZ"] = eMCLang_enNZ; - m_eMCLangA[L"en-CA"] = eMCLang_enCA; - m_eMCLangA[L"ja-JP"] = eMCLang_jaJP; - m_eMCLangA[L"de-DE"] = eMCLang_deDE; - m_eMCLangA[L"de-AT"] = eMCLang_deAT; - m_eMCLangA[L"fr-FR"] = eMCLang_frFR; - m_eMCLangA[L"fr-CA"] = eMCLang_frCA; - m_eMCLangA[L"es-ES"] = eMCLang_esES; - m_eMCLangA[L"es-MX"] = eMCLang_esMX; - m_eMCLangA[L"it-IT"] = eMCLang_itIT; - m_eMCLangA[L"ko-KR"] = eMCLang_koKR; - m_eMCLangA[L"pt-PT"] = eMCLang_ptPT; - m_eMCLangA[L"pt-BR"] = eMCLang_ptBR; - m_eMCLangA[L"ru-RU"] = eMCLang_ruRU; - m_eMCLangA[L"nl-NL"] = eMCLang_nlNL; - m_eMCLangA[L"fi-FI"] = eMCLang_fiFI; - m_eMCLangA[L"sv-SV"] = eMCLang_svSV; - m_eMCLangA[L"da-DA"] = eMCLang_daDA; - m_eMCLangA[L"no-NO"] = eMCLang_noNO; - m_eMCLangA[L"pl-PL"] = eMCLang_plPL; - m_eMCLangA[L"tr-TR"] = eMCLang_trTR; - m_eMCLangA[L"el-EL"] = eMCLang_elEL; - - m_eMCLangA[L"zh-SG"] = eMCLang_zhSG; - m_eMCLangA[L"zh-CN"] = eMCLang_zhCN; - m_eMCLangA[L"zh-HK"] = eMCLang_zhHK; - m_eMCLangA[L"zh-TW"] = eMCLang_zhTW; - m_eMCLangA[L"nl-BE"] = eMCLang_nlBE; - m_eMCLangA[L"da-DK"] = eMCLang_daDK; - m_eMCLangA[L"fr-BE"] = eMCLang_frBE; - m_eMCLangA[L"fr-CH"] = eMCLang_frCH; - m_eMCLangA[L"de-CH"] = eMCLang_deCH; - m_eMCLangA[L"nb-NO"] = eMCLang_nbNO; - m_eMCLangA[L"en-GR"] = eMCLang_enGR; - m_eMCLangA[L"en-HK"] = eMCLang_enHK; - m_eMCLangA[L"en-SA"] = eMCLang_enSA; - m_eMCLangA[L"en-HU"] = eMCLang_enHU; - m_eMCLangA[L"en-IN"] = eMCLang_enIN; - m_eMCLangA[L"en-IL"] = eMCLang_enIL; - m_eMCLangA[L"en-SG"] = eMCLang_enSG; - m_eMCLangA[L"en-SK"] = eMCLang_enSK; - m_eMCLangA[L"en-ZA"] = eMCLang_enZA; - m_eMCLangA[L"en-CZ"] = eMCLang_enCZ; - m_eMCLangA[L"en-AE"] = eMCLang_enAE; - m_eMCLangA[L"es-AR"] = eMCLang_esAR; - m_eMCLangA[L"es-CL"] = eMCLang_esCL; - m_eMCLangA[L"es-CO"] = eMCLang_esCO; - m_eMCLangA[L"es-US"] = eMCLang_esUS; - m_eMCLangA[L"sv-SE"] = eMCLang_svSE; - - m_eMCLangA[L"cs-CZ"] = eMCLang_csCZ; - m_eMCLangA[L"el-GR"] = eMCLang_elGR; - m_eMCLangA[L"nn-NO"] = eMCLang_nnNO; - m_eMCLangA[L"sk-SK"] = eMCLang_skSK; - - m_eMCLangA[L"zh-HANS"] = eMCLang_hans; - m_eMCLangA[L"zh-HANT"] = eMCLang_hant; - - m_xcLangA[L"zh-CHT"] = XC_LOCALE_CHINA; - m_xcLangA[L"cs-CS"] = XC_LOCALE_CHINA; - m_xcLangA[L"en-EN"] = XC_LOCALE_UNITED_STATES; - m_xcLangA[L"en-US"] = XC_LOCALE_UNITED_STATES; - m_xcLangA[L"en-GB"] = XC_LOCALE_GREAT_BRITAIN; - m_xcLangA[L"en-IE"] = XC_LOCALE_IRELAND; - m_xcLangA[L"en-AU"] = XC_LOCALE_AUSTRALIA; - m_xcLangA[L"en-NZ"] = XC_LOCALE_NEW_ZEALAND; - m_xcLangA[L"en-CA"] = XC_LOCALE_CANADA; - m_xcLangA[L"ja-JP"] = XC_LOCALE_JAPAN; - m_xcLangA[L"de-DE"] = XC_LOCALE_GERMANY; - m_xcLangA[L"de-AT"] = XC_LOCALE_AUSTRIA; - m_xcLangA[L"fr-FR"] = XC_LOCALE_FRANCE; - m_xcLangA[L"fr-CA"] = XC_LOCALE_CANADA; - m_xcLangA[L"es-ES"] = XC_LOCALE_SPAIN; - m_xcLangA[L"es-MX"] = XC_LOCALE_MEXICO; - m_xcLangA[L"it-IT"] = XC_LOCALE_ITALY; - m_xcLangA[L"ko-KR"] = XC_LOCALE_KOREA; - m_xcLangA[L"pt-PT"] = XC_LOCALE_PORTUGAL; - m_xcLangA[L"pt-BR"] = XC_LOCALE_BRAZIL; - m_xcLangA[L"ru-RU"] = XC_LOCALE_RUSSIAN_FEDERATION; - m_xcLangA[L"nl-NL"] = XC_LOCALE_NETHERLANDS; - m_xcLangA[L"fi-FI"] = XC_LOCALE_FINLAND; - m_xcLangA[L"sv-SV"] = XC_LOCALE_SWEDEN; - m_xcLangA[L"da-DA"] = XC_LOCALE_DENMARK; - m_xcLangA[L"no-NO"] = XC_LOCALE_NORWAY; - m_xcLangA[L"pl-PL"] = XC_LOCALE_POLAND; - m_xcLangA[L"tr-TR"] = XC_LOCALE_TURKEY; - m_xcLangA[L"el-EL"] = XC_LOCALE_GREECE; - m_xcLangA[L"la-LAS"] = XC_LOCALE_LATIN_AMERICA; - - // New ones for Xbox One - m_xcLangA[L"zh-SG"] = XC_LOCALE_SINGAPORE; - m_xcLangA[L"Zh-CN"] = XC_LOCALE_CHINA; - m_xcLangA[L"zh-HK"] = XC_LOCALE_HONG_KONG; - m_xcLangA[L"zh-TW"] = XC_LOCALE_TAIWAN; - m_xcLangA[L"nl-BE"] = XC_LOCALE_BELGIUM; - m_xcLangA[L"da-DK"] = XC_LOCALE_DENMARK; - m_xcLangA[L"fr-BE"] = XC_LOCALE_BELGIUM; - m_xcLangA[L"fr-CH"] = XC_LOCALE_SWITZERLAND; - m_xcLangA[L"de-CH"] = XC_LOCALE_SWITZERLAND; - m_xcLangA[L"nb-NO"] = XC_LOCALE_NORWAY; - m_xcLangA[L"en-GR"] = XC_LOCALE_GREECE; - m_xcLangA[L"en-HK"] = XC_LOCALE_HONG_KONG; - m_xcLangA[L"en-SA"] = XC_LOCALE_SAUDI_ARABIA; - m_xcLangA[L"en-HU"] = XC_LOCALE_HUNGARY; - m_xcLangA[L"en-IN"] = XC_LOCALE_INDIA; - m_xcLangA[L"en-IL"] = XC_LOCALE_ISRAEL; - m_xcLangA[L"en-SG"] = XC_LOCALE_SINGAPORE; - m_xcLangA[L"en-SK"] = XC_LOCALE_SLOVAK_REPUBLIC; - m_xcLangA[L"en-ZA"] = XC_LOCALE_SOUTH_AFRICA; - m_xcLangA[L"en-CZ"] = XC_LOCALE_CZECH_REPUBLIC; - m_xcLangA[L"en-AE"] = XC_LOCALE_UNITED_ARAB_EMIRATES; - m_xcLangA[L"ja-IP"] = XC_LOCALE_JAPAN; - m_xcLangA[L"es-AR"] = XC_LOCALE_ARGENTINA; - m_xcLangA[L"es-CL"] = XC_LOCALE_CHILE; - m_xcLangA[L"es-CO"] = XC_LOCALE_COLOMBIA; - m_xcLangA[L"es-US"] = XC_LOCALE_UNITED_STATES; - m_xcLangA[L"sv-SE"] = XC_LOCALE_SWEDEN; - - m_xcLangA[L"cs-CZ"] = XC_LOCALE_CZECH_REPUBLIC; - m_xcLangA[L"el-GR"] = XC_LOCALE_GREECE; - m_xcLangA[L"sk-SK"] = XC_LOCALE_SLOVAK_REPUBLIC; - - m_xcLangA[L"zh-HANS"] = XC_LOCALE_CHINA; - m_xcLangA[L"zh-HANT"] = XC_LOCALE_CHINA; -} - -void Game::SetTickTMSDLCFiles(bool bVal) { - ZoneScopedN("Game::SetTickTMSDLCFiles"); - // 4J-PB - we need to stop the retrieval of minecraft store images from TMS - // when we aren't in the DLC, since going in to Play Game will change the - // title id group - m_bTickTMSDLCFiles = bVal; -} +// (moved to manager class) std::wstring Game::getFilePath(std::uint32_t packId, std::wstring filename, diff --git a/targets/app/common/Game.h b/targets/app/common/Game.h index 8b96c2910..16901e30b 100644 --- a/targets/app/common/Game.h +++ b/targets/app/common/Game.h @@ -9,27 +9,34 @@ // using namespace std; +#include "app/common/ArchiveManager.h" +#include "app/common/BannedListManager.h" +#include "app/common/DebugOptions.h" +#include "app/common/DLCController.h" +#include "app/common/GameSettingsManager.h" #include "app/common/IPlatformGame.h" #include "app/common/App_structs.h" -#include "app/common/src/Audio/Consoles_SoundEngine.h" -#include "app/common/src/DLC/DLCManager.h" -#include "app/common/src/GameRules/ConsoleGameRulesConstants.h" -#include "app/common/src/GameRules/GameRuleManager.h" -#include "app/common/src/Localisation/StringTable.h" -#include "app/common/src/Tutorial/TutorialEnum.h" -#include "app/common/src/UI/All Platforms/ArchiveFile.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/include/NetTypes.h" -#include "app/include/SkinBox.h" -#include "app/include/XboxStubs.h" +#include "app/common/LocalizationManager.h" +#include "app/common/MenuController.h" +#include "app/common/NetworkController.h" +#include "app/common/SaveManager.h" +#include "app/common/SkinManager.h" +#include "app/common/TerrainFeatureManager.h" +#include "app/common/Audio/Consoles_SoundEngine.h" +#include "app/common/DLC/DLCManager.h" +#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "app/common/GameRules/GameRuleManager.h" +#include "app/common/Localisation/StringTable.h" +#include "app/common/Tutorial/TutorialEnum.h" +#include "app/common/UI/All Platforms/ArchiveFile.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "platform/NetTypes.h" +#include "minecraft/client/model/SkinBox.h" +#include "platform/XboxStubs.h" #include "minecraft/network/packet/DisconnectPacket.h" #include "minecraft/world/entity/item/MinecartHopper.h" -typedef struct _JoinFromInviteData { - std::uint32_t dwUserIndex; // dwUserIndex - std::uint32_t dwLocalUsersMask; // dwUserMask - const INVITE_INFO* pInviteInfo; // pInviteInfo -} JoinFromInviteData; +// JoinFromInviteData moved to NetworkController.h class Player; class Inventory; @@ -56,9 +63,6 @@ class Merchant; class CMinecraftAudio; class Game : public IPlatformGame { -private: - static int s_iHTMLFontSizesA[eHTMLSize_COUNT]; - public: Game(); @@ -68,13 +72,23 @@ public: typedef std::vector VMEMFILES; typedef std::vector VNOTIFICATIONS; - // storing skin files - std::vector vSkinNames; + // storing skin files - delegated to SkinManager + std::vector& vSkinNames = m_skinManager.vSkinNames; DLCManager m_dlcManager; + SaveManager m_saveManager; + BannedListManager m_bannedListManager; + TerrainFeatureManager m_terrainFeatureManager; + DebugOptions m_debugOptions; + LocalizationManager m_localizationManager; + ArchiveManager m_archiveManager; + SkinManager m_skinManager; + GameSettingsManager m_gameSettingsManager; + DLCController m_dlcController; + NetworkController m_networkController; + MenuController m_menuController; - // storing credits text from the DLC - std::vector m_vCreditText; // hold the credit text lines so - // we can avoid duplicating them + // storing credits text from the DLC - delegated to DLCController + std::vector& m_vCreditText = m_dlcController.m_vCreditText; // In builds prior to TU5, the size of the GAME_SETTINGS struct was 204 // bytes. We added a few new values to the internal struct in TU5, and even @@ -117,7 +131,7 @@ public: static const int USER_UI = 7; // 4J Stu - This also makes it appear on the UI console - void HandleButtonPresses(); + void HandleButtonPresses() { m_gameSettingsManager.handleButtonPresses(); } bool IntroRunning() { return m_bIntroRunning; } void SetIntroRunning(bool bSet) { m_bIntroRunning = bSet; } #if defined(_CONTENT_PACKAGE) @@ -131,7 +145,9 @@ public: bool IsAppPaused(); void SetAppPaused(bool val); - int displaySavingMessage(const C4JStorage::ESavingMessage eMsg, int iPad); + int displaySavingMessage(const C4JStorage::ESavingMessage eMsg, int iPad) { + return m_gameSettingsManager.displaySavingMessage(eMsg, iPad); + } bool GetGameStarted() { return m_bGameStarted; } void SetGameStarted(bool bVal) { if (bVal) @@ -143,125 +159,175 @@ public: } int GetLocalPlayerCount(void); bool LoadInventoryMenu(int iPad, std::shared_ptr player, - bool bNavigateBack = false); + bool bNavigateBack = false) { + return m_menuController.loadInventoryMenu(iPad, player, bNavigateBack); + } bool LoadCreativeMenu(int iPad, std::shared_ptr player, - bool bNavigateBack = false); + bool bNavigateBack = false) { + return m_menuController.loadCreativeMenu(iPad, player, bNavigateBack); + } bool LoadEnchantingMenu(int iPad, std::shared_ptr inventory, int x, int y, int z, Level* level, - const std::wstring& name); + const std::wstring& name) { + return m_menuController.loadEnchantingMenu(iPad, inventory, x, y, z, level, name); + } bool LoadFurnaceMenu(int iPad, std::shared_ptr inventory, - std::shared_ptr furnace); + std::shared_ptr furnace) { + return m_menuController.loadFurnaceMenu(iPad, inventory, furnace); + } bool LoadBrewingStandMenu( int iPad, std::shared_ptr inventory, - std::shared_ptr brewingStand); + std::shared_ptr brewingStand) { + return m_menuController.loadBrewingStandMenu(iPad, inventory, brewingStand); + } bool LoadContainerMenu(int iPad, std::shared_ptr inventory, - std::shared_ptr container); + std::shared_ptr container) { + return m_menuController.loadContainerMenu(iPad, inventory, container); + } bool LoadTrapMenu(int iPad, std::shared_ptr inventory, - std::shared_ptr trap); - bool LoadCrafting2x2Menu(int iPad, std::shared_ptr player); + std::shared_ptr trap) { + return m_menuController.loadTrapMenu(iPad, inventory, trap); + } + bool LoadCrafting2x2Menu(int iPad, std::shared_ptr player) { + return m_menuController.loadCrafting2x2Menu(iPad, player); + } bool LoadCrafting3x3Menu(int iPad, std::shared_ptr player, - int x, int y, int z); + int x, int y, int z) { + return m_menuController.loadCrafting3x3Menu(iPad, player, x, y, z); + } bool LoadFireworksMenu(int iPad, std::shared_ptr player, int x, - int y, int z); - bool LoadSignEntryMenu(int iPad, std::shared_ptr sign); + int y, int z) { + return m_menuController.loadFireworksMenu(iPad, player, x, y, z); + } + bool LoadSignEntryMenu(int iPad, std::shared_ptr sign) { + return m_menuController.loadSignEntryMenu(iPad, sign); + } bool LoadRepairingMenu(int iPad, std::shared_ptr inventory, - Level* level, int x, int y, int z); + Level* level, int x, int y, int z) { + return m_menuController.loadRepairingMenu(iPad, inventory, level, x, y, z); + } bool LoadTradingMenu(int iPad, std::shared_ptr inventory, std::shared_ptr trader, Level* level, - const std::wstring& name); + const std::wstring& name) { + return m_menuController.loadTradingMenu(iPad, inventory, trader, level, name); + } bool LoadCommandBlockMenu( int iPad, std::shared_ptr commandBlock) { return false; } bool LoadHopperMenu(int iPad, std::shared_ptr inventory, - std::shared_ptr hopper); + std::shared_ptr hopper) { + return m_menuController.loadHopperMenu(iPad, inventory, hopper); + } bool LoadHopperMenu(int iPad, std::shared_ptr inventory, - std::shared_ptr hopper); + std::shared_ptr hopper) { + return m_menuController.loadHopperMenu(iPad, inventory, hopper); + } bool LoadHorseMenu(int iPad, std::shared_ptr inventory, std::shared_ptr container, - std::shared_ptr horse); + std::shared_ptr horse) { + return m_menuController.loadHorseMenu(iPad, inventory, container, horse); + } bool LoadBeaconMenu(int iPad, std::shared_ptr inventory, - std::shared_ptr beacon); + std::shared_ptr beacon) { + return m_menuController.loadBeaconMenu(iPad, inventory, beacon); + } bool GetTutorialMode() { return m_bTutorialMode; } void SetTutorialMode(bool bSet) { m_bTutorialMode = bSet; } - void SetSpecialTutorialCompletionFlag(int iPad, int index); + void SetSpecialTutorialCompletionFlag(int iPad, int index) { + m_gameSettingsManager.setSpecialTutorialCompletionFlag(iPad, index); + } static const wchar_t* GetString(int iID); + StringTable* getStringTable() const { return m_localizationManager.getStringTable(); } eGameMode GetGameMode() { return m_eGameMode; } void SetGameMode(eGameMode eMode) { m_eGameMode = eMode; } - eXuiAction GetGlobalXuiAction() { return m_eGlobalXuiAction; } - void SetGlobalXuiAction(eXuiAction action) { m_eGlobalXuiAction = action; } - eXuiAction GetXuiAction(int iPad) { return m_eXuiAction[iPad]; } - void SetAction(int iPad, eXuiAction action, void* param = nullptr); - void SetTMSAction(int iPad, eTMSAction action) { - m_eTMSAction[iPad] = action; + eXuiAction GetGlobalXuiAction() { return m_menuController.getGlobalXuiAction(); } + void SetGlobalXuiAction(eXuiAction action) { m_menuController.setGlobalXuiAction(action); } + eXuiAction GetXuiAction(int iPad) { return m_menuController.getXuiAction(iPad); } + void SetAction(int iPad, eXuiAction action, void* param = nullptr) { + m_menuController.setAction(iPad, action, param); } - eTMSAction GetTMSAction(int iPad) { return m_eTMSAction[iPad]; } + void SetTMSAction(int iPad, eTMSAction action) { + m_menuController.setTMSAction(iPad, action); + } + eTMSAction GetTMSAction(int iPad) { return m_menuController.getTMSAction(iPad); } eXuiServerAction GetXuiServerAction(int iPad) { - return m_eXuiServerAction[iPad]; + return m_menuController.getXuiServerAction(iPad); } void* GetXuiServerActionParam(int iPad) { - return m_eXuiServerActionParam[iPad]; + return m_menuController.getXuiServerActionParam(iPad); } void SetXuiServerAction(int iPad, eXuiServerAction action, void* param = nullptr) { - m_eXuiServerAction[iPad] = action; - m_eXuiServerActionParam[iPad] = param; + m_menuController.setXuiServerAction(iPad, action, param); } eXuiServerAction GetGlobalXuiServerAction() { - return m_eGlobalXuiServerAction; + return m_menuController.getGlobalXuiServerAction(); } void SetGlobalXuiServerAction(eXuiServerAction action) { - m_eGlobalXuiServerAction = action; + m_menuController.setGlobalXuiServerAction(action); } DisconnectPacket::eDisconnectReason GetDisconnectReason() { - return m_disconnectReason; + return m_networkController.getDisconnectReason(); } void SetDisconnectReason(DisconnectPacket::eDisconnectReason bVal) { - m_disconnectReason = bVal; + m_networkController.setDisconnectReason(bVal); } - bool GetChangingSessionType() { return m_bChangingSessionType; } - void SetChangingSessionType(bool bVal) { m_bChangingSessionType = bVal; } + bool GetChangingSessionType() { return m_networkController.getChangingSessionType(); } + void SetChangingSessionType(bool bVal) { m_networkController.setChangingSessionType(bVal); } - bool GetReallyChangingSessionType() { return m_bReallyChangingSessionType; } + bool GetReallyChangingSessionType() { return m_networkController.getReallyChangingSessionType(); } void SetReallyChangingSessionType(bool bVal) { - m_bReallyChangingSessionType = bVal; + m_networkController.setReallyChangingSessionType(bVal); } // 4J Stu - Added so that we can call this when a confirmation box is // selected - static void SetActionConfirmed(void* param); + static void SetActionConfirmed(void* param) { + GameSettingsManager::setActionConfirmed(param); + } void HandleXuiActions(void); // 4J Stu - Functions used for Minecon and other promo work bool GetLoadSavesFromFolderEnabled() { - return m_bLoadSavesFromFolderEnabled; + return m_debugOptions.getLoadSavesFromFolderEnabled(); } void SetLoadSavesFromFolderEnabled(bool bVal) { - m_bLoadSavesFromFolderEnabled = bVal; + m_debugOptions.setLoadSavesFromFolderEnabled(bVal); } // 4J Stu - Useful for debugging - bool GetWriteSavesToFolderEnabled() { return m_bWriteSavesToFolderEnabled; } - void SetWriteSavesToFolderEnabled(bool bVal) { - m_bWriteSavesToFolderEnabled = bVal; + bool GetWriteSavesToFolderEnabled() { + return m_debugOptions.getWriteSavesToFolderEnabled(); + } + void SetWriteSavesToFolderEnabled(bool bVal) { + m_debugOptions.setWriteSavesToFolderEnabled(bVal); + } + bool GetMobsDontAttackEnabled() { + return m_debugOptions.getMobsDontAttack(); + } + void SetMobsDontAttackEnabled(bool bVal) { + m_debugOptions.setMobsDontAttack(bVal); + } + bool GetUseDPadForDebug() { return m_debugOptions.getUseDPadForDebug(); } + void SetUseDPadForDebug(bool bVal) { + m_debugOptions.setUseDPadForDebug(bVal); + } + bool GetMobsDontTickEnabled() { return m_debugOptions.getMobsDontTick(); } + void SetMobsDontTickEnabled(bool bVal) { + m_debugOptions.setMobsDontTick(bVal); } - bool GetMobsDontAttackEnabled() { return m_bMobsDontAttack; } - void SetMobsDontAttackEnabled(bool bVal) { m_bMobsDontAttack = bVal; } - bool GetUseDPadForDebug() { return m_bUseDPadForDebug; } - void SetUseDPadForDebug(bool bVal) { m_bUseDPadForDebug = bVal; } - bool GetMobsDontTickEnabled() { return m_bMobsDontTick; } - void SetMobsDontTickEnabled(bool bVal) { m_bMobsDontTick = bVal; } - bool GetFreezePlayers() { return m_bFreezePlayers; } - void SetFreezePlayers(bool bVal) { m_bFreezePlayers = bVal; } + bool GetFreezePlayers() { return m_debugOptions.getFreezePlayers(); } + void SetFreezePlayers(bool bVal) { m_debugOptions.setFreezePlayers(bVal); } // debug -0 show safe area void ShowSafeArea(bool show) {} @@ -270,85 +336,166 @@ public: // void GetPreviewImage(int iPad,XSOCIAL_PREVIEWIMAGE // *preview); - void InitGameSettings(); + void InitGameSettings() { m_gameSettingsManager.initGameSettings(); } static int OldProfileVersionCallback(void* pParam, unsigned char* pucData, const unsigned short usVersion, - const int iPad); + const int iPad) { + return GameSettingsManager::oldProfileVersionCallback(pParam, pucData, usVersion, iPad); + } static int DefaultOptionsCallback(void* pParam, C_4JProfile::PROFILESETTINGS* pSettings, - const int iPad); + const int iPad) { + return GameSettingsManager::defaultOptionsCallback(pParam, pSettings, iPad); + } int SetDefaultOptions(C_4JProfile::PROFILESETTINGS* pSettings, - const int iPad); + const int iPad) { + return m_gameSettingsManager.setDefaultOptions(pSettings, iPad); + } void SetRichPresenceContext(int iPad, int contextId) override = 0; - void SetGameSettings(int iPad, eGameSetting eVal, unsigned char ucVal); - unsigned char GetGameSettings(int iPad, eGameSetting eVal); - unsigned char GetGameSettings(eGameSetting eVal); // for the primary pad - void SetPlayerSkin(int iPad, const std::wstring& name); - void SetPlayerSkin(int iPad, std::uint32_t dwSkinId); - void SetPlayerCape(int iPad, const std::wstring& name); - void SetPlayerCape(int iPad, std::uint32_t dwCapeId); - void SetPlayerFavoriteSkin(int iPad, int iIndex, unsigned int uiSkinID); - unsigned int GetPlayerFavoriteSkin(int iPad, int iIndex); - unsigned char GetPlayerFavoriteSkinsPos(int iPad); - void SetPlayerFavoriteSkinsPos(int iPad, int iPos); - unsigned int GetPlayerFavoriteSkinsCount(int iPad); - void ValidateFavoriteSkins( - int iPad); // check the DLC is available for the skins + void SetGameSettings(int iPad, eGameSetting eVal, unsigned char ucVal) { + m_gameSettingsManager.setGameSettings(iPad, eVal, ucVal); + } + unsigned char GetGameSettings(int iPad, eGameSetting eVal) { + return m_gameSettingsManager.getGameSettings(iPad, eVal); + } + unsigned char GetGameSettings(eGameSetting eVal) { + return m_gameSettingsManager.getGameSettings(eVal); + } + void SetPlayerSkin(int iPad, const std::wstring& name) { + m_skinManager.setPlayerSkin(iPad, name, GameSettingsA); + } + void SetPlayerSkin(int iPad, std::uint32_t dwSkinId) { + m_skinManager.setPlayerSkin(iPad, dwSkinId, GameSettingsA); + } + void SetPlayerCape(int iPad, const std::wstring& name) { + m_skinManager.setPlayerCape(iPad, name, GameSettingsA); + } + void SetPlayerCape(int iPad, std::uint32_t dwCapeId) { + m_skinManager.setPlayerCape(iPad, dwCapeId, GameSettingsA); + } + void SetPlayerFavoriteSkin(int iPad, int iIndex, unsigned int uiSkinID) { + m_skinManager.setPlayerFavoriteSkin(iPad, iIndex, uiSkinID, GameSettingsA); + } + unsigned int GetPlayerFavoriteSkin(int iPad, int iIndex) { + return m_skinManager.getPlayerFavoriteSkin(iPad, iIndex, GameSettingsA); + } + unsigned char GetPlayerFavoriteSkinsPos(int iPad) { + return m_skinManager.getPlayerFavoriteSkinsPos(iPad, GameSettingsA); + } + void SetPlayerFavoriteSkinsPos(int iPad, int iPos) { + m_skinManager.setPlayerFavoriteSkinsPos(iPad, iPos, GameSettingsA); + } + unsigned int GetPlayerFavoriteSkinsCount(int iPad) { + return m_skinManager.getPlayerFavoriteSkinsCount(iPad, GameSettingsA); + } + void ValidateFavoriteSkins(int iPad) { + m_skinManager.validateFavoriteSkins(iPad, GameSettingsA, m_dlcManager); + } - // Mash-up pack worlds hide/display - void HideMashupPackWorld(int iPad, unsigned int iMashupPackID); - void EnableMashupPackWorlds(int iPad); - unsigned int GetMashupPackWorlds(int iPad); + // Mash-up pack worlds hide/display - delegated to GameSettingsManager + void HideMashupPackWorld(int iPad, unsigned int iMashupPackID) { + m_gameSettingsManager.hideMashupPackWorld(iPad, iMashupPackID); + } + void EnableMashupPackWorlds(int iPad) { + m_gameSettingsManager.enableMashupPackWorlds(iPad); + } + unsigned int GetMashupPackWorlds(int iPad) { + return m_gameSettingsManager.getMashupPackWorlds(iPad); + } - // Minecraft language select - void SetMinecraftLanguage(int iPad, unsigned char ucLanguage); - unsigned char GetMinecraftLanguage(int iPad); - void SetMinecraftLocale(int iPad, unsigned char ucLanguage); - unsigned char GetMinecraftLocale(int iPad); + // Minecraft language select - delegated to GameSettingsManager + void SetMinecraftLanguage(int iPad, unsigned char ucLanguage) { + m_gameSettingsManager.setMinecraftLanguage(iPad, ucLanguage); + } + unsigned char GetMinecraftLanguage(int iPad) { + return m_gameSettingsManager.getMinecraftLanguage(iPad); + } + void SetMinecraftLocale(int iPad, unsigned char ucLanguage) { + m_gameSettingsManager.setMinecraftLocale(iPad, ucLanguage); + } + unsigned char GetMinecraftLocale(int iPad) { + return m_gameSettingsManager.getMinecraftLocale(iPad); + } // 4J-PB - set a timer when the user navigates the quickselect, so we can // bring the opacity back to defaults for a short time unsigned int GetOpacityTimer(int iPad) { - return m_uiOpacityCountDown[iPad]; + return m_menuController.getOpacityTimer(iPad); } void SetOpacityTimer(int iPad) { - m_uiOpacityCountDown[iPad] = 120; + m_menuController.setOpacityTimer(iPad); } // 6 seconds void TickOpacityTimer(int iPad) { - if (m_uiOpacityCountDown[iPad] > 0) m_uiOpacityCountDown[iPad]--; + m_menuController.tickOpacityTimer(iPad); } public: - std::wstring GetPlayerSkinName(int iPad); - std::uint32_t GetPlayerSkinId(int iPad); - std::wstring GetPlayerCapeName(int iPad); - std::uint32_t GetPlayerCapeId(int iPad); - std::uint32_t GetAdditionalModelParts(int iPad); + std::wstring GetPlayerSkinName(int iPad) { + return m_skinManager.getPlayerSkinName(iPad, GameSettingsA); + } + std::uint32_t GetPlayerSkinId(int iPad) { + return m_skinManager.getPlayerSkinId(iPad, GameSettingsA, m_dlcManager); + } + std::wstring GetPlayerCapeName(int iPad) { + return m_skinManager.getPlayerCapeName(iPad, GameSettingsA); + } + std::uint32_t GetPlayerCapeId(int iPad) { + return m_skinManager.getPlayerCapeId(iPad, GameSettingsA); + } + std::uint32_t GetAdditionalModelParts(int iPad) { + return m_skinManager.getAdditionalModelParts(iPad); + } void CheckGameSettingsChanged(bool bOverride5MinuteTimer = false, - int iPad = XUSER_INDEX_ANY); - void ApplyGameSettingsChanged(int iPad); - void ClearGameSettingsChangedFlag(int iPad); - void ActionGameSettings(int iPad, eGameSetting eVal); + int iPad = XUSER_INDEX_ANY) { + m_gameSettingsManager.checkGameSettingsChanged(bOverride5MinuteTimer, iPad); + } + void ApplyGameSettingsChanged(int iPad) { + m_gameSettingsManager.applyGameSettingsChanged(iPad); + } + void ClearGameSettingsChangedFlag(int iPad) { + m_gameSettingsManager.clearGameSettingsChangedFlag(iPad); + } + void ActionGameSettings(int iPad, eGameSetting eVal) { + m_gameSettingsManager.actionGameSettings(iPad, eVal); + } unsigned int GetGameSettingsDebugMask(int iPad = -1, - bool bOverridePlayer = false); - void SetGameSettingsDebugMask(int iPad, unsigned int uiVal); - void ActionDebugMask(int iPad, bool bSetAllClear = false); + bool bOverridePlayer = false) { + return m_gameSettingsManager.getGameSettingsDebugMask(iPad, bOverridePlayer); + } + void SetGameSettingsDebugMask(int iPad, unsigned int uiVal) { + m_gameSettingsManager.setGameSettingsDebugMask(iPad, uiVal); + } + void ActionDebugMask(int iPad, bool bSetAllClear = false) { + m_gameSettingsManager.actionDebugMask(iPad, bSetAllClear); + } // bool IsLocalMultiplayerAvailable(); - // for sign in change monitoring + // for sign in change monitoring - delegated to NetworkController static void SignInChangeCallback(void* pParam, bool bVal, - unsigned int uiSignInData); - static void ClearSignInChangeUsersMask(); - static int SignoutExitWorldThreadProc(void* lpParameter); + unsigned int uiSignInData) { + NetworkController::signInChangeCallback(pParam, bVal, uiSignInData); + } + static void ClearSignInChangeUsersMask() { + NetworkController::clearSignInChangeUsersMask(); + } + static int SignoutExitWorldThreadProc(void* lpParameter) { + return NetworkController::signoutExitWorldThreadProc(lpParameter); + } static int PrimaryPlayerSignedOutReturned(void* pParam, int iPad, - const C4JStorage::EMessageResult); + const C4JStorage::EMessageResult result) { + return NetworkController::primaryPlayerSignedOutReturned(pParam, iPad, result); + } static int EthernetDisconnectReturned(void* pParam, int iPad, - const C4JStorage::EMessageResult); - static void ProfileReadErrorCallback(void* pParam); + const C4JStorage::EMessageResult result) { + return NetworkController::ethernetDisconnectReturned(pParam, iPad, result); + } + static void ProfileReadErrorCallback(void* pParam) { + NetworkController::profileReadErrorCallback(pParam); + } // FATAL LOAD ERRORS virtual void FatalLoadError(); @@ -356,15 +503,19 @@ public: // Notifications from the game listener to be passed to the qnet listener static void NotificationsCallback(void* pParam, std::uint32_t dwNotification, - unsigned int uiParam); + unsigned int uiParam) { + NetworkController::notificationsCallback(pParam, dwNotification, uiParam); + } // for the ethernet being disconnected - static void LiveLinkChangeCallback(void* pParam, bool bConnected); - bool GetLiveLinkRequired() { return m_bLiveLinkRequired; } - void SetLiveLinkRequired(bool required) { m_bLiveLinkRequired = required; } + static void LiveLinkChangeCallback(void* pParam, bool bConnected) { + NetworkController::liveLinkChangeCallback(pParam, bConnected); + } + bool GetLiveLinkRequired() { return m_networkController.getLiveLinkRequired(); } + void SetLiveLinkRequired(bool required) { m_networkController.setLiveLinkRequired(required); } #if defined(_DEBUG_MENUS_ENABLED) - bool DebugSettingsOn() { return m_bDebugOptions; } + bool DebugSettingsOn() { return m_debugOptions.settingsOn(); } bool DebugArtToolsOn(); #else bool DebugSettingsOn() { return false; } @@ -374,89 +525,97 @@ public: // bool UploadFileToGlobalStorage(int iQuadrant, // C4JStorage::eGlobalStorage eStorageFacility, std::wstring *wsFile ); - // Installed DLC - bool StartInstallDLCProcess(int iPad); - int dlcInstalledCallback(int iOfferC, int iPad); + // Installed DLC - delegated to DLCController + bool StartInstallDLCProcess(int iPad) { return m_dlcController.startInstallDLCProcess(iPad); } + int dlcInstalledCallback(int iOfferC, int iPad) { return m_dlcController.dlcInstalledCallback(iOfferC, iPad); } void HandleDLCLicenseChange(); int dlcMountedCallback(int iPad, std::uint32_t dwErr, - std::uint32_t dwLicenceMask); - void MountNextDLC(int iPad); - // static int DLCReadCallback(void* pParam,C4JStorage::DLC_FILE_DETAILS - // *pDLCData); - void HandleDLC(DLCPack* pack); - bool DLCInstallPending() { return m_bDLCInstallPending; } - bool DLCInstallProcessCompleted() { return m_bDLCInstallProcessCompleted; } - void ClearDLCInstalled() { m_bDLCInstallProcessCompleted = false; } + std::uint32_t dwLicenceMask) { + return m_dlcController.dlcMountedCallback(iPad, dwErr, dwLicenceMask); + } + void MountNextDLC(int iPad) { m_dlcController.mountNextDLC(iPad); } + void HandleDLC(DLCPack* pack) { m_dlcController.handleDLC(pack); } + bool DLCInstallPending() { return m_dlcController.dlcInstallPending(); } + bool DLCInstallProcessCompleted() { return m_dlcController.dlcInstallProcessCompleted(); } + void ClearDLCInstalled() { m_dlcController.clearDLCInstalled(); } static int MarketplaceCountsCallback(void* pParam, - C4JStorage::DLC_TMS_DETAILS*, - int iPad); - - bool AlreadySeenCreditText(const std::wstring& wstemp); - - void ClearNewDLCAvailable(void) { - m_bNewDLCAvailable = false; - m_bSeenNewDLCTip = true; + C4JStorage::DLC_TMS_DETAILS* details, + int iPad) { + return DLCController::marketplaceCountsCallback(pParam, details, iPad); } - bool GetNewDLCAvailable() { return m_bNewDLCAvailable; } - void DisplayNewDLCTipAgain() { m_bSeenNewDLCTip = false; } - bool DisplayNewDLCTip() { - if (!m_bSeenNewDLCTip) { - m_bSeenNewDLCTip = true; - return true; - } else - return false; + + bool AlreadySeenCreditText(const std::wstring& wstemp) { + return m_dlcController.alreadySeenCreditText(wstemp); } + void ClearNewDLCAvailable(void) { m_dlcController.clearNewDLCAvailable(); } + bool GetNewDLCAvailable() { return m_dlcController.getNewDLCAvailable(); } + void DisplayNewDLCTipAgain() { m_dlcController.displayNewDLCTipAgain(); } + bool DisplayNewDLCTip() { return m_dlcController.displayNewDLCTip(); } + // functions to store launch data, and to exit the game - required due to // possibly being on a demo disc virtual void StoreLaunchData(); virtual void ExitGame(); - bool isXuidNotch(PlayerUID xuid); + bool isXuidNotch(PlayerUID xuid) { + return m_skinManager.isXuidNotch(xuid); + } bool isXuidDeadmau5(PlayerUID xuid); void AddMemoryTextureFile(const std::wstring& wName, std::uint8_t* pbData, - unsigned int byteCount); - void RemoveMemoryTextureFile(const std::wstring& wName); + unsigned int byteCount) { + m_skinManager.addMemoryTextureFile(wName, pbData, byteCount); + } + void RemoveMemoryTextureFile(const std::wstring& wName) { + m_skinManager.removeMemoryTextureFile(wName); + } void GetMemFileDetails(const std::wstring& wName, std::uint8_t** ppbData, - unsigned int* pByteCount); - bool IsFileInMemoryTextures(const std::wstring& wName); + unsigned int* pByteCount) { + m_skinManager.getMemFileDetails(wName, ppbData, pByteCount); + } + bool IsFileInMemoryTextures(const std::wstring& wName) { + return m_skinManager.isFileInMemoryTextures(wName); + } // Texture Pack Data files (icon, banner, comparison shot & text) void AddMemoryTPDFile(int iConfig, std::uint8_t* pbData, - unsigned int byteCount); - void RemoveMemoryTPDFile(int iConfig); - bool IsFileInTPD(int iConfig); - void GetTPD(int iConfig, std::uint8_t** ppbData, unsigned int* pByteCount); - int GetTPDSize() { return m_MEM_TPD.size(); } - int GetTPConfigVal(wchar_t* pwchDataFile); + unsigned int byteCount) { + m_archiveManager.addMemoryTPDFile(iConfig, pbData, byteCount); + } + void RemoveMemoryTPDFile(int iConfig) { + m_archiveManager.removeMemoryTPDFile(iConfig); + } + bool IsFileInTPD(int iConfig) { + return m_archiveManager.isFileInTPD(iConfig); + } + void GetTPD(int iConfig, std::uint8_t** ppbData, unsigned int* pByteCount) { + m_archiveManager.getTPD(iConfig, ppbData, pByteCount); + } + int GetTPDSize() { return m_archiveManager.getTPDSize(); } + int GetTPConfigVal(wchar_t* pwchDataFile) { + return m_archiveManager.getTPConfigVal(pwchDataFile); + } - bool DefaultCapeExists(); + bool DefaultCapeExists() { + return m_skinManager.defaultCapeExists(); + } // void InstallDefaultCape(); // attempt to install the default cape once // per game launch - // invites - // void ProcessInvite(JoinFromInviteData *pJoinData); + // invites - delegated to NetworkController void ProcessInvite(std::uint32_t dwUserIndex, std::uint32_t dwLocalUsersMask, - const INVITE_INFO* pInviteInfo); + const INVITE_INFO* pInviteInfo) { + m_networkController.processInvite(dwUserIndex, dwLocalUsersMask, pInviteInfo); + } - // Add credits for DLC installed - void AddCreditText(const wchar_t* lpStr); + // Add credits for DLC installed - delegated to DLCController + void AddCreditText(const wchar_t* lpStr) { m_dlcController.addCreditText(lpStr); } private: - PlayerUID m_xuidNotch; std::unordered_map m_GTS_Files; - // for storing memory textures - player skin - std::unordered_map m_MEM_Files; - // for storing texture pack data files - std::unordered_map m_MEM_TPD; - std::mutex csMemFilesLock; // For locking access to the above map - std::mutex csMemTPDLock; // For locking access to the above map - - VNOTIFICATIONS m_vNotifications; - public: // launch data std::uint8_t* m_pLaunchData; @@ -465,13 +624,25 @@ public: public: // BAN LIST void AddLevelToBannedLevelList(int iPad, PlayerUID xuid, char* pszLevelName, - bool bWriteToTMS); - bool IsInBannedLevelList(int iPad, PlayerUID xuid, char* pszLevelName); + bool bWriteToTMS) { + m_bannedListManager.addLevel(iPad, xuid, pszLevelName, bWriteToTMS); + } + bool IsInBannedLevelList(int iPad, PlayerUID xuid, char* pszLevelName) { + return m_bannedListManager.isInList(iPad, xuid, pszLevelName); + } void RemoveLevelFromBannedLevelList(int iPad, PlayerUID xuid, - char* pszLevelName); - void InvalidateBannedList(int iPad); - void SetUniqueMapName(char* pszUniqueMapName); - char* GetUniqueMapName(void); + char* pszLevelName) { + m_bannedListManager.removeLevel(iPad, xuid, pszLevelName); + } + void InvalidateBannedList(int iPad) { + m_bannedListManager.invalidate(iPad); + } + void SetUniqueMapName(char* pszUniqueMapName) { + m_bannedListManager.setUniqueMapName(pszUniqueMapName); + } + char* GetUniqueMapName(void) { + return m_bannedListManager.getUniqueMapName(); + } public: bool GetResourcesLoaded() { return m_bResourcesLoaded; } @@ -483,33 +654,34 @@ public: bool m_bTutorialMode; bool m_bIsAppPaused; - bool m_bChangingSessionType; - bool m_bReallyChangingSessionType; + // m_bChangingSessionType and m_bReallyChangingSessionType moved to NetworkController // trial, and trying to unlock full // version on an upsell - void loadMediaArchive(); - void loadStringTable(); - -protected: - ArchiveFile* m_mediaArchive; - StringTable* m_stringTable; + void loadMediaArchive() { m_archiveManager.loadMediaArchive(); } + void loadStringTable() { + m_localizationManager.loadStringTable(m_archiveManager.getMediaArchive()); + } public: - int getArchiveFileSize(const std::wstring& filename); - bool hasArchiveFile(const std::wstring& filename); - std::vector getArchiveFile(const std::wstring& filename); + int getArchiveFileSize(const std::wstring& filename) { + return m_archiveManager.getArchiveFileSize(filename); + } + bool hasArchiveFile(const std::wstring& filename) { + return m_archiveManager.hasArchiveFile(filename); + } + std::vector getArchiveFile(const std::wstring& filename) { + return m_archiveManager.getArchiveFile(filename); + } private: static int BannedLevelDialogReturned(void* pParam, int iPad, const C4JStorage::EMessageResult); static int TexturePackDialogReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); - - VBANNEDLIST* m_vBannedListA[XUSER_MAX_COUNT]; - - void HandleButtonPresses(int iPad); + C4JStorage::EMessageResult result) { + return MenuController::texturePackDialogReturned(pParam, iPad, result); + } bool m_bResourcesLoaded; @@ -530,27 +702,12 @@ private: eGameMode m_eGameMode; // single or multiplayer - static unsigned int m_uiLastSignInData; + // GameSettingsA reference alias into GameSettingsManager + GAME_SETTINGS* (&GameSettingsA)[XUSER_MAX_COUNT] = m_gameSettingsManager.GameSettingsA; - // We've got sizeof(GAME_SETTINGS) bytes reserved at the start of the - // gamedefined data per player for settings - GAME_SETTINGS* GameSettingsA[XUSER_MAX_COUNT]; + // m_uiLastSignInData moved to NetworkController - // For promo work - bool m_bLoadSavesFromFolderEnabled; - - // For debugging - bool m_bWriteSavesToFolderEnabled; - bool m_bMobsDontAttack; - bool m_bUseDPadForDebug; - bool m_bMobsDontTick; - bool m_bFreezePlayers; - - // 4J : WESTY : For taking screen shots. - // bool m_bInterfaceRenderingOff; - // bool m_bHandRenderingOff; - - DisconnectPacket::eDisconnectReason m_disconnectReason; + // Debug options now in m_debugOptions public: virtual void RunFrame() {}; @@ -565,46 +722,54 @@ public: void SetTrialTimerStart(void); float getTrialTimer(void); - // notifications from the game for qnet - VNOTIFICATIONS* GetNotifications() { return &m_vNotifications; } + // notifications from the game for qnet - delegated to NetworkController + NetworkController::VNOTIFICATIONS* GetNotifications() { + return m_networkController.getNotifications(); + } private: - // To avoid problems with threads being kicked off from xuis that alter - // things that may be in progress within the run_middle, we'll action these - // at the end of the game loop - eXuiAction m_eXuiAction[XUSER_MAX_COUNT]; - eTMSAction m_eTMSAction[XUSER_MAX_COUNT]; - void* m_eXuiActionParam[XUSER_MAX_COUNT]; - eXuiAction m_eGlobalXuiAction; - eXuiServerAction m_eXuiServerAction[XUSER_MAX_COUNT]; - void* m_eXuiServerActionParam[XUSER_MAX_COUNT]; - eXuiServerAction m_eGlobalXuiServerAction; - - bool m_bLiveLinkRequired; static int UnlockFullExitReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + C4JStorage::EMessageResult result) { + return MenuController::unlockFullExitReturned(pParam, iPad, result); + } static int UnlockFullSaveReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + C4JStorage::EMessageResult result) { + return MenuController::unlockFullSaveReturned(pParam, iPad, result); + } static int UnlockFullInviteReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + C4JStorage::EMessageResult result) { + return MenuController::unlockFullInviteReturned(pParam, iPad, result); + } static int TrialOverReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + C4JStorage::EMessageResult result) { + return MenuController::trialOverReturned(pParam, iPad, result); + } static int ExitAndJoinFromInvite(void* pParam, int iPad, - C4JStorage::EMessageResult result); + C4JStorage::EMessageResult result) { + return NetworkController::exitAndJoinFromInvite(pParam, iPad, result); + } static int ExitAndJoinFromInviteSaveDialogReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result); + void* pParam, int iPad, C4JStorage::EMessageResult result) { + return NetworkController::exitAndJoinFromInviteSaveDialogReturned(pParam, iPad, result); + } static int ExitAndJoinFromInviteAndSaveReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result); + void* pParam, int iPad, C4JStorage::EMessageResult result) { + return NetworkController::exitAndJoinFromInviteAndSaveReturned(pParam, iPad, result); + } static int ExitAndJoinFromInviteDeclineSaveReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result); + void* pParam, int iPad, C4JStorage::EMessageResult result) { + return NetworkController::exitAndJoinFromInviteDeclineSaveReturned(pParam, iPad, result); + } static int FatalErrorDialogReturned(void* pParam, int iPad, C4JStorage::EMessageResult result); static int WarningTrialTexturePackReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result); + void* pParam, int iPad, C4JStorage::EMessageResult result) { + return NetworkController::warningTrialTexturePackReturned(pParam, iPad, result); + } - JoinFromInviteData m_InviteData; - bool m_bDebugOptions; // toggle debug things on or off + JoinFromInviteData& m_InviteData = m_networkController.m_InviteData; + // m_bDebugOptions moved to m_debugOptions // Trial timer float m_fTrialTimerStart, mfTrialPausedTime; @@ -618,62 +783,81 @@ private: TimeInfo m_Time; -protected: - static const int MAX_TIPS_GAMETIP = 50; - static const int MAX_TIPS_TRIVIATIP = 20; - static TIPSTRUCT m_GameTipA[MAX_TIPS_GAMETIP]; - static TIPSTRUCT m_TriviaTipA[MAX_TIPS_TRIVIATIP]; - static Random* TipRandom; - public: - void InitialiseTips(); - int GetNextTip(); - int GetHTMLColour(eMinecraftColour colour); + void InitialiseTips() { m_localizationManager.initialiseTips(); } + int GetNextTip() { return m_localizationManager.getNextTip(); } + int GetHTMLColour(eMinecraftColour colour) { + return m_localizationManager.getHTMLColour(colour); + } int GetHTMLColor(eMinecraftColour colour) { return GetHTMLColour(colour); } - int GetHTMLFontSize(EHTMLFontSize size); + int GetHTMLFontSize(EHTMLFontSize size) { + return m_localizationManager.getHTMLFontSize(size); + } std::wstring FormatHTMLString(int iPad, const std::wstring& desc, - int shadowColour = 0xFFFFFFFF); - std::wstring GetActionReplacement(int iPad, unsigned char ucAction); - std::wstring GetVKReplacement(unsigned int uiVKey); - std::wstring GetIconReplacement(unsigned int uiIcon); + int shadowColour = 0xFFFFFFFF) { + return m_localizationManager.formatHTMLString(iPad, desc, shadowColour); + } + std::wstring GetActionReplacement(int iPad, unsigned char ucAction) { + return m_localizationManager.getActionReplacement(iPad, ucAction); + } + std::wstring GetVKReplacement(unsigned int uiVKey) { + return m_localizationManager.getVKReplacement(uiVKey); + } + std::wstring GetIconReplacement(unsigned int uiIcon) { + return m_localizationManager.getIconReplacement(uiIcon); + } float getAppTime() { return m_Time.fAppTime; } void UpdateTrialPausedTimer() { mfTrialPausedTime += m_Time.fElapsedTime; } - static int RemoteSaveThreadProc(void* lpParameter); - static void ExitGameFromRemoteSave(void* lpParameter); + static int RemoteSaveThreadProc(void* lpParameter) { + return MenuController::remoteSaveThreadProc(lpParameter); + } + static void ExitGameFromRemoteSave(void* lpParameter) { + MenuController::exitGameFromRemoteSave(lpParameter); + } static int ExitGameFromRemoteSaveDialogReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result); - -private: - int m_TipIDA[MAX_TIPS_GAMETIP + MAX_TIPS_TRIVIATIP]; - unsigned int m_uiCurrentTip; - static int TipsSortFunction(const void* a, const void* b); + void* pParam, int iPad, C4JStorage::EMessageResult result) { + return MenuController::exitGameFromRemoteSaveDialogReturned(pParam, iPad, result); + } // XML public: // Hold a vector of terrain feature positions - void AddTerrainFeaturePosition(_eTerrainFeatureType, int, int); - void ClearTerrainFeaturePosition(); - _eTerrainFeatureType IsTerrainFeature(int x, int z); + void AddTerrainFeaturePosition(_eTerrainFeatureType eType, int x, int z) { + m_terrainFeatureManager.add(eType, x, z); + } + void ClearTerrainFeaturePosition() { m_terrainFeatureManager.clear(); } + _eTerrainFeatureType IsTerrainFeature(int x, int z) { + return m_terrainFeatureManager.isFeature(x, z); + } bool GetTerrainFeaturePosition(_eTerrainFeatureType eType, int* pX, - int* pZ); - std::vector m_vTerrainFeatures; + int* pZ) { + return m_terrainFeatureManager.getPosition(eType, pX, pZ); + } static int32_t RegisterMojangData(wchar_t*, PlayerUID, wchar_t*, wchar_t*); MOJANG_DATA* GetMojangDataForXuid(PlayerUID xuid); static int32_t RegisterConfigValues(wchar_t* pType, int iValue); - static int32_t RegisterDLCData(wchar_t*, wchar_t*, int, uint64_t, uint64_t, - wchar_t*, unsigned int, int, - wchar_t* pDataFile); + static int32_t RegisterDLCData(wchar_t* a, wchar_t* b, int c, uint64_t d, uint64_t e, + wchar_t* f, unsigned int g, int h, + wchar_t* pDataFile) { + return DLCController::registerDLCData(a, b, c, d, e, f, g, h, pDataFile); + } bool GetDLCFullOfferIDForSkinID(const std::wstring& FirstSkin, - uint64_t* pullVal); - DLC_INFO* GetDLCInfoForTrialOfferID(uint64_t ullOfferID_Trial); - DLC_INFO* GetDLCInfoForFullOfferID(uint64_t ullOfferID_Full); + uint64_t* pullVal) { + return m_dlcController.getDLCFullOfferIDForSkinID(FirstSkin, pullVal); + } + DLC_INFO* GetDLCInfoForTrialOfferID(uint64_t ullOfferID_Trial) { + return m_dlcController.getDLCInfoForTrialOfferID(ullOfferID_Trial); + } + DLC_INFO* GetDLCInfoForFullOfferID(uint64_t ullOfferID_Full) { + return m_dlcController.getDLCInfoForFullOfferID(ullOfferID_Full); + } - unsigned int GetDLCCreditsCount(); - SCreditTextItemDef* GetDLCCredits(int iIndex); + unsigned int GetDLCCreditsCount() { return m_dlcController.getDLCCreditsCount(); } + SCreditTextItemDef* GetDLCCredits(int iIndex) { return m_dlcController.getDLCCredits(iIndex); } // TMS void ReadDLCFileFromTMS(int iPad, eTMSAction action, @@ -692,90 +876,51 @@ public: void ReadBannedList(int iPad, eTMSAction action = (eTMSAction)0, bool bCallback = false) override = 0; -private: - std::vector vDLCCredits; - - static std::unordered_map MojangData; - static std::unordered_map - DLCTextures_PackID; // for mash-up packs & texture packs - static std::unordered_map - DLCInfo_Trial; // full offerid, dlc_info - static std::unordered_map - DLCInfo_Full; // full offerid, dlc_info - static std::unordered_map - DLCInfo_SkinName; // skin name, full offer id - // bool m_bRead_TMS_XUIDS_XML; // track whether we have already read the - // TMS xuids.xml file bool m_bRead_TMS_DLCINFO_XML; // track whether - // we have already read the TMS DLC.xml file - - bool m_bDefaultCapeInstallAttempted; // have we attempted to install the - // default cape from tms - - // bool m_bwasHidingGui; // 4J Stu - Removed 1.8.2 bug fix (TU6) as not - // needed - bool m_bDLCInstallProcessCompleted; - bool m_bDLCInstallPending; - int m_iTotalDLC; - int m_iTotalDLCInstalled; + // DLC data members moved to DLCController + // Sign-in info moved to NetworkController public: - // 4J Stu - We need to be able to detect when a guest player signs in or out - // causing other guest players to change their xuid The simplest way to do - // this is to check if their guest number has changed, so store the last - // known one here 4J Stu - Now storing the whole XUSER_SIGNIN_INFO so we can - // detect xuid changes - XUSER_SIGNIN_INFO m_currentSigninInfo[XUSER_MAX_COUNT]; // void OverrideFontRenderer(bool set, bool immediate = true); // void ToggleFontRenderer() { // OverrideFontRenderer(!m_bFontRendererOverridden,false); } - BANNEDLIST BannedListA[XUSER_MAX_COUNT]; - -private: - // XUI_FontRenderer *m_fontRenderer; - // bool m_bFontRendererOverridden; - // bool m_bOverrideFontRenderer; - - bool m_bRead_BannedListA[XUSER_MAX_COUNT]; - char m_pszUniqueMapName[14]; - bool m_BanListCheck[XUSER_MAX_COUNT]; + BANNEDLIST (&BannedListA)[XUSER_MAX_COUNT] = m_bannedListManager.BannedListA; public: - void SetBanListCheck(int iPad, bool bVal) { m_BanListCheck[iPad] = bVal; } - bool GetBanListCheck(int iPad) { return m_BanListCheck[iPad]; } + void SetBanListCheck(int iPad, bool bVal) { + m_bannedListManager.setBanListCheck(iPad, bVal); + } + bool GetBanListCheck(int iPad) { + return m_bannedListManager.getBanListCheck(iPad); + } // AUTOSAVE public: void SetAutosaveTimerTime(void); - bool AutosaveDue(void); - int64_t SecondsToAutosave(); + bool AutosaveDue(void) { return m_saveManager.autosaveDue(); } + int64_t SecondsToAutosave() { return m_saveManager.secondsToAutosave(); } -private: - time_util::time_point m_uiAutosaveTimer; - unsigned int m_uiOpacityCountDown[XUSER_MAX_COUNT]; - - // DLC - bool m_bNewDLCAvailable; - bool m_bSeenNewDLCTip; - - // Host options -private: - unsigned int m_uiGameHostSettings; - static unsigned char m_szPNG[8]; + // m_uiOpacityCountDown moved to MenuController + // DLC flags moved to DLCController + // Host options - m_uiGameHostSettings moved to GameSettingsManager + unsigned int& m_uiGameHostSettings = m_gameSettingsManager.m_uiGameHostSettings; #if defined(_LARGE_WORLDS) unsigned int m_GameNewWorldSize; bool m_bGameNewWorldSizeUseMoat; unsigned int m_GameNewHellScale; #endif - unsigned int FromBigEndian(unsigned int uiValue); public: void SetGameHostOption(eGameHostOption eVal, unsigned int uiVal); void SetGameHostOption(unsigned int& uiHostSettings, eGameHostOption eVal, - unsigned int uiVal); + unsigned int uiVal) { + m_gameSettingsManager.setGameHostOption(uiHostSettings, eVal, uiVal); + } unsigned int GetGameHostOption(eGameHostOption eVal); unsigned int GetGameHostOption(unsigned int uiHostSettings, - eGameHostOption eVal); + eGameHostOption eVal) { + return m_gameSettingsManager.getGameHostOption(uiHostSettings, eVal); + } #if defined(_LARGE_WORLDS) void SetGameNewWorldSize(unsigned int newSize, bool useMoat) { @@ -793,15 +938,21 @@ public: #endif void SetResetNether(bool bResetNether) { m_bResetNether = bResetNether; } bool GetResetNether() { return m_bResetNether; } - bool CanRecordStatsAndAchievements(); + bool CanRecordStatsAndAchievements() { + return m_gameSettingsManager.canRecordStatsAndAchievements(); + } - // World seed from png image + // World seed from png image - delegated to MenuController void GetImageTextData(std::uint8_t* imageData, unsigned int imageBytes, unsigned char* seedText, unsigned int& uiHostOptions, - bool& bHostOptionsRead, std::uint32_t& uiTexturePack); + bool& bHostOptionsRead, std::uint32_t& uiTexturePack) { + m_menuController.getImageTextData(imageData, imageBytes, seedText, uiHostOptions, bHostOptionsRead, uiTexturePack); + } unsigned int CreateImageTextData(std::uint8_t* textMetadata, int64_t seed, bool hasSeed, unsigned int uiHostOptions, - unsigned int uiTexturePackId); + unsigned int uiTexturePackId) { + return m_menuController.createImageTextData(textMetadata, seed, hasSeed, uiHostOptions, uiTexturePackId); + } // Game rules GameRuleManager m_gameRules; @@ -822,85 +973,85 @@ public: } const wchar_t* GetGameRulesString(const std::wstring& key); -private: - std::uint8_t m_playerColours[MINECRAFT_NET_MAX_PLAYERS]; // An array of - // QNet small-id's - unsigned int m_playerGamePrivileges[MINECRAFT_NET_MAX_PLAYERS]; + // m_playerColours and m_playerGamePrivileges moved to NetworkController public: void UpdatePlayerInfo(std::uint8_t networkSmallId, int16_t playerColourIndex, - unsigned int playerGamePrivileges); - short GetPlayerColour(std::uint8_t networkSmallId); - unsigned int GetPlayerPrivileges(std::uint8_t networkSmallId); + unsigned int playerGamePrivileges) { + m_networkController.updatePlayerInfo(networkSmallId, playerColourIndex, playerGamePrivileges); + } + short GetPlayerColour(std::uint8_t networkSmallId) { + return m_networkController.getPlayerColour(networkSmallId); + } + unsigned int GetPlayerPrivileges(std::uint8_t networkSmallId) { + return m_networkController.getPlayerPrivileges(networkSmallId); + } std::wstring getEntityName(eINSTANCEOF type); unsigned int AddDLCRequest(eDLCMarketplaceType eContentType, - bool bPromote = false); - bool RetrieveNextDLCContent(); - bool CheckTMSDLCCanStop(); - int dlcOffersReturned(int iOfferC, std::uint32_t dwType, int iPad); - std::uint32_t GetDLCContentType(eDLCContentType eType) { - return m_dwContentTypeA[eType]; + bool bPromote = false) { + return m_dlcController.addDLCRequest(eContentType, bPromote); } - eDLCContentType Find_eDLCContentType(std::uint32_t dwType); - int GetDLCOffersCount() { return m_iDLCOfferC; } - bool DLCContentRetrieved(eDLCMarketplaceType eType); - void TickDLCOffersRetrieved(); - void ClearAndResetDLCDownloadQueue(); - bool RetrieveNextTMSPPContent(); - void TickTMSPPFilesRetrieved(); - void ClearTMSPPFilesRetrieved(); + bool RetrieveNextDLCContent() { return m_dlcController.retrieveNextDLCContent(); } + bool CheckTMSDLCCanStop() { return m_dlcController.checkTMSDLCCanStop(); } + int dlcOffersReturned(int iOfferC, std::uint32_t dwType, int iPad) { + return m_dlcController.dlcOffersReturned(iOfferC, dwType, iPad); + } + std::uint32_t GetDLCContentType(eDLCContentType eType) { + return m_dlcController.getDLCContentType(eType); + } + eDLCContentType Find_eDLCContentType(std::uint32_t dwType) { + return m_dlcController.find_eDLCContentType(dwType); + } + int GetDLCOffersCount() { return m_dlcController.getDLCOffersCount(); } + bool DLCContentRetrieved(eDLCMarketplaceType eType) { + return m_dlcController.dlcContentRetrieved(eType); + } + void TickDLCOffersRetrieved() { m_dlcController.tickDLCOffersRetrieved(); } + void ClearAndResetDLCDownloadQueue() { m_dlcController.clearAndResetDLCDownloadQueue(); } + bool RetrieveNextTMSPPContent() { return m_dlcController.retrieveNextTMSPPContent(); } + void TickTMSPPFilesRetrieved() { m_dlcController.tickTMSPPFilesRetrieved(); } + void ClearTMSPPFilesRetrieved() { m_dlcController.clearTMSPPFilesRetrieved(); } unsigned int AddTMSPPFileTypeRequest(eDLCContentType eType, - bool bPromote = false); - int GetDLCInfoTexturesOffersCount(); + bool bPromote = false) { + return m_dlcController.addTMSPPFileTypeRequest(eType, bPromote); + } + int GetDLCInfoTexturesOffersCount() { return m_dlcController.getDLCInfoTexturesOffersCount(); } static int TMSPPFileReturned(void* pParam, int iPad, int iUserData, C4JStorage::PTMSPP_FILEDATA pFileData, - const char* szFilename); - DLC_INFO* GetDLCInfoTrialOffer(int iIndex); - DLC_INFO* GetDLCInfoFullOffer(int iIndex); + const char* szFilename) { + return DLCController::tmsPPFileReturned(pParam, iPad, iUserData, pFileData, szFilename); + } + DLC_INFO* GetDLCInfoTrialOffer(int iIndex) { return m_dlcController.getDLCInfoTrialOffer(iIndex); } + DLC_INFO* GetDLCInfoFullOffer(int iIndex) { return m_dlcController.getDLCInfoFullOffer(iIndex); } - int GetDLCInfoTrialOffersCount(); - int GetDLCInfoFullOffersCount(); - bool GetDLCFullOfferIDForPackID(const int iPackID, uint64_t* pullVal); - uint64_t GetDLCInfoTexturesFullOffer(int iIndex); + int GetDLCInfoTrialOffersCount() { return m_dlcController.getDLCInfoTrialOffersCount(); } + int GetDLCInfoFullOffersCount() { return m_dlcController.getDLCInfoFullOffersCount(); } + bool GetDLCFullOfferIDForPackID(const int iPackID, uint64_t* pullVal) { + return m_dlcController.getDLCFullOfferIDForPackID(iPackID, pullVal); + } + uint64_t GetDLCInfoTexturesFullOffer(int iIndex) { + return m_dlcController.getDLCInfoTexturesFullOffer(iIndex); + } void SetCorruptSaveDeleted(bool bVal) { m_bCorruptSaveDeleted = bVal; } bool GetCorruptSaveDeleted(void) { return m_bCorruptSaveDeleted; } - void lockSaveNotification(); - void unlockSaveNotification(); + void lockSaveNotification() { m_saveManager.lock(); } + void unlockSaveNotification() { m_saveManager.unlock(); } -private: - std::mutex m_saveNotificationMutex; - int m_saveNotificationDepth; - // Download Status - - // Request current_download; - std::vector m_DLCDownloadQueue; - std::vector m_TMSPPDownloadQueue; - static std::uint32_t m_dwContentTypeA[e_Marketplace_MAX]; - int m_iDLCOfferC; - bool m_bAllDLCContentRetrieved; - bool m_bAllTMSContentRetrieved; - bool m_bTickTMSDLCFiles; - std::mutex csDLCDownloadQueue; - std::mutex csTMSPPDownloadQueue; - std::mutex csAdditionalModelParts; - std::mutex csAdditionalSkinBoxes; - std::mutex csAnimOverrideBitmask; + // Download status members moved to DLCController bool m_bCorruptSaveDeleted; - std::uint32_t m_dwAdditionalModelParts[XUSER_MAX_COUNT]; - - std::uint8_t* m_pBannedListFileBuffer; - unsigned int m_dwBannedListFileSize; + std::uint8_t*& m_pBannedListFileBuffer = m_bannedListManager.m_pBannedListFileBuffer; + unsigned int& m_dwBannedListFileSize = m_bannedListManager.m_dwBannedListFileSize; public: - unsigned int m_dwDLCFileSize; - std::uint8_t* m_pDLCFileBuffer; + unsigned int& m_dwDLCFileSize = m_dlcController.m_dwDLCFileSize; + std::uint8_t*& m_pDLCFileBuffer = m_dlcController.m_pDLCFileBuffer; // static int CallbackReadXuidsFileFromTMS(void* lpParam, wchar_t // *wchFilename, int iPad, bool bResult, int iAction); static int @@ -911,17 +1062,33 @@ public: // Storing additional model parts per skin texture void SetAdditionalSkinBoxes(std::uint32_t dwSkinID, SKIN_BOX* SkinBoxA, - unsigned int dwSkinBoxC); + unsigned int dwSkinBoxC) { + m_skinManager.setAdditionalSkinBoxes(dwSkinID, SkinBoxA, dwSkinBoxC); + } std::vector* SetAdditionalSkinBoxes( - std::uint32_t dwSkinID, std::vector* pvSkinBoxA); - std::vector* GetAdditionalModelParts(std::uint32_t dwSkinID); - std::vector* GetAdditionalSkinBoxes(std::uint32_t dwSkinID); + std::uint32_t dwSkinID, std::vector* pvSkinBoxA) { + return m_skinManager.setAdditionalSkinBoxes(dwSkinID, pvSkinBoxA); + } + std::vector* GetAdditionalModelParts(std::uint32_t dwSkinID) { + return m_skinManager.getAdditionalModelParts(dwSkinID); + } + std::vector* GetAdditionalSkinBoxes(std::uint32_t dwSkinID) { + return m_skinManager.getAdditionalSkinBoxes(dwSkinID); + } void SetAnimOverrideBitmask(std::uint32_t dwSkinID, - unsigned int uiAnimOverrideBitmask); - unsigned int GetAnimOverrideBitmask(std::uint32_t dwSkinID); + unsigned int uiAnimOverrideBitmask) { + m_skinManager.setAnimOverrideBitmask(dwSkinID, uiAnimOverrideBitmask); + } + unsigned int GetAnimOverrideBitmask(std::uint32_t dwSkinID) { + return m_skinManager.getAnimOverrideBitmask(dwSkinID); + } - static std::uint32_t getSkinIdFromPath(const std::wstring& skin); - static std::wstring getSkinPathFromId(std::uint32_t skinId); + static std::uint32_t getSkinIdFromPath(const std::wstring& skin) { + return SkinManager::getSkinIdFromPath(skin); + } + static std::wstring getSkinPathFromId(std::uint32_t skinId) { + return SkinManager::getSkinPathFromId(skinId); + } int LoadLocalTMSFile(wchar_t* wchTMSFile) override = 0; int LoadLocalTMSFile(wchar_t* wchTMSFile, @@ -935,60 +1102,54 @@ public: virtual bool GetTMSDLCInfoRead() { return true; } virtual bool GetTMSXUIDsFileRead() { return true; } - bool GetBanListRead(int iPad) { return m_bRead_BannedListA[iPad]; } + bool GetBanListRead(int iPad) { + return m_bannedListManager.getBanListRead(iPad); + } void SetBanListRead(int iPad, bool bVal) { - m_bRead_BannedListA[iPad] = bVal; - } - void ClearBanList(int iPad) { - BannedListA[iPad].pBannedList = nullptr; - BannedListA[iPad].byteCount = 0; + m_bannedListManager.setBanListRead(iPad, bVal); } + void ClearBanList(int iPad) { m_bannedListManager.clearBanList(iPad); } std::uint32_t GetRequiredTexturePackID() { - return m_dwRequiredTexturePackID; + return m_archiveManager.getRequiredTexturePackID(); } void SetRequiredTexturePackID(std::uint32_t texturePackId) { - m_dwRequiredTexturePackID = texturePackId; + m_archiveManager.setRequiredTexturePackID(texturePackId); } virtual void GetFileFromTPD(eTPDFileType eType, std::uint8_t* pbData, unsigned int byteCount, std::uint8_t** ppbData, unsigned int* pByteCount) { - *ppbData = nullptr; - *pByteCount = 0; + m_archiveManager.getFileFromTPD(eType, pbData, byteCount, ppbData, + pByteCount); } // XTITLE_DEPLOYMENT_TYPE getDeploymentType() { return // m_titleDeploymentType; } private: - // vector of additional skin model parts, indexed by the skin texture id - std::unordered_map*> - m_AdditionalModelParts; - std::unordered_map*> - m_AdditionalSkinBoxes; - std::unordered_map m_AnimOverrides; - bool m_bResetNether; - std::uint32_t m_dwRequiredTexturePackID; // 4J-PB - language and locale functions public: - void LocaleAndLanguageInit(); - void getLocale(std::vector& vecWstrLocales); - int get_eMCLang(wchar_t* pwchLocale); - int get_xcLang(wchar_t* pwchLocale); + void LocaleAndLanguageInit() { m_localizationManager.localeAndLanguageInit(); } + void getLocale(std::vector& vecWstrLocales) { + m_localizationManager.getLocale(vecWstrLocales); + } + int get_eMCLang(wchar_t* pwchLocale) { + return m_localizationManager.get_eMCLang(pwchLocale); + } + int get_xcLang(wchar_t* pwchLocale) { + return m_localizationManager.get_xcLang(pwchLocale); + } - void SetTickTMSDLCFiles(bool bVal); + void SetTickTMSDLCFiles(bool bVal) { m_dlcController.setTickTMSDLCFiles(bVal); } std::wstring getFilePath(std::uint32_t packId, std::wstring filename, bool bAddDataFolder, std::wstring mountPoint = L"TPACK:"); private: - std::unordered_map m_localeA; - std::unordered_map m_eMCLangA; - std::unordered_map m_xcLangA; std::wstring getRootPath(std::uint32_t packId, bool allowOverride, bool bAddDataFolder, std::wstring mountPoint); diff --git a/targets/app/common/GameMenuService.cpp b/targets/app/common/GameMenuService.cpp new file mode 100644 index 000000000..3b4305841 --- /dev/null +++ b/targets/app/common/GameMenuService.cpp @@ -0,0 +1,58 @@ +#include "app/common/GameMenuService.h" + +#include "app/common/Game.h" + +bool GameMenuService::openInventory(int iPad, std::shared_ptr player, bool navigateBack) { + return game_.LoadInventoryMenu(iPad, player, navigateBack); +} +bool GameMenuService::openCreative(int iPad, std::shared_ptr player, bool navigateBack) { + return game_.LoadCreativeMenu(iPad, player, navigateBack); +} +bool GameMenuService::openCrafting2x2(int iPad, std::shared_ptr player) { + return game_.LoadCrafting2x2Menu(iPad, player); +} +bool GameMenuService::openCrafting3x3(int iPad, std::shared_ptr player, int x, int y, int z) { + return game_.LoadCrafting3x3Menu(iPad, player, x, y, z); +} +bool GameMenuService::openEnchanting(int iPad, std::shared_ptr inventory, int x, int y, int z, Level* level, const std::wstring& name) { + return game_.LoadEnchantingMenu(iPad, inventory, x, y, z, level, name); +} +bool GameMenuService::openFurnace(int iPad, std::shared_ptr inventory, std::shared_ptr furnace) { + return game_.LoadFurnaceMenu(iPad, inventory, furnace); +} +bool GameMenuService::openBrewingStand(int iPad, std::shared_ptr inventory, std::shared_ptr brewingStand) { + return game_.LoadBrewingStandMenu(iPad, inventory, brewingStand); +} +bool GameMenuService::openContainer(int iPad, std::shared_ptr inventory, std::shared_ptr container) { + return game_.LoadContainerMenu(iPad, inventory, container); +} +bool GameMenuService::openTrap(int iPad, std::shared_ptr inventory, std::shared_ptr trap) { + return game_.LoadTrapMenu(iPad, inventory, trap); +} +bool GameMenuService::openFireworks(int iPad, std::shared_ptr player, int x, int y, int z) { + return game_.LoadFireworksMenu(iPad, player, x, y, z); +} +bool GameMenuService::openSign(int iPad, std::shared_ptr sign) { + return game_.LoadSignEntryMenu(iPad, sign); +} +bool GameMenuService::openRepairing(int iPad, std::shared_ptr inventory, Level* level, int x, int y, int z) { + return game_.LoadRepairingMenu(iPad, inventory, level, x, y, z); +} +bool GameMenuService::openTrading(int iPad, std::shared_ptr inventory, std::shared_ptr trader, Level* level, const std::wstring& name) { + return game_.LoadTradingMenu(iPad, inventory, trader, level, name); +} +bool GameMenuService::openCommandBlock(int iPad, std::shared_ptr commandBlock) { + return game_.LoadCommandBlockMenu(iPad, commandBlock); +} +bool GameMenuService::openHopper(int iPad, std::shared_ptr inventory, std::shared_ptr hopper) { + return game_.LoadHopperMenu(iPad, inventory, hopper); +} +bool GameMenuService::openHopperMinecart(int iPad, std::shared_ptr inventory, std::shared_ptr hopper) { + return game_.LoadHopperMenu(iPad, inventory, hopper); +} +bool GameMenuService::openHorse(int iPad, std::shared_ptr inventory, std::shared_ptr container, std::shared_ptr horse) { + return game_.LoadHorseMenu(iPad, inventory, container, horse); +} +bool GameMenuService::openBeacon(int iPad, std::shared_ptr inventory, std::shared_ptr beacon) { + return game_.LoadBeaconMenu(iPad, inventory, beacon); +} diff --git a/targets/app/common/GameMenuService.h b/targets/app/common/GameMenuService.h new file mode 100644 index 000000000..cb056da7e --- /dev/null +++ b/targets/app/common/GameMenuService.h @@ -0,0 +1,54 @@ +#pragma once + +#include "minecraft/client/IMenuService.h" + +class Game; + +class GameMenuService : public IMenuService { +public: + explicit GameMenuService(Game& game) : game_(game) {} + + bool openInventory(int iPad, std::shared_ptr player, + bool navigateBack) override; + bool openCreative(int iPad, std::shared_ptr player, + bool navigateBack) override; + bool openCrafting2x2(int iPad, + std::shared_ptr player) override; + bool openCrafting3x3(int iPad, std::shared_ptr player, int x, + int y, int z) override; + bool openEnchanting(int iPad, std::shared_ptr inventory, int x, + int y, int z, Level* level, + const std::wstring& name) override; + bool openFurnace(int iPad, std::shared_ptr inventory, + std::shared_ptr furnace) override; + bool openBrewingStand( + int iPad, std::shared_ptr inventory, + std::shared_ptr brewingStand) override; + bool openContainer(int iPad, std::shared_ptr inventory, + std::shared_ptr container) override; + bool openTrap(int iPad, std::shared_ptr inventory, + std::shared_ptr trap) override; + bool openFireworks(int iPad, std::shared_ptr player, int x, + int y, int z) override; + bool openSign(int iPad, std::shared_ptr sign) override; + bool openRepairing(int iPad, std::shared_ptr inventory, + Level* level, int x, int y, int z) override; + bool openTrading(int iPad, std::shared_ptr inventory, + std::shared_ptr trader, Level* level, + const std::wstring& name) override; + bool openCommandBlock( + int iPad, std::shared_ptr commandBlock) override; + bool openHopper(int iPad, std::shared_ptr inventory, + std::shared_ptr hopper) override; + bool openHopperMinecart( + int iPad, std::shared_ptr inventory, + std::shared_ptr hopper) override; + bool openHorse(int iPad, std::shared_ptr inventory, + std::shared_ptr container, + std::shared_ptr horse) override; + bool openBeacon(int iPad, std::shared_ptr inventory, + std::shared_ptr beacon) override; + +private: + Game& game_; +}; diff --git a/targets/app/common/GameRules/ConsoleGameRules.h b/targets/app/common/GameRules/ConsoleGameRules.h new file mode 100644 index 000000000..765acff99 --- /dev/null +++ b/targets/app/common/GameRules/ConsoleGameRules.h @@ -0,0 +1,25 @@ +#pragma once +#include "ConsoleGameRulesConstants.h" +#include "GameRuleManager.h" +#include "app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.h" +#include "app/common/GameRules/LevelGeneration/BiomeOverride.h" +#include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.h" +#include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h" +#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "app/common/GameRules/LevelGeneration/StartFeature.h" +#include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.h" +#include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h" +#include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.h" +#include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.h" +#include "app/common/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.h" +#include "app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.h" +#include "app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.h" +#include "app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.h" +#include "app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h" +#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h" +#include "app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.h" +#include "app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.h" +#include "app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.h" +#include "app/common/GameRules/LevelRules/Rules/GameRule.h" +#include "app/common/GameRules/LevelRules/Rules/GameRulesInstance.h" diff --git a/targets/app/common/src/GameRules/ConsoleGameRulesConstants.h b/targets/app/common/GameRules/ConsoleGameRulesConstants.h similarity index 100% rename from targets/app/common/src/GameRules/ConsoleGameRulesConstants.h rename to targets/app/common/GameRules/ConsoleGameRulesConstants.h diff --git a/targets/app/common/src/GameRules/GameRuleManager.cpp b/targets/app/common/GameRules/GameRuleManager.cpp similarity index 97% rename from targets/app/common/src/GameRules/GameRuleManager.cpp rename to targets/app/common/GameRules/GameRuleManager.cpp index 9c14da10e..000e198b9 100644 --- a/targets/app/common/src/GameRules/GameRuleManager.cpp +++ b/targets/app/common/GameRules/GameRuleManager.cpp @@ -7,18 +7,18 @@ #include #include -#include "app/common/src/DLC/DLCGameRulesFile.h" -#include "app/common/src/DLC/DLCGameRulesHeader.h" -#include "app/common/src/DLC/DLCLocalisationFile.h" -#include "app/common/src/DLC/DLCManager.h" -#include "app/common/src/DLC/DLCPack.h" -#include "app/common/src/GameRules/LevelGeneration/ConsoleSchematicFile.h" -#include "app/common/src/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/common/src/GameRules/LevelGeneration/LevelGenerators.h" -#include "app/common/src/GameRules/LevelRules/LevelRules.h" -#include "app/common/src/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" -#include "app/common/src/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h" -#include "app/common/src/Localisation/StringTable.h" +#include "app/common/DLC/DLCGameRulesFile.h" +#include "app/common/DLC/DLCGameRulesHeader.h" +#include "app/common/DLC/DLCLocalisationFile.h" +#include "app/common/DLC/DLCManager.h" +#include "app/common/DLC/DLCPack.h" +#include "app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h" +#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "app/common/GameRules/LevelGeneration/LevelGenerators.h" +#include "app/common/GameRules/LevelRules/LevelRules.h" +#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h" +#include "app/common/Localisation/StringTable.h" #include "app/linux/LinuxGame.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "java/File.h" diff --git a/targets/app/common/src/GameRules/GameRuleManager.h b/targets/app/common/GameRules/GameRuleManager.h similarity index 92% rename from targets/app/common/src/GameRules/GameRuleManager.h rename to targets/app/common/GameRules/GameRuleManager.h index 63b837550..674b836e7 100644 --- a/targets/app/common/src/GameRules/GameRuleManager.h +++ b/targets/app/common/GameRules/GameRuleManager.h @@ -7,10 +7,10 @@ #include #include -#include "app/common/src/DLC/DLCGameRulesHeader.h" -#include "app/common/src/GameRules/ConsoleGameRulesConstants.h" -#include "app/common/src/GameRules/LevelGeneration/LevelGenerators.h" -#include "app/common/src/GameRules/LevelRules/LevelRules.h" +#include "app/common/DLC/DLCGameRulesHeader.h" +#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "app/common/GameRules/LevelGeneration/LevelGenerators.h" +#include "app/common/GameRules/LevelRules/LevelRules.h" class LevelGenerationOptions; class RootGameRulesDefinition; diff --git a/targets/app/common/src/GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp b/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp similarity index 98% rename from targets/app/common/src/GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp rename to targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp index a837ef0a2..372674e3a 100644 --- a/targets/app/common/src/GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp @@ -5,8 +5,8 @@ #include "ConsoleSchematicFile.h" #include "LevelGenerationOptions.h" -#include "app/common/src/GameRules/ConsoleGameRulesConstants.h" -#include "app/common/src/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" #include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" #include "java/InputOutputStream/DataOutputStream.h" diff --git a/targets/app/common/src/GameRules/LevelGeneration/ApplySchematicRuleDefinition.h b/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.h similarity index 92% rename from targets/app/common/src/GameRules/LevelGeneration/ApplySchematicRuleDefinition.h rename to targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.h index ddd61f367..8de7747bf 100644 --- a/targets/app/common/src/GameRules/LevelGeneration/ApplySchematicRuleDefinition.h +++ b/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.h @@ -5,8 +5,8 @@ #include #include "ConsoleSchematicFile.h" -#include "app/common/src/GameRules/ConsoleGameRulesConstants.h" -#include "app/common/src/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" #include "minecraft/world/phys/AABB.h" #include "minecraft/world/phys/Vec3.h" diff --git a/targets/app/common/src/GameRules/LevelGeneration/BiomeOverride.cpp b/targets/app/common/GameRules/LevelGeneration/BiomeOverride.cpp similarity index 92% rename from targets/app/common/src/GameRules/LevelGeneration/BiomeOverride.cpp rename to targets/app/common/GameRules/LevelGeneration/BiomeOverride.cpp index 43e41bb85..e466eb9b7 100644 --- a/targets/app/common/src/GameRules/LevelGeneration/BiomeOverride.cpp +++ b/targets/app/common/GameRules/LevelGeneration/BiomeOverride.cpp @@ -1,7 +1,7 @@ #include "BiomeOverride.h" -#include "app/common/src/GameRules/ConsoleGameRulesConstants.h" -#include "app/common/src/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" #include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" #include "java/InputOutputStream/DataOutputStream.h" diff --git a/targets/app/common/src/GameRules/LevelGeneration/BiomeOverride.h b/targets/app/common/GameRules/LevelGeneration/BiomeOverride.h similarity index 82% rename from targets/app/common/src/GameRules/LevelGeneration/BiomeOverride.h rename to targets/app/common/GameRules/LevelGeneration/BiomeOverride.h index f55cce44a..014ac4107 100644 --- a/targets/app/common/src/GameRules/LevelGeneration/BiomeOverride.h +++ b/targets/app/common/GameRules/LevelGeneration/BiomeOverride.h @@ -4,8 +4,8 @@ #include #include -#include "app/common/src/GameRules/ConsoleGameRulesConstants.h" -#include "app/common/src/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" class BiomeOverride : public GameRuleDefinition { private: diff --git a/targets/app/common/src/GameRules/LevelGeneration/ConsoleGenerateStructure.cpp b/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.cpp similarity index 91% rename from targets/app/common/src/GameRules/LevelGeneration/ConsoleGenerateStructure.cpp rename to targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.cpp index 98be85fb3..67ac87059 100644 --- a/targets/app/common/src/GameRules/LevelGeneration/ConsoleGenerateStructure.cpp +++ b/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.cpp @@ -4,13 +4,13 @@ #include -#include "app/common/src/GameRules/ConsoleGameRulesConstants.h" -#include "app/common/src/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h" -#include "app/common/src/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.h" -#include "app/common/src/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h" -#include "app/common/src/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.h" -#include "app/common/src/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.h" -#include "app/common/src/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h" +#include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.h" +#include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h" +#include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.h" +#include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.h" +#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" #include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" #include "java/InputOutputStream/DataOutputStream.h" diff --git a/targets/app/common/src/GameRules/LevelGeneration/ConsoleGenerateStructure.h b/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.h similarity index 91% rename from targets/app/common/src/GameRules/LevelGeneration/ConsoleGenerateStructure.h rename to targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.h index 207c6d4d0..e4bd1c208 100644 --- a/targets/app/common/src/GameRules/LevelGeneration/ConsoleGenerateStructure.h +++ b/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.h @@ -2,8 +2,8 @@ #include #include -#include "app/common/src/GameRules/ConsoleGameRulesConstants.h" -#include "app/common/src/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" #include "minecraft/world/level/levelgen/structure/StructureFeatureIO.h" #include "minecraft/world/level/levelgen/structure/StructurePiece.h" diff --git a/targets/app/common/src/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h b/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h similarity index 68% rename from targets/app/common/src/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h rename to targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h index 7e2cf7f14..f8f1014a2 100644 --- a/targets/app/common/src/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h +++ b/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h @@ -1,6 +1,6 @@ #pragma once -#include "app/common/src/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" class ConsoleGenerateStructureAction : public GameRuleDefinition { public: diff --git a/targets/app/common/src/GameRules/LevelGeneration/ConsoleSchematicFile.cpp b/targets/app/common/GameRules/LevelGeneration/ConsoleSchematicFile.cpp similarity index 100% rename from targets/app/common/src/GameRules/LevelGeneration/ConsoleSchematicFile.cpp rename to targets/app/common/GameRules/LevelGeneration/ConsoleSchematicFile.cpp diff --git a/targets/app/common/src/GameRules/LevelGeneration/ConsoleSchematicFile.h b/targets/app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h similarity index 100% rename from targets/app/common/src/GameRules/LevelGeneration/ConsoleSchematicFile.h rename to targets/app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h diff --git a/targets/app/common/src/GameRules/LevelGeneration/LevelGenerationOptions.cpp b/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp similarity index 97% rename from targets/app/common/src/GameRules/LevelGeneration/LevelGenerationOptions.cpp rename to targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp index 33f77d6c1..476557a6b 100644 --- a/targets/app/common/src/GameRules/LevelGeneration/LevelGenerationOptions.cpp +++ b/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp @@ -6,18 +6,18 @@ #include #include -#include "app/common/App_enums.h" -#include "app/common/src/DLC/DLCGameRulesHeader.h" -#include "app/common/src/DLC/DLCManager.h" -#include "app/common/src/DLC/DLCPack.h" -#include "app/common/src/GameRules/GameRuleManager.h" -#include "app/common/src/GameRules/LevelGeneration/ApplySchematicRuleDefinition.h" -#include "app/common/src/GameRules/LevelGeneration/BiomeOverride.h" -#include "app/common/src/GameRules/LevelGeneration/ConsoleGenerateStructure.h" -#include "app/common/src/GameRules/LevelGeneration/ConsoleSchematicFile.h" -#include "app/common/src/GameRules/LevelGeneration/StartFeature.h" -#include "app/common/src/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" -#include "app/common/src/Localisation/StringTable.h" +#include "minecraft/GameEnums.h" +#include "app/common/DLC/DLCGameRulesHeader.h" +#include "app/common/DLC/DLCManager.h" +#include "app/common/DLC/DLCPack.h" +#include "app/common/GameRules/GameRuleManager.h" +#include "app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.h" +#include "app/common/GameRules/LevelGeneration/BiomeOverride.h" +#include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.h" +#include "app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h" +#include "app/common/GameRules/LevelGeneration/StartFeature.h" +#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "app/common/Localisation/StringTable.h" #include "app/linux/LinuxGame.h" #include "app/linux/Stubs/winapi_stubs.h" #include "java/File.h" diff --git a/targets/app/common/src/GameRules/LevelGeneration/LevelGenerationOptions.h b/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.h similarity index 97% rename from targets/app/common/src/GameRules/LevelGeneration/LevelGenerationOptions.h rename to targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.h index 90fad20f5..cf70675e8 100644 --- a/targets/app/common/src/GameRules/LevelGeneration/LevelGenerationOptions.h +++ b/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.h @@ -8,10 +8,10 @@ #include #include -#include "app/common/src/DLC/DLCPack.h" -#include "app/common/src/GameRules/ConsoleGameRulesConstants.h" -#include "app/common/src/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" -#include "app/common/src/Localisation/StringTable.h" +#include "app/common/DLC/DLCPack.h" +#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "app/common/Localisation/StringTable.h" #include "minecraft/world/level/levelgen/structure/StructureFeature.h" class ApplySchematicRuleDefinition; diff --git a/targets/app/common/src/GameRules/LevelGeneration/LevelGenerators.cpp b/targets/app/common/GameRules/LevelGeneration/LevelGenerators.cpp similarity index 100% rename from targets/app/common/src/GameRules/LevelGeneration/LevelGenerators.cpp rename to targets/app/common/GameRules/LevelGeneration/LevelGenerators.cpp diff --git a/targets/app/common/src/GameRules/LevelGeneration/LevelGenerators.h b/targets/app/common/GameRules/LevelGeneration/LevelGenerators.h similarity index 100% rename from targets/app/common/src/GameRules/LevelGeneration/LevelGenerators.h rename to targets/app/common/GameRules/LevelGeneration/LevelGenerators.h diff --git a/targets/app/common/src/GameRules/LevelGeneration/StartFeature.cpp b/targets/app/common/GameRules/LevelGeneration/StartFeature.cpp similarity index 94% rename from targets/app/common/src/GameRules/LevelGeneration/StartFeature.cpp rename to targets/app/common/GameRules/LevelGeneration/StartFeature.cpp index b66efbaa4..225048439 100644 --- a/targets/app/common/src/GameRules/LevelGeneration/StartFeature.cpp +++ b/targets/app/common/GameRules/LevelGeneration/StartFeature.cpp @@ -1,7 +1,7 @@ #include "StartFeature.h" -#include "app/common/src/GameRules/ConsoleGameRulesConstants.h" -#include "app/common/src/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" #include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" #include "java/InputOutputStream/DataOutputStream.h" diff --git a/targets/app/common/src/GameRules/LevelGeneration/StartFeature.h b/targets/app/common/GameRules/LevelGeneration/StartFeature.h similarity index 84% rename from targets/app/common/src/GameRules/LevelGeneration/StartFeature.h rename to targets/app/common/GameRules/LevelGeneration/StartFeature.h index c54c671b2..c5716be6e 100644 --- a/targets/app/common/src/GameRules/LevelGeneration/StartFeature.h +++ b/targets/app/common/GameRules/LevelGeneration/StartFeature.h @@ -3,8 +3,8 @@ #include -#include "app/common/src/GameRules/ConsoleGameRulesConstants.h" -#include "app/common/src/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" #include "minecraft/world/level/levelgen/structure/StructureFeature.h" class StartFeature : public GameRuleDefinition { diff --git a/targets/app/common/src/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.cpp b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.cpp similarity index 94% rename from targets/app/common/src/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.cpp rename to targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.cpp index 00ae3e039..051d7419c 100644 --- a/targets/app/common/src/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.cpp +++ b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.cpp @@ -1,8 +1,8 @@ #include "XboxStructureActionGenerateBox.h" -#include "app/common/src/GameRules/ConsoleGameRulesConstants.h" -#include "app/common/src/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h" -#include "app/common/src/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h" +#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" #include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" #include "java/InputOutputStream/DataOutputStream.h" diff --git a/targets/app/common/src/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.h b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.h similarity index 85% rename from targets/app/common/src/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.h rename to targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.h index 2d20f138f..41c058abc 100644 --- a/targets/app/common/src/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.h +++ b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.h @@ -1,8 +1,8 @@ #pragma once #include -#include "app/common/src/GameRules/ConsoleGameRulesConstants.h" -#include "app/common/src/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h" +#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h" class StructurePiece; class Level; diff --git a/targets/app/common/src/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.cpp b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.cpp similarity index 92% rename from targets/app/common/src/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.cpp rename to targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.cpp index 8f54aa1ec..e9c20b361 100644 --- a/targets/app/common/src/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.cpp +++ b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.cpp @@ -1,8 +1,8 @@ #include "XboxStructureActionPlaceBlock.h" -#include "app/common/src/GameRules/ConsoleGameRulesConstants.h" -#include "app/common/src/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h" -#include "app/common/src/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h" +#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" #include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" #include "java/InputOutputStream/DataOutputStream.h" diff --git a/targets/app/common/src/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h similarity index 85% rename from targets/app/common/src/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h rename to targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h index 9d755899b..ccf3e961d 100644 --- a/targets/app/common/src/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h +++ b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h @@ -1,8 +1,8 @@ #pragma once #include -#include "app/common/src/GameRules/ConsoleGameRulesConstants.h" -#include "app/common/src/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h" +#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h" class StructurePiece; class Level; diff --git a/targets/app/common/src/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.cpp b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.cpp similarity index 93% rename from targets/app/common/src/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.cpp rename to targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.cpp index 4e807c820..8dfb354cd 100644 --- a/targets/app/common/src/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.cpp +++ b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.cpp @@ -4,9 +4,9 @@ #include -#include "app/common/src/GameRules/ConsoleGameRulesConstants.h" -#include "app/common/src/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h" -#include "app/common/src/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.h" +#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h" +#include "app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.h" #include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" #include "minecraft/world/Container.h" diff --git a/targets/app/common/src/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.h b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.h similarity index 94% rename from targets/app/common/src/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.h rename to targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.h index 2c5e2ae1e..bb15f2630 100644 --- a/targets/app/common/src/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.h +++ b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.h @@ -3,7 +3,7 @@ #include #include -#include "app/common/src/GameRules/ConsoleGameRulesConstants.h" +#include "app/common/GameRules/ConsoleGameRulesConstants.h" #include "XboxStructureActionPlaceBlock.h" class AddItemRuleDefinition; diff --git a/targets/app/common/src/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.cpp b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.cpp similarity index 94% rename from targets/app/common/src/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.cpp rename to targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.cpp index 6596f5fcf..31512bd14 100644 --- a/targets/app/common/src/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.cpp +++ b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.cpp @@ -4,8 +4,8 @@ #include -#include "app/common/src/GameRules/ConsoleGameRulesConstants.h" -#include "app/common/src/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h" +#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/levelgen/structure/BoundingBox.h" diff --git a/targets/app/common/src/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.h b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.h similarity index 92% rename from targets/app/common/src/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.h rename to targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.h index 23551dbb7..5fc9e989c 100644 --- a/targets/app/common/src/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.h +++ b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.h @@ -2,7 +2,7 @@ #include -#include "app/common/src/GameRules/ConsoleGameRulesConstants.h" +#include "app/common/GameRules/ConsoleGameRulesConstants.h" #include "XboxStructureActionPlaceBlock.h" class StructurePiece; diff --git a/targets/app/common/src/GameRules/LevelRules/LevelRules.cpp b/targets/app/common/GameRules/LevelRules/LevelRules.cpp similarity index 100% rename from targets/app/common/src/GameRules/LevelRules/LevelRules.cpp rename to targets/app/common/GameRules/LevelRules/LevelRules.cpp diff --git a/targets/app/common/src/GameRules/LevelRules/LevelRules.h b/targets/app/common/GameRules/LevelRules/LevelRules.h similarity index 100% rename from targets/app/common/src/GameRules/LevelRules/LevelRules.h rename to targets/app/common/GameRules/LevelRules/LevelRules.h diff --git a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.cpp similarity index 95% rename from targets/app/common/src/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.cpp rename to targets/app/common/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.cpp index 1233444c1..5e7e4472d 100644 --- a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.cpp @@ -3,8 +3,8 @@ #include #include -#include "app/common/src/GameRules/ConsoleGameRulesConstants.h" -#include "app/common/src/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" #include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" #include "java/InputOutputStream/DataOutputStream.h" diff --git a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.h b/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.h similarity index 91% rename from targets/app/common/src/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.h rename to targets/app/common/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.h index e1d3c1edd..ba4b9b488 100644 --- a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.h +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.h @@ -4,7 +4,7 @@ #include #include "GameRuleDefinition.h" -#include "app/common/src/GameRules/ConsoleGameRulesConstants.h" +#include "app/common/GameRules/ConsoleGameRulesConstants.h" class ItemInstance; diff --git a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.cpp similarity index 96% rename from targets/app/common/src/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.cpp rename to targets/app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.cpp index 0d541b7dc..eb3805c4c 100644 --- a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.cpp @@ -3,8 +3,8 @@ #include #include "AddEnchantmentRuleDefinition.h" -#include "app/common/src/GameRules/ConsoleGameRulesConstants.h" -#include "app/common/src/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" #include "util/StringHelpers.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/world/Container.h" diff --git a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.h b/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.h similarity index 94% rename from targets/app/common/src/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.h rename to targets/app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.h index dd21a0414..3bc21d700 100644 --- a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.h +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.h @@ -5,7 +5,7 @@ #include #include "GameRuleDefinition.h" -#include "app/common/src/GameRules/ConsoleGameRulesConstants.h" +#include "app/common/GameRules/ConsoleGameRulesConstants.h" class Container; class AddEnchantmentRuleDefinition; diff --git a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.cpp similarity index 94% rename from targets/app/common/src/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.cpp rename to targets/app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.cpp index f12a9428c..f1ae569f7 100644 --- a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.cpp @@ -1,9 +1,9 @@ #include "CollectItemRuleDefinition.h" -#include "app/common/src/GameRules/ConsoleGameRulesConstants.h" -#include "app/common/src/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" -#include "app/common/src/GameRules/LevelRules/Rules/GameRule.h" -#include "app/common/src/GameRules/LevelRules/Rules/GameRulesInstance.h" +#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "app/common/GameRules/LevelRules/Rules/GameRule.h" +#include "app/common/GameRules/LevelRules/Rules/GameRulesInstance.h" #include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" #include "java/InputOutputStream/DataOutputStream.h" diff --git a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.h b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.h similarity index 90% rename from targets/app/common/src/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.h rename to targets/app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.h index 8e40a3dcf..2bd8567f0 100644 --- a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.h +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.h @@ -4,8 +4,8 @@ #include #include "GameRuleDefinition.h" -#include "app/common/src/GameRules/ConsoleGameRulesConstants.h" -#include "app/common/src/GameRules/LevelRules/Rules/GameRulesInstance.h" +#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "app/common/GameRules/LevelRules/Rules/GameRulesInstance.h" class Pos; class UseTileRuleDefinition; diff --git a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.cpp similarity index 91% rename from targets/app/common/src/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.cpp rename to targets/app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.cpp index d9e25e2d0..8eae45405 100644 --- a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.cpp @@ -4,9 +4,9 @@ #include #include -#include "app/common/src/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h" -#include "app/common/src/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" -#include "app/common/src/GameRules/LevelRules/Rules/GameRule.h" +#include "app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h" +#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "app/common/GameRules/LevelRules/Rules/GameRule.h" #include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" #include "minecraft/network/Connection.h" diff --git a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.h b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.h similarity index 92% rename from targets/app/common/src/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.h rename to targets/app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.h index de8cef785..f32212ea2 100644 --- a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.h +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.h @@ -3,7 +3,7 @@ #include #include "CompoundGameRuleDefinition.h" -#include "app/common/src/GameRules/ConsoleGameRulesConstants.h" +#include "app/common/GameRules/ConsoleGameRulesConstants.h" class GameRule; diff --git a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.cpp similarity index 85% rename from targets/app/common/src/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.cpp rename to targets/app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.cpp index 0d3907fa8..0e3b3e54a 100644 --- a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.cpp @@ -7,14 +7,14 @@ #include #include -#include "app/common/src/GameRules/ConsoleGameRulesConstants.h" -#include "app/common/src/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.h" -#include "app/common/src/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.h" -#include "app/common/src/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" -#include "app/common/src/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.h" -#include "app/common/src/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.h" -#include "app/common/src/GameRules/LevelRules/Rules/GameRule.h" -#include "app/common/src/GameRules/LevelRules/Rules/GameRulesInstance.h" +#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.h" +#include "app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.h" +#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.h" +#include "app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.h" +#include "app/common/GameRules/LevelRules/Rules/GameRule.h" +#include "app/common/GameRules/LevelRules/Rules/GameRulesInstance.h" #include "util/StringHelpers.h" CompoundGameRuleDefinition::CompoundGameRuleDefinition() { diff --git a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h similarity index 86% rename from targets/app/common/src/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h rename to targets/app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h index e9423599e..26b89124e 100644 --- a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h @@ -3,8 +3,8 @@ #include #include "GameRuleDefinition.h" -#include "app/common/src/GameRules/ConsoleGameRulesConstants.h" -#include "app/common/src/GameRules/LevelRules/Rules/GameRulesInstance.h" +#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "app/common/GameRules/LevelRules/Rules/GameRulesInstance.h" class CompoundGameRuleDefinition : public GameRuleDefinition { protected: diff --git a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.cpp similarity index 91% rename from targets/app/common/src/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.cpp rename to targets/app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.cpp index ab7bcdbed..7ea580b34 100644 --- a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.cpp @@ -1,4 +1,4 @@ -#include "app/common/src/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" #include #include @@ -8,11 +8,11 @@ #include #include -#include "app/common/src/GameRules/ConsoleGameRulesConstants.h" -#include "app/common/src/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.h" -#include "app/common/src/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h" -#include "app/common/src/GameRules/LevelRules/Rules/GameRule.h" -#include "app/common/src/GameRules/LevelRules/Rules/GameRulesInstance.h" +#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.h" +#include "app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h" +#include "app/common/GameRules/LevelRules/Rules/GameRule.h" +#include "app/common/GameRules/LevelRules/Rules/GameRulesInstance.h" #include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" #include "java/InputOutputStream/DataOutputStream.h" diff --git a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h b/targets/app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h similarity index 95% rename from targets/app/common/src/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h rename to targets/app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h index 179336f75..706914467 100644 --- a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h @@ -6,8 +6,8 @@ #include #include -#include "app/common/src/GameRules/ConsoleGameRulesConstants.h" -#include "app/common/src/GameRules/LevelRules/Rules/GameRulesInstance.h" +#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "app/common/GameRules/LevelRules/Rules/GameRulesInstance.h" #include "minecraft/world/item/ItemInstance.h" class GameRule; diff --git a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/LevelRuleset.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.cpp similarity index 82% rename from targets/app/common/src/GameRules/LevelRules/RuleDefinitions/LevelRuleset.cpp rename to targets/app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.cpp index cfba4e883..96e85c8ca 100644 --- a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/LevelRuleset.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.cpp @@ -1,9 +1,9 @@ #include "LevelRuleset.h" -#include "app/common/src/GameRules/ConsoleGameRulesConstants.h" -#include "app/common/src/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h" -#include "app/common/src/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.h" -#include "app/common/src/Localisation/StringTable.h" +#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h" +#include "app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.h" +#include "app/common/Localisation/StringTable.h" class AABB; diff --git a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h b/targets/app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h similarity index 93% rename from targets/app/common/src/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h rename to targets/app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h index 2cb2f546e..52e70174e 100644 --- a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h @@ -4,7 +4,7 @@ #include #include "CompoundGameRuleDefinition.h" -#include "app/common/src/GameRules/ConsoleGameRulesConstants.h" +#include "app/common/GameRules/ConsoleGameRulesConstants.h" class NamedAreaRuleDefinition; class AABB; diff --git a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.cpp similarity index 95% rename from targets/app/common/src/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.cpp rename to targets/app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.cpp index cd2d37903..28e46d186 100644 --- a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.cpp @@ -2,8 +2,8 @@ #include -#include "app/common/src/GameRules/ConsoleGameRulesConstants.h" -#include "app/common/src/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" #include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" #include "java/InputOutputStream/DataOutputStream.h" diff --git a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.h b/targets/app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.h similarity index 91% rename from targets/app/common/src/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.h rename to targets/app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.h index 49394ff67..19c5c87fa 100644 --- a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.h +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.h @@ -3,7 +3,7 @@ #include #include "GameRuleDefinition.h" -#include "app/common/src/GameRules/ConsoleGameRulesConstants.h" +#include "app/common/GameRules/ConsoleGameRulesConstants.h" #include "minecraft/world/phys/AABB.h" class NamedAreaRuleDefinition : public GameRuleDefinition { diff --git a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.cpp similarity index 95% rename from targets/app/common/src/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.cpp rename to targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.cpp index cdbcf25fe..58dfecb6c 100644 --- a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.cpp @@ -4,9 +4,9 @@ #include -#include "app/common/src/GameRules/ConsoleGameRulesConstants.h" -#include "app/common/src/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.h" -#include "app/common/src/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.h" +#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" #include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" #include "java/InputOutputStream/DataOutputStream.h" diff --git a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.h b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.h similarity index 94% rename from targets/app/common/src/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.h rename to targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.h index a0e6c00ac..f529dd355 100644 --- a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.h +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.h @@ -5,7 +5,7 @@ #include #include "GameRuleDefinition.h" -#include "app/common/src/GameRules/ConsoleGameRulesConstants.h" +#include "app/common/GameRules/ConsoleGameRulesConstants.h" class AddItemRuleDefinition; class Pos; diff --git a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.cpp similarity index 95% rename from targets/app/common/src/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.cpp rename to targets/app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.cpp index bddf63ba0..a47b7e6b4 100644 --- a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.cpp @@ -1,7 +1,7 @@ #include "UseTileRuleDefinition.h" -#include "app/common/src/GameRules/ConsoleGameRulesConstants.h" -#include "app/common/src/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" #include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" #include "java/InputOutputStream/DataOutputStream.h" diff --git a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.h b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.h similarity index 92% rename from targets/app/common/src/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.h rename to targets/app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.h index e07ff80ff..eb72a020b 100644 --- a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.h +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.h @@ -4,7 +4,7 @@ #include #include "GameRuleDefinition.h" -#include "app/common/src/GameRules/ConsoleGameRulesConstants.h" +#include "app/common/GameRules/ConsoleGameRulesConstants.h" #include "minecraft/Pos.h" class UseTileRuleDefinition : public GameRuleDefinition { diff --git a/targets/app/common/src/GameRules/LevelRules/Rules/GameRule.cpp b/targets/app/common/GameRules/LevelRules/Rules/GameRule.cpp similarity index 94% rename from targets/app/common/src/GameRules/LevelRules/Rules/GameRule.cpp rename to targets/app/common/GameRules/LevelRules/Rules/GameRule.cpp index 1d6e93938..5d00d72cd 100644 --- a/targets/app/common/src/GameRules/LevelRules/Rules/GameRule.cpp +++ b/targets/app/common/GameRules/LevelRules/Rules/GameRule.cpp @@ -1,5 +1,5 @@ -#include "app/common/src/GameRules/LevelRules/Rules/GameRule.h" +#include "app/common/GameRules/LevelRules/Rules/GameRule.h" #include @@ -8,7 +8,7 @@ #include #include -#include "app/common/src/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" #include "app/linux/Stubs/winapi_stubs.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" diff --git a/targets/app/common/src/GameRules/LevelRules/Rules/GameRule.h b/targets/app/common/GameRules/LevelRules/Rules/GameRule.h similarity index 100% rename from targets/app/common/src/GameRules/LevelRules/Rules/GameRule.h rename to targets/app/common/GameRules/LevelRules/Rules/GameRule.h diff --git a/targets/app/common/src/GameRules/LevelRules/Rules/GameRulesInstance.h b/targets/app/common/GameRules/LevelRules/Rules/GameRulesInstance.h similarity index 100% rename from targets/app/common/src/GameRules/LevelRules/Rules/GameRulesInstance.h rename to targets/app/common/GameRules/LevelRules/Rules/GameRulesInstance.h diff --git a/targets/app/common/src/GameRules/WstringLookup.cpp b/targets/app/common/GameRules/WstringLookup.cpp similarity index 100% rename from targets/app/common/src/GameRules/WstringLookup.cpp rename to targets/app/common/GameRules/WstringLookup.cpp diff --git a/targets/app/common/src/GameRules/WstringLookup.h b/targets/app/common/GameRules/WstringLookup.h similarity index 100% rename from targets/app/common/src/GameRules/WstringLookup.h rename to targets/app/common/GameRules/WstringLookup.h diff --git a/targets/app/common/GameSettingsManager.cpp b/targets/app/common/GameSettingsManager.cpp new file mode 100644 index 000000000..c79bcbf14 --- /dev/null +++ b/targets/app/common/GameSettingsManager.cpp @@ -0,0 +1,1436 @@ +#include "app/common/GameSettingsManager.h" + +#include "app/common/Game.h" +#include "app/common/App_Defines.h" +#include "minecraft/GameEnums.h" +#include "app/common/Console_Debug_enum.h" +#include "app/common/Network/GameNetworkManager.h" +#include "app/linux/LinuxGame.h" +#include "app/linux/Linux_UIController.h" +#include "minecraft/client/Minecraft.h" +#include "minecraft/client/Options.h" +#include "minecraft/client/gui/Gui.h" +#include "minecraft/client/multiplayer/MultiPlayerGameMode.h" +#include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" +#include "minecraft/client/renderer/GameRenderer.h" +#include "minecraft/client/skins/TexturePack.h" +#include "minecraft/client/skins/TexturePackRepository.h" +#include "minecraft/server/MinecraftServer.h" +#include "minecraft/server/PlayerList.h" +#include "minecraft/server/level/ServerPlayer.h" +#include "minecraft/world/entity/player/Player.h" +#include "minecraft/world/level/tile/Tile.h" +#include "platform/sdl2/Input.h" +#include "platform/sdl2/Render.h" +#include "platform/sdl2/Storage.h" +#include "app/common/Audio/SoundEngine.h" + +#include + +GameSettingsManager::GameSettingsManager() { + memset(GameSettingsA, 0, sizeof(GameSettingsA)); + m_uiGameHostSettings = 0; +} + +void GameSettingsManager::initGameSettings() { + for (int i = 0; i < XUSER_MAX_COUNT; i++) { + GameSettingsA[i] = + (GAME_SETTINGS*)ProfileManager.GetGameDefinedProfileData(i); + // clear the flag to say the settings have changed + GameSettingsA[i]->bSettingsChanged = false; + +#if defined(_WINDOWS64) + C_4JProfile::PROFILESETTINGS* pProfileSettings = + ProfileManager.GetDashboardProfileSettings(i); + memset(pProfileSettings, 0, sizeof(C_4JProfile::PROFILESETTINGS)); + setDefaultOptions(pProfileSettings, i); +#else + C_4JProfile::PROFILESETTINGS* pProfileSettings = + ProfileManager.GetDashboardProfileSettings(i); + memset(pProfileSettings, 0, sizeof(C_4JProfile::PROFILESETTINGS)); + setDefaultOptions(pProfileSettings, i); +#endif + } +} + +int GameSettingsManager::setDefaultOptions( + C_4JProfile::PROFILESETTINGS* pSettings, const int iPad) { + setGameSettings(iPad, eGameSetting_MusicVolume, DEFAULT_VOLUME_LEVEL); + setGameSettings(iPad, eGameSetting_SoundFXVolume, DEFAULT_VOLUME_LEVEL); + setGameSettings(iPad, eGameSetting_Gamma, 50); + + if (Minecraft::GetInstance()->level == nullptr) { + app.DebugPrintf("SetDefaultOptions - Difficulty = 1\n"); + setGameSettings(iPad, eGameSetting_Difficulty, 1); + } + setGameSettings(iPad, eGameSetting_Sensitivity_InGame, 100); + setGameSettings(iPad, eGameSetting_ViewBob, 1); + setGameSettings(iPad, eGameSetting_ControlScheme, 0); + setGameSettings(iPad, eGameSetting_ControlInvertLook, + (pSettings->iYAxisInversion != 0) ? 1 : 0); + setGameSettings(iPad, eGameSetting_ControlSouthPaw, + pSettings->bSwapSticks ? 1 : 0); + setGameSettings(iPad, eGameSetting_SplitScreenVertical, 0); + setGameSettings(iPad, eGameSetting_GamertagsVisible, 1); + + // Interim TU 1.6.6 + setGameSettings(iPad, eGameSetting_Sensitivity_InMenu, 100); + setGameSettings(iPad, eGameSetting_DisplaySplitscreenGamertags, 1); + setGameSettings(iPad, eGameSetting_Hints, 1); + setGameSettings(iPad, eGameSetting_Autosave, 2); + setGameSettings(iPad, eGameSetting_Tooltips, 1); + setGameSettings(iPad, eGameSetting_InterfaceOpacity, 80); + + // TU 5 + setGameSettings(iPad, eGameSetting_Clouds, 1); + setGameSettings(iPad, eGameSetting_Online, 1); + setGameSettings(iPad, eGameSetting_InviteOnly, 0); + setGameSettings(iPad, eGameSetting_FriendsOfFriends, 1); + + // TU 6 + setGameSettings(iPad, eGameSetting_BedrockFog, 0); + setGameSettings(iPad, eGameSetting_DisplayHUD, 1); + setGameSettings(iPad, eGameSetting_DisplayHand, 1); + + // TU 7 + setGameSettings(iPad, eGameSetting_CustomSkinAnim, 1); + + // TU 9 + setGameSettings(iPad, eGameSetting_DeathMessages, 1); + setGameSettings(iPad, eGameSetting_UISize, 1); + setGameSettings(iPad, eGameSetting_UISizeSplitscreen, 2); + setGameSettings(iPad, eGameSetting_AnimatedCharacter, 1); + + // TU 12 + GameSettingsA[iPad]->ucCurrentFavoriteSkinPos = 0; + for (int i = 0; i < MAX_FAVORITE_SKINS; i++) { + GameSettingsA[iPad]->uiFavoriteSkinA[i] = 0xFFFFFFFF; + } + + // TU 13 + GameSettingsA[iPad]->uiMashUpPackWorldsDisplay = 0xFFFFFFFF; + + // 1.6.4 + app.SetGameHostOption(eGameHostOption_MobGriefing, 1); + app.SetGameHostOption(eGameHostOption_KeepInventory, 0); + app.SetGameHostOption(eGameHostOption_DoMobSpawning, 1); + app.SetGameHostOption(eGameHostOption_DoMobLoot, 1); + app.SetGameHostOption(eGameHostOption_DoTileDrops, 1); + app.SetGameHostOption(eGameHostOption_NaturalRegeneration, 1); + app.SetGameHostOption(eGameHostOption_DoDaylightCycle, 1); + + // PS3DEC13 + setGameSettings(iPad, eGameSetting_PS3_EULA_Read, 0); + + if (!app.GetGameStarted()) { + GameSettingsA[iPad]->ucLanguage = + MINECRAFT_LANGUAGE_DEFAULT; + GameSettingsA[iPad]->ucLocale = + MINECRAFT_LANGUAGE_DEFAULT; + } + + return 0; +} + +int GameSettingsManager::defaultOptionsCallback( + void* pParam, C_4JProfile::PROFILESETTINGS* pSettings, const int iPad) { + Game* pApp = (Game*)pParam; + + pApp->DebugPrintf("Setting default options for player %d", iPad); + pApp->SetAction(iPad, eAppAction_SetDefaultOptions, (void*)pSettings); + + return 0; +} + +int GameSettingsManager::oldProfileVersionCallback( + void* pParam, unsigned char* pucData, const unsigned short usVersion, + const int iPad) { + switch (usVersion) { + case PROFILE_VERSION_8: { + GAME_SETTINGS* pGameSettings = (GAME_SETTINGS*)pucData; + pGameSettings->uiBitmaskValues |= GAMESETTING_DISPLAYUPDATEMSG; + pGameSettings->uiMashUpPackWorldsDisplay = 0xFFFFFFFF; + pGameSettings->uiBitmaskValues &= ~GAMESETTING_PS3EULAREAD; + pGameSettings->ucLanguage = MINECRAFT_LANGUAGE_DEFAULT; + } break; + case PROFILE_VERSION_9: { + GAME_SETTINGS* pGameSettings = (GAME_SETTINGS*)pucData; + pGameSettings->uiBitmaskValues |= GAMESETTING_DISPLAYUPDATEMSG; + pGameSettings->uiBitmaskValues &= ~GAMESETTING_PS3EULAREAD; + pGameSettings->ucLanguage = MINECRAFT_LANGUAGE_DEFAULT; + } break; + case PROFILE_VERSION_10: { + GAME_SETTINGS* pGameSettings = (GAME_SETTINGS*)pucData; + pGameSettings->uiBitmaskValues |= GAMESETTING_DISPLAYUPDATEMSG; + pGameSettings->ucLanguage = MINECRAFT_LANGUAGE_DEFAULT; + } break; + case PROFILE_VERSION_11: { + GAME_SETTINGS* pGameSettings = (GAME_SETTINGS*)pucData; + pGameSettings->uiBitmaskValues |= GAMESETTING_DISPLAYUPDATEMSG; + } break; + case PROFILE_VERSION_12: { + GAME_SETTINGS* pGameSettings = (GAME_SETTINGS*)pucData; + pGameSettings->uiBitmaskValues |= GAMESETTING_DISPLAYUPDATEMSG; + } break; + default: { + app.DebugPrintf( + "Don't know what to do with this profile version!\n"); + + GAME_SETTINGS* pGameSettings = (GAME_SETTINGS*)pucData; + pGameSettings->ucMenuSensitivity = 100; + pGameSettings->ucInterfaceOpacity = 80; + pGameSettings->usBitmaskValues |= 0x0200; + pGameSettings->usBitmaskValues |= 0x0400; + pGameSettings->usBitmaskValues |= 0x1000; + pGameSettings->usBitmaskValues |= 0x8000; + + pGameSettings->uiBitmaskValues = 0L; + pGameSettings->uiBitmaskValues |= GAMESETTING_CLOUDS; + pGameSettings->uiBitmaskValues |= GAMESETTING_ONLINE; + pGameSettings->uiBitmaskValues |= GAMESETTING_FRIENDSOFFRIENDS; + pGameSettings->uiBitmaskValues |= GAMESETTING_DISPLAYUPDATEMSG; + pGameSettings->uiBitmaskValues &= ~GAMESETTING_BEDROCKFOG; + pGameSettings->uiBitmaskValues |= GAMESETTING_DISPLAYHUD; + pGameSettings->uiBitmaskValues |= GAMESETTING_DISPLAYHAND; + pGameSettings->uiBitmaskValues |= GAMESETTING_CUSTOMSKINANIM; + pGameSettings->uiBitmaskValues |= GAMESETTING_DEATHMESSAGES; + pGameSettings->uiBitmaskValues |= + (GAMESETTING_UISIZE & 0x00000800); + pGameSettings->uiBitmaskValues |= + (GAMESETTING_UISIZE_SPLITSCREEN & 0x00004000); + pGameSettings->uiBitmaskValues |= GAMESETTING_ANIMATEDCHARACTER; + for (int i = 0; i < MAX_FAVORITE_SKINS; i++) { + pGameSettings->uiFavoriteSkinA[i] = 0xFFFFFFFF; + } + pGameSettings->ucCurrentFavoriteSkinPos = 0; + pGameSettings->uiMashUpPackWorldsDisplay = 0xFFFFFFFF; + pGameSettings->uiBitmaskValues &= ~GAMESETTING_PS3EULAREAD; + pGameSettings->ucLanguage = MINECRAFT_LANGUAGE_DEFAULT; + } break; + } + + return 0; +} + +void GameSettingsManager::applyGameSettingsChanged(int iPad) { + actionGameSettings(iPad, eGameSetting_MusicVolume); + actionGameSettings(iPad, eGameSetting_SoundFXVolume); + actionGameSettings(iPad, eGameSetting_Gamma); + actionGameSettings(iPad, eGameSetting_Difficulty); + actionGameSettings(iPad, eGameSetting_Sensitivity_InGame); + actionGameSettings(iPad, eGameSetting_ViewBob); + actionGameSettings(iPad, eGameSetting_ControlScheme); + actionGameSettings(iPad, eGameSetting_ControlInvertLook); + actionGameSettings(iPad, eGameSetting_ControlSouthPaw); + actionGameSettings(iPad, eGameSetting_SplitScreenVertical); + actionGameSettings(iPad, eGameSetting_GamertagsVisible); + + // Interim TU 1.6.6 + actionGameSettings(iPad, eGameSetting_Sensitivity_InMenu); + actionGameSettings(iPad, eGameSetting_DisplaySplitscreenGamertags); + actionGameSettings(iPad, eGameSetting_Hints); + actionGameSettings(iPad, eGameSetting_InterfaceOpacity); + actionGameSettings(iPad, eGameSetting_Tooltips); + + actionGameSettings(iPad, eGameSetting_Clouds); + actionGameSettings(iPad, eGameSetting_BedrockFog); + actionGameSettings(iPad, eGameSetting_DisplayHUD); + actionGameSettings(iPad, eGameSetting_DisplayHand); + actionGameSettings(iPad, eGameSetting_CustomSkinAnim); + actionGameSettings(iPad, eGameSetting_DeathMessages); + actionGameSettings(iPad, eGameSetting_UISize); + actionGameSettings(iPad, eGameSetting_UISizeSplitscreen); + actionGameSettings(iPad, eGameSetting_AnimatedCharacter); + + actionGameSettings(iPad, eGameSetting_PS3_EULA_Read); +} + +void GameSettingsManager::actionGameSettings(int iPad, eGameSetting eVal) { + Minecraft* pMinecraft = Minecraft::GetInstance(); + switch (eVal) { + case eGameSetting_MusicVolume: + if (iPad == ProfileManager.GetPrimaryPad()) { + pMinecraft->options->set( + Options::Option::MUSIC, + ((float)GameSettingsA[iPad]->ucMusicVolume) / 100.0f); + } + break; + case eGameSetting_SoundFXVolume: + if (iPad == ProfileManager.GetPrimaryPad()) { + pMinecraft->options->set( + Options::Option::SOUND, + ((float)GameSettingsA[iPad]->ucSoundFXVolume) / 100.0f); + } + break; + case eGameSetting_Gamma: + if (iPad == ProfileManager.GetPrimaryPad()) { + float fVal = ((float)GameSettingsA[iPad]->ucGamma) * 327.68f; + RenderManager.UpdateGamma((unsigned short)fVal); + } + break; + case eGameSetting_Difficulty: + if (iPad == ProfileManager.GetPrimaryPad()) { + pMinecraft->options->toggle( + Options::Option::DIFFICULTY, + GameSettingsA[iPad]->usBitmaskValues & 0x03); + app.DebugPrintf("Difficulty toggle to %d\n", + GameSettingsA[iPad]->usBitmaskValues & 0x03); + + app.SetGameHostOption(eGameHostOption_Difficulty, + pMinecraft->options->difficulty); + + bool bInGame = pMinecraft->level != nullptr; + + if (bInGame && g_NetworkManager.IsHost() && + (iPad == ProfileManager.GetPrimaryPad())) { + app.SetXuiServerAction( + iPad, eXuiServerAction_ServerSettingChanged_Difficulty); + } + } else { + app.DebugPrintf( + "NOT ACTIONING DIFFICULTY - Primary pad is %d, This pad is " + "%d\n", + ProfileManager.GetPrimaryPad(), iPad); + } + break; + case eGameSetting_Sensitivity_InGame: + pMinecraft->options->set( + Options::Option::SENSITIVITY, + ((float)GameSettingsA[iPad]->ucSensitivity) / 100.0f); + break; + case eGameSetting_ViewBob: + break; + case eGameSetting_ControlScheme: + InputManager.SetJoypadMapVal( + iPad, (GameSettingsA[iPad]->usBitmaskValues & 0x30) >> 4); + break; + case eGameSetting_ControlInvertLook: + break; + case eGameSetting_ControlSouthPaw: + if (GameSettingsA[iPad]->usBitmaskValues & 0x80) { + InputManager.SetJoypadStickAxisMap(iPad, AXIS_MAP_LX, + AXIS_MAP_RX); + InputManager.SetJoypadStickAxisMap(iPad, AXIS_MAP_LY, + AXIS_MAP_RY); + InputManager.SetJoypadStickAxisMap(iPad, AXIS_MAP_RX, + AXIS_MAP_LX); + InputManager.SetJoypadStickAxisMap(iPad, AXIS_MAP_RY, + AXIS_MAP_LY); + InputManager.SetJoypadStickTriggerMap(iPad, TRIGGER_MAP_0, + TRIGGER_MAP_1); + InputManager.SetJoypadStickTriggerMap(iPad, TRIGGER_MAP_1, + TRIGGER_MAP_0); + } else { + InputManager.SetJoypadStickAxisMap(iPad, AXIS_MAP_LX, + AXIS_MAP_LX); + InputManager.SetJoypadStickAxisMap(iPad, AXIS_MAP_LY, + AXIS_MAP_LY); + InputManager.SetJoypadStickAxisMap(iPad, AXIS_MAP_RX, + AXIS_MAP_RX); + InputManager.SetJoypadStickAxisMap(iPad, AXIS_MAP_RY, + AXIS_MAP_RY); + InputManager.SetJoypadStickTriggerMap(iPad, TRIGGER_MAP_0, + TRIGGER_MAP_0); + InputManager.SetJoypadStickTriggerMap(iPad, TRIGGER_MAP_1, + TRIGGER_MAP_1); + } + break; + case eGameSetting_SplitScreenVertical: + if (iPad == ProfileManager.GetPrimaryPad()) { + pMinecraft->updatePlayerViewportAssignments(); + } + break; + case eGameSetting_GamertagsVisible: { + bool bInGame = pMinecraft->level != nullptr; + + // Game Host only + if (bInGame && g_NetworkManager.IsHost() && + (iPad == ProfileManager.GetPrimaryPad())) { + app.SetGameHostOption( + eGameHostOption_Gamertags, + ((GameSettingsA[iPad]->usBitmaskValues & 0x0008) != 0) ? 1 + : 0); + app.SetXuiServerAction( + iPad, eXuiServerAction_ServerSettingChanged_Gamertags); + + PlayerList* players = + MinecraftServer::getInstance()->getPlayerList(); + for (auto it3 = players->players.begin(); + it3 != players->players.end(); ++it3) { + std::shared_ptr decorationPlayer = *it3; + decorationPlayer->setShowOnMaps( + (app.GetGameHostOption(eGameHostOption_Gamertags) != 0) + ? true + : false); + } + } + } break; + case eGameSetting_Sensitivity_InMenu: + break; + case eGameSetting_DisplaySplitscreenGamertags: + for (std::uint8_t idx = 0; idx < XUSER_MAX_COUNT; ++idx) { + if (pMinecraft->localplayers[idx] != nullptr) { + if (pMinecraft->localplayers[idx]->m_iScreenSection == + C4JRender::VIEWPORT_TYPE_FULLSCREEN) { + ui.DisplayGamertag(idx, false); + } else { + ui.DisplayGamertag(idx, true); + } + } + } + break; + case eGameSetting_InterfaceOpacity: + ui.RefreshTooltips(iPad); + break; + case eGameSetting_Hints: + break; + case eGameSetting_Tooltips: + if ((GameSettingsA[iPad]->usBitmaskValues & 0x8000) != 0) { + ui.SetEnableTooltips(iPad, true); + } else { + ui.SetEnableTooltips(iPad, false); + } + break; + case eGameSetting_Clouds: + break; + case eGameSetting_Online: + break; + case eGameSetting_InviteOnly: + break; + case eGameSetting_FriendsOfFriends: + break; + case eGameSetting_BedrockFog: { + bool bInGame = pMinecraft->level != nullptr; + + if (bInGame && g_NetworkManager.IsHost() && + (iPad == ProfileManager.GetPrimaryPad())) { + app.SetGameHostOption( + eGameHostOption_BedrockFog, + getGameSettings(iPad, eGameSetting_BedrockFog) ? 1 : 0); + app.SetXuiServerAction( + iPad, eXuiServerAction_ServerSettingChanged_BedrockFog); + } + } break; + case eGameSetting_DisplayHUD: + break; + case eGameSetting_DisplayHand: + break; + case eGameSetting_CustomSkinAnim: + break; + case eGameSetting_DeathMessages: + break; + case eGameSetting_UISize: + break; + case eGameSetting_UISizeSplitscreen: + break; + case eGameSetting_AnimatedCharacter: + break; + case eGameSetting_PS3_EULA_Read: + break; + case eGameSetting_PSVita_NetworkModeAdhoc: + break; + default: + break; + } +} + +void GameSettingsManager::hideMashupPackWorld(int iPad, + unsigned int iMashupPackID) { + unsigned int uiPackID = iMashupPackID - 1024; + GameSettingsA[iPad]->uiMashUpPackWorldsDisplay &= ~(1 << uiPackID); + GameSettingsA[iPad]->bSettingsChanged = true; +} + +void GameSettingsManager::enableMashupPackWorlds(int iPad) { + GameSettingsA[iPad]->uiMashUpPackWorldsDisplay = 0xFFFFFFFF; + GameSettingsA[iPad]->bSettingsChanged = true; +} + +unsigned int GameSettingsManager::getMashupPackWorlds(int iPad) { + return GameSettingsA[iPad]->uiMashUpPackWorldsDisplay; +} + +void GameSettingsManager::setMinecraftLanguage(int iPad, + unsigned char ucLanguage) { + GameSettingsA[iPad]->ucLanguage = ucLanguage; + GameSettingsA[iPad]->bSettingsChanged = true; +} + +unsigned char GameSettingsManager::getMinecraftLanguage(int iPad) { + if (GameSettingsA[iPad] == nullptr) { + return 0; + } else { + return GameSettingsA[iPad]->ucLanguage; + } +} + +void GameSettingsManager::setMinecraftLocale(int iPad, + unsigned char ucLocale) { + GameSettingsA[iPad]->ucLocale = ucLocale; + GameSettingsA[iPad]->bSettingsChanged = true; +} + +unsigned char GameSettingsManager::getMinecraftLocale(int iPad) { + if (GameSettingsA[iPad] == nullptr) { + return 0; + } else { + return GameSettingsA[iPad]->ucLocale; + } +} + +void GameSettingsManager::setGameSettings(int iPad, eGameSetting eVal, + unsigned char ucVal) { + switch (eVal) { + case eGameSetting_MusicVolume: + if (GameSettingsA[iPad]->ucMusicVolume != ucVal) { + GameSettingsA[iPad]->ucMusicVolume = ucVal; + if (iPad == ProfileManager.GetPrimaryPad()) { + actionGameSettings(iPad, eVal); + } + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; + case eGameSetting_SoundFXVolume: + if (GameSettingsA[iPad]->ucSoundFXVolume != ucVal) { + GameSettingsA[iPad]->ucSoundFXVolume = ucVal; + if (iPad == ProfileManager.GetPrimaryPad()) { + actionGameSettings(iPad, eVal); + } + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; + case eGameSetting_Gamma: + if (GameSettingsA[iPad]->ucGamma != ucVal) { + GameSettingsA[iPad]->ucGamma = ucVal; + if (iPad == ProfileManager.GetPrimaryPad()) { + actionGameSettings(iPad, eVal); + } + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; + case eGameSetting_Difficulty: + if ((GameSettingsA[iPad]->usBitmaskValues & 0x03) != + (ucVal & 0x03)) { + GameSettingsA[iPad]->usBitmaskValues &= ~0x03; + GameSettingsA[iPad]->usBitmaskValues |= ucVal & 0x03; + if (iPad == ProfileManager.GetPrimaryPad()) { + actionGameSettings(iPad, eVal); + } + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; + case eGameSetting_Sensitivity_InGame: + if (GameSettingsA[iPad]->ucSensitivity != ucVal) { + GameSettingsA[iPad]->ucSensitivity = ucVal; + actionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; + case eGameSetting_ViewBob: + if ((GameSettingsA[iPad]->usBitmaskValues & 0x0004) != + ((ucVal & 0x01) << 2)) { + if (ucVal != 0) { + GameSettingsA[iPad]->usBitmaskValues |= 0x0004; + } else { + GameSettingsA[iPad]->usBitmaskValues &= ~0x0004; + } + actionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; + case eGameSetting_ControlScheme: + if ((GameSettingsA[iPad]->usBitmaskValues & 0x30) != + ((ucVal & 0x03) << 4)) { + GameSettingsA[iPad]->usBitmaskValues &= ~0x0030; + if (ucVal != 0) { + GameSettingsA[iPad]->usBitmaskValues |= (ucVal & 0x03) << 4; + } + actionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; + case eGameSetting_ControlInvertLook: + if ((GameSettingsA[iPad]->usBitmaskValues & 0x0040) != + ((ucVal & 0x01) << 6)) { + if (ucVal != 0) { + GameSettingsA[iPad]->usBitmaskValues |= 0x0040; + } else { + GameSettingsA[iPad]->usBitmaskValues &= ~0x0040; + } + actionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; + case eGameSetting_ControlSouthPaw: + if ((GameSettingsA[iPad]->usBitmaskValues & 0x0080) != + ((ucVal & 0x01) << 7)) { + if (ucVal != 0) { + GameSettingsA[iPad]->usBitmaskValues |= 0x0080; + } else { + GameSettingsA[iPad]->usBitmaskValues &= ~0x0080; + } + actionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; + case eGameSetting_SplitScreenVertical: + if ((GameSettingsA[iPad]->usBitmaskValues & 0x0100) != + ((ucVal & 0x01) << 8)) { + if (ucVal != 0) { + GameSettingsA[iPad]->usBitmaskValues |= 0x0100; + } else { + GameSettingsA[iPad]->usBitmaskValues &= ~0x0100; + } + actionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; + case eGameSetting_GamertagsVisible: + if ((GameSettingsA[iPad]->usBitmaskValues & 0x0008) != + ((ucVal & 0x01) << 3)) { + if (ucVal != 0) { + GameSettingsA[iPad]->usBitmaskValues |= 0x0008; + } else { + GameSettingsA[iPad]->usBitmaskValues &= ~0x0008; + } + actionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; + case eGameSetting_Sensitivity_InMenu: + if (GameSettingsA[iPad]->ucMenuSensitivity != ucVal) { + GameSettingsA[iPad]->ucMenuSensitivity = ucVal; + actionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; + case eGameSetting_DisplaySplitscreenGamertags: + if ((GameSettingsA[iPad]->usBitmaskValues & 0x0200) != + ((ucVal & 0x01) << 9)) { + if (ucVal != 0) { + GameSettingsA[iPad]->usBitmaskValues |= 0x0200; + } else { + GameSettingsA[iPad]->usBitmaskValues &= ~0x0200; + } + actionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; + case eGameSetting_Hints: + if ((GameSettingsA[iPad]->usBitmaskValues & 0x0400) != + ((ucVal & 0x01) << 10)) { + if (ucVal != 0) { + GameSettingsA[iPad]->usBitmaskValues |= 0x0400; + } else { + GameSettingsA[iPad]->usBitmaskValues &= ~0x0400; + } + actionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; + case eGameSetting_Autosave: + if ((GameSettingsA[iPad]->usBitmaskValues & 0x7800) != + ((ucVal & 0x0F) << 11)) { + GameSettingsA[iPad]->usBitmaskValues &= ~0x7800; + if (ucVal != 0) { + GameSettingsA[iPad]->usBitmaskValues |= (ucVal & 0x0F) + << 11; + } + actionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; + case eGameSetting_Tooltips: + if ((GameSettingsA[iPad]->usBitmaskValues & 0x8000) != + ((ucVal & 0x01) << 15)) { + if (ucVal != 0) { + GameSettingsA[iPad]->usBitmaskValues |= 0x8000; + } else { + GameSettingsA[iPad]->usBitmaskValues &= ~0x8000; + } + actionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; + case eGameSetting_InterfaceOpacity: + if (GameSettingsA[iPad]->ucInterfaceOpacity != ucVal) { + GameSettingsA[iPad]->ucInterfaceOpacity = ucVal; + actionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; + case eGameSetting_Clouds: + if ((GameSettingsA[iPad]->uiBitmaskValues & GAMESETTING_CLOUDS) != + (ucVal & 0x01)) { + if (ucVal == 1) { + GameSettingsA[iPad]->uiBitmaskValues |= GAMESETTING_CLOUDS; + } else { + GameSettingsA[iPad]->uiBitmaskValues &= ~GAMESETTING_CLOUDS; + } + actionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; + case eGameSetting_Online: + if ((GameSettingsA[iPad]->uiBitmaskValues & GAMESETTING_ONLINE) != + (ucVal & 0x01) << 1) { + if (ucVal == 1) { + GameSettingsA[iPad]->uiBitmaskValues |= GAMESETTING_ONLINE; + } else { + GameSettingsA[iPad]->uiBitmaskValues &= ~GAMESETTING_ONLINE; + } + actionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; + case eGameSetting_InviteOnly: + if ((GameSettingsA[iPad]->uiBitmaskValues & + GAMESETTING_INVITEONLY) != (ucVal & 0x01) << 2) { + if (ucVal == 1) { + GameSettingsA[iPad]->uiBitmaskValues |= + GAMESETTING_INVITEONLY; + } else { + GameSettingsA[iPad]->uiBitmaskValues &= + ~GAMESETTING_INVITEONLY; + } + actionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; + case eGameSetting_FriendsOfFriends: + if ((GameSettingsA[iPad]->uiBitmaskValues & + GAMESETTING_FRIENDSOFFRIENDS) != (ucVal & 0x01) << 3) { + if (ucVal == 1) { + GameSettingsA[iPad]->uiBitmaskValues |= + GAMESETTING_FRIENDSOFFRIENDS; + } else { + GameSettingsA[iPad]->uiBitmaskValues &= + ~GAMESETTING_FRIENDSOFFRIENDS; + } + actionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; + case eGameSetting_DisplayUpdateMessage: + if ((GameSettingsA[iPad]->uiBitmaskValues & + GAMESETTING_DISPLAYUPDATEMSG) != (ucVal & 0x03) << 4) { + GameSettingsA[iPad]->uiBitmaskValues &= + ~GAMESETTING_DISPLAYUPDATEMSG; + if (ucVal > 0) { + GameSettingsA[iPad]->uiBitmaskValues |= (ucVal & 0x03) << 4; + } + actionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; + case eGameSetting_BedrockFog: + if ((GameSettingsA[iPad]->uiBitmaskValues & + GAMESETTING_BEDROCKFOG) != (ucVal & 0x01) << 6) { + if (ucVal == 1) { + GameSettingsA[iPad]->uiBitmaskValues |= + GAMESETTING_BEDROCKFOG; + } else { + GameSettingsA[iPad]->uiBitmaskValues &= + ~GAMESETTING_BEDROCKFOG; + } + actionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; + case eGameSetting_DisplayHUD: + if ((GameSettingsA[iPad]->uiBitmaskValues & + GAMESETTING_DISPLAYHUD) != (ucVal & 0x01) << 7) { + if (ucVal == 1) { + GameSettingsA[iPad]->uiBitmaskValues |= + GAMESETTING_DISPLAYHUD; + } else { + GameSettingsA[iPad]->uiBitmaskValues &= + ~GAMESETTING_DISPLAYHUD; + } + actionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; + case eGameSetting_DisplayHand: + if ((GameSettingsA[iPad]->uiBitmaskValues & + GAMESETTING_DISPLAYHAND) != (ucVal & 0x01) << 8) { + if (ucVal == 1) { + GameSettingsA[iPad]->uiBitmaskValues |= + GAMESETTING_DISPLAYHAND; + } else { + GameSettingsA[iPad]->uiBitmaskValues &= + ~GAMESETTING_DISPLAYHAND; + } + actionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; + case eGameSetting_CustomSkinAnim: + if ((GameSettingsA[iPad]->uiBitmaskValues & + GAMESETTING_CUSTOMSKINANIM) != (ucVal & 0x01) << 9) { + if (ucVal == 1) { + GameSettingsA[iPad]->uiBitmaskValues |= + GAMESETTING_CUSTOMSKINANIM; + } else { + GameSettingsA[iPad]->uiBitmaskValues &= + ~GAMESETTING_CUSTOMSKINANIM; + } + actionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; + case eGameSetting_DeathMessages: + if ((GameSettingsA[iPad]->uiBitmaskValues & + GAMESETTING_DEATHMESSAGES) != (ucVal & 0x01) << 10) { + if (ucVal == 1) { + GameSettingsA[iPad]->uiBitmaskValues |= + GAMESETTING_DEATHMESSAGES; + } else { + GameSettingsA[iPad]->uiBitmaskValues &= + ~GAMESETTING_DEATHMESSAGES; + } + actionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; + case eGameSetting_UISize: + if ((GameSettingsA[iPad]->uiBitmaskValues & GAMESETTING_UISIZE) != + ((ucVal & 0x03) << 11)) { + GameSettingsA[iPad]->uiBitmaskValues &= ~GAMESETTING_UISIZE; + if (ucVal != 0) { + GameSettingsA[iPad]->uiBitmaskValues |= (ucVal & 0x03) + << 11; + } + actionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; + case eGameSetting_UISizeSplitscreen: + if ((GameSettingsA[iPad]->uiBitmaskValues & + GAMESETTING_UISIZE_SPLITSCREEN) != ((ucVal & 0x03) << 13)) { + GameSettingsA[iPad]->uiBitmaskValues &= + ~GAMESETTING_UISIZE_SPLITSCREEN; + if (ucVal != 0) { + GameSettingsA[iPad]->uiBitmaskValues |= (ucVal & 0x03) + << 13; + } + actionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; + case eGameSetting_AnimatedCharacter: + if ((GameSettingsA[iPad]->uiBitmaskValues & + GAMESETTING_ANIMATEDCHARACTER) != (ucVal & 0x01) << 15) { + if (ucVal == 1) { + GameSettingsA[iPad]->uiBitmaskValues |= + GAMESETTING_ANIMATEDCHARACTER; + } else { + GameSettingsA[iPad]->uiBitmaskValues &= + ~GAMESETTING_ANIMATEDCHARACTER; + } + actionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; + case eGameSetting_PS3_EULA_Read: + if ((GameSettingsA[iPad]->uiBitmaskValues & + GAMESETTING_PS3EULAREAD) != (ucVal & 0x01) << 16) { + if (ucVal == 1) { + GameSettingsA[iPad]->uiBitmaskValues |= + GAMESETTING_PS3EULAREAD; + } else { + GameSettingsA[iPad]->uiBitmaskValues &= + ~GAMESETTING_PS3EULAREAD; + } + actionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; + case eGameSetting_PSVita_NetworkModeAdhoc: + if ((GameSettingsA[iPad]->uiBitmaskValues & + GAMESETTING_PSVITANETWORKMODEADHOC) != (ucVal & 0x01) << 17) { + if (ucVal == 1) { + GameSettingsA[iPad]->uiBitmaskValues |= + GAMESETTING_PSVITANETWORKMODEADHOC; + } else { + GameSettingsA[iPad]->uiBitmaskValues &= + ~GAMESETTING_PSVITANETWORKMODEADHOC; + } + actionGameSettings(iPad, eVal); + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; + } +} + +unsigned char GameSettingsManager::getGameSettings(eGameSetting eVal) { + int iPad = ProfileManager.GetPrimaryPad(); + return getGameSettings(iPad, eVal); +} + +unsigned char GameSettingsManager::getGameSettings(int iPad, + eGameSetting eVal) { + switch (eVal) { + case eGameSetting_MusicVolume: + return GameSettingsA[iPad]->ucMusicVolume; + case eGameSetting_SoundFXVolume: + return GameSettingsA[iPad]->ucSoundFXVolume; + case eGameSetting_Gamma: + return GameSettingsA[iPad]->ucGamma; + case eGameSetting_Difficulty: + return GameSettingsA[iPad]->usBitmaskValues & 0x0003; + case eGameSetting_Sensitivity_InGame: + return GameSettingsA[iPad]->ucSensitivity; + case eGameSetting_ViewBob: + return ((GameSettingsA[iPad]->usBitmaskValues & 0x0004) >> 2); + case eGameSetting_GamertagsVisible: + return ((GameSettingsA[iPad]->usBitmaskValues & 0x0008) >> 3); + case eGameSetting_ControlScheme: + return ((GameSettingsA[iPad]->usBitmaskValues & 0x0030) >> 4); + case eGameSetting_ControlInvertLook: + return ((GameSettingsA[iPad]->usBitmaskValues & 0x0040) >> 6); + case eGameSetting_ControlSouthPaw: + return ((GameSettingsA[iPad]->usBitmaskValues & 0x0080) >> 7); + case eGameSetting_SplitScreenVertical: + return ((GameSettingsA[iPad]->usBitmaskValues & 0x0100) >> 8); + case eGameSetting_Sensitivity_InMenu: + return GameSettingsA[iPad]->ucMenuSensitivity; + case eGameSetting_DisplaySplitscreenGamertags: + return ((GameSettingsA[iPad]->usBitmaskValues & 0x0200) >> 9); + case eGameSetting_Hints: + return ((GameSettingsA[iPad]->usBitmaskValues & 0x0400) >> 10); + case eGameSetting_Autosave: { + unsigned char ucVal = + (GameSettingsA[iPad]->usBitmaskValues & 0x7800) >> 11; + return ucVal; + } + case eGameSetting_Tooltips: + return ((GameSettingsA[iPad]->usBitmaskValues & 0x8000) >> 15); + case eGameSetting_InterfaceOpacity: + return GameSettingsA[iPad]->ucInterfaceOpacity; + case eGameSetting_Clouds: + return (GameSettingsA[iPad]->uiBitmaskValues & GAMESETTING_CLOUDS); + case eGameSetting_Online: + return (GameSettingsA[iPad]->uiBitmaskValues & + GAMESETTING_ONLINE) >> + 1; + case eGameSetting_InviteOnly: + return (GameSettingsA[iPad]->uiBitmaskValues & + GAMESETTING_INVITEONLY) >> + 2; + case eGameSetting_FriendsOfFriends: + return (GameSettingsA[iPad]->uiBitmaskValues & + GAMESETTING_FRIENDSOFFRIENDS) >> + 3; + case eGameSetting_DisplayUpdateMessage: + return (GameSettingsA[iPad]->uiBitmaskValues & + GAMESETTING_DISPLAYUPDATEMSG) >> + 4; + case eGameSetting_BedrockFog: + return (GameSettingsA[iPad]->uiBitmaskValues & + GAMESETTING_BEDROCKFOG) >> + 6; + case eGameSetting_DisplayHUD: + return (GameSettingsA[iPad]->uiBitmaskValues & + GAMESETTING_DISPLAYHUD) >> + 7; + case eGameSetting_DisplayHand: + return (GameSettingsA[iPad]->uiBitmaskValues & + GAMESETTING_DISPLAYHAND) >> + 8; + case eGameSetting_CustomSkinAnim: + return (GameSettingsA[iPad]->uiBitmaskValues & + GAMESETTING_CUSTOMSKINANIM) >> + 9; + case eGameSetting_DeathMessages: + return (GameSettingsA[iPad]->uiBitmaskValues & + GAMESETTING_DEATHMESSAGES) >> + 10; + case eGameSetting_UISize: { + unsigned char ucVal = + (GameSettingsA[iPad]->uiBitmaskValues & GAMESETTING_UISIZE) >> + 11; + return ucVal; + } + case eGameSetting_UISizeSplitscreen: { + unsigned char ucVal = (GameSettingsA[iPad]->uiBitmaskValues & + GAMESETTING_UISIZE_SPLITSCREEN) >> + 13; + return ucVal; + } + case eGameSetting_AnimatedCharacter: + return (GameSettingsA[iPad]->uiBitmaskValues & + GAMESETTING_ANIMATEDCHARACTER) >> + 15; + case eGameSetting_PS3_EULA_Read: + return (GameSettingsA[iPad]->uiBitmaskValues & + GAMESETTING_PS3EULAREAD) >> + 16; + case eGameSetting_PSVita_NetworkModeAdhoc: + return (GameSettingsA[iPad]->uiBitmaskValues & + GAMESETTING_PSVITANETWORKMODEADHOC) >> + 17; + } + return 0; +} + +void GameSettingsManager::checkGameSettingsChanged(bool bOverride5MinuteTimer, + int iPad) { + if (iPad == XUSER_INDEX_ANY) { + for (int i = 0; i < XUSER_MAX_COUNT; i++) { + if (GameSettingsA[i]->bSettingsChanged) { + ProfileManager.WriteToProfile(i, true, bOverride5MinuteTimer); + GameSettingsA[i]->bSettingsChanged = false; + } + } + } else { + if (GameSettingsA[iPad]->bSettingsChanged) { + ProfileManager.WriteToProfile(iPad, true, bOverride5MinuteTimer); + GameSettingsA[iPad]->bSettingsChanged = false; + } + } +} + +void GameSettingsManager::clearGameSettingsChangedFlag(int iPad) { + GameSettingsA[iPad]->bSettingsChanged = false; +} + +#if !defined(_DEBUG_MENUS_ENABLED) +unsigned int GameSettingsManager::getGameSettingsDebugMask( + int iPad, bool bOverridePlayer) { + return 0; +} + +void GameSettingsManager::setGameSettingsDebugMask(int iPad, + unsigned int uiVal) {} + +void GameSettingsManager::actionDebugMask(int iPad, bool bSetAllClear) {} + +#else + +unsigned int GameSettingsManager::getGameSettingsDebugMask( + int iPad, bool bOverridePlayer) { + if (iPad == -1) { + iPad = ProfileManager.GetPrimaryPad(); + } + if (iPad < 0) iPad = 0; + + std::shared_ptr player = + Minecraft::GetInstance()->localplayers[iPad]; + + if (bOverridePlayer || player == nullptr) { + return GameSettingsA[iPad]->uiDebugBitmask; + } else { + return player->GetDebugOptions(); + } +} + +void GameSettingsManager::setGameSettingsDebugMask(int iPad, + unsigned int uiVal) { +#if !defined(_CONTENT_PACKAGE) + GameSettingsA[iPad]->bSettingsChanged = true; + GameSettingsA[iPad]->uiDebugBitmask = uiVal; + + std::shared_ptr player = + Minecraft::GetInstance()->localplayers[iPad]; + + if (player) { + Minecraft::GetInstance()->localgameModes[iPad]->handleDebugOptions( + uiVal, player); + } +#endif +} + +void GameSettingsManager::actionDebugMask(int iPad, bool bSetAllClear) { + unsigned int ulBitmask = app.GetGameSettingsDebugMask(iPad); + + if (bSetAllClear) ulBitmask = 0L; + + if (ProfileManager.GetPrimaryPad() != iPad) return; + + for (int i = 0; i < eDebugSetting_Max; i++) { + switch (i) { + case eDebugSetting_LoadSavesFromDisk: + if (ulBitmask & (1 << i)) { + app.SetLoadSavesFromFolderEnabled(true); + } else { + app.SetLoadSavesFromFolderEnabled(false); + } + break; + case eDebugSetting_WriteSavesToDisk: + if (ulBitmask & (1 << i)) { + app.SetWriteSavesToFolderEnabled(true); + } else { + app.SetWriteSavesToFolderEnabled(false); + } + break; + case eDebugSetting_FreezePlayers: + if (ulBitmask & (1 << i)) { + app.SetFreezePlayers(true); + } else { + app.SetFreezePlayers(false); + } + break; + case eDebugSetting_Safearea: + if (ulBitmask & (1 << i)) { + app.ShowSafeArea(true); + } else { + app.ShowSafeArea(false); + } + break; + case eDebugSetting_ShowUIConsole: + if (ulBitmask & (1 << i)) { + ui.ShowUIDebugConsole(true); + } else { + ui.ShowUIDebugConsole(false); + } + break; + case eDebugSetting_ShowUIMarketingGuide: + if (ulBitmask & (1 << i)) { + ui.ShowUIDebugMarketingGuide(true); + } else { + ui.ShowUIDebugMarketingGuide(false); + } + break; + case eDebugSetting_MobsDontAttack: + if (ulBitmask & (1 << i)) { + app.SetMobsDontAttackEnabled(true); + } else { + app.SetMobsDontAttackEnabled(false); + } + break; + case eDebugSetting_UseDpadForDebug: + if (ulBitmask & (1 << i)) { + app.SetUseDPadForDebug(true); + } else { + app.SetUseDPadForDebug(false); + } + break; + case eDebugSetting_MobsDontTick: + if (ulBitmask & (1 << i)) { + app.SetMobsDontTickEnabled(true); + } else { + app.SetMobsDontTickEnabled(false); + } + break; + } + } +} +#endif + +void GameSettingsManager::setSpecialTutorialCompletionFlag(int iPad, + int index) { + if (index >= 0 && index < 32 && GameSettingsA[iPad] != nullptr) { + GameSettingsA[iPad]->uiSpecialTutorialBitmask |= (1 << index); + } +} + +int GameSettingsManager::displaySavingMessage( + C4JStorage::ESavingMessage eVal, int iPad) { + ui.ShowSavingMessage(iPad, eVal); + return 0; +} + +void GameSettingsManager::setActionConfirmed(void* param) { + XuiActionParam* actionInfo = (XuiActionParam*)param; + app.SetAction(actionInfo->iPad, actionInfo->action); +} + +void GameSettingsManager::handleButtonPresses() { + for (int i = 0; i < 4; i++) { + handleButtonPresses(i); + } +} + +void GameSettingsManager::handleButtonPresses(int iPad) { + // Stub - button presses are handled elsewhere now +} + +void GameSettingsManager::setGameHostOption(unsigned int& uiHostSettings, + eGameHostOption eVal, + unsigned int uiVal) { + switch (eVal) { + case eGameHostOption_FriendsOfFriends: + if (uiVal != 0) { + uiHostSettings |= GAME_HOST_OPTION_BITMASK_FRIENDSOFFRIENDS; + } else { + uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_FRIENDSOFFRIENDS; + } + break; + case eGameHostOption_Difficulty: + uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_DIFFICULTY; + uiHostSettings |= (GAME_HOST_OPTION_BITMASK_DIFFICULTY & uiVal); + break; + case eGameHostOption_Gamertags: + if (uiVal != 0) { + uiHostSettings |= GAME_HOST_OPTION_BITMASK_GAMERTAGS; + } else { + uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_GAMERTAGS; + } + break; + case eGameHostOption_GameType: + uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_GAMETYPE; + uiHostSettings |= + (GAME_HOST_OPTION_BITMASK_GAMETYPE & (uiVal << 4)); + break; + case eGameHostOption_LevelType: + if (uiVal != 0) { + uiHostSettings |= GAME_HOST_OPTION_BITMASK_LEVELTYPE; + } else { + uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_LEVELTYPE; + } + break; + case eGameHostOption_Structures: + if (uiVal != 0) { + uiHostSettings |= GAME_HOST_OPTION_BITMASK_STRUCTURES; + } else { + uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_STRUCTURES; + } + break; + case eGameHostOption_BonusChest: + if (uiVal != 0) { + uiHostSettings |= GAME_HOST_OPTION_BITMASK_BONUSCHEST; + } else { + uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_BONUSCHEST; + } + break; + case eGameHostOption_HasBeenInCreative: + if (uiVal != 0) { + uiHostSettings |= GAME_HOST_OPTION_BITMASK_BEENINCREATIVE; + } else { + uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_BEENINCREATIVE; + } + break; + case eGameHostOption_PvP: + if (uiVal != 0) { + uiHostSettings |= GAME_HOST_OPTION_BITMASK_PVP; + } else { + uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_PVP; + } + break; + case eGameHostOption_TrustPlayers: + if (uiVal != 0) { + uiHostSettings |= GAME_HOST_OPTION_BITMASK_TRUSTPLAYERS; + } else { + uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_TRUSTPLAYERS; + } + break; + case eGameHostOption_TNT: + if (uiVal != 0) { + uiHostSettings |= GAME_HOST_OPTION_BITMASK_TNT; + } else { + uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_TNT; + } + break; + case eGameHostOption_FireSpreads: + if (uiVal != 0) { + uiHostSettings |= GAME_HOST_OPTION_BITMASK_FIRESPREADS; + } else { + uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_FIRESPREADS; + } + break; + case eGameHostOption_CheatsEnabled: + if (uiVal != 0) { + uiHostSettings |= GAME_HOST_OPTION_BITMASK_HOSTFLY; + uiHostSettings |= GAME_HOST_OPTION_BITMASK_HOSTHUNGER; + uiHostSettings |= GAME_HOST_OPTION_BITMASK_HOSTINVISIBLE; + } else { + uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_HOSTFLY; + uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_HOSTHUNGER; + uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_HOSTINVISIBLE; + } + break; + case eGameHostOption_HostCanFly: + if (uiVal != 0) { + uiHostSettings |= GAME_HOST_OPTION_BITMASK_HOSTFLY; + } else { + uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_HOSTFLY; + } + break; + case eGameHostOption_HostCanChangeHunger: + if (uiVal != 0) { + uiHostSettings |= GAME_HOST_OPTION_BITMASK_HOSTHUNGER; + } else { + uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_HOSTHUNGER; + } + break; + case eGameHostOption_HostCanBeInvisible: + if (uiVal != 0) { + uiHostSettings |= GAME_HOST_OPTION_BITMASK_HOSTINVISIBLE; + } else { + uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_HOSTINVISIBLE; + } + break; + case eGameHostOption_BedrockFog: + if (uiVal != 0) { + uiHostSettings |= GAME_HOST_OPTION_BITMASK_BEDROCKFOG; + } else { + uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_BEDROCKFOG; + } + break; + case eGameHostOption_DisableSaving: + if (uiVal != 0) { + uiHostSettings |= GAME_HOST_OPTION_BITMASK_DISABLESAVE; + } else { + uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_DISABLESAVE; + } + break; + case eGameHostOption_WasntSaveOwner: + if (uiVal != 0) { + uiHostSettings |= GAME_HOST_OPTION_BITMASK_NOTOWNER; + } else { + uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_NOTOWNER; + } + break; + case eGameHostOption_MobGriefing: + if (uiVal != 1) { + uiHostSettings |= GAME_HOST_OPTION_BITMASK_MOBGRIEFING; + } else { + uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_MOBGRIEFING; + } + break; + case eGameHostOption_KeepInventory: + if (uiVal != 0) { + uiHostSettings |= GAME_HOST_OPTION_BITMASK_KEEPINVENTORY; + } else { + uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_KEEPINVENTORY; + } + break; + case eGameHostOption_DoMobSpawning: + if (uiVal != 1) { + uiHostSettings |= GAME_HOST_OPTION_BITMASK_DOMOBSPAWNING; + } else { + uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_DOMOBSPAWNING; + } + break; + case eGameHostOption_DoMobLoot: + if (uiVal != 1) { + uiHostSettings |= GAME_HOST_OPTION_BITMASK_DOMOBLOOT; + } else { + uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_DOMOBLOOT; + } + break; + case eGameHostOption_DoTileDrops: + if (uiVal != 1) { + uiHostSettings |= GAME_HOST_OPTION_BITMASK_DOTILEDROPS; + } else { + uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_DOTILEDROPS; + } + break; + case eGameHostOption_NaturalRegeneration: + if (uiVal != 1) { + uiHostSettings |= GAME_HOST_OPTION_BITMASK_NATURALREGEN; + } else { + uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_NATURALREGEN; + } + break; + case eGameHostOption_DoDaylightCycle: + if (uiVal != 1) { + uiHostSettings |= GAME_HOST_OPTION_BITMASK_DODAYLIGHTCYCLE; + } else { + uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_DODAYLIGHTCYCLE; + } + break; + case eGameHostOption_WorldSize: + uiHostSettings &= ~GAME_HOST_OPTION_BITMASK_WORLDSIZE; + uiHostSettings |= + (GAME_HOST_OPTION_BITMASK_WORLDSIZE & + (uiVal << GAME_HOST_OPTION_BITMASK_WORLDSIZE_BITSHIFT)); + break; + case eGameHostOption_All: + uiHostSettings = uiVal; + break; + default: + break; + } +} + +unsigned int GameSettingsManager::getGameHostOption( + unsigned int uiHostSettings, eGameHostOption eVal) { + switch (eVal) { + case eGameHostOption_FriendsOfFriends: + return (uiHostSettings & GAME_HOST_OPTION_BITMASK_FRIENDSOFFRIENDS); + case eGameHostOption_Difficulty: + return (uiHostSettings & GAME_HOST_OPTION_BITMASK_DIFFICULTY); + case eGameHostOption_Gamertags: + return (uiHostSettings & GAME_HOST_OPTION_BITMASK_GAMERTAGS); + case eGameHostOption_GameType: + return (uiHostSettings & GAME_HOST_OPTION_BITMASK_GAMETYPE) >> 4; + case eGameHostOption_All: + return (uiHostSettings & GAME_HOST_OPTION_BITMASK_ALL); + case eGameHostOption_Tutorial: + return ((uiHostSettings & GAME_HOST_OPTION_BITMASK_GAMERTAGS) | + GAME_HOST_OPTION_BITMASK_TRUSTPLAYERS | + GAME_HOST_OPTION_BITMASK_FIRESPREADS | + GAME_HOST_OPTION_BITMASK_TNT | + GAME_HOST_OPTION_BITMASK_PVP | + GAME_HOST_OPTION_BITMASK_STRUCTURES | 1); + case eGameHostOption_LevelType: + return (uiHostSettings & GAME_HOST_OPTION_BITMASK_LEVELTYPE); + case eGameHostOption_Structures: + return (uiHostSettings & GAME_HOST_OPTION_BITMASK_STRUCTURES); + case eGameHostOption_BonusChest: + return (uiHostSettings & GAME_HOST_OPTION_BITMASK_BONUSCHEST); + case eGameHostOption_HasBeenInCreative: + return (uiHostSettings & GAME_HOST_OPTION_BITMASK_BEENINCREATIVE); + case eGameHostOption_PvP: + return (uiHostSettings & GAME_HOST_OPTION_BITMASK_PVP); + case eGameHostOption_TrustPlayers: + return (uiHostSettings & GAME_HOST_OPTION_BITMASK_TRUSTPLAYERS); + case eGameHostOption_TNT: + return (uiHostSettings & GAME_HOST_OPTION_BITMASK_TNT); + case eGameHostOption_FireSpreads: + return (uiHostSettings & GAME_HOST_OPTION_BITMASK_FIRESPREADS); + case eGameHostOption_CheatsEnabled: + return (uiHostSettings & (GAME_HOST_OPTION_BITMASK_HOSTFLY | + GAME_HOST_OPTION_BITMASK_HOSTHUNGER | + GAME_HOST_OPTION_BITMASK_HOSTINVISIBLE)); + case eGameHostOption_HostCanFly: + return (uiHostSettings & GAME_HOST_OPTION_BITMASK_HOSTFLY); + case eGameHostOption_HostCanChangeHunger: + return (uiHostSettings & GAME_HOST_OPTION_BITMASK_HOSTHUNGER); + case eGameHostOption_HostCanBeInvisible: + return (uiHostSettings & GAME_HOST_OPTION_BITMASK_HOSTINVISIBLE); + case eGameHostOption_BedrockFog: + return (uiHostSettings & GAME_HOST_OPTION_BITMASK_BEDROCKFOG); + case eGameHostOption_DisableSaving: + return (uiHostSettings & GAME_HOST_OPTION_BITMASK_DISABLESAVE); + case eGameHostOption_WasntSaveOwner: + return (uiHostSettings & GAME_HOST_OPTION_BITMASK_NOTOWNER); + case eGameHostOption_WorldSize: + return (uiHostSettings & GAME_HOST_OPTION_BITMASK_WORLDSIZE) >> + GAME_HOST_OPTION_BITMASK_WORLDSIZE_BITSHIFT; + case eGameHostOption_MobGriefing: + return !(uiHostSettings & GAME_HOST_OPTION_BITMASK_MOBGRIEFING); + case eGameHostOption_KeepInventory: + return (uiHostSettings & GAME_HOST_OPTION_BITMASK_KEEPINVENTORY); + case eGameHostOption_DoMobSpawning: + return !(uiHostSettings & GAME_HOST_OPTION_BITMASK_DOMOBSPAWNING); + case eGameHostOption_DoMobLoot: + return !(uiHostSettings & GAME_HOST_OPTION_BITMASK_DOMOBLOOT); + case eGameHostOption_DoTileDrops: + return !(uiHostSettings & GAME_HOST_OPTION_BITMASK_DOTILEDROPS); + case eGameHostOption_NaturalRegeneration: + return !(uiHostSettings & GAME_HOST_OPTION_BITMASK_NATURALREGEN); + case eGameHostOption_DoDaylightCycle: + return !(uiHostSettings & GAME_HOST_OPTION_BITMASK_DODAYLIGHTCYCLE); + default: + return 0; + } + return false; +} + +bool GameSettingsManager::canRecordStatsAndAchievements() { + bool isTutorial = Minecraft::GetInstance() != nullptr && + Minecraft::GetInstance()->isTutorial(); + return !(app.GetGameHostOption(eGameHostOption_HasBeenInCreative) || + app.GetGameHostOption(eGameHostOption_HostCanBeInvisible) || + app.GetGameHostOption(eGameHostOption_HostCanChangeHunger) || + app.GetGameHostOption(eGameHostOption_HostCanFly) || + app.GetGameHostOption(eGameHostOption_WasntSaveOwner) || + !app.GetGameHostOption(eGameHostOption_MobGriefing) || + app.GetGameHostOption(eGameHostOption_KeepInventory) || + !app.GetGameHostOption(eGameHostOption_DoMobSpawning) || + (!app.GetGameHostOption(eGameHostOption_DoDaylightCycle) && + !isTutorial)); +} diff --git a/targets/app/common/GameSettingsManager.h b/targets/app/common/GameSettingsManager.h new file mode 100644 index 000000000..4db558432 --- /dev/null +++ b/targets/app/common/GameSettingsManager.h @@ -0,0 +1,77 @@ +#pragma once + +#include + +#include "app/common/App_structs.h" +#include "platform/sdl2/Profile.h" +#include "platform/XboxStubs.h" + +class GameSettingsManager { +public: + GameSettingsManager(); + + void initGameSettings(); + static int oldProfileVersionCallback(void* pParam, unsigned char* pucData, + const unsigned short usVersion, + const int iPad); + static int defaultOptionsCallback(void* pParam, + C_4JProfile::PROFILESETTINGS* pSettings, + const int iPad); + int setDefaultOptions(C_4JProfile::PROFILESETTINGS* pSettings, + const int iPad); + + void setGameSettings(int iPad, eGameSetting eVal, unsigned char ucVal); + unsigned char getGameSettings(int iPad, eGameSetting eVal); + unsigned char getGameSettings(eGameSetting eVal); + + void checkGameSettingsChanged(bool bOverride5MinuteTimer = false, + int iPad = XUSER_INDEX_ANY); + void applyGameSettingsChanged(int iPad); + void clearGameSettingsChangedFlag(int iPad); + void actionGameSettings(int iPad, eGameSetting eVal); + + unsigned int getGameSettingsDebugMask(int iPad = -1, + bool bOverridePlayer = false); + void setGameSettingsDebugMask(int iPad, unsigned int uiVal); + void actionDebugMask(int iPad, bool bSetAllClear = false); + + void setSpecialTutorialCompletionFlag(int iPad, int index); + + // Mash-up pack worlds + void hideMashupPackWorld(int iPad, unsigned int iMashupPackID); + void enableMashupPackWorlds(int iPad); + unsigned int getMashupPackWorlds(int iPad); + + // Language/locale + void setMinecraftLanguage(int iPad, unsigned char ucLanguage); + unsigned char getMinecraftLanguage(int iPad); + void setMinecraftLocale(int iPad, unsigned char ucLocale); + unsigned char getMinecraftLocale(int iPad); + + // Game host options (bitfield versions) + void setGameHostOption(unsigned int& uiHostSettings, eGameHostOption eVal, + unsigned int uiVal); + unsigned int getGameHostOption(unsigned int uiHostSettings, + eGameHostOption eVal); + + bool canRecordStatsAndAchievements(); + + // HandleXuiActions and HandleButtonPresses + void handleXuiActions(); + void handleButtonPresses(); + + // Action-related + static void setActionConfirmed(void* param); + + // Saving message + int displaySavingMessage(const C4JStorage::ESavingMessage eMsg, int iPad); + + // Game settings array - public, referenced by Game via alias + GAME_SETTINGS* GameSettingsA[XUSER_MAX_COUNT]; + + // Game host settings bitfield + unsigned int m_uiGameHostSettings; + +private: + void handleButtonPresses(int iPad); +}; diff --git a/targets/app/common/Game_XuiActions.cpp b/targets/app/common/Game_XuiActions.cpp new file mode 100644 index 000000000..c68b6f445 --- /dev/null +++ b/targets/app/common/Game_XuiActions.cpp @@ -0,0 +1,1452 @@ +#include "app/common/App_Defines.h" +#include "app/common/DLC/DLCManager.h" +#include "app/common/Game.h" +#include "app/common/GameRules/GameRuleManager.h" +#include "app/common/Network/GameNetworkManager.h" +#include "app/common/Network/NetworkPlayerInterface.h" +#include "app/common/Tutorial/Tutorial.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.h" +#include "app/linux/LinuxGame.h" +#include "app/linux/Linux_UIController.h" +#include "minecraft/GameEnums.h" +#include "minecraft/client/Minecraft.h" +#include "minecraft/client/Options.h" +#include "minecraft/client/ProgressRenderer.h" +#include "minecraft/client/User.h" +#include "minecraft/client/gui/Gui.h" +#include "minecraft/client/multiplayer/ClientConnection.h" +#include "minecraft/client/multiplayer/MultiPlayerGameMode.h" +#include "minecraft/client/multiplayer/MultiPlayerLevel.h" +#include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" +#include "minecraft/client/renderer/GameRenderer.h" +#include "minecraft/client/renderer/Textures.h" +#include "minecraft/client/skins/DLCTexturePack.h" +#include "minecraft/client/skins/TexturePack.h" +#include "minecraft/client/skins/TexturePackRepository.h" +#include "minecraft/server/MinecraftServer.h" +#include "minecraft/stats/StatsCounter.h" +#include "platform/PlatformTypes.h" +#include "platform/sdl2/Profile.h" +#include "platform/sdl2/Storage.h" +#include "util/StringHelpers.h" +#include "app/common/Audio/SoundEngine.h" + +void Game::HandleXuiActions(void) { + eXuiAction eAction; + eTMSAction eTMS; + void* param; + Minecraft* pMinecraft = Minecraft::GetInstance(); + std::shared_ptr player; + + // are there any global actions to deal with? + eAction = app.GetGlobalXuiAction(); + if (eAction != eAppAction_Idle) { + switch (eAction) { + case eAppAction_DisplayLavaMessage: + // Display a warning about placing lava in the spawn area + { + unsigned int uiIDA[1]; + uiIDA[0] = IDS_CONFIRM_OK; + C4JStorage::EMessageResult result = + ui.RequestErrorMessage(IDS_CANT_PLACE_NEAR_SPAWN_TITLE, + IDS_CANT_PLACE_NEAR_SPAWN_TEXT, + uiIDA, 1, XUSER_INDEX_ANY); + if (result != C4JStorage::EMessage_Busy) + SetGlobalXuiAction(eAppAction_Idle); + } + break; + default: + break; + } + } + + // are there any app actions to deal with? + for (int i = 0; i < XUSER_MAX_COUNT; i++) { + eAction = app.GetXuiAction(i); + param = m_menuController.getXuiActionParam(i); + + if (eAction != eAppAction_Idle) { + switch (eAction) { + // // the renderer will capture a screenshot + // case eAppAction_SocialPost: + // if (ProfileManager.IsFullVersion()) { + // // Facebook Share + // if (CSocialManager::Instance() + // ->IsTitleAllowedToPostImages() && + // CSocialManager::Instance() + // ->AreAllUsersAllowedToPostImages()) { + // // disable character name tags for the shot + // // m_bwasHidingGui = + // pMinecraft->options->hideGui; + // // // 4J Stu - Removed 1.8.2 bug fix (TU6) as + // don't + // // need this + // pMinecraft->options->hideGui = true; + + // SetAction(i, eAppAction_SocialPostScreenshot); + // } else { + // SetAction(i, eAppAction_Idle); + // } + // } else { + // SetAction(i, eAppAction_Idle); + // } + // break; + // case eAppAction_SocialPostScreenshot: { + // SetAction(i, eAppAction_Idle); + // bool bKeepHiding = false; + // for (int j = 0; j < XUSER_MAX_COUNT; ++j) { + // if (app.GetXuiAction(j) == + // eAppAction_SocialPostScreenshot) { + // bKeepHiding = true; + // break; + // } + // } + // pMinecraft->options->hideGui = bKeepHiding; + + // // Facebook Share + + // if (app.GetLocalPlayerCount() > 1) { + // ui.NavigateToScene(i, eUIScene_SocialPost); + // } else { + // ui.NavigateToScene(i, eUIScene_SocialPost); + // } + // } break; + case eAppAction_SaveGame: + SetAction(i, eAppAction_Idle); + if (!GetChangingSessionType()) { + // flag the render to capture the screenshot for the + // save + SetAction(i, eAppAction_SaveGameCapturedThumbnail); + } + + break; + case eAppAction_AutosaveSaveGame: { + // Need to run a check to see if the save exists in order to + // stop the dialog asking if we want to overwrite it coming + // up on an autosave + bool bSaveExists; + StorageManager.DoesSaveExist(&bSaveExists); + + SetAction(i, eAppAction_Idle); + if (!GetChangingSessionType()) { + // flag the render to capture the screenshot for the + // save + SetAction(i, + eAppAction_AutosaveSaveGameCapturedThumbnail); + } + } + + break; + + case eAppAction_SaveGameCapturedThumbnail: + // reset the autosave timer + app.SetAutosaveTimerTime(); + SetAction(i, eAppAction_Idle); + // Check that there is a name for the save - if we're saving + // from the tutorial and this is the first save from the + // tutorial, we'll not have a name + /*if(StorageManager.GetSaveName()==nullptr) + { + app.NavigateToScene(i,eUIScene_SaveWorld); + } + else*/ + { + // turn off the gamertags in splitscreen for the primary + // player, since they are about to be made fullscreen + ui.HideAllGameUIElements(); + + // Hide the other players scenes + ui.ShowOtherPlayersBaseScene( + ProfileManager.GetPrimaryPad(), false); + + // int saveOrCheckpointId = 0; + // bool validSave = + // StorageManager.GetSaveUniqueNumber(&saveOrCheckpointId); + // SentientManager.RecordLevelSaveOrCheckpoint(ProfileManager.GetPrimaryPad(), + // saveOrCheckpointId); + + LoadingInputParams* loadingParams = + new LoadingInputParams(); + loadingParams->func = + &UIScene_PauseMenu::SaveWorldThreadProc; + loadingParams->lpParam = (void*)false; + + // 4J-JEV - PS4: Fix for #5708 - [ONLINE] - If the user + // pulls their network cable out while saving the title + // will hang. + loadingParams->waitForThreadToDelete = true; + + UIFullscreenProgressCompletionData* completionData = + new UIFullscreenProgressCompletionData(); + completionData->bShowBackground = true; + completionData->bShowLogo = true; + completionData->type = + e_ProgressCompletion_NavigateBackToScene; + completionData->iPad = ProfileManager.GetPrimaryPad(); + + if (ui.IsSceneInStack(ProfileManager.GetPrimaryPad(), + eUIScene_EndPoem)) { + completionData->scene = eUIScene_EndPoem; + } else { + completionData->scene = eUIScene_PauseMenu; + } + + loadingParams->completionData = completionData; + + // 4J Stu - Xbox only + + ui.NavigateToScene(ProfileManager.GetPrimaryPad(), + eUIScene_FullscreenProgress, + loadingParams, eUILayer_Fullscreen, + eUIGroup_Fullscreen); + } + break; + case eAppAction_AutosaveSaveGameCapturedThumbnail: + + { + app.SetAutosaveTimerTime(); + SetAction(i, eAppAction_Idle); + + // turn off the gamertags in splitscreen for the primary + // player, since they are about to be made fullscreen + ui.HideAllGameUIElements(); + + // app.CloseAllPlayersXuiScenes(); + // Hide the other players scenes + ui.ShowOtherPlayersBaseScene(ProfileManager.GetPrimaryPad(), + false); + + // This just allows it to be shown + if (pMinecraft + ->localgameModes[ProfileManager.GetPrimaryPad()] != + nullptr) + pMinecraft + ->localgameModes[ProfileManager.GetPrimaryPad()] + ->getTutorial() + ->showTutorialPopup(false); + + // int saveOrCheckpointId = 0; + // bool validSave = + // StorageManager.GetSaveUniqueNumber(&saveOrCheckpointId); + // SentientManager.RecordLevelSaveOrCheckpoint(ProfileManager.GetPrimaryPad(), + // saveOrCheckpointId); + + LoadingInputParams* loadingParams = + new LoadingInputParams(); + loadingParams->func = + &UIScene_PauseMenu::SaveWorldThreadProc; + + loadingParams->lpParam = (void*)true; + + UIFullscreenProgressCompletionData* completionData = + new UIFullscreenProgressCompletionData(); + completionData->bShowBackground = true; + completionData->bShowLogo = true; + completionData->type = + e_ProgressCompletion_AutosaveNavigateBack; + completionData->iPad = ProfileManager.GetPrimaryPad(); + // completionData->bAutosaveWasMenuDisplayed=ui.GetMenuDisplayed(ProfileManager.GetPrimaryPad()); + loadingParams->completionData = completionData; + + // 4J Stu - Xbox only + + ui.NavigateToScene(ProfileManager.GetPrimaryPad(), + eUIScene_FullscreenProgress, + loadingParams, eUILayer_Fullscreen, + eUIGroup_Fullscreen); + } break; + case eAppAction_ExitPlayer: + // a secondary player has chosen to quit + { + int iPlayerC = g_NetworkManager.GetPlayerCount(); + + // Since the player is exiting, let's flush any profile + // writes for them, and hope we're not breaking TCR + // 136... + ProfileManager.ForceQueuedProfileWrites(i); + + // not required - it's done within the + // removeLocalPlayerIdx + // if(pMinecraft->level->isClientSide) + // { + // // we need to + // remove the qnetplayer, or this player won't be able + // to get back into the game until qnet times out and + // removes them + // g_NetworkManager.NotifyPlayerLeaving(g_NetworkManager.GetLocalPlayerByUserIndex(i)); + // } + + // if there are any tips showing, we need to close them + + pMinecraft->gui->clearMessages(i); + + // Make sure we've not got this player selected as + // current - this shouldn't be the case anyway + pMinecraft->setLocalPlayerIdx( + ProfileManager.GetPrimaryPad()); + pMinecraft->removeLocalPlayerIdx(i); + + // Wipe out the tooltips + ui.SetTooltips(i, -1); + + // Change the presence info + // Are we offline or online, and how many players are + // there + if (iPlayerC > 2) // one player is about to leave here + // - they'll be set to idle in the + // qnet manager player leave + { + for (int iPlayer = 0; iPlayer < XUSER_MAX_COUNT; + iPlayer++) { + if ((iPlayer != i) && + pMinecraft->localplayers[iPlayer]) { + if (g_NetworkManager.IsLocalGame()) { + ProfileManager.SetCurrentGameActivity( + iPlayer, + CONTEXT_PRESENCE_MULTIPLAYEROFFLINE, + false); + } else { + ProfileManager.SetCurrentGameActivity( + iPlayer, + CONTEXT_PRESENCE_MULTIPLAYER, + false); + } + } + } + } else { + for (int iPlayer = 0; iPlayer < XUSER_MAX_COUNT; + iPlayer++) { + if ((iPlayer != i) && + pMinecraft->localplayers[iPlayer]) { + if (g_NetworkManager.IsLocalGame()) { + ProfileManager.SetCurrentGameActivity( + iPlayer, + CONTEXT_PRESENCE_MULTIPLAYER_1POFFLINE, + false); + } else { + ProfileManager.SetCurrentGameActivity( + iPlayer, + CONTEXT_PRESENCE_MULTIPLAYER_1P, + false); + } + } + } + } + + SetAction(i, eAppAction_Idle); + } + break; + case eAppAction_ExitPlayerPreLogin: { + int iPlayerC = g_NetworkManager.GetPlayerCount(); + // Since the player is exiting, let's flush any profile + // writes for them, and hope we're not breaking TCR 136... + ProfileManager.ForceQueuedProfileWrites(i); + // if there are any tips showing, we need to close them + + pMinecraft->gui->clearMessages(i); + + // Make sure we've not got this player selected as current - + // this shouldn't be the case anyway + pMinecraft->setLocalPlayerIdx( + ProfileManager.GetPrimaryPad()); + pMinecraft->removeLocalPlayerIdx(i); + + // Wipe out the tooltips + ui.SetTooltips(i, -1); + + // Change the presence info + // Are we offline or online, and how many players are there + if (iPlayerC > + 2) // one player is about to leave here - they'll be + // set to idle in the qnet manager player leave + { + for (int iPlayer = 0; iPlayer < XUSER_MAX_COUNT; + iPlayer++) { + if ((iPlayer != i) && + pMinecraft->localplayers[iPlayer]) { + if (g_NetworkManager.IsLocalGame()) { + ProfileManager.SetCurrentGameActivity( + iPlayer, + CONTEXT_PRESENCE_MULTIPLAYEROFFLINE, + false); + } else { + ProfileManager.SetCurrentGameActivity( + iPlayer, CONTEXT_PRESENCE_MULTIPLAYER, + false); + } + } + } + } else { + for (int iPlayer = 0; iPlayer < XUSER_MAX_COUNT; + iPlayer++) { + if ((iPlayer != i) && + pMinecraft->localplayers[iPlayer]) { + if (g_NetworkManager.IsLocalGame()) { + ProfileManager.SetCurrentGameActivity( + iPlayer, + CONTEXT_PRESENCE_MULTIPLAYER_1POFFLINE, + false); + } else { + ProfileManager.SetCurrentGameActivity( + iPlayer, + CONTEXT_PRESENCE_MULTIPLAYER_1P, false); + } + } + } + } + SetAction(i, eAppAction_Idle); + } break; + + case eAppAction_ExitWorld: + pMinecraft->exitingWorldRightNow = true; + + SetAction(i, eAppAction_Idle); + + // If we're already leaving don't exit + if (g_NetworkManager.IsLeavingGame()) { + break; + } + + pMinecraft->gui->clearMessages(); + + // turn off the gamertags in splitscreen for the primary + // player, since they are about to be made fullscreen + ui.HideAllGameUIElements(); + + // reset the flag stopping new dlc message being shown if + // you've seen the message before + DisplayNewDLCTipAgain(); + + // clear the autosave timer that might be on screen + ui.ShowAutosaveCountdownTimer(false); + + // Hide the selected item text + ui.HideAllGameUIElements(); + + // Since the player forced the exit, let's flush any profile + // writes, and hope we're not breaking TCR 136... + + // 4J-PB - cancel any possible std::string verifications + // queued with LIVE + // InputManager.CancelAllVerifyInProgress(); + + // In a split screen, only the primary player actually + // quits the game, others just remove their players + if (i != ProfileManager.GetPrimaryPad()) { + // Make sure we've not got this player selected as + // current - this shouldn't be the case anyway + pMinecraft->setLocalPlayerIdx( + ProfileManager.GetPrimaryPad()); + pMinecraft->removeLocalPlayerIdx(i); + + SetAction(i, eAppAction_Idle); + return; + } + // flag to capture the save thumbnail + SetAction(i, eAppAction_ExitWorldCapturedThumbnail, param); + + // Change the presence info + // Are we offline or online, and how many players are there + + if (g_NetworkManager.GetPlayerCount() > 1) { + for (int j = 0; j < XUSER_MAX_COUNT; j++) { + if (pMinecraft->localplayers[j]) { + if (g_NetworkManager.IsLocalGame()) { + app.SetRichPresenceContext( + j, CONTEXT_GAME_STATE_BLANK); + ProfileManager.SetCurrentGameActivity( + j, CONTEXT_PRESENCE_MULTIPLAYEROFFLINE, + false); + } else { + app.SetRichPresenceContext( + j, CONTEXT_GAME_STATE_BLANK); + ProfileManager.SetCurrentGameActivity( + j, CONTEXT_PRESENCE_MULTIPLAYER, false); + } + } + } + } else { + app.SetRichPresenceContext(i, CONTEXT_GAME_STATE_BLANK); + if (g_NetworkManager.IsLocalGame()) { + ProfileManager.SetCurrentGameActivity( + i, CONTEXT_PRESENCE_MULTIPLAYER_1POFFLINE, + false); + } else { + ProfileManager.SetCurrentGameActivity( + i, CONTEXT_PRESENCE_MULTIPLAYER_1P, false); + } + } + break; + case eAppAction_ExitWorldCapturedThumbnail: { + SetAction(i, eAppAction_Idle); + // Stop app running + SetGameStarted(false); + SetChangingSessionType( + true); // Added to stop handling ethernet disconnects + + ui.CloseAllPlayersScenes(); + + // turn off the gamertags in splitscreen for the primary + // player, since they are about to be made fullscreen + ui.HideAllGameUIElements(); + + // 4J Stu - Fix for #12368 - Crash: Game crashes when saving + // then exiting and selecting to save + for (unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { + // 4J Stu - Fix for #13257 - CRASH: Gameplay: Title + // crashed after exiting the tutorial It doesn't matter + // if they were in the tutorial already + pMinecraft->playerLeftTutorial(idx); + } + + LoadingInputParams* loadingParams = + new LoadingInputParams(); + loadingParams->func = + &UIScene_PauseMenu::ExitWorldThreadProc; + loadingParams->lpParam = param; + + UIFullscreenProgressCompletionData* completionData = + new UIFullscreenProgressCompletionData(); + // If param is non-null then this is a forced exit by the + // server, so make sure the player knows why 4J Stu - + // Changed - Don't use the FullScreenProgressScreen for + // action, use a dialog instead + completionData->bRequiresUserAction = + false; //(param != nullptr) ? true : false; + completionData->bShowTips = + (param != nullptr) ? false : true; + completionData->bShowBackground = true; + completionData->bShowLogo = true; + completionData->type = + e_ProgressCompletion_NavigateToHomeMenu; + completionData->iPad = DEFAULT_XUI_MENU_USER; + loadingParams->completionData = completionData; + + ui.NavigateToScene(ProfileManager.GetPrimaryPad(), + eUIScene_FullscreenProgress, + loadingParams); + } break; + case eAppAction_ExitWorldTrial: { + SetAction(i, eAppAction_Idle); + + pMinecraft->gui->clearMessages(); + + // turn off the gamertags in splitscreen for the primary + // player, since they are about to be made fullscreen + ui.HideAllGameUIElements(); + + // Stop app running + SetGameStarted(false); + + ui.CloseAllPlayersScenes(); + + // 4J Stu - Fix for #12368 - Crash: Game crashes when saving + // then exiting and selecting to save + for (unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { + // 4J Stu - Fix for #13257 - CRASH: Gameplay: Title + // crashed after exiting the tutorial It doesn't matter + // if they were in the tutorial already + pMinecraft->playerLeftTutorial(idx); + } + + LoadingInputParams* loadingParams = + new LoadingInputParams(); + loadingParams->func = + &UIScene_PauseMenu::ExitWorldThreadProc; + loadingParams->lpParam = param; + + UIFullscreenProgressCompletionData* completionData = + new UIFullscreenProgressCompletionData(); + completionData->bShowBackground = true; + completionData->bShowLogo = true; + completionData->type = + e_ProgressCompletion_NavigateToHomeMenu; + completionData->iPad = DEFAULT_XUI_MENU_USER; + loadingParams->completionData = completionData; + + ui.NavigateToScene(ProfileManager.GetPrimaryPad(), + eUIScene_FullscreenProgress, + loadingParams); + } + + break; + case eAppAction_ExitTrial: + // XLaunchNewImage(XLAUNCH_KEYWORD_DASH_ARCADE, 0); + ExitGame(); + break; + + case eAppAction_Respawn: { + ConnectionProgressParams* param = + new ConnectionProgressParams(); + param->iPad = i; + param->stringId = IDS_PROGRESS_RESPAWNING; + param->showTooltips = false; + param->setFailTimer = false; + ui.NavigateToScene(i, eUIScene_ConnectingProgress, param); + + // Need to reset this incase the player has already died and + // respawned + pMinecraft->localplayers[i]->SetPlayerRespawned(false); + + SetAction(i, eAppAction_WaitForRespawnComplete); + if (app.GetLocalPlayerCount() > 1) { + // In split screen mode, we don't want to do any async + // loading or flushing of the cache, just a simple + // respawn + pMinecraft->localplayers[i]->respawn(); + + // If the respawn requires a dimension change then the + // action will have changed + // if(app.GetXuiAction(i) == eAppAction_Respawn) + //{ + // SetAction(i,eAppAction_Idle); + // CloseXuiScenes(i); + //} + } else { + // SetAction(i,eAppAction_WaitForRespawnComplete); + + // LoadingInputParams *loadingParams = new + // LoadingInputParams(); loadingParams->func = + // &CScene_Death::RespawnThreadProc; + // loadingParams->lpParam = (void*)i; + + // Disable game & update thread whilst we do any of this + // app.SetGameStarted(false); + pMinecraft->gameRenderer->DisableUpdateThread(); + + // 4J Stu - We don't need this on a thread in + // multiplayer as respawning is asynchronous. + pMinecraft->localplayers[i]->respawn(); + + // app.SetGameStarted(true); + pMinecraft->gameRenderer->EnableUpdateThread(); + + // UIFullscreenProgressCompletionData *completionData = + // new UIFullscreenProgressCompletionData(); + // completionData->bShowBackground=true; + // completionData->bShowLogo=true; + // completionData->type = + // e_ProgressCompletion_CloseUIScenes; + // completionData->iPad = i; + // loadingParams->completionData = completionData; + + // app.NavigateToScene(i,eUIScene_FullscreenProgress, + // loadingParams, true); + } + } break; + case eAppAction_WaitForRespawnComplete: + player = pMinecraft->localplayers[i]; + if (player != nullptr && player->GetPlayerRespawned()) { + SetAction(i, eAppAction_Idle); + + if (ui.IsSceneInStack(i, eUIScene_EndPoem)) { + ui.NavigateBack(i, false, eUIScene_EndPoem); + } else { + ui.CloseUIScenes(i); + } + + // clear the progress messages + + // pMinecraft->progressRenderer->progressStart(-1); + // pMinecraft->progressRenderer->progressStage(-1); + } else if (!g_NetworkManager.IsInGameplay()) { + SetAction(i, eAppAction_Idle); + } + break; + case eAppAction_WaitForDimensionChangeComplete: + player = pMinecraft->localplayers[i]; + if (player != nullptr && player->connection && + player->connection->isStarted()) { + SetAction(i, eAppAction_Idle); + ui.CloseUIScenes(i); + } else if (!g_NetworkManager.IsInGameplay()) { + SetAction(i, eAppAction_Idle); + } + break; + case eAppAction_PrimaryPlayerSignedOut: { + // SetAction(i,eAppAction_Idle); + + // clear the autosavetimer that might be displayed + ui.ShowAutosaveCountdownTimer(false); + + // If the player signs out before the game started the + // server can be killed a bit earlier to stop the loading or + // saving of a new game continuing running while the + // UI/Guide is up + if (!app.GetGameStarted()) + MinecraftServer::HaltServer(true); + + // inform the player they are being returned to the menus + // because they signed out + StorageManager.SetSaveDeviceSelected(i, false); + // need to clear the player stats - can't assume it'll be + // done in setlevel - we may not be in the game + StatsCounter* pStats = Minecraft::GetInstance()->stats[i]; + pStats->clear(); + + // 4J-PB - the libs will display the Returned to Title + // screen unsigned int + // uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; + // + // ui.RequestMessageBox(IDS_RETURNEDTOMENU_TITLE, + // IDS_RETURNEDTOTITLESCREEN_TEXT, uiIDA, 1, + // i,&Game::PrimaryPlayerSignedOutReturned,this,app.GetStringTable()); + if (g_NetworkManager.IsInSession()) { + app.SetAction( + i, eAppAction_PrimaryPlayerSignedOutReturned); + } else { + app.SetAction( + i, eAppAction_PrimaryPlayerSignedOutReturned_Menus); + MinecraftServer::resetFlags(); + } + } break; + case eAppAction_EthernetDisconnected: { + app.DebugPrintf( + "Handling eAppAction_EthernetDisconnected\n"); + SetAction(i, eAppAction_Idle); + + // 4J Stu - Fix for #12530 -TCR 001 BAS Game Stability: + // Title will crash if the player disconnects while starting + // a new world and then opts to play the tutorial once they + // have been returned to the Main Menu. + if (!g_NetworkManager.IsLeavingGame()) { + app.DebugPrintf( + "Handling eAppAction_EthernetDisconnected - Not " + "leaving game\n"); + // 4J-PB - not the same as a signout. We should only + // leave the game if this machine is not the host. We + // shouldn't get rid of the save device either. + if (g_NetworkManager.IsHost()) { + app.DebugPrintf( + "Handling eAppAction_EthernetDisconnected - Is " + "Host\n"); + // If it's already a local game, then an ethernet + // disconnect should have no effect + if (!g_NetworkManager.IsLocalGame() && + g_NetworkManager.IsInGameplay()) { + // Change the session to an offline session + SetAction(i, eAppAction_ChangeSessionType); + } else if (!g_NetworkManager.IsLocalGame() && + !g_NetworkManager.IsInGameplay()) { + // There are two cases here, either: + // 1. We're early enough in the + // create/load game that we can do a really + // minimal shutdown or + // 2. We're far enough in (game has started + // but the actual game started flag hasn't + // been set) that we should just wait until + // we're in the game and switch to offline + // mode + + // If there's a non-null level then, for our + // purposes, the game has started + bool gameStarted = false; + for (int j = 0; j < pMinecraft->levels.size(); + j++) { + if (pMinecraft->levels.data()[j] != + nullptr) { + gameStarted = true; + break; + } + } + + if (!gameStarted) { + // 1. Exit + MinecraftServer::HaltServer(); + + // Fix for #12530 - TCR 001 BAS Game + // Stability: Title will crash if the player + // disconnects while starting a new world + // and then opts to play the tutorial once + // they have been returned to the Main Menu. + // 4J Stu - Leave the session + g_NetworkManager.LeaveGame(false); + + // need to clear the player stats - can't + // assume it'll be done in setlevel - we may + // not be in the game + StatsCounter* pStats = + Minecraft::GetInstance()->stats[i]; + pStats->clear(); + unsigned int uiIDA[1]; + uiIDA[0] = IDS_CONFIRM_OK; + + ui.RequestErrorMessage( + g_NetworkManager.CorrectErrorIDS( + IDS_CONNECTION_LOST), + g_NetworkManager.CorrectErrorIDS( + IDS_CONNECTION_LOST_LIVE), + uiIDA, 1, i, + &Game::EthernetDisconnectReturned, + this); + } else { + // 2. Switch to offline + SetAction(i, eAppAction_ChangeSessionType); + } + } + } else { + { + app.DebugPrintf( + "Handling eAppAction_EthernetDisconnected " + "- Not host\n"); + // need to clear the player stats - can't assume + // it'll be done in setlevel - we may not be in + // the game + StatsCounter* pStats = + Minecraft::GetInstance()->stats[i]; + pStats->clear(); + unsigned int uiIDA[1]; + uiIDA[0] = IDS_CONFIRM_OK; + + ui.RequestErrorMessage( + g_NetworkManager.CorrectErrorIDS( + IDS_CONNECTION_LOST), + g_NetworkManager.CorrectErrorIDS( + IDS_CONNECTION_LOST_LIVE), + uiIDA, 1, i, + &Game::EthernetDisconnectReturned, this); + } + } + } + } break; + // We currently handle both these returns the same way. + case eAppAction_EthernetDisconnectedReturned: + case eAppAction_PrimaryPlayerSignedOutReturned: { + SetAction(i, eAppAction_Idle); + + pMinecraft->gui->clearMessages(); + + // turn off the gamertags in splitscreen for the primary + // player, since they are about to be made fullscreen + ui.HideAllGameUIElements(); + + // set the state back to pre-game + ProfileManager.ResetProfileProcessState(); + + if (g_NetworkManager.IsLeavingGame()) { + // 4J Stu - If we are already leaving the game, then we + // just need to signal that the player signed out to + // stop saves + pMinecraft->progressRenderer->progressStartNoAbort( + IDS_EXITING_GAME); + pMinecraft->progressRenderer->progressStage(-1); + // This has no effect on client machines + MinecraftServer::HaltServer(true); + } else { + // Stop app running + SetGameStarted(false); + + // turn off the gamertags in splitscreen for the primary + // player, since they are about to be made fullscreen + ui.HideAllGameUIElements(); + + ui.CloseAllPlayersScenes(); + + // 4J Stu - Fix for #12368 - Crash: Game crashes when + // saving then exiting and selecting to save + for (unsigned int idx = 0; idx < XUSER_MAX_COUNT; + ++idx) { + // 4J Stu - Fix for #13257 - CRASH: Gameplay: Title + // crashed after exiting the tutorial It doesn't + // matter if they were in the tutorial already + pMinecraft->playerLeftTutorial(idx); + } + + LoadingInputParams* loadingParams = + new LoadingInputParams(); + loadingParams->func = &Game::SignoutExitWorldThreadProc; + + UIFullscreenProgressCompletionData* completionData = + new UIFullscreenProgressCompletionData(); + completionData->bShowBackground = true; + completionData->bShowLogo = true; + completionData->iPad = DEFAULT_XUI_MENU_USER; + completionData->type = + e_ProgressCompletion_NavigateToHomeMenu; + loadingParams->completionData = completionData; + + ui.NavigateToScene(ProfileManager.GetPrimaryPad(), + eUIScene_FullscreenProgress, + loadingParams); + } + } break; + case eAppAction_PrimaryPlayerSignedOutReturned_Menus: + SetAction(i, eAppAction_Idle); + // set the state back to pre-game + ProfileManager.ResetProfileProcessState(); + // clear the save device + StorageManager.SetSaveDeviceSelected(i, false); + + ui.UpdatePlayerBasePositions(); + // there are multiple layers in the help menu, so a navigate + // back isn't enough + ui.NavigateToHomeMenu(); + + break; + case eAppAction_EthernetDisconnectedReturned_Menus: + SetAction(i, eAppAction_Idle); + // set the state back to pre-game + ProfileManager.ResetProfileProcessState(); + + ui.UpdatePlayerBasePositions(); + + // there are multiple layers in the help menu, so a navigate + // back isn't enough + ui.NavigateToHomeMenu(); + + break; + + case eAppAction_TrialOver: { + SetAction(i, eAppAction_Idle); + unsigned int uiIDA[2]; + uiIDA[0] = IDS_UNLOCK_TITLE; + uiIDA[1] = IDS_EXIT_GAME; + + ui.RequestErrorMessage(IDS_TRIALOVER_TITLE, + IDS_TRIALOVER_TEXT, uiIDA, 2, i, + &Game::TrialOverReturned, this); + } break; + + // INVITES + case eAppAction_DashboardTrialJoinFromInvite: { + SetAction(i, eAppAction_Idle); + unsigned int uiIDA[2]; + uiIDA[0] = IDS_CONFIRM_OK; + uiIDA[1] = IDS_CONFIRM_CANCEL; + + ui.RequestErrorMessage( + IDS_UNLOCK_TITLE, IDS_UNLOCK_ACCEPT_INVITE, uiIDA, 2, i, + &Game::UnlockFullInviteReturned, this); + } break; + case eAppAction_ExitAndJoinFromInvite: { + unsigned int uiIDA[3]; + + SetAction(i, eAppAction_Idle); + // Check the player really wants to do this + + if (!StorageManager.GetSaveDisabled() && + i == ProfileManager.GetPrimaryPad() && + g_NetworkManager.IsHost() && GetGameStarted()) { + uiIDA[0] = IDS_CONFIRM_CANCEL; + uiIDA[1] = IDS_EXIT_GAME_SAVE; + uiIDA[2] = IDS_EXIT_GAME_NO_SAVE; + + ui.RequestAlertMessage( + IDS_EXIT_GAME, IDS_CONFIRM_LEAVE_VIA_INVITE, uiIDA, + 3, i, + &Game::ExitAndJoinFromInviteSaveDialogReturned, + this); + } else { + uiIDA[0] = IDS_CONFIRM_CANCEL; + uiIDA[1] = IDS_CONFIRM_OK; + ui.RequestAlertMessage( + IDS_EXIT_GAME, IDS_CONFIRM_LEAVE_VIA_INVITE, uiIDA, + 2, i, &Game::ExitAndJoinFromInvite, this); + } + } break; + case eAppAction_ExitAndJoinFromInviteConfirmed: { + SetAction(i, eAppAction_Idle); + + pMinecraft->gui->clearMessages(); + + // turn off the gamertags in splitscreen for the primary + // player, since they are about to be made fullscreen + ui.HideAllGameUIElements(); + + // Stop app running + SetGameStarted(false); + + ui.CloseAllPlayersScenes(); + + // 4J Stu - Fix for #12368 - Crash: Game crashes when saving + // then exiting and selecting to save + for (unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { + // 4J Stu - Fix for #13257 - CRASH: Gameplay: Title + // crashed after exiting the tutorial It doesn't matter + // if they were in the tutorial already + pMinecraft->playerLeftTutorial(idx); + } + + // 4J-PB - may have been using a texture pack with audio , + // so clean up anything texture pack related here + + // unload any texture pack audio + // if there is audio in use, clear out the audio, and + // unmount the pack + TexturePack* pTexPack = + Minecraft::GetInstance()->skins->getSelected(); + DLCTexturePack* pDLCTexPack = nullptr; + + if (pTexPack->hasAudio()) { + // get the dlc texture pack, and store it + pDLCTexPack = (DLCTexturePack*)pTexPack; + } + + // change to the default texture pack + pMinecraft->skins->selectTexturePackById( + TexturePackRepository::DEFAULT_TEXTURE_PACK_ID); + + if (pTexPack->hasAudio()) { + // need to stop the streaming audio - by playing + // streaming audio from the default texture pack now + // reset the streaming sounds back to the normal ones + pMinecraft->soundEngine->SetStreamingSounds( + eStream_Overworld_Calm1, eStream_Overworld_piano3, + eStream_Nether1, eStream_Nether4, + eStream_end_dragon, eStream_end_end, eStream_CD_1); + pMinecraft->soundEngine->playStreaming(L"", 0, 0, 0, 1, + 1); + + const unsigned int result = + StorageManager.UnmountInstalledDLC("TPACK"); + app.DebugPrintf("Unmount result is %d\n", result); + } + + LoadingInputParams* loadingParams = + new LoadingInputParams(); + loadingParams->func = + &CGameNetworkManager::ExitAndJoinFromInviteThreadProc; + loadingParams->lpParam = (void*)&m_InviteData; + + UIFullscreenProgressCompletionData* completionData = + new UIFullscreenProgressCompletionData(); + completionData->bShowBackground = true; + completionData->bShowLogo = true; + completionData->iPad = DEFAULT_XUI_MENU_USER; + completionData->type = e_ProgressCompletion_NoAction; + loadingParams->completionData = completionData; + + ui.NavigateToScene(ProfileManager.GetPrimaryPad(), + eUIScene_FullscreenProgress, + loadingParams); + } + + break; + case eAppAction_JoinFromInvite: { + SetAction(i, eAppAction_Idle); + + // 4J Stu - Move this state block from + // IPlatformNetwork::ExitAndJoinFromInviteThreadProc, + // as g_NetworkManager.JoinGameFromInviteInfo ultimately can + // call NavigateToScene, + /// and we should only be calling that from the main thread + app.SetTutorialMode(false); + + g_NetworkManager.SetLocalGame(false); + + JoinFromInviteData* inviteData = (JoinFromInviteData*)param; + // 4J-PB - clear any previous connection errors + Minecraft::GetInstance()->clearConnectionFailed(); + + app.DebugPrintf( + "Changing Primary Pad on an invite accept - pad was " + "%d, and is now %d\n", + ProfileManager.GetPrimaryPad(), + inviteData->dwUserIndex); + ProfileManager.SetLockedProfile(inviteData->dwUserIndex); + ProfileManager.SetPrimaryPad(inviteData->dwUserIndex); + + // change the minecraft player name + Minecraft::GetInstance()->user->name = + convStringToWstring(ProfileManager.GetGamertag( + ProfileManager.GetPrimaryPad())); + + bool success = g_NetworkManager.JoinGameFromInviteInfo( + inviteData->dwUserIndex, // dwUserIndex + inviteData->dwLocalUsersMask, // dwUserMask + inviteData->pInviteInfo); // pInviteInfo + + if (!success) { + app.DebugPrintf("Failed joining game from invite\n"); + // return hr; + + // 4J Stu - Copied this from XUI_FullScreenProgress to + // properly handle the fail case, as the thread will no + // longer be failing + unsigned int uiIDA[1]; + uiIDA[0] = IDS_CONFIRM_OK; + ui.RequestErrorMessage( + IDS_CONNECTION_FAILED, IDS_CONNECTION_LOST_SERVER, + uiIDA, 1, ProfileManager.GetPrimaryPad()); + + ui.NavigateToHomeMenu(); + ui.UpdatePlayerBasePositions(); + } + } break; + case eAppAction_ChangeSessionType: { + // If we are not in gameplay yet, then wait until the server + // is setup before changing the session type + if (g_NetworkManager.IsInGameplay()) { + // This kicks off a thread that waits for the server to + // end, then closes the current session, starts a new + // one and joins the local players into it + + SetAction(i, eAppAction_Idle); + + if (!GetChangingSessionType() && + !g_NetworkManager.IsLocalGame()) { + SetGameStarted(false); + SetChangingSessionType(true); + SetReallyChangingSessionType(true); + + // turn off the gamertags in splitscreen for the + // primary player, since they are about to be made + // fullscreen + ui.HideAllGameUIElements(); + + if (!ui.IsSceneInStack( + ProfileManager.GetPrimaryPad(), + eUIScene_EndPoem)) { + ui.CloseAllPlayersScenes(); + } + ui.ShowOtherPlayersBaseScene( + ProfileManager.GetPrimaryPad(), true); + + // Remove this line to fix: + // #49084 - TU5: Code: Gameplay: The title crashes + // every time client navigates to 'Play game' menu + // and loads/creates new game after a "Connection to + // Xbox LIVE was lost" message has appeared. + // app.NavigateToScene(0,eUIScene_Main); + + LoadingInputParams* loadingParams = + new LoadingInputParams(); + loadingParams->func = + &CGameNetworkManager:: + ChangeSessionTypeThreadProc; + loadingParams->lpParam = nullptr; + + UIFullscreenProgressCompletionData* completionData = + new UIFullscreenProgressCompletionData(); + completionData->bRequiresUserAction = true; + completionData->bShowBackground = true; + completionData->bShowLogo = true; + completionData->iPad = DEFAULT_XUI_MENU_USER; + if (ui.IsSceneInStack( + ProfileManager.GetPrimaryPad(), + eUIScene_EndPoem)) { + completionData->type = + e_ProgressCompletion_NavigateBackToScene; + completionData->scene = eUIScene_EndPoem; + } else { + completionData->type = + e_ProgressCompletion_CloseAllPlayersUIScenes; + } + loadingParams->completionData = completionData; + + ui.NavigateToScene(ProfileManager.GetPrimaryPad(), + eUIScene_FullscreenProgress, + loadingParams); + } + } else if (g_NetworkManager.IsLeavingGame()) { + // If we are leaving the game, then ignore the state + // change + SetAction(i, eAppAction_Idle); + } + } break; + case eAppAction_SetDefaultOptions: + SetAction(i, eAppAction_Idle); + SetDefaultOptions((C_4JProfile::PROFILESETTINGS*)param, i); + + // if the profile data has been changed, then force a + // profile write It seems we're allowed to break the 5 + // minute rule if it's the result of a user action + CheckGameSettingsChanged(true, i); + + break; + + case eAppAction_RemoteServerSave: { + // If the remote server save has already finished, don't + // complete the action + if (GetGameStarted()) { + SetAction(ProfileManager.GetPrimaryPad(), + eAppAction_Idle); + break; + } + + SetAction(i, eAppAction_WaitRemoteServerSaveComplete); + + for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { + ui.CloseUIScenes(i, true); + } + + // turn off the gamertags in splitscreen for the primary + // player, since they are about to be made fullscreen + ui.HideAllGameUIElements(); + + LoadingInputParams* loadingParams = + new LoadingInputParams(); + loadingParams->func = &Game::RemoteSaveThreadProc; + loadingParams->lpParam = nullptr; + + UIFullscreenProgressCompletionData* completionData = + new UIFullscreenProgressCompletionData(); + completionData->bRequiresUserAction = false; + completionData->bShowBackground = true; + completionData->bShowLogo = true; + completionData->iPad = DEFAULT_XUI_MENU_USER; + if (ui.IsSceneInStack(ProfileManager.GetPrimaryPad(), + eUIScene_EndPoem)) { + completionData->type = + e_ProgressCompletion_NavigateBackToScene; + completionData->scene = eUIScene_EndPoem; + } else { + completionData->type = + e_ProgressCompletion_CloseAllPlayersUIScenes; + } + loadingParams->completionData = completionData; + + loadingParams->cancelFunc = &Game::ExitGameFromRemoteSave; + loadingParams->cancelText = IDS_TOOLTIPS_EXIT; + + ui.NavigateToScene(ProfileManager.GetPrimaryPad(), + eUIScene_FullscreenProgress, + loadingParams); + } break; + case eAppAction_WaitRemoteServerSaveComplete: + // Do nothing + break; + case eAppAction_FailedToJoinNoPrivileges: { + unsigned int uiIDA[1]; + uiIDA[0] = IDS_CONFIRM_OK; + C4JStorage::EMessageResult result = ui.RequestErrorMessage( + IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, + IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA, 1, + ProfileManager.GetPrimaryPad()); + if (result != C4JStorage::EMessage_Busy) + SetAction(i, eAppAction_Idle); + } break; + case eAppAction_ProfileReadError: + // Return player to the main menu - code largely copied from + // that for handling eAppAction_PrimaryPlayerSignedOut, + // although I don't think we should have got as far as + // needing to halt the server, or running the game, before + // returning to the menu + if (!app.GetGameStarted()) + MinecraftServer::HaltServer(true); + + if (g_NetworkManager.IsInSession()) { + app.SetAction( + i, eAppAction_PrimaryPlayerSignedOutReturned); + } else { + app.SetAction( + i, eAppAction_PrimaryPlayerSignedOutReturned_Menus); + MinecraftServer::resetFlags(); + } + break; + + case eAppAction_BanLevel: { + // It's possible that this state can get set after the game + // has been exited (e.g. by network disconnection) so we + // can't ban the level at that point + if (g_NetworkManager.IsInGameplay() && + !g_NetworkManager.IsLeavingGame()) { + // primary player would exit the world, secondary would + // exit the player + if (ProfileManager.GetPrimaryPad() == i) { + SetAction(i, eAppAction_ExitWorld); + } else { + SetAction(i, eAppAction_ExitPlayer); + } + } + } break; + case eAppAction_LevelInBanLevelList: { + unsigned int uiIDA[2]; + uiIDA[0] = IDS_BUTTON_REMOVE_FROM_BAN_LIST; + uiIDA[1] = IDS_EXIT_GAME; + + // pass in the gamertag format std::string + wchar_t wchFormat[40]; + INetworkPlayer* player = + g_NetworkManager.GetLocalPlayerByUserIndex(i); + + // If not the primary player, but the primary player has + // banned this level and decided not to unban then we may + // have left the game by now + if (player) { + swprintf(wchFormat, 40, L"%ls\n\n%%ls", + player->GetOnlineName()); + + C4JStorage::EMessageResult result = + ui.RequestErrorMessage( + IDS_BANNED_LEVEL_TITLE, IDS_PLAYER_BANNED_LEVEL, + uiIDA, 2, i, &Game::BannedLevelDialogReturned, + this, wchFormat); + if (result != C4JStorage::EMessage_Busy) + SetAction(i, eAppAction_Idle); + } else { + SetAction(i, eAppAction_Idle); + } + } break; + case eAppAction_DebugText: + // launch the xui for text entry + { + SetAction(i, eAppAction_Idle); + } + break; + + case eAppAction_ReloadTexturePack: { + SetAction(i, eAppAction_Idle); + Minecraft* pMinecraft = Minecraft::GetInstance(); + pMinecraft->textures->reloadAll(); + pMinecraft->skins->updateUI(); + + if (!pMinecraft->skins->isUsingDefaultSkin()) { + TexturePack* pTexturePack = + pMinecraft->skins->getSelected(); + + DLCPack* pDLCPack = pTexturePack->getDLCPack(); + + bool purchased = false; + // do we have a license? + if (pDLCPack && + pDLCPack->hasPurchasedFile( + DLCManager::e_DLCType_Texture, L"")) { + purchased = true; + } + } + + // 4J-PB - If the texture pack has audio, we need to switch + // to this + if (pMinecraft->skins->getSelected()->hasAudio()) { + Minecraft::GetInstance()->soundEngine->playStreaming( + L"", 0, 0, 0, 1, 1); + } + } break; + + case eAppAction_ReloadFont: { + app.DebugPrintf( + "[Consoles_App] eAppAction_ReloadFont, ingame='%s'.\n", + app.GetGameStarted() ? "Yes" : "No"); + + SetAction(i, eAppAction_Idle); + + ui.SetTooltips(i, -1); + + ui.ReloadSkin(); + ui.StartReloadSkinThread(); + + ui.setCleanupOnReload(); + } break; + + case eAppAction_TexturePackRequired: { + unsigned int uiIDA[2]; + + uiIDA[0] = IDS_TEXTUREPACK_FULLVERSION; + uiIDA[1] = IDS_TEXTURE_PACK_TRIALVERSION; + + // Give the player a warning about the texture pack missing + ui.RequestErrorMessage( + IDS_DLC_TEXTUREPACK_NOT_PRESENT_TITLE, + IDS_DLC_TEXTUREPACK_NOT_PRESENT, uiIDA, 2, + ProfileManager.GetPrimaryPad(), + &Game::TexturePackDialogReturned, this); + SetAction(i, eAppAction_Idle); + } + + break; + default: + break; + } + } + + // Any TMS actions? + + eTMS = app.GetTMSAction(i); + + if (eTMS != eTMSAction_Idle) { + switch (eTMS) { + // TMS++ actions + case eTMSAction_TMSPP_RetrieveFiles_CreateLoad_SignInReturned: + case eTMSAction_TMSPP_RetrieveFiles_RunPlayGame: + SetTMSAction(i, eTMSAction_TMSPP_UserFileList); + break; + + case eTMSAction_TMSPP_UserFileList: + // retrieve the file list first + SetTMSAction(i, eTMSAction_TMSPP_XUIDSFile); + break; + case eTMSAction_TMSPP_XUIDSFile: + SetTMSAction(i, eTMSAction_TMSPP_DLCFile); + + break; + case eTMSAction_TMSPP_DLCFile: + SetTMSAction(i, eTMSAction_TMSPP_BannedListFile); + break; + case eTMSAction_TMSPP_BannedListFile: + // If we have one in TMSPP, then we can assume we can ignore + // TMS + SetTMSAction(i, eTMSAction_TMS_RetrieveFiles_Complete); + break; + + // SPECIAL CASE - where the user goes directly in to Help & + // Options from the main menu + case eTMSAction_TMSPP_RetrieveFiles_HelpAndOptions: + case eTMSAction_TMSPP_RetrieveFiles_DLCMain: + // retrieve the file list first + SetTMSAction(i, eTMSAction_TMSPP_DLCFileOnly); + break; + case eTMSAction_TMSPP_RetrieveUserFilelist_DLCFileOnly: + SetTMSAction(i, eTMSAction_TMSPP_DLCFileOnly); + + break; + + case eTMSAction_TMSPP_DLCFileOnly: + SetTMSAction(i, eTMSAction_TMSPP_RetrieveFiles_Complete); + break; + + case eTMSAction_TMSPP_RetrieveFiles_Complete: + SetTMSAction(i, eTMSAction_Idle); + break; + + // TMS files + /* case + eTMSAction_TMS_RetrieveFiles_CreateLoad_SignInReturned: case + eTMSAction_TMS_RetrieveFiles_RunPlayGame: #ifdef 0 + SetTMSAction(i,eTMSAction_TMS_XUIDSFile_Waiting); + // pass in the next app action on the call or callback + completing + app.ReadXuidsFileFromTMS(i,eTMSAction_TMS_DLCFile,true); + #else + SetTMSAction(i,eTMSAction_TMS_DLCFile); + #endif + break; + + case eTMSAction_TMS_DLCFile: + SetTMSAction(i,eTMSAction_TMS_BannedListFile); + + break; + + case eTMSAction_TMS_RetrieveFiles_HelpAndOptions: + case eTMSAction_TMS_RetrieveFiles_DLCMain: + SetTMSAction(i,eTMSAction_Idle); + + break; + case eTMSAction_TMS_BannedListFile: + + break; + + */ + case eTMSAction_TMS_RetrieveFiles_Complete: + SetTMSAction(i, eTMSAction_Idle); + // if(StorageManager.SetSaveDevice(&CScene_Main::DeviceSelectReturned,pClass)) + // { + // // save device already + // selected + // // ensure we've applied + // this player's settings + // app.ApplyGameSettingsChanged(ProfileManager.GetPrimaryPad()); + // app.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_MultiGameJoinLoad); + // } + break; + default: + break; + } + } + } +} + +// loadMediaArchive and loadStringTable moved to +// ArchiveManager/LocalizationManager diff --git a/targets/app/common/IPlatformGame.h b/targets/app/common/IPlatformGame.h index 8dd6b3b18..9335d33f1 100644 --- a/targets/app/common/IPlatformGame.h +++ b/targets/app/common/IPlatformGame.h @@ -2,7 +2,7 @@ #include -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" class IPlatformGame { public: diff --git a/targets/app/common/src/Leaderboards/LeaderboardInterface.cpp b/targets/app/common/Leaderboards/LeaderboardInterface.cpp similarity index 97% rename from targets/app/common/src/Leaderboards/LeaderboardInterface.cpp rename to targets/app/common/Leaderboards/LeaderboardInterface.cpp index 38274afe2..979d7937b 100644 --- a/targets/app/common/src/Leaderboards/LeaderboardInterface.cpp +++ b/targets/app/common/Leaderboards/LeaderboardInterface.cpp @@ -2,7 +2,7 @@ #include -#include "app/common/src/Leaderboards/LeaderboardManager.h" +#include "app/common/Leaderboards/LeaderboardManager.h" LeaderboardInterface::LeaderboardInterface(IPlatformLeaderboard* man) { m_manager = man; diff --git a/targets/app/common/src/Leaderboards/LeaderboardInterface.h b/targets/app/common/Leaderboards/LeaderboardInterface.h similarity index 100% rename from targets/app/common/src/Leaderboards/LeaderboardInterface.h rename to targets/app/common/Leaderboards/LeaderboardInterface.h diff --git a/targets/app/common/src/Leaderboards/LeaderboardManager.cpp b/targets/app/common/Leaderboards/LeaderboardManager.cpp similarity index 100% rename from targets/app/common/src/Leaderboards/LeaderboardManager.cpp rename to targets/app/common/Leaderboards/LeaderboardManager.cpp diff --git a/targets/app/common/src/Leaderboards/LeaderboardManager.h b/targets/app/common/Leaderboards/LeaderboardManager.h similarity index 100% rename from targets/app/common/src/Leaderboards/LeaderboardManager.h rename to targets/app/common/Leaderboards/LeaderboardManager.h diff --git a/targets/app/common/src/Leaderboards/base64.cpp b/targets/app/common/Leaderboards/base64.cpp similarity index 100% rename from targets/app/common/src/Leaderboards/base64.cpp rename to targets/app/common/Leaderboards/base64.cpp diff --git a/targets/app/common/src/Leaderboards/base64.h b/targets/app/common/Leaderboards/base64.h similarity index 100% rename from targets/app/common/src/Leaderboards/base64.h rename to targets/app/common/Leaderboards/base64.h diff --git a/targets/app/common/src/Localisation/StringTable.cpp b/targets/app/common/Localisation/StringTable.cpp similarity index 100% rename from targets/app/common/src/Localisation/StringTable.cpp rename to targets/app/common/Localisation/StringTable.cpp diff --git a/targets/app/common/src/Localisation/StringTable.h b/targets/app/common/Localisation/StringTable.h similarity index 100% rename from targets/app/common/src/Localisation/StringTable.h rename to targets/app/common/Localisation/StringTable.h diff --git a/targets/app/common/LocalizationManager.cpp b/targets/app/common/LocalizationManager.cpp new file mode 100644 index 000000000..3937fce4a --- /dev/null +++ b/targets/app/common/LocalizationManager.cpp @@ -0,0 +1,863 @@ +#include "app/common/LocalizationManager.h" + +#include +#include +#include + +#include + +#include "minecraft/GameEnums.h" +#include "app/common/App_structs.h" +#include "app/common/Localisation/StringTable.h" +#include "app/common/Colours/ColourTable.h" +#include "app/common/UI/All Platforms/ArchiveFile.h" +#include "app/linux/LinuxGame.h" +#include "java/Random.h" +#include "minecraft/client/Minecraft.h" +#include "minecraft/client/skins/TexturePack.h" +#include "minecraft/client/skins/TexturePackRepository.h" +#include "platform/InputActions.h" +#include "platform/sdl2/Input.h" +#include "platform/sdl2/Render.h" +#include "platform/XboxStubs.h" +#include "strings.h" +#include "util/StringHelpers.h" + +int LocalizationManager::s_iHTMLFontSizesA[eHTMLSize_COUNT] = { + 20, 13, 20, 26}; + +TIPSTRUCT LocalizationManager::m_GameTipA[MAX_TIPS_GAMETIP] = { + {0, IDS_TIPS_GAMETIP_1}, {0, IDS_TIPS_GAMETIP_2}, + {0, IDS_TIPS_GAMETIP_3}, {0, IDS_TIPS_GAMETIP_4}, + {0, IDS_TIPS_GAMETIP_5}, {0, IDS_TIPS_GAMETIP_6}, + {0, IDS_TIPS_GAMETIP_7}, {0, IDS_TIPS_GAMETIP_8}, + {0, IDS_TIPS_GAMETIP_9}, {0, IDS_TIPS_GAMETIP_10}, + {0, IDS_TIPS_GAMETIP_11}, {0, IDS_TIPS_GAMETIP_12}, + {0, IDS_TIPS_GAMETIP_13}, {0, IDS_TIPS_GAMETIP_14}, + {0, IDS_TIPS_GAMETIP_15}, {0, IDS_TIPS_GAMETIP_16}, + {0, IDS_TIPS_GAMETIP_17}, {0, IDS_TIPS_GAMETIP_18}, + {0, IDS_TIPS_GAMETIP_19}, {0, IDS_TIPS_GAMETIP_20}, + {0, IDS_TIPS_GAMETIP_21}, {0, IDS_TIPS_GAMETIP_22}, + {0, IDS_TIPS_GAMETIP_23}, {0, IDS_TIPS_GAMETIP_24}, + {0, IDS_TIPS_GAMETIP_25}, {0, IDS_TIPS_GAMETIP_26}, + {0, IDS_TIPS_GAMETIP_27}, {0, IDS_TIPS_GAMETIP_28}, + {0, IDS_TIPS_GAMETIP_29}, {0, IDS_TIPS_GAMETIP_30}, + {0, IDS_TIPS_GAMETIP_31}, {0, IDS_TIPS_GAMETIP_32}, + {0, IDS_TIPS_GAMETIP_33}, {0, IDS_TIPS_GAMETIP_34}, + {0, IDS_TIPS_GAMETIP_35}, {0, IDS_TIPS_GAMETIP_36}, + {0, IDS_TIPS_GAMETIP_37}, {0, IDS_TIPS_GAMETIP_38}, + {0, IDS_TIPS_GAMETIP_39}, {0, IDS_TIPS_GAMETIP_40}, + {0, IDS_TIPS_GAMETIP_41}, {0, IDS_TIPS_GAMETIP_42}, + {0, IDS_TIPS_GAMETIP_43}, {0, IDS_TIPS_GAMETIP_44}, + {0, IDS_TIPS_GAMETIP_45}, {0, IDS_TIPS_GAMETIP_46}, + {0, IDS_TIPS_GAMETIP_47}, {0, IDS_TIPS_GAMETIP_48}, + {0, IDS_TIPS_GAMETIP_49}, {0, IDS_TIPS_GAMETIP_50}, +}; + +TIPSTRUCT LocalizationManager::m_TriviaTipA[MAX_TIPS_TRIVIATIP] = { + {0, IDS_TIPS_TRIVIA_1}, {0, IDS_TIPS_TRIVIA_2}, {0, IDS_TIPS_TRIVIA_3}, + {0, IDS_TIPS_TRIVIA_4}, {0, IDS_TIPS_TRIVIA_5}, {0, IDS_TIPS_TRIVIA_6}, + {0, IDS_TIPS_TRIVIA_7}, {0, IDS_TIPS_TRIVIA_8}, {0, IDS_TIPS_TRIVIA_9}, + {0, IDS_TIPS_TRIVIA_10}, {0, IDS_TIPS_TRIVIA_11}, {0, IDS_TIPS_TRIVIA_12}, + {0, IDS_TIPS_TRIVIA_13}, {0, IDS_TIPS_TRIVIA_14}, {0, IDS_TIPS_TRIVIA_15}, + {0, IDS_TIPS_TRIVIA_16}, {0, IDS_TIPS_TRIVIA_17}, {0, IDS_TIPS_TRIVIA_18}, + {0, IDS_TIPS_TRIVIA_19}, {0, IDS_TIPS_TRIVIA_20}, +}; + +Random* LocalizationManager::TipRandom = new Random(); + +LocalizationManager::LocalizationManager() + : m_stringTable(nullptr), m_uiCurrentTip(0) { + memset(m_TipIDA, 0, sizeof(m_TipIDA)); +} + +void LocalizationManager::loadStringTable(ArchiveFile* mediaArchive) { + if (m_stringTable != nullptr) { + // we need to unload the current std::string table, this is a reload + delete m_stringTable; + } + std::wstring localisationFile = L"languages.loc"; + if (mediaArchive->hasFile(localisationFile)) { + std::vector locFile = + mediaArchive->getFile(localisationFile); + m_stringTable = new StringTable(locFile.data(), locFile.size()); + } else { + m_stringTable = nullptr; + assert(false); + // AHHHHHHHHH. + } +} + +const wchar_t* LocalizationManager::getString(int iID) const { + return m_stringTable->getString(iID); +} + +int LocalizationManager::TipsSortFunction(const void* a, const void* b) { + int s1 = ((TIPSTRUCT*)a)->iSortValue; + int s2 = ((TIPSTRUCT*)b)->iSortValue; + + if (s1 > s2) { + return 1; + } else if (s1 == s2) { + return 0; + } + + return -1; +} + +void LocalizationManager::initialiseTips() { + memset(m_TipIDA, 0, sizeof(m_TipIDA)); + + if (!RenderManager.IsHiDef()) { + m_GameTipA[0].uiStringID = IDS_TIPS_GAMETIP_0; + } + +#if defined(_CONTENT_PACKAGE) + for (int i = 1; i < MAX_TIPS_GAMETIP; i++) { + m_GameTipA[i].iSortValue = TipRandom->nextInt(); + } + qsort(&m_GameTipA[1], MAX_TIPS_GAMETIP - 1, sizeof(TIPSTRUCT), + TipsSortFunction); +#endif + + for (int i = 0; i < MAX_TIPS_TRIVIATIP; i++) { + m_TriviaTipA[i].iSortValue = TipRandom->nextInt(); + } + qsort(m_TriviaTipA, MAX_TIPS_TRIVIATIP, sizeof(TIPSTRUCT), + TipsSortFunction); + + int iCurrentGameTip = 0; + int iCurrentTriviaTip = 0; + + for (int i = 0; i < MAX_TIPS_GAMETIP + MAX_TIPS_TRIVIATIP; i++) { + if ((i % 3 == 2) && (iCurrentTriviaTip < MAX_TIPS_TRIVIATIP)) { + m_TipIDA[i] = m_TriviaTipA[iCurrentTriviaTip++].uiStringID; + } else { + if (iCurrentGameTip < MAX_TIPS_GAMETIP) { + m_TipIDA[i] = m_GameTipA[iCurrentGameTip++].uiStringID; + } else { + m_TipIDA[i] = m_TriviaTipA[iCurrentTriviaTip++].uiStringID; + } + } + + if (m_TipIDA[i] == 0) { +#if !defined(_CONTENT_PACKAGE) + assert(0); +#endif + } + } + + m_uiCurrentTip = 0; +} + +int LocalizationManager::getNextTip() { + static bool bShowSkinDLCTip = true; + if (app.GetNewDLCAvailable() && app.DisplayNewDLCTip()) { + return IDS_TIPS_GAMETIP_NEWDLC; + } else { + if (bShowSkinDLCTip) { + bShowSkinDLCTip = false; + if (app.DLCInstallProcessCompleted()) { + if (app.m_dlcManager.getPackCount(DLCManager::e_DLCType_Skin) == + 0) { + return IDS_TIPS_GAMETIP_SKINPACKS; + } + } else { + return IDS_TIPS_GAMETIP_SKINPACKS; + } + } + } + + if (m_uiCurrentTip == MAX_TIPS_GAMETIP + MAX_TIPS_TRIVIATIP) + m_uiCurrentTip = 0; + + return m_TipIDA[m_uiCurrentTip++]; +} + +int LocalizationManager::getHTMLColour(eMinecraftColour colour) { + Minecraft* pMinecraft = Minecraft::GetInstance(); + return pMinecraft->skins->getSelected()->getColourTable()->getColour( + colour); +} + +int LocalizationManager::getHTMLFontSize(EHTMLFontSize size) { + return s_iHTMLFontSizesA[size]; +} + +std::wstring LocalizationManager::formatHTMLString( + int iPad, const std::wstring& desc, int shadowColour /*= 0xFFFFFFFF*/) { + std::wstring text(desc); + + wchar_t replacements[64]; + text = replaceAll(text, L"{*B*}", L"
"); + swprintf(replacements, 64, L"", + getHTMLColour(eHTMLColor_T1)); + text = replaceAll(text, L"{*T1*}", replacements); + swprintf(replacements, 64, L"", + getHTMLColour(eHTMLColor_T2)); + text = replaceAll(text, L"{*T2*}", replacements); + swprintf(replacements, 64, L"", + getHTMLColour(eHTMLColor_T3)); + text = replaceAll(text, L"{*T3*}", replacements); + swprintf(replacements, 64, L"", + getHTMLColour(eHTMLColor_Black)); + text = replaceAll(text, L"{*ETB*}", replacements); + swprintf(replacements, 64, L"", + getHTMLColour(eHTMLColor_White)); + text = replaceAll(text, L"{*ETW*}", replacements); + text = replaceAll(text, L"{*EF*}", L""); + + swprintf(replacements, 64, L"", + getHTMLColour(eHTMLColor_0), shadowColour); + text = replaceAll(text, L"{*C0*}", replacements); + swprintf(replacements, 64, L"", + getHTMLColour(eHTMLColor_1), shadowColour); + text = replaceAll(text, L"{*C1*}", replacements); + swprintf(replacements, 64, L"", + getHTMLColour(eHTMLColor_2), shadowColour); + text = replaceAll(text, L"{*C2*}", replacements); + swprintf(replacements, 64, L"", + getHTMLColour(eHTMLColor_3), shadowColour); + text = replaceAll(text, L"{*C3*}", replacements); + swprintf(replacements, 64, L"", + getHTMLColour(eHTMLColor_4), shadowColour); + text = replaceAll(text, L"{*C4*}", replacements); + swprintf(replacements, 64, L"", + getHTMLColour(eHTMLColor_5), shadowColour); + text = replaceAll(text, L"{*C5*}", replacements); + swprintf(replacements, 64, L"", + getHTMLColour(eHTMLColor_6), shadowColour); + text = replaceAll(text, L"{*C6*}", replacements); + swprintf(replacements, 64, L"", + getHTMLColour(eHTMLColor_7), shadowColour); + text = replaceAll(text, L"{*C7*}", replacements); + swprintf(replacements, 64, L"", + getHTMLColour(eHTMLColor_8), shadowColour); + text = replaceAll(text, L"{*C8*}", replacements); + swprintf(replacements, 64, L"", + getHTMLColour(eHTMLColor_9), shadowColour); + text = replaceAll(text, L"{*C9*}", replacements); + swprintf(replacements, 64, L"", + getHTMLColour(eHTMLColor_a), shadowColour); + text = replaceAll(text, L"{*CA*}", replacements); + swprintf(replacements, 64, L"", + getHTMLColour(eHTMLColor_b), shadowColour); + text = replaceAll(text, L"{*CB*}", replacements); + swprintf(replacements, 64, L"", + getHTMLColour(eHTMLColor_c), shadowColour); + text = replaceAll(text, L"{*CC*}", replacements); + swprintf(replacements, 64, L"", + getHTMLColour(eHTMLColor_d), shadowColour); + text = replaceAll(text, L"{*CD*}", replacements); + swprintf(replacements, 64, L"", + getHTMLColour(eHTMLColor_e), shadowColour); + text = replaceAll(text, L"{*CE*}", replacements); + swprintf(replacements, 64, L"", + getHTMLColour(eHTMLColor_f), shadowColour); + text = replaceAll(text, L"{*CF*}", replacements); + + // Swap for southpaw. + if (app.GetGameSettings(iPad, eGameSetting_ControlSouthPaw)) { + text = + replaceAll(text, L"{*CONTROLLER_ACTION_MOVE*}", + getActionReplacement(iPad, MINECRAFT_ACTION_LOOK_RIGHT)); + text = replaceAll(text, L"{*CONTROLLER_ACTION_LOOK*}", + getActionReplacement(iPad, MINECRAFT_ACTION_RIGHT)); + + text = replaceAll(text, L"{*CONTROLLER_MENU_NAVIGATE*}", + getVKReplacement(VK_PAD_RTHUMB_LEFT)); + } else { + text = replaceAll(text, L"{*CONTROLLER_ACTION_MOVE*}", + getActionReplacement(iPad, MINECRAFT_ACTION_RIGHT)); + text = + replaceAll(text, L"{*CONTROLLER_ACTION_LOOK*}", + getActionReplacement(iPad, MINECRAFT_ACTION_LOOK_RIGHT)); + + text = replaceAll(text, L"{*CONTROLLER_MENU_NAVIGATE*}", + getVKReplacement(VK_PAD_LTHUMB_LEFT)); + } + + text = replaceAll(text, L"{*CONTROLLER_ACTION_JUMP*}", + getActionReplacement(iPad, MINECRAFT_ACTION_JUMP)); + text = + replaceAll(text, L"{*CONTROLLER_ACTION_SNEAK*}", + getActionReplacement(iPad, MINECRAFT_ACTION_SNEAK_TOGGLE)); + text = replaceAll(text, L"{*CONTROLLER_ACTION_USE*}", + getActionReplacement(iPad, MINECRAFT_ACTION_USE)); + text = replaceAll(text, L"{*CONTROLLER_ACTION_ACTION*}", + getActionReplacement(iPad, MINECRAFT_ACTION_ACTION)); + text = replaceAll(text, L"{*CONTROLLER_ACTION_LEFT_SCROLL*}", + getActionReplacement(iPad, MINECRAFT_ACTION_LEFT_SCROLL)); + text = + replaceAll(text, L"{*CONTROLLER_ACTION_RIGHT_SCROLL*}", + getActionReplacement(iPad, MINECRAFT_ACTION_RIGHT_SCROLL)); + text = replaceAll(text, L"{*CONTROLLER_ACTION_INVENTORY*}", + getActionReplacement(iPad, MINECRAFT_ACTION_INVENTORY)); + text = replaceAll(text, L"{*CONTROLLER_ACTION_CRAFTING*}", + getActionReplacement(iPad, MINECRAFT_ACTION_CRAFTING)); + text = replaceAll(text, L"{*CONTROLLER_ACTION_DROP*}", + getActionReplacement(iPad, MINECRAFT_ACTION_DROP)); + text = replaceAll( + text, L"{*CONTROLLER_ACTION_CAMERA*}", + getActionReplacement(iPad, MINECRAFT_ACTION_RENDER_THIRD_PERSON)); + text = replaceAll(text, L"{*CONTROLLER_ACTION_MENU_PAGEDOWN*}", + getActionReplacement(iPad, ACTION_MENU_PAGEDOWN)); + text = + replaceAll(text, L"{*CONTROLLER_ACTION_DISMOUNT*}", + getActionReplacement(iPad, MINECRAFT_ACTION_SNEAK_TOGGLE)); + text = replaceAll(text, L"{*CONTROLLER_VK_A*}", getVKReplacement(VK_PAD_A)); + text = replaceAll(text, L"{*CONTROLLER_VK_B*}", getVKReplacement(VK_PAD_B)); + text = replaceAll(text, L"{*CONTROLLER_VK_X*}", getVKReplacement(VK_PAD_X)); + text = replaceAll(text, L"{*CONTROLLER_VK_Y*}", getVKReplacement(VK_PAD_Y)); + text = replaceAll(text, L"{*CONTROLLER_VK_LB*}", + getVKReplacement(VK_PAD_LSHOULDER)); + text = replaceAll(text, L"{*CONTROLLER_VK_RB*}", + getVKReplacement(VK_PAD_RSHOULDER)); + text = replaceAll(text, L"{*CONTROLLER_VK_LS*}", + getVKReplacement(VK_PAD_LTHUMB_UP)); + text = replaceAll(text, L"{*CONTROLLER_VK_RS*}", + getVKReplacement(VK_PAD_RTHUMB_UP)); + text = replaceAll(text, L"{*CONTROLLER_VK_LT*}", + getVKReplacement(VK_PAD_LTRIGGER)); + text = replaceAll(text, L"{*CONTROLLER_VK_RT*}", + getVKReplacement(VK_PAD_RTRIGGER)); + text = replaceAll(text, L"{*ICON_SHANK_01*}", + getIconReplacement(XZP_ICON_SHANK_01)); + text = replaceAll(text, L"{*ICON_SHANK_03*}", + getIconReplacement(XZP_ICON_SHANK_03)); + text = replaceAll(text, L"{*CONTROLLER_ACTION_DPAD_UP*}", + getActionReplacement(iPad, MINECRAFT_ACTION_DPAD_UP)); + text = replaceAll(text, L"{*CONTROLLER_ACTION_DPAD_DOWN*}", + getActionReplacement(iPad, MINECRAFT_ACTION_DPAD_DOWN)); + text = replaceAll(text, L"{*CONTROLLER_ACTION_DPAD_RIGHT*}", + getActionReplacement(iPad, MINECRAFT_ACTION_DPAD_RIGHT)); + text = replaceAll(text, L"{*CONTROLLER_ACTION_DPAD_LEFT*}", + getActionReplacement(iPad, MINECRAFT_ACTION_DPAD_LEFT)); + + std::uint32_t dwLanguage = XGetLanguage(); + switch (dwLanguage) { + case XC_LANGUAGE_KOREAN: + case XC_LANGUAGE_JAPANESE: + case XC_LANGUAGE_TCHINESE: + text = replaceAll(text, L" ", L""); + break; + } + + return text; +} + +std::wstring LocalizationManager::getActionReplacement( + int iPad, unsigned char ucAction) { + unsigned int input = InputManager.GetGameJoypadMaps( + InputManager.GetJoypadMapVal(iPad), ucAction); + + std::wstring replacement = L""; + + if (input & _360_JOY_BUTTON_A) + replacement = L"ButtonA"; + else if (input & _360_JOY_BUTTON_B) + replacement = L"ButtonB"; + else if (input & _360_JOY_BUTTON_X) + replacement = L"ButtonX"; + else if (input & _360_JOY_BUTTON_Y) + replacement = L"ButtonY"; + else if ((input & _360_JOY_BUTTON_LSTICK_UP) || + (input & _360_JOY_BUTTON_LSTICK_DOWN) || + (input & _360_JOY_BUTTON_LSTICK_LEFT) || + (input & _360_JOY_BUTTON_LSTICK_RIGHT)) { + replacement = L"ButtonLeftStick"; + } else if ((input & _360_JOY_BUTTON_RSTICK_LEFT) || + (input & _360_JOY_BUTTON_RSTICK_RIGHT) || + (input & _360_JOY_BUTTON_RSTICK_UP) || + (input & _360_JOY_BUTTON_RSTICK_DOWN)) { + replacement = L"ButtonRightStick"; + } else if (input & _360_JOY_BUTTON_DPAD_LEFT) + replacement = L"ButtonDpadL"; + else if (input & _360_JOY_BUTTON_DPAD_RIGHT) + replacement = L"ButtonDpadR"; + else if (input & _360_JOY_BUTTON_DPAD_UP) + replacement = L"ButtonDpadU"; + else if (input & _360_JOY_BUTTON_DPAD_DOWN) + replacement = L"ButtonDpadD"; + else if (input & _360_JOY_BUTTON_LT) + replacement = L"ButtonLeftTrigger"; + else if (input & _360_JOY_BUTTON_RT) + replacement = L"ButtonRightTrigger"; + else if (input & _360_JOY_BUTTON_RB) + replacement = L"ButtonRightBumper"; + else if (input & _360_JOY_BUTTON_LB) + replacement = L"ButtonLeftBumper"; + else if (input & _360_JOY_BUTTON_BACK) + replacement = L"ButtonBack"; + else if (input & _360_JOY_BUTTON_START) + replacement = L"ButtonStart"; + else if (input & _360_JOY_BUTTON_RTHUMB) + replacement = L"ButtonRS"; + else if (input & _360_JOY_BUTTON_LTHUMB) + replacement = L"ButtonLS"; + + wchar_t string[128]; + +#if defined(_WIN64) + int size = 45; + if (ui.getScreenWidth() < 1920) size = 30; +#else + int size = 45; +#endif + + swprintf(string, 128, + L"", + replacement.c_str(), size, size); + + return string; +} + +std::wstring LocalizationManager::getVKReplacement(unsigned int uiVKey) { + std::wstring replacement = L""; + switch (uiVKey) { + case VK_PAD_A: + replacement = L"ButtonA"; + break; + case VK_PAD_B: + replacement = L"ButtonB"; + break; + case VK_PAD_X: + replacement = L"ButtonX"; + break; + case VK_PAD_Y: + replacement = L"ButtonY"; + break; + case VK_PAD_LSHOULDER: + replacement = L"ButtonLeftBumper"; + break; + case VK_PAD_RSHOULDER: + replacement = L"ButtonRightBumper"; + break; + case VK_PAD_LTRIGGER: + replacement = L"ButtonLeftTrigger"; + break; + case VK_PAD_RTRIGGER: + replacement = L"ButtonRightTrigger"; + break; + case VK_PAD_LTHUMB_UP: + case VK_PAD_LTHUMB_DOWN: + case VK_PAD_LTHUMB_RIGHT: + case VK_PAD_LTHUMB_LEFT: + case VK_PAD_LTHUMB_UPLEFT: + case VK_PAD_LTHUMB_UPRIGHT: + case VK_PAD_LTHUMB_DOWNRIGHT: + case VK_PAD_LTHUMB_DOWNLEFT: + replacement = L"ButtonLeftStick"; + break; + case VK_PAD_RTHUMB_UP: + case VK_PAD_RTHUMB_DOWN: + case VK_PAD_RTHUMB_RIGHT: + case VK_PAD_RTHUMB_LEFT: + case VK_PAD_RTHUMB_UPLEFT: + case VK_PAD_RTHUMB_UPRIGHT: + case VK_PAD_RTHUMB_DOWNRIGHT: + case VK_PAD_RTHUMB_DOWNLEFT: + replacement = L"ButtonRightStick"; + break; + default: + break; + } + wchar_t string[128]; + +#if defined(_WIN64) + int size = 45; + if (ui.getScreenWidth() < 1920) size = 30; +#else + int size = 45; +#endif + + swprintf(string, 128, + L"", + replacement.c_str(), size, size); + + return string; +} + +std::wstring LocalizationManager::getIconReplacement(unsigned int uiIcon) { + wchar_t string[128]; + +#if defined(_WIN64) + int size = 33; + if (ui.getScreenWidth() < 1920) size = 22; +#else + int size = 33; +#endif + + swprintf(string, 128, + L"", + size, size); + std::wstring result = L""; + switch (uiIcon) { + case XZP_ICON_SHANK_01: + result = string; + break; + case XZP_ICON_SHANK_03: + result.append(string).append(string).append(string); + break; + default: + break; + } + return result; +} + +void LocalizationManager::getLocale( + std::vector& vecWstrLocales) { + std::vector locales; + + const unsigned int systemLanguage = XGetLanguage(); + + switch (systemLanguage) { + case XC_LANGUAGE_ENGLISH: + switch (XGetLocale()) { + case XC_LOCALE_AUSTRALIA: + case XC_LOCALE_CANADA: + case XC_LOCALE_CZECH_REPUBLIC: + case XC_LOCALE_GREECE: + case XC_LOCALE_HONG_KONG: + case XC_LOCALE_HUNGARY: + case XC_LOCALE_INDIA: + case XC_LOCALE_IRELAND: + case XC_LOCALE_ISRAEL: + case XC_LOCALE_NEW_ZEALAND: + case XC_LOCALE_SAUDI_ARABIA: + case XC_LOCALE_SINGAPORE: + case XC_LOCALE_SLOVAK_REPUBLIC: + case XC_LOCALE_SOUTH_AFRICA: + case XC_LOCALE_UNITED_ARAB_EMIRATES: + case XC_LOCALE_GREAT_BRITAIN: + locales.push_back(eMCLang_enGB); + break; + default: + break; + } + break; + case XC_LANGUAGE_JAPANESE: + locales.push_back(eMCLang_jaJP); + break; + case XC_LANGUAGE_GERMAN: + switch (XGetLocale()) { + case XC_LOCALE_AUSTRIA: + locales.push_back(eMCLang_deAT); + break; + case XC_LOCALE_SWITZERLAND: + locales.push_back(eMCLang_deCH); + break; + default: + break; + } + locales.push_back(eMCLang_deDE); + break; + case XC_LANGUAGE_FRENCH: + switch (XGetLocale()) { + case XC_LOCALE_BELGIUM: + locales.push_back(eMCLang_frBE); + break; + case XC_LOCALE_CANADA: + locales.push_back(eMCLang_frCA); + break; + case XC_LOCALE_SWITZERLAND: + locales.push_back(eMCLang_frCH); + break; + default: + break; + } + locales.push_back(eMCLang_frFR); + break; + case XC_LANGUAGE_SPANISH: + switch (XGetLocale()) { + case XC_LOCALE_MEXICO: + case XC_LOCALE_ARGENTINA: + case XC_LOCALE_CHILE: + case XC_LOCALE_COLOMBIA: + case XC_LOCALE_UNITED_STATES: + case XC_LOCALE_LATIN_AMERICA: + locales.push_back(eMCLang_laLAS); + locales.push_back(eMCLang_esMX); + break; + default: + break; + } + locales.push_back(eMCLang_esES); + break; + case XC_LANGUAGE_ITALIAN: + locales.push_back(eMCLang_itIT); + break; + case XC_LANGUAGE_KOREAN: + locales.push_back(eMCLang_koKR); + break; + case XC_LANGUAGE_TCHINESE: + switch (XGetLocale()) { + case XC_LOCALE_HONG_KONG: + locales.push_back(eMCLang_zhHK); + locales.push_back(eMCLang_zhTW); + break; + case XC_LOCALE_TAIWAN: + locales.push_back(eMCLang_zhTW); + locales.push_back(eMCLang_zhHK); + default: + break; + } + locales.push_back(eMCLang_hant); + locales.push_back(eMCLang_zhCHT); + break; + case XC_LANGUAGE_PORTUGUESE: + if (XGetLocale() == XC_LOCALE_BRAZIL) { + locales.push_back(eMCLang_ptBR); + } + locales.push_back(eMCLang_ptPT); + break; + case XC_LANGUAGE_POLISH: + locales.push_back(eMCLang_plPL); + break; + case XC_LANGUAGE_RUSSIAN: + locales.push_back(eMCLang_ruRU); + break; + case XC_LANGUAGE_SWEDISH: + locales.push_back(eMCLang_svSV); + locales.push_back(eMCLang_svSE); + break; + case XC_LANGUAGE_TURKISH: + locales.push_back(eMCLang_trTR); + break; + case XC_LANGUAGE_BNORWEGIAN: + locales.push_back(eMCLang_nbNO); + locales.push_back(eMCLang_noNO); + locales.push_back(eMCLang_nnNO); + break; + case XC_LANGUAGE_DUTCH: + switch (XGetLocale()) { + case XC_LOCALE_BELGIUM: + locales.push_back(eMCLang_nlBE); + break; + default: + break; + } + locales.push_back(eMCLang_nlNL); + break; + case XC_LANGUAGE_SCHINESE: + switch (XGetLocale()) { + case XC_LOCALE_SINGAPORE: + locales.push_back(eMCLang_zhSG); + break; + default: + break; + } + locales.push_back(eMCLang_hans); + locales.push_back(eMCLang_csCS); + locales.push_back(eMCLang_zhCN); + break; + } + + locales.push_back(eMCLang_enUS); + locales.push_back(eMCLang_null); + + for (int i = 0; i < locales.size(); i++) { + eMCLang lang = locales.at(i); + vecWstrLocales.push_back(m_localeA[lang]); + } +} + +int LocalizationManager::get_eMCLang(wchar_t* pwchLocale) { + return m_eMCLangA[pwchLocale]; +} + +int LocalizationManager::get_xcLang(wchar_t* pwchLocale) { + return m_xcLangA[pwchLocale]; +} + +void LocalizationManager::localeAndLanguageInit() { + m_localeA[eMCLang_zhCHT] = L"zh-CHT"; + m_localeA[eMCLang_csCS] = L"cs-CS"; + m_localeA[eMCLang_laLAS] = L"la-LAS"; + m_localeA[eMCLang_null] = L"en-EN"; + m_localeA[eMCLang_enUS] = L"en-US"; + m_localeA[eMCLang_enGB] = L"en-GB"; + m_localeA[eMCLang_enIE] = L"en-IE"; + m_localeA[eMCLang_enAU] = L"en-AU"; + m_localeA[eMCLang_enNZ] = L"en-NZ"; + m_localeA[eMCLang_enCA] = L"en-CA"; + m_localeA[eMCLang_jaJP] = L"ja-JP"; + m_localeA[eMCLang_deDE] = L"de-DE"; + m_localeA[eMCLang_deAT] = L"de-AT"; + m_localeA[eMCLang_frFR] = L"fr-FR"; + m_localeA[eMCLang_frCA] = L"fr-CA"; + m_localeA[eMCLang_esES] = L"es-ES"; + m_localeA[eMCLang_esMX] = L"es-MX"; + m_localeA[eMCLang_itIT] = L"it-IT"; + m_localeA[eMCLang_koKR] = L"ko-KR"; + m_localeA[eMCLang_ptPT] = L"pt-PT"; + m_localeA[eMCLang_ptBR] = L"pt-BR"; + m_localeA[eMCLang_ruRU] = L"ru-RU"; + m_localeA[eMCLang_nlNL] = L"nl-NL"; + m_localeA[eMCLang_fiFI] = L"fi-FI"; + m_localeA[eMCLang_svSV] = L"sv-SV"; + m_localeA[eMCLang_daDA] = L"da-DA"; + m_localeA[eMCLang_noNO] = L"no-NO"; + m_localeA[eMCLang_plPL] = L"pl-PL"; + m_localeA[eMCLang_trTR] = L"tr-TR"; + m_localeA[eMCLang_elEL] = L"el-EL"; + m_localeA[eMCLang_zhSG] = L"zh-SG"; + m_localeA[eMCLang_zhCN] = L"zh-CN"; + m_localeA[eMCLang_zhHK] = L"zh-HK"; + m_localeA[eMCLang_zhTW] = L"zh-TW"; + m_localeA[eMCLang_nlBE] = L"nl-BE"; + m_localeA[eMCLang_daDK] = L"da-DK"; + m_localeA[eMCLang_frBE] = L"fr-BE"; + m_localeA[eMCLang_frCH] = L"fr-CH"; + m_localeA[eMCLang_deCH] = L"de-CH"; + m_localeA[eMCLang_nbNO] = L"nb-NO"; + m_localeA[eMCLang_enGR] = L"en-GR"; + m_localeA[eMCLang_enHK] = L"en-HK"; + m_localeA[eMCLang_enSA] = L"en-SA"; + m_localeA[eMCLang_enHU] = L"en-HU"; + m_localeA[eMCLang_enIN] = L"en-IN"; + m_localeA[eMCLang_enIL] = L"en-IL"; + m_localeA[eMCLang_enSG] = L"en-SG"; + m_localeA[eMCLang_enSK] = L"en-SK"; + m_localeA[eMCLang_enZA] = L"en-ZA"; + m_localeA[eMCLang_enCZ] = L"en-CZ"; + m_localeA[eMCLang_enAE] = L"en-AE"; + m_localeA[eMCLang_esAR] = L"es-AR"; + m_localeA[eMCLang_esCL] = L"es-CL"; + m_localeA[eMCLang_esCO] = L"es-CO"; + m_localeA[eMCLang_esUS] = L"es-US"; + m_localeA[eMCLang_svSE] = L"sv-SE"; + m_localeA[eMCLang_csCZ] = L"cs-CZ"; + m_localeA[eMCLang_elGR] = L"el-GR"; + m_localeA[eMCLang_nnNO] = L"nn-NO"; + m_localeA[eMCLang_skSK] = L"sk-SK"; + m_localeA[eMCLang_hans] = L"zh-HANS"; + m_localeA[eMCLang_hant] = L"zh-HANT"; + + m_eMCLangA[L"zh-CHT"] = eMCLang_zhCHT; + m_eMCLangA[L"cs-CS"] = eMCLang_csCS; + m_eMCLangA[L"la-LAS"] = eMCLang_laLAS; + m_eMCLangA[L"en-EN"] = eMCLang_null; + m_eMCLangA[L"en-US"] = eMCLang_enUS; + m_eMCLangA[L"en-GB"] = eMCLang_enGB; + m_eMCLangA[L"en-IE"] = eMCLang_enIE; + m_eMCLangA[L"en-AU"] = eMCLang_enAU; + m_eMCLangA[L"en-NZ"] = eMCLang_enNZ; + m_eMCLangA[L"en-CA"] = eMCLang_enCA; + m_eMCLangA[L"ja-JP"] = eMCLang_jaJP; + m_eMCLangA[L"de-DE"] = eMCLang_deDE; + m_eMCLangA[L"de-AT"] = eMCLang_deAT; + m_eMCLangA[L"fr-FR"] = eMCLang_frFR; + m_eMCLangA[L"fr-CA"] = eMCLang_frCA; + m_eMCLangA[L"es-ES"] = eMCLang_esES; + m_eMCLangA[L"es-MX"] = eMCLang_esMX; + m_eMCLangA[L"it-IT"] = eMCLang_itIT; + m_eMCLangA[L"ko-KR"] = eMCLang_koKR; + m_eMCLangA[L"pt-PT"] = eMCLang_ptPT; + m_eMCLangA[L"pt-BR"] = eMCLang_ptBR; + m_eMCLangA[L"ru-RU"] = eMCLang_ruRU; + m_eMCLangA[L"nl-NL"] = eMCLang_nlNL; + m_eMCLangA[L"fi-FI"] = eMCLang_fiFI; + m_eMCLangA[L"sv-SV"] = eMCLang_svSV; + m_eMCLangA[L"da-DA"] = eMCLang_daDA; + m_eMCLangA[L"no-NO"] = eMCLang_noNO; + m_eMCLangA[L"pl-PL"] = eMCLang_plPL; + m_eMCLangA[L"tr-TR"] = eMCLang_trTR; + m_eMCLangA[L"el-EL"] = eMCLang_elEL; + m_eMCLangA[L"zh-SG"] = eMCLang_zhSG; + m_eMCLangA[L"zh-CN"] = eMCLang_zhCN; + m_eMCLangA[L"zh-HK"] = eMCLang_zhHK; + m_eMCLangA[L"zh-TW"] = eMCLang_zhTW; + m_eMCLangA[L"nl-BE"] = eMCLang_nlBE; + m_eMCLangA[L"da-DK"] = eMCLang_daDK; + m_eMCLangA[L"fr-BE"] = eMCLang_frBE; + m_eMCLangA[L"fr-CH"] = eMCLang_frCH; + m_eMCLangA[L"de-CH"] = eMCLang_deCH; + m_eMCLangA[L"nb-NO"] = eMCLang_nbNO; + m_eMCLangA[L"en-GR"] = eMCLang_enGR; + m_eMCLangA[L"en-HK"] = eMCLang_enHK; + m_eMCLangA[L"en-SA"] = eMCLang_enSA; + m_eMCLangA[L"en-HU"] = eMCLang_enHU; + m_eMCLangA[L"en-IN"] = eMCLang_enIN; + m_eMCLangA[L"en-IL"] = eMCLang_enIL; + m_eMCLangA[L"en-SG"] = eMCLang_enSG; + m_eMCLangA[L"en-SK"] = eMCLang_enSK; + m_eMCLangA[L"en-ZA"] = eMCLang_enZA; + m_eMCLangA[L"en-CZ"] = eMCLang_enCZ; + m_eMCLangA[L"en-AE"] = eMCLang_enAE; + m_eMCLangA[L"es-AR"] = eMCLang_esAR; + m_eMCLangA[L"es-CL"] = eMCLang_esCL; + m_eMCLangA[L"es-CO"] = eMCLang_esCO; + m_eMCLangA[L"es-US"] = eMCLang_esUS; + m_eMCLangA[L"sv-SE"] = eMCLang_svSE; + m_eMCLangA[L"cs-CZ"] = eMCLang_csCZ; + m_eMCLangA[L"el-GR"] = eMCLang_elGR; + m_eMCLangA[L"nn-NO"] = eMCLang_nnNO; + m_eMCLangA[L"sk-SK"] = eMCLang_skSK; + m_eMCLangA[L"zh-HANS"] = eMCLang_hans; + m_eMCLangA[L"zh-HANT"] = eMCLang_hant; + + m_xcLangA[L"zh-CHT"] = XC_LOCALE_CHINA; + m_xcLangA[L"cs-CS"] = XC_LOCALE_CHINA; + m_xcLangA[L"en-EN"] = XC_LOCALE_UNITED_STATES; + m_xcLangA[L"en-US"] = XC_LOCALE_UNITED_STATES; + m_xcLangA[L"en-GB"] = XC_LOCALE_GREAT_BRITAIN; + m_xcLangA[L"en-IE"] = XC_LOCALE_IRELAND; + m_xcLangA[L"en-AU"] = XC_LOCALE_AUSTRALIA; + m_xcLangA[L"en-NZ"] = XC_LOCALE_NEW_ZEALAND; + m_xcLangA[L"en-CA"] = XC_LOCALE_CANADA; + m_xcLangA[L"ja-JP"] = XC_LOCALE_JAPAN; + m_xcLangA[L"de-DE"] = XC_LOCALE_GERMANY; + m_xcLangA[L"de-AT"] = XC_LOCALE_AUSTRIA; + m_xcLangA[L"fr-FR"] = XC_LOCALE_FRANCE; + m_xcLangA[L"fr-CA"] = XC_LOCALE_CANADA; + m_xcLangA[L"es-ES"] = XC_LOCALE_SPAIN; + m_xcLangA[L"es-MX"] = XC_LOCALE_MEXICO; + m_xcLangA[L"it-IT"] = XC_LOCALE_ITALY; + m_xcLangA[L"ko-KR"] = XC_LOCALE_KOREA; + m_xcLangA[L"pt-PT"] = XC_LOCALE_PORTUGAL; + m_xcLangA[L"pt-BR"] = XC_LOCALE_BRAZIL; + m_xcLangA[L"ru-RU"] = XC_LOCALE_RUSSIAN_FEDERATION; + m_xcLangA[L"nl-NL"] = XC_LOCALE_NETHERLANDS; + m_xcLangA[L"fi-FI"] = XC_LOCALE_FINLAND; + m_xcLangA[L"sv-SV"] = XC_LOCALE_SWEDEN; + m_xcLangA[L"da-DA"] = XC_LOCALE_DENMARK; + m_xcLangA[L"no-NO"] = XC_LOCALE_NORWAY; + m_xcLangA[L"pl-PL"] = XC_LOCALE_POLAND; + m_xcLangA[L"tr-TR"] = XC_LOCALE_TURKEY; + m_xcLangA[L"el-EL"] = XC_LOCALE_GREECE; + m_xcLangA[L"la-LAS"] = XC_LOCALE_LATIN_AMERICA; + m_xcLangA[L"zh-SG"] = XC_LOCALE_SINGAPORE; + m_xcLangA[L"Zh-CN"] = XC_LOCALE_CHINA; + m_xcLangA[L"zh-HK"] = XC_LOCALE_HONG_KONG; + m_xcLangA[L"zh-TW"] = XC_LOCALE_TAIWAN; + m_xcLangA[L"nl-BE"] = XC_LOCALE_BELGIUM; + m_xcLangA[L"da-DK"] = XC_LOCALE_DENMARK; + m_xcLangA[L"fr-BE"] = XC_LOCALE_BELGIUM; + m_xcLangA[L"fr-CH"] = XC_LOCALE_SWITZERLAND; + m_xcLangA[L"de-CH"] = XC_LOCALE_SWITZERLAND; + m_xcLangA[L"nb-NO"] = XC_LOCALE_NORWAY; + m_xcLangA[L"en-GR"] = XC_LOCALE_GREECE; + m_xcLangA[L"en-HK"] = XC_LOCALE_HONG_KONG; + m_xcLangA[L"en-SA"] = XC_LOCALE_SAUDI_ARABIA; + m_xcLangA[L"en-HU"] = XC_LOCALE_HUNGARY; + m_xcLangA[L"en-IN"] = XC_LOCALE_INDIA; + m_xcLangA[L"en-IL"] = XC_LOCALE_ISRAEL; + m_xcLangA[L"en-SG"] = XC_LOCALE_SINGAPORE; + m_xcLangA[L"en-SK"] = XC_LOCALE_SLOVAK_REPUBLIC; + m_xcLangA[L"en-ZA"] = XC_LOCALE_SOUTH_AFRICA; + m_xcLangA[L"en-CZ"] = XC_LOCALE_CZECH_REPUBLIC; + m_xcLangA[L"en-AE"] = XC_LOCALE_UNITED_ARAB_EMIRATES; + m_xcLangA[L"ja-IP"] = XC_LOCALE_JAPAN; + m_xcLangA[L"es-AR"] = XC_LOCALE_ARGENTINA; + m_xcLangA[L"es-CL"] = XC_LOCALE_CHILE; + m_xcLangA[L"es-CO"] = XC_LOCALE_COLOMBIA; + m_xcLangA[L"es-US"] = XC_LOCALE_UNITED_STATES; + m_xcLangA[L"sv-SE"] = XC_LOCALE_SWEDEN; + m_xcLangA[L"cs-CZ"] = XC_LOCALE_CZECH_REPUBLIC; + m_xcLangA[L"el-GR"] = XC_LOCALE_GREECE; + m_xcLangA[L"sk-SK"] = XC_LOCALE_SLOVAK_REPUBLIC; + m_xcLangA[L"zh-HANS"] = XC_LOCALE_CHINA; + m_xcLangA[L"zh-HANT"] = XC_LOCALE_CHINA; +} diff --git a/targets/app/common/LocalizationManager.h b/targets/app/common/LocalizationManager.h new file mode 100644 index 000000000..ad98c8e4a --- /dev/null +++ b/targets/app/common/LocalizationManager.h @@ -0,0 +1,61 @@ +#pragma once + +#include +#include +#include +#include + +#include "minecraft/GameEnums.h" +#include "app/common/App_structs.h" +#include "platform/XboxStubs.h" + +class ArchiveFile; +class Random; +class StringTable; + +class LocalizationManager { +public: + LocalizationManager(); + + void localeAndLanguageInit(); + void loadStringTable(ArchiveFile* mediaArchive); + const wchar_t* getString(int iID) const; + + std::wstring formatHTMLString(int iPad, const std::wstring& desc, + int shadowColour = 0xFFFFFFFF); + std::wstring getActionReplacement(int iPad, unsigned char ucAction); + std::wstring getVKReplacement(unsigned int uiVKey); + std::wstring getIconReplacement(unsigned int uiIcon); + + int getHTMLColour(eMinecraftColour colour); + int getHTMLColor(eMinecraftColour colour) { return getHTMLColour(colour); } + int getHTMLFontSize(EHTMLFontSize size); + + void initialiseTips(); + int getNextTip(); + + void getLocale(std::vector& vecWstrLocales); + int get_eMCLang(wchar_t* pwchLocale); + int get_xcLang(wchar_t* pwchLocale); + + StringTable* getStringTable() const { return m_stringTable; } + +private: + static int s_iHTMLFontSizesA[eHTMLSize_COUNT]; + + StringTable* m_stringTable; + + std::unordered_map m_localeA; + std::unordered_map m_eMCLangA; + std::unordered_map m_xcLangA; + + static const int MAX_TIPS_GAMETIP = 50; + static const int MAX_TIPS_TRIVIATIP = 20; + static TIPSTRUCT m_GameTipA[MAX_TIPS_GAMETIP]; + static TIPSTRUCT m_TriviaTipA[MAX_TIPS_TRIVIATIP]; + static Random* TipRandom; + + int m_TipIDA[MAX_TIPS_GAMETIP + MAX_TIPS_TRIVIATIP]; + unsigned int m_uiCurrentTip; + static int TipsSortFunction(const void* a, const void* b); +}; diff --git a/targets/app/common/MenuController.cpp b/targets/app/common/MenuController.cpp new file mode 100644 index 000000000..4b8884e87 --- /dev/null +++ b/targets/app/common/MenuController.cpp @@ -0,0 +1,665 @@ +#include "app/common/MenuController.h" + +#include "app/common/Game.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/Scenes/UIScene_FullscreenProgress.h" +#include "app/linux/LinuxGame.h" +#include "app/linux/Linux_UIController.h" +#include "minecraft/client/Minecraft.h" +#include "minecraft/client/ProgressRenderer.h" +#include "minecraft/client/renderer/GameRenderer.h" +#include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" +#include "minecraft/server/MinecraftServer.h" +#include "minecraft/world/Container.h" +#include "minecraft/world/entity/item/MinecartHopper.h" +#include "minecraft/world/entity/player/Player.h" +#include "minecraft/world/item/crafting/Recipy.h" +#include "minecraft/world/level/tile/Tile.h" +#include "minecraft/world/level/tile/entity/HopperTileEntity.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" +#include "platform/sdl2/Profile.h" +#include "platform/sdl2/Storage.h" + +#include +#include +#include +#include + +unsigned char MenuController::m_szPNG[8] = {137, 80, 78, 71, 13, 10, 26, 10}; + +MenuController::MenuController() { + for (int i = 0; i < XUSER_MAX_COUNT; i++) { + m_eTMSAction[i] = eTMSAction_Idle; + m_eXuiAction[i] = eAppAction_Idle; + m_eXuiActionParam[i] = nullptr; + m_uiOpacityCountDown[i] = 0; + } + m_eGlobalXuiAction = eAppAction_Idle; + m_eGlobalXuiServerAction = eXuiServerAction_Idle; +} + +void MenuController::setAction(int iPad, eXuiAction action, void* param) { + if ((m_eXuiAction[iPad] == eAppAction_ReloadTexturePack) && + (action == eAppAction_EthernetDisconnected)) { + app.DebugPrintf( + "Invalid change of App action for pad %d from %d to %d, ignoring\n", + iPad, m_eXuiAction[iPad], action); + } else if ((m_eXuiAction[iPad] == eAppAction_ReloadTexturePack) && + (action == eAppAction_ExitWorld)) { + app.DebugPrintf( + "Invalid change of App action for pad %d from %d to %d, ignoring\n", + iPad, m_eXuiAction[iPad], action); + } else if (m_eXuiAction[iPad] == eAppAction_ExitWorldCapturedThumbnail && + action != eAppAction_Idle) { + app.DebugPrintf( + "Invalid change of App action for pad %d from %d to %d, ignoring\n", + iPad, m_eXuiAction[iPad], action); + } else { + app.DebugPrintf("Changing App action for pad %d from %d to %d\n", iPad, + m_eXuiAction[iPad], action); + m_eXuiAction[iPad] = action; + m_eXuiActionParam[iPad] = param; + } +} + +bool MenuController::loadInventoryMenu(int iPad, + std::shared_ptr player, + bool bNavigateBack) { + bool success = true; + + InventoryScreenInput* initData = new InventoryScreenInput(); + initData->player = player; + initData->bNavigateBack = bNavigateBack; + initData->iPad = iPad; + + if (app.GetLocalPlayerCount() > 1) { + initData->bSplitscreen = true; + success = ui.NavigateToScene(iPad, eUIScene_InventoryMenu, initData); + } else { + initData->bSplitscreen = false; + success = ui.NavigateToScene(iPad, eUIScene_InventoryMenu, initData); + } + + return success; +} + +bool MenuController::loadCreativeMenu(int iPad, + std::shared_ptr player, + bool bNavigateBack) { + bool success = true; + + InventoryScreenInput* initData = new InventoryScreenInput(); + initData->player = player; + initData->bNavigateBack = bNavigateBack; + initData->iPad = iPad; + + if (app.GetLocalPlayerCount() > 1) { + initData->bSplitscreen = true; + success = ui.NavigateToScene(iPad, eUIScene_CreativeMenu, initData); + } else { + initData->bSplitscreen = false; + success = ui.NavigateToScene(iPad, eUIScene_CreativeMenu, initData); + } + + return success; +} + +bool MenuController::loadCrafting2x2Menu(int iPad, + std::shared_ptr player) { + bool success = true; + + CraftingPanelScreenInput* initData = new CraftingPanelScreenInput(); + initData->player = player; + initData->iContainerType = RECIPE_TYPE_2x2; + initData->iPad = iPad; + initData->x = 0; + initData->y = 0; + initData->z = 0; + + if (app.GetLocalPlayerCount() > 1) { + initData->bSplitscreen = true; + success = ui.NavigateToScene(iPad, eUIScene_Crafting2x2Menu, initData); + } else { + initData->bSplitscreen = false; + success = ui.NavigateToScene(iPad, eUIScene_Crafting2x2Menu, initData); + } + + return success; +} + +bool MenuController::loadCrafting3x3Menu(int iPad, + std::shared_ptr player, + int x, int y, int z) { + bool success = true; + + CraftingPanelScreenInput* initData = new CraftingPanelScreenInput(); + initData->player = player; + initData->iContainerType = RECIPE_TYPE_3x3; + initData->iPad = iPad; + initData->x = x; + initData->y = y; + initData->z = z; + + if (app.GetLocalPlayerCount() > 1) { + initData->bSplitscreen = true; + success = ui.NavigateToScene(iPad, eUIScene_Crafting3x3Menu, initData); + } else { + initData->bSplitscreen = false; + success = ui.NavigateToScene(iPad, eUIScene_Crafting3x3Menu, initData); + } + + return success; +} + +bool MenuController::loadFireworksMenu(int iPad, + std::shared_ptr player, + int x, int y, int z) { + bool success = true; + + FireworksScreenInput* initData = new FireworksScreenInput(); + initData->player = player; + initData->iPad = iPad; + initData->x = x; + initData->y = y; + initData->z = z; + + if (app.GetLocalPlayerCount() > 1) { + initData->bSplitscreen = true; + success = ui.NavigateToScene(iPad, eUIScene_FireworksMenu, initData); + } else { + initData->bSplitscreen = false; + success = ui.NavigateToScene(iPad, eUIScene_FireworksMenu, initData); + } + + return success; +} + +bool MenuController::loadEnchantingMenu(int iPad, + std::shared_ptr inventory, + int x, int y, int z, Level* level, + const std::wstring& name) { + bool success = true; + + EnchantingScreenInput* initData = new EnchantingScreenInput(); + initData->inventory = inventory; + initData->level = level; + initData->x = x; + initData->y = y; + initData->z = z; + initData->iPad = iPad; + initData->name = name; + + if (app.GetLocalPlayerCount() > 1) { + initData->bSplitscreen = true; + success = ui.NavigateToScene(iPad, eUIScene_EnchantingMenu, initData); + } else { + initData->bSplitscreen = false; + success = ui.NavigateToScene(iPad, eUIScene_EnchantingMenu, initData); + } + + return success; +} + +bool MenuController::loadFurnaceMenu( + int iPad, std::shared_ptr inventory, + std::shared_ptr furnace) { + bool success = true; + + FurnaceScreenInput* initData = new FurnaceScreenInput(); + initData->furnace = furnace; + initData->inventory = inventory; + initData->iPad = iPad; + + if (app.GetLocalPlayerCount() > 1) { + initData->bSplitscreen = true; + success = ui.NavigateToScene(iPad, eUIScene_FurnaceMenu, initData); + } else { + initData->bSplitscreen = false; + success = ui.NavigateToScene(iPad, eUIScene_FurnaceMenu, initData); + } + + return success; +} + +bool MenuController::loadBrewingStandMenu( + int iPad, std::shared_ptr inventory, + std::shared_ptr brewingStand) { + bool success = true; + + BrewingScreenInput* initData = new BrewingScreenInput(); + initData->brewingStand = brewingStand; + initData->inventory = inventory; + initData->iPad = iPad; + + if (app.GetLocalPlayerCount() > 1) { + initData->bSplitscreen = true; + success = ui.NavigateToScene(iPad, eUIScene_BrewingStandMenu, initData); + } else { + initData->bSplitscreen = false; + success = ui.NavigateToScene(iPad, eUIScene_BrewingStandMenu, initData); + } + + return success; +} + +bool MenuController::loadContainerMenu(int iPad, + std::shared_ptr inventory, + std::shared_ptr container) { + bool success = true; + + ContainerScreenInput* initData = new ContainerScreenInput(); + initData->inventory = inventory; + initData->container = container; + initData->iPad = iPad; + + if (app.GetLocalPlayerCount() > 1) { + initData->bSplitscreen = true; + + bool bLargeChest = + (initData->container->getContainerSize() > 3 * 9) ? true : false; + if (bLargeChest) { + success = + ui.NavigateToScene(iPad, eUIScene_LargeContainerMenu, initData); + } else { + success = + ui.NavigateToScene(iPad, eUIScene_ContainerMenu, initData); + } + } else { + initData->bSplitscreen = false; + success = ui.NavigateToScene(iPad, eUIScene_ContainerMenu, initData); + } + + return success; +} + +bool MenuController::loadTrapMenu( + int iPad, std::shared_ptr inventory, + std::shared_ptr trap) { + bool success = true; + + TrapScreenInput* initData = new TrapScreenInput(); + initData->inventory = inventory; + initData->trap = trap; + initData->iPad = iPad; + + if (app.GetLocalPlayerCount() > 1) { + initData->bSplitscreen = true; + success = ui.NavigateToScene(iPad, eUIScene_DispenserMenu, initData); + } else { + initData->bSplitscreen = false; + success = ui.NavigateToScene(iPad, eUIScene_DispenserMenu, initData); + } + + return success; +} + +bool MenuController::loadSignEntryMenu( + int iPad, std::shared_ptr sign) { + bool success = true; + + SignEntryScreenInput* initData = new SignEntryScreenInput(); + initData->sign = sign; + initData->iPad = iPad; + + success = ui.NavigateToScene(iPad, eUIScene_SignEntryMenu, initData); + + delete initData; + + return success; +} + +bool MenuController::loadRepairingMenu(int iPad, + std::shared_ptr inventory, + Level* level, int x, int y, int z) { + bool success = true; + + AnvilScreenInput* initData = new AnvilScreenInput(); + initData->inventory = inventory; + initData->level = level; + initData->x = x; + initData->y = y; + initData->z = z; + initData->iPad = iPad; + if (app.GetLocalPlayerCount() > 1) + initData->bSplitscreen = true; + else + initData->bSplitscreen = false; + + success = ui.NavigateToScene(iPad, eUIScene_AnvilMenu, initData); + + return success; +} + +bool MenuController::loadTradingMenu(int iPad, + std::shared_ptr inventory, + std::shared_ptr trader, + Level* level, const std::wstring& name) { + bool success = true; + + TradingScreenInput* initData = new TradingScreenInput(); + initData->inventory = inventory; + initData->trader = trader; + initData->level = level; + initData->iPad = iPad; + if (app.GetLocalPlayerCount() > 1) + initData->bSplitscreen = true; + else + initData->bSplitscreen = false; + + success = ui.NavigateToScene(iPad, eUIScene_TradingMenu, initData); + + return success; +} + +bool MenuController::loadHopperMenu( + int iPad, std::shared_ptr inventory, + std::shared_ptr hopper) { + bool success = true; + + HopperScreenInput* initData = new HopperScreenInput(); + initData->inventory = inventory; + initData->hopper = hopper; + initData->iPad = iPad; + if (app.GetLocalPlayerCount() > 1) + initData->bSplitscreen = true; + else + initData->bSplitscreen = false; + + success = ui.NavigateToScene(iPad, eUIScene_HopperMenu, initData); + + return success; +} + +bool MenuController::loadHopperMenu( + int iPad, std::shared_ptr inventory, + std::shared_ptr hopper) { + bool success = true; + + HopperScreenInput* initData = new HopperScreenInput(); + initData->inventory = inventory; + initData->hopper = std::dynamic_pointer_cast(hopper); + initData->iPad = iPad; + if (app.GetLocalPlayerCount() > 1) + initData->bSplitscreen = true; + else + initData->bSplitscreen = false; + + success = ui.NavigateToScene(iPad, eUIScene_HopperMenu, initData); + + return success; +} + +bool MenuController::loadHorseMenu(int iPad, + std::shared_ptr inventory, + std::shared_ptr container, + std::shared_ptr horse) { + bool success = true; + + HorseScreenInput* initData = new HorseScreenInput(); + initData->inventory = inventory; + initData->container = container; + initData->horse = horse; + initData->iPad = iPad; + if (app.GetLocalPlayerCount() > 1) + initData->bSplitscreen = true; + else + initData->bSplitscreen = false; + + success = ui.NavigateToScene(iPad, eUIScene_HorseMenu, initData); + + return success; +} + +bool MenuController::loadBeaconMenu( + int iPad, std::shared_ptr inventory, + std::shared_ptr beacon) { + bool success = true; + + BeaconScreenInput* initData = new BeaconScreenInput(); + initData->inventory = inventory; + initData->beacon = beacon; + initData->iPad = iPad; + if (app.GetLocalPlayerCount() > 1) + initData->bSplitscreen = true; + else + initData->bSplitscreen = false; + + success = ui.NavigateToScene(iPad, eUIScene_BeaconMenu, initData); + + return success; +} + +int MenuController::texturePackDialogReturned( + void* pParam, int iPad, C4JStorage::EMessageResult result) { + return 0; +} + +int MenuController::unlockFullInviteReturned( + void* pParam, int iPad, C4JStorage::EMessageResult result) { + Minecraft* pMinecraft = Minecraft::GetInstance(); + bool bNoPlayer; + + if (pMinecraft->player == nullptr) { + bNoPlayer = true; + } + + return 0; +} + +int MenuController::unlockFullSaveReturned( + void* pParam, int iPad, C4JStorage::EMessageResult result) { + return 0; +} + +int MenuController::unlockFullExitReturned( + void* pParam, int iPad, C4JStorage::EMessageResult result) { + Game* pApp = (Game*)pParam; + Minecraft* pMinecraft = Minecraft::GetInstance(); + + if (result != C4JStorage::EMessage_ResultAccept) { + pApp->SetAction(pMinecraft->player->GetXboxPad(), + eAppAction_ExitWorldTrial); + } + + return 0; +} + +int MenuController::trialOverReturned(void* pParam, int iPad, + C4JStorage::EMessageResult result) { + Game* pApp = (Game*)pParam; + Minecraft* pMinecraft = Minecraft::GetInstance(); + + if (result != C4JStorage::EMessage_ResultAccept) { + pApp->SetAction(pMinecraft->player->GetXboxPad(), eAppAction_ExitTrial); + } + + return 0; +} + +int MenuController::remoteSaveThreadProc(void* lpParameter) { + Compression::UseDefaultThreadStorage(); + Tile::CreateNewThreadStorage(); + + Minecraft* pMinecraft = Minecraft::GetInstance(); + + pMinecraft->progressRenderer->progressStartNoAbort( + IDS_PROGRESS_HOST_SAVING); + pMinecraft->progressRenderer->progressStage(-1); + pMinecraft->progressRenderer->progressStagePercentage(0); + + while (!app.GetGameStarted() && + app.GetXuiAction(ProfileManager.GetPrimaryPad()) == + eAppAction_WaitRemoteServerSaveComplete) { + pMinecraft->tickAllConnections(); + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + } + + if (app.GetXuiAction(ProfileManager.GetPrimaryPad()) != + eAppAction_WaitRemoteServerSaveComplete) { + return ERROR_CANCELLED; + } + app.SetAction(ProfileManager.GetPrimaryPad(), eAppAction_Idle); + + ui.UpdatePlayerBasePositions(); + + Tile::ReleaseThreadStorage(); + + return 0; +} + +void MenuController::exitGameFromRemoteSave(void* lpParameter) { + int primaryPad = ProfileManager.GetPrimaryPad(); + + unsigned int uiIDA[3]; + uiIDA[0] = IDS_CONFIRM_CANCEL; + uiIDA[1] = IDS_CONFIRM_OK; + + ui.RequestAlertMessage( + IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME, uiIDA, 2, primaryPad, + &MenuController::exitGameFromRemoteSaveDialogReturned, nullptr); +} + +int MenuController::exitGameFromRemoteSaveDialogReturned( + void* pParam, int iPad, C4JStorage::EMessageResult result) { + if (result == C4JStorage::EMessage_ResultDecline) { + app.SetAction(iPad, eAppAction_ExitWorld); + } else { + UIScene_FullscreenProgress* pScene = + (UIScene_FullscreenProgress*)ui.FindScene( + eUIScene_FullscreenProgress); + if (pScene != nullptr) { + pScene->SetWasCancelled(false); + } + } + return 0; +} + +#define PNG_TAG_tEXt 0x74455874 + +unsigned int MenuController::fromBigEndian(unsigned int uiValue) { + unsigned int uiReturn = + ((uiValue >> 24) & 0x000000ff) | ((uiValue >> 8) & 0x0000ff00) | + ((uiValue << 8) & 0x00ff0000) | ((uiValue << 24) & 0xff000000); + return uiReturn; +} + +void MenuController::getImageTextData(std::uint8_t* imageData, + unsigned int imageBytes, + unsigned char* seedText, + unsigned int& uiHostOptions, + bool& bHostOptionsRead, + std::uint32_t& uiTexturePack) { + auto readPngUInt32 = [](const std::uint8_t* data) -> unsigned int { + unsigned int value = 0; + std::memcpy(&value, data, sizeof(value)); + return value; + }; + + std::uint8_t* ucPtr = imageData; + unsigned int uiCount = 0; + unsigned int uiChunkLen; + unsigned int uiChunkType; + unsigned int uiCRC; + char szKeyword[80]; + + for (int i = 0; i < 8; i++) { + if (m_szPNG[i] != ucPtr[i]) return; + } + + uiCount += 8; + + while (uiCount < imageBytes) { + uiChunkLen = fromBigEndian(readPngUInt32(&ucPtr[uiCount])); + uiCount += sizeof(int); + uiChunkType = fromBigEndian(readPngUInt32(&ucPtr[uiCount])); + uiCount += sizeof(int); + + if (uiChunkType == PNG_TAG_tEXt) { + unsigned char* pszKeyword = &ucPtr[uiCount]; + while (pszKeyword < ucPtr + uiCount + uiChunkLen) { + memset(szKeyword, 0, 80); + unsigned int uiKeywordC = 0; + while (*pszKeyword != 0) { + szKeyword[uiKeywordC++] = *pszKeyword; + pszKeyword++; + } + pszKeyword++; + if (strcmp(szKeyword, "4J_SEED") == 0) { + unsigned int uiValueC = 0; + while (*pszKeyword != 0 && + (pszKeyword < ucPtr + uiCount + uiChunkLen)) { + seedText[uiValueC++] = *pszKeyword; + pszKeyword++; + } + } else if (strcmp(szKeyword, "4J_HOSTOPTIONS") == 0) { + bHostOptionsRead = true; + unsigned int uiValueC = 0; + unsigned char pszHostOptions[9]; + memset(&pszHostOptions, 0, 9); + while (*pszKeyword != 0 && + (pszKeyword < ucPtr + uiCount + uiChunkLen) && + uiValueC < 8) { + pszHostOptions[uiValueC++] = *pszKeyword; + pszKeyword++; + } + + uiHostOptions = 0; + std::stringstream ss; + ss << pszHostOptions; + ss >> std::hex >> uiHostOptions; + } else if (strcmp(szKeyword, "4J_TEXTUREPACK") == 0) { + unsigned int uiValueC = 0; + unsigned char pszTexturePack[9]; + memset(&pszTexturePack, 0, 9); + while (*pszKeyword != 0 && + (pszKeyword < ucPtr + uiCount + uiChunkLen) && + uiValueC < 8) { + pszTexturePack[uiValueC++] = *pszKeyword; + pszKeyword++; + } + + std::stringstream ss; + ss << pszTexturePack; + ss >> std::hex >> uiTexturePack; + } + } + } + uiCount += uiChunkLen; + uiCRC = fromBigEndian(readPngUInt32(&ucPtr[uiCount])); + uiCount += sizeof(int); + } + + return; +} + +unsigned int MenuController::createImageTextData( + std::uint8_t* textMetadata, int64_t seed, bool hasSeed, + unsigned int uiHostOptions, unsigned int uiTexturePackId) { + int iTextMetadataBytes = 0; + if (hasSeed) { + strcpy((char*)textMetadata, "4J_SEED"); + snprintf((char*)&textMetadata[8], 42, "%lld", (long long)seed); + + iTextMetadataBytes += 8; + while (textMetadata[iTextMetadataBytes] != 0) iTextMetadataBytes++; + ++iTextMetadataBytes; + } + + strcpy((char*)&textMetadata[iTextMetadataBytes], "4J_HOSTOPTIONS"); + snprintf((char*)&textMetadata[iTextMetadataBytes + 15], 9, "%X", + uiHostOptions); + + iTextMetadataBytes += 15; + while (textMetadata[iTextMetadataBytes] != 0) iTextMetadataBytes++; + ++iTextMetadataBytes; + + strcpy((char*)&textMetadata[iTextMetadataBytes], "4J_TEXTUREPACK"); + snprintf((char*)&textMetadata[iTextMetadataBytes + 15], 9, "%X", + uiHostOptions); + + iTextMetadataBytes += 15; + while (textMetadata[iTextMetadataBytes] != 0) iTextMetadataBytes++; + + return iTextMetadataBytes; +} diff --git a/targets/app/common/MenuController.h b/targets/app/common/MenuController.h new file mode 100644 index 000000000..c373df31e --- /dev/null +++ b/targets/app/common/MenuController.h @@ -0,0 +1,151 @@ +#pragma once + +#include +#include +#include + +#include "app/common/App_structs.h" +#include "platform/sdl2/Storage.h" +#include "platform/XboxStubs.h" + +class Player; +class Inventory; +class Level; +class FurnaceTileEntity; +class Container; +class DispenserTileEntity; +class SignTileEntity; +class BrewingStandTileEntity; +class HopperTileEntity; +class MinecartHopper; +class EntityHorse; +class BeaconTileEntity; +class LocalPlayer; +class Merchant; +class CommandBlockEntity; + +class MenuController { +public: + MenuController(); + + // Load menu methods + bool loadInventoryMenu(int iPad, std::shared_ptr player, + bool bNavigateBack = false); + bool loadCreativeMenu(int iPad, std::shared_ptr player, + bool bNavigateBack = false); + bool loadEnchantingMenu(int iPad, std::shared_ptr inventory, + int x, int y, int z, Level* level, + const std::wstring& name); + bool loadFurnaceMenu(int iPad, std::shared_ptr inventory, + std::shared_ptr furnace); + bool loadBrewingStandMenu( + int iPad, std::shared_ptr inventory, + std::shared_ptr brewingStand); + bool loadContainerMenu(int iPad, std::shared_ptr inventory, + std::shared_ptr container); + bool loadTrapMenu(int iPad, std::shared_ptr inventory, + std::shared_ptr trap); + bool loadCrafting2x2Menu(int iPad, std::shared_ptr player); + bool loadCrafting3x3Menu(int iPad, std::shared_ptr player, + int x, int y, int z); + bool loadFireworksMenu(int iPad, std::shared_ptr player, + int x, int y, int z); + bool loadSignEntryMenu(int iPad, std::shared_ptr sign); + bool loadRepairingMenu(int iPad, std::shared_ptr inventory, + Level* level, int x, int y, int z); + bool loadTradingMenu(int iPad, std::shared_ptr inventory, + std::shared_ptr trader, Level* level, + const std::wstring& name); + bool loadHopperMenu(int iPad, std::shared_ptr inventory, + std::shared_ptr hopper); + bool loadHopperMenu(int iPad, std::shared_ptr inventory, + std::shared_ptr hopper); + bool loadHorseMenu(int iPad, std::shared_ptr inventory, + std::shared_ptr container, + std::shared_ptr horse); + bool loadBeaconMenu(int iPad, std::shared_ptr inventory, + std::shared_ptr beacon); + + // Action management + void setAction(int iPad, eXuiAction action, void* param = nullptr); + eXuiAction getXuiAction(int iPad) { return m_eXuiAction[iPad]; } + void setXuiServerAction(int iPad, eXuiServerAction action, + void* param = nullptr) { + m_eXuiServerAction[iPad] = action; + m_eXuiServerActionParam[iPad] = param; + } + eXuiServerAction getXuiServerAction(int iPad) { + return m_eXuiServerAction[iPad]; + } + void* getXuiServerActionParam(int iPad) { + return m_eXuiServerActionParam[iPad]; + } + eXuiAction getGlobalXuiAction() { return m_eGlobalXuiAction; } + void setGlobalXuiAction(eXuiAction action) { m_eGlobalXuiAction = action; } + eXuiServerAction getGlobalXuiServerAction() { + return m_eGlobalXuiServerAction; + } + void setGlobalXuiServerAction(eXuiServerAction action) { + m_eGlobalXuiServerAction = action; + } + + // TMS action + void setTMSAction(int iPad, eTMSAction action) { + m_eTMSAction[iPad] = action; + } + eTMSAction getTMSAction(int iPad) { return m_eTMSAction[iPad]; } + + // Dialog callbacks + static int texturePackDialogReturned(void* pParam, int iPad, + C4JStorage::EMessageResult result); + static int fatalErrorDialogReturned(void* pParam, int iPad, + C4JStorage::EMessageResult result); + static int trialOverReturned(void* pParam, int iPad, + C4JStorage::EMessageResult result); + static int unlockFullExitReturned(void* pParam, int iPad, + C4JStorage::EMessageResult result); + static int unlockFullSaveReturned(void* pParam, int iPad, + C4JStorage::EMessageResult result); + static int unlockFullInviteReturned(void* pParam, int iPad, + C4JStorage::EMessageResult result); + + // Remote save + static int remoteSaveThreadProc(void* lpParameter); + static void exitGameFromRemoteSave(void* lpParameter); + static int exitGameFromRemoteSaveDialogReturned( + void* pParam, int iPad, C4JStorage::EMessageResult result); + + // Image text data + void getImageTextData(std::uint8_t* imageData, unsigned int imageBytes, + unsigned char* seedText, unsigned int& uiHostOptions, + bool& bHostOptionsRead, std::uint32_t& uiTexturePack); + unsigned int createImageTextData(std::uint8_t* textMetadata, int64_t seed, + bool hasSeed, unsigned int uiHostOptions, + unsigned int uiTexturePackId); + + // Opacity timer + unsigned int getOpacityTimer(int iPad) { + return m_uiOpacityCountDown[iPad]; + } + void setOpacityTimer(int iPad) { m_uiOpacityCountDown[iPad] = 120; } + void tickOpacityTimer(int iPad) { + if (m_uiOpacityCountDown[iPad] > 0) m_uiOpacityCountDown[iPad]--; + } + + // Action param accessor (needed by HandleXuiActions) + void* getXuiActionParam(int iPad) { return m_eXuiActionParam[iPad]; } + +private: + eXuiAction m_eXuiAction[XUSER_MAX_COUNT]; + eTMSAction m_eTMSAction[XUSER_MAX_COUNT]; + void* m_eXuiActionParam[XUSER_MAX_COUNT]; + eXuiAction m_eGlobalXuiAction; + eXuiServerAction m_eXuiServerAction[XUSER_MAX_COUNT]; + void* m_eXuiServerActionParam[XUSER_MAX_COUNT]; + eXuiServerAction m_eGlobalXuiServerAction; + + unsigned int m_uiOpacityCountDown[XUSER_MAX_COUNT]; + + static unsigned char m_szPNG[8]; + unsigned int fromBigEndian(unsigned int uiValue); +}; diff --git a/targets/app/common/src/Network/GameNetworkManager.cpp b/targets/app/common/Network/GameNetworkManager.cpp similarity index 99% rename from targets/app/common/src/Network/GameNetworkManager.cpp rename to targets/app/common/Network/GameNetworkManager.cpp index d133f22f2..e7ad30899 100644 --- a/targets/app/common/src/Network/GameNetworkManager.cpp +++ b/targets/app/common/Network/GameNetworkManager.cpp @@ -13,20 +13,20 @@ #include "platform/sdl2/Profile.h" #include "platform/sdl2/Render.h" #include "platform/sdl2/Storage.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/Game.h" -#include "app/common/src/GameRules/GameRuleManager.h" -#include "app/common/src/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/common/src/Network/NetworkPlayerInterface.h" -#include "app/common/src/Network/PlatformNetworkManagerStub.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.h" +#include "app/common/GameRules/GameRuleManager.h" +#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "app/common/Network/NetworkPlayerInterface.h" +#include "app/common/Network/PlatformNetworkManagerStub.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "app/linux/Stubs/winapi_stubs.h" #include "Socket.h" -#include "XboxStubs.h" +#include "platform/XboxStubs.h" #include "util/StringHelpers.h" #include "platform/PlatformServices.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" diff --git a/targets/app/common/src/Network/GameNetworkManager.h b/targets/app/common/Network/GameNetworkManager.h similarity index 99% rename from targets/app/common/src/Network/GameNetworkManager.h rename to targets/app/common/Network/GameNetworkManager.h index 03df4262e..834487b71 100644 --- a/targets/app/common/src/Network/GameNetworkManager.h +++ b/targets/app/common/Network/GameNetworkManager.h @@ -9,7 +9,7 @@ #endif #include "platform/PlatformTypes.h" #include "platform/IPlatformNetwork.h" -#include "app/include/NetTypes.h" +#include "platform/NetTypes.h" #include "NetworkPlayerInterface.h" #include "PlatformNetworkManagerStub.h" #include "SessionInfo.h" diff --git a/targets/app/common/src/Network/NetworkPlayerInterface.h b/targets/app/common/Network/NetworkPlayerInterface.h similarity index 100% rename from targets/app/common/src/Network/NetworkPlayerInterface.h rename to targets/app/common/Network/NetworkPlayerInterface.h diff --git a/targets/app/common/src/Network/NetworkPlayerQNet.cpp b/targets/app/common/Network/NetworkPlayerQNet.cpp similarity index 99% rename from targets/app/common/src/Network/NetworkPlayerQNet.cpp rename to targets/app/common/Network/NetworkPlayerQNet.cpp index 6794dc586..a086f86fe 100644 --- a/targets/app/common/src/Network/NetworkPlayerQNet.cpp +++ b/targets/app/common/Network/NetworkPlayerQNet.cpp @@ -2,7 +2,7 @@ #include -#include "app/include/NetTypes.h" +#include "platform/NetTypes.h" #include "java/System.h" NetworkPlayerQNet::NetworkPlayerQNet(IQNetPlayer* qnetPlayer) { diff --git a/targets/app/common/src/Network/NetworkPlayerQNet.h b/targets/app/common/Network/NetworkPlayerQNet.h similarity index 100% rename from targets/app/common/src/Network/NetworkPlayerQNet.h rename to targets/app/common/Network/NetworkPlayerQNet.h diff --git a/targets/app/common/src/Network/PlatformNetworkManagerInterface.h b/targets/app/common/Network/PlatformNetworkManagerInterface.h similarity index 98% rename from targets/app/common/src/Network/PlatformNetworkManagerInterface.h rename to targets/app/common/Network/PlatformNetworkManagerInterface.h index 0fbed1620..83f792714 100644 --- a/targets/app/common/src/Network/PlatformNetworkManagerInterface.h +++ b/targets/app/common/Network/PlatformNetworkManagerInterface.h @@ -5,9 +5,8 @@ #if !defined(__linux__) #include #endif -#include "app/include/NetTypes.h" -#include "app/include/SkinBox.h" -#include "app/include/XboxStubs.h" +#include "platform/NetTypes.h" +#include "minecraft/client/model/SkinBox.h" #include "NetworkPlayerInterface.h" #include "SessionInfo.h" #include "platform/C4JThread.h" diff --git a/targets/app/common/src/Network/PlatformNetworkManagerStub.cpp b/targets/app/common/Network/PlatformNetworkManagerStub.cpp similarity index 99% rename from targets/app/common/src/Network/PlatformNetworkManagerStub.cpp rename to targets/app/common/Network/PlatformNetworkManagerStub.cpp index 17fb5443a..1c87f8347 100644 --- a/targets/app/common/src/Network/PlatformNetworkManagerStub.cpp +++ b/targets/app/common/Network/PlatformNetworkManagerStub.cpp @@ -5,11 +5,11 @@ #include -#include "app/common/src/Network/GameNetworkManager.h" -#include "app/common/src/Network/NetworkPlayerInterface.h" +#include "app/common/Network/GameNetworkManager.h" +#include "app/common/Network/NetworkPlayerInterface.h" #include "app/linux/LinuxGame.h" #include "app/linux/Stubs/winapi_stubs.h" -#include "app/include/NetTypes.h" +#include "platform/NetTypes.h" #include "NetworkPlayerQNet.h" #include "Socket.h" #include "platform/C4JThread.h" diff --git a/targets/app/common/src/Network/PlatformNetworkManagerStub.h b/targets/app/common/Network/PlatformNetworkManagerStub.h similarity index 98% rename from targets/app/common/src/Network/PlatformNetworkManagerStub.h rename to targets/app/common/Network/PlatformNetworkManagerStub.h index c9dac6743..572326b58 100644 --- a/targets/app/common/src/Network/PlatformNetworkManagerStub.h +++ b/targets/app/common/Network/PlatformNetworkManagerStub.h @@ -5,9 +5,9 @@ #include #include "platform/PlatformTypes.h" -#include "app/include/NetTypes.h" -#include "app/include/SkinBox.h" -#include "app/include/XboxStubs.h" +#include "platform/NetTypes.h" +#include "minecraft/client/model/SkinBox.h" +#include "platform/XboxStubs.h" #include "NetworkPlayerInterface.h" #include "platform/IPlatformNetwork.h" #include "SessionInfo.h" diff --git a/targets/app/src/XboxStubs.cpp b/targets/app/common/Network/QNetStubs.cpp similarity index 58% rename from targets/app/src/XboxStubs.cpp rename to targets/app/common/Network/QNetStubs.cpp index ad9d690dd..2149d630a 100644 --- a/targets/app/src/XboxStubs.cpp +++ b/targets/app/common/Network/QNetStubs.cpp @@ -1,26 +1,13 @@ - - -#include -#include -#include - +#include "platform/NetTypes.h" #include "platform/PlatformTypes.h" -#include "app/linux/Stubs/winapi_stubs.h" -#include "app/include/NetTypes.h" -#include "app/include/XboxStubs.h" -class INVITE_INFO; +IQNetPlayer IQNet::m_player[4]; -bool IsEqualXUID(PlayerUID a, PlayerUID b) { return false; } +static bool s_gameRunning = false; uint8_t IQNetPlayer::GetSmallId() { return 0; } void IQNetPlayer::SendData(IQNetPlayer* player, const void* pvData, - uint32_t dwDataSize, uint32_t dwFlags) { -#if !defined(__linux__) - app.DebugPrintf("Sending from 0x%x to 0x%x %d bytes\n", this, player, - dwDataSize); -#endif -} + uint32_t dwDataSize, uint32_t dwFlags) {} bool IQNetPlayer::IsSameSystem(IQNetPlayer* player) { return true; } uint32_t IQNetPlayer::GetSendQueueSize(IQNetPlayer* player, uint32_t dwFlags) { return 0; @@ -31,8 +18,8 @@ bool IQNetPlayer::IsGuest() { return false; } bool IQNetPlayer::IsLocal() { return true; } PlayerUID IQNetPlayer::GetXuid() { return INVALID_XUID; } const wchar_t* IQNetPlayer::GetGamertag() { - static const wchar_t* test = L"stub"; - return test; + static const wchar_t* name = L"stub"; + return name; } int IQNetPlayer::GetSessionIndex() { return 0; } bool IQNetPlayer::IsTalking() { return false; } @@ -45,10 +32,6 @@ void IQNetPlayer::SetCustomDataValue(uintptr_t ulpCustomDataValue) { } uintptr_t IQNetPlayer::GetCustomDataValue() { return m_customData; } -IQNetPlayer IQNet::m_player[4]; - -bool _bQNetStubGameRunning = false; - int32_t IQNet::AddLocalPlayerByUserIndex(uint32_t dwUserIndex) { return 0; } IQNetPlayer* IQNet::GetHostPlayer() { return &m_player[0]; } IQNetPlayer* IQNet::GetLocalPlayerByUserIndex(uint32_t dwUserIndex) { @@ -61,33 +44,12 @@ IQNetPlayer* IQNet::GetPlayerBySmallId(uint8_t SmallId) { return &m_player[0]; } IQNetPlayer* IQNet::GetPlayerByXuid(PlayerUID xuid) { return &m_player[0]; } uint32_t IQNet::GetPlayerCount() { return 1; } QNET_STATE IQNet::GetState() { - return _bQNetStubGameRunning ? QNET_STATE_GAME_PLAY : QNET_STATE_IDLE; + return s_gameRunning ? QNET_STATE_GAME_PLAY : QNET_STATE_IDLE; } bool IQNet::IsHost() { return true; } int32_t IQNet::JoinGameFromInviteInfo(uint32_t dwUserIndex, uint32_t dwUserMask, const INVITE_INFO* pInviteInfo) { return 0; } -void IQNet::HostGame() { _bQNetStubGameRunning = true; } -void IQNet::EndGame() { _bQNetStubGameRunning = false; } - -uint32_t XUserGetSigninInfo(uint32_t dwUserIndex, uint32_t dwFlags, - PXUSER_SIGNIN_INFO pSigninInfo) { - return 0; -} - -const wchar_t* CXuiStringTable::Lookup(const wchar_t* szId) { return szId; } -const wchar_t* CXuiStringTable::Lookup(uint32_t nIndex) { return L"String"; } -void CXuiStringTable::Clear() {} -int32_t CXuiStringTable::Load(const wchar_t* szId) { return 0; } - -uint32_t XUserAreUsersFriends(uint32_t dwUserIndex, PPlayerUID pXuids, - uint32_t dwXuidCount, bool* pfResult, - void* pOverlapped) { - return 0; -} - -// #if 1 -uint32_t XGetLanguage() { return 1; } -uint32_t XGetLocale() { return 0; } -uint32_t XEnableGuestSignin(bool fEnable) { return 0; } +void IQNet::HostGame() { s_gameRunning = true; } +void IQNet::EndGame() { s_gameRunning = false; } diff --git a/targets/app/common/src/Network/SessionInfo.h b/targets/app/common/Network/SessionInfo.h similarity index 96% rename from targets/app/common/src/Network/SessionInfo.h rename to targets/app/common/Network/SessionInfo.h index 471bb4409..bf8b7f1a6 100644 --- a/targets/app/common/src/Network/SessionInfo.h +++ b/targets/app/common/Network/SessionInfo.h @@ -1,6 +1,6 @@ #pragma once -#include "app/include/NetTypes.h" +#include "platform/NetTypes.h" // A struct that we store in the QoS data when we are hosting the session. Max // size 1020 bytes. diff --git a/targets/app/common/src/Network/Socket.cpp b/targets/app/common/Network/Socket.cpp similarity index 99% rename from targets/app/common/src/Network/Socket.cpp rename to targets/app/common/Network/Socket.cpp index befdd7478..7fc736b95 100644 --- a/targets/app/common/src/Network/Socket.cpp +++ b/targets/app/common/Network/Socket.cpp @@ -8,9 +8,9 @@ // 4jcraft TODO #include "platform/ShutdownManager.h" -#include "app/common/src/Network/GameNetworkManager.h" -#include "app/common/src/Network/NetworkPlayerInterface.h" -#include "app/include/NetTypes.h" +#include "app/common/Network/GameNetworkManager.h" +#include "app/common/Network/NetworkPlayerInterface.h" +#include "platform/NetTypes.h" #include "minecraft/server/network/ServerConnection.h" class SocketAddress {}; diff --git a/targets/app/common/src/Network/Socket.h b/targets/app/common/Network/Socket.h similarity index 98% rename from targets/app/common/src/Network/Socket.h rename to targets/app/common/Network/Socket.h index b862d5c77..e8d69ff85 100644 --- a/targets/app/common/src/Network/Socket.h +++ b/targets/app/common/Network/Socket.h @@ -10,8 +10,8 @@ #include #include -#include "app/common/src/Network/GameNetworkManager.h" -#include "app/common/src/Network/NetworkPlayerInterface.h" +#include "app/common/Network/GameNetworkManager.h" +#include "app/common/Network/NetworkPlayerInterface.h" #include "platform/C4JThread.h" #include "java/InputOutputStream/InputStream.h" #include "java/InputOutputStream/OutputStream.h" diff --git a/targets/app/common/NetworkController.cpp b/targets/app/common/NetworkController.cpp new file mode 100644 index 000000000..d66ff0057 --- /dev/null +++ b/targets/app/common/NetworkController.cpp @@ -0,0 +1,518 @@ +#include "app/common/NetworkController.h" + +#include "app/common/Game.h" +#include "app/common/Network/GameNetworkManager.h" +#include "app/linux/LinuxGame.h" +#include "app/linux/Linux_UIController.h" +#include "minecraft/client/Minecraft.h" +#include "minecraft/client/ProgressRenderer.h" +#include "minecraft/client/multiplayer/MultiPlayerLevel.h" +#include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" +#include "minecraft/client/renderer/GameRenderer.h" +#include "minecraft/client/skins/DLCTexturePack.h" +#include "minecraft/client/skins/TexturePack.h" +#include "minecraft/client/skins/TexturePackRepository.h" +#include "minecraft/server/MinecraftServer.h" +#include "minecraft/stats/StatsCounter.h" +#include "minecraft/world/entity/player/Player.h" +#include "minecraft/world/level/tile/Tile.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" +#include "platform/sdl2/Input.h" +#include "platform/sdl2/Profile.h" +#include "platform/sdl2/Storage.h" +#include "app/common/Audio/SoundEngine.h" + +#include +#include +#include + +unsigned int NetworkController::m_uiLastSignInData = 0; + +NetworkController::NetworkController() { + m_disconnectReason = DisconnectPacket::eDisconnect_None; + m_bLiveLinkRequired = false; + m_bChangingSessionType = false; + m_bReallyChangingSessionType = false; + + memset(&m_InviteData, 0, sizeof(JoinFromInviteData)); + memset(m_playerColours, 0, MINECRAFT_NET_MAX_PLAYERS); + memset(m_playerGamePrivileges, 0, sizeof(m_playerGamePrivileges)); + + for (int i = 0; i < XUSER_MAX_COUNT; i++) { + if (FAILED(XUserGetSigninInfo(i, + XUSER_GET_SIGNIN_INFO_OFFLINE_XUID_ONLY, + &m_currentSigninInfo[i]))) { + m_currentSigninInfo[i].xuid = INVALID_XUID; + m_currentSigninInfo[i].dwGuestNumber = 0; + } + } +} + +void NetworkController::updatePlayerInfo(std::uint8_t networkSmallId, + int16_t playerColourIndex, + unsigned int playerGamePrivileges) { + for (unsigned int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; ++i) { + if (m_playerColours[i] == networkSmallId) { + m_playerColours[i] = 0; + m_playerGamePrivileges[i] = 0; + } + } + if (playerColourIndex >= 0 && + playerColourIndex < MINECRAFT_NET_MAX_PLAYERS) { + m_playerColours[playerColourIndex] = networkSmallId; + m_playerGamePrivileges[playerColourIndex] = playerGamePrivileges; + } +} + +short NetworkController::getPlayerColour(std::uint8_t networkSmallId) { + short index = -1; + for (unsigned int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; ++i) { + if (m_playerColours[i] == networkSmallId) { + index = i; + break; + } + } + return index; +} + +unsigned int NetworkController::getPlayerPrivileges( + std::uint8_t networkSmallId) { + unsigned int privileges = 0; + for (unsigned int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; ++i) { + if (m_playerColours[i] == networkSmallId) { + privileges = m_playerGamePrivileges[i]; + break; + } + } + return privileges; +} + +void NetworkController::processInvite(std::uint32_t dwUserIndex, + std::uint32_t dwLocalUsersMask, + const INVITE_INFO* pInviteInfo) { + m_InviteData.dwUserIndex = dwUserIndex; + m_InviteData.dwLocalUsersMask = dwLocalUsersMask; + m_InviteData.pInviteInfo = pInviteInfo; + app.SetAction(dwUserIndex, eAppAction_ExitAndJoinFromInvite); +} + +int NetworkController::primaryPlayerSignedOutReturned( + void* pParam, int iPad, const C4JStorage::EMessageResult) { + if (g_NetworkManager.IsInSession()) { + app.SetAction(iPad, eAppAction_PrimaryPlayerSignedOutReturned); + } else { + app.SetAction(iPad, eAppAction_PrimaryPlayerSignedOutReturned_Menus); + } + return 0; +} + +int NetworkController::ethernetDisconnectReturned( + void* pParam, int iPad, const C4JStorage::EMessageResult) { + Minecraft* pMinecraft = Minecraft::GetInstance(); + + if (Minecraft::GetInstance()->player != nullptr) { + app.SetAction(pMinecraft->player->GetXboxPad(), + eAppAction_EthernetDisconnectedReturned); + } else { + app.SetAction(iPad, eAppAction_EthernetDisconnectedReturned_Menus); + } + return 0; +} + +void NetworkController::profileReadErrorCallback(void* pParam) { + Game* pApp = (Game*)pParam; + int iPrimaryPlayer = ProfileManager.GetPrimaryPad(); + pApp->SetAction(iPrimaryPlayer, eAppAction_ProfileReadError); +} + +int NetworkController::signoutExitWorldThreadProc(void* lpParameter) { + Compression::UseDefaultThreadStorage(); + + Minecraft* pMinecraft = Minecraft::GetInstance(); + + int exitReasonStringId = -1; + + bool saveStats = false; + if (pMinecraft->isClientSide() || g_NetworkManager.IsInSession()) { + if (lpParameter != nullptr) { + switch (app.GetDisconnectReason()) { + case DisconnectPacket::eDisconnect_Kicked: + exitReasonStringId = IDS_DISCONNECTED_KICKED; + break; + case DisconnectPacket::eDisconnect_NoUGC_AllLocal: + exitReasonStringId = + IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_ALL_LOCAL; + break; + case DisconnectPacket::eDisconnect_NoUGC_Single_Local: + exitReasonStringId = + IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_SINGLE_LOCAL; + break; + case DisconnectPacket::eDisconnect_NoFlying: + exitReasonStringId = IDS_DISCONNECTED_FLYING; + break; + case DisconnectPacket::eDisconnect_OutdatedServer: + exitReasonStringId = IDS_DISCONNECTED_SERVER_OLD; + break; + case DisconnectPacket::eDisconnect_OutdatedClient: + exitReasonStringId = IDS_DISCONNECTED_CLIENT_OLD; + break; + default: + exitReasonStringId = IDS_DISCONNECTED; + } + pMinecraft->progressRenderer->progressStartNoAbort( + exitReasonStringId); + if (pMinecraft->levels[0] != nullptr) + pMinecraft->levels[0]->disconnect(false); + if (pMinecraft->levels[1] != nullptr) + pMinecraft->levels[1]->disconnect(false); + } else { + exitReasonStringId = IDS_EXITING_GAME; + pMinecraft->progressRenderer->progressStartNoAbort( + IDS_EXITING_GAME); + + if (pMinecraft->levels[0] != nullptr) + pMinecraft->levels[0]->disconnect(); + if (pMinecraft->levels[1] != nullptr) + pMinecraft->levels[1]->disconnect(); + } + + MinecraftServer::HaltServer(true); + saveStats = false; + g_NetworkManager.LeaveGame(false); + } else { + if (lpParameter != nullptr) { + switch (app.GetDisconnectReason()) { + case DisconnectPacket::eDisconnect_Kicked: + exitReasonStringId = IDS_DISCONNECTED_KICKED; + break; + case DisconnectPacket::eDisconnect_NoUGC_AllLocal: + exitReasonStringId = + IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_ALL_LOCAL; + break; + case DisconnectPacket::eDisconnect_NoUGC_Single_Local: + exitReasonStringId = + IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_SINGLE_LOCAL; + break; + case DisconnectPacket::eDisconnect_OutdatedServer: + exitReasonStringId = IDS_DISCONNECTED_SERVER_OLD; + break; + case DisconnectPacket::eDisconnect_OutdatedClient: + exitReasonStringId = IDS_DISCONNECTED_CLIENT_OLD; + default: + exitReasonStringId = IDS_DISCONNECTED; + } + pMinecraft->progressRenderer->progressStartNoAbort( + exitReasonStringId); + } + } + pMinecraft->setLevel(nullptr, exitReasonStringId, nullptr, saveStats, true); + + app.m_gameRules.unloadCurrentGameRules(); + + MinecraftServer::resetFlags(); + + while (g_NetworkManager.IsInSession()) { + std::this_thread::sleep_for(std::chrono::milliseconds(1)); + } + + return 0; +} + +void NetworkController::clearSignInChangeUsersMask() { + int iPrimaryPlayer = ProfileManager.GetPrimaryPad(); + + if (m_uiLastSignInData != 0) { + if (iPrimaryPlayer >= 0) { + m_uiLastSignInData = 1 << iPrimaryPlayer; + } else { + m_uiLastSignInData = 0; + } + } +} + +void NetworkController::signInChangeCallback(void* pParam, + bool bPrimaryPlayerChanged, + unsigned int uiSignInData) { + Game* pApp = (Game*)pParam; + int iPrimaryPlayer = ProfileManager.GetPrimaryPad(); + + if ((ProfileManager.GetLockedProfile() != -1) && iPrimaryPlayer != -1) { + if (((uiSignInData & (1 << iPrimaryPlayer)) == 0) || + bPrimaryPlayerChanged) { + pApp->SetAction(iPrimaryPlayer, eAppAction_PrimaryPlayerSignedOut); + pApp->InvalidateBannedList(iPrimaryPlayer); + StorageManager.ClearDLCOffers(); + pApp->ClearAndResetDLCDownloadQueue(); + pApp->ClearDLCInstalled(); + } else { + unsigned int uiChangedPlayers = uiSignInData ^ m_uiLastSignInData; + + if (g_NetworkManager.IsInSession()) { + bool hasGuestIdChanged = false; + for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { + unsigned int guestNumber = 0; + if (ProfileManager.IsSignedIn(i)) { + XUSER_SIGNIN_INFO info; + XUserGetSigninInfo( + i, XUSER_GET_SIGNIN_INFO_OFFLINE_XUID_ONLY, &info); + pApp->DebugPrintf( + "Player at index %d has guest number %d\n", i, + info.dwGuestNumber); + guestNumber = info.dwGuestNumber; + } + if (pApp->m_networkController.m_currentSigninInfo[i] + .dwGuestNumber != 0 && + guestNumber != 0 && + pApp->m_networkController.m_currentSigninInfo[i] + .dwGuestNumber != guestNumber) { + hasGuestIdChanged = true; + } + } + + if (hasGuestIdChanged) { + unsigned int uiIDA[1]; + uiIDA[0] = IDS_CONFIRM_OK; + ui.RequestErrorMessage(IDS_GUEST_ORDER_CHANGED_TITLE, + IDS_GUEST_ORDER_CHANGED_TEXT, uiIDA, + 1, ProfileManager.GetPrimaryPad()); + } + + bool switchToOffline = false; + if (!ProfileManager.IsSignedInLive( + ProfileManager.GetLockedProfile()) && + !g_NetworkManager.IsLocalGame()) { + switchToOffline = true; + } + + for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { + if (i == iPrimaryPlayer) continue; + + if (hasGuestIdChanged && + pApp->m_networkController.m_currentSigninInfo[i] + .dwGuestNumber != 0 && + g_NetworkManager.GetLocalPlayerByUserIndex(i) != + nullptr) { + pApp->DebugPrintf( + "Recommending removal of player at index %d " + "because their guest id changed\n", + i); + pApp->SetAction(i, eAppAction_ExitPlayer); + } else { + XUSER_SIGNIN_INFO info; + XUserGetSigninInfo( + i, XUSER_GET_SIGNIN_INFO_OFFLINE_XUID_ONLY, &info); + + bool bPlayerChanged = + (uiChangedPlayers & (1 << i)) == (1 << i); + bool bPlayerSignedIn = ((uiSignInData & (1 << i)) != 0); + + if (bPlayerChanged && + (!bPlayerSignedIn || + (bPlayerSignedIn && + !ProfileManager.AreXUIDSEqual( + pApp->m_networkController + .m_currentSigninInfo[i] + .xuid, + info.xuid)))) { + pApp->DebugPrintf( + "Player at index %d Left - invalidating their " + "banned list\n", + i); + pApp->InvalidateBannedList(i); + + if (g_NetworkManager.GetLocalPlayerByUserIndex(i) != + nullptr || + Minecraft::GetInstance()->localplayers[i] != + nullptr) { + pApp->DebugPrintf("Player %d signed out\n", i); + pApp->SetAction(i, eAppAction_ExitPlayer); + } + } + } + } + + if (switchToOffline) { + pApp->SetAction(iPrimaryPlayer, + eAppAction_EthernetDisconnected); + } + + g_NetworkManager.HandleSignInChange(); + } else if (pApp->GetLiveLinkRequired() && + !ProfileManager.IsSignedInLive( + ProfileManager.GetLockedProfile())) { + { + pApp->SetAction(iPrimaryPlayer, + eAppAction_EthernetDisconnected); + } + } + } + m_uiLastSignInData = uiSignInData; + } else if (iPrimaryPlayer != -1) { + pApp->InvalidateBannedList(iPrimaryPlayer); + StorageManager.ClearDLCOffers(); + pApp->ClearAndResetDLCDownloadQueue(); + pApp->ClearDLCInstalled(); + } + + for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { + if (FAILED(XUserGetSigninInfo( + i, XUSER_GET_SIGNIN_INFO_OFFLINE_XUID_ONLY, + &pApp->m_networkController.m_currentSigninInfo[i]))) { + pApp->m_networkController.m_currentSigninInfo[i].xuid = + INVALID_XUID; + pApp->m_networkController.m_currentSigninInfo[i].dwGuestNumber = 0; + } + app.DebugPrintf( + "Player at index %d has guest number %d\n", i, + pApp->m_networkController.m_currentSigninInfo[i].dwGuestNumber); + } +} + +void NetworkController::notificationsCallback(void* pParam, + std::uint32_t dwNotification, + unsigned int uiParam) { + Game* pClass = (Game*)pParam; + + PNOTIFICATION pNotification = new NOTIFICATION; + pNotification->dwNotification = dwNotification; + pNotification->uiParam = uiParam; + + switch (dwNotification) { + case XN_SYS_SIGNINCHANGED: { + pClass->DebugPrintf("Signing changed - %d\n", uiParam); + } break; + case XN_SYS_INPUTDEVICESCHANGED: + if (app.GetGameStarted() && g_NetworkManager.IsInSession()) { + for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { + if (!InputManager.IsPadConnected(i) && + Minecraft::GetInstance()->localplayers[i] != nullptr && + !ui.IsPauseMenuDisplayed(i) && + !ui.IsSceneInStack(i, eUIScene_EndPoem)) { + ui.CloseUIScenes(i); + ui.NavigateToScene(i, eUIScene_PauseMenu); + } + } + } + break; + case XN_LIVE_CONTENT_INSTALLED: { + app.ClearDLCInstalled(); + ui.HandleDLCInstalled(ProfileManager.GetPrimaryPad()); + } break; + case XN_SYS_STORAGEDEVICESCHANGED: { + } break; + } + + pClass->m_networkController.m_vNotifications.push_back(pNotification); +} + +void NetworkController::liveLinkChangeCallback(void* pParam, bool bConnected) { + // Implementation is platform-specific, stub here +} + +int NetworkController::exitAndJoinFromInvite( + void* pParam, int iPad, C4JStorage::EMessageResult result) { + Game* pApp = (Game*)pParam; + + if (result == C4JStorage::EMessage_ResultDecline) { + pApp->SetAction(iPad, eAppAction_ExitAndJoinFromInviteConfirmed); + } + + return 0; +} + +int NetworkController::exitAndJoinFromInviteSaveDialogReturned( + void* pParam, int iPad, C4JStorage::EMessageResult result) { + Game* pClass = (Game*)pParam; + if (result == C4JStorage::EMessage_ResultDecline || + result == C4JStorage::EMessage_ResultThirdOption) { + if (result == C4JStorage::EMessage_ResultDecline) { + if (!Minecraft::GetInstance()->skins->isUsingDefaultSkin()) { + TexturePack* tPack = + Minecraft::GetInstance()->skins->getSelected(); + DLCPack* pDLCPack = tPack->getDLCPack(); + if (!pDLCPack->hasPurchasedFile(DLCManager::e_DLCType_Texture, + L"")) { + unsigned int uiIDA[2]; + uiIDA[0] = IDS_CONFIRM_OK; + uiIDA[1] = IDS_CONFIRM_CANCEL; + + ui.RequestErrorMessage( + IDS_WARNING_DLC_TRIALTEXTUREPACK_TITLE, + IDS_WARNING_DLC_TRIALTEXTUREPACK_TEXT, uiIDA, 2, iPad, + &NetworkController::warningTrialTexturePackReturned, + pClass); + + return 0; + } + } + bool bSaveExists; + StorageManager.DoesSaveExist(&bSaveExists); + if (bSaveExists) { + unsigned int uiIDA[2]; + uiIDA[0] = IDS_CONFIRM_CANCEL; + uiIDA[1] = IDS_CONFIRM_OK; + ui.RequestErrorMessage( + IDS_TITLE_SAVE_GAME, IDS_CONFIRM_SAVE_GAME, uiIDA, 2, + ProfileManager.GetPrimaryPad(), + &NetworkController::exitAndJoinFromInviteAndSaveReturned, + pClass); + return 0; + } else { + MinecraftServer::getInstance()->setSaveOnExit(true); + } + } else { + unsigned int uiIDA[2]; + uiIDA[0] = IDS_CONFIRM_CANCEL; + uiIDA[1] = IDS_CONFIRM_OK; + ui.RequestErrorMessage( + IDS_TITLE_DECLINE_SAVE_GAME, IDS_CONFIRM_DECLINE_SAVE_GAME, + uiIDA, 2, ProfileManager.GetPrimaryPad(), + &NetworkController::exitAndJoinFromInviteDeclineSaveReturned, + pClass); + return 0; + } + + app.SetAction(ProfileManager.GetPrimaryPad(), + eAppAction_ExitAndJoinFromInviteConfirmed); + } + return 0; +} + +int NetworkController::warningTrialTexturePackReturned( + void* pParam, int iPad, C4JStorage::EMessageResult result) { + return 0; +} + +int NetworkController::exitAndJoinFromInviteAndSaveReturned( + void* pParam, int iPad, C4JStorage::EMessageResult result) { + if (result == C4JStorage::EMessage_ResultDecline) { + if (!Minecraft::GetInstance()->skins->isUsingDefaultSkin()) { + TexturePack* tPack = Minecraft::GetInstance()->skins->getSelected(); + DLCPack* pDLCPack = tPack->getDLCPack(); + if (!pDLCPack->hasPurchasedFile(DLCManager::e_DLCType_Texture, + L"")) { + unsigned int uiIDA[2]; + uiIDA[0] = IDS_CONFIRM_OK; + uiIDA[1] = IDS_CONFIRM_CANCEL; + ui.RequestErrorMessage( + IDS_WARNING_DLC_TRIALTEXTUREPACK_TITLE, + IDS_WARNING_DLC_TRIALTEXTUREPACK_TEXT, uiIDA, 2, iPad, + &NetworkController::warningTrialTexturePackReturned, + nullptr); + return 0; + } + } + MinecraftServer::getInstance()->setSaveOnExit(true); + app.SetAction(iPad, eAppAction_ExitAndJoinFromInviteConfirmed); + } + return 0; +} + +int NetworkController::exitAndJoinFromInviteDeclineSaveReturned( + void* pParam, int iPad, C4JStorage::EMessageResult result) { + if (result == C4JStorage::EMessage_ResultDecline) { + MinecraftServer::getInstance()->setSaveOnExit(false); + app.SetAction(iPad, eAppAction_ExitAndJoinFromInviteConfirmed); + } + return 0; +} diff --git a/targets/app/common/NetworkController.h b/targets/app/common/NetworkController.h new file mode 100644 index 000000000..0c1a706c0 --- /dev/null +++ b/targets/app/common/NetworkController.h @@ -0,0 +1,106 @@ +#pragma once + +#include + +#include "app/common/App_structs.h" +#include "platform/NetTypes.h" +#include "platform/sdl2/Storage.h" +#include "platform/XboxStubs.h" +#include "minecraft/network/packet/DisconnectPacket.h" + +struct INVITE_INFO; + +typedef struct _JoinFromInviteData { + std::uint32_t dwUserIndex; + std::uint32_t dwLocalUsersMask; + const INVITE_INFO* pInviteInfo; +} JoinFromInviteData; + +class NetworkController { +public: + NetworkController(); + + // Player info + void updatePlayerInfo(std::uint8_t networkSmallId, + int16_t playerColourIndex, + unsigned int playerGamePrivileges); + short getPlayerColour(std::uint8_t networkSmallId); + unsigned int getPlayerPrivileges(std::uint8_t networkSmallId); + + // Sign-in change + static void signInChangeCallback(void* pParam, bool bVal, + unsigned int uiSignInData); + static void clearSignInChangeUsersMask(); + static int signoutExitWorldThreadProc(void* lpParameter); + static int primaryPlayerSignedOutReturned(void* pParam, int iPad, + const C4JStorage::EMessageResult); + static int ethernetDisconnectReturned(void* pParam, int iPad, + const C4JStorage::EMessageResult); + static void profileReadErrorCallback(void* pParam); + + // Notifications + static void notificationsCallback(void* pParam, + std::uint32_t dwNotification, + unsigned int uiParam); + + // Ethernet/Live link + static void liveLinkChangeCallback(void* pParam, bool bConnected); + + // Invites + void processInvite(std::uint32_t dwUserIndex, + std::uint32_t dwLocalUsersMask, + const INVITE_INFO* pInviteInfo); + static int exitAndJoinFromInvite(void* pParam, int iPad, + C4JStorage::EMessageResult result); + static int exitAndJoinFromInviteSaveDialogReturned( + void* pParam, int iPad, C4JStorage::EMessageResult result); + static int exitAndJoinFromInviteAndSaveReturned( + void* pParam, int iPad, C4JStorage::EMessageResult result); + static int exitAndJoinFromInviteDeclineSaveReturned( + void* pParam, int iPad, C4JStorage::EMessageResult result); + static int warningTrialTexturePackReturned( + void* pParam, int iPad, C4JStorage::EMessageResult result); + + // Disconnect + DisconnectPacket::eDisconnectReason getDisconnectReason() { + return m_disconnectReason; + } + void setDisconnectReason(DisconnectPacket::eDisconnectReason bVal) { + m_disconnectReason = bVal; + } + + // Session type flags + bool getChangingSessionType() { return m_bChangingSessionType; } + void setChangingSessionType(bool bVal) { m_bChangingSessionType = bVal; } + bool getReallyChangingSessionType() { return m_bReallyChangingSessionType; } + void setReallyChangingSessionType(bool bVal) { + m_bReallyChangingSessionType = bVal; + } + + // Live link + bool getLiveLinkRequired() { return m_bLiveLinkRequired; } + void setLiveLinkRequired(bool required) { m_bLiveLinkRequired = required; } + + // Sign-in info + XUSER_SIGNIN_INFO m_currentSigninInfo[XUSER_MAX_COUNT]; + + // Invite data + JoinFromInviteData m_InviteData; + + // Notifications + typedef std::vector VNOTIFICATIONS; + VNOTIFICATIONS m_vNotifications; + VNOTIFICATIONS* getNotifications() { return &m_vNotifications; } + + // Static sign-in data + static unsigned int m_uiLastSignInData; + +private: + std::uint8_t m_playerColours[MINECRAFT_NET_MAX_PLAYERS]; + unsigned int m_playerGamePrivileges[MINECRAFT_NET_MAX_PLAYERS]; + + DisconnectPacket::eDisconnectReason m_disconnectReason; + bool m_bChangingSessionType; + bool m_bReallyChangingSessionType; + bool m_bLiveLinkRequired; +}; diff --git a/targets/app/common/SaveManager.cpp b/targets/app/common/SaveManager.cpp new file mode 100644 index 000000000..cde5e2d64 --- /dev/null +++ b/targets/app/common/SaveManager.cpp @@ -0,0 +1,63 @@ +#include "app/linux/LinuxGame.h" +#include "app/common/SaveManager.h" + +#include + +#include "app/common/Game.h" +#include "app/common/Network/GameNetworkManager.h" +#include "minecraft/server/MinecraftServer.h" +#include "platform/sdl2/Profile.h" + +void SaveManager::setAutosaveTimerTime(int settingValue) { + m_uiAutosaveTimer = + time_util::clock::now() + + std::chrono::minutes(settingValue * 15); +} + +bool SaveManager::autosaveDue() const { + return (time_util::clock::now() > m_uiAutosaveTimer); +} + +int64_t SaveManager::secondsToAutosave() const { + return std::chrono::duration_cast( + m_uiAutosaveTimer - time_util::clock::now()) + .count(); +} + +void SaveManager::lock() { + std::lock_guard lock(m_saveNotificationMutex); + if (m_saveNotificationDepth++ == 0) { + if (g_NetworkManager + .IsInSession()) // this can be triggered from the front end if + // we're downloading a save + { + MinecraftServer::getInstance()->broadcastStartSavingPacket(); + + if (g_NetworkManager.IsLocalGame() && + g_NetworkManager.GetPlayerCount() == 1) { + app.SetXuiServerAction(ProfileManager.GetPrimaryPad(), + eXuiServerAction_PauseServer, + (void*)true); + } + } + } +} + +void SaveManager::unlock() { + std::lock_guard lock(m_saveNotificationMutex); + if (--m_saveNotificationDepth == 0) { + if (g_NetworkManager + .IsInSession()) // this can be triggered from the front end if + // we're downloading a save + { + MinecraftServer::getInstance()->broadcastStopSavingPacket(); + + if (g_NetworkManager.IsLocalGame() && + g_NetworkManager.GetPlayerCount() == 1) { + app.SetXuiServerAction(ProfileManager.GetPrimaryPad(), + eXuiServerAction_PauseServer, + (void*)false); + } + } + } +} diff --git a/targets/app/common/SaveManager.h b/targets/app/common/SaveManager.h new file mode 100644 index 000000000..a5159e8ce --- /dev/null +++ b/targets/app/common/SaveManager.h @@ -0,0 +1,23 @@ +#pragma once + +#include +#include + +#include "util/Timer.h" + +class SaveManager { +public: + SaveManager() : m_uiAutosaveTimer{}, m_saveNotificationDepth(0) {} + + void setAutosaveTimerTime(int settingValue); + bool autosaveDue() const; + int64_t secondsToAutosave() const; + + void lock(); + void unlock(); + +private: + time_util::time_point m_uiAutosaveTimer; + std::mutex m_saveNotificationMutex; + int m_saveNotificationDepth; +}; diff --git a/targets/app/common/SkinManager.cpp b/targets/app/common/SkinManager.cpp new file mode 100644 index 000000000..5030df7ec --- /dev/null +++ b/targets/app/common/SkinManager.cpp @@ -0,0 +1,451 @@ +#include "app/common/SkinManager.h" + +#include +#include +#include +#include + +#include "app/common/App_structs.h" +#include "app/common/DLC/DLCManager.h" +#include "app/common/DLC/DLCPack.h" +#include "app/common/DLC/DLCSkinFile.h" +#include "app/common/Minecraft_Macros.h" +#include "app/linux/LinuxGame.h" +#include "minecraft/client/Minecraft.h" +#include "minecraft/client/model/geom/Model.h" +#include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" +#include "minecraft/client/renderer/entity/EntityRenderer.h" +#include "minecraft/client/renderer/entity/EntityRenderDispatcher.h" +#include "minecraft/world/entity/player/Player.h" +#include "platform/sdl2/Profile.h" + +SkinManager::SkinManager() : m_xuidNotch(INVALID_XUID) { + for (int i = 0; i < XUSER_MAX_COUNT; i++) { + m_dwAdditionalModelParts[i] = 0; + } +} + +void SkinManager::setPlayerSkin(int iPad, const std::wstring& name, + GAME_SETTINGS** gameSettingsA) { + std::uint32_t skinId = getSkinIdFromPath(name); + setPlayerSkin(iPad, skinId, gameSettingsA); +} + +void SkinManager::setPlayerSkin(int iPad, std::uint32_t dwSkinId, + GAME_SETTINGS** gameSettingsA) { + app.DebugPrintf("Setting skin for %d to %08X\n", iPad, dwSkinId); + + gameSettingsA[iPad]->dwSelectedSkin = dwSkinId; + gameSettingsA[iPad]->bSettingsChanged = true; + + if (Minecraft::GetInstance()->localplayers[iPad] != nullptr) + Minecraft::GetInstance()->localplayers[iPad]->setAndBroadcastCustomSkin( + dwSkinId); +} + +std::wstring SkinManager::getPlayerSkinName(int iPad, + GAME_SETTINGS** gameSettingsA) { + return getSkinPathFromId(gameSettingsA[iPad]->dwSelectedSkin); +} + +std::uint32_t SkinManager::getPlayerSkinId(int iPad, + GAME_SETTINGS** gameSettingsA, + DLCManager& dlcManager) { + DLCPack* Pack = nullptr; + DLCSkinFile* skinFile = nullptr; + std::uint32_t dwSkin = gameSettingsA[iPad]->dwSelectedSkin; + wchar_t chars[256]; + + if (GET_IS_DLC_SKIN_FROM_BITMASK(dwSkin)) { + swprintf(chars, 256, L"dlcskin%08d.png", + GET_DLC_SKIN_ID_FROM_BITMASK(dwSkin)); + + Pack = dlcManager.getPackContainingSkin(chars); + + if (Pack) { + skinFile = Pack->getSkinFile(chars); + + bool bSkinIsFree = + skinFile->getParameterAsBool(DLCManager::e_DLCParamType_Free); + bool bLicensed = Pack->hasPurchasedFile(DLCManager::e_DLCType_Skin, + skinFile->getPath()); + + if (bSkinIsFree || bLicensed) { + return dwSkin; + } else { + return 0; + } + } + } + + return dwSkin; +} + +std::uint32_t SkinManager::getAdditionalModelParts(int iPad) { + return m_dwAdditionalModelParts[iPad]; +} + +void SkinManager::setPlayerCape(int iPad, const std::wstring& name, + GAME_SETTINGS** gameSettingsA) { + std::uint32_t capeId = Player::getCapeIdFromPath(name); + setPlayerCape(iPad, capeId, gameSettingsA); +} + +void SkinManager::setPlayerCape(int iPad, std::uint32_t dwCapeId, + GAME_SETTINGS** gameSettingsA) { + app.DebugPrintf("Setting cape for %d to %08X\n", iPad, dwCapeId); + + gameSettingsA[iPad]->dwSelectedCape = dwCapeId; + gameSettingsA[iPad]->bSettingsChanged = true; + + if (Minecraft::GetInstance()->localplayers[iPad] != nullptr) + Minecraft::GetInstance()->localplayers[iPad]->setAndBroadcastCustomCape( + dwCapeId); +} + +std::wstring SkinManager::getPlayerCapeName(int iPad, + GAME_SETTINGS** gameSettingsA) { + return Player::getCapePathFromId(gameSettingsA[iPad]->dwSelectedCape); +} + +std::uint32_t SkinManager::getPlayerCapeId(int iPad, + GAME_SETTINGS** gameSettingsA) { + return gameSettingsA[iPad]->dwSelectedCape; +} + +void SkinManager::setPlayerFavoriteSkin(int iPad, int iIndex, + unsigned int uiSkinID, + GAME_SETTINGS** gameSettingsA) { + app.DebugPrintf("Setting favorite skin for %d to %08X\n", iPad, uiSkinID); + + gameSettingsA[iPad]->uiFavoriteSkinA[iIndex] = uiSkinID; + gameSettingsA[iPad]->bSettingsChanged = true; +} + +unsigned int SkinManager::getPlayerFavoriteSkin( + int iPad, int iIndex, GAME_SETTINGS** gameSettingsA) { + return gameSettingsA[iPad]->uiFavoriteSkinA[iIndex]; +} + +unsigned char SkinManager::getPlayerFavoriteSkinsPos( + int iPad, GAME_SETTINGS** gameSettingsA) { + return gameSettingsA[iPad]->ucCurrentFavoriteSkinPos; +} + +void SkinManager::setPlayerFavoriteSkinsPos(int iPad, int iPos, + GAME_SETTINGS** gameSettingsA) { + gameSettingsA[iPad]->ucCurrentFavoriteSkinPos = (unsigned char)iPos; + gameSettingsA[iPad]->bSettingsChanged = true; +} + +unsigned int SkinManager::getPlayerFavoriteSkinsCount( + int iPad, GAME_SETTINGS** gameSettingsA) { + unsigned int uiCount = 0; + for (int i = 0; i < MAX_FAVORITE_SKINS; i++) { + if (gameSettingsA[iPad]->uiFavoriteSkinA[i] != 0xFFFFFFFF) { + uiCount++; + } else { + break; + } + } + return uiCount; +} + +void SkinManager::validateFavoriteSkins(int iPad, + GAME_SETTINGS** gameSettingsA, + DLCManager& dlcManager) { + unsigned int uiCount = getPlayerFavoriteSkinsCount(iPad, gameSettingsA); + + unsigned int uiValidSkin = 0; + wchar_t chars[256]; + + for (unsigned int i = 0; i < uiCount; i++) { + swprintf(chars, 256, L"dlcskin%08d.png", + getPlayerFavoriteSkin(iPad, i, gameSettingsA)); + + DLCPack* pDLCPack = dlcManager.getPackContainingSkin(chars); + + if (pDLCPack != nullptr) { + DLCSkinFile* pSkinFile = pDLCPack->getSkinFile(chars); + + if (pDLCPack->hasPurchasedFile(DLCManager::e_DLCType_Skin, L"") || + (pSkinFile && pSkinFile->isFree())) { + gameSettingsA[iPad]->uiFavoriteSkinA[uiValidSkin++] = + gameSettingsA[iPad]->uiFavoriteSkinA[i]; + } + } + } + + for (unsigned int i = uiValidSkin; i < MAX_FAVORITE_SKINS; i++) { + gameSettingsA[iPad]->uiFavoriteSkinA[i] = 0xFFFFFFFF; + } +} + +bool SkinManager::isXuidNotch(PlayerUID xuid) { + if (m_xuidNotch != INVALID_XUID && xuid != INVALID_XUID) { + return ProfileManager.AreXUIDSEqual(xuid, m_xuidNotch); + } + return false; +} + +bool SkinManager::isXuidDeadmau5(PlayerUID xuid) { + // Delegates back to static MojangData on Game - this is a simple forwarding + // wrapper for now; the actual MojangData map stays on Game. + return app.isXuidDeadmau5(xuid); +} + +void SkinManager::addMemoryTextureFile(const std::wstring& wName, + std::uint8_t* pbData, + unsigned int byteCount) { + std::lock_guard lock(csMemFilesLock); + PMEMDATA pData = nullptr; + auto it = m_MEM_Files.find(wName); + if (it != m_MEM_Files.end()) { +#if !defined(_CONTENT_PACKAGE) + wprintf(L"Incrementing the memory texture file count for %ls\n", + wName.c_str()); +#endif + pData = (*it).second; + + if (pData->byteCount == 0 && byteCount != 0) { + if (pData->pbData != nullptr) delete[] pData->pbData; + + pData->pbData = pbData; + pData->byteCount = byteCount; + } + + ++pData->ucRefCount; + return; + } + + pData = new MEMDATA(); + pData->pbData = pbData; + pData->byteCount = byteCount; + pData->ucRefCount = 1; + + m_MEM_Files[wName] = pData; +} + +void SkinManager::removeMemoryTextureFile(const std::wstring& wName) { + std::lock_guard lock(csMemFilesLock); + + auto it = m_MEM_Files.find(wName); + if (it != m_MEM_Files.end()) { +#if !defined(_CONTENT_PACKAGE) + wprintf(L"Decrementing the memory texture file count for %ls\n", + wName.c_str()); +#endif + PMEMDATA pData = (*it).second; + --pData->ucRefCount; + if (pData->ucRefCount <= 0) { +#if !defined(_CONTENT_PACKAGE) + wprintf(L"Erasing the memory texture file data for %ls\n", + wName.c_str()); +#endif + delete pData; + m_MEM_Files.erase(wName); + } + } +} + +bool SkinManager::defaultCapeExists() { + std::wstring wTex = L"Special_Cape.png"; + bool val = false; + + { + std::lock_guard lock(csMemFilesLock); + auto it = m_MEM_Files.find(wTex); + if (it != m_MEM_Files.end()) val = true; + } + + return val; +} + +bool SkinManager::isFileInMemoryTextures(const std::wstring& wName) { + bool val = false; + + { + std::lock_guard lock(csMemFilesLock); + auto it = m_MEM_Files.find(wName); + if (it != m_MEM_Files.end()) val = true; + } + + return val; +} + +void SkinManager::getMemFileDetails(const std::wstring& wName, + std::uint8_t** ppbData, + unsigned int* pByteCount) { + std::lock_guard lock(csMemFilesLock); + auto it = m_MEM_Files.find(wName); + if (it != m_MEM_Files.end()) { + PMEMDATA pData = (*it).second; + *ppbData = pData->pbData; + *pByteCount = pData->byteCount; + } +} + +void SkinManager::setAdditionalSkinBoxes(std::uint32_t dwSkinID, + SKIN_BOX* SkinBoxA, + unsigned int dwSkinBoxC) { + EntityRenderer* renderer = + EntityRenderDispatcher::instance->getRenderer(eTYPE_PLAYER); + Model* pModel = renderer->getModel(); + std::vector* pvModelPart = new std::vector; + std::vector* pvSkinBoxes = new std::vector; + + { + std::lock_guard lock_mp(csAdditionalModelParts); + std::lock_guard lock_sb(csAdditionalSkinBoxes); + + app.DebugPrintf( + "*** SetAdditionalSkinBoxes - Inserting model parts for skin %d " + "from " + "array of Skin Boxes\n", + dwSkinID & 0x0FFFFFFF); + + for (unsigned int i = 0; i < dwSkinBoxC; i++) { + if (pModel) { + ModelPart* pModelPart = pModel->AddOrRetrievePart(&SkinBoxA[i]); + pvModelPart->push_back(pModelPart); + pvSkinBoxes->push_back(&SkinBoxA[i]); + } + } + + m_AdditionalModelParts.insert( + std::pair*>(dwSkinID, + pvModelPart)); + m_AdditionalSkinBoxes.insert( + std::pair*>(dwSkinID, + pvSkinBoxes)); + } +} + +std::vector* SkinManager::setAdditionalSkinBoxes( + std::uint32_t dwSkinID, std::vector* pvSkinBoxA) { + EntityRenderer* renderer = + EntityRenderDispatcher::instance->getRenderer(eTYPE_PLAYER); + Model* pModel = renderer->getModel(); + std::vector* pvModelPart = new std::vector; + + { + std::lock_guard lock_mp(csAdditionalModelParts); + std::lock_guard lock_sb(csAdditionalSkinBoxes); + app.DebugPrintf( + "*** SetAdditionalSkinBoxes - Inserting model parts for skin %d " + "from " + "array of Skin Boxes\n", + dwSkinID & 0x0FFFFFFF); + + for (auto it = pvSkinBoxA->begin(); it != pvSkinBoxA->end(); ++it) { + if (pModel) { + ModelPart* pModelPart = pModel->AddOrRetrievePart(*it); + pvModelPart->push_back(pModelPart); + } + } + + m_AdditionalModelParts.insert( + std::pair*>(dwSkinID, + pvModelPart)); + m_AdditionalSkinBoxes.insert( + std::pair*>(dwSkinID, + pvSkinBoxA)); + } + return pvModelPart; +} + +std::vector* SkinManager::getAdditionalModelParts( + std::uint32_t dwSkinID) { + std::lock_guard lock(csAdditionalModelParts); + std::vector* pvModelParts = nullptr; + if (m_AdditionalModelParts.size() > 0) { + auto it = m_AdditionalModelParts.find(dwSkinID); + if (it != m_AdditionalModelParts.end()) { + pvModelParts = (*it).second; + } + } + + return pvModelParts; +} + +std::vector* SkinManager::getAdditionalSkinBoxes( + std::uint32_t dwSkinID) { + std::lock_guard lock(csAdditionalSkinBoxes); + std::vector* pvSkinBoxes = nullptr; + if (m_AdditionalSkinBoxes.size() > 0) { + auto it = m_AdditionalSkinBoxes.find(dwSkinID); + if (it != m_AdditionalSkinBoxes.end()) { + pvSkinBoxes = (*it).second; + } + } + + return pvSkinBoxes; +} + +unsigned int SkinManager::getAnimOverrideBitmask(std::uint32_t dwSkinID) { + std::lock_guard lock(csAnimOverrideBitmask); + unsigned int uiAnimOverrideBitmask = 0L; + + if (m_AnimOverrides.size() > 0) { + auto it = m_AnimOverrides.find(dwSkinID); + if (it != m_AnimOverrides.end()) { + uiAnimOverrideBitmask = (*it).second; + } + } + + return uiAnimOverrideBitmask; +} + +void SkinManager::setAnimOverrideBitmask(std::uint32_t dwSkinID, + unsigned int uiAnimOverrideBitmask) { + std::lock_guard lock(csAnimOverrideBitmask); + + if (m_AnimOverrides.size() > 0) { + auto it = m_AnimOverrides.find(dwSkinID); + if (it != m_AnimOverrides.end()) { + return; // already in here + } + } + m_AnimOverrides.insert(std::pair( + dwSkinID, uiAnimOverrideBitmask)); +} + +std::uint32_t SkinManager::getSkinIdFromPath(const std::wstring& skin) { + bool dlcSkin = false; + unsigned int skinId = 0; + + if (skin.size() >= 14) { + dlcSkin = skin.substr(0, 3).compare(L"dlc") == 0; + + std::wstring skinValue = skin.substr(7, skin.size()); + skinValue = skinValue.substr(0, skinValue.find_first_of(L'.')); + + std::wstringstream ss; + if (dlcSkin) + ss << std::dec << skinValue.c_str(); + else + ss << std::hex << skinValue.c_str(); + ss >> skinId; + + skinId = MAKE_SKIN_BITMASK(dlcSkin, skinId); + } + return skinId; +} + +std::wstring SkinManager::getSkinPathFromId(std::uint32_t skinId) { + wchar_t chars[256]; + if (GET_IS_DLC_SKIN_FROM_BITMASK(skinId)) { + swprintf(chars, 256, L"dlcskin%08d.png", + GET_DLC_SKIN_ID_FROM_BITMASK(skinId)); + } else { + std::uint32_t ugcSkinIndex = GET_UGC_SKIN_ID_FROM_BITMASK(skinId); + std::uint32_t defaultSkinIndex = + GET_DEFAULT_SKIN_ID_FROM_BITMASK(skinId); + if (ugcSkinIndex == 0) { + swprintf(chars, 256, L"defskin%08X.png", defaultSkinIndex); + } else { + swprintf(chars, 256, L"ugcskin%08X.png", ugcSkinIndex); + } + } + return chars; +} diff --git a/targets/app/common/SkinManager.h b/targets/app/common/SkinManager.h new file mode 100644 index 000000000..eb92265cf --- /dev/null +++ b/targets/app/common/SkinManager.h @@ -0,0 +1,108 @@ +#pragma once + +#include +#include +#include +#include +#include + +#include "app/common/App_structs.h" +#include "minecraft/client/model/SkinBox.h" +#include "platform/XboxStubs.h" + +class ModelPart; +class DLCManager; + +class SkinManager { +public: + SkinManager(); + + // Skin get/set (require GameSettingsA pointer from Game) + void setPlayerSkin(int iPad, const std::wstring& name, + GAME_SETTINGS** gameSettingsA); + void setPlayerSkin(int iPad, std::uint32_t dwSkinId, + GAME_SETTINGS** gameSettingsA); + std::wstring getPlayerSkinName(int iPad, GAME_SETTINGS** gameSettingsA); + std::uint32_t getPlayerSkinId(int iPad, GAME_SETTINGS** gameSettingsA, + DLCManager& dlcManager); + + // Cape get/set + void setPlayerCape(int iPad, const std::wstring& name, + GAME_SETTINGS** gameSettingsA); + void setPlayerCape(int iPad, std::uint32_t dwCapeId, + GAME_SETTINGS** gameSettingsA); + std::wstring getPlayerCapeName(int iPad, GAME_SETTINGS** gameSettingsA); + std::uint32_t getPlayerCapeId(int iPad, GAME_SETTINGS** gameSettingsA); + + // Favorite skins + void setPlayerFavoriteSkin(int iPad, int iIndex, unsigned int uiSkinID, + GAME_SETTINGS** gameSettingsA); + unsigned int getPlayerFavoriteSkin(int iPad, int iIndex, + GAME_SETTINGS** gameSettingsA); + unsigned char getPlayerFavoriteSkinsPos(int iPad, + GAME_SETTINGS** gameSettingsA); + void setPlayerFavoriteSkinsPos(int iPad, int iPos, + GAME_SETTINGS** gameSettingsA); + unsigned int getPlayerFavoriteSkinsCount(int iPad, + GAME_SETTINGS** gameSettingsA); + void validateFavoriteSkins(int iPad, GAME_SETTINGS** gameSettingsA, + DLCManager& dlcManager); + + // Additional model parts per player + std::uint32_t getAdditionalModelParts(int iPad); + + // Additional model parts per skin texture + void setAdditionalSkinBoxes(std::uint32_t dwSkinID, SKIN_BOX* SkinBoxA, + unsigned int dwSkinBoxC); + std::vector* setAdditionalSkinBoxes( + std::uint32_t dwSkinID, std::vector* pvSkinBoxA); + std::vector* getAdditionalModelParts(std::uint32_t dwSkinID); + std::vector* getAdditionalSkinBoxes(std::uint32_t dwSkinID); + + // Anim overrides + void setAnimOverrideBitmask(std::uint32_t dwSkinID, + unsigned int uiAnimOverrideBitmask); + unsigned int getAnimOverrideBitmask(std::uint32_t dwSkinID); + + // Skin path <-> id conversion (static) + static std::uint32_t getSkinIdFromPath(const std::wstring& skin); + static std::wstring getSkinPathFromId(std::uint32_t skinId); + + // Default cape + bool defaultCapeExists(); + + // Notch/Deadmau5 xuid checks + bool isXuidNotch(PlayerUID xuid); + bool isXuidDeadmau5(PlayerUID xuid); + + // Memory texture files for player skins + void addMemoryTextureFile(const std::wstring& wName, std::uint8_t* pbData, + unsigned int byteCount); + void removeMemoryTextureFile(const std::wstring& wName); + void getMemFileDetails(const std::wstring& wName, std::uint8_t** ppbData, + unsigned int* pByteCount); + bool isFileInMemoryTextures(const std::wstring& wName); + + // storing skin files + std::vector vSkinNames; + + // per-player additional model parts + std::uint32_t m_dwAdditionalModelParts[XUSER_MAX_COUNT]; + +private: + PlayerUID m_xuidNotch; + + // Memory texture files + std::unordered_map m_MEM_Files; + std::mutex csMemFilesLock; + + // Additional model parts/skin boxes per skin id + std::unordered_map*> + m_AdditionalModelParts; + std::unordered_map*> + m_AdditionalSkinBoxes; + std::unordered_map m_AnimOverrides; + std::mutex csAdditionalModelParts; + std::mutex csAdditionalSkinBoxes; + std::mutex csAnimOverrideBitmask; +}; diff --git a/targets/app/common/TerrainFeatureManager.cpp b/targets/app/common/TerrainFeatureManager.cpp new file mode 100644 index 000000000..e6a38ecb2 --- /dev/null +++ b/targets/app/common/TerrainFeatureManager.cpp @@ -0,0 +1,58 @@ +#include "app/common/TerrainFeatureManager.h" + +void TerrainFeatureManager::add(_eTerrainFeatureType eFeatureType, int x, + int z) { + // check we don't already have this in + for (auto it = m_vTerrainFeatures.begin(); it < m_vTerrainFeatures.end(); + ++it) { + FEATURE_DATA* pFeatureData = *it; + + if ((pFeatureData->eTerrainFeature == eFeatureType) && + (pFeatureData->x == x) && (pFeatureData->z == z)) + return; + } + + FEATURE_DATA* pFeatureData = new FEATURE_DATA; + pFeatureData->eTerrainFeature = eFeatureType; + pFeatureData->x = x; + pFeatureData->z = z; + + m_vTerrainFeatures.push_back(pFeatureData); +} + +_eTerrainFeatureType TerrainFeatureManager::isFeature(int x, int z) const { + for (auto it = m_vTerrainFeatures.begin(); it < m_vTerrainFeatures.end(); + ++it) { + FEATURE_DATA* pFeatureData = *it; + + if ((pFeatureData->x == x) && (pFeatureData->z == z)) + return pFeatureData->eTerrainFeature; + } + + return eTerrainFeature_None; +} + +bool TerrainFeatureManager::getPosition(_eTerrainFeatureType eType, int* pX, + int* pZ) const { + for (auto it = m_vTerrainFeatures.begin(); it < m_vTerrainFeatures.end(); + ++it) { + FEATURE_DATA* pFeatureData = *it; + + if (pFeatureData->eTerrainFeature == eType) { + *pX = pFeatureData->x; + *pZ = pFeatureData->z; + return true; + } + } + + return false; +} + +void TerrainFeatureManager::clear() { + FEATURE_DATA* pFeatureData; + while (m_vTerrainFeatures.size() > 0) { + pFeatureData = m_vTerrainFeatures.back(); + m_vTerrainFeatures.pop_back(); + delete pFeatureData; + } +} diff --git a/targets/app/common/TerrainFeatureManager.h b/targets/app/common/TerrainFeatureManager.h new file mode 100644 index 000000000..16cb46a1a --- /dev/null +++ b/targets/app/common/TerrainFeatureManager.h @@ -0,0 +1,19 @@ +#pragma once + +#include + +#include "minecraft/GameEnums.h" +#include "app/common/App_structs.h" + +class TerrainFeatureManager { +public: + void add(_eTerrainFeatureType eFeatureType, int x, int z); + void clear(); + _eTerrainFeatureType isFeature(int x, int z) const; + bool getPosition(_eTerrainFeatureType eType, int* pX, int* pZ) const; + + std::vector* features() { return &m_vTerrainFeatures; } + +private: + std::vector m_vTerrainFeatures; +}; diff --git a/targets/app/common/src/Trial/TrialMode.cpp b/targets/app/common/Trial/TrialMode.cpp similarity index 72% rename from targets/app/common/src/Trial/TrialMode.cpp rename to targets/app/common/Trial/TrialMode.cpp index a1138b853..71b3f785c 100644 --- a/targets/app/common/src/Trial/TrialMode.cpp +++ b/targets/app/common/Trial/TrialMode.cpp @@ -1,7 +1,7 @@ #include "TrialMode.h" -#include "app/common/src/Tutorial/FullTutorial.h" -#include "app/common/src/Tutorial/FullTutorialMode.h" +#include "app/common/Tutorial/FullTutorial.h" +#include "app/common/Tutorial/FullTutorialMode.h" class ClientConnection; class Minecraft; diff --git a/targets/app/common/src/Trial/TrialMode.h b/targets/app/common/Trial/TrialMode.h similarity index 81% rename from targets/app/common/src/Trial/TrialMode.h rename to targets/app/common/Trial/TrialMode.h index 41a7d92d5..a6908f97f 100644 --- a/targets/app/common/src/Trial/TrialMode.h +++ b/targets/app/common/Trial/TrialMode.h @@ -1,5 +1,5 @@ #pragma once -#include "app/common/src/Tutorial/FullTutorialMode.h" +#include "app/common/Tutorial/FullTutorialMode.h" class ClientConnection; class Minecraft; diff --git a/targets/app/common/src/Tutorial/Constraints/AreaConstraint.cpp b/targets/app/common/Tutorial/Constraints/AreaConstraint.cpp similarity index 96% rename from targets/app/common/src/Tutorial/Constraints/AreaConstraint.cpp rename to targets/app/common/Tutorial/Constraints/AreaConstraint.cpp index a49d44ecd..c5625cb82 100644 --- a/targets/app/common/src/Tutorial/Constraints/AreaConstraint.cpp +++ b/targets/app/common/Tutorial/Constraints/AreaConstraint.cpp @@ -2,7 +2,7 @@ #include -#include "app/common/src/Tutorial/Constraints/TutorialConstraint.h" +#include "app/common/Tutorial/Constraints/TutorialConstraint.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/world/phys/AABB.h" diff --git a/targets/app/common/src/Tutorial/Constraints/AreaConstraint.h b/targets/app/common/Tutorial/Constraints/AreaConstraint.h similarity index 100% rename from targets/app/common/src/Tutorial/Constraints/AreaConstraint.h rename to targets/app/common/Tutorial/Constraints/AreaConstraint.h diff --git a/targets/app/common/src/Tutorial/Constraints/ChangeStateConstraint.cpp b/targets/app/common/Tutorial/Constraints/ChangeStateConstraint.cpp similarity index 96% rename from targets/app/common/src/Tutorial/Constraints/ChangeStateConstraint.cpp rename to targets/app/common/Tutorial/Constraints/ChangeStateConstraint.cpp index 8669f4c5d..5135f2c8e 100644 --- a/targets/app/common/src/Tutorial/Constraints/ChangeStateConstraint.cpp +++ b/targets/app/common/Tutorial/Constraints/ChangeStateConstraint.cpp @@ -2,10 +2,10 @@ #include -#include "app/common/src/Network/NetworkPlayerInterface.h" -#include "app/common/src/Tutorial/Constraints/TutorialConstraint.h" -#include "app/common/src/Tutorial/Tutorial.h" -#include "app/common/src/Tutorial/TutorialEnum.h" +#include "app/common/Network/NetworkPlayerInterface.h" +#include "app/common/Tutorial/Constraints/TutorialConstraint.h" +#include "app/common/Tutorial/Tutorial.h" +#include "app/common/Tutorial/TutorialEnum.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/ClientConnection.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" diff --git a/targets/app/common/src/Tutorial/Constraints/ChangeStateConstraint.h b/targets/app/common/Tutorial/Constraints/ChangeStateConstraint.h similarity index 96% rename from targets/app/common/src/Tutorial/Constraints/ChangeStateConstraint.h rename to targets/app/common/Tutorial/Constraints/ChangeStateConstraint.h index 9c059151c..b87601123 100644 --- a/targets/app/common/src/Tutorial/Constraints/ChangeStateConstraint.h +++ b/targets/app/common/Tutorial/Constraints/ChangeStateConstraint.h @@ -2,7 +2,7 @@ #include -#include "app/common/src/Tutorial/TutorialEnum.h" +#include "app/common/Tutorial/TutorialEnum.h" #include "TutorialConstraint.h" #include "minecraft/world/phys/AABB.h" diff --git a/targets/app/common/src/Tutorial/Constraints/InputConstraint.cpp b/targets/app/common/Tutorial/Constraints/InputConstraint.cpp similarity index 100% rename from targets/app/common/src/Tutorial/Constraints/InputConstraint.cpp rename to targets/app/common/Tutorial/Constraints/InputConstraint.cpp diff --git a/targets/app/common/src/Tutorial/Constraints/InputConstraint.h b/targets/app/common/Tutorial/Constraints/InputConstraint.h similarity index 100% rename from targets/app/common/src/Tutorial/Constraints/InputConstraint.h rename to targets/app/common/Tutorial/Constraints/InputConstraint.h diff --git a/targets/app/common/src/Tutorial/Constraints/TutorialConstraint.h b/targets/app/common/Tutorial/Constraints/TutorialConstraint.h similarity index 100% rename from targets/app/common/src/Tutorial/Constraints/TutorialConstraint.h rename to targets/app/common/Tutorial/Constraints/TutorialConstraint.h diff --git a/targets/app/common/src/Tutorial/Constraints/TutorialConstraints.h b/targets/app/common/Tutorial/Constraints/TutorialConstraints.h similarity index 100% rename from targets/app/common/src/Tutorial/Constraints/TutorialConstraints.h rename to targets/app/common/Tutorial/Constraints/TutorialConstraints.h diff --git a/targets/app/common/src/Tutorial/FullTutorial.cpp b/targets/app/common/Tutorial/FullTutorial.cpp similarity index 98% rename from targets/app/common/src/Tutorial/FullTutorial.cpp rename to targets/app/common/Tutorial/FullTutorial.cpp index 8f79ed9d7..c0d45db3d 100644 --- a/targets/app/common/src/Tutorial/FullTutorial.cpp +++ b/targets/app/common/Tutorial/FullTutorial.cpp @@ -4,26 +4,26 @@ #include #include "platform/InputActions.h" -#include "app/common/src/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h" -#include "app/common/src/Tutorial/Constraints/AreaConstraint.h" -#include "app/common/src/Tutorial/Constraints/ChangeStateConstraint.h" -#include "app/common/src/Tutorial/Hints/AreaHint.h" -#include "app/common/src/Tutorial/Tasks/AreaTask.h" -#include "app/common/src/Tutorial/Tasks/ChoiceTask.h" -#include "app/common/src/Tutorial/Tasks/CompleteUsingItemTask.h" -#include "app/common/src/Tutorial/Tasks/ControllerTask.h" -#include "app/common/src/Tutorial/Tasks/CraftTask.h" -#include "app/common/src/Tutorial/Tasks/EffectChangedTask.h" -#include "app/common/src/Tutorial/Tasks/FullTutorialActiveTask.h" -#include "app/common/src/Tutorial/Tasks/InfoTask.h" -#include "app/common/src/Tutorial/Tasks/PickupTask.h" -#include "app/common/src/Tutorial/Tasks/ProcedureCompoundTask.h" -#include "app/common/src/Tutorial/Tasks/ProgressFlagTask.h" -#include "app/common/src/Tutorial/Tasks/StateChangeTask.h" -#include "app/common/src/Tutorial/Tasks/UseItemTask.h" -#include "app/common/src/Tutorial/Tasks/UseTileTask.h" -#include "app/common/src/Tutorial/Tasks/XuiCraftingTask.h" -#include "app/common/src/Tutorial/Tutorial.h" +#include "app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h" +#include "app/common/Tutorial/Constraints/AreaConstraint.h" +#include "app/common/Tutorial/Constraints/ChangeStateConstraint.h" +#include "app/common/Tutorial/Hints/AreaHint.h" +#include "app/common/Tutorial/Tasks/AreaTask.h" +#include "app/common/Tutorial/Tasks/ChoiceTask.h" +#include "app/common/Tutorial/Tasks/CompleteUsingItemTask.h" +#include "app/common/Tutorial/Tasks/ControllerTask.h" +#include "app/common/Tutorial/Tasks/CraftTask.h" +#include "app/common/Tutorial/Tasks/EffectChangedTask.h" +#include "app/common/Tutorial/Tasks/FullTutorialActiveTask.h" +#include "app/common/Tutorial/Tasks/InfoTask.h" +#include "app/common/Tutorial/Tasks/PickupTask.h" +#include "app/common/Tutorial/Tasks/ProcedureCompoundTask.h" +#include "app/common/Tutorial/Tasks/ProgressFlagTask.h" +#include "app/common/Tutorial/Tasks/StateChangeTask.h" +#include "app/common/Tutorial/Tasks/UseItemTask.h" +#include "app/common/Tutorial/Tasks/UseTileTask.h" +#include "app/common/Tutorial/Tasks/XuiCraftingTask.h" +#include "app/common/Tutorial/Tutorial.h" #include "app/linux/LinuxGame.h" #include "minecraft/world/effect/MobEffect.h" #include "minecraft/world/item/Item.h" diff --git a/targets/app/common/src/Tutorial/FullTutorial.h b/targets/app/common/Tutorial/FullTutorial.h similarity index 92% rename from targets/app/common/src/Tutorial/FullTutorial.h rename to targets/app/common/Tutorial/FullTutorial.h index 22c2d2ec8..ddf86922d 100644 --- a/targets/app/common/src/Tutorial/FullTutorial.h +++ b/targets/app/common/Tutorial/FullTutorial.h @@ -1,5 +1,5 @@ #pragma once -#include "app/common/src/Tutorial/TutorialEnum.h" +#include "app/common/Tutorial/TutorialEnum.h" #include "Tutorial.h" #define FULL_TUTORIAL_PROGRESS_2_X_2_Crafting 1 diff --git a/targets/app/common/src/Tutorial/FullTutorialMode.cpp b/targets/app/common/Tutorial/FullTutorialMode.cpp similarity index 83% rename from targets/app/common/src/Tutorial/FullTutorialMode.cpp rename to targets/app/common/Tutorial/FullTutorialMode.cpp index 55a5b9621..f9500d5f7 100644 --- a/targets/app/common/src/Tutorial/FullTutorialMode.cpp +++ b/targets/app/common/Tutorial/FullTutorialMode.cpp @@ -1,8 +1,8 @@ #include "FullTutorialMode.h" #include "FullTutorial.h" -#include "app/common/src/Tutorial/Tutorial.h" -#include "app/common/src/Tutorial/TutorialMode.h" +#include "app/common/Tutorial/Tutorial.h" +#include "app/common/Tutorial/TutorialMode.h" #include "minecraft/client/Minecraft.h" class ClientConnection; diff --git a/targets/app/common/src/Tutorial/FullTutorialMode.h b/targets/app/common/Tutorial/FullTutorialMode.h similarity index 100% rename from targets/app/common/src/Tutorial/FullTutorialMode.h rename to targets/app/common/Tutorial/FullTutorialMode.h diff --git a/targets/app/common/src/Tutorial/Hints/AreaHint.cpp b/targets/app/common/Tutorial/Hints/AreaHint.cpp similarity index 90% rename from targets/app/common/src/Tutorial/Hints/AreaHint.cpp rename to targets/app/common/Tutorial/Hints/AreaHint.cpp index c42ca2354..8f4501cdc 100644 --- a/targets/app/common/src/Tutorial/Hints/AreaHint.cpp +++ b/targets/app/common/Tutorial/Hints/AreaHint.cpp @@ -2,9 +2,9 @@ #include -#include "app/common/src/Tutorial/Hints/TutorialHint.h" -#include "app/common/src/Tutorial/Tutorial.h" -#include "app/common/src/Tutorial/TutorialEnum.h" +#include "app/common/Tutorial/Hints/TutorialHint.h" +#include "app/common/Tutorial/Tutorial.h" +#include "app/common/Tutorial/TutorialEnum.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/world/phys/AABB.h" diff --git a/targets/app/common/src/Tutorial/Hints/AreaHint.h b/targets/app/common/Tutorial/Hints/AreaHint.h similarity index 94% rename from targets/app/common/src/Tutorial/Hints/AreaHint.h rename to targets/app/common/Tutorial/Hints/AreaHint.h index e3922e008..375abfc99 100644 --- a/targets/app/common/src/Tutorial/Hints/AreaHint.h +++ b/targets/app/common/Tutorial/Hints/AreaHint.h @@ -1,6 +1,6 @@ #pragma once -#include "app/common/src/Tutorial/TutorialEnum.h" +#include "app/common/Tutorial/TutorialEnum.h" #include "TutorialHint.h" #include "minecraft/world/phys/AABB.h" diff --git a/targets/app/common/src/Tutorial/Hints/DiggerItemHint.cpp b/targets/app/common/Tutorial/Hints/DiggerItemHint.cpp similarity index 95% rename from targets/app/common/src/Tutorial/Hints/DiggerItemHint.cpp rename to targets/app/common/Tutorial/Hints/DiggerItemHint.cpp index 2742c963c..dfea1d621 100644 --- a/targets/app/common/src/Tutorial/Hints/DiggerItemHint.cpp +++ b/targets/app/common/Tutorial/Hints/DiggerItemHint.cpp @@ -3,8 +3,8 @@ #include -#include "app/common/src/Tutorial/Hints/TutorialHint.h" -#include "app/common/src/Tutorial/Tutorial.h" +#include "app/common/Tutorial/Hints/TutorialHint.h" +#include "app/common/Tutorial/Tutorial.h" #include "java/Class.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/item/ItemInstance.h" diff --git a/targets/app/common/src/Tutorial/Hints/DiggerItemHint.h b/targets/app/common/Tutorial/Hints/DiggerItemHint.h similarity index 91% rename from targets/app/common/src/Tutorial/Hints/DiggerItemHint.h rename to targets/app/common/Tutorial/Hints/DiggerItemHint.h index 45357afe1..95ba875e2 100644 --- a/targets/app/common/src/Tutorial/Hints/DiggerItemHint.h +++ b/targets/app/common/Tutorial/Hints/DiggerItemHint.h @@ -1,6 +1,6 @@ #pragma once -#include "app/common/src/Tutorial/TutorialEnum.h" +#include "app/common/Tutorial/TutorialEnum.h" #include "TutorialHint.h" class DiggerItem; diff --git a/targets/app/common/src/Tutorial/Hints/LookAtEntityHint.cpp b/targets/app/common/Tutorial/Hints/LookAtEntityHint.cpp similarity index 83% rename from targets/app/common/src/Tutorial/Hints/LookAtEntityHint.cpp rename to targets/app/common/Tutorial/Hints/LookAtEntityHint.cpp index 94ce2a8a6..486259a5a 100644 --- a/targets/app/common/src/Tutorial/Hints/LookAtEntityHint.cpp +++ b/targets/app/common/Tutorial/Hints/LookAtEntityHint.cpp @@ -1,8 +1,8 @@ #include "LookAtEntityHint.h" -#include "app/common/src/Tutorial/Hints/TutorialHint.h" -#include "app/common/src/Tutorial/Tutorial.h" -#include "app/common/src/Tutorial/TutorialEnum.h" +#include "app/common/Tutorial/Hints/TutorialHint.h" +#include "app/common/Tutorial/Tutorial.h" +#include "app/common/Tutorial/TutorialEnum.h" LookAtEntityHint::LookAtEntityHint(eTutorial_Hint id, Tutorial* tutorial, int descriptionId, int titleId, diff --git a/targets/app/common/src/Tutorial/Hints/LookAtEntityHint.h b/targets/app/common/Tutorial/Hints/LookAtEntityHint.h similarity index 90% rename from targets/app/common/src/Tutorial/Hints/LookAtEntityHint.h rename to targets/app/common/Tutorial/Hints/LookAtEntityHint.h index 6633ae8cd..d74b98767 100644 --- a/targets/app/common/src/Tutorial/Hints/LookAtEntityHint.h +++ b/targets/app/common/Tutorial/Hints/LookAtEntityHint.h @@ -1,7 +1,7 @@ #pragma once // using namespace std; -#include "app/common/src/Tutorial/TutorialEnum.h" +#include "app/common/Tutorial/TutorialEnum.h" #include "TutorialHint.h" #include "java/Class.h" diff --git a/targets/app/common/src/Tutorial/Hints/LookAtTileHint.cpp b/targets/app/common/Tutorial/Hints/LookAtTileHint.cpp similarity index 92% rename from targets/app/common/src/Tutorial/Hints/LookAtTileHint.cpp rename to targets/app/common/Tutorial/Hints/LookAtTileHint.cpp index cf65ae02a..2c07bbab6 100644 --- a/targets/app/common/src/Tutorial/Hints/LookAtTileHint.cpp +++ b/targets/app/common/Tutorial/Hints/LookAtTileHint.cpp @@ -2,9 +2,9 @@ #include -#include "app/common/src/Tutorial/Hints/TutorialHint.h" -#include "app/common/src/Tutorial/Tutorial.h" -#include "app/common/src/Tutorial/TutorialEnum.h" +#include "app/common/Tutorial/Hints/TutorialHint.h" +#include "app/common/Tutorial/Tutorial.h" +#include "app/common/Tutorial/TutorialEnum.h" #include "minecraft/world/item/Item.h" LookAtTileHint::LookAtTileHint(eTutorial_Hint id, Tutorial* tutorial, diff --git a/targets/app/common/src/Tutorial/Hints/LookAtTileHint.h b/targets/app/common/Tutorial/Hints/LookAtTileHint.h similarity index 92% rename from targets/app/common/src/Tutorial/Hints/LookAtTileHint.h rename to targets/app/common/Tutorial/Hints/LookAtTileHint.h index dd133f291..514c4fc43 100644 --- a/targets/app/common/src/Tutorial/Hints/LookAtTileHint.h +++ b/targets/app/common/Tutorial/Hints/LookAtTileHint.h @@ -1,7 +1,7 @@ #pragma once // using namespace std; -#include "app/common/src/Tutorial/TutorialEnum.h" +#include "app/common/Tutorial/TutorialEnum.h" #include "TutorialHint.h" class ItemInstance; diff --git a/targets/app/common/src/Tutorial/Hints/TakeItemHint.cpp b/targets/app/common/Tutorial/Hints/TakeItemHint.cpp similarity index 88% rename from targets/app/common/src/Tutorial/Hints/TakeItemHint.cpp rename to targets/app/common/Tutorial/Hints/TakeItemHint.cpp index b059d5b31..51d3356e1 100644 --- a/targets/app/common/src/Tutorial/Hints/TakeItemHint.cpp +++ b/targets/app/common/Tutorial/Hints/TakeItemHint.cpp @@ -2,9 +2,9 @@ #include -#include "app/common/src/Tutorial/Hints/TutorialHint.h" -#include "app/common/src/Tutorial/Tutorial.h" -#include "app/common/src/Tutorial/TutorialEnum.h" +#include "app/common/Tutorial/Hints/TutorialHint.h" +#include "app/common/Tutorial/Tutorial.h" +#include "app/common/Tutorial/TutorialEnum.h" #include "minecraft/world/item/ItemInstance.h" TakeItemHint::TakeItemHint(eTutorial_Hint id, Tutorial* tutorial, int items[], diff --git a/targets/app/common/src/Tutorial/Hints/TakeItemHint.h b/targets/app/common/Tutorial/Hints/TakeItemHint.h similarity index 90% rename from targets/app/common/src/Tutorial/Hints/TakeItemHint.h rename to targets/app/common/Tutorial/Hints/TakeItemHint.h index e836aa618..0cb9c6928 100644 --- a/targets/app/common/src/Tutorial/Hints/TakeItemHint.h +++ b/targets/app/common/Tutorial/Hints/TakeItemHint.h @@ -1,7 +1,7 @@ #pragma once // using namespace std; -#include "app/common/src/Tutorial/TutorialEnum.h" +#include "app/common/Tutorial/TutorialEnum.h" #include "TutorialHint.h" class ItemInstance; diff --git a/targets/app/common/src/Tutorial/Hints/TutorialHint.cpp b/targets/app/common/Tutorial/Hints/TutorialHint.cpp similarity index 96% rename from targets/app/common/src/Tutorial/Hints/TutorialHint.cpp rename to targets/app/common/Tutorial/Hints/TutorialHint.cpp index 14f89c60f..1122ceb00 100644 --- a/targets/app/common/src/Tutorial/Hints/TutorialHint.cpp +++ b/targets/app/common/Tutorial/Hints/TutorialHint.cpp @@ -1,7 +1,7 @@ #include "TutorialHint.h" -#include "app/common/src/Tutorial/Tutorial.h" -#include "app/common/src/Tutorial/TutorialEnum.h" +#include "app/common/Tutorial/Tutorial.h" +#include "app/common/Tutorial/TutorialEnum.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/world/level/material/Material.h" diff --git a/targets/app/common/src/Tutorial/Hints/TutorialHint.h b/targets/app/common/Tutorial/Hints/TutorialHint.h similarity index 96% rename from targets/app/common/src/Tutorial/Hints/TutorialHint.h rename to targets/app/common/Tutorial/Hints/TutorialHint.h index b30746df0..0ef31b135 100644 --- a/targets/app/common/src/Tutorial/Hints/TutorialHint.h +++ b/targets/app/common/Tutorial/Hints/TutorialHint.h @@ -3,7 +3,7 @@ #include -#include "app/common/src/Tutorial/TutorialEnum.h" +#include "app/common/Tutorial/TutorialEnum.h" #include "java/Class.h" class Entity; diff --git a/targets/app/common/src/Tutorial/Hints/TutorialHints.h b/targets/app/common/Tutorial/Hints/TutorialHints.h similarity index 100% rename from targets/app/common/src/Tutorial/Hints/TutorialHints.h rename to targets/app/common/Tutorial/Hints/TutorialHints.h diff --git a/targets/app/common/src/Tutorial/Tasks/AreaTask.cpp b/targets/app/common/Tutorial/Tasks/AreaTask.cpp similarity index 89% rename from targets/app/common/src/Tutorial/Tasks/AreaTask.cpp rename to targets/app/common/Tutorial/Tasks/AreaTask.cpp index c81e0f004..d3b5c7ebb 100644 --- a/targets/app/common/src/Tutorial/Tasks/AreaTask.cpp +++ b/targets/app/common/Tutorial/Tasks/AreaTask.cpp @@ -2,10 +2,10 @@ #include -#include "app/common/src/Tutorial/Constraints/TutorialConstraint.h" -#include "app/common/src/Tutorial/Tasks/TutorialTask.h" -#include "app/common/src/Tutorial/Tutorial.h" -#include "app/common/src/Tutorial/TutorialEnum.h" +#include "app/common/Tutorial/Constraints/TutorialConstraint.h" +#include "app/common/Tutorial/Tasks/TutorialTask.h" +#include "app/common/Tutorial/Tutorial.h" +#include "app/common/Tutorial/TutorialEnum.h" AreaTask::AreaTask(eTutorial_State state, Tutorial* tutorial, std::vector* inConstraints, diff --git a/targets/app/common/src/Tutorial/Tasks/AreaTask.h b/targets/app/common/Tutorial/Tasks/AreaTask.h similarity index 94% rename from targets/app/common/src/Tutorial/Tasks/AreaTask.h rename to targets/app/common/Tutorial/Tasks/AreaTask.h index 8b8111bea..fbbd20bcc 100644 --- a/targets/app/common/src/Tutorial/Tasks/AreaTask.h +++ b/targets/app/common/Tutorial/Tasks/AreaTask.h @@ -4,7 +4,7 @@ #include #include -#include "app/common/src/Tutorial/TutorialEnum.h" +#include "app/common/Tutorial/TutorialEnum.h" #include "TutorialTask.h" class Tutorial; diff --git a/targets/app/common/src/Tutorial/Tasks/ChoiceTask.cpp b/targets/app/common/Tutorial/Tasks/ChoiceTask.cpp similarity index 93% rename from targets/app/common/src/Tutorial/Tasks/ChoiceTask.cpp rename to targets/app/common/Tutorial/Tasks/ChoiceTask.cpp index fb243c15c..9847c2981 100644 --- a/targets/app/common/src/Tutorial/Tasks/ChoiceTask.cpp +++ b/targets/app/common/Tutorial/Tasks/ChoiceTask.cpp @@ -4,10 +4,10 @@ #include #include "platform/sdl2/Input.h" -#include "app/common/src/Tutorial/Constraints/InputConstraint.h" -#include "app/common/src/Tutorial/Tasks/TutorialTask.h" -#include "app/common/src/Tutorial/Tutorial.h" -#include "app/common/src/Tutorial/TutorialEnum.h" +#include "app/common/Tutorial/Constraints/InputConstraint.h" +#include "app/common/Tutorial/Tasks/TutorialTask.h" +#include "app/common/Tutorial/Tutorial.h" +#include "app/common/Tutorial/TutorialEnum.h" #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" diff --git a/targets/app/common/src/Tutorial/Tasks/ChoiceTask.h b/targets/app/common/Tutorial/Tasks/ChoiceTask.h similarity index 94% rename from targets/app/common/src/Tutorial/Tasks/ChoiceTask.h rename to targets/app/common/Tutorial/Tasks/ChoiceTask.h index 2e54de703..7faf10682 100644 --- a/targets/app/common/src/Tutorial/Tasks/ChoiceTask.h +++ b/targets/app/common/Tutorial/Tasks/ChoiceTask.h @@ -1,7 +1,7 @@ #pragma once // using namespace std; -#include "app/common/src/Tutorial/TutorialEnum.h" +#include "app/common/Tutorial/TutorialEnum.h" #include "TutorialTask.h" class Tutorial; diff --git a/targets/app/common/src/Tutorial/Tasks/CompleteUsingItemTask.cpp b/targets/app/common/Tutorial/Tasks/CompleteUsingItemTask.cpp similarity index 95% rename from targets/app/common/src/Tutorial/Tasks/CompleteUsingItemTask.cpp rename to targets/app/common/Tutorial/Tasks/CompleteUsingItemTask.cpp index 09a6f8fd6..24be8f6ce 100644 --- a/targets/app/common/src/Tutorial/Tasks/CompleteUsingItemTask.cpp +++ b/targets/app/common/Tutorial/Tasks/CompleteUsingItemTask.cpp @@ -2,7 +2,7 @@ #include -#include "app/common/src/Tutorial/Tasks/TutorialTask.h" +#include "app/common/Tutorial/Tasks/TutorialTask.h" #include "minecraft/world/item/ItemInstance.h" class Tutorial; diff --git a/targets/app/common/src/Tutorial/Tasks/CompleteUsingItemTask.h b/targets/app/common/Tutorial/Tasks/CompleteUsingItemTask.h similarity index 100% rename from targets/app/common/src/Tutorial/Tasks/CompleteUsingItemTask.h rename to targets/app/common/Tutorial/Tasks/CompleteUsingItemTask.h diff --git a/targets/app/common/src/Tutorial/Tasks/ControllerTask.cpp b/targets/app/common/Tutorial/Tasks/ControllerTask.cpp similarity index 96% rename from targets/app/common/src/Tutorial/Tasks/ControllerTask.cpp rename to targets/app/common/Tutorial/Tasks/ControllerTask.cpp index aaf25d66e..c1dce5cdb 100644 --- a/targets/app/common/src/Tutorial/Tasks/ControllerTask.cpp +++ b/targets/app/common/Tutorial/Tasks/ControllerTask.cpp @@ -7,9 +7,9 @@ #include #include "platform/sdl2/Input.h" -#include "app/common/App_enums.h" -#include "app/common/src/Tutorial/Constraints/InputConstraint.h" -#include "app/common/src/Tutorial/Tasks/TutorialTask.h" +#include "minecraft/GameEnums.h" +#include "app/common/Tutorial/Constraints/InputConstraint.h" +#include "app/common/Tutorial/Tasks/TutorialTask.h" #include "app/linux/LinuxGame.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" diff --git a/targets/app/common/src/Tutorial/Tasks/ControllerTask.h b/targets/app/common/Tutorial/Tasks/ControllerTask.h similarity index 100% rename from targets/app/common/src/Tutorial/Tasks/ControllerTask.h rename to targets/app/common/Tutorial/Tasks/ControllerTask.h diff --git a/targets/app/common/src/Tutorial/Tasks/CraftTask.cpp b/targets/app/common/Tutorial/Tasks/CraftTask.cpp similarity index 97% rename from targets/app/common/src/Tutorial/Tasks/CraftTask.cpp rename to targets/app/common/Tutorial/Tasks/CraftTask.cpp index bb8b59ca5..6af9a997d 100644 --- a/targets/app/common/src/Tutorial/Tasks/CraftTask.cpp +++ b/targets/app/common/Tutorial/Tasks/CraftTask.cpp @@ -5,7 +5,7 @@ #include #include -#include "app/common/src/Tutorial/Tasks/TutorialTask.h" +#include "app/common/Tutorial/Tasks/TutorialTask.h" #include "minecraft/world/item/ItemInstance.h" class Tutorial; diff --git a/targets/app/common/src/Tutorial/Tasks/CraftTask.h b/targets/app/common/Tutorial/Tasks/CraftTask.h similarity index 100% rename from targets/app/common/src/Tutorial/Tasks/CraftTask.h rename to targets/app/common/Tutorial/Tasks/CraftTask.h diff --git a/targets/app/common/src/Tutorial/Tasks/EffectChangedTask.cpp b/targets/app/common/Tutorial/Tasks/EffectChangedTask.cpp similarity index 94% rename from targets/app/common/src/Tutorial/Tasks/EffectChangedTask.cpp rename to targets/app/common/Tutorial/Tasks/EffectChangedTask.cpp index afd13e041..0e4f137fb 100644 --- a/targets/app/common/src/Tutorial/Tasks/EffectChangedTask.cpp +++ b/targets/app/common/Tutorial/Tasks/EffectChangedTask.cpp @@ -1,6 +1,6 @@ #include "EffectChangedTask.h" -#include "app/common/src/Tutorial/Tasks/TutorialTask.h" +#include "app/common/Tutorial/Tasks/TutorialTask.h" class Tutorial; diff --git a/targets/app/common/src/Tutorial/Tasks/EffectChangedTask.h b/targets/app/common/Tutorial/Tasks/EffectChangedTask.h similarity index 100% rename from targets/app/common/src/Tutorial/Tasks/EffectChangedTask.h rename to targets/app/common/Tutorial/Tasks/EffectChangedTask.h diff --git a/targets/app/common/src/Tutorial/Tasks/FullTutorialActiveTask.cpp b/targets/app/common/Tutorial/Tasks/FullTutorialActiveTask.cpp similarity index 79% rename from targets/app/common/src/Tutorial/Tasks/FullTutorialActiveTask.cpp rename to targets/app/common/Tutorial/Tasks/FullTutorialActiveTask.cpp index 27604b4cc..eba2e6900 100644 --- a/targets/app/common/src/Tutorial/Tasks/FullTutorialActiveTask.cpp +++ b/targets/app/common/Tutorial/Tasks/FullTutorialActiveTask.cpp @@ -1,8 +1,8 @@ #include "FullTutorialActiveTask.h" -#include "app/common/src/Tutorial/Tasks/TutorialTask.h" -#include "app/common/src/Tutorial/Tutorial.h" -#include "app/common/src/Tutorial/TutorialEnum.h" +#include "app/common/Tutorial/Tasks/TutorialTask.h" +#include "app/common/Tutorial/Tutorial.h" +#include "app/common/Tutorial/TutorialEnum.h" FullTutorialActiveTask::FullTutorialActiveTask( Tutorial* tutorial, diff --git a/targets/app/common/src/Tutorial/Tasks/FullTutorialActiveTask.h b/targets/app/common/Tutorial/Tasks/FullTutorialActiveTask.h similarity index 91% rename from targets/app/common/src/Tutorial/Tasks/FullTutorialActiveTask.h rename to targets/app/common/Tutorial/Tasks/FullTutorialActiveTask.h index b150d764d..bcee51649 100644 --- a/targets/app/common/src/Tutorial/Tasks/FullTutorialActiveTask.h +++ b/targets/app/common/Tutorial/Tasks/FullTutorialActiveTask.h @@ -1,7 +1,7 @@ #pragma once // using namespace std; -#include "app/common/src/Tutorial/TutorialEnum.h" +#include "app/common/Tutorial/TutorialEnum.h" #include "TutorialTask.h" class Tutorial; diff --git a/targets/app/common/src/Tutorial/Tasks/HorseChoiceTask.cpp b/targets/app/common/Tutorial/Tasks/HorseChoiceTask.cpp similarity index 93% rename from targets/app/common/src/Tutorial/Tasks/HorseChoiceTask.cpp rename to targets/app/common/Tutorial/Tasks/HorseChoiceTask.cpp index be3373be3..bbb131b5a 100644 --- a/targets/app/common/src/Tutorial/Tasks/HorseChoiceTask.cpp +++ b/targets/app/common/Tutorial/Tasks/HorseChoiceTask.cpp @@ -2,8 +2,8 @@ #include -#include "app/common/src/Tutorial/Tasks/ChoiceTask.h" -#include "app/common/src/Tutorial/TutorialEnum.h" +#include "app/common/Tutorial/Tasks/ChoiceTask.h" +#include "app/common/Tutorial/TutorialEnum.h" #include "java/Class.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/animal/EntityHorse.h" diff --git a/targets/app/common/src/Tutorial/Tasks/HorseChoiceTask.h b/targets/app/common/Tutorial/Tasks/HorseChoiceTask.h similarity index 92% rename from targets/app/common/src/Tutorial/Tasks/HorseChoiceTask.h rename to targets/app/common/Tutorial/Tasks/HorseChoiceTask.h index 9a8f537e6..67fd7c95a 100644 --- a/targets/app/common/src/Tutorial/Tasks/HorseChoiceTask.h +++ b/targets/app/common/Tutorial/Tasks/HorseChoiceTask.h @@ -1,7 +1,7 @@ #pragma once #include "ChoiceTask.h" -#include "app/common/src/Tutorial/TutorialEnum.h" +#include "app/common/Tutorial/TutorialEnum.h" class Tutorial; diff --git a/targets/app/common/src/Tutorial/Tasks/InfoTask.cpp b/targets/app/common/Tutorial/Tasks/InfoTask.cpp similarity index 94% rename from targets/app/common/src/Tutorial/Tasks/InfoTask.cpp rename to targets/app/common/Tutorial/Tasks/InfoTask.cpp index 9ef123d0a..c9dfc0283 100644 --- a/targets/app/common/src/Tutorial/Tasks/InfoTask.cpp +++ b/targets/app/common/Tutorial/Tasks/InfoTask.cpp @@ -6,9 +6,9 @@ #include #include "platform/sdl2/Input.h" -#include "app/common/src/Tutorial/Constraints/InputConstraint.h" -#include "app/common/src/Tutorial/Tasks/TutorialTask.h" -#include "app/common/src/Tutorial/Tutorial.h" +#include "app/common/Tutorial/Constraints/InputConstraint.h" +#include "app/common/Tutorial/Tasks/TutorialTask.h" +#include "app/common/Tutorial/Tutorial.h" #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" diff --git a/targets/app/common/src/Tutorial/Tasks/InfoTask.h b/targets/app/common/Tutorial/Tasks/InfoTask.h similarity index 100% rename from targets/app/common/src/Tutorial/Tasks/InfoTask.h rename to targets/app/common/Tutorial/Tasks/InfoTask.h diff --git a/targets/app/common/src/Tutorial/Tasks/PickupTask.cpp b/targets/app/common/Tutorial/Tasks/PickupTask.cpp similarity index 100% rename from targets/app/common/src/Tutorial/Tasks/PickupTask.cpp rename to targets/app/common/Tutorial/Tasks/PickupTask.cpp diff --git a/targets/app/common/src/Tutorial/Tasks/PickupTask.h b/targets/app/common/Tutorial/Tasks/PickupTask.h similarity index 100% rename from targets/app/common/src/Tutorial/Tasks/PickupTask.h rename to targets/app/common/Tutorial/Tasks/PickupTask.h diff --git a/targets/app/common/src/Tutorial/Tasks/ProcedureCompoundTask.cpp b/targets/app/common/Tutorial/Tasks/ProcedureCompoundTask.cpp similarity index 98% rename from targets/app/common/src/Tutorial/Tasks/ProcedureCompoundTask.cpp rename to targets/app/common/Tutorial/Tasks/ProcedureCompoundTask.cpp index cf4984645..90a55014c 100644 --- a/targets/app/common/src/Tutorial/Tasks/ProcedureCompoundTask.cpp +++ b/targets/app/common/Tutorial/Tasks/ProcedureCompoundTask.cpp @@ -3,8 +3,8 @@ #include #include -#include "app/common/src/Tutorial/Tasks/TutorialTask.h" -#include "app/common/src/Tutorial/TutorialEnum.h" +#include "app/common/Tutorial/Tasks/TutorialTask.h" +#include "app/common/Tutorial/TutorialEnum.h" ProcedureCompoundTask::~ProcedureCompoundTask() { for (auto it = m_taskSequence.begin(); it < m_taskSequence.end(); ++it) { diff --git a/targets/app/common/src/Tutorial/Tasks/ProcedureCompoundTask.h b/targets/app/common/Tutorial/Tasks/ProcedureCompoundTask.h similarity index 96% rename from targets/app/common/src/Tutorial/Tasks/ProcedureCompoundTask.h rename to targets/app/common/Tutorial/Tasks/ProcedureCompoundTask.h index f0338c425..c78318b0d 100644 --- a/targets/app/common/src/Tutorial/Tasks/ProcedureCompoundTask.h +++ b/targets/app/common/Tutorial/Tasks/ProcedureCompoundTask.h @@ -2,7 +2,7 @@ #include -#include "app/common/src/Tutorial/TutorialEnum.h" +#include "app/common/Tutorial/TutorialEnum.h" #include "TutorialTask.h" class Tutorial; diff --git a/targets/app/common/src/Tutorial/Tasks/ProgressFlagTask.cpp b/targets/app/common/Tutorial/Tasks/ProgressFlagTask.cpp similarity index 100% rename from targets/app/common/src/Tutorial/Tasks/ProgressFlagTask.cpp rename to targets/app/common/Tutorial/Tasks/ProgressFlagTask.cpp diff --git a/targets/app/common/src/Tutorial/Tasks/ProgressFlagTask.h b/targets/app/common/Tutorial/Tasks/ProgressFlagTask.h similarity index 85% rename from targets/app/common/src/Tutorial/Tasks/ProgressFlagTask.h rename to targets/app/common/Tutorial/Tasks/ProgressFlagTask.h index b0077521a..03f0abb42 100644 --- a/targets/app/common/src/Tutorial/Tasks/ProgressFlagTask.h +++ b/targets/app/common/Tutorial/Tasks/ProgressFlagTask.h @@ -1,7 +1,7 @@ #pragma once // using namespace std; -#include "app/common/src/Tutorial/Tasks/TutorialTask.h" -#include "app/common/src/Tutorial/Tutorial.h" +#include "app/common/Tutorial/Tasks/TutorialTask.h" +#include "app/common/Tutorial/Tutorial.h" #include "TutorialTask.h" class Tutorial; diff --git a/targets/app/common/src/Tutorial/Tasks/RideEntityTask.cpp b/targets/app/common/Tutorial/Tasks/RideEntityTask.cpp similarity index 94% rename from targets/app/common/src/Tutorial/Tasks/RideEntityTask.cpp rename to targets/app/common/Tutorial/Tasks/RideEntityTask.cpp index 1e8d26807..af7a61733 100644 --- a/targets/app/common/src/Tutorial/Tasks/RideEntityTask.cpp +++ b/targets/app/common/Tutorial/Tasks/RideEntityTask.cpp @@ -2,7 +2,7 @@ #include -#include "app/common/src/Tutorial/Tasks/TutorialTask.h" +#include "app/common/Tutorial/Tasks/TutorialTask.h" #include "java/Class.h" #include "minecraft/world/entity/Entity.h" diff --git a/targets/app/common/src/Tutorial/Tasks/RideEntityTask.h b/targets/app/common/Tutorial/Tasks/RideEntityTask.h similarity index 100% rename from targets/app/common/src/Tutorial/Tasks/RideEntityTask.h rename to targets/app/common/Tutorial/Tasks/RideEntityTask.h diff --git a/targets/app/common/src/Tutorial/Tasks/StatTask.cpp b/targets/app/common/Tutorial/Tasks/StatTask.cpp similarity index 93% rename from targets/app/common/src/Tutorial/Tasks/StatTask.cpp rename to targets/app/common/Tutorial/Tasks/StatTask.cpp index c6b129f8f..007c4b252 100644 --- a/targets/app/common/src/Tutorial/Tasks/StatTask.cpp +++ b/targets/app/common/Tutorial/Tasks/StatTask.cpp @@ -1,7 +1,7 @@ #include "StatTask.h" #include "platform/sdl2/Profile.h" -#include "app/common/src/Tutorial/Tasks/TutorialTask.h" +#include "app/common/Tutorial/Tasks/TutorialTask.h" #include "minecraft/client/Minecraft.h" #include "minecraft/stats/StatsCounter.h" diff --git a/targets/app/common/src/Tutorial/Tasks/StatTask.h b/targets/app/common/Tutorial/Tasks/StatTask.h similarity index 100% rename from targets/app/common/src/Tutorial/Tasks/StatTask.h rename to targets/app/common/Tutorial/Tasks/StatTask.h diff --git a/targets/app/common/src/Tutorial/Tasks/StateChangeTask.h b/targets/app/common/Tutorial/Tasks/StateChangeTask.h similarity index 95% rename from targets/app/common/src/Tutorial/Tasks/StateChangeTask.h rename to targets/app/common/Tutorial/Tasks/StateChangeTask.h index 660ce02ab..af6e7cf20 100644 --- a/targets/app/common/src/Tutorial/Tasks/StateChangeTask.h +++ b/targets/app/common/Tutorial/Tasks/StateChangeTask.h @@ -1,6 +1,6 @@ #pragma once // using namespace std; -#include "app/common/src/Tutorial/Tutorial.h" +#include "app/common/Tutorial/Tutorial.h" #include "TutorialTask.h" class StateChangeTask : public TutorialTask { diff --git a/targets/app/common/src/Tutorial/Tasks/TutorialTask.cpp b/targets/app/common/Tutorial/Tasks/TutorialTask.cpp similarity index 95% rename from targets/app/common/src/Tutorial/Tasks/TutorialTask.cpp rename to targets/app/common/Tutorial/Tasks/TutorialTask.cpp index cfaf76275..954258f9e 100644 --- a/targets/app/common/src/Tutorial/Tasks/TutorialTask.cpp +++ b/targets/app/common/Tutorial/Tasks/TutorialTask.cpp @@ -2,8 +2,8 @@ #include -#include "app/common/src/Tutorial/Constraints/TutorialConstraint.h" -#include "app/common/src/Tutorial/Tutorial.h" +#include "app/common/Tutorial/Constraints/TutorialConstraint.h" +#include "app/common/Tutorial/Tutorial.h" TutorialTask::TutorialTask(Tutorial* tutorial, int descriptionId, bool enablePreCompletion, diff --git a/targets/app/common/src/Tutorial/Tasks/TutorialTask.h b/targets/app/common/Tutorial/Tasks/TutorialTask.h similarity index 98% rename from targets/app/common/src/Tutorial/Tasks/TutorialTask.h rename to targets/app/common/Tutorial/Tasks/TutorialTask.h index a87cf704b..593edf3a6 100644 --- a/targets/app/common/src/Tutorial/Tasks/TutorialTask.h +++ b/targets/app/common/Tutorial/Tasks/TutorialTask.h @@ -4,7 +4,7 @@ #include // using namespace std; -#include "app/common/src/Tutorial/TutorialEnum.h" +#include "app/common/Tutorial/TutorialEnum.h" class Level; class Tutorial; diff --git a/targets/app/common/src/Tutorial/Tasks/TutorialTasks.h b/targets/app/common/Tutorial/Tasks/TutorialTasks.h similarity index 100% rename from targets/app/common/src/Tutorial/Tasks/TutorialTasks.h rename to targets/app/common/Tutorial/Tasks/TutorialTasks.h diff --git a/targets/app/common/src/Tutorial/Tasks/UseItemTask.cpp b/targets/app/common/Tutorial/Tasks/UseItemTask.cpp similarity index 93% rename from targets/app/common/src/Tutorial/Tasks/UseItemTask.cpp rename to targets/app/common/Tutorial/Tasks/UseItemTask.cpp index d4ddacdd7..a8cb185ef 100644 --- a/targets/app/common/src/Tutorial/Tasks/UseItemTask.cpp +++ b/targets/app/common/Tutorial/Tasks/UseItemTask.cpp @@ -2,7 +2,7 @@ #include -#include "app/common/src/Tutorial/Tasks/TutorialTask.h" +#include "app/common/Tutorial/Tasks/TutorialTask.h" #include "minecraft/world/item/ItemInstance.h" class Tutorial; diff --git a/targets/app/common/src/Tutorial/Tasks/UseItemTask.h b/targets/app/common/Tutorial/Tasks/UseItemTask.h similarity index 100% rename from targets/app/common/src/Tutorial/Tasks/UseItemTask.h rename to targets/app/common/Tutorial/Tasks/UseItemTask.h diff --git a/targets/app/common/src/Tutorial/Tasks/UseTileTask.cpp b/targets/app/common/Tutorial/Tasks/UseTileTask.cpp similarity index 96% rename from targets/app/common/src/Tutorial/Tasks/UseTileTask.cpp rename to targets/app/common/Tutorial/Tasks/UseTileTask.cpp index d9014956f..0bb742cc2 100644 --- a/targets/app/common/src/Tutorial/Tasks/UseTileTask.cpp +++ b/targets/app/common/Tutorial/Tasks/UseTileTask.cpp @@ -2,7 +2,7 @@ #include -#include "app/common/src/Tutorial/Tasks/TutorialTask.h" +#include "app/common/Tutorial/Tasks/TutorialTask.h" #include "minecraft/world/level/Level.h" class Tutorial; diff --git a/targets/app/common/src/Tutorial/Tasks/UseTileTask.h b/targets/app/common/Tutorial/Tasks/UseTileTask.h similarity index 100% rename from targets/app/common/src/Tutorial/Tasks/UseTileTask.h rename to targets/app/common/Tutorial/Tasks/UseTileTask.h diff --git a/targets/app/common/src/Tutorial/Tasks/XuiCraftingTask.cpp b/targets/app/common/Tutorial/Tasks/XuiCraftingTask.cpp similarity index 86% rename from targets/app/common/src/Tutorial/Tasks/XuiCraftingTask.cpp rename to targets/app/common/Tutorial/Tasks/XuiCraftingTask.cpp index 66f177ce1..da3617966 100644 --- a/targets/app/common/src/Tutorial/Tasks/XuiCraftingTask.cpp +++ b/targets/app/common/Tutorial/Tasks/XuiCraftingTask.cpp @@ -1,7 +1,7 @@ #include "XuiCraftingTask.h" -#include "app/common/src/Tutorial/Tutorial.h" -#include "app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_CraftingMenu.h" +#include "app/common/Tutorial/Tutorial.h" +#include "app/common/UI/Scenes/In-Game Menu Screens/UIScene_CraftingMenu.h" bool XuiCraftingTask::isCompleted() { // This doesn't seem to work diff --git a/targets/app/common/src/Tutorial/Tasks/XuiCraftingTask.h b/targets/app/common/Tutorial/Tasks/XuiCraftingTask.h similarity index 100% rename from targets/app/common/src/Tutorial/Tasks/XuiCraftingTask.h rename to targets/app/common/Tutorial/Tasks/XuiCraftingTask.h diff --git a/targets/app/common/src/Tutorial/Tutorial.cpp b/targets/app/common/Tutorial/Tutorial.cpp similarity index 99% rename from targets/app/common/src/Tutorial/Tutorial.cpp rename to targets/app/common/Tutorial/Tutorial.cpp index d56d54293..9a82d358b 100644 --- a/targets/app/common/src/Tutorial/Tutorial.cpp +++ b/targets/app/common/Tutorial/Tutorial.cpp @@ -8,20 +8,20 @@ #include "platform/InputActions.h" #include "platform/sdl2/Profile.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/App_structs.h" -#include "app/common/src/Tutorial/Constraints/TutorialConstraint.h" -#include "app/common/src/Tutorial/Hints/DiggerItemHint.h" -#include "app/common/src/Tutorial/Hints/LookAtEntityHint.h" -#include "app/common/src/Tutorial/Hints/LookAtTileHint.h" -#include "app/common/src/Tutorial/Hints/TutorialHint.h" -#include "app/common/src/Tutorial/Tasks/ChoiceTask.h" -#include "app/common/src/Tutorial/Tasks/HorseChoiceTask.h" -#include "app/common/src/Tutorial/Tasks/InfoTask.h" -#include "app/common/src/Tutorial/Tasks/ProcedureCompoundTask.h" -#include "app/common/src/Tutorial/Tasks/RideEntityTask.h" -#include "app/common/src/Tutorial/Tasks/TutorialTask.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" +#include "app/common/Tutorial/Constraints/TutorialConstraint.h" +#include "app/common/Tutorial/Hints/DiggerItemHint.h" +#include "app/common/Tutorial/Hints/LookAtEntityHint.h" +#include "app/common/Tutorial/Hints/LookAtTileHint.h" +#include "app/common/Tutorial/Hints/TutorialHint.h" +#include "app/common/Tutorial/Tasks/ChoiceTask.h" +#include "app/common/Tutorial/Tasks/HorseChoiceTask.h" +#include "app/common/Tutorial/Tasks/InfoTask.h" +#include "app/common/Tutorial/Tasks/ProcedureCompoundTask.h" +#include "app/common/Tutorial/Tasks/RideEntityTask.h" +#include "app/common/Tutorial/Tasks/TutorialTask.h" +#include "app/common/UI/All Platforms/UIStructs.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "TutorialMessage.h" diff --git a/targets/app/common/src/Tutorial/Tutorial.h b/targets/app/common/Tutorial/Tutorial.h similarity index 96% rename from targets/app/common/src/Tutorial/Tutorial.h rename to targets/app/common/Tutorial/Tutorial.h index def40763e..5070d5ea5 100644 --- a/targets/app/common/src/Tutorial/Tutorial.h +++ b/targets/app/common/Tutorial/Tutorial.h @@ -11,10 +11,10 @@ #include "util/Timer.h" -#include "app/common/src/Tutorial/Constraints/TutorialConstraint.h" -#include "app/common/src/Tutorial/Hints/TutorialHint.h" -#include "app/common/src/Tutorial/Tasks/TutorialTask.h" -#include "app/common/src/Tutorial/TutorialEnum.h" +#include "app/common/Tutorial/Constraints/TutorialConstraint.h" +#include "app/common/Tutorial/Hints/TutorialHint.h" +#include "app/common/Tutorial/Tasks/TutorialTask.h" +#include "app/common/Tutorial/TutorialEnum.h" #include "TutorialEnum.h" #include "TutorialMessage.h" diff --git a/targets/app/common/src/Tutorial/TutorialEnum.h b/targets/app/common/Tutorial/TutorialEnum.h similarity index 100% rename from targets/app/common/src/Tutorial/TutorialEnum.h rename to targets/app/common/Tutorial/TutorialEnum.h diff --git a/targets/app/common/src/Tutorial/TutorialMessage.cpp b/targets/app/common/Tutorial/TutorialMessage.cpp similarity index 100% rename from targets/app/common/src/Tutorial/TutorialMessage.cpp rename to targets/app/common/Tutorial/TutorialMessage.cpp diff --git a/targets/app/common/src/Tutorial/TutorialMessage.h b/targets/app/common/Tutorial/TutorialMessage.h similarity index 100% rename from targets/app/common/src/Tutorial/TutorialMessage.h rename to targets/app/common/Tutorial/TutorialMessage.h diff --git a/targets/app/common/src/Tutorial/TutorialMode.cpp b/targets/app/common/Tutorial/TutorialMode.cpp similarity index 98% rename from targets/app/common/src/Tutorial/TutorialMode.cpp rename to targets/app/common/Tutorial/TutorialMode.cpp index 0f936d73a..014f7a5b8 100644 --- a/targets/app/common/src/Tutorial/TutorialMode.cpp +++ b/targets/app/common/Tutorial/TutorialMode.cpp @@ -2,7 +2,7 @@ #include -#include "app/common/src/Tutorial/Tutorial.h" +#include "app/common/Tutorial/Tutorial.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" #include "minecraft/client/multiplayer/MultiPlayerLevel.h" diff --git a/targets/app/common/src/Tutorial/TutorialMode.h b/targets/app/common/Tutorial/TutorialMode.h similarity index 100% rename from targets/app/common/src/Tutorial/TutorialMode.h rename to targets/app/common/Tutorial/TutorialMode.h diff --git a/targets/app/common/src/UI/All Platforms/ArchiveFile.cpp b/targets/app/common/UI/All Platforms/ArchiveFile.cpp similarity index 100% rename from targets/app/common/src/UI/All Platforms/ArchiveFile.cpp rename to targets/app/common/UI/All Platforms/ArchiveFile.cpp diff --git a/targets/app/common/src/UI/All Platforms/ArchiveFile.h b/targets/app/common/UI/All Platforms/ArchiveFile.h similarity index 100% rename from targets/app/common/src/UI/All Platforms/ArchiveFile.h rename to targets/app/common/UI/All Platforms/ArchiveFile.h diff --git a/targets/app/common/src/UI/All Platforms/IUIController.h b/targets/app/common/UI/All Platforms/IUIController.h similarity index 100% rename from targets/app/common/src/UI/All Platforms/IUIController.h rename to targets/app/common/UI/All Platforms/IUIController.h diff --git a/targets/app/common/src/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp similarity index 99% rename from targets/app/common/src/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp rename to targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp index 2fdfe4b84..d1fb9835a 100644 --- a/targets/app/common/src/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp @@ -10,10 +10,10 @@ #include "platform/InputActions.h" #include "platform/sdl2/Input.h" #include "platform/sdl2/Render.h" -#include "app/common/App_enums.h" -#include "app/common/src/Tutorial/Tutorial.h" -#include "app/common/src/Tutorial/TutorialMode.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" +#include "minecraft/GameEnums.h" +#include "app/common/Tutorial/Tutorial.h" +#include "app/common/Tutorial/TutorialMode.h" +#include "app/common/UI/All Platforms/UIStructs.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/src/UI/All Platforms/IUIScene_AbstractContainerMenu.h b/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h similarity index 99% rename from targets/app/common/src/UI/All Platforms/IUIScene_AbstractContainerMenu.h rename to targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h index 45feb362e..dcf87e8ee 100644 --- a/targets/app/common/src/UI/All Platforms/IUIScene_AbstractContainerMenu.h +++ b/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h @@ -3,8 +3,8 @@ #include #include -#include "app/common/src/Tutorial/TutorialEnum.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" +#include "app/common/Tutorial/TutorialEnum.h" +#include "app/common/UI/All Platforms/UIEnums.h" #include "UIStructs.h" class HtmlString; diff --git a/targets/app/common/src/UI/All Platforms/IUIScene_AnvilMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_AnvilMenu.cpp similarity index 99% rename from targets/app/common/src/UI/All Platforms/IUIScene_AnvilMenu.cpp rename to targets/app/common/UI/All Platforms/IUIScene_AnvilMenu.cpp index 55ef3a9e1..094ad37fa 100644 --- a/targets/app/common/src/UI/All Platforms/IUIScene_AnvilMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_AnvilMenu.cpp @@ -3,7 +3,7 @@ #include #include -#include "app/common/src/UI/All Platforms/IUIScene_AbstractContainerMenu.h" +#include "app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h" #include "app/linux/LinuxGame.h" #include "java/InputOutputStream/ByteArrayOutputStream.h" #include "java/InputOutputStream/DataOutputStream.h" diff --git a/targets/app/common/src/UI/All Platforms/IUIScene_AnvilMenu.h b/targets/app/common/UI/All Platforms/IUIScene_AnvilMenu.h similarity index 100% rename from targets/app/common/src/UI/All Platforms/IUIScene_AnvilMenu.h rename to targets/app/common/UI/All Platforms/IUIScene_AnvilMenu.h diff --git a/targets/app/common/src/UI/All Platforms/IUIScene_BeaconMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_BeaconMenu.cpp similarity index 99% rename from targets/app/common/src/UI/All Platforms/IUIScene_BeaconMenu.cpp rename to targets/app/common/UI/All Platforms/IUIScene_BeaconMenu.cpp index 6e84ffe93..ab5330c4b 100644 --- a/targets/app/common/src/UI/All Platforms/IUIScene_BeaconMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_BeaconMenu.cpp @@ -5,8 +5,8 @@ #include #include -#include "app/common/App_enums.h" -#include "app/common/src/UI/All Platforms/IUIScene_AbstractContainerMenu.h" +#include "minecraft/GameEnums.h" +#include "app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h" #include "app/linux/LinuxGame.h" #include "java/InputOutputStream/ByteArrayOutputStream.h" #include "java/InputOutputStream/DataOutputStream.h" diff --git a/targets/app/common/src/UI/All Platforms/IUIScene_BeaconMenu.h b/targets/app/common/UI/All Platforms/IUIScene_BeaconMenu.h similarity index 100% rename from targets/app/common/src/UI/All Platforms/IUIScene_BeaconMenu.h rename to targets/app/common/UI/All Platforms/IUIScene_BeaconMenu.h diff --git a/targets/app/common/src/UI/All Platforms/IUIScene_BrewingMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_BrewingMenu.cpp similarity index 98% rename from targets/app/common/src/UI/All Platforms/IUIScene_BrewingMenu.cpp rename to targets/app/common/UI/All Platforms/IUIScene_BrewingMenu.cpp index 74ba96d52..af0ecd802 100644 --- a/targets/app/common/src/UI/All Platforms/IUIScene_BrewingMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_BrewingMenu.cpp @@ -2,7 +2,7 @@ #include -#include "app/common/src/UI/All Platforms/IUIScene_AbstractContainerMenu.h" +#include "app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h" #include "minecraft/world/inventory/BrewingStandMenu.h" IUIScene_AbstractContainerMenu::ESceneSection diff --git a/targets/app/common/src/UI/All Platforms/IUIScene_BrewingMenu.h b/targets/app/common/UI/All Platforms/IUIScene_BrewingMenu.h similarity index 100% rename from targets/app/common/src/UI/All Platforms/IUIScene_BrewingMenu.h rename to targets/app/common/UI/All Platforms/IUIScene_BrewingMenu.h diff --git a/targets/app/common/src/UI/All Platforms/IUIScene_CommandBlockMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_CommandBlockMenu.cpp similarity index 100% rename from targets/app/common/src/UI/All Platforms/IUIScene_CommandBlockMenu.cpp rename to targets/app/common/UI/All Platforms/IUIScene_CommandBlockMenu.cpp diff --git a/targets/app/common/src/UI/All Platforms/IUIScene_CommandBlockMenu.h b/targets/app/common/UI/All Platforms/IUIScene_CommandBlockMenu.h similarity index 100% rename from targets/app/common/src/UI/All Platforms/IUIScene_CommandBlockMenu.h rename to targets/app/common/UI/All Platforms/IUIScene_CommandBlockMenu.h diff --git a/targets/app/common/src/UI/All Platforms/IUIScene_ContainerMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_ContainerMenu.cpp similarity index 96% rename from targets/app/common/src/UI/All Platforms/IUIScene_ContainerMenu.cpp rename to targets/app/common/UI/All Platforms/IUIScene_ContainerMenu.cpp index a79b99bd7..a533ba16e 100644 --- a/targets/app/common/src/UI/All Platforms/IUIScene_ContainerMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_ContainerMenu.cpp @@ -2,7 +2,7 @@ #include -#include "app/common/src/UI/All Platforms/IUIScene_AbstractContainerMenu.h" +#include "app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h" #include "minecraft/world/inventory/AbstractContainerMenu.h" IUIScene_AbstractContainerMenu::ESceneSection diff --git a/targets/app/common/src/UI/All Platforms/IUIScene_ContainerMenu.h b/targets/app/common/UI/All Platforms/IUIScene_ContainerMenu.h similarity index 100% rename from targets/app/common/src/UI/All Platforms/IUIScene_ContainerMenu.h rename to targets/app/common/UI/All Platforms/IUIScene_ContainerMenu.h diff --git a/targets/app/common/src/UI/All Platforms/IUIScene_CraftingMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp similarity index 99% rename from targets/app/common/src/UI/All Platforms/IUIScene_CraftingMenu.cpp rename to targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp index 2d50f47ca..af15c437d 100644 --- a/targets/app/common/src/UI/All Platforms/IUIScene_CraftingMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp @@ -10,10 +10,10 @@ #include "platform/InputActions.h" #include "platform/sdl2/Profile.h" #include "platform/sdl2/Render.h" -#include "app/common/App_enums.h" -#include "app/common/src/Console_Debug_enum.h" -#include "app/common/src/Tutorial/Tutorial.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" +#include "minecraft/GameEnums.h" +#include "app/common/Console_Debug_enum.h" +#include "app/common/Tutorial/Tutorial.h" +#include "app/common/UI/All Platforms/UIEnums.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "app/linux/Stubs/winapi_stubs.h" diff --git a/targets/app/common/src/UI/All Platforms/IUIScene_CraftingMenu.h b/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.h similarity index 97% rename from targets/app/common/src/UI/All Platforms/IUIScene_CraftingMenu.h rename to targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.h index 76aea9810..a6ee67e14 100644 --- a/targets/app/common/src/UI/All Platforms/IUIScene_CraftingMenu.h +++ b/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.h @@ -1,8 +1,8 @@ #pragma once #include -#include "app/common/src/Tutorial/Tutorial.h" -#include "app/common/src/Tutorial/TutorialEnum.h" +#include "app/common/Tutorial/Tutorial.h" +#include "app/common/Tutorial/TutorialEnum.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/item/crafting/Recipy.h" diff --git a/targets/app/common/src/UI/All Platforms/IUIScene_CreativeMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_CreativeMenu.cpp similarity index 99% rename from targets/app/common/src/UI/All Platforms/IUIScene_CreativeMenu.cpp rename to targets/app/common/UI/All Platforms/IUIScene_CreativeMenu.cpp index a5e701ed2..59233e5dc 100644 --- a/targets/app/common/src/UI/All Platforms/IUIScene_CreativeMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_CreativeMenu.cpp @@ -7,7 +7,7 @@ #include #include "platform/InputActions.h" -#include "app/common/src/UI/All Platforms/IUIScene_AbstractContainerMenu.h" +#include "app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "java/JavaMath.h" diff --git a/targets/app/common/src/UI/All Platforms/IUIScene_CreativeMenu.h b/targets/app/common/UI/All Platforms/IUIScene_CreativeMenu.h similarity index 98% rename from targets/app/common/src/UI/All Platforms/IUIScene_CreativeMenu.h rename to targets/app/common/UI/All Platforms/IUIScene_CreativeMenu.h index 694de8d57..711177cef 100644 --- a/targets/app/common/src/UI/All Platforms/IUIScene_CreativeMenu.h +++ b/targets/app/common/UI/All Platforms/IUIScene_CreativeMenu.h @@ -5,8 +5,8 @@ #include #include "IUIScene_AbstractContainerMenu.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/All Platforms/UIStructs.h" #include "minecraft/world/inventory/AbstractContainerMenu.h" class Inventory; diff --git a/targets/app/common/src/UI/All Platforms/IUIScene_DispenserMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_DispenserMenu.cpp similarity index 96% rename from targets/app/common/src/UI/All Platforms/IUIScene_DispenserMenu.cpp rename to targets/app/common/UI/All Platforms/IUIScene_DispenserMenu.cpp index 9473d9da5..11d6faa4f 100644 --- a/targets/app/common/src/UI/All Platforms/IUIScene_DispenserMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_DispenserMenu.cpp @@ -2,7 +2,7 @@ #include -#include "app/common/src/UI/All Platforms/IUIScene_AbstractContainerMenu.h" +#include "app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h" IUIScene_AbstractContainerMenu::ESceneSection IUIScene_DispenserMenu::GetSectionAndSlotInDirection(ESceneSection eSection, diff --git a/targets/app/common/src/UI/All Platforms/IUIScene_DispenserMenu.h b/targets/app/common/UI/All Platforms/IUIScene_DispenserMenu.h similarity index 100% rename from targets/app/common/src/UI/All Platforms/IUIScene_DispenserMenu.h rename to targets/app/common/UI/All Platforms/IUIScene_DispenserMenu.h diff --git a/targets/app/common/src/UI/All Platforms/IUIScene_EnchantingMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_EnchantingMenu.cpp similarity index 98% rename from targets/app/common/src/UI/All Platforms/IUIScene_EnchantingMenu.cpp rename to targets/app/common/UI/All Platforms/IUIScene_EnchantingMenu.cpp index 517a7e4c5..78533d498 100644 --- a/targets/app/common/src/UI/All Platforms/IUIScene_EnchantingMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_EnchantingMenu.cpp @@ -4,7 +4,7 @@ #include -#include "app/common/src/UI/All Platforms/IUIScene_AbstractContainerMenu.h" +#include "app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" diff --git a/targets/app/common/src/UI/All Platforms/IUIScene_EnchantingMenu.h b/targets/app/common/UI/All Platforms/IUIScene_EnchantingMenu.h similarity index 100% rename from targets/app/common/src/UI/All Platforms/IUIScene_EnchantingMenu.h rename to targets/app/common/UI/All Platforms/IUIScene_EnchantingMenu.h diff --git a/targets/app/common/src/UI/All Platforms/IUIScene_FireworksMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_FireworksMenu.cpp similarity index 98% rename from targets/app/common/src/UI/All Platforms/IUIScene_FireworksMenu.cpp rename to targets/app/common/UI/All Platforms/IUIScene_FireworksMenu.cpp index eca43ef42..fe0b87499 100644 --- a/targets/app/common/src/UI/All Platforms/IUIScene_FireworksMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_FireworksMenu.cpp @@ -2,7 +2,7 @@ #include -#include "app/common/src/UI/All Platforms/IUIScene_AbstractContainerMenu.h" +#include "app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h" #include "minecraft/world/inventory/FireworksMenu.h" IUIScene_AbstractContainerMenu::ESceneSection diff --git a/targets/app/common/src/UI/All Platforms/IUIScene_FireworksMenu.h b/targets/app/common/UI/All Platforms/IUIScene_FireworksMenu.h similarity index 100% rename from targets/app/common/src/UI/All Platforms/IUIScene_FireworksMenu.h rename to targets/app/common/UI/All Platforms/IUIScene_FireworksMenu.h diff --git a/targets/app/common/src/UI/All Platforms/IUIScene_FurnaceMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_FurnaceMenu.cpp similarity index 98% rename from targets/app/common/src/UI/All Platforms/IUIScene_FurnaceMenu.cpp rename to targets/app/common/UI/All Platforms/IUIScene_FurnaceMenu.cpp index 9be58df2a..aee52849f 100644 --- a/targets/app/common/src/UI/All Platforms/IUIScene_FurnaceMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_FurnaceMenu.cpp @@ -2,7 +2,7 @@ #include -#include "app/common/src/UI/All Platforms/IUIScene_AbstractContainerMenu.h" +#include "app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h" #include "minecraft/world/inventory/FurnaceMenu.h" IUIScene_AbstractContainerMenu::ESceneSection diff --git a/targets/app/common/src/UI/All Platforms/IUIScene_FurnaceMenu.h b/targets/app/common/UI/All Platforms/IUIScene_FurnaceMenu.h similarity index 100% rename from targets/app/common/src/UI/All Platforms/IUIScene_FurnaceMenu.h rename to targets/app/common/UI/All Platforms/IUIScene_FurnaceMenu.h diff --git a/targets/app/common/src/UI/All Platforms/IUIScene_HUD.cpp b/targets/app/common/UI/All Platforms/IUIScene_HUD.cpp similarity index 99% rename from targets/app/common/src/UI/All Platforms/IUIScene_HUD.cpp rename to targets/app/common/UI/All Platforms/IUIScene_HUD.cpp index 6aa71f154..f16a119db 100644 --- a/targets/app/common/src/UI/All Platforms/IUIScene_HUD.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_HUD.cpp @@ -5,7 +5,7 @@ #include "platform/sdl2/Profile.h" #include "platform/sdl2/Render.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "java/Class.h" diff --git a/targets/app/common/src/UI/All Platforms/IUIScene_HUD.h b/targets/app/common/UI/All Platforms/IUIScene_HUD.h similarity index 100% rename from targets/app/common/src/UI/All Platforms/IUIScene_HUD.h rename to targets/app/common/UI/All Platforms/IUIScene_HUD.h diff --git a/targets/app/common/src/UI/All Platforms/IUIScene_HopperMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_HopperMenu.cpp similarity index 96% rename from targets/app/common/src/UI/All Platforms/IUIScene_HopperMenu.cpp rename to targets/app/common/UI/All Platforms/IUIScene_HopperMenu.cpp index 6e85a142a..c62940270 100644 --- a/targets/app/common/src/UI/All Platforms/IUIScene_HopperMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_HopperMenu.cpp @@ -2,7 +2,7 @@ #include -#include "app/common/src/UI/All Platforms/IUIScene_AbstractContainerMenu.h" +#include "app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h" #include "minecraft/world/inventory/HopperMenu.h" IUIScene_AbstractContainerMenu::ESceneSection diff --git a/targets/app/common/src/UI/All Platforms/IUIScene_HopperMenu.h b/targets/app/common/UI/All Platforms/IUIScene_HopperMenu.h similarity index 100% rename from targets/app/common/src/UI/All Platforms/IUIScene_HopperMenu.h rename to targets/app/common/UI/All Platforms/IUIScene_HopperMenu.h diff --git a/targets/app/common/src/UI/All Platforms/IUIScene_HorseInventoryMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_HorseInventoryMenu.cpp similarity index 98% rename from targets/app/common/src/UI/All Platforms/IUIScene_HorseInventoryMenu.cpp rename to targets/app/common/UI/All Platforms/IUIScene_HorseInventoryMenu.cpp index 4f5441db1..91aefb70f 100644 --- a/targets/app/common/src/UI/All Platforms/IUIScene_HorseInventoryMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_HorseInventoryMenu.cpp @@ -2,7 +2,7 @@ #include -#include "app/common/src/UI/All Platforms/IUIScene_AbstractContainerMenu.h" +#include "app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h" #include "minecraft/world/entity/animal/EntityHorse.h" IUIScene_AbstractContainerMenu::ESceneSection diff --git a/targets/app/common/src/UI/All Platforms/IUIScene_HorseInventoryMenu.h b/targets/app/common/UI/All Platforms/IUIScene_HorseInventoryMenu.h similarity index 100% rename from targets/app/common/src/UI/All Platforms/IUIScene_HorseInventoryMenu.h rename to targets/app/common/UI/All Platforms/IUIScene_HorseInventoryMenu.h diff --git a/targets/app/common/src/UI/All Platforms/IUIScene_InventoryMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_InventoryMenu.cpp similarity index 96% rename from targets/app/common/src/UI/All Platforms/IUIScene_InventoryMenu.cpp rename to targets/app/common/UI/All Platforms/IUIScene_InventoryMenu.cpp index 57bcdcecb..b3c03fc57 100644 --- a/targets/app/common/src/UI/All Platforms/IUIScene_InventoryMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_InventoryMenu.cpp @@ -2,7 +2,7 @@ #include -#include "app/common/src/UI/All Platforms/IUIScene_AbstractContainerMenu.h" +#include "app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h" #include "minecraft/world/inventory/InventoryMenu.h" IUIScene_AbstractContainerMenu::ESceneSection diff --git a/targets/app/common/src/UI/All Platforms/IUIScene_InventoryMenu.h b/targets/app/common/UI/All Platforms/IUIScene_InventoryMenu.h similarity index 100% rename from targets/app/common/src/UI/All Platforms/IUIScene_InventoryMenu.h rename to targets/app/common/UI/All Platforms/IUIScene_InventoryMenu.h diff --git a/targets/app/common/src/UI/All Platforms/IUIScene_PauseMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.cpp similarity index 98% rename from targets/app/common/src/UI/All Platforms/IUIScene_PauseMenu.cpp rename to targets/app/common/UI/All Platforms/IUIScene_PauseMenu.cpp index bb2e2170e..301b7a922 100644 --- a/targets/app/common/src/UI/All Platforms/IUIScene_PauseMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.cpp @@ -10,12 +10,12 @@ #include #include "platform/sdl2/Profile.h" -#include "app/common/App_enums.h" -#include "app/common/src/DLC/DLCManager.h" -#include "app/common/src/DLC/DLCPack.h" -#include "app/common/src/GameRules/GameRuleManager.h" -#include "app/common/src/Network/GameNetworkManager.h" -#include "app/common/src/UI/UIScene.h" +#include "minecraft/GameEnums.h" +#include "app/common/DLC/DLCManager.h" +#include "app/common/DLC/DLCPack.h" +#include "app/common/GameRules/GameRuleManager.h" +#include "app/common/Network/GameNetworkManager.h" +#include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "app/linux/Stubs/winapi_stubs.h" diff --git a/targets/app/common/src/UI/All Platforms/IUIScene_PauseMenu.h b/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.h similarity index 97% rename from targets/app/common/src/UI/All Platforms/IUIScene_PauseMenu.h rename to targets/app/common/UI/All Platforms/IUIScene_PauseMenu.h index 74ffcdcf0..02a778471 100644 --- a/targets/app/common/src/UI/All Platforms/IUIScene_PauseMenu.h +++ b/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.h @@ -2,7 +2,7 @@ #include "platform/sdl2/Profile.h" #include "platform/sdl2/Storage.h" -#include "app/common/src/DLC/DLCPack.h" +#include "app/common/DLC/DLCPack.h" class DLCPack; diff --git a/targets/app/common/src/UI/All Platforms/IUIScene_TradingMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_TradingMenu.cpp similarity index 99% rename from targets/app/common/src/UI/All Platforms/IUIScene_TradingMenu.cpp rename to targets/app/common/UI/All Platforms/IUIScene_TradingMenu.cpp index 0c7140dab..30f14552d 100644 --- a/targets/app/common/src/UI/All Platforms/IUIScene_TradingMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_TradingMenu.cpp @@ -5,8 +5,8 @@ #include #include "platform/InputActions.h" -#include "app/common/src/Tutorial/Tutorial.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" +#include "app/common/Tutorial/Tutorial.h" +#include "app/common/UI/All Platforms/UIEnums.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "util/StringHelpers.h" diff --git a/targets/app/common/src/UI/All Platforms/IUIScene_TradingMenu.h b/targets/app/common/UI/All Platforms/IUIScene_TradingMenu.h similarity index 95% rename from targets/app/common/src/UI/All Platforms/IUIScene_TradingMenu.h rename to targets/app/common/UI/All Platforms/IUIScene_TradingMenu.h index 266d73070..2d5b01a26 100644 --- a/targets/app/common/src/UI/All Platforms/IUIScene_TradingMenu.h +++ b/targets/app/common/UI/All Platforms/IUIScene_TradingMenu.h @@ -5,8 +5,8 @@ #include #include -#include "app/common/src/Tutorial/Tutorial.h" -#include "app/common/src/Tutorial/TutorialEnum.h" +#include "app/common/Tutorial/Tutorial.h" +#include "app/common/Tutorial/TutorialEnum.h" #include "minecraft/util/HtmlString.h" #include "minecraft/world/inventory/MerchantMenu.h" #include "minecraft/world/item/Rarity.h" diff --git a/targets/app/common/src/UI/All Platforms/UIEnums.h b/targets/app/common/UI/All Platforms/UIEnums.h similarity index 100% rename from targets/app/common/src/UI/All Platforms/UIEnums.h rename to targets/app/common/UI/All Platforms/UIEnums.h diff --git a/targets/app/common/src/UI/All Platforms/UIStructs.h b/targets/app/common/UI/All Platforms/UIStructs.h similarity index 99% rename from targets/app/common/src/UI/All Platforms/UIStructs.h rename to targets/app/common/UI/All Platforms/UIStructs.h index 86561267d..f164eb8ab 100644 --- a/targets/app/common/src/UI/All Platforms/UIStructs.h +++ b/targets/app/common/UI/All Platforms/UIStructs.h @@ -382,13 +382,13 @@ typedef struct _SignInInfo { } SignInInfo; // Credits -typedef struct { +struct SCreditTextItemDef { const wchar_t* m_Text; // Should contain string, optionally with %s to add // in translated string ... e.g. "Andy West - %s" int m_iStringID[2]; // May be NO_TRANSLATED_STRING if we do not require to // add any translated string. ECreditTextTypes m_eType; -} SCreditTextItemDef; +}; // Message box typedef struct _MessageBoxInfo { diff --git a/targets/app/common/src/UI/Components/UIComponent_Chat.cpp b/targets/app/common/UI/Components/UIComponent_Chat.cpp similarity index 96% rename from targets/app/common/src/UI/Components/UIComponent_Chat.cpp rename to targets/app/common/UI/Components/UIComponent_Chat.cpp index 4f4a63493..38310d908 100644 --- a/targets/app/common/src/UI/Components/UIComponent_Chat.cpp +++ b/targets/app/common/UI/Components/UIComponent_Chat.cpp @@ -3,10 +3,10 @@ #include #include "platform/sdl2/Render.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/UILayer.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/UILayer.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Components/UIComponent_Chat.h b/targets/app/common/UI/Components/UIComponent_Chat.h similarity index 92% rename from targets/app/common/src/UI/Components/UIComponent_Chat.h rename to targets/app/common/UI/Components/UIComponent_Chat.h index 1c6c1bd09..85e3439b0 100644 --- a/targets/app/common/src/UI/Components/UIComponent_Chat.h +++ b/targets/app/common/UI/Components/UIComponent_Chat.h @@ -3,10 +3,10 @@ #include #include "platform/sdl2/Render.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" class UILayer; diff --git a/targets/app/common/src/UI/Components/UIComponent_DebugUIConsole.cpp b/targets/app/common/UI/Components/UIComponent_DebugUIConsole.cpp similarity index 91% rename from targets/app/common/src/UI/Components/UIComponent_DebugUIConsole.cpp rename to targets/app/common/UI/Components/UIComponent_DebugUIConsole.cpp index 3332970c3..f3f7eecc2 100644 --- a/targets/app/common/src/UI/Components/UIComponent_DebugUIConsole.cpp +++ b/targets/app/common/UI/Components/UIComponent_DebugUIConsole.cpp @@ -1,7 +1,7 @@ #include "UIComponent_DebugUIConsole.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/UIScene.h" class UILayer; diff --git a/targets/app/common/src/UI/Components/UIComponent_DebugUIConsole.h b/targets/app/common/UI/Components/UIComponent_DebugUIConsole.h similarity index 91% rename from targets/app/common/src/UI/Components/UIComponent_DebugUIConsole.h rename to targets/app/common/UI/Components/UIComponent_DebugUIConsole.h index 9fbb44404..4cf695149 100644 --- a/targets/app/common/src/UI/Components/UIComponent_DebugUIConsole.h +++ b/targets/app/common/UI/Components/UIComponent_DebugUIConsole.h @@ -3,9 +3,9 @@ #include #include -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/UIScene.h" class UILayer; diff --git a/targets/app/common/src/UI/Components/UIComponent_DebugUIMarketingGuide.cpp b/targets/app/common/UI/Components/UIComponent_DebugUIMarketingGuide.cpp similarity index 96% rename from targets/app/common/src/UI/Components/UIComponent_DebugUIMarketingGuide.cpp rename to targets/app/common/UI/Components/UIComponent_DebugUIMarketingGuide.cpp index 68253c8b9..e77fadb7b 100644 --- a/targets/app/common/src/UI/Components/UIComponent_DebugUIMarketingGuide.cpp +++ b/targets/app/common/UI/Components/UIComponent_DebugUIMarketingGuide.cpp @@ -1,6 +1,6 @@ #include "UIComponent_DebugUIMarketingGuide.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Components/UIComponent_DebugUIMarketingGuide.h b/targets/app/common/UI/Components/UIComponent_DebugUIMarketingGuide.h similarity index 88% rename from targets/app/common/src/UI/Components/UIComponent_DebugUIMarketingGuide.h rename to targets/app/common/UI/Components/UIComponent_DebugUIMarketingGuide.h index 180474367..55712fe17 100644 --- a/targets/app/common/src/UI/Components/UIComponent_DebugUIMarketingGuide.h +++ b/targets/app/common/UI/Components/UIComponent_DebugUIMarketingGuide.h @@ -2,9 +2,9 @@ #include -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Components/UIComponent_Logo.cpp b/targets/app/common/UI/Components/UIComponent_Logo.cpp similarity index 92% rename from targets/app/common/src/UI/Components/UIComponent_Logo.cpp rename to targets/app/common/UI/Components/UIComponent_Logo.cpp index a805bf59b..a0db6e84f 100644 --- a/targets/app/common/src/UI/Components/UIComponent_Logo.cpp +++ b/targets/app/common/UI/Components/UIComponent_Logo.cpp @@ -1,8 +1,8 @@ #include "UIComponent_Logo.h" #include "platform/sdl2/Render.h" -#include "app/common/src/UI/UILayer.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/UILayer.h" +#include "app/common/UI/UIScene.h" UIComponent_Logo::UIComponent_Logo(int iPad, void* initData, UILayer* parentLayer) diff --git a/targets/app/common/src/UI/Components/UIComponent_Logo.h b/targets/app/common/UI/Components/UIComponent_Logo.h similarity index 89% rename from targets/app/common/src/UI/Components/UIComponent_Logo.h rename to targets/app/common/UI/Components/UIComponent_Logo.h index 8f0b11757..0a7b4a674 100644 --- a/targets/app/common/src/UI/Components/UIComponent_Logo.h +++ b/targets/app/common/UI/Components/UIComponent_Logo.h @@ -2,8 +2,8 @@ #include -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/UIScene.h" class UILayer; diff --git a/targets/app/common/src/UI/Components/UIComponent_MenuBackground.cpp b/targets/app/common/UI/Components/UIComponent_MenuBackground.cpp similarity index 98% rename from targets/app/common/src/UI/Components/UIComponent_MenuBackground.cpp rename to targets/app/common/UI/Components/UIComponent_MenuBackground.cpp index a6e5640ea..7d9f6b9bc 100644 --- a/targets/app/common/src/UI/Components/UIComponent_MenuBackground.cpp +++ b/targets/app/common/UI/Components/UIComponent_MenuBackground.cpp @@ -1,8 +1,8 @@ #include "UIComponent_MenuBackground.h" #include "platform/sdl2/Render.h" -#include "app/common/src/UI/UILayer.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/UILayer.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Components/UIComponent_MenuBackground.h b/targets/app/common/UI/Components/UIComponent_MenuBackground.h similarity index 91% rename from targets/app/common/src/UI/Components/UIComponent_MenuBackground.h rename to targets/app/common/UI/Components/UIComponent_MenuBackground.h index 1d57c5fdd..c22bc08bf 100644 --- a/targets/app/common/src/UI/Components/UIComponent_MenuBackground.h +++ b/targets/app/common/UI/Components/UIComponent_MenuBackground.h @@ -3,8 +3,8 @@ #include #include "platform/sdl2/Render.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" class UILayer; diff --git a/targets/app/common/src/UI/Components/UIComponent_Panorama.cpp b/targets/app/common/UI/Components/UIComponent_Panorama.cpp similarity index 98% rename from targets/app/common/src/UI/Components/UIComponent_Panorama.cpp rename to targets/app/common/UI/Components/UIComponent_Panorama.cpp index cc449f243..ca284e743 100644 --- a/targets/app/common/src/UI/Components/UIComponent_Panorama.cpp +++ b/targets/app/common/UI/Components/UIComponent_Panorama.cpp @@ -5,8 +5,8 @@ #include #include "platform/sdl2/Render.h" -#include "app/common/src/UI/UILayer.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/UILayer.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Components/UIComponent_Panorama.h b/targets/app/common/UI/Components/UIComponent_Panorama.h similarity index 92% rename from targets/app/common/src/UI/Components/UIComponent_Panorama.h rename to targets/app/common/UI/Components/UIComponent_Panorama.h index 43c761321..798cb339d 100644 --- a/targets/app/common/src/UI/Components/UIComponent_Panorama.h +++ b/targets/app/common/UI/Components/UIComponent_Panorama.h @@ -3,8 +3,8 @@ #include #include "platform/sdl2/Render.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Components/UIComponent_PressStartToPlay.cpp b/targets/app/common/UI/Components/UIComponent_PressStartToPlay.cpp similarity index 97% rename from targets/app/common/src/UI/Components/UIComponent_PressStartToPlay.cpp rename to targets/app/common/UI/Components/UIComponent_PressStartToPlay.cpp index 8f1610125..6460c46dc 100644 --- a/targets/app/common/src/UI/Components/UIComponent_PressStartToPlay.cpp +++ b/targets/app/common/UI/Components/UIComponent_PressStartToPlay.cpp @@ -1,7 +1,7 @@ #include "UIComponent_PressStartToPlay.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "strings.h" diff --git a/targets/app/common/src/UI/Components/UIComponent_PressStartToPlay.h b/targets/app/common/UI/Components/UIComponent_PressStartToPlay.h similarity index 91% rename from targets/app/common/src/UI/Components/UIComponent_PressStartToPlay.h rename to targets/app/common/UI/Components/UIComponent_PressStartToPlay.h index ca52c2a6f..14d434132 100644 --- a/targets/app/common/src/UI/Components/UIComponent_PressStartToPlay.h +++ b/targets/app/common/UI/Components/UIComponent_PressStartToPlay.h @@ -3,10 +3,10 @@ #include #include "platform/PlatformTypes.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Components/UIComponent_Tooltips.cpp b/targets/app/common/UI/Components/UIComponent_Tooltips.cpp similarity index 98% rename from targets/app/common/src/UI/Components/UIComponent_Tooltips.cpp rename to targets/app/common/UI/Components/UIComponent_Tooltips.cpp index 59bb96ffe..0014b18d3 100644 --- a/targets/app/common/src/UI/Components/UIComponent_Tooltips.cpp +++ b/targets/app/common/UI/Components/UIComponent_Tooltips.cpp @@ -2,11 +2,11 @@ #include "platform/sdl2/Profile.h" #include "platform/sdl2/Render.h" -#include "app/common/App_enums.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/UILayer.h" -#include "app/common/src/UI/UIScene.h" -#include "app/common/src/UI/UIString.h" +#include "minecraft/GameEnums.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/UILayer.h" +#include "app/common/UI/UIScene.h" +#include "app/common/UI/UIString.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Components/UIComponent_Tooltips.h b/targets/app/common/UI/Components/UIComponent_Tooltips.h similarity index 94% rename from targets/app/common/src/UI/Components/UIComponent_Tooltips.h rename to targets/app/common/UI/Components/UIComponent_Tooltips.h index dc263cddb..e07969066 100644 --- a/targets/app/common/src/UI/Components/UIComponent_Tooltips.h +++ b/targets/app/common/UI/Components/UIComponent_Tooltips.h @@ -5,10 +5,10 @@ #include "platform/PlatformTypes.h" #include "platform/InputActions.h" #include "platform/sdl2/Render.h" -#include "app/common/App_enums.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/UIScene.h" -#include "app/common/src/UI/UIString.h" +#include "minecraft/GameEnums.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/UIScene.h" +#include "app/common/UI/UIString.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Components/UIComponent_TutorialPopup.cpp b/targets/app/common/UI/Components/UIComponent_TutorialPopup.cpp similarity index 98% rename from targets/app/common/src/UI/Components/UIComponent_TutorialPopup.cpp rename to targets/app/common/UI/Components/UIComponent_TutorialPopup.cpp index 69a1d1e44..254070b62 100644 --- a/targets/app/common/src/UI/Components/UIComponent_TutorialPopup.cpp +++ b/targets/app/common/UI/Components/UIComponent_TutorialPopup.cpp @@ -5,12 +5,12 @@ #include #include "platform/sdl2/Profile.h" -#include "app/common/App_enums.h" -#include "app/common/src/Tutorial/Tutorial.h" -#include "app/common/src/Tutorial/TutorialEnum.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/UILayer.h" -#include "app/common/src/UI/UIScene.h" +#include "minecraft/GameEnums.h" +#include "app/common/Tutorial/Tutorial.h" +#include "app/common/Tutorial/TutorialEnum.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/UILayer.h" +#include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "util/StringHelpers.h" diff --git a/targets/app/common/src/UI/Components/UIComponent_TutorialPopup.h b/targets/app/common/UI/Components/UIComponent_TutorialPopup.h similarity index 93% rename from targets/app/common/src/UI/Components/UIComponent_TutorialPopup.h rename to targets/app/common/UI/Components/UIComponent_TutorialPopup.h index 82735f1da..c594f213f 100644 --- a/targets/app/common/src/UI/Components/UIComponent_TutorialPopup.h +++ b/targets/app/common/UI/Components/UIComponent_TutorialPopup.h @@ -4,11 +4,11 @@ #include #include "platform/sdl2/Render.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Components/UIScene_HUD.cpp b/targets/app/common/UI/Components/UIScene_HUD.cpp similarity index 99% rename from targets/app/common/src/UI/Components/UIScene_HUD.cpp rename to targets/app/common/UI/Components/UIScene_HUD.cpp index 448567cf9..1af9a6776 100644 --- a/targets/app/common/src/UI/Components/UIScene_HUD.cpp +++ b/targets/app/common/UI/Components/UIScene_HUD.cpp @@ -5,11 +5,11 @@ #include #include "platform/sdl2/Profile.h" -#include "app/common/App_enums.h" -#include "app/common/src/UI/Components/UIComponent_Chat.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/UILayer.h" -#include "app/common/src/UI/UIScene.h" +#include "minecraft/GameEnums.h" +#include "app/common/UI/Components/UIComponent_Chat.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/UILayer.h" +#include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "util/StringHelpers.h" diff --git a/targets/app/common/src/UI/Components/UIScene_HUD.h b/targets/app/common/UI/Components/UIScene_HUD.h similarity index 96% rename from targets/app/common/src/UI/Components/UIScene_HUD.h rename to targets/app/common/UI/Components/UIScene_HUD.h index a565b1da0..9be484b44 100644 --- a/targets/app/common/src/UI/Components/UIScene_HUD.h +++ b/targets/app/common/UI/Components/UIScene_HUD.h @@ -3,11 +3,11 @@ #include #include "platform/sdl2/Render.h" -#include "app/common/src/UI/All Platforms/IUIScene_HUD.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/IUIScene_HUD.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Controls/UIControl.cpp b/targets/app/common/UI/Controls/UIControl.cpp similarity index 99% rename from targets/app/common/src/UI/Controls/UIControl.cpp rename to targets/app/common/UI/Controls/UIControl.cpp index 2982ca3ca..f7227d1da 100644 --- a/targets/app/common/src/UI/Controls/UIControl.cpp +++ b/targets/app/common/UI/Controls/UIControl.cpp @@ -1,6 +1,6 @@ #include "UIControl.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Controls/UIControl.h b/targets/app/common/UI/Controls/UIControl.h similarity index 100% rename from targets/app/common/src/UI/Controls/UIControl.h rename to targets/app/common/UI/Controls/UIControl.h diff --git a/targets/app/common/src/UI/Controls/UIControl_Base.cpp b/targets/app/common/UI/Controls/UIControl_Base.cpp similarity index 95% rename from targets/app/common/src/UI/Controls/UIControl_Base.cpp rename to targets/app/common/UI/Controls/UIControl_Base.cpp index c812d2871..633dda49c 100644 --- a/targets/app/common/src/UI/Controls/UIControl_Base.cpp +++ b/targets/app/common/UI/Controls/UIControl_Base.cpp @@ -1,11 +1,11 @@ -#include "app/common/src/UI/Controls/UIControl_Base.h" +#include "app/common/UI/Controls/UIControl_Base.h" #include #include -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/UIScene.h" -#include "app/common/src/UI/UIString.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/UIScene.h" +#include "app/common/UI/UIString.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Controls/UIControl_Base.h b/targets/app/common/UI/Controls/UIControl_Base.h similarity index 89% rename from targets/app/common/src/UI/Controls/UIControl_Base.h rename to targets/app/common/UI/Controls/UIControl_Base.h index 352a88ab0..5864e86e8 100644 --- a/targets/app/common/src/UI/Controls/UIControl_Base.h +++ b/targets/app/common/UI/Controls/UIControl_Base.h @@ -2,9 +2,9 @@ #include -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/UIScene.h" -#include "app/common/src/UI/UIString.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/UIScene.h" +#include "app/common/UI/UIString.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Controls/UIControl_BeaconEffectButton.cpp b/targets/app/common/UI/Controls/UIControl_BeaconEffectButton.cpp similarity index 96% rename from targets/app/common/src/UI/Controls/UIControl_BeaconEffectButton.cpp rename to targets/app/common/UI/Controls/UIControl_BeaconEffectButton.cpp index ed88a0bc9..87e8ea1b5 100644 --- a/targets/app/common/src/UI/Controls/UIControl_BeaconEffectButton.cpp +++ b/targets/app/common/UI/Controls/UIControl_BeaconEffectButton.cpp @@ -1,7 +1,7 @@ #include "UIControl_BeaconEffectButton.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Controls/UIControl_BeaconEffectButton.h b/targets/app/common/UI/Controls/UIControl_BeaconEffectButton.h similarity index 88% rename from targets/app/common/src/UI/Controls/UIControl_BeaconEffectButton.h rename to targets/app/common/UI/Controls/UIControl_BeaconEffectButton.h index eb4db2422..bdc889568 100644 --- a/targets/app/common/src/UI/Controls/UIControl_BeaconEffectButton.h +++ b/targets/app/common/UI/Controls/UIControl_BeaconEffectButton.h @@ -2,9 +2,9 @@ #include -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_BeaconEffectButton.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_BeaconEffectButton.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Controls/UIControl_BitmapIcon.cpp b/targets/app/common/UI/Controls/UIControl_BitmapIcon.cpp similarity index 93% rename from targets/app/common/src/UI/Controls/UIControl_BitmapIcon.cpp rename to targets/app/common/UI/Controls/UIControl_BitmapIcon.cpp index a7237bdd3..d80955019 100644 --- a/targets/app/common/src/UI/Controls/UIControl_BitmapIcon.cpp +++ b/targets/app/common/UI/Controls/UIControl_BitmapIcon.cpp @@ -1,7 +1,7 @@ #include "UIControl_BitmapIcon.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Controls/UIControl_BitmapIcon.h b/targets/app/common/UI/Controls/UIControl_BitmapIcon.h similarity index 75% rename from targets/app/common/src/UI/Controls/UIControl_BitmapIcon.h rename to targets/app/common/UI/Controls/UIControl_BitmapIcon.h index f6b037a59..8a455b1f5 100644 --- a/targets/app/common/src/UI/Controls/UIControl_BitmapIcon.h +++ b/targets/app/common/UI/Controls/UIControl_BitmapIcon.h @@ -2,9 +2,9 @@ #include -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_BitmapIcon.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_BitmapIcon.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Controls/UIControl_Button.cpp b/targets/app/common/UI/Controls/UIControl_Button.cpp similarity index 90% rename from targets/app/common/src/UI/Controls/UIControl_Button.cpp rename to targets/app/common/UI/Controls/UIControl_Button.cpp index 425c11143..99965b371 100644 --- a/targets/app/common/src/UI/Controls/UIControl_Button.cpp +++ b/targets/app/common/UI/Controls/UIControl_Button.cpp @@ -1,9 +1,9 @@ #include "UIControl_Button.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_Base.h" -#include "app/common/src/UI/UIScene.h" -#include "app/common/src/UI/UIString.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_Base.h" +#include "app/common/UI/UIScene.h" +#include "app/common/UI/UIString.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Controls/UIControl_Button.h b/targets/app/common/UI/Controls/UIControl_Button.h similarity index 76% rename from targets/app/common/src/UI/Controls/UIControl_Button.h rename to targets/app/common/UI/Controls/UIControl_Button.h index 54260d16a..f595550bf 100644 --- a/targets/app/common/src/UI/Controls/UIControl_Button.h +++ b/targets/app/common/UI/Controls/UIControl_Button.h @@ -2,10 +2,10 @@ #include -#include "app/common/src/UI/Controls/UIControl_Base.h" -#include "app/common/src/UI/Controls/UIControl_Button.h" -#include "app/common/src/UI/UIScene.h" -#include "app/common/src/UI/UIString.h" +#include "app/common/UI/Controls/UIControl_Base.h" +#include "app/common/UI/Controls/UIControl_Button.h" +#include "app/common/UI/UIScene.h" +#include "app/common/UI/UIString.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Controls/UIControl_ButtonList.cpp b/targets/app/common/UI/Controls/UIControl_ButtonList.cpp similarity index 97% rename from targets/app/common/src/UI/Controls/UIControl_ButtonList.cpp rename to targets/app/common/UI/Controls/UIControl_ButtonList.cpp index 84339ec2d..6c77ce52e 100644 --- a/targets/app/common/src/UI/Controls/UIControl_ButtonList.cpp +++ b/targets/app/common/UI/Controls/UIControl_ButtonList.cpp @@ -1,9 +1,9 @@ #include "UIControl_ButtonList.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_Base.h" -#include "app/common/src/UI/UIScene.h" -#include "app/common/src/UI/UIString.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_Base.h" +#include "app/common/UI/UIScene.h" +#include "app/common/UI/UIString.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Controls/UIControl_ButtonList.h b/targets/app/common/UI/Controls/UIControl_ButtonList.h similarity index 88% rename from targets/app/common/src/UI/Controls/UIControl_ButtonList.h rename to targets/app/common/UI/Controls/UIControl_ButtonList.h index 144cff072..313a6b287 100644 --- a/targets/app/common/src/UI/Controls/UIControl_ButtonList.h +++ b/targets/app/common/UI/Controls/UIControl_ButtonList.h @@ -3,10 +3,10 @@ #include #include -#include "app/common/src/UI/Controls/UIControl_Base.h" -#include "app/common/src/UI/Controls/UIControl_ButtonList.h" -#include "app/common/src/UI/UIScene.h" -#include "app/common/src/UI/UIString.h" +#include "app/common/UI/Controls/UIControl_Base.h" +#include "app/common/UI/Controls/UIControl_ButtonList.h" +#include "app/common/UI/UIScene.h" +#include "app/common/UI/UIString.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Controls/UIControl_CheckBox.cpp b/targets/app/common/UI/Controls/UIControl_CheckBox.cpp similarity index 94% rename from targets/app/common/src/UI/Controls/UIControl_CheckBox.cpp rename to targets/app/common/UI/Controls/UIControl_CheckBox.cpp index a0432ba01..6ec876a55 100644 --- a/targets/app/common/src/UI/Controls/UIControl_CheckBox.cpp +++ b/targets/app/common/UI/Controls/UIControl_CheckBox.cpp @@ -1,9 +1,9 @@ #include "UIControl_CheckBox.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_Base.h" -#include "app/common/src/UI/UIScene.h" -#include "app/common/src/UI/UIString.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_Base.h" +#include "app/common/UI/UIScene.h" +#include "app/common/UI/UIString.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Controls/UIControl_CheckBox.h b/targets/app/common/UI/Controls/UIControl_CheckBox.h similarity index 79% rename from targets/app/common/src/UI/Controls/UIControl_CheckBox.h rename to targets/app/common/UI/Controls/UIControl_CheckBox.h index 3c846d90a..da891a56b 100644 --- a/targets/app/common/src/UI/Controls/UIControl_CheckBox.h +++ b/targets/app/common/UI/Controls/UIControl_CheckBox.h @@ -2,10 +2,10 @@ #include -#include "app/common/src/UI/Controls/UIControl_Base.h" -#include "app/common/src/UI/Controls/UIControl_CheckBox.h" -#include "app/common/src/UI/UIScene.h" -#include "app/common/src/UI/UIString.h" +#include "app/common/UI/Controls/UIControl_Base.h" +#include "app/common/UI/Controls/UIControl_CheckBox.h" +#include "app/common/UI/UIScene.h" +#include "app/common/UI/UIString.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Controls/UIControl_Cursor.cpp b/targets/app/common/UI/Controls/UIControl_Cursor.cpp similarity index 83% rename from targets/app/common/src/UI/Controls/UIControl_Cursor.cpp rename to targets/app/common/UI/Controls/UIControl_Cursor.cpp index 74a8b0c3e..3a5c44f4b 100644 --- a/targets/app/common/src/UI/Controls/UIControl_Cursor.cpp +++ b/targets/app/common/UI/Controls/UIControl_Cursor.cpp @@ -1,7 +1,7 @@ #include "UIControl_Cursor.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_Base.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_Base.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Controls/UIControl_Cursor.h b/targets/app/common/UI/Controls/UIControl_Cursor.h similarity index 71% rename from targets/app/common/src/UI/Controls/UIControl_Cursor.h rename to targets/app/common/UI/Controls/UIControl_Cursor.h index 353bff3b8..8488628d0 100644 --- a/targets/app/common/src/UI/Controls/UIControl_Cursor.h +++ b/targets/app/common/UI/Controls/UIControl_Cursor.h @@ -2,9 +2,9 @@ #include -#include "app/common/src/UI/Controls/UIControl_Base.h" -#include "app/common/src/UI/Controls/UIControl_Cursor.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/Controls/UIControl_Base.h" +#include "app/common/UI/Controls/UIControl_Cursor.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Controls/UIControl_DLCList.cpp b/targets/app/common/UI/Controls/UIControl_DLCList.cpp similarity index 94% rename from targets/app/common/src/UI/Controls/UIControl_DLCList.cpp rename to targets/app/common/UI/Controls/UIControl_DLCList.cpp index 6f135eb02..3ce5ae42f 100644 --- a/targets/app/common/src/UI/Controls/UIControl_DLCList.cpp +++ b/targets/app/common/UI/Controls/UIControl_DLCList.cpp @@ -1,8 +1,8 @@ #include "UIControl_DLCList.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_ButtonList.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_ButtonList.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Controls/UIControl_DLCList.h b/targets/app/common/UI/Controls/UIControl_DLCList.h similarity index 86% rename from targets/app/common/src/UI/Controls/UIControl_DLCList.h rename to targets/app/common/UI/Controls/UIControl_DLCList.h index 959be49ce..63cdb375c 100644 --- a/targets/app/common/src/UI/Controls/UIControl_DLCList.h +++ b/targets/app/common/UI/Controls/UIControl_DLCList.h @@ -2,8 +2,8 @@ #include -#include "app/common/src/UI/Controls/UIControl_DLCList.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/Controls/UIControl_DLCList.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Controls/UIControl_DynamicLabel.cpp b/targets/app/common/UI/Controls/UIControl_DynamicLabel.cpp similarity index 95% rename from targets/app/common/src/UI/Controls/UIControl_DynamicLabel.cpp rename to targets/app/common/UI/Controls/UIControl_DynamicLabel.cpp index e376f9e76..1c4aac7a9 100644 --- a/targets/app/common/src/UI/Controls/UIControl_DynamicLabel.cpp +++ b/targets/app/common/UI/Controls/UIControl_DynamicLabel.cpp @@ -1,8 +1,8 @@ #include "UIControl_DynamicLabel.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_Base.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_Base.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Controls/UIControl_DynamicLabel.h b/targets/app/common/UI/Controls/UIControl_DynamicLabel.h similarity index 83% rename from targets/app/common/src/UI/Controls/UIControl_DynamicLabel.h rename to targets/app/common/UI/Controls/UIControl_DynamicLabel.h index f715db092..987c589cd 100644 --- a/targets/app/common/src/UI/Controls/UIControl_DynamicLabel.h +++ b/targets/app/common/UI/Controls/UIControl_DynamicLabel.h @@ -2,9 +2,9 @@ #include -#include "app/common/src/UI/Controls/UIControl_DynamicLabel.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/Controls/UIControl_DynamicLabel.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Controls/UIControl_EnchantmentBook.cpp b/targets/app/common/UI/Controls/UIControl_EnchantmentBook.cpp similarity index 96% rename from targets/app/common/src/UI/Controls/UIControl_EnchantmentBook.cpp rename to targets/app/common/UI/Controls/UIControl_EnchantmentBook.cpp index 4942d20ea..be543ad91 100644 --- a/targets/app/common/src/UI/Controls/UIControl_EnchantmentBook.cpp +++ b/targets/app/common/UI/Controls/UIControl_EnchantmentBook.cpp @@ -3,8 +3,8 @@ #include #include "platform/sdl2/Render.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Controls/UIControl_EnchantmentBook.h b/targets/app/common/UI/Controls/UIControl_EnchantmentBook.h similarity index 83% rename from targets/app/common/src/UI/Controls/UIControl_EnchantmentBook.h rename to targets/app/common/UI/Controls/UIControl_EnchantmentBook.h index eab4e9c59..31e0ff88d 100644 --- a/targets/app/common/src/UI/Controls/UIControl_EnchantmentBook.h +++ b/targets/app/common/UI/Controls/UIControl_EnchantmentBook.h @@ -2,9 +2,9 @@ #include -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_EnchantmentBook.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_EnchantmentBook.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Controls/UIControl_EnchantmentButton.cpp b/targets/app/common/UI/Controls/UIControl_EnchantmentButton.cpp similarity index 96% rename from targets/app/common/src/UI/Controls/UIControl_EnchantmentButton.cpp rename to targets/app/common/UI/Controls/UIControl_EnchantmentButton.cpp index 8822b5972..d62242c7a 100644 --- a/targets/app/common/src/UI/Controls/UIControl_EnchantmentButton.cpp +++ b/targets/app/common/UI/Controls/UIControl_EnchantmentButton.cpp @@ -6,11 +6,11 @@ #include #include "platform/sdl2/Render.h" -#include "app/common/App_enums.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_Button.h" -#include "app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.h" -#include "app/common/src/UI/UIScene.h" +#include "minecraft/GameEnums.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_Button.h" +#include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Controls/UIControl_EnchantmentButton.h b/targets/app/common/UI/Controls/UIControl_EnchantmentButton.h similarity index 92% rename from targets/app/common/src/UI/Controls/UIControl_EnchantmentButton.h rename to targets/app/common/UI/Controls/UIControl_EnchantmentButton.h index 7be2c5825..ffacbf700 100644 --- a/targets/app/common/src/UI/Controls/UIControl_EnchantmentButton.h +++ b/targets/app/common/UI/Controls/UIControl_EnchantmentButton.h @@ -3,8 +3,8 @@ #include #include -#include "app/common/src/UI/Controls/UIControl_EnchantmentButton.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/Controls/UIControl_EnchantmentButton.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Controls/UIControl_HTMLLabel.cpp b/targets/app/common/UI/Controls/UIControl_HTMLLabel.cpp similarity index 95% rename from targets/app/common/src/UI/Controls/UIControl_HTMLLabel.cpp rename to targets/app/common/UI/Controls/UIControl_HTMLLabel.cpp index 79f783cb5..52e2d887b 100644 --- a/targets/app/common/src/UI/Controls/UIControl_HTMLLabel.cpp +++ b/targets/app/common/UI/Controls/UIControl_HTMLLabel.cpp @@ -1,8 +1,8 @@ #include "UIControl_HTMLLabel.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_Base.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_Base.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Controls/UIControl_HTMLLabel.h b/targets/app/common/UI/Controls/UIControl_HTMLLabel.h similarity index 79% rename from targets/app/common/src/UI/Controls/UIControl_HTMLLabel.h rename to targets/app/common/UI/Controls/UIControl_HTMLLabel.h index 5267e2386..eb2d4319c 100644 --- a/targets/app/common/src/UI/Controls/UIControl_HTMLLabel.h +++ b/targets/app/common/UI/Controls/UIControl_HTMLLabel.h @@ -2,10 +2,10 @@ #include -#include "app/common/src/UI/Controls/UIControl_Base.h" -#include "app/common/src/UI/Controls/UIControl_HTMLLabel.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/Controls/UIControl_Base.h" +#include "app/common/UI/Controls/UIControl_HTMLLabel.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Controls/UIControl_Label.cpp b/targets/app/common/UI/Controls/UIControl_Label.cpp similarity index 87% rename from targets/app/common/src/UI/Controls/UIControl_Label.cpp rename to targets/app/common/UI/Controls/UIControl_Label.cpp index bc8e883c2..81d14ebd8 100644 --- a/targets/app/common/src/UI/Controls/UIControl_Label.cpp +++ b/targets/app/common/UI/Controls/UIControl_Label.cpp @@ -1,9 +1,9 @@ #include "UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_Base.h" -#include "app/common/src/UI/UIScene.h" -#include "app/common/src/UI/UIString.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_Base.h" +#include "app/common/UI/UIScene.h" +#include "app/common/UI/UIString.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Controls/UIControl_Label.h b/targets/app/common/UI/Controls/UIControl_Label.h similarity index 74% rename from targets/app/common/src/UI/Controls/UIControl_Label.h rename to targets/app/common/UI/Controls/UIControl_Label.h index fa4d935b6..ff2e86f00 100644 --- a/targets/app/common/src/UI/Controls/UIControl_Label.h +++ b/targets/app/common/UI/Controls/UIControl_Label.h @@ -2,10 +2,10 @@ #include -#include "app/common/src/UI/Controls/UIControl_Base.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/UIScene.h" -#include "app/common/src/UI/UIString.h" +#include "app/common/UI/Controls/UIControl_Base.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/UIScene.h" +#include "app/common/UI/UIString.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Controls/UIControl_LeaderboardList.cpp b/targets/app/common/UI/Controls/UIControl_LeaderboardList.cpp similarity index 98% rename from targets/app/common/src/UI/Controls/UIControl_LeaderboardList.cpp rename to targets/app/common/UI/Controls/UIControl_LeaderboardList.cpp index 182ebd80b..cae041698 100644 --- a/targets/app/common/src/UI/Controls/UIControl_LeaderboardList.cpp +++ b/targets/app/common/UI/Controls/UIControl_LeaderboardList.cpp @@ -1,8 +1,8 @@ #include "UIControl_LeaderboardList.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_Base.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_Base.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Controls/UIControl_LeaderboardList.h b/targets/app/common/UI/Controls/UIControl_LeaderboardList.h similarity index 91% rename from targets/app/common/src/UI/Controls/UIControl_LeaderboardList.h rename to targets/app/common/UI/Controls/UIControl_LeaderboardList.h index 09b0ac687..d6a1feb56 100644 --- a/targets/app/common/src/UI/Controls/UIControl_LeaderboardList.h +++ b/targets/app/common/UI/Controls/UIControl_LeaderboardList.h @@ -2,9 +2,9 @@ #include -#include "app/common/src/UI/Controls/UIControl_Base.h" -#include "app/common/src/UI/Controls/UIControl_LeaderboardList.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/Controls/UIControl_Base.h" +#include "app/common/UI/Controls/UIControl_LeaderboardList.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Controls/UIControl_MinecraftHorse.cpp b/targets/app/common/UI/Controls/UIControl_MinecraftHorse.cpp similarity index 94% rename from targets/app/common/src/UI/Controls/UIControl_MinecraftHorse.cpp rename to targets/app/common/UI/Controls/UIControl_MinecraftHorse.cpp index b785e2a02..046a5b163 100644 --- a/targets/app/common/src/UI/Controls/UIControl_MinecraftHorse.cpp +++ b/targets/app/common/UI/Controls/UIControl_MinecraftHorse.cpp @@ -1,4 +1,4 @@ -#include "app/common/src/UI/Controls/UIControl_MinecraftHorse.h" +#include "app/common/UI/Controls/UIControl_MinecraftHorse.h" #include @@ -6,8 +6,8 @@ #include #include "platform/sdl2/Render.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Controls/UIControl_MinecraftHorse.h b/targets/app/common/UI/Controls/UIControl_MinecraftHorse.h similarity index 85% rename from targets/app/common/src/UI/Controls/UIControl_MinecraftHorse.h rename to targets/app/common/UI/Controls/UIControl_MinecraftHorse.h index 8aea1d504..31e824f60 100644 --- a/targets/app/common/src/UI/Controls/UIControl_MinecraftHorse.h +++ b/targets/app/common/UI/Controls/UIControl_MinecraftHorse.h @@ -1,6 +1,6 @@ #pragma once -#include "app/common/src/UI/Controls/UIControl_MinecraftHorse.h" +#include "app/common/UI/Controls/UIControl_MinecraftHorse.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Controls/UIControl_MinecraftPlayer.cpp b/targets/app/common/UI/Controls/UIControl_MinecraftPlayer.cpp similarity index 96% rename from targets/app/common/src/UI/Controls/UIControl_MinecraftPlayer.cpp rename to targets/app/common/UI/Controls/UIControl_MinecraftPlayer.cpp index 4a025068b..32a866138 100644 --- a/targets/app/common/src/UI/Controls/UIControl_MinecraftPlayer.cpp +++ b/targets/app/common/UI/Controls/UIControl_MinecraftPlayer.cpp @@ -6,8 +6,8 @@ #include #include "platform/sdl2/Render.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Controls/UIControl_MinecraftPlayer.h b/targets/app/common/UI/Controls/UIControl_MinecraftPlayer.h similarity index 85% rename from targets/app/common/src/UI/Controls/UIControl_MinecraftPlayer.h rename to targets/app/common/UI/Controls/UIControl_MinecraftPlayer.h index 341d161bf..89d94f366 100644 --- a/targets/app/common/src/UI/Controls/UIControl_MinecraftPlayer.h +++ b/targets/app/common/UI/Controls/UIControl_MinecraftPlayer.h @@ -1,6 +1,6 @@ #pragma once -#include "app/common/src/UI/Controls/UIControl_MinecraftPlayer.h" +#include "app/common/UI/Controls/UIControl_MinecraftPlayer.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Controls/UIControl_PlayerList.cpp b/targets/app/common/UI/Controls/UIControl_PlayerList.cpp similarity index 94% rename from targets/app/common/src/UI/Controls/UIControl_PlayerList.cpp rename to targets/app/common/UI/Controls/UIControl_PlayerList.cpp index e62ba1e9b..80bb89d99 100644 --- a/targets/app/common/src/UI/Controls/UIControl_PlayerList.cpp +++ b/targets/app/common/UI/Controls/UIControl_PlayerList.cpp @@ -1,8 +1,8 @@ #include "UIControl_PlayerList.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_ButtonList.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_ButtonList.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Controls/UIControl_PlayerList.h b/targets/app/common/UI/Controls/UIControl_PlayerList.h similarity index 86% rename from targets/app/common/src/UI/Controls/UIControl_PlayerList.h rename to targets/app/common/UI/Controls/UIControl_PlayerList.h index 714eef50d..ab2a7a954 100644 --- a/targets/app/common/src/UI/Controls/UIControl_PlayerList.h +++ b/targets/app/common/UI/Controls/UIControl_PlayerList.h @@ -2,8 +2,8 @@ #include -#include "app/common/src/UI/Controls/UIControl_PlayerList.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/Controls/UIControl_PlayerList.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Controls/UIControl_PlayerSkinPreview.cpp b/targets/app/common/UI/Controls/UIControl_PlayerSkinPreview.cpp similarity index 99% rename from targets/app/common/src/UI/Controls/UIControl_PlayerSkinPreview.cpp rename to targets/app/common/UI/Controls/UIControl_PlayerSkinPreview.cpp index 0684d7c3f..a8672eb73 100644 --- a/targets/app/common/src/UI/Controls/UIControl_PlayerSkinPreview.cpp +++ b/targets/app/common/UI/Controls/UIControl_PlayerSkinPreview.cpp @@ -7,8 +7,8 @@ #include #include "platform/sdl2/Render.h" -#include "app/common/App_enums.h" -#include "app/common/src/UI/Controls/UIControl.h" +#include "minecraft/GameEnums.h" +#include "app/common/UI/Controls/UIControl.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Controls/UIControl_PlayerSkinPreview.h b/targets/app/common/UI/Controls/UIControl_PlayerSkinPreview.h similarity index 97% rename from targets/app/common/src/UI/Controls/UIControl_PlayerSkinPreview.h rename to targets/app/common/UI/Controls/UIControl_PlayerSkinPreview.h index 9d599a52e..6f07238bf 100644 --- a/targets/app/common/src/UI/Controls/UIControl_PlayerSkinPreview.h +++ b/targets/app/common/UI/Controls/UIControl_PlayerSkinPreview.h @@ -5,7 +5,7 @@ #include #include -#include "app/common/src/UI/Controls/UIControl_PlayerSkinPreview.h" +#include "app/common/UI/Controls/UIControl_PlayerSkinPreview.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Controls/UIControl_Progress.cpp b/targets/app/common/UI/Controls/UIControl_Progress.cpp similarity index 93% rename from targets/app/common/src/UI/Controls/UIControl_Progress.cpp rename to targets/app/common/UI/Controls/UIControl_Progress.cpp index 93d81ca0e..7f2a28fd8 100644 --- a/targets/app/common/src/UI/Controls/UIControl_Progress.cpp +++ b/targets/app/common/UI/Controls/UIControl_Progress.cpp @@ -1,9 +1,9 @@ #include "UIControl_Progress.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_Base.h" -#include "app/common/src/UI/UIScene.h" -#include "app/common/src/UI/UIString.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_Base.h" +#include "app/common/UI/UIScene.h" +#include "app/common/UI/UIString.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Controls/UIControl_Progress.h b/targets/app/common/UI/Controls/UIControl_Progress.h similarity index 78% rename from targets/app/common/src/UI/Controls/UIControl_Progress.h rename to targets/app/common/UI/Controls/UIControl_Progress.h index 50b921854..d1a1c4348 100644 --- a/targets/app/common/src/UI/Controls/UIControl_Progress.h +++ b/targets/app/common/UI/Controls/UIControl_Progress.h @@ -2,10 +2,10 @@ #include -#include "app/common/src/UI/Controls/UIControl_Base.h" -#include "app/common/src/UI/Controls/UIControl_Progress.h" -#include "app/common/src/UI/UIScene.h" -#include "app/common/src/UI/UIString.h" +#include "app/common/UI/Controls/UIControl_Base.h" +#include "app/common/UI/Controls/UIControl_Progress.h" +#include "app/common/UI/UIScene.h" +#include "app/common/UI/UIString.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Controls/UIControl_SaveList.cpp b/targets/app/common/UI/Controls/UIControl_SaveList.cpp similarity index 96% rename from targets/app/common/src/UI/Controls/UIControl_SaveList.cpp rename to targets/app/common/UI/Controls/UIControl_SaveList.cpp index 86cd16160..64c8346a2 100644 --- a/targets/app/common/src/UI/Controls/UIControl_SaveList.cpp +++ b/targets/app/common/UI/Controls/UIControl_SaveList.cpp @@ -1,8 +1,8 @@ #include "UIControl_SaveList.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_ButtonList.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_ButtonList.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Controls/UIControl_SaveList.h b/targets/app/common/UI/Controls/UIControl_SaveList.h similarity index 91% rename from targets/app/common/src/UI/Controls/UIControl_SaveList.h rename to targets/app/common/UI/Controls/UIControl_SaveList.h index c6bc50cb5..457943027 100644 --- a/targets/app/common/src/UI/Controls/UIControl_SaveList.h +++ b/targets/app/common/UI/Controls/UIControl_SaveList.h @@ -2,8 +2,8 @@ #include -#include "app/common/src/UI/Controls/UIControl_SaveList.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/Controls/UIControl_SaveList.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Controls/UIControl_Slider.cpp b/targets/app/common/UI/Controls/UIControl_Slider.cpp similarity index 94% rename from targets/app/common/src/UI/Controls/UIControl_Slider.cpp rename to targets/app/common/UI/Controls/UIControl_Slider.cpp index c6dc4fc6c..055d9d1b3 100644 --- a/targets/app/common/src/UI/Controls/UIControl_Slider.cpp +++ b/targets/app/common/UI/Controls/UIControl_Slider.cpp @@ -1,9 +1,9 @@ #include "UIControl_Slider.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_Base.h" -#include "app/common/src/UI/UIScene.h" -#include "app/common/src/UI/UIString.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_Base.h" +#include "app/common/UI/UIScene.h" +#include "app/common/UI/UIString.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Controls/UIControl_Slider.h b/targets/app/common/UI/Controls/UIControl_Slider.h similarity index 84% rename from targets/app/common/src/UI/Controls/UIControl_Slider.h rename to targets/app/common/UI/Controls/UIControl_Slider.h index dd26125eb..5eeab750a 100644 --- a/targets/app/common/src/UI/Controls/UIControl_Slider.h +++ b/targets/app/common/UI/Controls/UIControl_Slider.h @@ -3,10 +3,10 @@ #include #include -#include "app/common/src/UI/Controls/UIControl_Base.h" -#include "app/common/src/UI/Controls/UIControl_Slider.h" -#include "app/common/src/UI/UIScene.h" -#include "app/common/src/UI/UIString.h" +#include "app/common/UI/Controls/UIControl_Base.h" +#include "app/common/UI/Controls/UIControl_Slider.h" +#include "app/common/UI/UIScene.h" +#include "app/common/UI/UIString.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Controls/UIControl_SlotList.cpp b/targets/app/common/UI/Controls/UIControl_SlotList.cpp similarity index 95% rename from targets/app/common/src/UI/Controls/UIControl_SlotList.cpp rename to targets/app/common/UI/Controls/UIControl_SlotList.cpp index b6714e551..4308839e6 100644 --- a/targets/app/common/src/UI/Controls/UIControl_SlotList.cpp +++ b/targets/app/common/UI/Controls/UIControl_SlotList.cpp @@ -1,8 +1,8 @@ #include "UIControl_SlotList.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_Base.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_Base.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Controls/UIControl_SlotList.h b/targets/app/common/UI/Controls/UIControl_SlotList.h similarity index 85% rename from targets/app/common/src/UI/Controls/UIControl_SlotList.h rename to targets/app/common/UI/Controls/UIControl_SlotList.h index 2d470273c..6a77d7608 100644 --- a/targets/app/common/src/UI/Controls/UIControl_SlotList.h +++ b/targets/app/common/UI/Controls/UIControl_SlotList.h @@ -2,9 +2,9 @@ #include -#include "app/common/src/UI/Controls/UIControl_Base.h" -#include "app/common/src/UI/Controls/UIControl_SlotList.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/Controls/UIControl_Base.h" +#include "app/common/UI/Controls/UIControl_SlotList.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Controls/UIControl_SpaceIndicatorBar.cpp b/targets/app/common/UI/Controls/UIControl_SpaceIndicatorBar.cpp similarity index 95% rename from targets/app/common/src/UI/Controls/UIControl_SpaceIndicatorBar.cpp rename to targets/app/common/UI/Controls/UIControl_SpaceIndicatorBar.cpp index ac40b11c6..8f1256647 100644 --- a/targets/app/common/src/UI/Controls/UIControl_SpaceIndicatorBar.cpp +++ b/targets/app/common/UI/Controls/UIControl_SpaceIndicatorBar.cpp @@ -1,9 +1,9 @@ #include "UIControl_SpaceIndicatorBar.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_Base.h" -#include "app/common/src/UI/UIScene.h" -#include "app/common/src/UI/UIString.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_Base.h" +#include "app/common/UI/UIScene.h" +#include "app/common/UI/UIString.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Controls/UIControl_SpaceIndicatorBar.h b/targets/app/common/UI/Controls/UIControl_SpaceIndicatorBar.h similarity index 83% rename from targets/app/common/src/UI/Controls/UIControl_SpaceIndicatorBar.h rename to targets/app/common/UI/Controls/UIControl_SpaceIndicatorBar.h index cb08bf528..c7323f452 100644 --- a/targets/app/common/src/UI/Controls/UIControl_SpaceIndicatorBar.h +++ b/targets/app/common/UI/Controls/UIControl_SpaceIndicatorBar.h @@ -7,10 +7,10 @@ #include #include -#include "app/common/src/UI/Controls/UIControl_Base.h" -#include "app/common/src/UI/Controls/UIControl_SpaceIndicatorBar.h" -#include "app/common/src/UI/UIScene.h" -#include "app/common/src/UI/UIString.h" +#include "app/common/UI/Controls/UIControl_Base.h" +#include "app/common/UI/Controls/UIControl_SpaceIndicatorBar.h" +#include "app/common/UI/UIScene.h" +#include "app/common/UI/UIString.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Controls/UIControl_TextInput.cpp b/targets/app/common/UI/Controls/UIControl_TextInput.cpp similarity index 92% rename from targets/app/common/src/UI/Controls/UIControl_TextInput.cpp rename to targets/app/common/UI/Controls/UIControl_TextInput.cpp index 12bd53c57..b8704ad8b 100644 --- a/targets/app/common/src/UI/Controls/UIControl_TextInput.cpp +++ b/targets/app/common/UI/Controls/UIControl_TextInput.cpp @@ -1,9 +1,9 @@ #include "UIControl_TextInput.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_Base.h" -#include "app/common/src/UI/UIScene.h" -#include "app/common/src/UI/UIString.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_Base.h" +#include "app/common/UI/UIScene.h" +#include "app/common/UI/UIString.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Controls/UIControl_TextInput.h b/targets/app/common/UI/Controls/UIControl_TextInput.h similarity index 76% rename from targets/app/common/src/UI/Controls/UIControl_TextInput.h rename to targets/app/common/UI/Controls/UIControl_TextInput.h index 5032eb142..5a272ebbc 100644 --- a/targets/app/common/src/UI/Controls/UIControl_TextInput.h +++ b/targets/app/common/UI/Controls/UIControl_TextInput.h @@ -2,10 +2,10 @@ #include -#include "app/common/src/UI/Controls/UIControl_Base.h" -#include "app/common/src/UI/Controls/UIControl_TextInput.h" -#include "app/common/src/UI/UIScene.h" -#include "app/common/src/UI/UIString.h" +#include "app/common/UI/Controls/UIControl_Base.h" +#include "app/common/UI/Controls/UIControl_TextInput.h" +#include "app/common/UI/UIScene.h" +#include "app/common/UI/UIString.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Controls/UIControl_TexturePackList.cpp b/targets/app/common/UI/Controls/UIControl_TexturePackList.cpp similarity index 96% rename from targets/app/common/src/UI/Controls/UIControl_TexturePackList.cpp rename to targets/app/common/UI/Controls/UIControl_TexturePackList.cpp index 16c122a49..3194f5d1a 100644 --- a/targets/app/common/src/UI/Controls/UIControl_TexturePackList.cpp +++ b/targets/app/common/UI/Controls/UIControl_TexturePackList.cpp @@ -1,9 +1,9 @@ #include "UIControl_TexturePackList.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_Base.h" -#include "app/common/src/UI/UIScene.h" -#include "app/common/src/UI/UIString.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_Base.h" +#include "app/common/UI/UIScene.h" +#include "app/common/UI/UIString.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Controls/UIControl_TexturePackList.h b/targets/app/common/UI/Controls/UIControl_TexturePackList.h similarity index 85% rename from targets/app/common/src/UI/Controls/UIControl_TexturePackList.h rename to targets/app/common/UI/Controls/UIControl_TexturePackList.h index c233ef40a..e687ec630 100644 --- a/targets/app/common/src/UI/Controls/UIControl_TexturePackList.h +++ b/targets/app/common/UI/Controls/UIControl_TexturePackList.h @@ -2,9 +2,9 @@ #include -#include "app/common/src/UI/Controls/UIControl_Base.h" -#include "app/common/src/UI/Controls/UIControl_TexturePackList.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/Controls/UIControl_Base.h" +#include "app/common/UI/Controls/UIControl_TexturePackList.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Controls/UIControl_Touch.cpp b/targets/app/common/UI/Controls/UIControl_Touch.cpp similarity index 89% rename from targets/app/common/src/UI/Controls/UIControl_Touch.cpp rename to targets/app/common/UI/Controls/UIControl_Touch.cpp index 280031183..09da5f198 100644 --- a/targets/app/common/src/UI/Controls/UIControl_Touch.cpp +++ b/targets/app/common/UI/Controls/UIControl_Touch.cpp @@ -1,7 +1,7 @@ #include "UIControl_Touch.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_Base.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_Base.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Controls/UIControl_Touch.h b/targets/app/common/UI/Controls/UIControl_Touch.h similarity index 74% rename from targets/app/common/src/UI/Controls/UIControl_Touch.h rename to targets/app/common/UI/Controls/UIControl_Touch.h index 90619683a..74329f663 100644 --- a/targets/app/common/src/UI/Controls/UIControl_Touch.h +++ b/targets/app/common/UI/Controls/UIControl_Touch.h @@ -2,9 +2,9 @@ #include -#include "app/common/src/UI/Controls/UIControl_Base.h" -#include "app/common/src/UI/Controls/UIControl_Touch.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/Controls/UIControl_Base.h" +#include "app/common/UI/Controls/UIControl_Touch.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp b/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp similarity index 94% rename from targets/app/common/src/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp rename to targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp index fd71dcc0c..726eba47b 100644 --- a/targets/app/common/src/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp @@ -1,18 +1,18 @@ -#include "app/common/src/UI/Scenes/Debug/UIScene_DebugCreateSchematic.h" +#include "app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.h" #include #include "platform/InputActions.h" #include "platform/sdl2/Input.h" #include "platform/sdl2/Profile.h" -#include "app/common/App_enums.h" -#include "app/common/src/GameRules/LevelGeneration/ConsoleSchematicFile.h" -#include "app/common/src/UI/Controls/UIControl_Button.h" -#include "app/common/src/UI/Controls/UIControl_CheckBox.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_TextInput.h" -#include "app/common/src/UI/UIScene.h" +#include "minecraft/GameEnums.h" +#include "app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h" +#include "app/common/UI/Controls/UIControl_Button.h" +#include "app/common/UI/Controls/UIControl_CheckBox.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_TextInput.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" diff --git a/targets/app/common/src/UI/Scenes/Debug/UIScene_DebugCreateSchematic.h b/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.h similarity index 86% rename from targets/app/common/src/UI/Scenes/Debug/UIScene_DebugCreateSchematic.h rename to targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.h index 1150561c8..198852cae 100644 --- a/targets/app/common/src/UI/Scenes/Debug/UIScene_DebugCreateSchematic.h +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.h @@ -2,13 +2,13 @@ #ifdef _DEBUG_MENUS_ENABLED #include -#include "app/common/src/GameRules/LevelGeneration/ConsoleSchematicFile.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/Controls/UIControl_Button.h" -#include "app/common/src/UI/Controls/UIControl_CheckBox.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_TextInput.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/Controls/UIControl_Button.h" +#include "app/common/UI/Controls/UIControl_CheckBox.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_TextInput.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" class UILayer; diff --git a/targets/app/common/src/UI/Scenes/Debug/UIScene_DebugOptions.cpp b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.cpp similarity index 96% rename from targets/app/common/src/UI/Scenes/Debug/UIScene_DebugOptions.cpp rename to targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.cpp index 5dde0006c..87045c669 100644 --- a/targets/app/common/src/UI/Scenes/Debug/UIScene_DebugOptions.cpp +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.cpp @@ -1,9 +1,9 @@ #include "UIScene_DebugOptions.h" #include "platform/InputActions.h" -#include "app/common/src/Console_Debug_enum.h" -#include "app/common/src/UI/Controls/UIControl_CheckBox.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/Console_Debug_enum.h" +#include "app/common/UI/Controls/UIControl_CheckBox.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Scenes/Debug/UIScene_DebugOptions.h b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.h similarity index 89% rename from targets/app/common/src/UI/Scenes/Debug/UIScene_DebugOptions.h rename to targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.h index 66bab0db1..70dd20462 100644 --- a/targets/app/common/src/UI/Scenes/Debug/UIScene_DebugOptions.h +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.h @@ -2,10 +2,10 @@ #include -#include "app/common/src/Console_Debug_enum.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/Controls/UIControl_CheckBox.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/Console_Debug_enum.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/Controls/UIControl_CheckBox.h" +#include "app/common/UI/UIScene.h" class UILayer; diff --git a/targets/app/common/src/UI/Scenes/Debug/UIScene_DebugOverlay.cpp b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp similarity index 96% rename from targets/app/common/src/UI/Scenes/Debug/UIScene_DebugOverlay.cpp rename to targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp index 361d6a38f..59e3d96b3 100644 --- a/targets/app/common/src/UI/Scenes/Debug/UIScene_DebugOverlay.cpp +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp @@ -1,5 +1,5 @@ -#include "app/common/src/UI/Scenes/Debug/UIScene_DebugOverlay.h" +#include "app/common/UI/Scenes/Debug/UIScene_DebugOverlay.h" #include @@ -7,13 +7,13 @@ #include "platform/InputActions.h" #include "platform/sdl2/Profile.h" -#include "app/common/App_enums.h" -#include "app/common/src/Tutorial/Tutorial.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/Controls/UIControl_Button.h" -#include "app/common/src/UI/Controls/UIControl_ButtonList.h" -#include "app/common/src/UI/Controls/UIControl_Slider.h" -#include "app/common/src/UI/UIScene.h" +#include "minecraft/GameEnums.h" +#include "app/common/Tutorial/Tutorial.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/Controls/UIControl_Button.h" +#include "app/common/UI/Controls/UIControl_ButtonList.h" +#include "app/common/UI/Controls/UIControl_Slider.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Scenes/Debug/UIScene_DebugOverlay.h b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.h similarity index 89% rename from targets/app/common/src/UI/Scenes/Debug/UIScene_DebugOverlay.h rename to targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.h index 0e250e099..db1f3cf06 100644 --- a/targets/app/common/src/UI/Scenes/Debug/UIScene_DebugOverlay.h +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.h @@ -5,11 +5,11 @@ #include #include -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/Controls/UIControl_Button.h" -#include "app/common/src/UI/Controls/UIControl_ButtonList.h" -#include "app/common/src/UI/Controls/UIControl_Slider.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/Controls/UIControl_Button.h" +#include "app/common/UI/Controls/UIControl_ButtonList.h" +#include "app/common/UI/Controls/UIControl_Slider.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp b/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp similarity index 92% rename from targets/app/common/src/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp rename to targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp index cd0463c77..581d81420 100644 --- a/targets/app/common/src/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp @@ -1,5 +1,5 @@ -#include "app/common/src/UI/Scenes/Debug/UIScene_DebugSetCamera.h" +#include "app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.h" #include @@ -8,13 +8,13 @@ #include "platform/InputActions.h" #include "platform/sdl2/Input.h" #include "platform/sdl2/Profile.h" -#include "app/common/App_enums.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/common/src/UI/Controls/UIControl_Button.h" -#include "app/common/src/UI/Controls/UIControl_CheckBox.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_TextInput.h" -#include "app/common/src/UI/UIScene.h" +#include "minecraft/GameEnums.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/Controls/UIControl_Button.h" +#include "app/common/UI/Controls/UIControl_CheckBox.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_TextInput.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" diff --git a/targets/app/common/src/UI/Scenes/Debug/UIScene_DebugSetCamera.h b/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.h similarity index 84% rename from targets/app/common/src/UI/Scenes/Debug/UIScene_DebugSetCamera.h rename to targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.h index 9a90e50e3..693130c97 100644 --- a/targets/app/common/src/UI/Scenes/Debug/UIScene_DebugSetCamera.h +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.h @@ -2,13 +2,13 @@ #ifdef _DEBUG_MENUS_ENABLED #include -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/common/src/UI/Controls/UIControl_Button.h" -#include "app/common/src/UI/Controls/UIControl_CheckBox.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_TextInput.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/Controls/UIControl_Button.h" +#include "app/common/UI/Controls/UIControl_CheckBox.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_TextInput.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" class UILayer; diff --git a/targets/app/common/src/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.cpp similarity index 97% rename from targets/app/common/src/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.cpp rename to targets/app/common/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.cpp index 1956c867f..05a5cfc53 100644 --- a/targets/app/common/src/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.cpp @@ -6,11 +6,11 @@ #include "platform/sdl2/Profile.h" #include "app/common/App_structs.h" -#include "app/common/src/DLC/DLCManager.h" -#include "app/common/src/UI/Controls/UIControl_BitmapIcon.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_TexturePackList.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/DLC/DLCManager.h" +#include "app/common/UI/Controls/UIControl_BitmapIcon.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_TexturePackList.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" #include "app/linux/LinuxGame.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/src/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.h b/targets/app/common/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.h similarity index 85% rename from targets/app/common/src/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.h rename to targets/app/common/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.h index 0c9a60927..a7c13287d 100644 --- a/targets/app/common/src/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.h @@ -3,12 +3,12 @@ #include #include "platform/sdl2/Storage.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_BitmapIcon.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_TexturePackList.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_BitmapIcon.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_TexturePackList.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" class UILayer; diff --git a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.cpp similarity index 98% rename from targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.cpp rename to targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.cpp index 22b90ceb4..fd55a5b58 100644 --- a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.cpp @@ -11,21 +11,21 @@ #include "platform/sdl2/Input.h" #include "platform/sdl2/Profile.h" #include "app/common/App_Defines.h" -#include "app/common/App_enums.h" -#include "app/common/src/DLC/DLCManager.h" -#include "app/common/src/DLC/DLCPack.h" -#include "app/common/src/Network/GameNetworkManager.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/common/src/UI/Controls/UIControl_Button.h" -#include "app/common/src/UI/Controls/UIControl_CheckBox.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_Slider.h" -#include "app/common/src/UI/Controls/UIControl_TextInput.h" -#include "app/common/src/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.h" -#include "app/common/src/UI/UILayer.h" +#include "minecraft/GameEnums.h" +#include "app/common/DLC/DLCManager.h" +#include "app/common/DLC/DLCPack.h" +#include "app/common/Network/GameNetworkManager.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/Controls/UIControl_Button.h" +#include "app/common/UI/Controls/UIControl_CheckBox.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_Slider.h" +#include "app/common/UI/Controls/UIControl_TextInput.h" +#include "app/common/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.h" +#include "app/common/UI/UILayer.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "app/include/NetTypes.h" +#include "platform/NetTypes.h" #include "util/StringHelpers.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/Options.h" diff --git a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.h similarity index 84% rename from targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.h rename to targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.h index 806cbe3f8..9bb7c90f3 100644 --- a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.h @@ -6,17 +6,17 @@ #include "platform/sdl2/Storage.h" #include "IUIScene_StartGame.h" -#include "app/common/src/DLC/DLCPack.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_BitmapIcon.h" -#include "app/common/src/UI/Controls/UIControl_Button.h" -#include "app/common/src/UI/Controls/UIControl_CheckBox.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_Slider.h" -#include "app/common/src/UI/Controls/UIControl_TextInput.h" -#include "app/common/src/UI/Controls/UIControl_TexturePackList.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/DLC/DLCPack.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_BitmapIcon.h" +#include "app/common/UI/Controls/UIControl_Button.h" +#include "app/common/UI/Controls/UIControl_CheckBox.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_Slider.h" +#include "app/common/UI/Controls/UIControl_TextInput.h" +#include "app/common/UI/Controls/UIControl_TexturePackList.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" class DLCPack; diff --git a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.cpp similarity index 93% rename from targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.cpp rename to targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.cpp index 5fce56541..f803dd8b1 100644 --- a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.cpp @@ -2,11 +2,11 @@ #include "UIScene_DLCMainMenu.h" #include "platform/InputActions.h" -#include "app/common/App_enums.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/common/src/UI/Controls/UIControl_ButtonList.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/UIScene.h" +#include "minecraft/GameEnums.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/Controls/UIControl_ButtonList.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "strings.h" diff --git a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.h similarity index 85% rename from targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.h rename to targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.h index b5ae25c3d..84b15c452 100644 --- a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.h @@ -3,11 +3,11 @@ #include #include "platform/sdl2/Storage.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_ButtonList.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_ButtonList.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" class UILayer; diff --git a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.cpp similarity index 96% rename from targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.cpp rename to targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.cpp index 15e6dedd9..beadbe741 100644 --- a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.cpp @@ -6,11 +6,11 @@ #include "platform/PlatformTypes.h" #include "platform/InputActions.h" #include "platform/sdl2/Render.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/common/src/UI/Controls/UIControl_DLCList.h" -#include "app/common/src/UI/Controls/UIControl_HTMLLabel.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/Controls/UIControl_DLCList.h" +#include "app/common/UI/Controls/UIControl_HTMLLabel.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "strings.h" diff --git a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.h similarity index 84% rename from targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.h rename to targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.h index 52b4c038b..8f698873f 100644 --- a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.h @@ -3,13 +3,13 @@ #include #include "platform/sdl2/Storage.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_BitmapIcon.h" -#include "app/common/src/UI/Controls/UIControl_DLCList.h" -#include "app/common/src/UI/Controls/UIControl_HTMLLabel.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_BitmapIcon.h" +#include "app/common/UI/Controls/UIControl_DLCList.h" +#include "app/common/UI/Controls/UIControl_HTMLLabel.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" class UILayer; diff --git a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_EULA.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_EULA.cpp similarity index 93% rename from targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_EULA.cpp rename to targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_EULA.cpp index 206b68273..af1e574e5 100644 --- a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_EULA.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_EULA.cpp @@ -8,11 +8,11 @@ #include "platform/sdl2/Input.h" #include "platform/sdl2/Profile.h" #include "app/common/App_Defines.h" -#include "app/common/App_enums.h" -#include "app/common/src/UI/Controls/UIControl_Button.h" -#include "app/common/src/UI/Controls/UIControl_DynamicLabel.h" -#include "app/common/src/UI/UILayer.h" -#include "app/common/src/UI/UIScene.h" +#include "minecraft/GameEnums.h" +#include "app/common/UI/Controls/UIControl_Button.h" +#include "app/common/UI/Controls/UIControl_DynamicLabel.h" +#include "app/common/UI/UILayer.h" +#include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "minecraft/sounds/SoundTypes.h" diff --git a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_EULA.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_EULA.h similarity index 84% rename from targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_EULA.h rename to targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_EULA.h index 0a631b5f0..645cb0a68 100644 --- a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_EULA.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_EULA.h @@ -2,10 +2,10 @@ #include -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/Controls/UIControl_Button.h" -#include "app/common/src/UI/Controls/UIControl_DynamicLabel.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/Controls/UIControl_Button.h" +#include "app/common/UI/Controls/UIControl_DynamicLabel.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" class UILayer; diff --git a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_Intro.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_Intro.cpp similarity index 97% rename from targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_Intro.cpp rename to targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_Intro.cpp index 6bf36a4f4..64eb2b1f6 100644 --- a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_Intro.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_Intro.cpp @@ -1,8 +1,8 @@ #include "UIScene_Intro.h" #include "platform/InputActions.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #include "app/linux/Linux_UIController.h" diff --git a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_Intro.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_Intro.h similarity index 92% rename from targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_Intro.h rename to targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_Intro.h index 101b98b44..7334886dc 100644 --- a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_Intro.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_Intro.h @@ -2,8 +2,8 @@ #include -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_JoinMenu.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_JoinMenu.cpp similarity index 97% rename from targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_JoinMenu.cpp rename to targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_JoinMenu.cpp index 34bdad051..f2fd29f87 100644 --- a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_JoinMenu.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_JoinMenu.cpp @@ -8,15 +8,15 @@ #include "platform/InputActions.h" #include "platform/sdl2/Profile.h" #include "app/common/App_Defines.h" -#include "app/common/App_enums.h" -#include "app/common/src/Network/GameNetworkManager.h" -#include "app/common/src/Network/SessionInfo.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/common/src/UI/Controls/UIControl_Button.h" -#include "app/common/src/UI/Controls/UIControl_ButtonList.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/UILayer.h" -#include "app/common/src/UI/UIScene.h" +#include "minecraft/GameEnums.h" +#include "app/common/Network/GameNetworkManager.h" +#include "app/common/Network/SessionInfo.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/Controls/UIControl_Button.h" +#include "app/common/UI/Controls/UIControl_ButtonList.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/UILayer.h" +#include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "minecraft/sounds/SoundTypes.h" diff --git a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_JoinMenu.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_JoinMenu.h similarity index 91% rename from targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_JoinMenu.h rename to targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_JoinMenu.h index 68e12166c..d39db7865 100644 --- a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_JoinMenu.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_JoinMenu.h @@ -3,11 +3,11 @@ #include #include "platform/sdl2/Storage.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/Controls/UIControl_Button.h" -#include "app/common/src/UI/Controls/UIControl_ButtonList.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/Controls/UIControl_Button.h" +#include "app/common/UI/Controls/UIControl_ButtonList.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" class FriendSessionInfo; diff --git a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_LaunchMoreOptionsMenu.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LaunchMoreOptionsMenu.cpp similarity index 98% rename from targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_LaunchMoreOptionsMenu.cpp rename to targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LaunchMoreOptionsMenu.cpp index 2b1ed4b83..3977355c9 100644 --- a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_LaunchMoreOptionsMenu.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LaunchMoreOptionsMenu.cpp @@ -9,14 +9,14 @@ #include "platform/sdl2/Profile.h" #include "platform/sdl2/Render.h" #include "app/common/App_Defines.h" -#include "app/common/App_enums.h" -#include "app/common/src/UI/Controls/UIControl_CheckBox.h" -#include "app/common/src/UI/Controls/UIControl_HTMLLabel.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_Slider.h" -#include "app/common/src/UI/Controls/UIControl_TextInput.h" -#include "app/common/src/UI/UILayer.h" -#include "app/common/src/UI/UIScene.h" +#include "minecraft/GameEnums.h" +#include "app/common/UI/Controls/UIControl_CheckBox.h" +#include "app/common/UI/Controls/UIControl_HTMLLabel.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_Slider.h" +#include "app/common/UI/Controls/UIControl_TextInput.h" +#include "app/common/UI/UILayer.h" +#include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "util/StringHelpers.h" diff --git a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_LaunchMoreOptionsMenu.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LaunchMoreOptionsMenu.h similarity index 92% rename from targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_LaunchMoreOptionsMenu.h rename to targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LaunchMoreOptionsMenu.h index da282d597..43069d299 100644 --- a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_LaunchMoreOptionsMenu.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LaunchMoreOptionsMenu.h @@ -2,15 +2,15 @@ #include -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_CheckBox.h" -#include "app/common/src/UI/Controls/UIControl_HTMLLabel.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_Slider.h" -#include "app/common/src/UI/Controls/UIControl_TextInput.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_CheckBox.h" +#include "app/common/UI/Controls/UIControl_HTMLLabel.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_Slider.h" +#include "app/common/UI/Controls/UIControl_TextInput.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.cpp similarity index 98% rename from targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.cpp rename to targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.cpp index 43f8201a8..e972b3ff1 100644 --- a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.cpp @@ -10,13 +10,13 @@ #include "platform/InputActions.h" #include "platform/sdl2/Profile.h" -#include "app/common/src/Console_Debug_enum.h" -#include "app/common/src/Leaderboards/LeaderboardInterface.h" -#include "app/common/src/Leaderboards/LeaderboardManager.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_LeaderboardList.h" -#include "app/common/src/UI/UILayer.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/Console_Debug_enum.h" +#include "app/common/Leaderboards/LeaderboardInterface.h" +#include "app/common/Leaderboards/LeaderboardManager.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_LeaderboardList.h" +#include "app/common/UI/UILayer.h" +#include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "app/linux/Stubs/winapi_stubs.h" diff --git a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.h similarity index 94% rename from targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.h rename to targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.h index 0221c116c..bd934779f 100644 --- a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.h @@ -5,12 +5,12 @@ #include "platform/PlatformTypes.h" #include "platform/sdl2/Storage.h" -#include "app/common/src/Leaderboards/LeaderboardInterface.h" -#include "app/common/src/Leaderboards/LeaderboardManager.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_LeaderboardList.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/Leaderboards/LeaderboardInterface.h" +#include "app/common/Leaderboards/LeaderboardManager.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_LeaderboardList.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.cpp similarity index 98% rename from targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.cpp rename to targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.cpp index e595e3704..45034a7e6 100644 --- a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.cpp @@ -9,22 +9,22 @@ #include "platform/sdl2/Profile.h" #include "platform/sdl2/Render.h" #include "app/common/App_Defines.h" -#include "app/common/App_enums.h" -#include "app/common/src/DLC/DLCManager.h" -#include "app/common/src/DLC/DLCPack.h" -#include "app/common/src/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/common/src/Network/GameNetworkManager.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/common/src/UI/Controls/UIControl_BitmapIcon.h" -#include "app/common/src/UI/Controls/UIControl_Button.h" -#include "app/common/src/UI/Controls/UIControl_CheckBox.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_Slider.h" -#include "app/common/src/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.h" -#include "app/common/src/UI/UILayer.h" +#include "minecraft/GameEnums.h" +#include "app/common/DLC/DLCManager.h" +#include "app/common/DLC/DLCPack.h" +#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "app/common/Network/GameNetworkManager.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/Controls/UIControl_BitmapIcon.h" +#include "app/common/UI/Controls/UIControl_Button.h" +#include "app/common/UI/Controls/UIControl_CheckBox.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_Slider.h" +#include "app/common/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.h" +#include "app/common/UI/UILayer.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "app/include/NetTypes.h" +#include "platform/NetTypes.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/Options.h" #include "minecraft/client/skins/DLCTexturePack.h" diff --git a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.h similarity index 89% rename from targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.h rename to targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.h index 00129c353..38cb289f3 100644 --- a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.h @@ -5,16 +5,16 @@ #include "platform/sdl2/Storage.h" #include "IUIScene_StartGame.h" -#include "app/common/src/DLC/DLCPack.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_BitmapIcon.h" -#include "app/common/src/UI/Controls/UIControl_Button.h" -#include "app/common/src/UI/Controls/UIControl_CheckBox.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_Slider.h" -#include "app/common/src/UI/Controls/UIControl_TexturePackList.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/DLC/DLCPack.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_BitmapIcon.h" +#include "app/common/UI/Controls/UIControl_Button.h" +#include "app/common/UI/Controls/UIControl_CheckBox.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_Slider.h" +#include "app/common/UI/Controls/UIControl_TexturePackList.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" class DLCPack; diff --git a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.cpp similarity index 99% rename from targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.cpp rename to targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.cpp index e1610d1f4..43676d4d3 100644 --- a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.cpp @@ -10,18 +10,18 @@ #include "platform/sdl2/Input.h" #include "platform/sdl2/Profile.h" #include "app/common/App_Defines.h" -#include "app/common/App_enums.h" -#include "app/common/src/DLC/DLCManager.h" -#include "app/common/src/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/common/src/Network/GameNetworkManager.h" -#include "app/common/src/Network/SessionInfo.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_SaveList.h" -#include "app/common/src/UI/UILayer.h" -#include "app/common/src/UI/UIScene.h" +#include "minecraft/GameEnums.h" +#include "app/common/DLC/DLCManager.h" +#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "app/common/Network/GameNetworkManager.h" +#include "app/common/Network/SessionInfo.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_SaveList.h" +#include "app/common/UI/UILayer.h" +#include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "app/include/NetTypes.h" +#include "platform/NetTypes.h" #include "java/File.h" #include "java/InputOutputStream/FileInputStream.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.h similarity index 96% rename from targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.h rename to targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.h index ebf7bea89..af480fcd1 100644 --- a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.h @@ -6,12 +6,12 @@ #include #include "platform/sdl2/Storage.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_SaveList.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_SaveList.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" #include "java/File.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.cpp similarity index 99% rename from targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.cpp rename to targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.cpp index f765f1ef4..3b9a12f68 100644 --- a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.cpp @@ -11,17 +11,17 @@ #include "platform/sdl2/Profile.h" #include "platform/sdl2/Render.h" #include "app/common/App_Defines.h" -#include "app/common/App_enums.h" -#include "app/common/src/Network/GameNetworkManager.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/common/src/UI/Controls/UIControl_Button.h" -#include "app/common/src/UI/UILayer.h" -#include "app/common/src/UI/UIScene.h" -#include "app/common/src/UI/UIString.h" +#include "minecraft/GameEnums.h" +#include "app/common/Network/GameNetworkManager.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/Controls/UIControl_Button.h" +#include "app/common/UI/UILayer.h" +#include "app/common/UI/UIScene.h" +#include "app/common/UI/UIString.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "app/linux/Stubs/winapi_stubs.h" -#include "app/include/NetTypes.h" +#include "platform/NetTypes.h" #include "util/StringHelpers.h" #include "java/InputOutputStream/BufferedReader.h" diff --git a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.h similarity index 95% rename from targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.h rename to targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.h index d38764194..f79a276da 100644 --- a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.h @@ -6,10 +6,10 @@ #include #include "platform/sdl2/Storage.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_Button.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_Button.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_NewUpdateMessage.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_NewUpdateMessage.cpp similarity index 94% rename from targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_NewUpdateMessage.cpp rename to targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_NewUpdateMessage.cpp index b632e9668..c49d994fa 100644 --- a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_NewUpdateMessage.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_NewUpdateMessage.cpp @@ -5,11 +5,11 @@ #include "platform/InputActions.h" #include "app/common/App_Defines.h" -#include "app/common/App_enums.h" -#include "app/common/src/UI/Controls/UIControl_Button.h" -#include "app/common/src/UI/Controls/UIControl_DynamicLabel.h" -#include "app/common/src/UI/UILayer.h" -#include "app/common/src/UI/UIScene.h" +#include "minecraft/GameEnums.h" +#include "app/common/UI/Controls/UIControl_Button.h" +#include "app/common/UI/Controls/UIControl_DynamicLabel.h" +#include "app/common/UI/UILayer.h" +#include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "minecraft/sounds/SoundTypes.h" diff --git a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_NewUpdateMessage.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_NewUpdateMessage.h similarity index 84% rename from targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_NewUpdateMessage.h rename to targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_NewUpdateMessage.h index 778a81deb..e177d7d10 100644 --- a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_NewUpdateMessage.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_NewUpdateMessage.h @@ -2,10 +2,10 @@ #include -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/Controls/UIControl_Button.h" -#include "app/common/src/UI/Controls/UIControl_DynamicLabel.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/Controls/UIControl_Button.h" +#include "app/common/UI/Controls/UIControl_DynamicLabel.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" class UILayer; diff --git a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_SaveMessage.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_SaveMessage.cpp similarity index 95% rename from targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_SaveMessage.cpp rename to targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_SaveMessage.cpp index 740ca06f6..931a8c4f6 100644 --- a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_SaveMessage.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_SaveMessage.cpp @@ -6,10 +6,10 @@ #include "platform/sdl2/Input.h" #include "platform/sdl2/Profile.h" #include "app/common/App_Defines.h" -#include "app/common/src/UI/Controls/UIControl_Button.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/UILayer.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/Controls/UIControl_Button.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/UILayer.h" +#include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "minecraft/sounds/SoundTypes.h" diff --git a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_SaveMessage.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_SaveMessage.h similarity index 87% rename from targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_SaveMessage.h rename to targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_SaveMessage.h index 27d7b08e6..fd334e430 100644 --- a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_SaveMessage.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_SaveMessage.h @@ -2,10 +2,10 @@ #include -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/Controls/UIControl_Button.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/Controls/UIControl_Button.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_TrialExitUpsell.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_TrialExitUpsell.cpp similarity index 98% rename from targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_TrialExitUpsell.cpp rename to targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_TrialExitUpsell.cpp index 226ecc828..0949775d3 100644 --- a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_TrialExitUpsell.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_TrialExitUpsell.cpp @@ -4,7 +4,7 @@ #include "platform/InputActions.h" #include "platform/sdl2/Profile.h" #include "app/common/App_Defines.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "minecraft/sounds/SoundTypes.h" diff --git a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_TrialExitUpsell.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_TrialExitUpsell.h similarity index 89% rename from targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_TrialExitUpsell.h rename to targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_TrialExitUpsell.h index c4f65b0b5..fed184faf 100644 --- a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_TrialExitUpsell.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_TrialExitUpsell.h @@ -2,8 +2,8 @@ #include -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/UIScene.h" class UILayer; diff --git a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_ControlsMenu.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_ControlsMenu.cpp similarity index 97% rename from targets/app/common/src/UI/Scenes/Help & Options/UIScene_ControlsMenu.cpp rename to targets/app/common/UI/Scenes/Help & Options/UIScene_ControlsMenu.cpp index 29e35203e..2de72d80e 100644 --- a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_ControlsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_ControlsMenu.cpp @@ -6,12 +6,12 @@ #include "platform/InputActions.h" #include "platform/sdl2/Input.h" -#include "app/common/App_enums.h" -#include "app/common/src/BuildVer/BuildVer.h" -#include "app/common/src/UI/Controls/UIControl_Button.h" -#include "app/common/src/UI/Controls/UIControl_CheckBox.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/UIScene.h" +#include "minecraft/GameEnums.h" +#include "app/common/BuildVer/BuildVer.h" +#include "app/common/UI/Controls/UIControl_Button.h" +#include "app/common/UI/Controls/UIControl_CheckBox.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_ControlsMenu.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_ControlsMenu.h similarity index 94% rename from targets/app/common/src/UI/Scenes/Help & Options/UIScene_ControlsMenu.h rename to targets/app/common/UI/Scenes/Help & Options/UIScene_ControlsMenu.h index 81083eb94..35f5bf3a1 100644 --- a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_ControlsMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_ControlsMenu.h @@ -2,12 +2,12 @@ #include -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_Button.h" -#include "app/common/src/UI/Controls/UIControl_CheckBox.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_Button.h" +#include "app/common/UI/Controls/UIControl_CheckBox.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_Credits.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_Credits.cpp similarity index 99% rename from targets/app/common/src/UI/Scenes/Help & Options/UIScene_Credits.cpp rename to targets/app/common/UI/Scenes/Help & Options/UIScene_Credits.cpp index 8087f2967..1897318a1 100644 --- a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_Credits.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_Credits.cpp @@ -5,8 +5,8 @@ #include #include "platform/InputActions.h" -#include "app/common/src/UI/UILayer.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/UILayer.h" +#include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "util/StringHelpers.h" diff --git a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_Credits.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_Credits.h similarity index 92% rename from targets/app/common/src/UI/Scenes/Help & Options/UIScene_Credits.h rename to targets/app/common/UI/Scenes/Help & Options/UIScene_Credits.h index 008f012c4..829df3f33 100644 --- a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_Credits.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_Credits.h @@ -2,9 +2,9 @@ #include -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.cpp similarity index 98% rename from targets/app/common/src/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.cpp rename to targets/app/common/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.cpp index ff2ca1eb7..c290b5781 100644 --- a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.cpp @@ -3,9 +3,9 @@ #include "platform/InputActions.h" #include "platform/sdl2/Profile.h" -#include "app/common/src/UI/Controls/UIControl_Button.h" -#include "app/common/src/UI/UILayer.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/Controls/UIControl_Button.h" +#include "app/common/UI/UILayer.h" +#include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.h similarity index 91% rename from targets/app/common/src/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.h rename to targets/app/common/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.h index ebd22e0b5..4c4b869de 100644 --- a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.h @@ -2,9 +2,9 @@ #include -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/Controls/UIControl_Button.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/Controls/UIControl_Button.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" class UILayer; diff --git a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_HowToPlay.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlay.cpp similarity index 99% rename from targets/app/common/src/UI/Scenes/Help & Options/UIScene_HowToPlay.cpp rename to targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlay.cpp index 5060c2ef9..916bd3dd1 100644 --- a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_HowToPlay.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlay.cpp @@ -7,9 +7,9 @@ #include #include "platform/InputActions.h" -#include "app/common/App_enums.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/UIScene.h" +#include "minecraft/GameEnums.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "util/StringHelpers.h" diff --git a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_HowToPlay.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlay.h similarity index 96% rename from targets/app/common/src/UI/Scenes/Help & Options/UIScene_HowToPlay.h rename to targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlay.h index 7c8a7595a..02ecaeb5d 100644 --- a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_HowToPlay.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlay.h @@ -2,10 +2,10 @@ #include -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/Controls/UIControl_DynamicLabel.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/Controls/UIControl_DynamicLabel.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.cpp similarity index 97% rename from targets/app/common/src/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.cpp rename to targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.cpp index 70bc4b1a4..c453ff0fa 100644 --- a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.cpp @@ -4,9 +4,9 @@ #include #include "platform/InputActions.h" -#include "app/common/src/UI/Controls/UIControl_ButtonList.h" -#include "app/common/src/UI/UILayer.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/Controls/UIControl_ButtonList.h" +#include "app/common/UI/UILayer.h" +#include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.h similarity index 92% rename from targets/app/common/src/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.h rename to targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.h index 9be1c0190..69be4630f 100644 --- a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.h @@ -2,9 +2,9 @@ #include -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/Controls/UIControl_ButtonList.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/Controls/UIControl_ButtonList.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" class UILayer; diff --git a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_LanguageSelector.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.cpp similarity index 96% rename from targets/app/common/src/UI/Scenes/Help & Options/UIScene_LanguageSelector.cpp rename to targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.cpp index fbba0d40f..f65eb66bd 100644 --- a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_LanguageSelector.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.cpp @@ -1,9 +1,9 @@ #include "UIScene_LanguageSelector.h" #include "platform/InputActions.h" -#include "app/common/src/UI/Controls/UIControl_ButtonList.h" -#include "app/common/src/UI/UILayer.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/Controls/UIControl_ButtonList.h" +#include "app/common/UI/UILayer.h" +#include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_LanguageSelector.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.h similarity index 91% rename from targets/app/common/src/UI/Scenes/Help & Options/UIScene_LanguageSelector.h rename to targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.h index 153fd1fd3..2e5422a42 100644 --- a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_LanguageSelector.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.h @@ -3,14 +3,14 @@ #include #include "app/common/App_Defines.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_ButtonList.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_ButtonList.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" -#include "app/include/NetTypes.h" -#include "app/include/SkinBox.h" -#include "app/include/XboxStubs.h" +#include "platform/NetTypes.h" +#include "minecraft/client/model/SkinBox.h" +#include "platform/XboxStubs.h" class UILayer; diff --git a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_ReinstallMenu.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_ReinstallMenu.cpp similarity index 98% rename from targets/app/common/src/UI/Scenes/Help & Options/UIScene_ReinstallMenu.cpp rename to targets/app/common/UI/Scenes/Help & Options/UIScene_ReinstallMenu.cpp index 6b37125bd..185e50dd0 100644 --- a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_ReinstallMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_ReinstallMenu.cpp @@ -2,8 +2,8 @@ #include "UIScene_ReinstallMenu.h" #include "platform/InputActions.h" -#include "app/common/src/UI/UILayer.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/UILayer.h" +#include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_ReinstallMenu.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_ReinstallMenu.h similarity index 90% rename from targets/app/common/src/UI/Scenes/Help & Options/UIScene_ReinstallMenu.h rename to targets/app/common/UI/Scenes/Help & Options/UIScene_ReinstallMenu.h index 42beb08f9..d799cb197 100644 --- a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_ReinstallMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_ReinstallMenu.h @@ -2,9 +2,9 @@ #include -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/Controls/UIControl_Button.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/Controls/UIControl_Button.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" class UILayer; diff --git a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.cpp similarity index 96% rename from targets/app/common/src/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.cpp rename to targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.cpp index cd2c88468..6c8ef57cb 100644 --- a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.cpp @@ -4,10 +4,10 @@ #include #include "platform/InputActions.h" -#include "app/common/App_enums.h" -#include "app/common/src/UI/Controls/UIControl_Slider.h" -#include "app/common/src/UI/UILayer.h" -#include "app/common/src/UI/UIScene.h" +#include "minecraft/GameEnums.h" +#include "app/common/UI/Controls/UIControl_Slider.h" +#include "app/common/UI/UILayer.h" +#include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.h similarity index 87% rename from targets/app/common/src/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.h rename to targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.h index 50392e508..d09d386d1 100644 --- a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.h @@ -2,9 +2,9 @@ #include -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/Controls/UIControl_Slider.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/Controls/UIControl_Slider.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" class UILayer; diff --git a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.cpp similarity index 96% rename from targets/app/common/src/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.cpp rename to targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.cpp index d8d50a846..8775cbce6 100644 --- a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.cpp @@ -3,10 +3,10 @@ #include #include "platform/InputActions.h" -#include "app/common/App_enums.h" -#include "app/common/src/UI/Controls/UIControl_Slider.h" -#include "app/common/src/UI/UILayer.h" -#include "app/common/src/UI/UIScene.h" +#include "minecraft/GameEnums.h" +#include "app/common/UI/Controls/UIControl_Slider.h" +#include "app/common/UI/UILayer.h" +#include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.h similarity index 88% rename from targets/app/common/src/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.h rename to targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.h index 65f1ecc90..1659543db 100644 --- a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.h @@ -2,9 +2,9 @@ #include -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/Controls/UIControl_Slider.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/Controls/UIControl_Slider.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" class UILayer; diff --git a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.cpp similarity index 95% rename from targets/app/common/src/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.cpp rename to targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.cpp index 2d4d6d324..aad9811cb 100644 --- a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.cpp @@ -4,12 +4,12 @@ #include "platform/InputActions.h" #include "platform/sdl2/Profile.h" -#include "app/common/App_enums.h" -#include "app/common/src/Network/GameNetworkManager.h" -#include "app/common/src/UI/Controls/UIControl_CheckBox.h" -#include "app/common/src/UI/Controls/UIControl_Slider.h" -#include "app/common/src/UI/UILayer.h" -#include "app/common/src/UI/UIScene.h" +#include "minecraft/GameEnums.h" +#include "app/common/Network/GameNetworkManager.h" +#include "app/common/UI/Controls/UIControl_CheckBox.h" +#include "app/common/UI/Controls/UIControl_Slider.h" +#include "app/common/UI/UILayer.h" +#include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.h similarity index 88% rename from targets/app/common/src/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.h rename to targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.h index 08a10f1cf..5b3021e6f 100644 --- a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.h @@ -2,10 +2,10 @@ #include -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/Controls/UIControl_CheckBox.h" -#include "app/common/src/UI/Controls/UIControl_Slider.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/Controls/UIControl_CheckBox.h" +#include "app/common/UI/Controls/UIControl_Slider.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" class UILayer; diff --git a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_SettingsMenu.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.cpp similarity index 97% rename from targets/app/common/src/UI/Scenes/Help & Options/UIScene_SettingsMenu.cpp rename to targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.cpp index 539f75c9e..1d9533e40 100644 --- a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_SettingsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.cpp @@ -3,9 +3,9 @@ #include "platform/InputActions.h" #include "platform/sdl2/Profile.h" -#include "app/common/src/UI/Controls/UIControl_Button.h" -#include "app/common/src/UI/UILayer.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/Controls/UIControl_Button.h" +#include "app/common/UI/UILayer.h" +#include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_SettingsMenu.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.h similarity index 91% rename from targets/app/common/src/UI/Scenes/Help & Options/UIScene_SettingsMenu.h rename to targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.h index e3aed600f..fd47ffd53 100644 --- a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_SettingsMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.h @@ -3,9 +3,9 @@ #include #include "platform/sdl2/Storage.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/Controls/UIControl_Button.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/Controls/UIControl_Button.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" class UILayer; diff --git a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.cpp similarity index 97% rename from targets/app/common/src/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.cpp rename to targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.cpp index b3bcc89a0..d9cbf6935 100644 --- a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.cpp @@ -6,14 +6,14 @@ #include "platform/InputActions.h" #include "platform/sdl2/Profile.h" #include "platform/sdl2/Render.h" -#include "app/common/App_enums.h" -#include "app/common/src/Network/GameNetworkManager.h" -#include "app/common/src/UI/Controls/UIControl_Button.h" -#include "app/common/src/UI/Controls/UIControl_CheckBox.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_Slider.h" -#include "app/common/src/UI/UILayer.h" -#include "app/common/src/UI/UIScene.h" +#include "minecraft/GameEnums.h" +#include "app/common/Network/GameNetworkManager.h" +#include "app/common/UI/Controls/UIControl_Button.h" +#include "app/common/UI/Controls/UIControl_CheckBox.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_Slider.h" +#include "app/common/UI/UILayer.h" +#include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.h similarity index 88% rename from targets/app/common/src/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.h rename to targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.h index c01e79854..3d690947a 100644 --- a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.h @@ -2,12 +2,12 @@ #include -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/Controls/UIControl_Button.h" -#include "app/common/src/UI/Controls/UIControl_CheckBox.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_Slider.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/Controls/UIControl_Button.h" +#include "app/common/UI/Controls/UIControl_CheckBox.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_Slider.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" class UILayer; diff --git a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.cpp similarity index 97% rename from targets/app/common/src/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.cpp rename to targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.cpp index 2012ab0bf..103459bf2 100644 --- a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.cpp @@ -5,11 +5,11 @@ #include "platform/InputActions.h" #include "platform/sdl2/Profile.h" -#include "app/common/App_enums.h" -#include "app/common/src/UI/Controls/UIControl_CheckBox.h" -#include "app/common/src/UI/Controls/UIControl_Slider.h" -#include "app/common/src/UI/UILayer.h" -#include "app/common/src/UI/UIScene.h" +#include "minecraft/GameEnums.h" +#include "app/common/UI/Controls/UIControl_CheckBox.h" +#include "app/common/UI/Controls/UIControl_Slider.h" +#include "app/common/UI/UILayer.h" +#include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.h similarity index 90% rename from targets/app/common/src/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.h rename to targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.h index 95c12cb78..3bca46fc5 100644 --- a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.h @@ -2,10 +2,10 @@ #include -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/Controls/UIControl_CheckBox.h" -#include "app/common/src/UI/Controls/UIControl_Slider.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/Controls/UIControl_CheckBox.h" +#include "app/common/UI/Controls/UIControl_Slider.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" class UILayer; diff --git a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp similarity index 99% rename from targets/app/common/src/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp rename to targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp index b5d23a57e..a9dc5777e 100644 --- a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp @@ -10,17 +10,17 @@ #include "platform/sdl2/Render.h" #include "app/common/App_Defines.h" #include "app/common/Minecraft_Macros.h" -#include "app/common/src/DLC/DLCManager.h" -#include "app/common/src/DLC/DLCPack.h" -#include "app/common/src/DLC/DLCSkinFile.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_PlayerSkinPreview.h" -#include "app/common/src/UI/UILayer.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/DLC/DLCManager.h" +#include "app/common/DLC/DLCPack.h" +#include "app/common/DLC/DLCSkinFile.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_PlayerSkinPreview.h" +#include "app/common/UI/UILayer.h" +#include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "SkinBox.h" +#include "minecraft/client/model/SkinBox.h" #include "util/StringHelpers.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.h similarity index 94% rename from targets/app/common/src/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.h rename to targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.h index 8801ba04c..bd2b004cd 100644 --- a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.h @@ -4,18 +4,18 @@ #include #include "platform/sdl2/Storage.h" -#include "app/common/src/DLC/DLCPack.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_PlayerSkinPreview.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/DLC/DLCPack.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_PlayerSkinPreview.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif #include "app/linux/Iggy/include/rrCore.h" -#include "app/include/SkinBox.h" +#include "minecraft/client/model/SkinBox.h" #include "minecraft/world/entity/player/SkinTypes.h" #include "minecraft/client/renderer/Textures.h" diff --git a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.cpp similarity index 96% rename from targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.cpp rename to targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.cpp index 6af0020b8..2345d8042 100644 --- a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.cpp @@ -5,14 +5,14 @@ #include #include "platform/InputActions.h" -#include "app/common/src/Tutorial/Tutorial.h" -#include "app/common/src/Tutorial/TutorialMode.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/common/src/UI/Controls/UIControl_Cursor.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_SlotList.h" -#include "app/common/src/UI/UILayer.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/Tutorial/Tutorial.h" +#include "app/common/Tutorial/TutorialMode.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/Controls/UIControl_Cursor.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_SlotList.h" +#include "app/common/UI/UILayer.h" +#include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h similarity index 90% rename from targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h rename to targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h index e5d72ef0d..448135457 100644 --- a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h @@ -3,12 +3,12 @@ #include #include "platform/sdl2/Render.h" -#include "app/common/src/UI/All Platforms/IUIScene_AbstractContainerMenu.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_Cursor.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_SlotList.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_Cursor.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_SlotList.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AnvilMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AnvilMenu.cpp similarity index 96% rename from targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AnvilMenu.cpp rename to targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AnvilMenu.cpp index de86ffe83..6e216951c 100644 --- a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AnvilMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AnvilMenu.cpp @@ -9,13 +9,13 @@ #include "platform/sdl2/Input.h" #include "platform/sdl2/Profile.h" -#include "app/common/src/Tutorial/Tutorial.h" -#include "app/common/src/Tutorial/TutorialEnum.h" -#include "app/common/src/Tutorial/TutorialMode.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_SlotList.h" -#include "app/common/src/UI/Controls/UIControl_TextInput.h" -#include "app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" +#include "app/common/Tutorial/Tutorial.h" +#include "app/common/Tutorial/TutorialEnum.h" +#include "app/common/Tutorial/TutorialMode.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_SlotList.h" +#include "app/common/UI/Controls/UIControl_TextInput.h" +#include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" #include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AnvilMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AnvilMenu.h similarity index 83% rename from targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AnvilMenu.h rename to targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AnvilMenu.h index 76ddd0b42..f7106a6f0 100644 --- a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AnvilMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AnvilMenu.h @@ -3,15 +3,15 @@ #include #include "platform/sdl2/Input.h" -#include "app/common/src/Tutorial/TutorialMode.h" -#include "app/common/src/UI/All Platforms/IUIScene_AnvilMenu.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_SlotList.h" -#include "app/common/src/UI/Controls/UIControl_TextInput.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/Tutorial/TutorialMode.h" +#include "app/common/UI/All Platforms/IUIScene_AnvilMenu.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_SlotList.h" +#include "app/common/UI/Controls/UIControl_TextInput.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BeaconMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BeaconMenu.cpp similarity index 97% rename from targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BeaconMenu.cpp rename to targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BeaconMenu.cpp index ac1ffa331..7378efa6d 100644 --- a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BeaconMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BeaconMenu.cpp @@ -4,13 +4,13 @@ #include -#include "app/common/src/Tutorial/Tutorial.h" -#include "app/common/src/Tutorial/TutorialEnum.h" -#include "app/common/src/Tutorial/TutorialMode.h" -#include "app/common/src/UI/Controls/UIControl_BeaconEffectButton.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_SlotList.h" -#include "app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" +#include "app/common/Tutorial/Tutorial.h" +#include "app/common/Tutorial/TutorialEnum.h" +#include "app/common/Tutorial/TutorialMode.h" +#include "app/common/UI/Controls/UIControl_BeaconEffectButton.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_SlotList.h" +#include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" #include "app/linux/LinuxGame.h" #include "minecraft/client/Minecraft.h" #include "minecraft/world/entity/player/Inventory.h" diff --git a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BeaconMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BeaconMenu.h similarity index 87% rename from targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BeaconMenu.h rename to targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BeaconMenu.h index a7dcb4b30..ef2f26f56 100644 --- a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BeaconMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BeaconMenu.h @@ -2,14 +2,14 @@ #include -#include "app/common/src/UI/All Platforms/IUIScene_BeaconMenu.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_BeaconEffectButton.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_SlotList.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/IUIScene_BeaconMenu.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_BeaconEffectButton.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_SlotList.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BrewingStandMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BrewingStandMenu.cpp similarity index 95% rename from targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BrewingStandMenu.cpp rename to targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BrewingStandMenu.cpp index c2a484b61..f6b1c80b7 100644 --- a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BrewingStandMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BrewingStandMenu.cpp @@ -3,14 +3,14 @@ #include #include "platform/sdl2/Profile.h" -#include "app/common/src/Tutorial/Tutorial.h" -#include "app/common/src/Tutorial/TutorialEnum.h" -#include "app/common/src/Tutorial/TutorialMode.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_Progress.h" -#include "app/common/src/UI/Controls/UIControl_SlotList.h" -#include "app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" +#include "app/common/Tutorial/Tutorial.h" +#include "app/common/Tutorial/TutorialEnum.h" +#include "app/common/Tutorial/TutorialMode.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_Progress.h" +#include "app/common/UI/Controls/UIControl_SlotList.h" +#include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" #include "app/linux/LinuxGame.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BrewingStandMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BrewingStandMenu.h similarity index 82% rename from targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BrewingStandMenu.h rename to targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BrewingStandMenu.h index 7f25e6e58..20d395573 100644 --- a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BrewingStandMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BrewingStandMenu.h @@ -3,14 +3,14 @@ #include #include -#include "app/common/src/UI/All Platforms/IUIScene_BrewingMenu.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_Progress.h" -#include "app/common/src/UI/Controls/UIControl_SlotList.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/IUIScene_BrewingMenu.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_Progress.h" +#include "app/common/UI/Controls/UIControl_SlotList.h" +#include "app/common/UI/UIScene.h" #include "UIScene_AbstractContainerMenu.h" class InventoryMenu; diff --git a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_ContainerMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_ContainerMenu.cpp similarity index 93% rename from targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_ContainerMenu.cpp rename to targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_ContainerMenu.cpp index d8c0702d7..06747581b 100644 --- a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_ContainerMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_ContainerMenu.cpp @@ -4,13 +4,13 @@ #include -#include "app/common/src/Tutorial/Tutorial.h" -#include "app/common/src/Tutorial/TutorialEnum.h" -#include "app/common/src/Tutorial/TutorialMode.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_SlotList.h" -#include "app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" +#include "app/common/Tutorial/Tutorial.h" +#include "app/common/Tutorial/TutorialEnum.h" +#include "app/common/Tutorial/TutorialMode.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_SlotList.h" +#include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" #include "app/linux/LinuxGame.h" #include "minecraft/client/Minecraft.h" #include "minecraft/world/Container.h" diff --git a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_ContainerMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_ContainerMenu.h similarity index 79% rename from targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_ContainerMenu.h rename to targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_ContainerMenu.h index 945e4f542..9113ed99c 100644 --- a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_ContainerMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_ContainerMenu.h @@ -2,13 +2,13 @@ #include -#include "app/common/src/UI/All Platforms/IUIScene_ContainerMenu.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_SlotList.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/IUIScene_ContainerMenu.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_SlotList.h" +#include "app/common/UI/UIScene.h" #include "UIScene_AbstractContainerMenu.h" class InventoryMenu; diff --git a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.cpp similarity index 96% rename from targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.cpp rename to targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.cpp index 53d1648ff..a13eef5d8 100644 --- a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.cpp @@ -4,14 +4,14 @@ #include -#include "app/common/src/Tutorial/Tutorial.h" -#include "app/common/src/Tutorial/TutorialEnum.h" -#include "app/common/src/Tutorial/TutorialMode.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/common/src/UI/Controls/UIControl_Base.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_SlotList.h" -#include "app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" +#include "app/common/Tutorial/Tutorial.h" +#include "app/common/Tutorial/TutorialEnum.h" +#include "app/common/Tutorial/TutorialMode.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/Controls/UIControl_Base.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_SlotList.h" +#include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" @@ -19,7 +19,7 @@ #include "app/linux/Iggy/include/rrCore.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "app/include/XboxStubs.h" +#include "platform/XboxStubs.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/player/LocalPlayer.h" #include "minecraft/sounds/SoundTypes.h" diff --git a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.h similarity index 89% rename from targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.h rename to targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.h index e9e0cc217..140664e4f 100644 --- a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.h @@ -2,13 +2,13 @@ #include -#include "app/common/src/UI/All Platforms/IUIScene_CreativeMenu.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_Base.h" -#include "app/common/src/UI/Controls/UIControl_SlotList.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/IUIScene_CreativeMenu.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_Base.h" +#include "app/common/UI/Controls/UIControl_SlotList.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_DispenserMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_DispenserMenu.cpp similarity index 93% rename from targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_DispenserMenu.cpp rename to targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_DispenserMenu.cpp index 661aad066..466d5fdf6 100644 --- a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_DispenserMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_DispenserMenu.cpp @@ -4,13 +4,13 @@ #include -#include "app/common/src/Tutorial/Tutorial.h" -#include "app/common/src/Tutorial/TutorialEnum.h" -#include "app/common/src/Tutorial/TutorialMode.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_SlotList.h" -#include "app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" +#include "app/common/Tutorial/Tutorial.h" +#include "app/common/Tutorial/TutorialEnum.h" +#include "app/common/Tutorial/TutorialMode.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_SlotList.h" +#include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" #include "app/linux/LinuxGame.h" #include "minecraft/client/Minecraft.h" #include "minecraft/world/inventory/TrapMenu.h" diff --git a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_DispenserMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_DispenserMenu.h similarity index 79% rename from targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_DispenserMenu.h rename to targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_DispenserMenu.h index 035cbfe03..a40436d87 100644 --- a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_DispenserMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_DispenserMenu.h @@ -2,13 +2,13 @@ #include -#include "app/common/src/UI/All Platforms/IUIScene_DispenserMenu.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_SlotList.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/IUIScene_DispenserMenu.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_SlotList.h" +#include "app/common/UI/UIScene.h" #include "UIScene_AbstractContainerMenu.h" class InventoryMenu; diff --git a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.cpp similarity index 95% rename from targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.cpp rename to targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.cpp index cff34b14f..f23df9a52 100644 --- a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.cpp @@ -6,14 +6,14 @@ #include #include "platform/sdl2/Profile.h" -#include "app/common/src/Tutorial/Tutorial.h" -#include "app/common/src/Tutorial/TutorialEnum.h" -#include "app/common/src/Tutorial/TutorialMode.h" -#include "app/common/src/UI/Controls/UIControl_EnchantmentBook.h" -#include "app/common/src/UI/Controls/UIControl_EnchantmentButton.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_SlotList.h" -#include "app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" +#include "app/common/Tutorial/Tutorial.h" +#include "app/common/Tutorial/TutorialEnum.h" +#include "app/common/Tutorial/TutorialMode.h" +#include "app/common/UI/Controls/UIControl_EnchantmentBook.h" +#include "app/common/UI/Controls/UIControl_EnchantmentButton.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_SlotList.h" +#include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.h similarity index 79% rename from targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.h rename to targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.h index 6557fd50c..e9b1f2c68 100644 --- a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.h @@ -2,15 +2,15 @@ #include -#include "app/common/src/UI/All Platforms/IUIScene_EnchantingMenu.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_EnchantmentBook.h" -#include "app/common/src/UI/Controls/UIControl_EnchantmentButton.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_SlotList.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/IUIScene_EnchantingMenu.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_EnchantmentBook.h" +#include "app/common/UI/Controls/UIControl_EnchantmentButton.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_SlotList.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #include "UIScene_AbstractContainerMenu.h" diff --git a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FireworksMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FireworksMenu.cpp similarity index 95% rename from targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FireworksMenu.cpp rename to targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FireworksMenu.cpp index 54b885a53..5c7ffe66b 100644 --- a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FireworksMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FireworksMenu.cpp @@ -4,12 +4,12 @@ #include -#include "app/common/src/Tutorial/Tutorial.h" -#include "app/common/src/Tutorial/TutorialEnum.h" -#include "app/common/src/Tutorial/TutorialMode.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_SlotList.h" -#include "app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" +#include "app/common/Tutorial/Tutorial.h" +#include "app/common/Tutorial/TutorialEnum.h" +#include "app/common/Tutorial/TutorialMode.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_SlotList.h" +#include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" #include "app/linux/LinuxGame.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/player/LocalPlayer.h" diff --git a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FireworksMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FireworksMenu.h similarity index 82% rename from targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FireworksMenu.h rename to targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FireworksMenu.h index 8370c4236..888530258 100644 --- a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FireworksMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FireworksMenu.h @@ -2,13 +2,13 @@ #include -#include "app/common/src/UI/All Platforms/IUIScene_FireworksMenu.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_SlotList.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/IUIScene_FireworksMenu.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_SlotList.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FurnaceMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FurnaceMenu.cpp similarity index 94% rename from targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FurnaceMenu.cpp rename to targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FurnaceMenu.cpp index 6ba1dcb04..80bf0cf87 100644 --- a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FurnaceMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FurnaceMenu.cpp @@ -4,13 +4,13 @@ #include #include "platform/sdl2/Profile.h" -#include "app/common/src/Tutorial/Tutorial.h" -#include "app/common/src/Tutorial/TutorialEnum.h" -#include "app/common/src/Tutorial/TutorialMode.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_Progress.h" -#include "app/common/src/UI/Controls/UIControl_SlotList.h" -#include "app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" +#include "app/common/Tutorial/Tutorial.h" +#include "app/common/Tutorial/TutorialEnum.h" +#include "app/common/Tutorial/TutorialMode.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_Progress.h" +#include "app/common/UI/Controls/UIControl_SlotList.h" +#include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" #include "app/linux/LinuxGame.h" #include "minecraft/client/Minecraft.h" #include "minecraft/world/inventory/FurnaceMenu.h" diff --git a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FurnaceMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FurnaceMenu.h similarity index 82% rename from targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FurnaceMenu.h rename to targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FurnaceMenu.h index ea10109fc..4e0ea1666 100644 --- a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FurnaceMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FurnaceMenu.h @@ -3,14 +3,14 @@ #include #include -#include "app/common/src/UI/All Platforms/IUIScene_FurnaceMenu.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_Progress.h" -#include "app/common/src/UI/Controls/UIControl_SlotList.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/IUIScene_FurnaceMenu.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_Progress.h" +#include "app/common/UI/Controls/UIControl_SlotList.h" +#include "app/common/UI/UIScene.h" #include "UIScene_AbstractContainerMenu.h" class InventoryMenu; diff --git a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HopperMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HopperMenu.cpp similarity index 93% rename from targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HopperMenu.cpp rename to targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HopperMenu.cpp index 3bc476737..ebe8ef0ac 100644 --- a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HopperMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HopperMenu.cpp @@ -4,13 +4,13 @@ #include -#include "app/common/src/Tutorial/Tutorial.h" -#include "app/common/src/Tutorial/TutorialEnum.h" -#include "app/common/src/Tutorial/TutorialMode.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_SlotList.h" -#include "app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" +#include "app/common/Tutorial/Tutorial.h" +#include "app/common/Tutorial/TutorialEnum.h" +#include "app/common/Tutorial/TutorialMode.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_SlotList.h" +#include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" #include "app/linux/LinuxGame.h" #include "minecraft/client/Minecraft.h" #include "minecraft/world/Container.h" diff --git a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HopperMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HopperMenu.h similarity index 79% rename from targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HopperMenu.h rename to targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HopperMenu.h index 5d67ddc3a..5ff4d392b 100644 --- a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HopperMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HopperMenu.h @@ -2,13 +2,13 @@ #include -#include "app/common/src/UI/All Platforms/IUIScene_HopperMenu.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_SlotList.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/IUIScene_HopperMenu.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_SlotList.h" +#include "app/common/UI/UIScene.h" #include "UIScene_AbstractContainerMenu.h" class InventoryMenu; diff --git a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.cpp similarity index 95% rename from targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.cpp rename to targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.cpp index d436bbc39..f95a45415 100644 --- a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.cpp @@ -4,14 +4,14 @@ #include -#include "app/common/src/Tutorial/Tutorial.h" -#include "app/common/src/Tutorial/TutorialEnum.h" -#include "app/common/src/Tutorial/TutorialMode.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_MinecraftHorse.h" -#include "app/common/src/UI/Controls/UIControl_SlotList.h" -#include "app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" +#include "app/common/Tutorial/Tutorial.h" +#include "app/common/Tutorial/TutorialEnum.h" +#include "app/common/Tutorial/TutorialMode.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_MinecraftHorse.h" +#include "app/common/UI/Controls/UIControl_SlotList.h" +#include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.h similarity index 82% rename from targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.h rename to targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.h index 3819b9184..6bcf7ff75 100644 --- a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.h @@ -2,14 +2,14 @@ #include -#include "app/common/src/UI/All Platforms/IUIScene_HorseInventoryMenu.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_MinecraftHorse.h" -#include "app/common/src/UI/Controls/UIControl_SlotList.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/IUIScene_HorseInventoryMenu.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_MinecraftHorse.h" +#include "app/common/UI/Controls/UIControl_SlotList.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.cpp similarity index 96% rename from targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.cpp rename to targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.cpp index bc0cfeb02..a588c1ff1 100644 --- a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.cpp @@ -7,12 +7,12 @@ #include #include -#include "app/common/src/Tutorial/Tutorial.h" -#include "app/common/src/Tutorial/TutorialEnum.h" -#include "app/common/src/Tutorial/TutorialMode.h" -#include "app/common/src/UI/Controls/UIControl_MinecraftPlayer.h" -#include "app/common/src/UI/Controls/UIControl_SlotList.h" -#include "app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" +#include "app/common/Tutorial/Tutorial.h" +#include "app/common/Tutorial/TutorialEnum.h" +#include "app/common/Tutorial/TutorialMode.h" +#include "app/common/UI/Controls/UIControl_MinecraftPlayer.h" +#include "app/common/UI/Controls/UIControl_SlotList.h" +#include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "util/StringHelpers.h" diff --git a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.h similarity index 83% rename from targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.h rename to targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.h index a47a6524d..fe400fac7 100644 --- a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.h @@ -2,13 +2,13 @@ #include -#include "app/common/src/UI/All Platforms/IUIScene_InventoryMenu.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_MinecraftPlayer.h" -#include "app/common/src/UI/Controls/UIControl_SlotList.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/IUIScene_InventoryMenu.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_MinecraftPlayer.h" +#include "app/common/UI/Controls/UIControl_SlotList.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.cpp similarity index 96% rename from targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.cpp rename to targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.cpp index 1d2ad093f..cef0b16fa 100644 --- a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.cpp @@ -7,13 +7,13 @@ #include "platform/InputActions.h" #include "platform/sdl2/Profile.h" -#include "app/common/src/Tutorial/Tutorial.h" -#include "app/common/src/Tutorial/TutorialEnum.h" -#include "app/common/src/Tutorial/TutorialMode.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_SlotList.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/Tutorial/Tutorial.h" +#include "app/common/Tutorial/TutorialEnum.h" +#include "app/common/Tutorial/TutorialMode.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_SlotList.h" +#include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "util/StringHelpers.h" diff --git a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.h similarity index 89% rename from targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.h rename to targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.h index c64f2eb0c..4e04f6b38 100644 --- a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.h @@ -2,13 +2,13 @@ #include -#include "app/common/src/UI/All Platforms/IUIScene_TradingMenu.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_SlotList.h" -#include "app/common/src/UI/UILayer.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/IUIScene_TradingMenu.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_SlotList.h" +#include "app/common/UI/UILayer.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_CraftingMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_CraftingMenu.cpp similarity index 98% rename from targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_CraftingMenu.cpp rename to targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_CraftingMenu.cpp index 466ace887..1ac22cb8d 100644 --- a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_CraftingMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_CraftingMenu.cpp @@ -3,14 +3,14 @@ #include "platform/InputActions.h" #include "platform/sdl2/Profile.h" -#include "app/common/src/Tutorial/Tutorial.h" -#include "app/common/src/Tutorial/TutorialEnum.h" -#include "app/common/src/Tutorial/TutorialMode.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/common/src/UI/Controls/UIControl_HTMLLabel.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_SlotList.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/Tutorial/Tutorial.h" +#include "app/common/Tutorial/TutorialEnum.h" +#include "app/common/Tutorial/TutorialMode.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/Controls/UIControl_HTMLLabel.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_SlotList.h" +#include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_CraftingMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_CraftingMenu.h similarity index 95% rename from targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_CraftingMenu.h rename to targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_CraftingMenu.h index 15c651658..3a475c621 100644 --- a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_CraftingMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_CraftingMenu.h @@ -3,13 +3,13 @@ #include #include -#include "app/common/src/UI/All Platforms/IUIScene_CraftingMenu.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_HTMLLabel.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_SlotList.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/IUIScene_CraftingMenu.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_HTMLLabel.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_SlotList.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_DeathMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_DeathMenu.cpp similarity index 92% rename from targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_DeathMenu.cpp rename to targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_DeathMenu.cpp index b9c7efccb..955a61c1f 100644 --- a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_DeathMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_DeathMenu.cpp @@ -6,14 +6,14 @@ #include "platform/InputActions.h" #include "platform/sdl2/Profile.h" #include "platform/sdl2/Storage.h" -#include "app/common/App_enums.h" -#include "app/common/src/Network/GameNetworkManager.h" -#include "app/common/src/Tutorial/Tutorial.h" -#include "app/common/src/Tutorial/TutorialMode.h" -#include "app/common/src/UI/All Platforms/IUIScene_PauseMenu.h" -#include "app/common/src/UI/Controls/UIControl_Button.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/UIScene.h" +#include "minecraft/GameEnums.h" +#include "app/common/Network/GameNetworkManager.h" +#include "app/common/Tutorial/Tutorial.h" +#include "app/common/Tutorial/TutorialMode.h" +#include "app/common/UI/All Platforms/IUIScene_PauseMenu.h" +#include "app/common/UI/Controls/UIControl_Button.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_DeathMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_DeathMenu.h similarity index 84% rename from targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_DeathMenu.h rename to targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_DeathMenu.h index 9935cf3f1..7b2c387d7 100644 --- a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_DeathMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_DeathMenu.h @@ -2,10 +2,10 @@ #include -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/Controls/UIControl_Button.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/Controls/UIControl_Button.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" class UILayer; diff --git a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_EndPoem.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_EndPoem.cpp similarity index 98% rename from targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_EndPoem.cpp rename to targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_EndPoem.cpp index 38db9a44e..b4f2dd238 100644 --- a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_EndPoem.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_EndPoem.cpp @@ -9,9 +9,9 @@ #include "platform/PlatformTypes.h" #include "platform/InputActions.h" #include "platform/sdl2/Profile.h" -#include "app/common/App_enums.h" -#include "app/common/src/Tutorial/Tutorial.h" -#include "app/common/src/UI/UIScene.h" +#include "minecraft/GameEnums.h" +#include "app/common/Tutorial/Tutorial.h" +#include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "util/StringHelpers.h" diff --git a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_EndPoem.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_EndPoem.h similarity index 92% rename from targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_EndPoem.h rename to targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_EndPoem.h index 7d31736fe..d4e9d2d5a 100644 --- a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_EndPoem.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_EndPoem.h @@ -3,8 +3,8 @@ #include #include -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_InGameHostOptionsMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameHostOptionsMenu.cpp similarity index 95% rename from targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_InGameHostOptionsMenu.cpp rename to targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameHostOptionsMenu.cpp index 8029686fa..e8f4e7386 100644 --- a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_InGameHostOptionsMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameHostOptionsMenu.cpp @@ -4,13 +4,13 @@ #include #include "platform/InputActions.h" -#include "app/common/App_enums.h" -#include "app/common/src/Network/GameNetworkManager.h" -#include "app/common/src/Network/NetworkPlayerInterface.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/common/src/UI/Controls/UIControl_Button.h" -#include "app/common/src/UI/Controls/UIControl_CheckBox.h" -#include "app/common/src/UI/UIScene.h" +#include "minecraft/GameEnums.h" +#include "app/common/Network/GameNetworkManager.h" +#include "app/common/Network/NetworkPlayerInterface.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/Controls/UIControl_Button.h" +#include "app/common/UI/Controls/UIControl_CheckBox.h" +#include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_InGameHostOptionsMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameHostOptionsMenu.h similarity index 91% rename from targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_InGameHostOptionsMenu.h rename to targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameHostOptionsMenu.h index 30613973b..40e605fd5 100644 --- a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_InGameHostOptionsMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameHostOptionsMenu.h @@ -2,10 +2,10 @@ #include -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/Controls/UIControl_Button.h" -#include "app/common/src/UI/Controls/UIControl_CheckBox.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/Controls/UIControl_Button.h" +#include "app/common/UI/Controls/UIControl_CheckBox.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" class UILayer; diff --git a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.cpp similarity index 97% rename from targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.cpp rename to targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.cpp index 4e608dbd2..5f5bb4d07 100644 --- a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.cpp @@ -5,16 +5,16 @@ #include "platform/PlatformTypes.h" #include "platform/InputActions.h" #include "platform/sdl2/Profile.h" -#include "app/common/App_enums.h" -#include "app/common/src/Console_Debug_enum.h" -#include "app/common/src/Network/GameNetworkManager.h" -#include "app/common/src/Network/NetworkPlayerInterface.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/common/src/UI/Controls/UIControl_Button.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_PlayerList.h" -#include "app/common/src/UI/UILayer.h" -#include "app/common/src/UI/UIScene.h" +#include "minecraft/GameEnums.h" +#include "app/common/Console_Debug_enum.h" +#include "app/common/Network/GameNetworkManager.h" +#include "app/common/Network/NetworkPlayerInterface.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/Controls/UIControl_Button.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_PlayerList.h" +#include "app/common/UI/UILayer.h" +#include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "app/linux/Stubs/winapi_stubs.h" diff --git a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.h similarity index 87% rename from targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.h rename to targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.h index 719579929..cd670822e 100644 --- a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.h @@ -5,12 +5,12 @@ #include #include "platform/sdl2/Storage.h" -#include "app/common/src/Network/GameNetworkManager.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/Controls/UIControl_Button.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_PlayerList.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/Network/GameNetworkManager.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/Controls/UIControl_Button.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_PlayerList.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" class INetworkPlayer; diff --git a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.cpp similarity index 98% rename from targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.cpp rename to targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.cpp index 1a3bd04f0..f0af5a898 100644 --- a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.cpp @@ -4,15 +4,15 @@ #include #include "platform/InputActions.h" -#include "app/common/App_enums.h" -#include "app/common/src/Network/GameNetworkManager.h" -#include "app/common/src/Network/NetworkPlayerInterface.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/common/src/UI/Controls/UIControl_Button.h" -#include "app/common/src/UI/Controls/UIControl_CheckBox.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.h" -#include "app/common/src/UI/UIScene.h" +#include "minecraft/GameEnums.h" +#include "app/common/Network/GameNetworkManager.h" +#include "app/common/Network/NetworkPlayerInterface.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/Controls/UIControl_Button.h" +#include "app/common/UI/Controls/UIControl_CheckBox.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.h" +#include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.h similarity index 91% rename from targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.h rename to targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.h index b74347a80..7a1863f6f 100644 --- a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.h @@ -4,12 +4,12 @@ #include #include "platform/sdl2/Storage.h" -#include "app/common/src/Network/GameNetworkManager.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/Controls/UIControl_Button.h" -#include "app/common/src/UI/Controls/UIControl_CheckBox.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/Network/GameNetworkManager.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/Controls/UIControl_Button.h" +#include "app/common/UI/Controls/UIControl_CheckBox.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_InGameSaveManagementMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameSaveManagementMenu.cpp similarity index 100% rename from targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_InGameSaveManagementMenu.cpp rename to targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameSaveManagementMenu.cpp diff --git a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_InGameSaveManagementMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameSaveManagementMenu.h similarity index 94% rename from targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_InGameSaveManagementMenu.h rename to targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameSaveManagementMenu.h index c22d441c4..bd95c92c5 100644 --- a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_InGameSaveManagementMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameSaveManagementMenu.h @@ -2,9 +2,9 @@ #include -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_SaveList.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_SaveList.h" +#include "app/common/UI/UIScene.h" class UIScene_InGameSaveManagementMenu : public UIScene { private: diff --git a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.cpp similarity index 97% rename from targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.cpp rename to targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.cpp index e09b8e88c..1f2d7c3b9 100644 --- a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.cpp @@ -7,16 +7,16 @@ #include "platform/InputActions.h" #include "platform/sdl2/Profile.h" -#include "app/common/App_enums.h" -#include "app/common/src/DLC/DLCManager.h" -#include "app/common/src/DLC/DLCPack.h" -#include "app/common/src/Network/GameNetworkManager.h" -#include "app/common/src/Tutorial/Tutorial.h" -#include "app/common/src/Tutorial/TutorialMode.h" -#include "app/common/src/UI/All Platforms/IUIScene_PauseMenu.h" -#include "app/common/src/UI/Controls/UIControl_Button.h" -#include "app/common/src/UI/UILayer.h" -#include "app/common/src/UI/UIScene.h" +#include "minecraft/GameEnums.h" +#include "app/common/DLC/DLCManager.h" +#include "app/common/DLC/DLCPack.h" +#include "app/common/Network/GameNetworkManager.h" +#include "app/common/Tutorial/Tutorial.h" +#include "app/common/Tutorial/TutorialMode.h" +#include "app/common/UI/All Platforms/IUIScene_PauseMenu.h" +#include "app/common/UI/Controls/UIControl_Button.h" +#include "app/common/UI/UILayer.h" +#include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.h similarity index 91% rename from targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.h rename to targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.h index 7b510ea0c..1bbc797af 100644 --- a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.h @@ -3,10 +3,10 @@ #include #include "platform/sdl2/Storage.h" -#include "app/common/src/UI/All Platforms/IUIScene_PauseMenu.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/Controls/UIControl_Button.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/IUIScene_PauseMenu.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/Controls/UIControl_Button.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" class UILayer; diff --git a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_SignEntryMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_SignEntryMenu.cpp similarity index 95% rename from targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_SignEntryMenu.cpp rename to targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_SignEntryMenu.cpp index f75806778..a86982b93 100644 --- a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_SignEntryMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_SignEntryMenu.cpp @@ -3,12 +3,12 @@ #include "platform/InputActions.h" #include "platform/sdl2/Input.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/common/src/UI/Controls/UIControl_Button.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_TextInput.h" -#include "app/common/src/UI/UILayer.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/Controls/UIControl_Button.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_TextInput.h" +#include "app/common/UI/UILayer.h" +#include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "util/StringHelpers.h" diff --git a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_SignEntryMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_SignEntryMenu.h similarity index 85% rename from targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_SignEntryMenu.h rename to targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_SignEntryMenu.h index c3c540398..1b565038e 100644 --- a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_SignEntryMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_SignEntryMenu.h @@ -3,11 +3,11 @@ #include #include -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/Controls/UIControl_Button.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_TextInput.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/Controls/UIControl_Button.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_TextInput.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" class SignTileEntity; diff --git a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_TeleportMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_TeleportMenu.cpp similarity index 96% rename from targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_TeleportMenu.cpp rename to targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_TeleportMenu.cpp index f28476144..7609c73a1 100644 --- a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_TeleportMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_TeleportMenu.cpp @@ -4,14 +4,14 @@ #include #include "platform/InputActions.h" -#include "app/common/src/Console_Debug_enum.h" -#include "app/common/src/Network/GameNetworkManager.h" -#include "app/common/src/Network/NetworkPlayerInterface.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_PlayerList.h" -#include "app/common/src/UI/UILayer.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/Console_Debug_enum.h" +#include "app/common/Network/GameNetworkManager.h" +#include "app/common/Network/NetworkPlayerInterface.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_PlayerList.h" +#include "app/common/UI/UILayer.h" +#include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_TeleportMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_TeleportMenu.h similarity index 84% rename from targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_TeleportMenu.h rename to targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_TeleportMenu.h index 5d5353e4a..9ac75f841 100644 --- a/targets/app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_TeleportMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_TeleportMenu.h @@ -3,13 +3,13 @@ #include #include -#include "app/common/src/Network/GameNetworkManager.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_PlayerList.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/Network/GameNetworkManager.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_PlayerList.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" -#include "app/include/NetTypes.h" +#include "platform/NetTypes.h" class INetworkPlayer; class UILayer; diff --git a/targets/app/common/src/UI/Scenes/UIScene_ConnectingProgress.cpp b/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.cpp similarity index 95% rename from targets/app/common/src/UI/Scenes/UIScene_ConnectingProgress.cpp rename to targets/app/common/UI/Scenes/UIScene_ConnectingProgress.cpp index 30a840eb3..c00a2d1ba 100644 --- a/targets/app/common/src/UI/Scenes/UIScene_ConnectingProgress.cpp +++ b/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.cpp @@ -3,14 +3,14 @@ #include "platform/InputActions.h" #include "platform/sdl2/Profile.h" -#include "app/common/App_enums.h" -#include "app/common/src/Network/GameNetworkManager.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/common/src/UI/Controls/UIControl_Button.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_Progress.h" -#include "app/common/src/UI/UILayer.h" -#include "app/common/src/UI/UIScene.h" +#include "minecraft/GameEnums.h" +#include "app/common/Network/GameNetworkManager.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/Controls/UIControl_Button.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_Progress.h" +#include "app/common/UI/UILayer.h" +#include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "java/System.h" diff --git a/targets/app/common/src/UI/Scenes/UIScene_ConnectingProgress.h b/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.h similarity index 83% rename from targets/app/common/src/UI/Scenes/UIScene_ConnectingProgress.h rename to targets/app/common/UI/Scenes/UIScene_ConnectingProgress.h index fc93b21dd..7866c9959 100644 --- a/targets/app/common/src/UI/Scenes/UIScene_ConnectingProgress.h +++ b/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.h @@ -2,12 +2,12 @@ #include -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_Button.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_Progress.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_Button.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_Progress.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" class UILayer; diff --git a/targets/app/common/src/UI/Scenes/UIScene_FullscreenProgress.cpp b/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.cpp similarity index 97% rename from targets/app/common/src/UI/Scenes/UIScene_FullscreenProgress.cpp rename to targets/app/common/UI/Scenes/UIScene_FullscreenProgress.cpp index bd0fb1c4c..61869e35a 100644 --- a/targets/app/common/src/UI/Scenes/UIScene_FullscreenProgress.cpp +++ b/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.cpp @@ -7,14 +7,14 @@ #include "platform/PlatformTypes.h" #include "platform/InputActions.h" #include "platform/sdl2/Profile.h" -#include "app/common/App_enums.h" -#include "app/common/src/Network/GameNetworkManager.h" -#include "app/common/src/Tutorial/Tutorial.h" -#include "app/common/src/UI/Controls/UIControl_Button.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_Progress.h" -#include "app/common/src/UI/UILayer.h" -#include "app/common/src/UI/UIScene.h" +#include "minecraft/GameEnums.h" +#include "app/common/Network/GameNetworkManager.h" +#include "app/common/Tutorial/Tutorial.h" +#include "app/common/UI/Controls/UIControl_Button.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_Progress.h" +#include "app/common/UI/UILayer.h" +#include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "app/linux/Stubs/winapi_stubs.h" diff --git a/targets/app/common/src/UI/Scenes/UIScene_FullscreenProgress.h b/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.h similarity index 84% rename from targets/app/common/src/UI/Scenes/UIScene_FullscreenProgress.h rename to targets/app/common/UI/Scenes/UIScene_FullscreenProgress.h index 549329eda..e3b5b54cf 100644 --- a/targets/app/common/src/UI/Scenes/UIScene_FullscreenProgress.h +++ b/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.h @@ -2,13 +2,13 @@ #include -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_Button.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_Progress.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_Button.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_Progress.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" class C4JThread; diff --git a/targets/app/common/src/UI/Scenes/UIScene_Keyboard.cpp b/targets/app/common/UI/Scenes/UIScene_Keyboard.cpp similarity index 96% rename from targets/app/common/src/UI/Scenes/UIScene_Keyboard.cpp rename to targets/app/common/UI/Scenes/UIScene_Keyboard.cpp index 23b1a8567..44dbaa8d1 100644 --- a/targets/app/common/src/UI/Scenes/UIScene_Keyboard.cpp +++ b/targets/app/common/UI/Scenes/UIScene_Keyboard.cpp @@ -2,11 +2,11 @@ #include "platform/InputActions.h" #include "app/common/App_Defines.h" -#include "app/common/src/UI/Controls/UIControl_Button.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_TextInput.h" -#include "app/common/src/UI/UILayer.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/Controls/UIControl_Button.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_TextInput.h" +#include "app/common/UI/UILayer.h" +#include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "util/StringHelpers.h" diff --git a/targets/app/common/src/UI/Scenes/UIScene_Keyboard.h b/targets/app/common/UI/Scenes/UIScene_Keyboard.h similarity index 92% rename from targets/app/common/src/UI/Scenes/UIScene_Keyboard.h rename to targets/app/common/UI/Scenes/UIScene_Keyboard.h index 2ace04f7c..61defc8f3 100644 --- a/targets/app/common/src/UI/Scenes/UIScene_Keyboard.h +++ b/targets/app/common/UI/Scenes/UIScene_Keyboard.h @@ -2,11 +2,11 @@ #include -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/Controls/UIControl_Button.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/Controls/UIControl_TextInput.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/Controls/UIControl_Button.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/Controls/UIControl_TextInput.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Scenes/UIScene_MessageBox.cpp b/targets/app/common/UI/Scenes/UIScene_MessageBox.cpp similarity index 95% rename from targets/app/common/src/UI/Scenes/UIScene_MessageBox.cpp rename to targets/app/common/UI/Scenes/UIScene_MessageBox.cpp index 60a02ef5e..348461ba0 100644 --- a/targets/app/common/src/UI/Scenes/UIScene_MessageBox.cpp +++ b/targets/app/common/UI/Scenes/UIScene_MessageBox.cpp @@ -4,11 +4,11 @@ #include "platform/PlatformTypes.h" #include "platform/InputActions.h" #include "platform/sdl2/Profile.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/common/src/UI/Controls/UIControl_Button.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/UILayer.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/Controls/UIControl_Button.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/UILayer.h" +#include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "strings.h" diff --git a/targets/app/common/src/UI/Scenes/UIScene_MessageBox.h b/targets/app/common/UI/Scenes/UIScene_MessageBox.h similarity index 90% rename from targets/app/common/src/UI/Scenes/UIScene_MessageBox.h rename to targets/app/common/UI/Scenes/UIScene_MessageBox.h index de4d0d2cc..69c91028d 100644 --- a/targets/app/common/src/UI/Scenes/UIScene_MessageBox.h +++ b/targets/app/common/UI/Scenes/UIScene_MessageBox.h @@ -3,10 +3,10 @@ #include #include "platform/sdl2/Storage.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/Controls/UIControl_Button.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/Controls/UIControl_Button.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Scenes/UIScene_QuadrantSignin.cpp b/targets/app/common/UI/Scenes/UIScene_QuadrantSignin.cpp similarity index 97% rename from targets/app/common/src/UI/Scenes/UIScene_QuadrantSignin.cpp rename to targets/app/common/UI/Scenes/UIScene_QuadrantSignin.cpp index 6cd46d396..1cfb41e50 100644 --- a/targets/app/common/src/UI/Scenes/UIScene_QuadrantSignin.cpp +++ b/targets/app/common/UI/Scenes/UIScene_QuadrantSignin.cpp @@ -7,10 +7,10 @@ #include "platform/InputActions.h" #include "platform/sdl2/Input.h" #include "platform/sdl2/Profile.h" -#include "app/common/src/UI/Controls/UIControl_BitmapIcon.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/UILayer.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/Controls/UIControl_BitmapIcon.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/UILayer.h" +#include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "strings.h" diff --git a/targets/app/common/src/UI/Scenes/UIScene_QuadrantSignin.h b/targets/app/common/UI/Scenes/UIScene_QuadrantSignin.h similarity index 93% rename from targets/app/common/src/UI/Scenes/UIScene_QuadrantSignin.h rename to targets/app/common/UI/Scenes/UIScene_QuadrantSignin.h index 02196ad87..a360ae6e5 100644 --- a/targets/app/common/src/UI/Scenes/UIScene_QuadrantSignin.h +++ b/targets/app/common/UI/Scenes/UIScene_QuadrantSignin.h @@ -3,12 +3,12 @@ #include #include -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_BitmapIcon.h" -#include "app/common/src/UI/Controls/UIControl_Label.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_BitmapIcon.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/Scenes/UIScene_Timer.cpp b/targets/app/common/UI/Scenes/UIScene_Timer.cpp similarity index 88% rename from targets/app/common/src/UI/Scenes/UIScene_Timer.cpp rename to targets/app/common/UI/Scenes/UIScene_Timer.cpp index 66ade73ed..97d4e59e0 100644 --- a/targets/app/common/src/UI/Scenes/UIScene_Timer.cpp +++ b/targets/app/common/UI/Scenes/UIScene_Timer.cpp @@ -1,7 +1,7 @@ #include "UIScene_Timer.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/UIScene.h" class UILayer; diff --git a/targets/app/common/src/UI/Scenes/UIScene_Timer.h b/targets/app/common/UI/Scenes/UIScene_Timer.h similarity index 84% rename from targets/app/common/src/UI/Scenes/UIScene_Timer.h rename to targets/app/common/UI/Scenes/UIScene_Timer.h index 788f64055..f8830a6b4 100644 --- a/targets/app/common/src/UI/Scenes/UIScene_Timer.h +++ b/targets/app/common/UI/Scenes/UIScene_Timer.h @@ -2,9 +2,9 @@ #include -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/UIScene.h" class UILayer; diff --git a/targets/app/common/src/UI/UIBitmapFont.cpp b/targets/app/common/UI/UIBitmapFont.cpp similarity index 99% rename from targets/app/common/src/UI/UIBitmapFont.cpp rename to targets/app/common/UI/UIBitmapFont.cpp index 651ce19b9..74b41e2fa 100644 --- a/targets/app/common/src/UI/UIBitmapFont.cpp +++ b/targets/app/common/UI/UIBitmapFont.cpp @@ -5,7 +5,7 @@ #include "app/linux/Stubs/iggy_stubs.h" #endif #include "app/linux/Iggy/include/rrCore.h" -#include "app/include/BufferedImage.h" +#include "minecraft/client/BufferedImage.h" #include "UIFontData.h" ///////////////////////////// diff --git a/targets/app/common/src/UI/UIBitmapFont.h b/targets/app/common/UI/UIBitmapFont.h similarity index 100% rename from targets/app/common/src/UI/UIBitmapFont.h rename to targets/app/common/UI/UIBitmapFont.h diff --git a/targets/app/common/src/UI/UIController.cpp b/targets/app/common/UI/UIController.cpp similarity index 98% rename from targets/app/common/src/UI/UIController.cpp rename to targets/app/common/UI/UIController.cpp index 6f2ade9b1..8f77249dd 100644 --- a/targets/app/common/src/UI/UIController.cpp +++ b/targets/app/common/UI/UIController.cpp @@ -12,32 +12,32 @@ #include "platform/sdl2/Input.h" #include "platform/sdl2/Profile.h" -#include "app/common/App_enums.h" -#include "app/common/src/Audio/SoundEngine.h" -#include "app/common/src/DLC/DLCManager.h" -#include "app/common/src/Network/GameNetworkManager.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/common/src/UI/Components/UIComponent_DebugUIConsole.h" -#include "app/common/src/UI/Components/UIComponent_DebugUIMarketingGuide.h" -#include "app/common/src/UI/Components/UIComponent_PressStartToPlay.h" -#include "app/common/src/UI/Components/UIComponent_Tooltips.h" -#include "app/common/src/UI/Components/UIComponent_TutorialPopup.h" -#include "app/common/src/UI/Components/UIScene_HUD.h" -#include "app/common/src/UI/UIBitmapFont.h" -#include "app/common/src/UI/UIGroup.h" -#include "app/common/src/UI/UIScene.h" -#include "app/common/src/UI/UIString.h" -#include "app/common/src/UI/UITTFFont.h" +#include "minecraft/GameEnums.h" +#include "app/common/Audio/SoundEngine.h" +#include "app/common/DLC/DLCManager.h" +#include "app/common/Network/GameNetworkManager.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/Components/UIComponent_DebugUIConsole.h" +#include "app/common/UI/Components/UIComponent_DebugUIMarketingGuide.h" +#include "app/common/UI/Components/UIComponent_PressStartToPlay.h" +#include "app/common/UI/Components/UIComponent_Tooltips.h" +#include "app/common/UI/Components/UIComponent_TutorialPopup.h" +#include "app/common/UI/Components/UIScene_HUD.h" +#include "app/common/UI/UIBitmapFont.h" +#include "app/common/UI/UIGroup.h" +#include "app/common/UI/UIScene.h" +#include "app/common/UI/UIString.h" +#include "app/common/UI/UITTFFont.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "app/include/BufferedImage.h" +#include "minecraft/client/BufferedImage.h" #include "UIFontData.h" -#include "XboxStubs.h" +#include "platform/XboxStubs.h" #include "platform/C4JThread.h" #include "util/Timer.h" diff --git a/targets/app/common/src/UI/UIController.h b/targets/app/common/UI/UIController.h similarity index 98% rename from targets/app/common/src/UI/UIController.h rename to targets/app/common/UI/UIController.h index d5a22b2a8..dfd92ec1a 100644 --- a/targets/app/common/src/UI/UIController.h +++ b/targets/app/common/UI/UIController.h @@ -24,10 +24,10 @@ #include "platform/InputActions.h" #include "platform/sdl2/Render.h" #include "platform/sdl2/Storage.h" -#include "app/common/src/UI/All Platforms/IUIController.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/common/src/UI/Controls/UIControl.h" +#include "app/common/UI/All Platforms/IUIController.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/Controls/UIControl.h" #include "app/linux/Iggy/include/rrCore.h" #include "UIGroup.h" #include "minecraft/sounds/SoundTypes.h" diff --git a/targets/app/common/src/UI/UIFontData.cpp b/targets/app/common/UI/UIFontData.cpp similarity index 100% rename from targets/app/common/src/UI/UIFontData.cpp rename to targets/app/common/UI/UIFontData.cpp diff --git a/targets/app/common/src/UI/UIFontData.h b/targets/app/common/UI/UIFontData.h similarity index 100% rename from targets/app/common/src/UI/UIFontData.h rename to targets/app/common/UI/UIFontData.h diff --git a/targets/app/common/src/UI/UIGroup.cpp b/targets/app/common/UI/UIGroup.cpp similarity index 98% rename from targets/app/common/src/UI/UIGroup.cpp rename to targets/app/common/UI/UIGroup.cpp index f992e39a1..fb9fe99f7 100644 --- a/targets/app/common/src/UI/UIGroup.cpp +++ b/targets/app/common/UI/UIGroup.cpp @@ -2,10 +2,10 @@ #include "platform/sdl2/Profile.h" #include "platform/sdl2/Render.h" -#include "app/common/src/Tutorial/Tutorial.h" -#include "app/common/src/Tutorial/TutorialMode.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/UILayer.h" +#include "app/common/Tutorial/Tutorial.h" +#include "app/common/Tutorial/TutorialMode.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/UILayer.h" #include "app/linux/Iggy/include/rrCore.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" diff --git a/targets/app/common/src/UI/UIGroup.h b/targets/app/common/UI/UIGroup.h similarity index 98% rename from targets/app/common/src/UI/UIGroup.h rename to targets/app/common/UI/UIGroup.h index a71a4e1eb..4d796989d 100644 --- a/targets/app/common/src/UI/UIGroup.h +++ b/targets/app/common/UI/UIGroup.h @@ -2,7 +2,7 @@ #include #include "platform/sdl2/Render.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" +#include "app/common/UI/All Platforms/UIEnums.h" #include "app/linux/Iggy/include/rrCore.h" #include "UILayer.h" diff --git a/targets/app/common/src/UI/UILayer.cpp b/targets/app/common/UI/UILayer.cpp similarity index 83% rename from targets/app/common/src/UI/UILayer.cpp rename to targets/app/common/UI/UILayer.cpp index 39390a1e0..6db553aa1 100644 --- a/targets/app/common/src/UI/UILayer.cpp +++ b/targets/app/common/UI/UILayer.cpp @@ -3,79 +3,79 @@ #include #include "platform/sdl2/Render.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/Components/UIComponent_Chat.h" -#include "app/common/src/UI/Components/UIComponent_DebugUIConsole.h" -#include "app/common/src/UI/Components/UIComponent_DebugUIMarketingGuide.h" -#include "app/common/src/UI/Components/UIComponent_Logo.h" -#include "app/common/src/UI/Components/UIComponent_MenuBackground.h" -#include "app/common/src/UI/Components/UIComponent_Panorama.h" -#include "app/common/src/UI/Components/UIComponent_PressStartToPlay.h" -#include "app/common/src/UI/Components/UIComponent_Tooltips.h" -#include "app/common/src/UI/Components/UIComponent_TutorialPopup.h" -#include "app/common/src/UI/Components/UIScene_HUD.h" -#include "app/common/src/UI/Scenes/Debug/UIScene_DebugCreateSchematic.h" -#include "app/common/src/UI/Scenes/Debug/UIScene_DebugOptions.h" -#include "app/common/src/UI/Scenes/Debug/UIScene_DebugOverlay.h" -#include "app/common/src/UI/Scenes/Debug/UIScene_DebugSetCamera.h" -#include "app/common/src/UI/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.h" -#include "app/common/src/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.h" -#include "app/common/src/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.h" -#include "app/common/src/UI/Scenes/Frontend Menu screens/UIScene_EULA.h" -#include "app/common/src/UI/Scenes/Frontend Menu screens/UIScene_Intro.h" -#include "app/common/src/UI/Scenes/Frontend Menu screens/UIScene_JoinMenu.h" -#include "app/common/src/UI/Scenes/Frontend Menu screens/UIScene_LaunchMoreOptionsMenu.h" -#include "app/common/src/UI/Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.h" -#include "app/common/src/UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.h" -#include "app/common/src/UI/Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.h" -#include "app/common/src/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.h" -#include "app/common/src/UI/Scenes/Frontend Menu screens/UIScene_NewUpdateMessage.h" -#include "app/common/src/UI/Scenes/Frontend Menu screens/UIScene_SaveMessage.h" -#include "app/common/src/UI/Scenes/Frontend Menu screens/UIScene_TrialExitUpsell.h" -#include "app/common/src/UI/Scenes/Help & Options/UIScene_ControlsMenu.h" -#include "app/common/src/UI/Scenes/Help & Options/UIScene_Credits.h" -#include "app/common/src/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.h" -#include "app/common/src/UI/Scenes/Help & Options/UIScene_HowToPlay.h" -#include "app/common/src/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.h" -#include "app/common/src/UI/Scenes/Help & Options/UIScene_LanguageSelector.h" -#include "app/common/src/UI/Scenes/Help & Options/UIScene_ReinstallMenu.h" -#include "app/common/src/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.h" -#include "app/common/src/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.h" -#include "app/common/src/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.h" -#include "app/common/src/UI/Scenes/Help & Options/UIScene_SettingsMenu.h" -#include "app/common/src/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.h" -#include "app/common/src/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.h" -#include "app/common/src/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.h" -#include "app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AnvilMenu.h" -#include "app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BeaconMenu.h" -#include "app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BrewingStandMenu.h" -#include "app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_ContainerMenu.h" -#include "app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.h" -#include "app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_DispenserMenu.h" -#include "app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.h" -#include "app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FireworksMenu.h" -#include "app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FurnaceMenu.h" -#include "app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HopperMenu.h" -#include "app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.h" -#include "app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.h" -#include "app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.h" -#include "app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_CraftingMenu.h" -#include "app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_DeathMenu.h" -#include "app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_EndPoem.h" -#include "app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_InGameHostOptionsMenu.h" -#include "app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.h" -#include "app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.h" -#include "app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.h" -#include "app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_SignEntryMenu.h" -#include "app/common/src/UI/Scenes/In-Game Menu Screens/UIScene_TeleportMenu.h" -#include "app/common/src/UI/Scenes/UIScene_ConnectingProgress.h" -#include "app/common/src/UI/Scenes/UIScene_FullscreenProgress.h" -#include "app/common/src/UI/Scenes/UIScene_Keyboard.h" -#include "app/common/src/UI/Scenes/UIScene_MessageBox.h" -#include "app/common/src/UI/Scenes/UIScene_QuadrantSignin.h" -#include "app/common/src/UI/Scenes/UIScene_Timer.h" -#include "app/common/src/UI/UIGroup.h" -#include "app/common/src/UI/UIScene.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/Components/UIComponent_Chat.h" +#include "app/common/UI/Components/UIComponent_DebugUIConsole.h" +#include "app/common/UI/Components/UIComponent_DebugUIMarketingGuide.h" +#include "app/common/UI/Components/UIComponent_Logo.h" +#include "app/common/UI/Components/UIComponent_MenuBackground.h" +#include "app/common/UI/Components/UIComponent_Panorama.h" +#include "app/common/UI/Components/UIComponent_PressStartToPlay.h" +#include "app/common/UI/Components/UIComponent_Tooltips.h" +#include "app/common/UI/Components/UIComponent_TutorialPopup.h" +#include "app/common/UI/Components/UIScene_HUD.h" +#include "app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.h" +#include "app/common/UI/Scenes/Debug/UIScene_DebugOptions.h" +#include "app/common/UI/Scenes/Debug/UIScene_DebugOverlay.h" +#include "app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.h" +#include "app/common/UI/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.h" +#include "app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.h" +#include "app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.h" +#include "app/common/UI/Scenes/Frontend Menu screens/UIScene_EULA.h" +#include "app/common/UI/Scenes/Frontend Menu screens/UIScene_Intro.h" +#include "app/common/UI/Scenes/Frontend Menu screens/UIScene_JoinMenu.h" +#include "app/common/UI/Scenes/Frontend Menu screens/UIScene_LaunchMoreOptionsMenu.h" +#include "app/common/UI/Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.h" +#include "app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.h" +#include "app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.h" +#include "app/common/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.h" +#include "app/common/UI/Scenes/Frontend Menu screens/UIScene_NewUpdateMessage.h" +#include "app/common/UI/Scenes/Frontend Menu screens/UIScene_SaveMessage.h" +#include "app/common/UI/Scenes/Frontend Menu screens/UIScene_TrialExitUpsell.h" +#include "app/common/UI/Scenes/Help & Options/UIScene_ControlsMenu.h" +#include "app/common/UI/Scenes/Help & Options/UIScene_Credits.h" +#include "app/common/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.h" +#include "app/common/UI/Scenes/Help & Options/UIScene_HowToPlay.h" +#include "app/common/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.h" +#include "app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.h" +#include "app/common/UI/Scenes/Help & Options/UIScene_ReinstallMenu.h" +#include "app/common/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.h" +#include "app/common/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.h" +#include "app/common/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.h" +#include "app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.h" +#include "app/common/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.h" +#include "app/common/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.h" +#include "app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.h" +#include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AnvilMenu.h" +#include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BeaconMenu.h" +#include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BrewingStandMenu.h" +#include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_ContainerMenu.h" +#include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.h" +#include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_DispenserMenu.h" +#include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.h" +#include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FireworksMenu.h" +#include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FurnaceMenu.h" +#include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HopperMenu.h" +#include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.h" +#include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.h" +#include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.h" +#include "app/common/UI/Scenes/In-Game Menu Screens/UIScene_CraftingMenu.h" +#include "app/common/UI/Scenes/In-Game Menu Screens/UIScene_DeathMenu.h" +#include "app/common/UI/Scenes/In-Game Menu Screens/UIScene_EndPoem.h" +#include "app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameHostOptionsMenu.h" +#include "app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.h" +#include "app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.h" +#include "app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.h" +#include "app/common/UI/Scenes/In-Game Menu Screens/UIScene_SignEntryMenu.h" +#include "app/common/UI/Scenes/In-Game Menu Screens/UIScene_TeleportMenu.h" +#include "app/common/UI/Scenes/UIScene_ConnectingProgress.h" +#include "app/common/UI/Scenes/UIScene_FullscreenProgress.h" +#include "app/common/UI/Scenes/UIScene_Keyboard.h" +#include "app/common/UI/Scenes/UIScene_MessageBox.h" +#include "app/common/UI/Scenes/UIScene_QuadrantSignin.h" +#include "app/common/UI/Scenes/UIScene_Timer.h" +#include "app/common/UI/UIGroup.h" +#include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" diff --git a/targets/app/common/src/UI/UILayer.h b/targets/app/common/UI/UILayer.h similarity index 98% rename from targets/app/common/src/UI/UILayer.h rename to targets/app/common/UI/UILayer.h index 651d360cb..77f1a582a 100644 --- a/targets/app/common/src/UI/UILayer.h +++ b/targets/app/common/UI/UILayer.h @@ -7,7 +7,7 @@ #include #include "platform/sdl2/Render.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" +#include "app/common/UI/All Platforms/UIEnums.h" #include "app/linux/Iggy/include/rrCore.h" // using namespace std; diff --git a/targets/app/common/src/UI/UIScene.cpp b/targets/app/common/UI/UIScene.cpp similarity index 99% rename from targets/app/common/src/UI/UIScene.cpp rename to targets/app/common/UI/UIScene.cpp index 20c833581..8bded15d2 100644 --- a/targets/app/common/src/UI/UIScene.cpp +++ b/targets/app/common/UI/UIScene.cpp @@ -7,13 +7,13 @@ #include "platform/PlatformTypes.h" #include "platform/InputActions.h" #include "platform/sdl2/Render.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/common/src/UI/Controls/UIControl.h" -#include "app/common/src/UI/Controls/UIControl_Base.h" -#include "app/common/src/UI/UIController.h" -#include "app/common/src/UI/UIGroup.h" -#include "app/common/src/UI/UILayer.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/Controls/UIControl.h" +#include "app/common/UI/Controls/UIControl_Base.h" +#include "app/common/UI/UIController.h" +#include "app/common/UI/UIGroup.h" +#include "app/common/UI/UILayer.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/UIScene.h b/targets/app/common/UI/UIScene.h similarity index 98% rename from targets/app/common/src/UI/UIScene.h rename to targets/app/common/UI/UIScene.h index 765e3947e..b76240fce 100644 --- a/targets/app/common/src/UI/UIScene.h +++ b/targets/app/common/UI/UIScene.h @@ -14,9 +14,9 @@ #include #include "platform/sdl2/Render.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/common/src/UI/Controls/UIControl_Base.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/Controls/UIControl_Base.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" diff --git a/targets/app/common/src/UI/UIString.cpp b/targets/app/common/UI/UIString.cpp similarity index 99% rename from targets/app/common/src/UI/UIString.cpp rename to targets/app/common/UI/UIString.cpp index b53d70b26..7e6fcd5d2 100644 --- a/targets/app/common/src/UI/UIString.cpp +++ b/targets/app/common/UI/UIString.cpp @@ -1,7 +1,7 @@ #include "UIString.h" #include "app/linux/LinuxGame.h" -#include "app/include/XboxStubs.h" +#include "platform/XboxStubs.h" #include "util/StringHelpers.h" bool UIString::setCurrentLanguage() { diff --git a/targets/app/common/src/UI/UIString.h b/targets/app/common/UI/UIString.h similarity index 100% rename from targets/app/common/src/UI/UIString.h rename to targets/app/common/UI/UIString.h diff --git a/targets/app/common/src/UI/UITTFFont.cpp b/targets/app/common/UI/UITTFFont.cpp similarity index 100% rename from targets/app/common/src/UI/UITTFFont.cpp rename to targets/app/common/UI/UITTFFont.cpp diff --git a/targets/app/common/src/UI/UITTFFont.h b/targets/app/common/UI/UITTFFont.h similarity index 100% rename from targets/app/common/src/UI/UITTFFont.h rename to targets/app/common/UI/UITTFFont.h diff --git a/targets/app/common/XboxStubs.cpp b/targets/app/common/XboxStubs.cpp new file mode 100644 index 000000000..9a713ee46 --- /dev/null +++ b/targets/app/common/XboxStubs.cpp @@ -0,0 +1,18 @@ +#include "platform/PlatformTypes.h" +#include "platform/XboxStubs.h" + +bool IsEqualXUID(PlayerUID a, PlayerUID b) { return a == b; } + +uint32_t XUserGetSigninInfo(uint32_t dwUserIndex, uint32_t dwFlags, + PXUSER_SIGNIN_INFO pSigninInfo) { + return 0; +} + +const wchar_t* CXuiStringTable::Lookup(const wchar_t* szId) { return szId; } +const wchar_t* CXuiStringTable::Lookup(uint32_t nIndex) { return L"String"; } +void CXuiStringTable::Clear() {} +int32_t CXuiStringTable::Load(const wchar_t* szId) { return 0; } + +uint32_t XGetLanguage() { return 1; } +uint32_t XGetLocale() { return 0; } +uint32_t XEnableGuestSignin(bool fEnable) { return 0; } diff --git a/targets/app/common/src/GameRules/ConsoleGameRules.h b/targets/app/common/src/GameRules/ConsoleGameRules.h deleted file mode 100644 index 7a4521fc0..000000000 --- a/targets/app/common/src/GameRules/ConsoleGameRules.h +++ /dev/null @@ -1,25 +0,0 @@ -#pragma once -#include "ConsoleGameRulesConstants.h" -#include "GameRuleManager.h" -#include "app/common/src/GameRules/LevelGeneration/ApplySchematicRuleDefinition.h" -#include "app/common/src/GameRules/LevelGeneration/BiomeOverride.h" -#include "app/common/src/GameRules/LevelGeneration/ConsoleGenerateStructure.h" -#include "app/common/src/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h" -#include "app/common/src/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/common/src/GameRules/LevelGeneration/StartFeature.h" -#include "app/common/src/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.h" -#include "app/common/src/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h" -#include "app/common/src/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.h" -#include "app/common/src/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.h" -#include "app/common/src/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.h" -#include "app/common/src/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.h" -#include "app/common/src/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.h" -#include "app/common/src/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.h" -#include "app/common/src/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h" -#include "app/common/src/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" -#include "app/common/src/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h" -#include "app/common/src/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.h" -#include "app/common/src/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.h" -#include "app/common/src/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.h" -#include "app/common/src/GameRules/LevelRules/Rules/GameRule.h" -#include "app/common/src/GameRules/LevelRules/Rules/GameRulesInstance.h" diff --git a/targets/app/src/stubs.cpp b/targets/app/common/stubs.cpp similarity index 97% rename from targets/app/src/stubs.cpp rename to targets/app/common/stubs.cpp index e7b0bf301..85132ba4d 100644 --- a/targets/app/src/stubs.cpp +++ b/targets/app/common/stubs.cpp @@ -1,5 +1,5 @@ -#include "app/include/stubs.h" +#include "platform/stubs.h" #include "app/linux/LinuxGame.h" #if defined(__linux__) diff --git a/targets/app/linux/Leaderboards/LinuxLeaderboardManager.cpp b/targets/app/linux/Leaderboards/LinuxLeaderboardManager.cpp index e05e76820..dda0e9728 100644 --- a/targets/app/linux/Leaderboards/LinuxLeaderboardManager.cpp +++ b/targets/app/linux/Leaderboards/LinuxLeaderboardManager.cpp @@ -1,6 +1,6 @@ #include "LinuxLeaderboardManager.h" -#include "app/common/src/Leaderboards/LeaderboardManager.h" +#include "app/common/Leaderboards/LeaderboardManager.h" LeaderboardManager* LeaderboardManager::m_instance = new LinuxLeaderboardManager(); // Singleton instance of the diff --git a/targets/app/linux/Leaderboards/LinuxLeaderboardManager.h b/targets/app/linux/Leaderboards/LinuxLeaderboardManager.h index b831d8e28..72fe03e0e 100644 --- a/targets/app/linux/Leaderboards/LinuxLeaderboardManager.h +++ b/targets/app/linux/Leaderboards/LinuxLeaderboardManager.h @@ -1,7 +1,7 @@ #pragma once #include "platform/PlatformTypes.h" -#include "app/common/src/Leaderboards/LeaderboardManager.h" +#include "app/common/Leaderboards/LeaderboardManager.h" class LinuxLeaderboardManager : public LeaderboardManager { public: diff --git a/targets/app/linux/LinuxGL.cpp b/targets/app/linux/LinuxGL.cpp index 19a3ea8c0..4217f1d66 100644 --- a/targets/app/linux/LinuxGL.cpp +++ b/targets/app/linux/LinuxGL.cpp @@ -1,7 +1,7 @@ #ifdef __linux__ #include "platform/sdl2/Render.h" -#include "app/include/stubs.h" +#include "platform/stubs.h" #include "java/ByteBuffer.h" #include "java/FloatBuffer.h" diff --git a/targets/app/linux/LinuxGame.cpp b/targets/app/linux/LinuxGame.cpp index 919c79d12..f53c18b92 100644 --- a/targets/app/linux/LinuxGame.cpp +++ b/targets/app/linux/LinuxGame.cpp @@ -7,10 +7,10 @@ #include "platform/sdl2/Profile.h" #include "platform/sdl2/Render.h" #include "platform/sdl2/Storage.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/Game.h" -#include "app/common/src/Network/GameNetworkManager.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" +#include "app/common/Network/GameNetworkManager.h" +#include "app/common/UI/All Platforms/UIStructs.h" #include "platform/C4JThread.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/User.h" diff --git a/targets/app/linux/LinuxGame.h b/targets/app/linux/LinuxGame.h index a9d0160ef..99a9fee55 100644 --- a/targets/app/linux/LinuxGame.h +++ b/targets/app/linux/LinuxGame.h @@ -2,7 +2,7 @@ #include -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/Game.h" class C4JStringTable; diff --git a/targets/app/linux/Linux_Minecraft.cpp b/targets/app/linux/Linux_Minecraft.cpp index 81cb0d3d7..4085eec72 100644 --- a/targets/app/linux/Linux_Minecraft.cpp +++ b/targets/app/linux/Linux_Minecraft.cpp @@ -1,3 +1,5 @@ +#include "app/common/AppGameServices.h" +#include "app/common/GameMenuService.h" // Minecraft.cpp : Defines the entry point for the application. // @@ -48,7 +50,7 @@ static void sigsegv_handler(int sig) { #include "minecraft/stats/StatsCounter.h" #include "minecraft/world/level/Level.h" -// #include "app/common/src/Leaderboards/LeaderboardManager.h" +// #include "app/common/Leaderboards/LeaderboardManager.h" // #include "../Common/XUI/XUI_Scene_Container.h" // #include "NetworkManager.h" #include "platform/PlatformTypes.h" @@ -58,8 +60,8 @@ static void sigsegv_handler(int sig) { #include "platform/sdl2/Render.h" #include "platform/sdl2/Storage.h" #include "app/common/App_Defines.h" -#include "app/common/src/Audio/SoundEngine.h" -#include "app/common/src/Network/GameNetworkManager.h" +#include "app/common/Audio/SoundEngine.h" +#include "app/common/Network/GameNetworkManager.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" @@ -461,7 +463,9 @@ int main(int argc, const char* argv[]) { app.loadMediaArchive(); app.loadStringTable(); - // fuck you + static GameMenuService menuService(app); + static AppGameServices services(app, menuService); + initGameServices(&services); ui.init(1920, 1080); // storage manager is needed for the trial key check StorageManager.Init( diff --git a/targets/app/linux/Linux_UIController.cpp b/targets/app/linux/Linux_UIController.cpp index e6cf502b2..8a5417a43 100644 --- a/targets/app/linux/Linux_UIController.cpp +++ b/targets/app/linux/Linux_UIController.cpp @@ -3,7 +3,7 @@ // GDraw GL backend for Linux #include "platform/sdl2/Render.h" #include "Linux_UIController.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" +#include "app/common/UI/All Platforms/UIStructs.h" #include "app/linux/Iggy/gdraw/gdraw.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY diff --git a/targets/app/linux/Linux_UIController.h b/targets/app/linux/Linux_UIController.h index 38dcd6d12..09f5dfc30 100644 --- a/targets/app/linux/Linux_UIController.h +++ b/targets/app/linux/Linux_UIController.h @@ -1,7 +1,7 @@ #pragma once -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/common/src/UI/UIController.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/UIController.h" #include "app/linux/Iggy/include/iggy.h" #include "app/linux/Iggy/include/rrCore.h" diff --git a/targets/app/linux/linux_game_stubs.cpp b/targets/app/linux/linux_game_stubs.cpp index 0fea096da..6bd332517 100644 --- a/targets/app/linux/linux_game_stubs.cpp +++ b/targets/app/linux/linux_game_stubs.cpp @@ -1,10 +1,8 @@ #ifdef __linux__ #include "app/common/Game.h" -#include "app/include/stubs.h" +#include "platform/stubs.h" void Display::update() {} -int Game::GetTPConfigVal(wchar_t* pwchDataFile) { return 0; } - #endif diff --git a/targets/app/windows/Windows64_UIController.h b/targets/app/windows/Windows64_UIController.h index 4f0749f6a..70e05b148 100644 --- a/targets/app/windows/Windows64_UIController.h +++ b/targets/app/windows/Windows64_UIController.h @@ -1,6 +1,6 @@ #pragma once -#include "app/common/src/UI/UIController.h" +#include "app/common/UI/UIController.h" class ConsoleUIController : public UIController { private: diff --git a/targets/app/windows/Source Files/Leaderboards/WindowsLeaderboardManager.cpp b/targets/app/windows/src/Leaderboards/WindowsLeaderboardManager.cpp similarity index 100% rename from targets/app/windows/Source Files/Leaderboards/WindowsLeaderboardManager.cpp rename to targets/app/windows/src/Leaderboards/WindowsLeaderboardManager.cpp diff --git a/targets/app/windows/Source Files/Leaderboards/WindowsLeaderboardManager.h b/targets/app/windows/src/Leaderboards/WindowsLeaderboardManager.h similarity index 96% rename from targets/app/windows/Source Files/Leaderboards/WindowsLeaderboardManager.h rename to targets/app/windows/src/Leaderboards/WindowsLeaderboardManager.h index 7f4cdc1bb..df81e27d6 100644 --- a/targets/app/windows/Source Files/Leaderboards/WindowsLeaderboardManager.h +++ b/targets/app/windows/src/Leaderboards/WindowsLeaderboardManager.h @@ -1,6 +1,6 @@ #pragma once -#include "app/common/src/Leaderboards/LeaderboardManager.h" +#include "app/common/Leaderboards/LeaderboardManager.h" class WindowsLeaderboardManager : public LeaderboardManager { public: diff --git a/targets/app/windows/Source Files/Windows64_Minecraft.cpp b/targets/app/windows/src/Windows64_Minecraft.cpp similarity index 99% rename from targets/app/windows/Source Files/Windows64_Minecraft.cpp rename to targets/app/windows/src/Windows64_Minecraft.cpp index 985594685..7b43f2d06 100644 --- a/targets/app/windows/Source Files/Windows64_Minecraft.cpp +++ b/targets/app/windows/src/Windows64_Minecraft.cpp @@ -5,7 +5,7 @@ #include -#include "app/common/src/Network/Socket.h" +#include "app/common/Network/Socket.h" #include "util/StringHelpers.h" #include "minecraft/client/User.h" #include "minecraft/client/multiplayer/ClientConnection.h" @@ -23,7 +23,7 @@ #include "minecraft/world/phys/AABB.h" #include "minecraft/world/phys/Vec3.h" // #include "Social/SocialManager.h" -// #include "app/common/src/Leaderboards/LeaderboardManager.h" +// #include "app/common/Leaderboards/LeaderboardManager.h" // #include "../Common/XUI/XUI_Scene_Container.h" // #include "NetworkManager.h" #include "../Resource.h" diff --git a/targets/app/common/App_enums.h b/targets/minecraft/GameEnums.h similarity index 100% rename from targets/app/common/App_enums.h rename to targets/minecraft/GameEnums.h diff --git a/targets/minecraft/GameHostOptions.cpp b/targets/minecraft/GameHostOptions.cpp new file mode 100644 index 000000000..33bd30311 --- /dev/null +++ b/targets/minecraft/GameHostOptions.cpp @@ -0,0 +1,167 @@ +#include "minecraft/GameHostOptions.h" + +namespace GameHostOptions { + +unsigned int get(unsigned int settings, eGameHostOption option) { + switch (option) { + case eGameHostOption_FriendsOfFriends: + return (settings & GAME_HOST_OPTION_BITMASK_FRIENDSOFFRIENDS); + case eGameHostOption_Difficulty: + return (settings & GAME_HOST_OPTION_BITMASK_DIFFICULTY); + case eGameHostOption_Gamertags: + return (settings & GAME_HOST_OPTION_BITMASK_GAMERTAGS); + case eGameHostOption_GameType: + return (settings & GAME_HOST_OPTION_BITMASK_GAMETYPE) >> 4; + case eGameHostOption_All: + return (settings & GAME_HOST_OPTION_BITMASK_ALL); + case eGameHostOption_Tutorial: + return ((settings & GAME_HOST_OPTION_BITMASK_GAMERTAGS) | + GAME_HOST_OPTION_BITMASK_TRUSTPLAYERS | + GAME_HOST_OPTION_BITMASK_FIRESPREADS | + GAME_HOST_OPTION_BITMASK_TNT | + GAME_HOST_OPTION_BITMASK_PVP | + GAME_HOST_OPTION_BITMASK_STRUCTURES | 1); + case eGameHostOption_LevelType: + return (settings & GAME_HOST_OPTION_BITMASK_LEVELTYPE); + case eGameHostOption_Structures: + return (settings & GAME_HOST_OPTION_BITMASK_STRUCTURES); + case eGameHostOption_BonusChest: + return (settings & GAME_HOST_OPTION_BITMASK_BONUSCHEST); + case eGameHostOption_HasBeenInCreative: + return (settings & GAME_HOST_OPTION_BITMASK_BEENINCREATIVE); + case eGameHostOption_PvP: + return (settings & GAME_HOST_OPTION_BITMASK_PVP); + case eGameHostOption_TrustPlayers: + return (settings & GAME_HOST_OPTION_BITMASK_TRUSTPLAYERS); + case eGameHostOption_TNT: + return (settings & GAME_HOST_OPTION_BITMASK_TNT); + case eGameHostOption_FireSpreads: + return (settings & GAME_HOST_OPTION_BITMASK_FIRESPREADS); + case eGameHostOption_CheatsEnabled: + return (settings & (GAME_HOST_OPTION_BITMASK_HOSTFLY | + GAME_HOST_OPTION_BITMASK_HOSTHUNGER | + GAME_HOST_OPTION_BITMASK_HOSTINVISIBLE)); + case eGameHostOption_HostCanFly: + return (settings & GAME_HOST_OPTION_BITMASK_HOSTFLY); + case eGameHostOption_HostCanChangeHunger: + return (settings & GAME_HOST_OPTION_BITMASK_HOSTHUNGER); + case eGameHostOption_HostCanBeInvisible: + return (settings & GAME_HOST_OPTION_BITMASK_HOSTINVISIBLE); + case eGameHostOption_BedrockFog: + return (settings & GAME_HOST_OPTION_BITMASK_BEDROCKFOG); + case eGameHostOption_DisableSaving: + return (settings & GAME_HOST_OPTION_BITMASK_DISABLESAVE); + case eGameHostOption_WasntSaveOwner: + return (settings & GAME_HOST_OPTION_BITMASK_NOTOWNER); + case eGameHostOption_WorldSize: + return (settings & GAME_HOST_OPTION_BITMASK_WORLDSIZE) >> + GAME_HOST_OPTION_BITMASK_WORLDSIZE_BITSHIFT; + case eGameHostOption_MobGriefing: + return !(settings & GAME_HOST_OPTION_BITMASK_MOBGRIEFING); + case eGameHostOption_KeepInventory: + return (settings & GAME_HOST_OPTION_BITMASK_KEEPINVENTORY); + case eGameHostOption_DoMobSpawning: + return !(settings & GAME_HOST_OPTION_BITMASK_DOMOBSPAWNING); + case eGameHostOption_DoMobLoot: + return !(settings & GAME_HOST_OPTION_BITMASK_DOMOBLOOT); + case eGameHostOption_DoTileDrops: + return !(settings & GAME_HOST_OPTION_BITMASK_DOTILEDROPS); + case eGameHostOption_NaturalRegeneration: + return !(settings & GAME_HOST_OPTION_BITMASK_NATURALREGEN); + case eGameHostOption_DoDaylightCycle: + return !(settings & GAME_HOST_OPTION_BITMASK_DODAYLIGHTCYCLE); + default: + return 0; + } +} + +void set(unsigned int& settings, eGameHostOption option, unsigned int value) { + auto setBit = [&](unsigned int mask) { + if (value != 0) + settings |= mask; + else + settings &= ~mask; + }; + auto setInvertedBit = [&](unsigned int mask) { + if (value != 1) + settings |= mask; + else + settings &= ~mask; + }; + + switch (option) { + case eGameHostOption_FriendsOfFriends: + setBit(GAME_HOST_OPTION_BITMASK_FRIENDSOFFRIENDS); break; + case eGameHostOption_Difficulty: + settings &= ~GAME_HOST_OPTION_BITMASK_DIFFICULTY; + settings |= (GAME_HOST_OPTION_BITMASK_DIFFICULTY & value); break; + case eGameHostOption_Gamertags: + setBit(GAME_HOST_OPTION_BITMASK_GAMERTAGS); break; + case eGameHostOption_GameType: + settings &= ~GAME_HOST_OPTION_BITMASK_GAMETYPE; + settings |= (GAME_HOST_OPTION_BITMASK_GAMETYPE & (value << 4)); break; + case eGameHostOption_LevelType: + setBit(GAME_HOST_OPTION_BITMASK_LEVELTYPE); break; + case eGameHostOption_Structures: + setBit(GAME_HOST_OPTION_BITMASK_STRUCTURES); break; + case eGameHostOption_BonusChest: + setBit(GAME_HOST_OPTION_BITMASK_BONUSCHEST); break; + case eGameHostOption_HasBeenInCreative: + setBit(GAME_HOST_OPTION_BITMASK_BEENINCREATIVE); break; + case eGameHostOption_PvP: + setBit(GAME_HOST_OPTION_BITMASK_PVP); break; + case eGameHostOption_TrustPlayers: + setBit(GAME_HOST_OPTION_BITMASK_TRUSTPLAYERS); break; + case eGameHostOption_TNT: + setBit(GAME_HOST_OPTION_BITMASK_TNT); break; + case eGameHostOption_FireSpreads: + setBit(GAME_HOST_OPTION_BITMASK_FIRESPREADS); break; + case eGameHostOption_CheatsEnabled: + if (value != 0) { + settings |= GAME_HOST_OPTION_BITMASK_HOSTFLY; + settings |= GAME_HOST_OPTION_BITMASK_HOSTHUNGER; + settings |= GAME_HOST_OPTION_BITMASK_HOSTINVISIBLE; + } else { + settings &= ~GAME_HOST_OPTION_BITMASK_HOSTFLY; + settings &= ~GAME_HOST_OPTION_BITMASK_HOSTHUNGER; + settings &= ~GAME_HOST_OPTION_BITMASK_HOSTINVISIBLE; + } break; + case eGameHostOption_HostCanFly: + setBit(GAME_HOST_OPTION_BITMASK_HOSTFLY); break; + case eGameHostOption_HostCanChangeHunger: + setBit(GAME_HOST_OPTION_BITMASK_HOSTHUNGER); break; + case eGameHostOption_HostCanBeInvisible: + setBit(GAME_HOST_OPTION_BITMASK_HOSTINVISIBLE); break; + case eGameHostOption_BedrockFog: + setBit(GAME_HOST_OPTION_BITMASK_BEDROCKFOG); break; + case eGameHostOption_DisableSaving: + setBit(GAME_HOST_OPTION_BITMASK_DISABLESAVE); break; + case eGameHostOption_WasntSaveOwner: + setBit(GAME_HOST_OPTION_BITMASK_NOTOWNER); break; + case eGameHostOption_MobGriefing: + setInvertedBit(GAME_HOST_OPTION_BITMASK_MOBGRIEFING); break; + case eGameHostOption_KeepInventory: + setBit(GAME_HOST_OPTION_BITMASK_KEEPINVENTORY); break; + case eGameHostOption_DoMobSpawning: + setInvertedBit(GAME_HOST_OPTION_BITMASK_DOMOBSPAWNING); break; + case eGameHostOption_DoMobLoot: + setInvertedBit(GAME_HOST_OPTION_BITMASK_DOMOBLOOT); break; + case eGameHostOption_DoTileDrops: + setInvertedBit(GAME_HOST_OPTION_BITMASK_DOTILEDROPS); break; + case eGameHostOption_NaturalRegeneration: + setInvertedBit(GAME_HOST_OPTION_BITMASK_NATURALREGEN); break; + case eGameHostOption_DoDaylightCycle: + setInvertedBit(GAME_HOST_OPTION_BITMASK_DODAYLIGHTCYCLE); break; + case eGameHostOption_WorldSize: + settings &= ~GAME_HOST_OPTION_BITMASK_WORLDSIZE; + settings |= (GAME_HOST_OPTION_BITMASK_WORLDSIZE & + (value << GAME_HOST_OPTION_BITMASK_WORLDSIZE_BITSHIFT)); + break; + case eGameHostOption_All: + settings = value; break; + default: + break; + } +} + +} // namespace GameHostOptions diff --git a/targets/minecraft/GameHostOptions.h b/targets/minecraft/GameHostOptions.h new file mode 100644 index 000000000..0d27f5dae --- /dev/null +++ b/targets/minecraft/GameHostOptions.h @@ -0,0 +1,16 @@ +#pragma once + +#include + +#include "app/common/App_Defines.h" +#include "minecraft/GameEnums.h" + +// Stateless bitfield utilities - no app dependency. +// The global-state overloads (get/set with no settings arg) have moved +// to IgameServices().getGameHostOption / setGameHostOption. +namespace GameHostOptions { + +unsigned int get(unsigned int settings, eGameHostOption option); +void set(unsigned int& settings, eGameHostOption option, unsigned int value); + +} // namespace GameHostOptions diff --git a/targets/minecraft/GameTypes.h b/targets/minecraft/GameTypes.h new file mode 100644 index 000000000..721aea6b1 --- /dev/null +++ b/targets/minecraft/GameTypes.h @@ -0,0 +1,20 @@ +#pragma once + +#include + +#include "minecraft/GameEnums.h" + +#ifndef MAX_CAPENAME_SIZE +#define MAX_CAPENAME_SIZE 32 +#endif + +struct MOJANG_DATA { + eXUID eXuid; + wchar_t wchCape[MAX_CAPENAME_SIZE]; + wchar_t wchSkin[MAX_CAPENAME_SIZE]; +}; + +struct FEATURE_DATA { + int x, z; + _eTerrainFeatureType eTerrainFeature; +}; diff --git a/targets/minecraft/IGameServices.cpp b/targets/minecraft/IGameServices.cpp new file mode 100644 index 000000000..a854ef3ef --- /dev/null +++ b/targets/minecraft/IGameServices.cpp @@ -0,0 +1,15 @@ +#include "minecraft/IGameServices.h" + +#include + +static IGameServices* s_services = nullptr; + +void initGameServices(IGameServices* services) { + s_services = services; +} + +IGameServices& gameServices() { + assert(s_services && + "initGameServices() must be called before gameServices()"); + return *s_services; +} diff --git a/targets/minecraft/IGameServices.h b/targets/minecraft/IGameServices.h new file mode 100644 index 000000000..ed89c25f7 --- /dev/null +++ b/targets/minecraft/IGameServices.h @@ -0,0 +1,235 @@ +#pragma once + +#include +#include +#include + +// Forward declarations - minecraft types +class LevelGenerationOptions; +class LevelRuleset; +class LevelChunk; +class ModelPart; + +// Forward declarations +class DLCSkinFile; +class DLCPack; + +#include "minecraft/client/model/SkinBox.h" +#include "minecraft/GameTypes.h" +#include "minecraft/GameEnums.h" +#include "platform/PlatformTypes.h" +#include "minecraft/network/packet/DisconnectPacket.h" +#include "minecraft/client/IMenuService.h" + +// eINSTANCEOF lives in java/Class.h which is heavyweight. +using EntityTypeId = int; + +class IGameServices { +public: + virtual ~IGameServices() = default; + + // -- Strings -- + + [[nodiscard]] virtual const wchar_t* getString(int id) = 0; + + // -- Debug settings -- + + [[nodiscard]] virtual bool debugSettingsOn() = 0; + [[nodiscard]] virtual bool debugArtToolsOn() = 0; + [[nodiscard]] virtual unsigned int debugGetMask(int iPad = -1, + bool overridePlayer = false) = 0; + [[nodiscard]] virtual bool debugMobsDontAttack() = 0; + [[nodiscard]] virtual bool debugMobsDontTick() = 0; + [[nodiscard]] virtual bool debugFreezePlayers() = 0; + + // -- Game host options (global settings via stored pointer) -- + + [[nodiscard]] virtual unsigned int getGameHostOption(eGameHostOption option) = 0; + virtual void setGameHostOption(eGameHostOption option, + unsigned int value) = 0; + + // -- Level generation -- + + [[nodiscard]] virtual LevelGenerationOptions* getLevelGenerationOptions() = 0; + [[nodiscard]] virtual LevelRuleset* getGameRuleDefinitions() = 0; + + // -- Texture cache -- + + virtual void addMemoryTextureFile(const std::wstring& name, + std::uint8_t* data, + unsigned int size) = 0; + virtual void removeMemoryTextureFile(const std::wstring& name) = 0; + virtual void getMemFileDetails(const std::wstring& name, + std::uint8_t** data, + unsigned int* size) = 0; + [[nodiscard]] virtual bool isFileInMemoryTextures(const std::wstring& name) = 0; + + // -- Player settings -- + + [[nodiscard]] virtual unsigned char getGameSettings(int iPad, int setting) = 0; + [[nodiscard]] virtual unsigned char getGameSettings(int setting) = 0; + + // -- App time -- + + [[nodiscard]] virtual float getAppTime() = 0; + + // -- Game state -- + + [[nodiscard]] virtual bool getGameStarted() = 0; + virtual void setGameStarted(bool val) = 0; + [[nodiscard]] virtual bool getTutorialMode() = 0; + virtual void setTutorialMode(bool val) = 0; + [[nodiscard]] virtual bool isAppPaused() = 0; + [[nodiscard]] virtual int getLocalPlayerCount() = 0; + [[nodiscard]] virtual bool autosaveDue() = 0; + virtual void setAutosaveTimerTime() = 0; + [[nodiscard]] virtual int64_t secondsToAutosave() = 0; + virtual void setDisconnectReason( + DisconnectPacket::eDisconnectReason reason) = 0; + virtual void lockSaveNotification() = 0; + virtual void unlockSaveNotification() = 0; + [[nodiscard]] virtual bool getResetNether() = 0; + [[nodiscard]] virtual bool getUseDPadForDebug() = 0; + [[nodiscard]] virtual bool getWriteSavesToFolderEnabled() = 0; + [[nodiscard]] virtual bool isLocalMultiplayerAvailable() = 0; + [[nodiscard]] virtual bool dlcInstallPending() = 0; + [[nodiscard]] virtual bool dlcInstallProcessCompleted() = 0; + [[nodiscard]] virtual bool canRecordStatsAndAchievements() = 0; + [[nodiscard]] virtual bool getTMSGlobalFileListRead() = 0; + virtual void setRequiredTexturePackID(std::uint32_t id) = 0; + virtual void setSpecialTutorialCompletionFlag(int iPad, int index) = 0; + virtual void setBanListCheck(int iPad, bool val) = 0; + [[nodiscard]] virtual bool getBanListCheck(int iPad) = 0; + [[nodiscard]] virtual unsigned int getGameNewWorldSize() = 0; + [[nodiscard]] virtual unsigned int getGameNewWorldSizeUseMoat() = 0; + [[nodiscard]] virtual unsigned int getGameNewHellScale() = 0; + + // -- UI dispatch -- + + virtual void setAction(int iPad, eXuiAction action, + void* param = nullptr) = 0; + virtual void setXuiServerAction(int iPad, eXuiServerAction action, + void* param = nullptr) = 0; + [[nodiscard]] virtual eXuiAction getXuiAction(int iPad) = 0; + [[nodiscard]] virtual eXuiServerAction getXuiServerAction(int iPad) = 0; + [[nodiscard]] virtual void* getXuiServerActionParam(int iPad) = 0; + virtual void setGlobalXuiAction(eXuiAction action) = 0; + virtual void handleButtonPresses() = 0; + virtual void setTMSAction(int iPad, eTMSAction action) = 0; + + // -- Skin / cape / animation -- + + [[nodiscard]] virtual std::wstring getPlayerSkinName(int iPad) = 0; + [[nodiscard]] virtual std::uint32_t getPlayerSkinId(int iPad) = 0; + [[nodiscard]] virtual std::wstring getPlayerCapeName(int iPad) = 0; + [[nodiscard]] virtual std::uint32_t getPlayerCapeId(int iPad) = 0; + [[nodiscard]] virtual std::uint32_t getAdditionalModelPartsForPad(int iPad) = 0; + virtual void setAdditionalSkinBoxes(std::uint32_t dwSkinID, + SKIN_BOX* boxA, + unsigned int boxC) = 0; + [[nodiscard]] virtual std::vector* getAdditionalSkinBoxes( + std::uint32_t dwSkinID) = 0; + [[nodiscard]] virtual std::vector* getAdditionalModelParts( + std::uint32_t dwSkinID) = 0; + virtual std::vector* setAdditionalSkinBoxesFromVec( + std::uint32_t dwSkinID, std::vector* pvSkinBoxA) = 0; + virtual void setAnimOverrideBitmask(std::uint32_t dwSkinID, + unsigned int bitmask) = 0; + [[nodiscard]] virtual unsigned int getAnimOverrideBitmask( + std::uint32_t dwSkinID) = 0; + [[nodiscard]] virtual std::uint32_t getSkinIdFromPath(const std::wstring& skin) = 0; + [[nodiscard]] virtual std::wstring getSkinPathFromId(std::uint32_t skinId) = 0; + [[nodiscard]] virtual bool defaultCapeExists() = 0; + [[nodiscard]] virtual bool isXuidNotch(PlayerUID xuid) = 0; + [[nodiscard]] virtual bool isXuidDeadmau5(PlayerUID xuid) = 0; + + // -- Platform features -- + + virtual void fatalLoadError() = 0; + virtual void setRichPresenceContext(int iPad, int contextId) = 0; + virtual void captureSaveThumbnail() = 0; + virtual void getSaveThumbnail(std::uint8_t** data, + unsigned int* size) = 0; + virtual void readBannedList(int iPad, eTMSAction action = (eTMSAction)0, + bool bCallback = false) = 0; + virtual void updatePlayerInfo(std::uint8_t networkSmallId, + int16_t playerColourIndex, + unsigned int playerPrivileges) = 0; + [[nodiscard]] virtual unsigned int getPlayerPrivileges( + std::uint8_t networkSmallId) = 0; + virtual void setGameSettingsDebugMask(int iPad, + unsigned int uiVal) = 0; + + // -- Schematics / terrain -- + + virtual void processSchematics(LevelChunk* chunk) = 0; + virtual void processSchematicsLighting(LevelChunk* chunk) = 0; + virtual void addTerrainFeaturePosition(_eTerrainFeatureType type, + int x, int z) = 0; + [[nodiscard]] virtual bool getTerrainFeaturePosition(_eTerrainFeatureType type, + int* pX, int* pZ) = 0; + virtual void loadDefaultGameRules() = 0; + + // -- Archive / resources -- + + [[nodiscard]] virtual bool hasArchiveFile(const std::wstring& filename) = 0; + [[nodiscard]] virtual std::vector getArchiveFile( + const std::wstring& filename) = 0; + + // -- Strings / formatting / misc queries -- + + [[nodiscard]] virtual int getHTMLColour(eMinecraftColour colour) = 0; + [[nodiscard]] virtual std::wstring getEntityName(EntityTypeId type) = 0; + [[nodiscard]] virtual const wchar_t* getGameRulesString( + const std::wstring& key) = 0; + [[nodiscard]] virtual unsigned int createImageTextData( + std::uint8_t* textMetadata, int64_t seed, bool hasSeed, + unsigned int uiHostOptions, unsigned int uiTexturePackId) = 0; + [[nodiscard]] virtual std::wstring getFilePath(std::uint32_t packId, + std::wstring filename, + bool bAddDataFolder, + std::wstring mountPoint = L"TPACK:") = 0; + [[nodiscard]] virtual char* getUniqueMapName() = 0; + virtual void setUniqueMapName(char* name) = 0; + [[nodiscard]] virtual unsigned int getOpacityTimer(int iPad) = 0; + virtual void setOpacityTimer(int iPad) = 0; + virtual void tickOpacityTimer(int iPad) = 0; + [[nodiscard]] virtual bool isInBannedLevelList(int iPad, PlayerUID xuid, + char* levelName) = 0; + [[nodiscard]] virtual MOJANG_DATA* getMojangDataForXuid(PlayerUID xuid) = 0; + virtual void debugPrintf(const char* msg) = 0; + + // -- DLC -- + + [[nodiscard]] virtual DLCSkinFile* getDLCSkinFile( + const std::wstring& name) = 0; + [[nodiscard]] virtual bool dlcNeedsCorruptCheck() = 0; + virtual unsigned int dlcCheckForCorrupt(bool showMessage = true) = 0; + [[nodiscard]] virtual bool dlcReadDataFile(unsigned int& filesProcessed, + const std::wstring& path, DLCPack* pack, + bool fromArchive = false) = 0; + virtual void dlcRemovePack(DLCPack* pack) = 0; + + // -- Game rules -- + + virtual LevelGenerationOptions* loadGameRules(std::uint8_t* data, + unsigned int size) = 0; + virtual void saveGameRules(std::uint8_t** data, + unsigned int* size) = 0; + virtual void unloadCurrentGameRules() = 0; + virtual void setLevelGenerationOptions( + LevelGenerationOptions* levelGen) = 0; + + // -- Shared data -- + + [[nodiscard]] virtual std::vector& getSkinNames() = 0; + [[nodiscard]] virtual std::vector& getTerrainFeatures() = 0; + + // -- Menu service -- + + [[nodiscard]] virtual IMenuService& menus() = 0; +}; + +// Global accessor - set once at startup, used everywhere in minecraft/ +void initGameServices(IGameServices* services); +IGameServices& gameServices(); diff --git a/targets/app/src/BufferedImage.cpp b/targets/minecraft/client/BufferedImage.cpp similarity index 94% rename from targets/app/src/BufferedImage.cpp rename to targets/minecraft/client/BufferedImage.cpp index 405979696..49d64c33a 100644 --- a/targets/app/src/BufferedImage.cpp +++ b/targets/minecraft/client/BufferedImage.cpp @@ -1,4 +1,4 @@ -#include "app/include/BufferedImage.h" +#include "minecraft/client/BufferedImage.h" #include @@ -7,10 +7,10 @@ #include #include "platform/sdl2/Render.h" -#include "app/common/src/DLC/DLCFile.h" -#include "app/common/src/DLC/DLCManager.h" -#include "app/common/src/DLC/DLCPack.h" -#include "app/linux/LinuxGame.h" +#include "app/common/DLC/DLCFile.h" +#include "app/common/DLC/DLCManager.h" +#include "app/common/DLC/DLCPack.h" +#include "minecraft/IGameServices.h" #include "app/linux/Stubs/winapi_stubs.h" #include "PlatformTypes.h" #include "util/StringHelpers.h" @@ -98,8 +98,8 @@ BufferedImage::BufferedImage(const std::wstring& File, &ImageInfo, &data[l]); } else { std::wstring archiveKey = L"res/" + fileName; - if (app.hasArchiveFile(archiveKey)) { - std::vector ba = app.getArchiveFile(archiveKey); + if (gameServices().hasArchiveFile(archiveKey)) { + std::vector ba = gameServices().getArchiveFile(archiveKey); hr = RenderManager.LoadTextureData(ba.data(), ba.size(), &ImageInfo, &data[l]); } @@ -140,14 +140,14 @@ BufferedImage::BufferedImage(DLCPack* dlcPack, const std::wstring& File, mipMapPath + L".png"); if (!dlcPack->doesPackContainFile(DLCManager::e_DLCType_All, name)) { - if (l == 0) app.FatalLoadError(); + if (l == 0) gameServices().fatalLoadError(); return; } DLCFile* dlcFile = dlcPack->getFile(DLCManager::e_DLCType_All, name); pbData = dlcFile->getData(dataBytes); if (pbData == nullptr || dataBytes == 0) { - if (l == 0) app.FatalLoadError(); + if (l == 0) gameServices().fatalLoadError(); return; } @@ -175,7 +175,7 @@ BufferedImage::BufferedImage(std::uint8_t* pbData, std::uint32_t dataBytes) { width = ImageInfo.Width; height = ImageInfo.Height; } else { - app.FatalLoadError(); + gameServices().fatalLoadError(); } } diff --git a/targets/app/include/BufferedImage.h b/targets/minecraft/client/BufferedImage.h similarity index 100% rename from targets/app/include/BufferedImage.h rename to targets/minecraft/client/BufferedImage.h diff --git a/targets/minecraft/client/Camera.cpp b/targets/minecraft/client/Camera.cpp index 8963c1cfd..29c5062cb 100644 --- a/targets/minecraft/client/Camera.cpp +++ b/targets/minecraft/client/Camera.cpp @@ -8,7 +8,7 @@ #include #include "MemoryTracker.h" -#include "app/include/stubs.h" +#include "platform/stubs.h" #include "java/FloatBuffer.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/player/Player.h" diff --git a/targets/minecraft/client/ClientConstants.cpp b/targets/minecraft/client/ClientConstants.cpp index e74b1fa38..f2cc01850 100644 --- a/targets/minecraft/client/ClientConstants.cpp +++ b/targets/minecraft/client/ClientConstants.cpp @@ -1,6 +1,6 @@ #include "ClientConstants.h" -#include "app/common/src/BuildVer/BuildVer.h" +#include "app/common/BuildVer/BuildVer.h" const std::wstring ClientConstants::VERSION_STRING = std::wstring(L"Minecraft Xbox ") + VER_FILEVERSION_STR_W + diff --git a/targets/minecraft/client/IMenuService.h b/targets/minecraft/client/IMenuService.h new file mode 100644 index 000000000..93c71e929 --- /dev/null +++ b/targets/minecraft/client/IMenuService.h @@ -0,0 +1,66 @@ +#pragma once + +#include +#include + +class LocalPlayer; +class Inventory; +class Container; +class Level; +class FurnaceTileEntity; +class BrewingStandTileEntity; +class DispenserTileEntity; +class SignTileEntity; +class CommandBlockEntity; +class HopperTileEntity; +class MinecartHopper; +class EntityHorse; +class BeaconTileEntity; +class Merchant; + +class IMenuService { +public: + virtual ~IMenuService() = default; + + virtual bool openInventory(int iPad, std::shared_ptr player, + bool navigateBack = false) = 0; + virtual bool openCreative(int iPad, std::shared_ptr player, + bool navigateBack = false) = 0; + virtual bool openCrafting2x2(int iPad, + std::shared_ptr player) = 0; + virtual bool openCrafting3x3(int iPad, std::shared_ptr player, + int x, int y, int z) = 0; + virtual bool openEnchanting(int iPad, std::shared_ptr inventory, + int x, int y, int z, Level* level, + const std::wstring& name) = 0; + virtual bool openFurnace(int iPad, std::shared_ptr inventory, + std::shared_ptr furnace) = 0; + virtual bool openBrewingStand( + int iPad, std::shared_ptr inventory, + std::shared_ptr brewingStand) = 0; + virtual bool openContainer(int iPad, std::shared_ptr inventory, + std::shared_ptr container) = 0; + virtual bool openTrap(int iPad, std::shared_ptr inventory, + std::shared_ptr trap) = 0; + virtual bool openFireworks(int iPad, std::shared_ptr player, + int x, int y, int z) = 0; + virtual bool openSign(int iPad, + std::shared_ptr sign) = 0; + virtual bool openRepairing(int iPad, std::shared_ptr inventory, + Level* level, int x, int y, int z) = 0; + virtual bool openTrading(int iPad, std::shared_ptr inventory, + std::shared_ptr trader, Level* level, + const std::wstring& name) = 0; + virtual bool openCommandBlock( + int iPad, std::shared_ptr commandBlock) = 0; + virtual bool openHopper(int iPad, std::shared_ptr inventory, + std::shared_ptr hopper) = 0; + virtual bool openHopperMinecart( + int iPad, std::shared_ptr inventory, + std::shared_ptr hopper) = 0; + virtual bool openHorse(int iPad, std::shared_ptr inventory, + std::shared_ptr container, + std::shared_ptr horse) = 0; + virtual bool openBeacon(int iPad, std::shared_ptr inventory, + std::shared_ptr beacon) = 0; +}; diff --git a/targets/minecraft/client/Lighting.cpp b/targets/minecraft/client/Lighting.cpp index 77bfbddd6..e5adc421a 100644 --- a/targets/minecraft/client/Lighting.cpp +++ b/targets/minecraft/client/Lighting.cpp @@ -3,7 +3,7 @@ #include #include "platform/sdl2/Render.h" -#include "app/include/stubs.h" +#include "platform/stubs.h" #include "java/FloatBuffer.h" #include "minecraft/world/phys/Vec3.h" diff --git a/targets/minecraft/client/Minecraft.cpp b/targets/minecraft/client/Minecraft.cpp index 80dd5614d..b916c7a89 100644 --- a/targets/minecraft/client/Minecraft.cpp +++ b/targets/minecraft/client/Minecraft.cpp @@ -1,3 +1,6 @@ +#include "minecraft/IGameServices.h" +#include "minecraft/client/IMenuService.h" +#include "minecraft/util/Log.h" #include "Minecraft.h" #include @@ -14,18 +17,17 @@ #include "platform/sdl2/Profile.h" #include "platform/sdl2/Render.h" #include "platform/sdl2/Storage.h" -#include "app/common/App_enums.h" -#include "app/common/src/Audio/SoundEngine.h" -#include "app/common/src/DLC/DLCManager.h" -#include "app/common/src/Network/GameNetworkManager.h" -#include "app/common/src/Network/NetworkPlayerInterface.h" -#include "app/common/src/Tutorial/Tutorial.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/linux/LinuxGame.h" +#include "minecraft/GameEnums.h" +#include "app/common/Audio/SoundEngine.h" +#include "app/common/DLC/DLCManager.h" +#include "app/common/Network/GameNetworkManager.h" +#include "app/common/Network/NetworkPlayerInterface.h" +#include "app/common/Tutorial/Tutorial.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/All Platforms/UIStructs.h" #include "app/linux/Linux_UIController.h" #include "app/linux/Stubs/winapi_stubs.h" -#include "app/include/XboxStubs.h" +#include "platform/XboxStubs.h" #include "Options.h" #include "Pos.h" #include "ProgressRenderer.h" @@ -104,13 +106,13 @@ #endif #include "platform/sdl2/Input.h" #include "app/common/Minecraft_Macros.h" -#include "app/common/src/Colours/ColourTable.h" -#include "app/common/src/ConsoleGameMode.h" -#include "app/common/src/DLC/DLCPack.h" -#include "app/common/src/Tutorial/FullTutorialMode.h" -#include "app/common/src/UI/All Platforms/IUIScene_CreativeMenu.h" -#include "app/common/src/UI/UIFontData.h" -#include "app/include/stubs.h" +#include "app/common/Colours/ColourTable.h" +#include "app/common/ConsoleGameMode.h" +#include "app/common/DLC/DLCPack.h" +#include "app/common/Tutorial/FullTutorialMode.h" +#include "app/common/UI/All Platforms/IUIScene_CreativeMenu.h" +#include "app/common/UI/UIFontData.h" +#include "platform/stubs.h" #include "util/StringHelpers.h" #include "java/File.h" #include "java/System.h" @@ -289,7 +291,7 @@ void Minecraft::clearConnectionFailed() { m_connectionFailed[i] = false; m_connectionFailedReason[i] = DisconnectPacket::eDisconnect_None; } - app.SetDisconnectReason(DisconnectPacket::eDisconnect_None); + gameServices().setDisconnectReason(DisconnectPacket::eDisconnect_None); } void Minecraft::connectTo(const std::wstring& server, int port) { @@ -504,7 +506,7 @@ File Minecraft::getWorkingDirectory(const std::wstring& applicationName) { #endif if (!workingDirectory->exists()) { if (!workingDirectory->mkdirs()) { - app.DebugPrintf("The working directory could not be created"); + Log::info("The working directory could not be created"); assert(0); // throw new RuntimeException(L"The working directory could not be // created: " + workingDirectory); @@ -733,7 +735,7 @@ void Minecraft::updatePlayerViewportAssignments() { for (int i = 0; i < XUSER_MAX_COUNT; i++) { if (localplayers[i] != nullptr) { // Primary player settings decide what the mode is - if (app.GetGameSettings(InputManager.GetPrimaryPad(), + if (gameServices().getGameSettings(InputManager.GetPrimaryPad(), eGameSetting_SplitScreenVertical)) { localplayers[i]->m_iScreenSection = C4JRender::VIEWPORT_TYPE_SPLIT_LEFT + found; @@ -756,7 +758,7 @@ void Minecraft::updatePlayerViewportAssignments() { // allocations (as the players won't have seen them) This fixes // an issue with the primary player being the 4th controller // quadrant, but ending up in the 3rd viewport. - if (app.GetGameStarted()) { + if (gameServices().getGameStarted()) { if ((localplayers[i]->m_iScreenSection >= C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT) && (localplayers[i]->m_iScreenSection <= @@ -805,7 +807,7 @@ void Minecraft::updatePlayerViewportAssignments() { // 4J Stu - If the game is not running we do not want to do this yet, and // should wait until the task that caused the app to not be running is // finished - if (app.GetGameStarted()) ui.UpdatePlayerBasePositions(); + if (gameServices().getGameStarted()) ui.UpdatePlayerBasePositions(); } // Add a temporary player so that the viewports get re-arranged, and add the @@ -823,7 +825,7 @@ bool Minecraft::addLocalPlayer(int idx) { bool success = g_NetworkManager.AddLocalPlayerByUserIndex(idx); if (success) { - app.DebugPrintf("Adding temp local player on pad %d\n", idx); + Log::info("Adding temp local player on pad %d\n", idx); localplayers[idx] = std::shared_ptr( new MultiplayerLocalPlayer(this, level, user, nullptr)); localgameModes[idx] = nullptr; @@ -841,7 +843,7 @@ bool Minecraft::addLocalPlayer(int idx) { ui.NavigateToScene(idx, eUIScene_ConnectingProgress, param); } else { - app.DebugPrintf("g_NetworkManager.AddLocalPlayerByUserIndex failed\n"); + Log::info("g_NetworkManager.AddLocalPlayerByUserIndex failed\n"); } return success; @@ -887,7 +889,7 @@ std::shared_ptr Minecraft::createExtraLocalPlayer( mpLevel->addClientConnection(clientConnection); } - if (app.GetTutorialMode()) { + if (gameServices().getTutorialMode()) { localgameModes[idx] = new FullTutorialMode(idx, this, clientConnection); } else { @@ -941,7 +943,7 @@ std::shared_ptr Minecraft::createExtraLocalPlayer( // ClientConnection::handleMovePlayer // // 4J-PB - can't call this when this function is called // from the qnet thread (GetGameStarted will be false) - // if(app.GetGameStarted()) + // if(gameServices().getGameStarted()) // { // ui.CloseUIScenes(idx); // } @@ -1084,7 +1086,7 @@ void Minecraft::run_middle() { // set the timer bAutosaveTimerSet=true; - app.SetAutosaveTimerTime(); + gameServices().setAutosaveTimerTime(); } else*/ { @@ -1093,7 +1095,7 @@ void Minecraft::run_middle() { // player has a app action running , or has any crafting // or containers open, don't autosave if (!StorageManager.GetSaveDisabled() && - (app.GetXuiAction(InputManager.GetPrimaryPad()) == + (gameServices().getXuiAction(InputManager.GetPrimaryPad()) == eAppAction_Idle)) { if (!ui.IsPauseMenuDisplayed( InputManager.GetPrimaryPad()) && @@ -1102,7 +1104,7 @@ void Minecraft::run_middle() { // check if the autotimer countdown has reached // zero unsigned char ucAutosaveVal = - app.GetGameSettings( + gameServices().getGameSettings( InputManager.GetPrimaryPad(), eGameSetting_Autosave); bool bTrialTexturepack = false; @@ -1131,18 +1133,18 @@ void Minecraft::run_middle() { // check whether we need to save this tick if ((ucAutosaveVal != 0) && !bTrialTexturepack) { - if (app.AutosaveDue()) { + if (gameServices().autosaveDue()) { // disable the autosave countdown ui.ShowAutosaveCountdownTimer(false); // Need to save now - app.DebugPrintf("+++++++++++\n"); - app.DebugPrintf("+++Autosave\n"); - app.DebugPrintf("+++++++++++\n"); - app.SetAction( + Log::info("+++++++++++\n"); + Log::info("+++Autosave\n"); + Log::info("+++++++++++\n"); + gameServices().setAction( InputManager.GetPrimaryPad(), eAppAction_AutosaveSaveGame); - // app.SetAutosaveTimerTime(); + // gameServices().setAutosaveTimerTime(); #if !defined(_CONTENT_PACKAGE) { // print the time @@ -1157,7 +1159,7 @@ void Minecraft::run_middle() { gmtime_r(&now_tt, &utcTime); #endif - app.DebugPrintf("%02d:%02d:%02d\n", + Log::info("%02d:%02d:%02d\n", utcTime.tm_hour, utcTime.tm_min, utcTime.tm_sec); @@ -1165,7 +1167,7 @@ void Minecraft::run_middle() { #endif } else { int64_t uiTimeToAutosave = - app.SecondsToAutosave(); + gameServices().secondsToAutosave(); if (uiTimeToAutosave < 6) { ui.ShowAutosaveCountdownTimer(true); @@ -1186,14 +1188,14 @@ void Minecraft::run_middle() { // the level in their banned list and ask if they want to play // it for (int i = 0; i < XUSER_MAX_COUNT; i++) { - if (localplayers[i] && (app.GetBanListCheck(i) == false) && + if (localplayers[i] && (gameServices().getBanListCheck(i) == false) && !Minecraft::GetInstance()->isTutorial() && ProfileManager.IsSignedInLive(i) && !ProfileManager.IsGuest(i)) { // If there is a sys ui displayed, we can't display the // message box here, so ignore until we can if (!ProfileManager.IsSystemUIDisplayed()) { - app.SetBanListCheck(i, true); + gameServices().setBanListCheck(i, true); // 4J-PB - check if the level is in the banned level // list get the unique save name and xuid from // whoever is the host @@ -1201,15 +1203,15 @@ void Minecraft::run_middle() { g_NetworkManager.GetHostPlayer(); PlayerUID xuid = pHostPlayer->GetUID(); - if (app.IsInBannedLevelList( - i, xuid, app.GetUniqueMapName())) { + if (gameServices().isInBannedLevelList( + i, xuid, gameServices().getUniqueMapName())) { // put up a message box asking if the player // would like to unban this level - app.DebugPrintf("This level is banned\n"); + Log::info("This level is banned\n"); // set the app action to bring up the message // box to give them the option to remove from // the ban list or exit the level - app.SetAction(i, eAppAction_LevelInBanLevelList, + gameServices().setAction(i, eAppAction_LevelInBanLevelList, (void*)true); } } @@ -1217,10 +1219,10 @@ void Minecraft::run_middle() { } if (!ProfileManager.IsSystemUIDisplayed() && - app.DLCInstallProcessCompleted() && - !app.DLCInstallPending() && - app.m_dlcManager.NeedsCorruptCheck()) { - app.m_dlcManager.checkForCorruptDLCAndAlert(); + gameServices().dlcInstallProcessCompleted() && + !gameServices().dlcInstallPending() && + gameServices().dlcNeedsCorruptCheck()) { + gameServices().dlcCheckForCorrupt(); } // When we go into the first loaded level, check if the console @@ -1233,7 +1235,7 @@ void Minecraft::run_middle() { if (iFirstTimeCountdown == 0) { bFirstTimeIntoGame = false; - if (app.IsLocalMultiplayerAvailable()) { + if (gameServices().isLocalMultiplayerAvailable()) { for (int i = 0; i < XUSER_MAX_COUNT; i++) { if ((localplayers[i] == nullptr) && InputManager.IsPadConnected(i)) { @@ -1277,7 +1279,7 @@ void Minecraft::run_middle() { i, MINECRAFT_ACTION_PAUSEMENU)) { localplayers[i]->ullButtonsPressed |= 1LL << MINECRAFT_ACTION_PAUSEMENU; - app.DebugPrintf( + Log::info( "PAUSE PRESSED - ipad = %d, Storing press\n", i); #if defined(ENABLE_JAVA_GUIS) @@ -1312,7 +1314,7 @@ void Minecraft::run_middle() { 1LL << MINECRAFT_ACTION_GAME_INFO; #if !defined(_FINAL_BUILD) - if (app.DebugSettingsOn() && app.GetUseDPadForDebug()) { + if (gameServices().debugSettingsOn() && gameServices().getUseDPadForDebug()) { localplayers[i]->ullDpad_last = 0; localplayers[i]->ullDpad_this = 0; localplayers[i]->ullDpad_filtered = 0; @@ -1390,7 +1392,7 @@ void Minecraft::run_middle() { // || InputManager.ButtonPressed(i, // MINECRAFT_ACTION_ACTION)) { - app.SetOpacityTimer(i); + gameServices().setOpacityTimer(i); } } else { // 4J Stu - This doesn't make any sense with the way we @@ -1428,7 +1430,7 @@ void Minecraft::run_middle() { addLocalPlayer(i); if (!success) { - app.DebugPrintf( + Log::info( "Bringing up the sign " "in " "ui\n"); @@ -1505,7 +1507,7 @@ void Minecraft::run_middle() { { // player not signed in to live // bring up the sign in dialog - app.DebugPrintf( + Log::info( "Bringing up the sign in " "ui\n"); ProfileManager.RequestSignInUI( @@ -1522,7 +1524,7 @@ void Minecraft::run_middle() { } } else { // bring up the sign in dialog - app.DebugPrintf( + Log::info( "Bringing up the sign in ui\n"); ProfileManager.RequestSignInUI( false, @@ -1557,7 +1559,7 @@ void Minecraft::run_middle() { // again if (i != 0) { InputManager.Tick(); - app.HandleButtonPresses(); + gameServices().handleButtonPresses(); } ticks++; @@ -1677,12 +1679,12 @@ void Minecraft::run_middle() { if (i == iPrimaryPad) { // check to see if we need to capture a // screenshot for the save game thumbnail - switch (app.GetXuiAction(i)) { + switch (gameServices().getXuiAction(i)) { case eAppAction_ExitWorldCapturedThumbnail: case eAppAction_SaveGameCapturedThumbnail: case eAppAction_AutosaveSaveGameCapturedThumbnail: // capture the save thumbnail - app.CaptureSaveThumbnail(); + gameServices().captureSaveThumbnail(); break; default: break; @@ -1795,7 +1797,7 @@ void Minecraft::run_middle() { g_NetworkManager.GetPlayerCount() == 1 && screen != nullptr && screen->isPauseScreen(); #else - pause = app.IsAppPaused(); + pause = gameServices().isAppPaused(); #endif #if !defined(_CONTENT_PACKAGE) @@ -2041,7 +2043,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { // Tick the opacity timer (to display the interface at default opacity for a // certain time if the user has been navigating it) - app.TickOpacityTimer(iPad); + gameServices().tickOpacityTimer(iPad); // 4J added if (bFirst) levelRenderer->destroyedTileManager->tick(); @@ -3066,7 +3068,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { // have the // privilege { - if (app.GetGameHostOption( + if (gameServices().getGameHostOption( eGameHostOption_PvP) && player->isAllowedToAttackPlayers()) { *piAction = IDS_TOOLTIPS_HIT; @@ -3392,7 +3394,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { } } - if (app.DebugSettingsOn()) { + if (gameServices().debugSettingsOn()) { if (player->ullButtonsPressed & (1LL << MINECRAFT_ACTION_CHANGE_SKIN)) { player->ChangePlayerSkin(); @@ -3402,7 +3404,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { if (player->missTime > 0) player->missTime--; #if defined(_DEBUG_MENUS_ENABLED) - if (app.DebugSettingsOn()) { + if (gameServices().debugSettingsOn()) { // 4J-PB - debugoverlay for primary player only if (iPad == InputManager.GetPrimaryPad()) { if ((player->ullButtonsPressed & @@ -3419,7 +3421,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { if ((player->ullButtonsPressed & (1LL << MINECRAFT_ACTION_SPAWN_CREEPER)) && - app.GetMobsDontAttackEnabled()) { + gameServices().debugMobsDontAttack()) { // shared_ptr mob = // std::dynamic_pointer_cast(Creeper::_class->newInstance( // level )); shared_ptr mob = @@ -3463,7 +3465,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { #if defined(ENABLE_JAVA_GUIS) setScreen(new InventoryScreen(player)); #else - app.LoadInventoryMenu(iPad, player); + gameServices().menus().openInventory(iPad, std::static_pointer_cast(player)); #endif } @@ -3484,7 +3486,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { setScreen(new CreativeInventoryScreen(player)); } #else - app.LoadCreativeMenu(iPad, player); + gameServices().menus().openCreative(iPad, std::static_pointer_cast(player)); } // 4J-PB - Microsoft request that we use the 3x3 crafting if someone // presses X while at the workbench @@ -3501,13 +3503,13 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { &hitResult->pos, false, &usedItem); } else { ui.PlayUISFX(eSFX_Press); - app.LoadCrafting2x2Menu(iPad, player); + gameServices().menus().openCrafting2x2(iPad, std::static_pointer_cast(player)); } #endif } if ((player->ullButtonsPressed & (1LL << MINECRAFT_ACTION_PAUSEMENU))) { - app.DebugPrintf( + Log::info( "PAUSE PRESS PROCESSING - ipad = %d, NavigateToScene\n", player->GetXboxPad()); ui.PlayUISFX(eSFX_Press); @@ -3569,9 +3571,9 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { // printf("Input Detected!\n"); // // // see if we can react to this - // if(app.GetXuiAction(iPad)==eAppAction_Idle) + // if(gameServices().getXuiAction(iPad)==eAppAction_Idle) // { - // app.SetAction(iPad,eAppAction_DebugText,(void*)wchInput); + // gameServices().setAction(iPad,eAppAction_DebugText,(void*)wchInput); // } // } // } @@ -3590,7 +3592,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { // level->difficulty = options->difficulty; // if (level->isClientSide) level->difficulty = Difficulty::HARD; if (!level->isClientSide) { - // app.DebugPrintf("Minecraft::tick - Difficulty = + // Log::info("Minecraft::tick - Difficulty = // %d",options->difficulty); level->difficulty = options->difficulty; } @@ -3654,7 +3656,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { // 4J Stu - We are always online, but still could be paused if (!pause) // || isClientSide()) { - // app.DebugPrintf("Minecraft::tick spawn settings - + // Log::info("Minecraft::tick spawn settings - // Difficulty = %d",options->difficulty); levels[i]->setSpawnSettings(level->difficulty > 0, true); #if defined(DISABLE_LEVELTICK_THREAD) @@ -4008,7 +4010,7 @@ std::wstring Minecraft::gatherStats1() { ZoneScopedN("Minecraft::gatherStats1"); // return levelRenderer->gatherStats1(); return L"Time to autosave: " + - toWString(app.SecondsToAutosave()) + L"s"; + toWString(gameServices().secondsToAutosave()) + L"s"; } std::wstring Minecraft::gatherStats2() { @@ -4085,7 +4087,7 @@ void Minecraft::respawnPlayer(int iPad, int dimension, int newEntityId) { } // Set the animation override if the skin has one - std::uint32_t dwSkinID = app.getSkinIdFromPath(player->customTextureUrl); + std::uint32_t dwSkinID = gameServices().getSkinIdFromPath(player->customTextureUrl); if (GET_IS_DLC_SKIN_FROM_BITMASK(dwSkinID)) { player->setAnimOverrideBitmask( player->getSkinAnimOverrideBitmask(dwSkinID)); @@ -4099,14 +4101,14 @@ void Minecraft::respawnPlayer(int iPad, int dimension, int newEntityId) { createPrimaryLocalPlayer(iPad); // update the debugoptions - app.SetGameSettingsDebugMask(InputManager.GetPrimaryPad(), - app.GetGameSettingsDebugMask(-1, true)); + gameServices().setGameSettingsDebugMask(InputManager.GetPrimaryPad(), + gameServices().debugGetMask(-1, true)); } else { storeExtraLocalPlayer(iPad); } player->setShowOnMaps( - app.GetGameHostOption(eGameHostOption_Gamertags) != 0 ? true : false); + gameServices().getGameHostOption(eGameHostOption_Gamertags) != 0 ? true : false); player->resetPos(); level->addEntity(player); @@ -4252,7 +4254,7 @@ void Minecraft::main() { User::staticCtor(); Tutorial::staticCtor(); ColourTable::staticCtor(); - app.loadDefaultGameRules(); + gameServices().loadDefaultGameRules(); #if defined(_LARGE_WORLDS) LevelRenderer::staticCtor(); @@ -4361,7 +4363,7 @@ void Minecraft::handleMouseClick(int button) if (button == 0 && missTime > 0) return; if (button == 0) { -app.DebugPrintf("handleMouseClick - Player %d is +Log::info("handleMouseClick - Player %d is swinging\n",player->GetXboxPad()); player->swing(); } @@ -4436,7 +4438,7 @@ int oldCount = item != nullptr ? item->count : 0; if (gameMode->useItemOn(player, level, item, x, y, z, face)) { mayUse = false; -app.DebugPrintf("Player %d is swinging\n",player->GetXboxPad()); +Log::info("Player %d is swinging\n",player->GetXboxPad()); player->swing(); } if (item == nullptr) @@ -4490,7 +4492,7 @@ void Minecraft::playerStartedTutorial(int iPad) { ZoneScopedN("Minecraft::playerStartedTutorial"); // If the app doesn't think we are in a tutorial mode then just ignore this // add - if (app.GetTutorialMode()) + if (gameServices().getTutorialMode()) m_inFullTutorialBits = m_inFullTutorialBits | (1 << iPad); } @@ -4499,13 +4501,13 @@ void Minecraft::playerLeftTutorial(int iPad) { // 4J Stu - Fix for bug that was flooding Sentient with LevelStart events // If the tutorial bits are already 0 then don't need to update anything if (m_inFullTutorialBits == 0) { - app.SetTutorialMode(false); + gameServices().setTutorialMode(false); return; } m_inFullTutorialBits = m_inFullTutorialBits & ~(1 << iPad); if (m_inFullTutorialBits == 0) { - app.SetTutorialMode(false); + gameServices().setTutorialMode(false); } } @@ -4519,7 +4521,7 @@ int Minecraft::InGame_SignInReturned(void* pParam, bool bContinue, int iPad) { // it's disabled Fix for #66516 - TCR #124: MPS Guest Support ; #001: // BAS Game Stability: TU8: The game crashes when second Guest signs-in // on console which takes part in Xbox LIVE multiplayer session. - app.DebugPrintf("Disabling Guest Signin\n"); + Log::info("Disabling Guest Signin\n"); XEnableGuestSignin(false); } diff --git a/targets/minecraft/client/Options.cpp b/targets/minecraft/client/Options.cpp index 20a7c4b9c..a9428d697 100644 --- a/targets/minecraft/client/Options.cpp +++ b/targets/minecraft/client/Options.cpp @@ -1,9 +1,10 @@ +#include "minecraft/util/Log.h" #include "Options.h" #include "KeyMapping.h" -#include "app/common/src/Audio/SoundEngine.h" +#include "app/common/Audio/SoundEngine.h" #include "app/linux/LinuxGame.h" -#include "app/include/stubs.h" +#include "platform/stubs.h" #include "util/StringHelpers.h" #include "java/File.h" #include "java/InputOutputStream/BufferedReader.h" @@ -256,7 +257,7 @@ void Options::toggle(const Options::Option* option, int dir) { // if (option == Option::DIFFICULTY) difficulty = (difficulty + dir) & 3; if (option == Option::DIFFICULTY) difficulty = (dir) & 3; - app.DebugPrintf("Option::DIFFICULTY = %d", difficulty); + Log::info("Option::DIFFICULTY = %d", difficulty); if (option == Option::GRAPHICS) { fancyGraphics = !fancyGraphics; diff --git a/targets/minecraft/client/gui/ChatScreen.cpp b/targets/minecraft/client/gui/ChatScreen.cpp index cd811c59b..617b71ca0 100644 --- a/targets/minecraft/client/gui/ChatScreen.cpp +++ b/targets/minecraft/client/gui/ChatScreen.cpp @@ -2,7 +2,7 @@ #include -#include "app/include/stubs.h" +#include "platform/stubs.h" #include "util/StringHelpers.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/minecraft/client/gui/CreateWorldScreen.cpp b/targets/minecraft/client/gui/CreateWorldScreen.cpp index 68beb3d40..b5facb94f 100644 --- a/targets/minecraft/client/gui/CreateWorldScreen.cpp +++ b/targets/minecraft/client/gui/CreateWorldScreen.cpp @@ -1,3 +1,5 @@ +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "CreateWorldScreen.h" #include @@ -10,14 +12,14 @@ #include "Button.h" #include "EditBox.h" #include "MessageScreen.h" -#include "app/common/App_enums.h" -#include "app/common/src/Network/GameNetworkManager.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" +#include "minecraft/GameEnums.h" +#include "app/common/Network/GameNetworkManager.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/All Platforms/UIStructs.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "app/include/NetTypes.h" -#include "app/include/stubs.h" +#include "platform/NetTypes.h" +#include "platform/stubs.h" #include "util/StringHelpers.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" @@ -160,10 +162,10 @@ std::wstring CreateWorldScreen::findAvailableFolderName( void CreateWorldScreen::removed() { Keyboard::enableRepeatEvents(false); } void CreateWorldScreen::buttonClicked(Button* button) { - app.DebugPrintf("CreateWorldScreen::buttonClicked START\n"); + Log::info("CreateWorldScreen::buttonClicked START\n"); if (!button->active) return; if (button->id == 1) { - app.DebugPrintf( + Log::info( "CreateWorldScreen::buttonClicked 'Cancel' " "minecraft->setScreen(lastScreen)\n"); minecraft->setScreen(lastScreen); @@ -250,38 +252,38 @@ void CreateWorldScreen::buttonClicked(Button* button) { param->texturePackId = 0; param->settings = 0; - app.SetGameHostOption(eGameHostOption_Difficulty, + gameServices().setGameHostOption(eGameHostOption_Difficulty, minecraft->options->difficulty); - app.SetGameHostOption(eGameHostOption_FriendsOfFriends, + gameServices().setGameHostOption(eGameHostOption_FriendsOfFriends, moreOptionsParams->bAllowFriendsOfFriends); - app.SetGameHostOption(eGameHostOption_Gamertags, 1); - app.SetGameHostOption(eGameHostOption_BedrockFog, 0); - app.SetGameHostOption(eGameHostOption_GameType, + gameServices().setGameHostOption(eGameHostOption_Gamertags, 1); + gameServices().setGameHostOption(eGameHostOption_BedrockFog, 0); + gameServices().setGameHostOption(eGameHostOption_GameType, (gameMode == L"survival") ? GameType::SURVIVAL->getId() : GameType::CREATIVE->getId()); - app.SetGameHostOption(eGameHostOption_LevelType, + gameServices().setGameHostOption(eGameHostOption_LevelType, moreOptionsParams->bFlatWorld); - app.SetGameHostOption(eGameHostOption_Structures, + gameServices().setGameHostOption(eGameHostOption_Structures, moreOptionsParams->bStructures); - app.SetGameHostOption(eGameHostOption_BonusChest, + gameServices().setGameHostOption(eGameHostOption_BonusChest, moreOptionsParams->bBonusChest); - app.SetGameHostOption(eGameHostOption_PvP, moreOptionsParams->bPVP); - app.SetGameHostOption(eGameHostOption_TrustPlayers, + gameServices().setGameHostOption(eGameHostOption_PvP, moreOptionsParams->bPVP); + gameServices().setGameHostOption(eGameHostOption_TrustPlayers, moreOptionsParams->bTrust); - app.SetGameHostOption(eGameHostOption_FireSpreads, + gameServices().setGameHostOption(eGameHostOption_FireSpreads, moreOptionsParams->bFireSpreads); - app.SetGameHostOption(eGameHostOption_TNT, moreOptionsParams->bTNT); - app.SetGameHostOption(eGameHostOption_HostCanFly, + gameServices().setGameHostOption(eGameHostOption_TNT, moreOptionsParams->bTNT); + gameServices().setGameHostOption(eGameHostOption_HostCanFly, moreOptionsParams->bHostPrivileges); - app.SetGameHostOption(eGameHostOption_HostCanChangeHunger, + gameServices().setGameHostOption(eGameHostOption_HostCanChangeHunger, moreOptionsParams->bHostPrivileges); - app.SetGameHostOption(eGameHostOption_HostCanBeInvisible, + gameServices().setGameHostOption(eGameHostOption_HostCanBeInvisible, moreOptionsParams->bHostPrivileges); - app.SetGameHostOption(eGameHostOption_CheatsEnabled, + gameServices().setGameHostOption(eGameHostOption_CheatsEnabled, moreOptionsParams->bHostPrivileges); - param->settings = app.GetGameHostOption(eGameHostOption_All); + param->settings = gameServices().getGameHostOption(eGameHostOption_All); param->xzSize = LEVEL_MAX_WIDTH; param->hellScale = HELL_LEVEL_MAX_SCALE; @@ -294,7 +296,7 @@ void CreateWorldScreen::buttonClicked(Button* button) { loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; loadingParams->lpParam = param; - app.SetAutosaveTimerTime(); + gameServices().setAutosaveTimerTime(); UIFullscreenProgressCompletionData* completionData = new UIFullscreenProgressCompletionData(); diff --git a/targets/minecraft/client/gui/EditBox.cpp b/targets/minecraft/client/gui/EditBox.cpp index 29776b5c0..3a785bd5f 100644 --- a/targets/minecraft/client/gui/EditBox.cpp +++ b/targets/minecraft/client/gui/EditBox.cpp @@ -1,6 +1,6 @@ #include "EditBox.h" -#include "app/include/stubs.h" +#include "platform/stubs.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/gui/Screen.h" diff --git a/targets/minecraft/client/gui/Font.cpp b/targets/minecraft/client/gui/Font.cpp index ae8ac9a0a..8d08bd9d2 100644 --- a/targets/minecraft/client/gui/Font.cpp +++ b/targets/minecraft/client/gui/Font.cpp @@ -6,7 +6,7 @@ #include #include "platform/sdl2/Render.h" -#include "app/include/BufferedImage.h" +#include "minecraft/client/BufferedImage.h" #include "util/StringHelpers.h" #include "java/Random.h" #include "minecraft/SharedConstants.h" diff --git a/targets/minecraft/client/gui/Gui.cpp b/targets/minecraft/client/gui/Gui.cpp index 6e9a8290d..bf7c23d0a 100644 --- a/targets/minecraft/client/gui/Gui.cpp +++ b/targets/minecraft/client/gui/Gui.cpp @@ -1,3 +1,4 @@ +#include "minecraft/IGameServices.h" #include "Gui.h" #include @@ -7,11 +8,11 @@ #include "platform/sdl2/Input.h" #include "platform/sdl2/Render.h" #include "Facing.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/App_structs.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "app/include/XboxStubs.h" +#include "platform/XboxStubs.h" #include "util/StringHelpers.h" #include "java/JavaMath.h" #include "java/Random.h" @@ -55,7 +56,7 @@ #include "minecraft/world/level/storage/LevelData.h" #include "minecraft/world/level/tile/PortalTile.h" #include "minecraft/world/level/tile/Tile.h" -#include "app/include/stubs.h" +#include "platform/stubs.h" #include "strings.h" @@ -112,10 +113,10 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) { // 4J-PB - selected the gui scale based on the slider settings if (minecraft->player->m_iScreenSection == C4JRender::VIEWPORT_TYPE_FULLSCREEN) { - guiScale = app.GetGameSettings(iPad, eGameSetting_UISize) + 2; + guiScale = gameServices().getGameSettings(iPad, eGameSetting_UISize) + 2; } else { guiScale = - app.GetGameSettings(iPad, eGameSetting_UISizeSplitscreen) + 2; + gameServices().getGameSettings(iPad, eGameSetting_UISizeSplitscreen) + 2; } ScreenSizeCalculator ssc(minecraft->options, minecraft->width, @@ -246,11 +247,11 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) { // 4J-PB - turn off the slot display if a xui menu is up, or if we're // autosaving bool bDisplayGui = !ui.GetMenuDisplayed(iPad) && - !(app.GetXuiAction(iPad) == + !(gameServices().getXuiAction(iPad) == eAppAction_AutosaveSaveGameCapturedThumbnail); // if tooltips are off, set the y offset to zero - if (app.GetGameSettings(iPad, eGameSetting_Tooltips) == 0 && bDisplayGui) { + if (gameServices().getGameSettings(iPad, eGameSetting_Tooltips) == 0 && bDisplayGui) { switch (minecraft->player->m_iScreenSection) { case C4JRender::VIEWPORT_TYPE_FULLSCREEN: iTooltipsYOffset = screenHeight / 10; @@ -274,7 +275,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) { // 4J-PB - Turn off interface if eGameSetting_DisplayHUD is off - for screen // shots/videos. - if (app.GetGameSettings(iPad, eGameSetting_DisplayHUD) == 0) { + if (gameServices().getGameSettings(iPad, eGameSetting_DisplayHUD) == 0) { bDisplayGui = false; } @@ -333,7 +334,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) { // 4J - this is where to set the blend factor for gui things // use the primary player's settings - unsigned char ucAlpha = app.GetGameSettings( + unsigned char ucAlpha = gameServices().getGameSettings( InputManager.GetPrimaryPad(), eGameSetting_InterfaceOpacity); // If the user has started to navigate their quickselect bar, ignore the @@ -341,7 +342,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) { float fVal = fAlphaIncrementPerCent * (float)ucAlpha; if (ucAlpha < 80) { // check if we have the timer running for the opacity - unsigned int uiOpacityTimer = app.GetOpacityTimer(iPad); + unsigned int uiOpacityTimer = gameServices().getOpacityTimer(iPad); if (uiOpacityTimer != 0) { if (uiOpacityTimer < 10) { float fStep = (80.0f - (float)ucAlpha) / 10.0f; @@ -728,7 +729,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) { // positions worked out by hand from the xui implementation of the // crouch icon - if (app.GetGameSettings(iPad, eGameSetting_AnimatedCharacter)) { + if (gameServices().getGameSettings(iPad, eGameSetting_AnimatedCharacter)) { // int playerIdx = minecraft->player->GetXboxPad(); static int characterDisplayTimer[4] = {0}; @@ -977,8 +978,8 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) { wfeature[eTerrainFeature_Village] = L"Village: "; wfeature[eTerrainFeature_Ravine] = L"Ravine: "; - for (int i = 0; i < app.m_vTerrainFeatures.size(); i++) { - FEATURE_DATA* pFeatureData = app.m_vTerrainFeatures[i]; + for (int i = 0; i < gameServices().getTerrainFeatures().size(); i++) { + FEATURE_DATA* pFeatureData = gameServices().getTerrainFeatures()[i]; std::wstring itemInfo = L"[" + toWString(pFeatureData->x * 16) + L", " + @@ -1465,7 +1466,7 @@ void Gui::addMessage(const std::wstring& _string, int iPad, for (int i = 0; i < XUSER_MAX_COUNT; i++) { if (minecraft->localplayers[i] && !(bIsDeathMessage && - app.GetGameSettings(i, eGameSetting_DeathMessages) == 0)) { + gameServices().getGameSettings(i, eGameSetting_DeathMessages) == 0)) { guiMessages[i].insert(guiMessages[i].begin(), GuiMessage(string)); while (guiMessages[i].size() > 50) { @@ -1474,7 +1475,7 @@ void Gui::addMessage(const std::wstring& _string, int iPad, } } } else if (!(bIsDeathMessage && - app.GetGameSettings(iPad, eGameSetting_DeathMessages) == 0)) { + gameServices().getGameSettings(iPad, eGameSetting_DeathMessages) == 0)) { guiMessages[iPad].insert(guiMessages[iPad].begin(), GuiMessage(string)); while (guiMessages[iPad].size() > 50) { guiMessages[iPad].pop_back(); @@ -1509,7 +1510,7 @@ float Gui::getJukeboxOpacity(int iPad) { void Gui::setNowPlaying(const std::wstring& string) { // overlayMessageString = L"Now playing: " + string; - overlayMessageString = app.GetString(IDS_NOWPLAYING) + string; + overlayMessageString = gameServices().getString(IDS_NOWPLAYING) + string; overlayMessageTime = 20 * 3; animateOverlayMessageColor = true; } @@ -1517,7 +1518,7 @@ void Gui::setNowPlaying(const std::wstring& string) { void Gui::displayClientMessage(int messageId, int iPad) { // Language *language = Language::getInstance(); std::wstring languageString = - app.GetString(messageId); // language->getElement(messageId); + gameServices().getString(messageId); // language->getElement(messageId); addMessage(languageString, iPad); } diff --git a/targets/minecraft/client/gui/GuiComponent.cpp b/targets/minecraft/client/gui/GuiComponent.cpp index e6e40ac8c..a0d61fc0f 100644 --- a/targets/minecraft/client/gui/GuiComponent.cpp +++ b/targets/minecraft/client/gui/GuiComponent.cpp @@ -4,7 +4,7 @@ #include #include "platform/sdl2/Render.h" -#include "app/include/stubs.h" +#include "platform/stubs.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Font.h" #include "minecraft/client/gui/Gui.h" diff --git a/targets/minecraft/client/gui/InBedChatScreen.cpp b/targets/minecraft/client/gui/InBedChatScreen.cpp index fdf2e1cdc..fb4fa57a8 100644 --- a/targets/minecraft/client/gui/InBedChatScreen.cpp +++ b/targets/minecraft/client/gui/InBedChatScreen.cpp @@ -5,7 +5,7 @@ #include #include "Button.h" -#include "app/include/stubs.h" +#include "platform/stubs.h" #include "util/StringHelpers.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/ChatScreen.h" diff --git a/targets/minecraft/client/gui/JoinMultiplayerScreen.cpp b/targets/minecraft/client/gui/JoinMultiplayerScreen.cpp index 3f49e52fc..99c987d51 100644 --- a/targets/minecraft/client/gui/JoinMultiplayerScreen.cpp +++ b/targets/minecraft/client/gui/JoinMultiplayerScreen.cpp @@ -4,7 +4,7 @@ #include "Button.h" #include "EditBox.h" -#include "app/include/stubs.h" +#include "platform/stubs.h" #include "util/StringHelpers.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/Options.h" diff --git a/targets/minecraft/client/gui/Minimap.cpp b/targets/minecraft/client/gui/Minimap.cpp index c59353751..73d939e0e 100644 --- a/targets/minecraft/client/gui/Minimap.cpp +++ b/targets/minecraft/client/gui/Minimap.cpp @@ -9,9 +9,9 @@ #include "platform/sdl2/Render.h" #include "Font.h" -#include "app/common/App_enums.h" -#include "app/common/src/Colours/ColourTable.h" -#include "app/include/BufferedImage.h" +#include "minecraft/GameEnums.h" +#include "app/common/Colours/ColourTable.h" +#include "minecraft/client/BufferedImage.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/renderer/Tesselator.h" #include "minecraft/client/renderer/Textures.h" diff --git a/targets/minecraft/client/gui/NameEntryScreen.cpp b/targets/minecraft/client/gui/NameEntryScreen.cpp index 309389a0d..18acb3d38 100644 --- a/targets/minecraft/client/gui/NameEntryScreen.cpp +++ b/targets/minecraft/client/gui/NameEntryScreen.cpp @@ -3,7 +3,7 @@ #include #include "Button.h" -#include "app/include/stubs.h" +#include "platform/stubs.h" #include "util/StringHelpers.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Screen.h" diff --git a/targets/minecraft/client/gui/PauseScreen.cpp b/targets/minecraft/client/gui/PauseScreen.cpp index da12bf5d7..1f11ea04f 100644 --- a/targets/minecraft/client/gui/PauseScreen.cpp +++ b/targets/minecraft/client/gui/PauseScreen.cpp @@ -1,3 +1,4 @@ +#include "minecraft/IGameServices.h" #include "PauseScreen.h" #include @@ -10,8 +11,8 @@ #include "platform/sdl2/Input.h" #include "Button.h" #include "MessageScreen.h" -#include "app/common/App_enums.h" -#include "app/common/src/Network/GameNetworkManager.h" +#include "minecraft/GameEnums.h" +#include "app/common/Network/GameNetworkManager.h" #include "app/linux/LinuxGame.h" #include "OptionsScreen.h" #include "minecraft/client/Minecraft.h" @@ -32,7 +33,7 @@ void PauseScreen::init() { // 4jcraft: solves the issue of client-side only pausing in the java gui if (g_NetworkManager.IsLocalGame() && g_NetworkManager.GetPlayerCount() == 1) - app.SetXuiServerAction(InputManager.GetPrimaryPad(), + gameServices().setXuiServerAction(InputManager.GetPrimaryPad(), eXuiServerAction_PauseServer, (void*)true); buttons.push_back(new Button(1, width / 2 - 100, height / 4 + 24 * 5 + yo, I18n::get(L"menu.returnToMenu"))); @@ -70,7 +71,7 @@ void PauseScreen::exitWorld(Minecraft* minecraft, bool save) { if (g_NetworkManager.IsHost()) { server->setSaveOnExit(save); } - app.SetAction(minecraft->player->GetXboxPad(), eAppAction_ExitWorld); + gameServices().setAction(minecraft->player->GetXboxPad(), eAppAction_ExitWorld); } void PauseScreen::buttonClicked(Button* button) { @@ -90,7 +91,7 @@ void PauseScreen::buttonClicked(Button* button) { exitWorld(minecraft, true); } if (button->id == 4) { - app.SetXuiServerAction(InputManager.GetPrimaryPad(), + gameServices().setXuiServerAction(InputManager.GetPrimaryPad(), eXuiServerAction_PauseServer, (void*)false); minecraft->setScreen(nullptr); // minecraft->grabMouse(); // 4J - removed diff --git a/targets/minecraft/client/gui/RenameWorldScreen.cpp b/targets/minecraft/client/gui/RenameWorldScreen.cpp index c56701630..e0e937276 100644 --- a/targets/minecraft/client/gui/RenameWorldScreen.cpp +++ b/targets/minecraft/client/gui/RenameWorldScreen.cpp @@ -4,7 +4,7 @@ #include "Button.h" #include "EditBox.h" -#include "app/include/stubs.h" +#include "platform/stubs.h" #include "util/StringHelpers.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Screen.h" diff --git a/targets/minecraft/client/gui/Screen.cpp b/targets/minecraft/client/gui/Screen.cpp index a08d6050f..d7095ec8c 100644 --- a/targets/minecraft/client/gui/Screen.cpp +++ b/targets/minecraft/client/gui/Screen.cpp @@ -1,14 +1,15 @@ +#include "minecraft/IGameServices.h" #include "Screen.h" #include "platform/InputActions.h" #include "platform/sdl2/Input.h" #include "platform/sdl2/Profile.h" #include "Button.h" -#include "app/common/App_enums.h" -#include "app/common/src/Audio/SoundEngine.h" -#include "app/common/src/Network/GameNetworkManager.h" +#include "minecraft/GameEnums.h" +#include "app/common/Audio/SoundEngine.h" +#include "app/common/Network/GameNetworkManager.h" #include "app/linux/LinuxGame.h" -#include "app/include/stubs.h" +#include "platform/stubs.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Screen.h" #include "minecraft/client/gui/particle/GuiParticles.h" @@ -43,7 +44,7 @@ void Screen::keyPressed(wchar_t eventCharacter, int eventKey) { // unpausing is done in all scenarios if (g_NetworkManager.IsLocalGame() && g_NetworkManager.GetPlayerCount() == 1) - app.SetXuiServerAction(InputManager.GetPrimaryPad(), + gameServices().setXuiServerAction(InputManager.GetPrimaryPad(), eXuiServerAction_PauseServer, (void*)false); } } diff --git a/targets/minecraft/client/gui/SelectWorldScreen.cpp b/targets/minecraft/client/gui/SelectWorldScreen.cpp index 101e19cdd..3d121c03f 100644 --- a/targets/minecraft/client/gui/SelectWorldScreen.cpp +++ b/targets/minecraft/client/gui/SelectWorldScreen.cpp @@ -1,3 +1,4 @@ +#include "minecraft/util/Log.h" #include "SelectWorldScreen.h" #include @@ -34,7 +35,7 @@ SelectWorldScreen::SelectWorldScreen(Screen* lastScreen) { } void SelectWorldScreen::init() { - app.DebugPrintf("SelectWorldScreen::init() START\n"); + Log::info("SelectWorldScreen::init() START\n"); Language* language = Language::getInstance(); title = language->getElement(L"selectWorld.title"); @@ -95,7 +96,7 @@ void SelectWorldScreen::postInit() { } void SelectWorldScreen::buttonClicked(Button* button) { - app.DebugPrintf("SelectWorldScreen::buttonClicked START\n"); + Log::info("SelectWorldScreen::buttonClicked START\n"); if (!button->active) return; if (button->id == BUTTON_DELETE_ID) { std::wstring worldName = getWorldName(selectedWorld); @@ -124,7 +125,7 @@ void SelectWorldScreen::buttonClicked(Button* button) { minecraft->setScreen( new RenameWorldScreen(this, getWorldId(selectedWorld))); } else if (button->id == BUTTON_CANCEL_ID) { - app.DebugPrintf( + Log::info( "SelectWorldScreen::buttonClicked 'Cancel' " "minecraft->setScreen(lastScreen)\n"); minecraft->setScreen(lastScreen); @@ -200,7 +201,7 @@ void SelectWorldScreen::render(int xm, int ym, float a) { count = 0; } } else { - app.DebugPrintf( + Log::info( "SelectWorldScreen::render minecraft->setScreen(new " "CreateWorldScreen(this))\n"); minecraft->setScreen(new CreateWorldScreen(this)); diff --git a/targets/minecraft/client/gui/achievement/AchievementScreen.cpp b/targets/minecraft/client/gui/achievement/AchievementScreen.cpp index 45e98cb32..95f031cd7 100644 --- a/targets/minecraft/client/gui/achievement/AchievementScreen.cpp +++ b/targets/minecraft/client/gui/achievement/AchievementScreen.cpp @@ -6,7 +6,7 @@ #include #include "platform/sdl2/Render.h" -#include "app/include/stubs.h" +#include "platform/stubs.h" #include "minecraft/client/KeyMapping.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/Options.h" diff --git a/targets/minecraft/client/gui/achievement/StatsScreen.cpp b/targets/minecraft/client/gui/achievement/StatsScreen.cpp index f210421b2..2ae8ad43c 100644 --- a/targets/minecraft/client/gui/achievement/StatsScreen.cpp +++ b/targets/minecraft/client/gui/achievement/StatsScreen.cpp @@ -1,7 +1,7 @@ #include "StatsScreen.h" -#include "app/common/src/Audio/SoundEngine.h" -#include "app/include/stubs.h" +#include "app/common/Audio/SoundEngine.h" +#include "platform/stubs.h" #include "util/StringHelpers.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Button.h" diff --git a/targets/minecraft/client/gui/inventory/AbstractContainerScreen.cpp b/targets/minecraft/client/gui/inventory/AbstractContainerScreen.cpp index 3e76f6922..92aba34cf 100644 --- a/targets/minecraft/client/gui/inventory/AbstractContainerScreen.cpp +++ b/targets/minecraft/client/gui/inventory/AbstractContainerScreen.cpp @@ -1,3 +1,4 @@ +#include "minecraft/IGameServices.h" #include "AbstractContainerScreen.h" #include @@ -5,7 +6,7 @@ #include #include "app/linux/LinuxGame.h" -#include "app/include/stubs.h" +#include "platform/stubs.h" #include "minecraft/client/KeyMapping.h" #include "minecraft/client/Lighting.h" #include "minecraft/client/Minecraft.h" @@ -248,7 +249,7 @@ void AbstractContainerScreen::renderTooltip(std::shared_ptr item, } if (!cleanedLines.empty()) { - lineColors[0] = app.GetHTMLColour(item->getRarity()->color); + lineColors[0] = gameServices().getHTMLColour(item->getRarity()->color); } renderTooltipInternal(cleanedLines, lineColors, xm, ym); diff --git a/targets/minecraft/client/gui/inventory/BeaconPowerButton.cpp b/targets/minecraft/client/gui/inventory/BeaconPowerButton.cpp index ae1bd13a0..41ae1c2fc 100644 --- a/targets/minecraft/client/gui/inventory/BeaconPowerButton.cpp +++ b/targets/minecraft/client/gui/inventory/BeaconPowerButton.cpp @@ -1,3 +1,4 @@ +#include "minecraft/IGameServices.h" #include "BeaconPowerButton.h" #include @@ -34,7 +35,7 @@ void BeaconPowerButton::renderTooltip(int xm, int ym) { MobEffect* effect = MobEffect::effects[effectId]; if (!effect) return; - std::wstring name = app.GetString(effect->getDescriptionId()); + std::wstring name = gameServices().getString(effect->getDescriptionId()); if (tier >= 3 && effect->id != MobEffect::regeneration->id) { name += L" II"; } diff --git a/targets/minecraft/client/gui/inventory/CreativeInventoryScreen.cpp b/targets/minecraft/client/gui/inventory/CreativeInventoryScreen.cpp index e3e88aa76..48d17c954 100644 --- a/targets/minecraft/client/gui/inventory/CreativeInventoryScreen.cpp +++ b/targets/minecraft/client/gui/inventory/CreativeInventoryScreen.cpp @@ -1,3 +1,4 @@ +#include "minecraft/IGameServices.h" #include "CreativeInventoryScreen.h" #include @@ -9,9 +10,9 @@ #include "platform/sdl2/Input.h" #include "platform/sdl2/Render.h" #include "AbstractContainerScreen.h" -#include "app/common/src/UI/All Platforms/IUIScene_CreativeMenu.h" +#include "app/common/UI/All Platforms/IUIScene_CreativeMenu.h" #include "app/linux/LinuxGame.h" -#include "app/include/stubs.h" +#include "platform/stubs.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/Lighting.h" #include "minecraft/client/gui/Screen.h" @@ -411,7 +412,7 @@ void CreativeInventoryScreen::renderLabels() { IUIScene_CreativeMenu::TabSpec* spec = IUIScene_CreativeMenu::specs[selectedTabIndex]; if (spec) { - std::wstring tabName = app.GetString(spec->m_descriptionId); + std::wstring tabName = gameServices().getString(spec->m_descriptionId); font->draw(tabName, 8, 6, 0x404040); } } @@ -589,7 +590,7 @@ bool CreativeInventoryScreen::renderIconTooltip(int tab, int mouseX, glDisable(GL_LIGHTING); glDisable(GL_DEPTH_TEST); renderTooltip( - app.GetString(IUIScene_CreativeMenu::specs[tab]->m_descriptionId), + gameServices().getString(IUIScene_CreativeMenu::specs[tab]->m_descriptionId), mouseX, mouseY); glEnable(GL_LIGHTING); glEnable(GL_DEPTH_TEST); diff --git a/targets/minecraft/client/gui/inventory/CreativeInventoryScreen.h b/targets/minecraft/client/gui/inventory/CreativeInventoryScreen.h index b3ad21b39..c67636193 100644 --- a/targets/minecraft/client/gui/inventory/CreativeInventoryScreen.h +++ b/targets/minecraft/client/gui/inventory/CreativeInventoryScreen.h @@ -3,7 +3,7 @@ #include #include "AbstractContainerScreen.h" -#include "app/common/src/UI/All Platforms/IUIScene_CreativeMenu.h" +#include "app/common/UI/All Platforms/IUIScene_CreativeMenu.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/world/inventory/AbstractContainerMenu.h" diff --git a/targets/minecraft/client/gui/inventory/TextEditScreen.cpp b/targets/minecraft/client/gui/inventory/TextEditScreen.cpp index 0e838cba6..356665fbc 100644 --- a/targets/minecraft/client/gui/inventory/TextEditScreen.cpp +++ b/targets/minecraft/client/gui/inventory/TextEditScreen.cpp @@ -3,7 +3,7 @@ #include #include "platform/sdl2/Render.h" -#include "app/include/stubs.h" +#include "platform/stubs.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Button.h" diff --git a/targets/minecraft/client/gui/particle/GuiParticle.cpp b/targets/minecraft/client/gui/particle/GuiParticle.cpp index 83ea20131..c7aae80d0 100644 --- a/targets/minecraft/client/gui/particle/GuiParticle.cpp +++ b/targets/minecraft/client/gui/particle/GuiParticle.cpp @@ -1,6 +1,6 @@ #include "GuiParticle.h" -#include "app/include/stubs.h" +#include "platform/stubs.h" #include "java/Random.h" Random* GuiParticle::random = new Random(); diff --git a/targets/minecraft/client/model/HumanoidModel.cpp b/targets/minecraft/client/model/HumanoidModel.cpp index 7801c5f6f..630a0eabf 100644 --- a/targets/minecraft/client/model/HumanoidModel.cpp +++ b/targets/minecraft/client/model/HumanoidModel.cpp @@ -1,3 +1,4 @@ +#include "minecraft/util/Log.h" #include "HumanoidModel.h" #include @@ -44,14 +45,14 @@ ModelPart* HumanoidModel::AddOrRetrievePart(SKIN_BOX* pBox) { if (pNewBox) { if ((pNewBox->getfU() != (int)pBox->fU) || (pNewBox->getfV() != (int)pBox->fV)) { - app.DebugPrintf( + Log::info( "HumanoidModel::AddOrRetrievePart - Box geometry was found, " "but with different uvs\n"); pNewBox = nullptr; } } if (pNewBox == nullptr) { - // app.DebugPrintf("HumanoidModel::AddOrRetrievePart - Adding box to + // Log::info("HumanoidModel::AddOrRetrievePart - Adding box to // model part\n"); pNewBox = new ModelPart(this, (int)pBox->fU, (int)pBox->fV); diff --git a/targets/minecraft/client/model/HumanoidModel.h b/targets/minecraft/client/model/HumanoidModel.h index 0a7705102..ee3c4f092 100644 --- a/targets/minecraft/client/model/HumanoidModel.h +++ b/targets/minecraft/client/model/HumanoidModel.h @@ -1,5 +1,5 @@ #pragma once -#include "app/include/SkinBox.h" +#include "minecraft/client/model/SkinBox.h" #include "minecraft/client/model/geom/Model.h" class ModelPart; diff --git a/targets/app/include/SkinBox.h b/targets/minecraft/client/model/SkinBox.h similarity index 100% rename from targets/app/include/SkinBox.h rename to targets/minecraft/client/model/SkinBox.h diff --git a/targets/minecraft/client/model/geom/Model.h b/targets/minecraft/client/model/geom/Model.h index 8dec7bef1..d8bc1682b 100644 --- a/targets/minecraft/client/model/geom/Model.h +++ b/targets/minecraft/client/model/geom/Model.h @@ -5,7 +5,7 @@ #include #include -#include "app/include/SkinBox.h" +#include "minecraft/client/model/SkinBox.h" #include "java/Random.h" class Mob; diff --git a/targets/minecraft/client/model/geom/ModelPart.h b/targets/minecraft/client/model/geom/ModelPart.h index 818d1af5f..92514d8b4 100644 --- a/targets/minecraft/client/model/geom/ModelPart.h +++ b/targets/minecraft/client/model/geom/ModelPart.h @@ -2,7 +2,7 @@ #include #include -#include "app/include/SkinBox.h" +#include "minecraft/client/model/SkinBox.h" #include "Model.h" #include "minecraft/client/model/Polygon.h" #include "minecraft/client/model/Vertex.h" diff --git a/targets/minecraft/client/multiplayer/ClientConnection.cpp b/targets/minecraft/client/multiplayer/ClientConnection.cpp index 807bfe18c..5c5531979 100644 --- a/targets/minecraft/client/multiplayer/ClientConnection.cpp +++ b/targets/minecraft/client/multiplayer/ClientConnection.cpp @@ -1,3 +1,5 @@ +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "ClientConnection.h" #include @@ -13,23 +15,23 @@ #include "platform/PlatformTypes.h" #include "platform/sdl2/Input.h" #include "platform/sdl2/Profile.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/App_structs.h" -#include "app/common/src/ConsoleGameMode.h" -#include "app/common/src/DLC/DLCManager.h" -#include "app/common/src/DLC/DLCPack.h" -#include "app/common/src/DLC/DLCSkinFile.h" -#include "app/common/src/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" -#include "app/common/src/Network/GameNetworkManager.h" -#include "app/common/src/Network/NetworkPlayerInterface.h" -#include "app/common/src/Network/Socket.h" -#include "app/common/src/Tutorial/FullTutorialMode.h" -#include "app/common/src/Tutorial/Tutorial.h" -#include "app/common/src/Tutorial/TutorialEnum.h" -#include "app/common/src/Tutorial/TutorialMode.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" -#include "app/common/src/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.h" +#include "app/common/ConsoleGameMode.h" +#include "app/common/DLC/DLCManager.h" +#include "app/common/DLC/DLCPack.h" +#include "app/common/DLC/DLCSkinFile.h" +#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "app/common/Network/GameNetworkManager.h" +#include "app/common/Network/NetworkPlayerInterface.h" +#include "app/common/Network/Socket.h" +#include "app/common/Tutorial/FullTutorialMode.h" +#include "app/common/Tutorial/Tutorial.h" +#include "app/common/Tutorial/TutorialEnum.h" +#include "app/common/Tutorial/TutorialMode.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "app/linux/Stubs/winapi_stubs.h" @@ -274,7 +276,7 @@ void ClientConnection::handleLogin(std::shared_ptr packet) { MOJANG_DATA* pMojangData = nullptr; if (!g_NetworkManager.IsLocalGame()) { - pMojangData = app.GetMojangDataForXuid(OnlineXuid); + pMojangData = gameServices().getMojangDataForXuid(OnlineXuid); } if (!g_NetworkManager.IsHost()) { @@ -314,12 +316,12 @@ void ClientConnection::handleLogin(std::shared_ptr packet) { if (pMojangData->wchSkin[0] != 0L) { std::wstring wstr = pMojangData->wchSkin; // check the file is not already in - bRes = app.IsFileInMemoryTextures(wstr); + bRes = gameServices().isFileInMemoryTextures(wstr); if (!bRes) { } if (bRes) { - app.AddMemoryTextureFile(wstr, pBuffer, dwSize); + gameServices().addMemoryTextureFile(wstr, pBuffer, dwSize); } } @@ -327,25 +329,25 @@ void ClientConnection::handleLogin(std::shared_ptr packet) { if (pMojangData->wchCape[0] != 0L) { std::wstring wstr = pMojangData->wchCape; // check the file is not already in - bRes = app.IsFileInMemoryTextures(wstr); + bRes = gameServices().isFileInMemoryTextures(wstr); if (!bRes) { } if (bRes) { - app.AddMemoryTextureFile(wstr, pBuffer, dwSize); + gameServices().addMemoryTextureFile(wstr, pBuffer, dwSize); } } } // If we're online, read the banned game list - app.ReadBannedList(iUserID); + gameServices().readBannedList(iUserID); // mark the level as not checked against banned levels - it'll be // checked once the level starts - app.SetBanListCheck(iUserID, false); + gameServices().setBanListCheck(iUserID, false); } if (m_userIndex == InputManager.GetPrimaryPad()) { - if (app.GetTutorialMode()) { + if (gameServices().getTutorialMode()) { minecraft->gameMode = new FullTutorialMode( InputManager.GetPrimaryPad(), minecraft, this); } else { @@ -374,7 +376,7 @@ void ClientConnection::handleLogin(std::shared_ptr packet) { level->savedDataStorage = activeLevel->savedDataStorage; } - app.DebugPrintf("ClientConnection - DIFFICULTY --- %d\n", + Log::info("ClientConnection - DIFFICULTY --- %d\n", packet->difficulty); level->difficulty = packet->difficulty; // 4J Added level->isClientSide = true; @@ -382,8 +384,8 @@ void ClientConnection::handleLogin(std::shared_ptr packet) { } minecraft->player->setPlayerIndex(packet->m_playerIndex); - minecraft->player->setCustomSkin(app.GetPlayerSkinId(m_userIndex)); - minecraft->player->setCustomCape(app.GetPlayerCapeId(m_userIndex)); + minecraft->player->setCustomSkin(gameServices().getPlayerSkinId(m_userIndex)); + minecraft->player->setCustomCape(gameServices().getPlayerCapeId(m_userIndex)); minecraft->createPrimaryLocalPlayer(InputManager.GetPrimaryPad()); @@ -392,7 +394,7 @@ void ClientConnection::handleLogin(std::shared_ptr packet) { minecraft->player->entityId = packet->clientVersion; std::uint8_t networkSmallId = getSocket()->getSmallId(); - app.UpdatePlayerInfo(networkSmallId, packet->m_playerIndex, + gameServices().updatePlayerInfo(networkSmallId, packet->m_playerIndex, packet->m_uiGamePrivileges); minecraft->player->setPlayerGamePrivilege( Player::ePlayerGamePrivilege_All, packet->m_uiGamePrivileges); @@ -410,8 +412,8 @@ void ClientConnection::handleLogin(std::shared_ptr packet) { displayPrivilegeChanges(minecraft->player, startingPrivileges); // update the debugoptions - app.SetGameSettingsDebugMask(InputManager.GetPrimaryPad(), - app.GetGameSettingsDebugMask(-1, true)); + gameServices().setGameSettingsDebugMask(InputManager.GetPrimaryPad(), + gameServices().debugGetMask(-1, true)); } else { // 4J-PB - this isn't the level we want // level = (MultiPlayerLevel *)minecraft->level; @@ -469,11 +471,11 @@ void ClientConnection::handleLogin(std::shared_ptr packet) { player->entityId = packet->clientVersion; player->setPlayerIndex(packet->m_playerIndex); - player->setCustomSkin(app.GetPlayerSkinId(m_userIndex)); - player->setCustomCape(app.GetPlayerCapeId(m_userIndex)); + player->setCustomSkin(gameServices().getPlayerSkinId(m_userIndex)); + player->setCustomCape(gameServices().getPlayerCapeId(m_userIndex)); std::uint8_t networkSmallId = getSocket()->getSmallId(); - app.UpdatePlayerInfo(networkSmallId, packet->m_playerIndex, + gameServices().updatePlayerInfo(networkSmallId, packet->m_playerIndex, packet->m_uiGamePrivileges); player->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_All, packet->m_uiGamePrivileges); @@ -556,7 +558,7 @@ void ClientConnection::handleAddEntity( int ix = (int)x; int iy = (int)y; int iz = (int)z; - app.DebugPrintf("ClientConnection ITEM_FRAME xyz %d,%d,%d\n", ix, + Log::info("ClientConnection ITEM_FRAME xyz %d,%d,%d\n", ix, iy, iz); } e = std::shared_ptr( @@ -873,7 +875,7 @@ void ClientConnection::handleAddPlayer( ProfileManager.AreXUIDSEqual(playerXUIDOnline, packet->xuid)) || (playerXUIDOffline != INVALID_XUID && ProfileManager.AreXUIDSEqual(playerXUIDOffline, packet->xuid))) { - app.DebugPrintf( + Log::info( "AddPlayerPacket received with XUID of local player\n"); return; } @@ -918,10 +920,10 @@ void ClientConnection::handleAddPlayer( if (!player->customTextureUrl.empty() && player->customTextureUrl.substr(0, 3).compare(L"def") != 0 && - !app.IsFileInMemoryTextures(player->customTextureUrl)) { + !gameServices().isFileInMemoryTextures(player->customTextureUrl)) { if (minecraft->addPendingClientTextureRequest( player->customTextureUrl)) { - app.DebugPrintf( + Log::info( "Client sending TextureAndGeometryPacket to get custom skin " "%ls for player %ls\n", player->customTextureUrl.c_str(), player->name.c_str()); @@ -931,20 +933,20 @@ void ClientConnection::handleAddPlayer( 0))); } } else if (!player->customTextureUrl.empty() && - app.IsFileInMemoryTextures(player->customTextureUrl)) { + gameServices().isFileInMemoryTextures(player->customTextureUrl)) { // Update the ref count on the memory texture data - app.AddMemoryTextureFile(player->customTextureUrl, nullptr, 0); + gameServices().addMemoryTextureFile(player->customTextureUrl, nullptr, 0); } - app.DebugPrintf("Custom skin for player %ls is %ls\n", player->name.c_str(), + Log::info("Custom skin for player %ls is %ls\n", player->name.c_str(), player->customTextureUrl.c_str()); if (!player->customTextureUrl2.empty() && player->customTextureUrl2.substr(0, 3).compare(L"def") != 0 && - !app.IsFileInMemoryTextures(player->customTextureUrl2)) { + !gameServices().isFileInMemoryTextures(player->customTextureUrl2)) { if (minecraft->addPendingClientTextureRequest( player->customTextureUrl2)) { - app.DebugPrintf( + Log::info( "Client sending texture packet to get custom cape %ls for " "player %ls\n", player->customTextureUrl2.c_str(), player->name.c_str()); @@ -952,12 +954,12 @@ void ClientConnection::handleAddPlayer( new TexturePacket(player->customTextureUrl2, nullptr, 0))); } } else if (!player->customTextureUrl2.empty() && - app.IsFileInMemoryTextures(player->customTextureUrl2)) { + gameServices().isFileInMemoryTextures(player->customTextureUrl2)) { // Update the ref count on the memory texture data - app.AddMemoryTextureFile(player->customTextureUrl2, nullptr, 0); + gameServices().addMemoryTextureFile(player->customTextureUrl2, nullptr, 0); } - app.DebugPrintf("Custom cape for player %ls is %ls\n", player->name.c_str(), + Log::info("Custom cape for player %ls is %ls\n", player->name.c_str(), player->customTextureUrl2.c_str()); level->putEntity(packet->id, player); @@ -1114,7 +1116,7 @@ void ClientConnection::handleMovePlayer( // Minecraft::createExtraLocalPlayer 4J-PB - can't call this when this // function is called from the qnet thread (GetGameStarted will be // false) - if (app.GetGameStarted()) { + if (gameServices().getGameStarted()) { ui.CloseUIScenes(m_userIndex); } } @@ -1337,9 +1339,9 @@ void ClientConnection::handleDisconnect( Minecraft* pMinecraft = Minecraft::GetInstance(); pMinecraft->connectionDisconnected(m_userIndex, packet->reason); - app.SetDisconnectReason(packet->reason); + gameServices().setDisconnectReason(packet->reason); - app.SetAction(m_userIndex, eAppAction_ExitWorld, (void*)true); + gameServices().setAction(m_userIndex, eAppAction_ExitWorld, (void*)true); // minecraft->setLevel(nullptr); // minecraft->setScreen(new DisconnectedScreen(L"disconnect.disconnected", // L"disconnect.genericReason", &packet->reason)); @@ -1369,7 +1371,7 @@ void ClientConnection::onDisconnect(DisconnectPacket::eDisconnectReason reason, &ClientConnection::HostDisconnectReturned, nullptr); } else { - app.SetAction(m_userIndex, eAppAction_ExitWorld, (void*)true); + gameServices().setAction(m_userIndex, eAppAction_ExitWorld, (void*)true); } // minecraft->setLevel(nullptr); @@ -1439,7 +1441,7 @@ void ClientConnection::handleTakeItemEntity( ((random->nextFloat() - random->nextFloat()) * 0.7f + 1.0f) * 2.0f; - app.DebugPrintf("XP Orb with pitch %f\n", fPitch); + Log::info("XP Orb with pitch %f\n", fPitch); level->playSound(from, eSoundType_RANDOM_ORB, 0.2f, fPitch); } else { level->playSound( @@ -1494,327 +1496,327 @@ void ClientConnection::handleChat(std::shared_ptr packet) { switch (packet->m_messageType) { case ChatPacket::e_ChatBedOccupied: - message = app.GetString(IDS_TILE_BED_OCCUPIED); + message = gameServices().getString(IDS_TILE_BED_OCCUPIED); break; case ChatPacket::e_ChatBedNoSleep: - message = app.GetString(IDS_TILE_BED_NO_SLEEP); + message = gameServices().getString(IDS_TILE_BED_NO_SLEEP); break; case ChatPacket::e_ChatBedNotValid: - message = app.GetString(IDS_TILE_BED_NOT_VALID); + message = gameServices().getString(IDS_TILE_BED_NOT_VALID); break; case ChatPacket::e_ChatBedNotSafe: - message = app.GetString(IDS_TILE_BED_NOTSAFE); + message = gameServices().getString(IDS_TILE_BED_NOTSAFE); break; case ChatPacket::e_ChatBedPlayerSleep: - message = app.GetString(IDS_TILE_BED_PLAYERSLEEP); + message = gameServices().getString(IDS_TILE_BED_PLAYERSLEEP); iPos = message.find(L"%s"); message.replace(iPos, 2, playerDisplayName); break; case ChatPacket::e_ChatBedMeSleep: - message = app.GetString(IDS_TILE_BED_MESLEEP); + message = gameServices().getString(IDS_TILE_BED_MESLEEP); break; case ChatPacket::e_ChatPlayerJoinedGame: - message = app.GetString(IDS_PLAYER_JOINED); + message = gameServices().getString(IDS_PLAYER_JOINED); iPos = message.find(L"%s"); message.replace(iPos, 2, playerDisplayName); break; case ChatPacket::e_ChatPlayerLeftGame: - message = app.GetString(IDS_PLAYER_LEFT); + message = gameServices().getString(IDS_PLAYER_LEFT); iPos = message.find(L"%s"); message.replace(iPos, 2, playerDisplayName); break; case ChatPacket::e_ChatPlayerKickedFromGame: - message = app.GetString(IDS_PLAYER_KICKED); + message = gameServices().getString(IDS_PLAYER_KICKED); iPos = message.find(L"%s"); message.replace(iPos, 2, playerDisplayName); break; case ChatPacket::e_ChatCannotPlaceLava: displayOnGui = false; - app.SetGlobalXuiAction(eAppAction_DisplayLavaMessage); + gameServices().setGlobalXuiAction(eAppAction_DisplayLavaMessage); break; case ChatPacket::e_ChatDeathInFire: - message = app.GetString(IDS_DEATH_INFIRE); + message = gameServices().getString(IDS_DEATH_INFIRE); replacePlayer = true; break; case ChatPacket::e_ChatDeathOnFire: - message = app.GetString(IDS_DEATH_ONFIRE); + message = gameServices().getString(IDS_DEATH_ONFIRE); replacePlayer = true; break; case ChatPacket::e_ChatDeathLava: - message = app.GetString(IDS_DEATH_LAVA); + message = gameServices().getString(IDS_DEATH_LAVA); replacePlayer = true; break; case ChatPacket::e_ChatDeathInWall: - message = app.GetString(IDS_DEATH_INWALL); + message = gameServices().getString(IDS_DEATH_INWALL); replacePlayer = true; break; case ChatPacket::e_ChatDeathDrown: - message = app.GetString(IDS_DEATH_DROWN); + message = gameServices().getString(IDS_DEATH_DROWN); replacePlayer = true; break; case ChatPacket::e_ChatDeathStarve: - message = app.GetString(IDS_DEATH_STARVE); + message = gameServices().getString(IDS_DEATH_STARVE); replacePlayer = true; break; case ChatPacket::e_ChatDeathCactus: - message = app.GetString(IDS_DEATH_CACTUS); + message = gameServices().getString(IDS_DEATH_CACTUS); replacePlayer = true; break; case ChatPacket::e_ChatDeathFall: - message = app.GetString(IDS_DEATH_FALL); + message = gameServices().getString(IDS_DEATH_FALL); replacePlayer = true; break; case ChatPacket::e_ChatDeathOutOfWorld: - message = app.GetString(IDS_DEATH_OUTOFWORLD); + message = gameServices().getString(IDS_DEATH_OUTOFWORLD); replacePlayer = true; break; case ChatPacket::e_ChatDeathGeneric: - message = app.GetString(IDS_DEATH_GENERIC); + message = gameServices().getString(IDS_DEATH_GENERIC); replacePlayer = true; break; case ChatPacket::e_ChatDeathExplosion: - message = app.GetString(IDS_DEATH_EXPLOSION); + message = gameServices().getString(IDS_DEATH_EXPLOSION); replacePlayer = true; break; case ChatPacket::e_ChatDeathMagic: - message = app.GetString(IDS_DEATH_MAGIC); + message = gameServices().getString(IDS_DEATH_MAGIC); replacePlayer = true; break; case ChatPacket::e_ChatDeathAnvil: - message = app.GetString(IDS_DEATH_FALLING_ANVIL); + message = gameServices().getString(IDS_DEATH_FALLING_ANVIL); replacePlayer = true; break; case ChatPacket::e_ChatDeathFallingBlock: - message = app.GetString(IDS_DEATH_FALLING_TILE); + message = gameServices().getString(IDS_DEATH_FALLING_TILE); replacePlayer = true; break; case ChatPacket::e_ChatDeathDragonBreath: - message = app.GetString(IDS_DEATH_DRAGON_BREATH); + message = gameServices().getString(IDS_DEATH_DRAGON_BREATH); replacePlayer = true; break; case ChatPacket::e_ChatDeathMob: - message = app.GetString(IDS_DEATH_MOB); + message = gameServices().getString(IDS_DEATH_MOB); replacePlayer = true; replaceEntitySource = true; break; case ChatPacket::e_ChatDeathPlayer: - message = app.GetString(IDS_DEATH_PLAYER); + message = gameServices().getString(IDS_DEATH_PLAYER); replacePlayer = true; replaceEntitySource = true; break; case ChatPacket::e_ChatDeathArrow: - message = app.GetString(IDS_DEATH_ARROW); + message = gameServices().getString(IDS_DEATH_ARROW); replacePlayer = true; replaceEntitySource = true; break; case ChatPacket::e_ChatDeathFireball: - message = app.GetString(IDS_DEATH_FIREBALL); + message = gameServices().getString(IDS_DEATH_FIREBALL); replacePlayer = true; replaceEntitySource = true; break; case ChatPacket::e_ChatDeathThrown: - message = app.GetString(IDS_DEATH_THROWN); + message = gameServices().getString(IDS_DEATH_THROWN); replacePlayer = true; replaceEntitySource = true; break; case ChatPacket::e_ChatDeathIndirectMagic: - message = app.GetString(IDS_DEATH_INDIRECT_MAGIC); + message = gameServices().getString(IDS_DEATH_INDIRECT_MAGIC); replacePlayer = true; replaceEntitySource = true; break; case ChatPacket::e_ChatDeathThorns: - message = app.GetString(IDS_DEATH_THORNS); + message = gameServices().getString(IDS_DEATH_THORNS); replacePlayer = true; replaceEntitySource = true; break; case ChatPacket::e_ChatDeathFellAccidentLadder: - message = app.GetString(IDS_DEATH_FELL_ACCIDENT_LADDER); + message = gameServices().getString(IDS_DEATH_FELL_ACCIDENT_LADDER); replacePlayer = true; break; case ChatPacket::e_ChatDeathFellAccidentVines: - message = app.GetString(IDS_DEATH_FELL_ACCIDENT_VINES); + message = gameServices().getString(IDS_DEATH_FELL_ACCIDENT_VINES); replacePlayer = true; break; case ChatPacket::e_ChatDeathFellAccidentWater: - message = app.GetString(IDS_DEATH_FELL_ACCIDENT_WATER); + message = gameServices().getString(IDS_DEATH_FELL_ACCIDENT_WATER); replacePlayer = true; break; case ChatPacket::e_ChatDeathFellAccidentGeneric: - message = app.GetString(IDS_DEATH_FELL_ACCIDENT_GENERIC); + message = gameServices().getString(IDS_DEATH_FELL_ACCIDENT_GENERIC); replacePlayer = true; break; case ChatPacket::e_ChatDeathFellKiller: - // message=app.GetString(IDS_DEATH_FELL_KILLER); + // message=gameServices().getString(IDS_DEATH_FELL_KILLER); // replacePlayer = true; // replaceEntitySource = true; // 4J Stu - The correct string for here, IDS_DEATH_FELL_KILLER is // incorrect. We can't change localisation, so use a different // string for now - message = app.GetString(IDS_DEATH_FALL); + message = gameServices().getString(IDS_DEATH_FALL); replacePlayer = true; break; case ChatPacket::e_ChatDeathFellAssist: - message = app.GetString(IDS_DEATH_FELL_ASSIST); + message = gameServices().getString(IDS_DEATH_FELL_ASSIST); replacePlayer = true; replaceEntitySource = true; break; case ChatPacket::e_ChatDeathFellAssistItem: - message = app.GetString(IDS_DEATH_FELL_ASSIST_ITEM); + message = gameServices().getString(IDS_DEATH_FELL_ASSIST_ITEM); replacePlayer = true; replaceEntitySource = true; replaceItem = true; break; case ChatPacket::e_ChatDeathFellFinish: - message = app.GetString(IDS_DEATH_FELL_FINISH); + message = gameServices().getString(IDS_DEATH_FELL_FINISH); replacePlayer = true; replaceEntitySource = true; break; case ChatPacket::e_ChatDeathFellFinishItem: - message = app.GetString(IDS_DEATH_FELL_FINISH_ITEM); + message = gameServices().getString(IDS_DEATH_FELL_FINISH_ITEM); replacePlayer = true; replaceEntitySource = true; replaceItem = true; break; case ChatPacket::e_ChatDeathInFirePlayer: - message = app.GetString(IDS_DEATH_INFIRE_PLAYER); + message = gameServices().getString(IDS_DEATH_INFIRE_PLAYER); replacePlayer = true; replaceEntitySource = true; break; case ChatPacket::e_ChatDeathOnFirePlayer: - message = app.GetString(IDS_DEATH_ONFIRE_PLAYER); + message = gameServices().getString(IDS_DEATH_ONFIRE_PLAYER); replacePlayer = true; replaceEntitySource = true; break; case ChatPacket::e_ChatDeathLavaPlayer: - message = app.GetString(IDS_DEATH_LAVA_PLAYER); + message = gameServices().getString(IDS_DEATH_LAVA_PLAYER); replacePlayer = true; replaceEntitySource = true; break; case ChatPacket::e_ChatDeathDrownPlayer: - message = app.GetString(IDS_DEATH_DROWN_PLAYER); + message = gameServices().getString(IDS_DEATH_DROWN_PLAYER); replacePlayer = true; replaceEntitySource = true; break; case ChatPacket::e_ChatDeathCactusPlayer: - message = app.GetString(IDS_DEATH_CACTUS_PLAYER); + message = gameServices().getString(IDS_DEATH_CACTUS_PLAYER); replacePlayer = true; replaceEntitySource = true; break; case ChatPacket::e_ChatDeathExplosionPlayer: - message = app.GetString(IDS_DEATH_EXPLOSION_PLAYER); + message = gameServices().getString(IDS_DEATH_EXPLOSION_PLAYER); replacePlayer = true; replaceEntitySource = true; break; case ChatPacket::e_ChatDeathWither: - message = app.GetString(IDS_DEATH_WITHER); + message = gameServices().getString(IDS_DEATH_WITHER); replacePlayer = true; break; case ChatPacket::e_ChatDeathPlayerItem: - message = app.GetString(IDS_DEATH_PLAYER_ITEM); + message = gameServices().getString(IDS_DEATH_PLAYER_ITEM); replacePlayer = true; replaceEntitySource = true; replaceItem = true; break; case ChatPacket::e_ChatDeathArrowItem: - message = app.GetString(IDS_DEATH_ARROW_ITEM); + message = gameServices().getString(IDS_DEATH_ARROW_ITEM); replacePlayer = true; replaceEntitySource = true; replaceItem = true; break; case ChatPacket::e_ChatDeathFireballItem: - message = app.GetString(IDS_DEATH_FIREBALL_ITEM); + message = gameServices().getString(IDS_DEATH_FIREBALL_ITEM); replacePlayer = true; replaceEntitySource = true; replaceItem = true; break; case ChatPacket::e_ChatDeathThrownItem: - message = app.GetString(IDS_DEATH_THROWN_ITEM); + message = gameServices().getString(IDS_DEATH_THROWN_ITEM); replacePlayer = true; replaceEntitySource = true; replaceItem = true; break; case ChatPacket::e_ChatDeathIndirectMagicItem: - message = app.GetString(IDS_DEATH_INDIRECT_MAGIC_ITEM); + message = gameServices().getString(IDS_DEATH_INDIRECT_MAGIC_ITEM); replacePlayer = true; replaceEntitySource = true; replaceItem = true; break; case ChatPacket::e_ChatPlayerEnteredEnd: - message = app.GetString(IDS_PLAYER_ENTERED_END); + message = gameServices().getString(IDS_PLAYER_ENTERED_END); iPos = message.find(L"%s"); message.replace(iPos, 2, playerDisplayName); break; case ChatPacket::e_ChatPlayerLeftEnd: - message = app.GetString(IDS_PLAYER_LEFT_END); + message = gameServices().getString(IDS_PLAYER_LEFT_END); iPos = message.find(L"%s"); message.replace(iPos, 2, playerDisplayName); break; case ChatPacket::e_ChatPlayerMaxEnemies: - message = app.GetString(IDS_MAX_ENEMIES_SPAWNED); + message = gameServices().getString(IDS_MAX_ENEMIES_SPAWNED); break; // Spawn eggs case ChatPacket::e_ChatPlayerMaxVillagers: - message = app.GetString(IDS_MAX_VILLAGERS_SPAWNED); + message = gameServices().getString(IDS_MAX_VILLAGERS_SPAWNED); break; case ChatPacket::e_ChatPlayerMaxPigsSheepCows: - message = app.GetString(IDS_MAX_PIGS_SHEEP_COWS_CATS_SPAWNED); + message = gameServices().getString(IDS_MAX_PIGS_SHEEP_COWS_CATS_SPAWNED); break; case ChatPacket::e_ChatPlayerMaxChickens: - message = app.GetString(IDS_MAX_CHICKENS_SPAWNED); + message = gameServices().getString(IDS_MAX_CHICKENS_SPAWNED); break; case ChatPacket::e_ChatPlayerMaxSquid: - message = app.GetString(IDS_MAX_SQUID_SPAWNED); + message = gameServices().getString(IDS_MAX_SQUID_SPAWNED); break; case ChatPacket::e_ChatPlayerMaxMooshrooms: - message = app.GetString(IDS_MAX_MOOSHROOMS_SPAWNED); + message = gameServices().getString(IDS_MAX_MOOSHROOMS_SPAWNED); break; case ChatPacket::e_ChatPlayerMaxWolves: - message = app.GetString(IDS_MAX_WOLVES_SPAWNED); + message = gameServices().getString(IDS_MAX_WOLVES_SPAWNED); break; case ChatPacket::e_ChatPlayerMaxBats: - message = app.GetString(IDS_MAX_BATS_SPAWNED); + message = gameServices().getString(IDS_MAX_BATS_SPAWNED); break; // Breeding case ChatPacket::e_ChatPlayerMaxBredPigsSheepCows: - message = app.GetString(IDS_MAX_PIGS_SHEEP_COWS_CATS_BRED); + message = gameServices().getString(IDS_MAX_PIGS_SHEEP_COWS_CATS_BRED); break; case ChatPacket::e_ChatPlayerMaxBredChickens: - message = app.GetString(IDS_MAX_CHICKENS_BRED); + message = gameServices().getString(IDS_MAX_CHICKENS_BRED); break; case ChatPacket::e_ChatPlayerMaxBredMooshrooms: - message = app.GetString(IDS_MAX_MUSHROOMCOWS_BRED); + message = gameServices().getString(IDS_MAX_MUSHROOMCOWS_BRED); break; case ChatPacket::e_ChatPlayerMaxBredWolves: - message = app.GetString(IDS_MAX_WOLVES_BRED); + message = gameServices().getString(IDS_MAX_WOLVES_BRED); break; // can't shear the mooshroom case ChatPacket::e_ChatPlayerCantShearMooshroom: - message = app.GetString(IDS_CANT_SHEAR_MOOSHROOM); + message = gameServices().getString(IDS_CANT_SHEAR_MOOSHROOM); break; // Paintings/Item Frames case ChatPacket::e_ChatPlayerMaxHangingEntities: - message = app.GetString(IDS_MAX_HANGINGENTITIES); + message = gameServices().getString(IDS_MAX_HANGINGENTITIES); break; // Enemy spawn eggs in peaceful case ChatPacket::e_ChatPlayerCantSpawnInPeaceful: - message = app.GetString(IDS_CANT_SPAWN_IN_PEACEFUL); + message = gameServices().getString(IDS_CANT_SPAWN_IN_PEACEFUL); break; // Enemy spawn eggs in peaceful case ChatPacket::e_ChatPlayerMaxBoats: - message = app.GetString(IDS_MAX_BOATS); + message = gameServices().getString(IDS_MAX_BOATS); break; case ChatPacket::e_ChatCommandTeleportSuccess: - message = app.GetString(IDS_COMMAND_TELEPORT_SUCCESS); + message = gameServices().getString(IDS_COMMAND_TELEPORT_SUCCESS); replacePlayer = true; if (packet->m_intArgs[0] == eTYPE_SERVERPLAYER) { message = @@ -1822,15 +1824,15 @@ void ClientConnection::handleChat(std::shared_ptr packet) { } else { message = replaceAll( message, L"{*DESTINATION*}", - app.getEntityName((eINSTANCEOF)packet->m_intArgs[0])); + gameServices().getEntityName((EntityTypeId)packet->m_intArgs[0])); } break; case ChatPacket::e_ChatCommandTeleportMe: - message = app.GetString(IDS_COMMAND_TELEPORT_ME); + message = gameServices().getString(IDS_COMMAND_TELEPORT_ME); replacePlayer = true; break; case ChatPacket::e_ChatCommandTeleportToMe: - message = app.GetString(IDS_COMMAND_TELEPORT_TO_ME); + message = gameServices().getString(IDS_COMMAND_TELEPORT_TO_ME); replacePlayer = true; break; @@ -1855,7 +1857,7 @@ void ClientConnection::handleChat(std::shared_ptr packet) { entityName = packet->m_stringArgs[1]; } else { entityName = - app.getEntityName((eINSTANCEOF)packet->m_intArgs[0]); + gameServices().getEntityName((EntityTypeId)packet->m_intArgs[0]); } message = replaceAll(message, L"{*SOURCE*}", entityName); @@ -1929,12 +1931,12 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) { if (!g_NetworkManager.IsHost()) { // set the game host settings - app.SetGameHostOption(eGameHostOption_All, packet->m_serverSettings); + gameServices().setGameHostOption(eGameHostOption_All, packet->m_serverSettings); // 4J-PB - if we go straight in from the menus via an invite, we won't // have the DLC info - if (app.GetTMSGlobalFileListRead() == false) { - app.SetTMSAction(InputManager.GetPrimaryPad(), + if (gameServices().getTMSGlobalFileListRead() == false) { + gameServices().setTMSAction(InputManager.GetPrimaryPad(), eTMSAction_TMSPP_RetrieveFiles_RunPlayGame); } } @@ -1960,12 +1962,12 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) { reason = DisconnectPacket::eDisconnect_ContentRestricted_AllLocal; - app.DebugPrintf( + Log::info( "Exiting world on handling Pre-Login packet due UGC " "privileges: %d\n", reason); - app.SetDisconnectReason(reason); - app.SetAction(InputManager.GetPrimaryPad(), eAppAction_ExitWorld, + gameServices().setDisconnectReason(reason); + gameServices().setAction(InputManager.GetPrimaryPad(), eAppAction_ExitWorld, (void*)true); } else { if (!isFriendsWithHost) @@ -1976,7 +1978,7 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) { reason = DisconnectPacket:: eDisconnect_ContentRestricted_Single_Local; - app.DebugPrintf( + Log::info( "Exiting player %d on handling Pre-Login packet due UGC " "privileges: %d\n", m_userIndex, reason); @@ -1992,7 +1994,7 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) { IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_SINGLE_LOCAL, uiIDA, 1, m_userIndex); - app.SetDisconnectReason(reason); + gameServices().setDisconnectReason(reason); // 4J-PB - this locks up on the read and write threads not closing // down, because they are trying to lock the incoming critsec when @@ -2000,10 +2002,10 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) { // Minecraft::GetInstance()->connectionDisconnected( // m_userIndex , reason ); done = true; // connection->flush(); connection->close(reason); - // app.SetAction(m_userIndex,eAppAction_ExitPlayer); + // gameServices().setAction(m_userIndex,eAppAction_ExitPlayer); // 4J-PB - doing this instead - app.SetAction(m_userIndex, eAppAction_ExitPlayerPreLogin); + gameServices().setAction(m_userIndex, eAppAction_ExitPlayerPreLogin); } } else { // Texture pack handling @@ -2016,11 +2018,11 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) { Minecraft* pMinecraft = Minecraft::GetInstance(); if (pMinecraft->skins->selectTexturePackById( packet->m_texturePackId)) { - app.DebugPrintf( + Log::info( "Selected texture pack %d from Pre-Login packet\n", packet->m_texturePackId); } else { - app.DebugPrintf( + Log::info( "Could not select texture pack %d from Pre-Login packet, " "requesting from host\n", packet->m_texturePackId); @@ -2064,8 +2066,8 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) { send(std::make_shared( minecraft->user->name, SharedConstants::NETWORK_PROTOCOL_VERSION, offlineXUID, onlineXUID, (!allAllowed && friendsAllowed), - packet->m_ugcPlayersVersion, app.GetPlayerSkinId(m_userIndex), - app.GetPlayerCapeId(m_userIndex), + packet->m_ugcPlayersVersion, gameServices().getPlayerSkinId(m_userIndex), + gameServices().getPlayerCapeId(m_userIndex), ProfileManager.IsGuest(m_userIndex))); fprintf(stderr, "[LOGIN] LoginPacket sent successfully\n"); @@ -2266,7 +2268,7 @@ void ClientConnection::handleTexture(std::shared_ptr packet) { #endif std::uint8_t* pbData = nullptr; unsigned int dwBytes = 0; - app.GetMemFileDetails(packet->textureName, &pbData, &dwBytes); + gameServices().getMemFileDetails(packet->textureName, &pbData, &dwBytes); if (dwBytes != 0) { send(std::shared_ptr( @@ -2278,7 +2280,7 @@ void ClientConnection::handleTexture(std::shared_ptr packet) { wprintf(L"Client received custom texture %ls\n", packet->textureName.c_str()); #endif - app.AddMemoryTextureFile(packet->textureName, packet->pbData, + gameServices().addMemoryTextureFile(packet->textureName, packet->pbData, packet->dataBytes); Minecraft::GetInstance()->handleClientTextureReceived( packet->textureName); @@ -2301,9 +2303,9 @@ void ClientConnection::handleTextureAndGeometry( #endif std::uint8_t* pbData = nullptr; unsigned int dwBytes = 0; - app.GetMemFileDetails(packet->textureName, &pbData, &dwBytes); + gameServices().getMemFileDetails(packet->textureName, &pbData, &dwBytes); DLCSkinFile* pDLCSkinFile = - app.m_dlcManager.getSkinFile(packet->textureName); + gameServices().getDLCSkinFile(packet->textureName); if (dwBytes != 0) { if (pDLCSkinFile) { @@ -2319,12 +2321,12 @@ void ClientConnection::handleTextureAndGeometry( } } else { unsigned int uiAnimOverrideBitmask = - app.GetAnimOverrideBitmask(packet->dwSkinID); + gameServices().getAnimOverrideBitmask(packet->dwSkinID); send(std::shared_ptr( new TextureAndGeometryPacket( packet->textureName, pbData, dwBytes, - app.GetAdditionalSkinBoxes(packet->dwSkinID), + gameServices().getAdditionalSkinBoxes(packet->dwSkinID), uiAnimOverrideBitmask))); } } @@ -2335,15 +2337,15 @@ void ClientConnection::handleTextureAndGeometry( packet->textureName.c_str()); #endif // Add the texture data - app.AddMemoryTextureFile(packet->textureName, packet->pbData, + gameServices().addMemoryTextureFile(packet->textureName, packet->pbData, packet->dwTextureBytes); // Add the geometry data if (packet->dwBoxC != 0) { - app.SetAdditionalSkinBoxes(packet->dwSkinID, packet->BoxDataA, + gameServices().setAdditionalSkinBoxes(packet->dwSkinID, packet->BoxDataA, packet->dwBoxC); } // Add the anim override - app.SetAnimOverrideBitmask(packet->dwSkinID, + gameServices().setAnimOverrideBitmask(packet->dwSkinID, packet->uiAnimOverrideBitmask); // clear out the pending texture request @@ -2371,7 +2373,7 @@ void ClientConnection::handleTextureChange( switch (packet->action) { case TextureChangePacket::e_TextureChange_Skin: - player->setCustomSkin(app.getSkinIdFromPath(packet->path)); + player->setCustomSkin(gameServices().getSkinIdFromPath(packet->path)); #if !defined(_CONTENT_PACKAGE) wprintf(L"Skin for remote player %ls has changed to %ls (%d)\n", player->name.c_str(), player->customTextureUrl.c_str(), @@ -2390,7 +2392,7 @@ void ClientConnection::handleTextureChange( if (!packet->path.empty() && packet->path.substr(0, 3).compare(L"def") != 0 && - !app.IsFileInMemoryTextures(packet->path)) { + !gameServices().isFileInMemoryTextures(packet->path)) { if (minecraft->addPendingClientTextureRequest(packet->path)) { #if !defined(_CONTENT_PACKAGE) wprintf( @@ -2402,9 +2404,9 @@ void ClientConnection::handleTextureChange( new TexturePacket(packet->path, nullptr, 0))); } } else if (!packet->path.empty() && - app.IsFileInMemoryTextures(packet->path)) { + gameServices().isFileInMemoryTextures(packet->path)) { // Update the ref count on the memory texture data - app.AddMemoryTextureFile(packet->path, nullptr, 0); + gameServices().addMemoryTextureFile(packet->path, nullptr, 0); } } @@ -2426,7 +2428,7 @@ void ClientConnection::handleTextureAndGeometryChange( } if (isLocalPlayer) return; - player->setCustomSkin(app.getSkinIdFromPath(packet->path)); + player->setCustomSkin(gameServices().getSkinIdFromPath(packet->path)); #if !defined(_CONTENT_PACKAGE) wprintf(L"Skin for remote player %ls has changed to %ls (%d)\n", @@ -2436,7 +2438,7 @@ void ClientConnection::handleTextureAndGeometryChange( if (!packet->path.empty() && packet->path.substr(0, 3).compare(L"def") != 0 && - !app.IsFileInMemoryTextures(packet->path)) { + !gameServices().isFileInMemoryTextures(packet->path)) { if (minecraft->addPendingClientTextureRequest(packet->path)) { #if !defined(_CONTENT_PACKAGE) wprintf( @@ -2449,9 +2451,9 @@ void ClientConnection::handleTextureAndGeometryChange( new TextureAndGeometryPacket(packet->path, nullptr, 0))); } } else if (!packet->path.empty() && - app.IsFileInMemoryTextures(packet->path)) { + gameServices().isFileInMemoryTextures(packet->path)) { // Update the ref count on the memory texture data - app.AddMemoryTextureFile(packet->path, nullptr, 0); + gameServices().addMemoryTextureFile(packet->path, nullptr, 0); } } @@ -2489,7 +2491,7 @@ void ClientConnection::handleRespawn(std::shared_ptr packet) { dimensionLevel->savedDataStorage = level->savedDataStorage; dimensionLevel->difficulty = packet->difficulty; // 4J Added - app.DebugPrintf("dimensionLevel->difficulty - Difficulty = %d\n", + Log::info("dimensionLevel->difficulty - Difficulty = %d\n", packet->difficulty); dimensionLevel->isClientSide = true; @@ -2543,13 +2545,13 @@ void ClientConnection::handleRespawn(std::shared_ptr packet) { // with the inventory menu open ui.CloseUIScenes(m_userIndex); - if (app.GetLocalPlayerCount() > 1) { + if (gameServices().getLocalPlayerCount() > 1) { ui.NavigateToScene(m_userIndex, eUIScene_ConnectingProgress, param); } else { ui.NavigateToScene(m_userIndex, eUIScene_ConnectingProgress, param); } - app.SetAction(m_userIndex, eAppAction_WaitForDimensionChangeComplete); + gameServices().setAction(m_userIndex, eAppAction_WaitForDimensionChangeComplete); } // minecraft->respawnPlayer(minecraft->player->GetXboxPad(),true, @@ -2569,7 +2571,7 @@ void ClientConnection::handleRespawn(std::shared_ptr packet) { void ClientConnection::handleExplosion(std::shared_ptr packet) { if (!packet->m_bKnockbackOnly) { - // app.DebugPrintf("Received ExplodePacket with explosion data\n"); + // Log::info("Received ExplodePacket with explosion data\n"); Explosion* e = new Explosion(minecraft->level, nullptr, packet->x, packet->y, packet->z, packet->r); @@ -2588,10 +2590,10 @@ void ClientConnection::handleExplosion(std::shared_ptr packet) { delete e; } else { - // app.DebugPrintf("Received ExplodePacket with knockback only data\n"); + // Log::info("Received ExplodePacket with knockback only data\n"); } - // app.DebugPrintf("Adding knockback (%f,%f,%f) for player %d\n", + // Log::info("Adding knockback (%f,%f,%f) for player %d\n", // packet->getKnockbackX(), packet->getKnockbackY(), // packet->getKnockbackZ(), m_userIndex); minecraft->localplayers[m_userIndex]->xd += packet->getKnockbackX(); @@ -2875,7 +2877,7 @@ void ClientConnection::handleTileEditorOpen( void ClientConnection::handleSignUpdate( std::shared_ptr packet) { - app.DebugPrintf("ClientConnection::handleSignUpdate - "); + Log::info("ClientConnection::handleSignUpdate - "); if (minecraft->level->hasChunkAt(packet->x, packet->y, packet->z)) { std::shared_ptr te = minecraft->level->getTileEntity(packet->x, packet->y, packet->z); @@ -2888,18 +2890,18 @@ void ClientConnection::handleSignUpdate( ste->SetMessage(i, packet->lines[i]); } - app.DebugPrintf("verified = %d\tCensored = %d\n", + Log::info("verified = %d\tCensored = %d\n", packet->m_bVerified, packet->m_bCensored); ste->SetVerified(packet->m_bVerified); ste->SetCensored(packet->m_bCensored); ste->setChanged(); } else { - app.DebugPrintf( + Log::info( "std::dynamic_pointer_cast(te) == nullptr\n"); } } else { - app.DebugPrintf("hasChunkAt failed\n"); + Log::info("hasChunkAt failed\n"); } } @@ -3004,7 +3006,7 @@ void ClientConnection::handleGameEvent( } else if (event == GameEventPacket::WIN_GAME) { ui.SetWinUserIndex(static_cast(gameEventPacket->param)); - app.DebugPrintf("handleGameEvent packet for WIN_GAME - %d\n", + Log::info("handleGameEvent packet for WIN_GAME - %d\n", m_userIndex); // This just allows it to be shown if (minecraft->localgameModes[InputManager.GetPrimaryPad()] != nullptr) @@ -3018,12 +3020,12 @@ void ClientConnection::handleGameEvent( // Move app started to here so that it happens immediately otherwise // back-to-back START/STOP packets leave the client stuck in the // loading screen - app.SetGameStarted(false); - app.SetAction(InputManager.GetPrimaryPad(), + gameServices().setGameStarted(false); + gameServices().setAction(InputManager.GetPrimaryPad(), eAppAction_RemoteServerSave); } } else if (event == GameEventPacket::STOP_SAVING) { - if (!g_NetworkManager.IsHost()) app.SetGameStarted(true); + if (!g_NetworkManager.IsHost()) gameServices().setGameStarted(true); } else if (event == GameEventPacket::SUCCESSFUL_BOW_HIT) { std::shared_ptr player = minecraft->localplayers[m_userIndex]; @@ -3106,7 +3108,7 @@ bool ClientConnection::isServerPacketListener() { return false; } void ClientConnection::handlePlayerInfo( std::shared_ptr packet) { unsigned int startingPrivileges = - app.GetPlayerPrivileges(packet->m_networkSmallId); + gameServices().getPlayerPrivileges(packet->m_networkSmallId); INetworkPlayer* networkPlayer = g_NetworkManager.GetPlayerBySmallId(packet->m_networkSmallId); @@ -3119,7 +3121,7 @@ void ClientConnection::handlePlayerInfo( } // 4J Stu - Repurposed this packet for player info that we want - app.UpdatePlayerInfo(packet->m_networkSmallId, packet->m_playerColourIndex, + gameServices().updatePlayerInfo(packet->m_networkSmallId, packet->m_playerColourIndex, packet->m_playerPrivileges); std::shared_ptr entity = getEntity(packet->m_entityId); @@ -3161,58 +3163,58 @@ void ClientConnection::displayPrivilegeChanges( Player::getPlayerGamePrivilege(oldPrivileges, priv)) { privOn = Player::getPlayerGamePrivilege(newPrivileges, priv); std::wstring message = L""; - if (app.GetGameHostOption(eGameHostOption_TrustPlayers) == 0) { + if (gameServices().getGameHostOption(eGameHostOption_TrustPlayers) == 0) { switch (priv) { case Player::ePlayerGamePrivilege_CannotMine: if (privOn) - message = app.GetString(IDS_PRIV_MINE_TOGGLE_ON); + message = gameServices().getString(IDS_PRIV_MINE_TOGGLE_ON); else - message = app.GetString(IDS_PRIV_MINE_TOGGLE_OFF); + message = gameServices().getString(IDS_PRIV_MINE_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_CannotBuild: if (privOn) - message = app.GetString(IDS_PRIV_BUILD_TOGGLE_ON); + message = gameServices().getString(IDS_PRIV_BUILD_TOGGLE_ON); else - message = app.GetString(IDS_PRIV_BUILD_TOGGLE_OFF); + message = gameServices().getString(IDS_PRIV_BUILD_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_CanUseDoorsAndSwitches: if (privOn) message = - app.GetString(IDS_PRIV_USE_DOORS_TOGGLE_ON); + gameServices().getString(IDS_PRIV_USE_DOORS_TOGGLE_ON); else message = - app.GetString(IDS_PRIV_USE_DOORS_TOGGLE_OFF); + gameServices().getString(IDS_PRIV_USE_DOORS_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_CanUseContainers: if (privOn) - message = app.GetString( + message = gameServices().getString( IDS_PRIV_USE_CONTAINERS_TOGGLE_ON); else - message = app.GetString( + message = gameServices().getString( IDS_PRIV_USE_CONTAINERS_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_CannotAttackAnimals: if (privOn) message = - app.GetString(IDS_PRIV_ATTACK_ANIMAL_TOGGLE_ON); + gameServices().getString(IDS_PRIV_ATTACK_ANIMAL_TOGGLE_ON); else - message = app.GetString( + message = gameServices().getString( IDS_PRIV_ATTACK_ANIMAL_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_CannotAttackMobs: if (privOn) message = - app.GetString(IDS_PRIV_ATTACK_MOB_TOGGLE_ON); + gameServices().getString(IDS_PRIV_ATTACK_MOB_TOGGLE_ON); else message = - app.GetString(IDS_PRIV_ATTACK_MOB_TOGGLE_OFF); + gameServices().getString(IDS_PRIV_ATTACK_MOB_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_CannotAttackPlayers: if (privOn) message = - app.GetString(IDS_PRIV_ATTACK_PLAYER_TOGGLE_ON); + gameServices().getString(IDS_PRIV_ATTACK_PLAYER_TOGGLE_ON); else - message = app.GetString( + message = gameServices().getString( IDS_PRIV_ATTACK_PLAYER_TOGGLE_OFF); break; default: @@ -3222,75 +3224,75 @@ void ClientConnection::displayPrivilegeChanges( switch (priv) { case Player::ePlayerGamePrivilege_Op: if (privOn) - message = app.GetString(IDS_PRIV_MODERATOR_TOGGLE_ON); + message = gameServices().getString(IDS_PRIV_MODERATOR_TOGGLE_ON); else - message = app.GetString(IDS_PRIV_MODERATOR_TOGGLE_OFF); + message = gameServices().getString(IDS_PRIV_MODERATOR_TOGGLE_OFF); break; default: break; }; - if (app.GetGameHostOption(eGameHostOption_CheatsEnabled) != 0) { + if (gameServices().getGameHostOption(eGameHostOption_CheatsEnabled) != 0) { switch (priv) { case Player::ePlayerGamePrivilege_CanFly: if (privOn) - message = app.GetString(IDS_PRIV_FLY_TOGGLE_ON); + message = gameServices().getString(IDS_PRIV_FLY_TOGGLE_ON); else - message = app.GetString(IDS_PRIV_FLY_TOGGLE_OFF); + message = gameServices().getString(IDS_PRIV_FLY_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_ClassicHunger: if (privOn) message = - app.GetString(IDS_PRIV_EXHAUSTION_TOGGLE_ON); + gameServices().getString(IDS_PRIV_EXHAUSTION_TOGGLE_ON); else message = - app.GetString(IDS_PRIV_EXHAUSTION_TOGGLE_OFF); + gameServices().getString(IDS_PRIV_EXHAUSTION_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_Invisible: if (privOn) message = - app.GetString(IDS_PRIV_INVISIBLE_TOGGLE_ON); + gameServices().getString(IDS_PRIV_INVISIBLE_TOGGLE_ON); else message = - app.GetString(IDS_PRIV_INVISIBLE_TOGGLE_OFF); + gameServices().getString(IDS_PRIV_INVISIBLE_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_Invulnerable: if (privOn) message = - app.GetString(IDS_PRIV_INVULNERABLE_TOGGLE_ON); + gameServices().getString(IDS_PRIV_INVULNERABLE_TOGGLE_ON); else message = - app.GetString(IDS_PRIV_INVULNERABLE_TOGGLE_OFF); + gameServices().getString(IDS_PRIV_INVULNERABLE_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_CanToggleInvisible: if (privOn) message = - app.GetString(IDS_PRIV_CAN_INVISIBLE_TOGGLE_ON); + gameServices().getString(IDS_PRIV_CAN_INVISIBLE_TOGGLE_ON); else - message = app.GetString( + message = gameServices().getString( IDS_PRIV_CAN_INVISIBLE_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_CanToggleFly: if (privOn) - message = app.GetString(IDS_PRIV_CAN_FLY_TOGGLE_ON); + message = gameServices().getString(IDS_PRIV_CAN_FLY_TOGGLE_ON); else message = - app.GetString(IDS_PRIV_CAN_FLY_TOGGLE_OFF); + gameServices().getString(IDS_PRIV_CAN_FLY_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_CanToggleClassicHunger: if (privOn) - message = app.GetString( + message = gameServices().getString( IDS_PRIV_CAN_EXHAUSTION_TOGGLE_ON); else - message = app.GetString( + message = gameServices().getString( IDS_PRIV_CAN_EXHAUSTION_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_CanTeleport: if (privOn) message = - app.GetString(IDS_PRIV_CAN_TELEPORT_TOGGLE_ON); + gameServices().getString(IDS_PRIV_CAN_TELEPORT_TOGGLE_ON); else message = - app.GetString(IDS_PRIV_CAN_TELEPORT_TOGGLE_OFF); + gameServices().getString(IDS_PRIV_CAN_TELEPORT_TOGGLE_OFF); break; default: break; @@ -3365,11 +3367,11 @@ Connection* ClientConnection::getConnection() { return connection; } void ClientConnection::handleServerSettingsChanged( std::shared_ptr packet) { if (packet->action == ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS) { - app.SetGameHostOption(eGameHostOption_All, packet->data); + gameServices().setGameHostOption(eGameHostOption_All, packet->data); } else if (packet->action == ServerSettingsChangedPacket::HOST_DIFFICULTY) { for (unsigned int i = 0; i < minecraft->levels.size(); ++i) { if (minecraft->levels[i] != nullptr) { - app.DebugPrintf( + Log::info( "ClientConnection::handleServerSettingsChanged - " "Difficulty = %d", packet->data); @@ -3379,7 +3381,7 @@ void ClientConnection::handleServerSettingsChanged( } else { // options // minecraft->options->SetGamertagSetting((packet->data==0)?false:true); - app.SetGameHostOption(eGameHostOption_Gamertags, packet->data); + gameServices().setGameHostOption(eGameHostOption_Gamertags, packet->data); } } @@ -3400,7 +3402,7 @@ void ClientConnection::handleUpdateProgress( void ClientConnection::handleUpdateGameRuleProgressPacket( std::shared_ptr packet) { - const wchar_t* string = app.GetGameRulesString(packet->m_messageId); + const wchar_t* string = gameServices().getGameRulesString(packet->m_messageId); if (string != nullptr) { std::wstring message(string); message = GameRuleDefinition::generateDescriptionString( @@ -3414,10 +3416,10 @@ void ClientConnection::handleUpdateGameRuleProgressPacket( // If this rule has a data tag associated with it, then we save that in user // profile data if (packet->m_dataTag > 0 && packet->m_dataTag <= 32) { - app.DebugPrintf( + Log::info( "handleUpdateGameRuleProgressPacket: Data tag is in range, so " "updating profile data\n"); - app.SetSpecialTutorialCompletionFlag(m_userIndex, + gameServices().setSpecialTutorialCompletionFlag(m_userIndex, packet->m_dataTag - 1); } } @@ -3439,7 +3441,7 @@ int ClientConnection::HostDisconnectReturned( // no upsell, we're about to quit MinecraftServer::getInstance()->setSaveOnExit(false); // flag a app action of exit game - app.SetAction(iPad, eAppAction_ExitWorld); + gameServices().setAction(iPad, eAppAction_ExitWorld); } } @@ -3460,7 +3462,7 @@ int ClientConnection::HostDisconnectReturned( } else { MinecraftServer::getInstance()->setSaveOnExit(true); // flag a app action of exit game - app.SetAction(iPad, eAppAction_ExitWorld); + gameServices().setAction(iPad, eAppAction_ExitWorld); } return 0; @@ -3480,7 +3482,7 @@ int ClientConnection::ExitGameAndSaveReturned( MinecraftServer::getInstance()->setSaveOnExit(false); } // flag a app action of exit game - app.SetAction(iPad, eAppAction_ExitWorld); + gameServices().setAction(iPad, eAppAction_ExitWorld); return 0; } diff --git a/targets/minecraft/client/multiplayer/MultiPlayerChunkCache.cpp b/targets/minecraft/client/multiplayer/MultiPlayerChunkCache.cpp index cb6d44fa5..7e1802a17 100644 --- a/targets/minecraft/client/multiplayer/MultiPlayerChunkCache.cpp +++ b/targets/minecraft/client/multiplayer/MultiPlayerChunkCache.cpp @@ -3,7 +3,7 @@ #include #include -#include "app/common/src/Network/GameNetworkManager.h" +#include "app/common/Network/GameNetworkManager.h" #include "app/linux/Stubs/winapi_stubs.h" #include "util/StringHelpers.h" #include "minecraft/server/MinecraftServer.h" diff --git a/targets/minecraft/client/multiplayer/MultiPlayerGameMode.cpp b/targets/minecraft/client/multiplayer/MultiPlayerGameMode.cpp index 33fc83836..906a106d7 100644 --- a/targets/minecraft/client/multiplayer/MultiPlayerGameMode.cpp +++ b/targets/minecraft/client/multiplayer/MultiPlayerGameMode.cpp @@ -1,9 +1,10 @@ +#include "minecraft/IGameServices.h" #include "MultiPlayerGameMode.h" #include #include "ClientConnection.h" -#include "app/common/src/Audio/SoundEngine.h" +#include "app/common/Audio/SoundEngine.h" #include "MultiPlayerLevel.h" #include "java/Class.h" #include "minecraft/client/Minecraft.h" @@ -149,8 +150,8 @@ void MultiPlayerGameMode::startDestroyBlock(int x, int y, int z, int face) { if (t > 0 && (Tile::tiles[t]->getDestroyProgress( minecraft->player, minecraft->player->level, x, y, z) >= 1 - // ||(app.DebugSettingsOn() && - // app.GetGameSettingsDebugMask(InputManager.GetPrimaryPad())&(1L< @@ -12,9 +13,9 @@ #include "platform/PlatformTypes.h" #include "platform/sdl2/Input.h" #include "ClientConnection.h" -#include "app/common/src/Audio/SoundEngine.h" -#include "app/common/src/Console_Debug_enum.h" -#include "app/common/src/Network/GameNetworkManager.h" +#include "app/common/Audio/SoundEngine.h" +#include "app/common/Console_Debug_enum.h" +#include "app/common/Network/GameNetworkManager.h" #include "app/linux/LinuxGame.h" #include "MultiPlayerChunkCache.h" #include "MultiPlayerLocalPlayer.h" @@ -121,8 +122,8 @@ void MultiPlayerLevel::tick() { // 4J: Debug setting added to keep it at day time #if !defined(_FINAL_BUILD) bool freezeTime = - app.DebugSettingsOn() && - app.GetGameSettingsDebugMask(InputManager.GetPrimaryPad()) & + gameServices().debugSettingsOn() && + gameServices().debugGetMask(InputManager.GetPrimaryPad()) & (1L << eDebugSetting_FreezeTime); if (!freezeTime) #endif diff --git a/targets/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp b/targets/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp index 0bbf3b91a..dcdbfa22d 100644 --- a/targets/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp +++ b/targets/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp @@ -1,3 +1,5 @@ +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "MultiPlayerLocalPlayer.h" #include @@ -5,9 +7,9 @@ #include #include "ClientConnection.h" -#include "app/common/src/Tutorial/Tutorial.h" -#include "app/common/src/Tutorial/TutorialEnum.h" -#include "app/common/src/Tutorial/TutorialMode.h" +#include "app/common/Tutorial/Tutorial.h" +#include "app/common/Tutorial/TutorialEnum.h" +#include "app/common/Tutorial/TutorialMode.h" #include "app/linux/LinuxGame.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" @@ -72,11 +74,11 @@ void MultiplayerLocalPlayer::tick() { // bool bIsisPrimaryHost=g_NetworkManager.IsHost() && // (InputManager.GetPrimaryPad()==m_iPad); - /*if((app.GetGameSettings(m_iPad,eGameSetting_PlayerVisibleInMap)!=0) != + /*if((gameServices().getGameSettings(m_iPad,eGameSetting_PlayerVisibleInMap)!=0) != m_bShownOnMaps) { m_bShownOnMaps = - (app.GetGameSettings(m_iPad,eGameSetting_PlayerVisibleInMap)!=0); if + (gameServices().getGameSettings(m_iPad,eGameSetting_PlayerVisibleInMap)!=0); if (m_bShownOnMaps) connection->send( std::shared_ptr( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::SHOW_ON_MAPS) ) ); else connection->send( std::shared_ptr( new @@ -377,7 +379,7 @@ void MultiplayerLocalPlayer::setAndBroadcastCustomSkin(std::uint32_t skinId) { if (getCustomSkin() != oldSkinIndex) connection->send(std::shared_ptr( new TextureAndGeometryChangePacket( - shared_from_this(), app.GetPlayerSkinName(GetXboxPad())))); + shared_from_this(), gameServices().getPlayerSkinName(GetXboxPad())))); } void MultiplayerLocalPlayer::setAndBroadcastCustomCape(std::uint32_t capeId) { @@ -390,7 +392,7 @@ void MultiplayerLocalPlayer::setAndBroadcastCustomCape(std::uint32_t capeId) { if (getCustomCape() != oldCapeIndex) connection->send(std::make_shared( shared_from_this(), TextureChangePacket::e_TextureChange_Cape, - app.GetPlayerCapeName(GetXboxPad()))); + gameServices().getPlayerCapeName(GetXboxPad()))); } // 4J added for testing. This moves the player in a repeated sequence of 2 @@ -419,7 +421,7 @@ void MultiplayerLocalPlayer::StressTestMove(double* tempX, double* tempY, /* if( faultFound ) { - app.DebugPrintf("Fault found\n"); + Log::info("Fault found\n"); stressTestEnabled = false; } */ diff --git a/targets/minecraft/client/particle/DragonBreathParticle.cpp b/targets/minecraft/client/particle/DragonBreathParticle.cpp index acce371c6..95fb45e85 100644 --- a/targets/minecraft/client/particle/DragonBreathParticle.cpp +++ b/targets/minecraft/client/particle/DragonBreathParticle.cpp @@ -1,7 +1,7 @@ #include "DragonBreathParticle.h" -#include "app/common/App_enums.h" -#include "app/common/src/Colours/ColourTable.h" +#include "minecraft/GameEnums.h" +#include "app/common/Colours/ColourTable.h" #include "java/JavaMath.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/particle/Particle.h" diff --git a/targets/minecraft/client/particle/DripParticle.cpp b/targets/minecraft/client/particle/DripParticle.cpp index 03ca1196d..a91826588 100644 --- a/targets/minecraft/client/particle/DripParticle.cpp +++ b/targets/minecraft/client/particle/DripParticle.cpp @@ -2,8 +2,8 @@ #include -#include "app/common/App_enums.h" -#include "app/common/src/Colours/ColourTable.h" +#include "minecraft/GameEnums.h" +#include "app/common/Colours/ColourTable.h" #include "java/JavaMath.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/particle/Particle.h" diff --git a/targets/minecraft/client/particle/EnchantmentTableParticle.cpp b/targets/minecraft/client/particle/EnchantmentTableParticle.cpp index ef886bb78..5f1fc3a4c 100644 --- a/targets/minecraft/client/particle/EnchantmentTableParticle.cpp +++ b/targets/minecraft/client/particle/EnchantmentTableParticle.cpp @@ -1,7 +1,7 @@ #include "EnchantmentTableParticle.h" -#include "app/common/App_enums.h" -#include "app/common/src/Colours/ColourTable.h" +#include "minecraft/GameEnums.h" +#include "app/common/Colours/ColourTable.h" #include "java/JavaMath.h" #include "java/Random.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/minecraft/client/particle/EnderParticle.cpp b/targets/minecraft/client/particle/EnderParticle.cpp index 5e4d40d12..09b440886 100644 --- a/targets/minecraft/client/particle/EnderParticle.cpp +++ b/targets/minecraft/client/particle/EnderParticle.cpp @@ -1,7 +1,7 @@ #include "EnderParticle.h" -#include "app/common/App_enums.h" -#include "app/common/src/Colours/ColourTable.h" +#include "minecraft/GameEnums.h" +#include "app/common/Colours/ColourTable.h" #include "java/JavaMath.h" #include "java/Random.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/minecraft/client/particle/ExplodeParticle.cpp b/targets/minecraft/client/particle/ExplodeParticle.cpp index 9a8cf6f55..497e50880 100644 --- a/targets/minecraft/client/particle/ExplodeParticle.cpp +++ b/targets/minecraft/client/particle/ExplodeParticle.cpp @@ -1,7 +1,7 @@ #include "ExplodeParticle.h" -#include "app/common/App_enums.h" -#include "app/common/src/Colours/ColourTable.h" +#include "minecraft/GameEnums.h" +#include "app/common/Colours/ColourTable.h" #include "java/JavaMath.h" #include "java/Random.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/minecraft/client/particle/HugeExplosionParticle.cpp b/targets/minecraft/client/particle/HugeExplosionParticle.cpp index 428de1d37..8ee5059e0 100644 --- a/targets/minecraft/client/particle/HugeExplosionParticle.cpp +++ b/targets/minecraft/client/particle/HugeExplosionParticle.cpp @@ -3,8 +3,8 @@ #include #include "platform/sdl2/Render.h" -#include "app/common/App_enums.h" -#include "app/common/src/Colours/ColourTable.h" +#include "minecraft/GameEnums.h" +#include "app/common/Colours/ColourTable.h" #include "java/Random.h" #include "minecraft/client/Lighting.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/minecraft/client/particle/NetherPortalParticle.cpp b/targets/minecraft/client/particle/NetherPortalParticle.cpp index 059ea537f..2f74cf654 100644 --- a/targets/minecraft/client/particle/NetherPortalParticle.cpp +++ b/targets/minecraft/client/particle/NetherPortalParticle.cpp @@ -1,7 +1,7 @@ #include "NetherPortalParticle.h" -#include "app/common/App_enums.h" -#include "app/common/src/Colours/ColourTable.h" +#include "minecraft/GameEnums.h" +#include "app/common/Colours/ColourTable.h" #include "java/JavaMath.h" #include "java/Random.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/minecraft/client/particle/NoteParticle.cpp b/targets/minecraft/client/particle/NoteParticle.cpp index d047f1f4e..e9544152e 100644 --- a/targets/minecraft/client/particle/NoteParticle.cpp +++ b/targets/minecraft/client/particle/NoteParticle.cpp @@ -2,8 +2,8 @@ #include -#include "app/common/App_enums.h" -#include "app/common/src/Colours/ColourTable.h" +#include "minecraft/GameEnums.h" +#include "app/common/Colours/ColourTable.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/particle/Particle.h" diff --git a/targets/minecraft/client/particle/SmokeParticle.cpp b/targets/minecraft/client/particle/SmokeParticle.cpp index 185f94fb5..a4cd52689 100644 --- a/targets/minecraft/client/particle/SmokeParticle.cpp +++ b/targets/minecraft/client/particle/SmokeParticle.cpp @@ -1,7 +1,7 @@ #include "SmokeParticle.h" -#include "app/common/App_enums.h" -#include "app/common/src/Colours/ColourTable.h" +#include "minecraft/GameEnums.h" +#include "app/common/Colours/ColourTable.h" #include "java/JavaMath.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/particle/Particle.h" diff --git a/targets/minecraft/client/particle/SuspendedParticle.cpp b/targets/minecraft/client/particle/SuspendedParticle.cpp index 9d284581b..2251c52ab 100644 --- a/targets/minecraft/client/particle/SuspendedParticle.cpp +++ b/targets/minecraft/client/particle/SuspendedParticle.cpp @@ -2,8 +2,8 @@ #include -#include "app/common/App_enums.h" -#include "app/common/src/Colours/ColourTable.h" +#include "minecraft/GameEnums.h" +#include "app/common/Colours/ColourTable.h" #include "java/JavaMath.h" #include "java/Random.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/minecraft/client/player/Input.cpp b/targets/minecraft/client/player/Input.cpp index fd231d699..d41178e7c 100644 --- a/targets/minecraft/client/player/Input.cpp +++ b/targets/minecraft/client/player/Input.cpp @@ -1,3 +1,4 @@ +#include "minecraft/IGameServices.h" #include "Input.h" #include @@ -5,7 +6,7 @@ #include "platform/InputActions.h" #include "platform/sdl2/Input.h" #include "LocalPlayer.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/linux/LinuxGame.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" @@ -50,7 +51,7 @@ void Input::tick(LocalPlayer* player) { ya = 0.0f; #ifndef _CONTENT_PACKAGE - if (app.GetFreezePlayers()) { + if (gameServices().debugFreezePlayers()) { xa = ya = 0.0f; player->abilities.flying = true; } @@ -87,7 +88,7 @@ void Input::tick(LocalPlayer* player) { pMinecraft->localgameModes[iPad]->isInputAllowed( MINECRAFT_ACTION_LOOK_RIGHT)) tx = InputManager.GetJoypadStick_RX(iPad) * - (((float)app.GetGameSettings(iPad, + (((float)gameServices().getGameSettings(iPad, eGameSetting_Sensitivity_InGame)) / 100.0f); // apply sensitivity to look if (pMinecraft->localgameModes[iPad]->isInputAllowed( @@ -95,16 +96,16 @@ void Input::tick(LocalPlayer* player) { pMinecraft->localgameModes[iPad]->isInputAllowed( MINECRAFT_ACTION_LOOK_DOWN)) ty = InputManager.GetJoypadStick_RY(iPad) * - (((float)app.GetGameSettings(iPad, + (((float)gameServices().getGameSettings(iPad, eGameSetting_Sensitivity_InGame)) / 100.0f); // apply sensitivity to look #ifndef _CONTENT_PACKAGE - if (app.GetFreezePlayers()) tx = ty = 0.0f; + if (gameServices().debugFreezePlayers()) tx = ty = 0.0f; #endif // 4J: WESTY : Invert look Y if required. - if (app.GetGameSettings(iPad, eGameSetting_ControlInvertLook)) { + if (gameServices().getGameSettings(iPad, eGameSetting_ControlInvertLook)) { ty = -ty; } @@ -127,7 +128,7 @@ void Input::tick(LocalPlayer* player) { pMinecraft->localgameModes[iPad]->isInputAllowed(MINECRAFT_ACTION_JUMP); #ifndef _CONTENT_PACKAGE - if (app.GetFreezePlayers()) jumping = false; + if (gameServices().debugFreezePlayers()) jumping = false; #endif // OutputDebugString("INPUT: End input tick\n"); diff --git a/targets/minecraft/client/player/LocalPlayer.cpp b/targets/minecraft/client/player/LocalPlayer.cpp index fff0a7612..ff2fb41d1 100644 --- a/targets/minecraft/client/player/LocalPlayer.cpp +++ b/targets/minecraft/client/player/LocalPlayer.cpp @@ -1,3 +1,6 @@ +#include "minecraft/client/IMenuService.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "LocalPlayer.h" #include @@ -30,12 +33,11 @@ #include "platform/sdl2/Profile.h" #include "platform/sdl2/Render.h" #include "app/common/App_structs.h" -#include "app/common/src/Audio/SoundEngine.h" -#include "app/common/src/Network/GameNetworkManager.h" -#include "app/common/src/Tutorial/Tutorial.h" -#include "app/common/src/Tutorial/TutorialMode.h" -#include "app/common/src/UI/All Platforms/UIEnums.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Audio/SoundEngine.h" +#include "app/common/Network/GameNetworkManager.h" +#include "app/common/Tutorial/Tutorial.h" +#include "app/common/Tutorial/TutorialMode.h" +#include "app/common/UI/All Platforms/UIEnums.h" #include "app/linux/Linux_UIController.h" #include "app/linux/Stubs/winapi_stubs.h" #include "PlatformTypes.h" @@ -115,7 +117,7 @@ LocalPlayer::LocalPlayer(Minecraft* minecraft, Level* level, User* user, this->name = user->name; // wprintf(L"Created LocalPlayer with name %ls\n", name.c_str() ); // check to see if this player's xuid is in the list of special players - MOJANG_DATA* pMojangData = app.GetMojangDataForXuid(getOnlineXuid()); + MOJANG_DATA* pMojangData = gameServices().getMojangDataForXuid(getOnlineXuid()); if (pMojangData) { customTextureUrl = pMojangData->wchSkin; } @@ -519,7 +521,7 @@ void LocalPlayer::changeDimension(int i) { awardStat(GenericStats::winGame(), GenericStats::param_noArgs()); // minecraft.setScreen(new WinScreen()); #if !defined(_CONTENT_PACKAGE) - app.DebugPrintf( + Log::info( "LocalPlayer::changeDimension from 1 to 1 but WinScreen has " "not been implemented.\n"); __debugbreak(); @@ -590,11 +592,11 @@ void LocalPlayer::openTextEdit(std::shared_ptr tileEntity) { bool success; if (tileEntity->GetType() == eTYPE_SIGNTILEENTITY) { - success = app.LoadSignEntryMenu( + success = gameServices().menus().openSign( GetXboxPad(), std::dynamic_pointer_cast(tileEntity)); } else if (tileEntity->GetType() == eTYPE_COMMANDBLOCKTILEENTITY) { - success = app.LoadCommandBlockMenu( + success = gameServices().menus().openCommandBlock( GetXboxPad(), std::dynamic_pointer_cast(tileEntity)); } @@ -608,7 +610,7 @@ bool LocalPlayer::openContainer(std::shared_ptr container) { minecraft->setScreen(new ContainerScreen(inventory, container)); bool success = true; #else - bool success = app.LoadContainerMenu(GetXboxPad(), inventory, container); + bool success = gameServices().menus().openContainer(GetXboxPad(), inventory, container); if (success) ui.PlayUISFX(eSFX_Press); #endif // minecraft->setScreen(new ContainerScreen(inventory, container)); @@ -620,7 +622,7 @@ bool LocalPlayer::openHopper(std::shared_ptr container) { minecraft->setScreen(new HopperScreen(inventory, container)); bool success = true; #else - bool success = app.LoadHopperMenu(GetXboxPad(), inventory, container); + bool success = gameServices().menus().openHopper(GetXboxPad(), inventory, container); if (success) ui.PlayUISFX(eSFX_Press); #endif return success; @@ -631,7 +633,7 @@ bool LocalPlayer::openHopper(std::shared_ptr container) { minecraft->setScreen(new HopperScreen(inventory, container)); bool success = true; #else - bool success = app.LoadHopperMenu(GetXboxPad(), inventory, container); + bool success = gameServices().menus().openHopperMinecart(GetXboxPad(), inventory, container); if (success) ui.PlayUISFX(eSFX_Press); #endif return success; @@ -643,7 +645,7 @@ bool LocalPlayer::openHorseInventory(std::shared_ptr horse, minecraft->setScreen(new HorseInventoryScreen(inventory, container, horse)); bool success = true; #else - bool success = app.LoadHorseMenu(GetXboxPad(), inventory, container, horse); + bool success = gameServices().menus().openHorse(GetXboxPad(), inventory, container, horse); if (success) ui.PlayUISFX(eSFX_Press); #endif return success; @@ -654,7 +656,7 @@ bool LocalPlayer::startCrafting(int x, int y, int z) { minecraft->setScreen(new CraftingScreen(inventory, level, x, y, z)); bool success = true; #else - bool success = app.LoadCrafting3x3Menu( + bool success = gameServices().menus().openCrafting3x3( GetXboxPad(), std::dynamic_pointer_cast(shared_from_this()), x, y, z); if (success) ui.PlayUISFX(eSFX_Press); @@ -665,7 +667,7 @@ bool LocalPlayer::startCrafting(int x, int y, int z) { } bool LocalPlayer::openFireworks(int x, int y, int z) { - bool success = app.LoadFireworksMenu( + bool success = gameServices().menus().openFireworks( GetXboxPad(), std::dynamic_pointer_cast(shared_from_this()), x, y, z); if (success) ui.PlayUISFX(eSFX_Press); @@ -679,7 +681,7 @@ bool LocalPlayer::startEnchanting(int x, int y, int z, bool success = true; #else bool success = - app.LoadEnchantingMenu(GetXboxPad(), inventory, x, y, z, level, name); + gameServices().menus().openEnchanting(GetXboxPad(), inventory, x, y, z, level, name); if (success) ui.PlayUISFX(eSFX_Press); #endif return success; @@ -691,7 +693,7 @@ bool LocalPlayer::startRepairing(int x, int y, int z) { bool success = true; #else bool success = - app.LoadRepairingMenu(GetXboxPad(), inventory, level, x, y, z); + gameServices().menus().openRepairing(GetXboxPad(), inventory, level, x, y, z); if (success) ui.PlayUISFX(eSFX_Press); #endif return success; @@ -702,7 +704,7 @@ bool LocalPlayer::openFurnace(std::shared_ptr furnace) { minecraft->setScreen(new FurnaceScreen(inventory, furnace)); bool success = true; #else - bool success = app.LoadFurnaceMenu(GetXboxPad(), inventory, furnace); + bool success = gameServices().menus().openFurnace(GetXboxPad(), inventory, furnace); if (success) ui.PlayUISFX(eSFX_Press); #endif return success; @@ -715,7 +717,7 @@ bool LocalPlayer::openBrewingStand( bool success = true; #else bool success = - app.LoadBrewingStandMenu(GetXboxPad(), inventory, brewingStand); + gameServices().menus().openBrewingStand(GetXboxPad(), inventory, brewingStand); if (success) ui.PlayUISFX(eSFX_Press); #endif return success; @@ -726,7 +728,7 @@ bool LocalPlayer::openBeacon(std::shared_ptr beacon) { minecraft->setScreen(new BeaconScreen(inventory, beacon)); bool success = true; #else - bool success = app.LoadBeaconMenu(GetXboxPad(), inventory, beacon); + bool success = gameServices().menus().openBeacon(GetXboxPad(), inventory, beacon); if (success) ui.PlayUISFX(eSFX_Press); #endif return success; @@ -737,7 +739,7 @@ bool LocalPlayer::openTrap(std::shared_ptr trap) { minecraft->setScreen(new TrapScreen(inventory, trap)); bool success = true; #else - bool success = app.LoadTrapMenu(GetXboxPad(), inventory, trap); + bool success = gameServices().menus().openTrap(GetXboxPad(), inventory, trap); if (success) ui.PlayUISFX(eSFX_Press); #endif return success; @@ -750,7 +752,7 @@ bool LocalPlayer::openTrading(std::shared_ptr traderTarget, bool success = true; #else bool success = - app.LoadTradingMenu(GetXboxPad(), inventory, traderTarget, level, name); + gameServices().menus().openTrading(GetXboxPad(), inventory, traderTarget, level, name); if (success) ui.PlayUISFX(eSFX_Press); #endif return success; @@ -824,7 +826,7 @@ void LocalPlayer::displayClientMessage(int messageId) { void LocalPlayer::awardStat(Stat* stat, const std::vector& param) { int count = CommonStats::readParam(param); - if (!app.CanRecordStatsAndAchievements()) return; + if (!gameServices().canRecordStatsAndAchievements()) return; if (stat == nullptr) return; if (stat->isAchievement()) { @@ -965,7 +967,7 @@ void LocalPlayer::awardStat(Stat* stat, const std::vector& param) { numCookPorkchop = pStats->getTotalValue(cookPorkchop); numEatPorkchop = pStats->getTotalValue(eatPorkchop); - app.DebugPrintf( + Log::info( "[AwardStat] Check unlock 'Porkchop': " "pork_cooked=%i, pork_eaten=%i.\n", numCookPorkchop, numEatPorkchop); @@ -986,7 +988,7 @@ void LocalPlayer::awardStat(Stat* stat, const std::vector& param) { iPlayedTicks = pStats->getTotalValue(timePlayed); iRequiredTicks = Level::TICKS_PER_DAY * 100; - /* app.DebugPrintf( + /* Log::info( "[AwardStat] Check unlock 'Passing the Time': " "total_ticks=%i, req=%i.\n", iPlayedTicks, iRequiredTicks @@ -1011,7 +1013,7 @@ void LocalPlayer::awardStat(Stat* stat, const std::vector& param) { numEmeraldBought = pStats->getTotalValue(emeraldBought); totalSum = numEmeraldMined + numEmeraldBought; - app.DebugPrintf( + Log::info( "[AwardStat] Check unlock 'The Haggler': " "emerald_mined=%i, emerald_bought=%i, sum=%i.\n", numEmeraldMined, numEmeraldBought, totalSum); @@ -1051,7 +1053,7 @@ void LocalPlayer::awardStat(Stat* stat, const std::vector& param) { numPlacedWallSign = pStats->getTotalValue(placeWallsign); numPlacedSignpost = pStats->getTotalValue(placeSignpost); - app.DebugPrintf( + Log::info( "[AwardStat] Check unlock 'It's a Sign': " "crafted=%i, placedWallSigns=%i, placedSignposts=%i.\n", numCraftedSigns, numPlacedWallSign, numPlacedSignpost); @@ -1454,7 +1456,7 @@ bool LocalPlayer::handleMouseClick(int button) { if (button == 0 && missTime > 0) return false; if (button == 0) { - // app.DebugPrintf("handleMouseClick - Player %d is + // Log::info("handleMouseClick - Player %d is // swinging\n",GetXboxPad()); swing(); } @@ -1540,7 +1542,7 @@ bool LocalPlayer::handleMouseClick(int button) { returnItemPlaced = true; } mayUse = false; - // app.DebugPrintf("Player %d is swinging\n",GetXboxPad()); + // Log::info("Player %d is swinging\n",GetXboxPad()); swing(); } if (item == nullptr) { @@ -1574,39 +1576,39 @@ void LocalPlayer::updateRichPresence() { std::shared_ptr selectedItem = inventory->getSelected(); if (selectedItem != nullptr && selectedItem->id == Item::fishingRod_Id) { - app.SetRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_FISHING); + gameServices().setRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_FISHING); } else if (selectedItem != nullptr && selectedItem->id == Item::map_Id) { - app.SetRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_MAP); + gameServices().setRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_MAP); } else if ((riding != nullptr) && riding->instanceof(eTYPE_MINECART)) { - app.SetRichPresenceContext(m_iPad, + gameServices().setRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_RIDING_MINECART); } else if ((riding != nullptr) && riding->instanceof(eTYPE_BOAT)) { - app.SetRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_BOATING); + gameServices().setRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_BOATING); } else if ((riding != nullptr) && riding->instanceof(eTYPE_PIG)) { - app.SetRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_RIDING_PIG); + gameServices().setRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_RIDING_PIG); } else if (this->dimension == -1) { - app.SetRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_NETHER); + gameServices().setRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_NETHER); } else if (minecraft->soundEngine->GetIsPlayingStreamingCDMusic()) { - app.SetRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_CD); + gameServices().setRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_CD); } else { - app.SetRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_BLANK); + gameServices().setRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_BLANK); } } } // 4J Stu - Added for telemetry void LocalPlayer::SetSessionTimerStart(void) { - m_sessionTimeStart = app.getAppTime(); + m_sessionTimeStart = gameServices().getAppTime(); m_dimensionTimeStart = m_sessionTimeStart; } float LocalPlayer::getSessionTimer(void) { - return app.getAppTime() - m_sessionTimeStart; + return gameServices().getAppTime() - m_sessionTimeStart; } float LocalPlayer::getAndResetChangeDimensionTimer() { - float appTime = app.getAppTime(); + float appTime = gameServices().getAppTime(); float returnVal = appTime - m_dimensionTimeStart; m_dimensionTimeStart = appTime; return returnVal; diff --git a/targets/minecraft/client/player/RemotePlayer.cpp b/targets/minecraft/client/player/RemotePlayer.cpp index a48fa4e40..39adc9838 100644 --- a/targets/minecraft/client/player/RemotePlayer.cpp +++ b/targets/minecraft/client/player/RemotePlayer.cpp @@ -1,3 +1,4 @@ +#include "minecraft/util/Log.h" #include "RemotePlayer.h" #include @@ -21,7 +22,7 @@ RemotePlayer::RemotePlayer(Level* level, const std::wstring& name) lx = ly = lz = lyr = lxr = 0.0; fallTime = 0.0f; - app.DebugPrintf("Created RemotePlayer with name %ls\n", name.c_str()); + Log::info("Created RemotePlayer with name %ls\n", name.c_str()); heightOffset = 0; footSize = 0; diff --git a/targets/minecraft/client/renderer/Chunk.cpp b/targets/minecraft/client/renderer/Chunk.cpp index d89a7385f..989476468 100644 --- a/targets/minecraft/client/renderer/Chunk.cpp +++ b/targets/minecraft/client/renderer/Chunk.cpp @@ -12,7 +12,7 @@ #include "platform/sdl2/Render.h" #include "LevelRenderer.h" #include "app/linux/Stubs/winapi_stubs.h" -#include "app/include/FrameProfiler.h" +#include "util/FrameProfiler.h" #include "TileRenderer.h" #include "minecraft/client/renderer/Tesselator.h" #include "minecraft/client/renderer/culling/Culler.h" diff --git a/targets/minecraft/client/renderer/GameRenderer.cpp b/targets/minecraft/client/renderer/GameRenderer.cpp index 744e27a79..87228a1eb 100644 --- a/targets/minecraft/client/renderer/GameRenderer.cpp +++ b/targets/minecraft/client/renderer/GameRenderer.cpp @@ -1,3 +1,5 @@ +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "GameRenderer.h" #include @@ -13,14 +15,14 @@ #include "Chunk.h" #include "ItemInHandRenderer.h" #include "LevelRenderer.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "platform/ShutdownManager.h" -#include "app/common/src/Colours/ColourTable.h" +#include "app/common/Colours/ColourTable.h" #include "app/linux/LinuxGame.h" #include "app/linux/Stubs/winapi_stubs.h" -#include "app/include/BufferedImage.h" -#include "app/include/FrameProfiler.h" -#include "app/include/stubs.h" +#include "minecraft/client/BufferedImage.h" +#include "util/FrameProfiler.h" +#include "platform/stubs.h" #include "Tesselator.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" @@ -663,7 +665,7 @@ void GameRenderer::setupCamera(float a, int eye) { bool bNoBobbingAnim = (mc->player->getAnimOverrideBitmask() & (1 << HumanoidModel::eAnim_NoBobbing)) != 0; - if (app.GetGameSettings(mc->player->GetXboxPad(), eGameSetting_ViewBob) && + if (gameServices().getGameSettings(mc->player->GetXboxPad(), eGameSetting_ViewBob) && !mc->player->abilities.flying && !bNoLegAnim && !bNoBobbingAnim) bobView(a); @@ -717,7 +719,7 @@ void GameRenderer::renderItemInHand(float a, int eye) { std::shared_ptr item = localplayer->inventory->getSelected(); if (!(item && item->getItem()->id == Item::map_Id) && - app.GetGameSettings(localplayer->GetXboxPad(), + gameServices().getGameSettings(localplayer->GetXboxPad(), eGameSetting_DisplayHand) == 0) renderHand = false; } @@ -758,7 +760,7 @@ void GameRenderer::renderItemInHand(float a, int eye) { bool bNoLegAnim = (localplayer->getAnimOverrideBitmask() & ((1 << HumanoidModel::eAnim_NoLegAnim) | (1 << HumanoidModel::eAnim_NoBobbing))) != 0; - if (app.GetGameSettings(localplayer->GetXboxPad(), eGameSetting_ViewBob) && + if (gameServices().getGameSettings(localplayer->GetXboxPad(), eGameSetting_ViewBob) && !localplayer->abilities.flying && !bNoLegAnim) bobView(a); @@ -790,7 +792,7 @@ void GameRenderer::renderItemInHand(float a, int eye) { // 4J-PB - changing this to be per player // if (mc->options->bobView) bobView(a); - if (app.GetGameSettings(localplayer->GetXboxPad(), eGameSetting_ViewBob) && + if (gameServices().getGameSettings(localplayer->GetXboxPad(), eGameSetting_ViewBob) && !localplayer->abilities.flying && !bNoLegAnim) bobView(a); } @@ -835,7 +837,7 @@ void GameRenderer::turnOnLightLayer( static int logCount = 0; if (logCount < 16) { ++logCount; - app.DebugPrintf("[linux-lightmap] turnOnLightLayer tex=%d scale=%d\n", + Log::info("[linux-lightmap] turnOnLightLayer tex=%d scale=%d\n", textureId, scaleLight ? 1 : 0); } @@ -1201,7 +1203,7 @@ void GameRenderer::EnableUpdateThread() { // #endif #if defined(MULTITHREAD_ENABLE) if (updateRunning) return; - app.DebugPrintf( + Log::info( "------------------EnableUpdateThread--------------------\n"); updateRunning = true; m_updateEvents->set(eUpdateCanRun); @@ -1215,7 +1217,7 @@ void GameRenderer::DisableUpdateThread() { // #endif #if defined(MULTITHREAD_ENABLE) if (!updateRunning) return; - app.DebugPrintf( + Log::info( "------------------DisableUpdateThread--------------------\n"); updateRunning = false; m_updateEvents->clear(eUpdateCanRun); diff --git a/targets/minecraft/client/renderer/ItemInHandRenderer.cpp b/targets/minecraft/client/renderer/ItemInHandRenderer.cpp index bc85fa098..b16b03ed5 100644 --- a/targets/minecraft/client/renderer/ItemInHandRenderer.cpp +++ b/targets/minecraft/client/renderer/ItemInHandRenderer.cpp @@ -1,3 +1,5 @@ +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "ItemInHandRenderer.h" #include @@ -7,8 +9,8 @@ #include #include "platform/sdl2/Render.h" -#include "app/common/App_enums.h" -#include "app/common/src/Colours/ColourTable.h" +#include "minecraft/GameEnums.h" +#include "app/common/Colours/ColourTable.h" #include "app/linux/LinuxGame.h" #include "Tesselator.h" #include "Textures.h" @@ -464,7 +466,7 @@ void ItemInHandRenderer::render(float a) { static int lightmapLogCount = 0; if (lightmapLogCount < 8) { ++lightmapLogCount; - app.DebugPrintf( + Log::info( "[linux-lightmap] item-hand raw=0x%08x uv=(%d,%d)\n", col, u, v); } @@ -547,7 +549,7 @@ void ItemInHandRenderer::render(float a) { player->inventory->getSelected(); if ((itemInstance && (itemInstance->getItem()->id == Item::map_Id)) || - app.GetGameSettings(localPlayer->GetXboxPad(), + gameServices().getGameSettings(localPlayer->GetXboxPad(), eGameSetting_DisplayHand) != 0) { playerRenderer->renderHand(); } @@ -764,7 +766,7 @@ void ItemInHandRenderer::render(float a) { player->inventory->getSelected(); if ((itemInstance && (itemInstance->getItem()->id == Item::map_Id)) || - app.GetGameSettings(localPlayer->GetXboxPad(), + gameServices().getGameSettings(localPlayer->GetXboxPad(), eGameSetting_DisplayHand) != 0) { playerRenderer->renderHand(); } diff --git a/targets/minecraft/client/renderer/LevelRenderer.cpp b/targets/minecraft/client/renderer/LevelRenderer.cpp index 2651d019f..03173d8b2 100644 --- a/targets/minecraft/client/renderer/LevelRenderer.cpp +++ b/targets/minecraft/client/renderer/LevelRenderer.cpp @@ -1,3 +1,5 @@ +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "LevelRenderer.h" #include @@ -18,14 +20,14 @@ #include "platform/sdl2/Render.h" #include "Chunk.h" #include "GameRenderer.h" -#include "app/common/App_enums.h" -#include "app/common/src/Audio/SoundEngine.h" -#include "app/common/src/Colours/ColourTable.h" -#include "app/common/src/Console_Debug_enum.h" +#include "minecraft/GameEnums.h" +#include "app/common/Audio/SoundEngine.h" +#include "app/common/Colours/ColourTable.h" +#include "app/common/Console_Debug_enum.h" #include "app/linux/LinuxGame.h" -#include "app/include/FrameProfiler.h" -#include "app/include/MobSkinMemTextureProcessor.h" -#include "app/include/stubs.h" +#include "util/FrameProfiler.h" +#include "minecraft/client/renderer/MobSkinMemTextureProcessor.h" +#include "platform/stubs.h" #include "Tesselator.h" #include "util/StringHelpers.h" #include "java/Class.h" @@ -445,8 +447,8 @@ void LevelRenderer::setLevel(int playerIndex, MultiPlayerLevel* level) { } void LevelRenderer::AddDLCSkinsToMemTextures() { - for (int i = 0; i < app.vSkinNames.size(); i++) { - textures->addMemTexture(app.vSkinNames[i], + for (int i = 0; i < gameServices().getSkinNames().size(); i++) { + textures->addMemTexture(gameServices().getSkinNames()[i], new MobSkinMemTextureProcessor()); } } @@ -1127,7 +1129,7 @@ void LevelRenderer::renderHaloRing(float alpha) { // Rough lumninance calculation float Y = (sr + sr + sb + sg + sg + sg) / 6; float br = 0.6f + (Y * 0.4f); - // app.DebugPrintf("Luminance = %f, brightness = %f\n", Y, br); + // Log::info("Luminance = %f, brightness = %f\n", Y, br); glColor3f(br, br, br); // Fog at the base near the world @@ -1162,7 +1164,7 @@ void LevelRenderer::renderClouds(float alpha) { int playerIndex = mc->player->GetXboxPad(); // if the primary player has clouds off, so do all players on this machine - if (app.GetGameSettings(InputManager.GetPrimaryPad(), + if (gameServices().getGameSettings(InputManager.GetPrimaryPad(), eGameSetting_Clouds) == 0) { return; } @@ -1175,8 +1177,8 @@ void LevelRenderer::renderClouds(float alpha) { return; } - if (app.DebugSettingsOn()) { - if (app.GetGameSettingsDebugMask(InputManager.GetPrimaryPad()) & + if (gameServices().debugSettingsOn()) { + if (gameServices().debugGetMask(InputManager.GetPrimaryPad()) & (1L << eDebugSetting_FreezeTime)) { iTicks = m_freezeticks; } @@ -1253,8 +1255,8 @@ void LevelRenderer::renderClouds(float alpha) { glDisable(GL_BLEND); glEnable(GL_CULL_FACE); - if (app.DebugSettingsOn()) { - if (!(app.GetGameSettingsDebugMask(InputManager.GetPrimaryPad()) & + if (gameServices().debugSettingsOn()) { + if (!(gameServices().debugGetMask(InputManager.GetPrimaryPad()) & (1L << eDebugSetting_FreezeTime))) { m_freezeticks = iTicks; } @@ -1439,8 +1441,8 @@ void LevelRenderer::renderAdvancedClouds(float alpha) { int iTicks = ticks; - if (app.DebugSettingsOn()) { - if (app.GetGameSettingsDebugMask(InputManager.GetPrimaryPad()) & + if (gameServices().debugSettingsOn()) { + if (gameServices().debugGetMask(InputManager.GetPrimaryPad()) & (1L << eDebugSetting_FreezeTime)) { iTicks = m_freezeticks; } @@ -1686,8 +1688,8 @@ void LevelRenderer::renderAdvancedClouds(float alpha) { glDisable(GL_BLEND); glEnable(GL_CULL_FACE); - if (app.DebugSettingsOn()) { - if (!(app.GetGameSettingsDebugMask(InputManager.GetPrimaryPad()) & + if (gameServices().debugSettingsOn()) { + if (!(gameServices().debugGetMask(InputManager.GetPrimaryPad()) & (1L << eDebugSetting_FreezeTime))) { m_freezeticks = iTicks; } @@ -1748,7 +1750,7 @@ bool LevelRenderer::updateDirtyChunks() { static int throttle = 0; if( ( throttle % 100 ) == 0 ) { - app.DebugPrintf("CBuffSize: %d\n",memAlloc/(1024*1024)); + Log::info("CBuffSize: %d\n",memAlloc/(1024*1024)); } throttle++; */ @@ -1818,7 +1820,7 @@ bool LevelRenderer::updateDirtyChunks() { int py = (int)player->y; int pz = (int)player->z; - // app.DebugPrintf("!! %d %d %d, %d %d %d + // Log::info("!! %d %d %d, %d %d %d //{%d,%d} //",px,py,pz,stackChunkDirty,nonStackChunkDirty,onlyRebuild, // xChunks, zChunks); @@ -1935,7 +1937,7 @@ bool LevelRenderer::updateDirtyChunks() { } } } - // app.DebugPrintf("[%d,%d,%d]\n",nearestClipChunks.empty(),considered,wouldBeNearButEmpty); + // Log::info("[%d,%d,%d]\n",nearestClipChunks.empty(),considered,wouldBeNearButEmpty); } } } @@ -1999,7 +2001,7 @@ bool LevelRenderer::updateDirtyChunks() { // 0; static int64_t countTime = 0; // int64_t startTime = System::currentTimeMillis(); - // app.DebugPrintf("Rebuilding permaChunk %d\n", index); + // Log::info("Rebuilding permaChunk %d\n", index); { FRAME_PROFILE_SCOPE(ChunkRebuildBody); @@ -2218,7 +2220,7 @@ void LevelRenderer::renderHitOutline(std::shared_ptr player, const float ss = 0.002f; // 4J-PB - If Display HUD is false, don't render the hit outline - if (app.GetGameSettings(iPad, eGameSetting_DisplayHUD) == 0) return; + if (gameServices().getGameSettings(iPad, eGameSetting_DisplayHUD) == 0) return; RenderManager.StateSetLightingEnable(false); glDisable(GL_TEXTURE_2D); @@ -4047,7 +4049,7 @@ int LevelRenderer::rebuildChunkThreadProc(void* lpParam) { while (true) { s_activationEventA[index]->waitForSignal(C4JThread::kInfiniteTimeout); - // app.DebugPrintf("Rebuilding permaChunk %d\n", index + 1); + // Log::info("Rebuilding permaChunk %d\n", index + 1); { FRAME_PROFILE_SCOPE(ChunkRebuildBody); permaChunk[index + 1].rebuild(); diff --git a/targets/minecraft/client/renderer/LevelRenderer.h b/targets/minecraft/client/renderer/LevelRenderer.h index c66590063..12e02de73 100644 --- a/targets/minecraft/client/renderer/LevelRenderer.h +++ b/targets/minecraft/client/renderer/LevelRenderer.h @@ -1,7 +1,6 @@ #pragma once -#include "app/include/NetTypes.h" -#include "app/include/SkinBox.h" -#include "app/include/XboxStubs.h" +#include "platform/NetTypes.h" +#include "minecraft/client/model/SkinBox.h" #include "OffsettedRenderList.h" #include "platform/C4JThread.h" #include "util/Definitions.h" diff --git a/targets/minecraft/client/renderer/MemTexture.cpp b/targets/minecraft/client/renderer/MemTexture.cpp index 25f70fdef..a4d2b917a 100644 --- a/targets/minecraft/client/renderer/MemTexture.cpp +++ b/targets/minecraft/client/renderer/MemTexture.cpp @@ -1,9 +1,9 @@ -#include "app/include/MemTexture.h" +#include "minecraft/client/renderer/MemTexture.h" #include #include -#include "app/include/BufferedImage.h" +#include "minecraft/client/BufferedImage.h" class MemTextureProcessor; diff --git a/targets/app/include/MemTexture.h b/targets/minecraft/client/renderer/MemTexture.h similarity index 100% rename from targets/app/include/MemTexture.h rename to targets/minecraft/client/renderer/MemTexture.h diff --git a/targets/app/include/MemTextureProcessor.h b/targets/minecraft/client/renderer/MemTextureProcessor.h similarity index 100% rename from targets/app/include/MemTextureProcessor.h rename to targets/minecraft/client/renderer/MemTextureProcessor.h diff --git a/targets/minecraft/client/renderer/MobSkinMemTextureProcessor.cpp b/targets/minecraft/client/renderer/MobSkinMemTextureProcessor.cpp index 866225074..08ee542ae 100644 --- a/targets/minecraft/client/renderer/MobSkinMemTextureProcessor.cpp +++ b/targets/minecraft/client/renderer/MobSkinMemTextureProcessor.cpp @@ -1,7 +1,7 @@ -#include "app/include/MobSkinMemTextureProcessor.h" +#include "minecraft/client/renderer/MobSkinMemTextureProcessor.h" -#include "app/include/BufferedImage.h" -#include "app/include/stubs.h" +#include "minecraft/client/BufferedImage.h" +#include "platform/stubs.h" BufferedImage* MobSkinMemTextureProcessor::process(BufferedImage* in) { if (in == nullptr) return nullptr; diff --git a/targets/app/include/MobSkinMemTextureProcessor.h b/targets/minecraft/client/renderer/MobSkinMemTextureProcessor.h similarity index 86% rename from targets/app/include/MobSkinMemTextureProcessor.h rename to targets/minecraft/client/renderer/MobSkinMemTextureProcessor.h index f1e4879bf..131716ed0 100644 --- a/targets/app/include/MobSkinMemTextureProcessor.h +++ b/targets/minecraft/client/renderer/MobSkinMemTextureProcessor.h @@ -1,5 +1,5 @@ #pragma once -#include "app/include/MemTextureProcessor.h" +#include "minecraft/client/renderer/MemTextureProcessor.h" class MobSkinMemTextureProcessor : public MemTextureProcessor { private: diff --git a/targets/minecraft/client/renderer/MobSkinTextureProcessor.cpp b/targets/minecraft/client/renderer/MobSkinTextureProcessor.cpp index ddc4c28a1..3c48ed8c8 100644 --- a/targets/minecraft/client/renderer/MobSkinTextureProcessor.cpp +++ b/targets/minecraft/client/renderer/MobSkinTextureProcessor.cpp @@ -1,7 +1,7 @@ #include "MobSkinTextureProcessor.h" -#include "app/include/BufferedImage.h" -#include "app/include/stubs.h" +#include "minecraft/client/BufferedImage.h" +#include "platform/stubs.h" BufferedImage* MobSkinTextureProcessor::process(BufferedImage* in) { if (in == nullptr) return nullptr; diff --git a/targets/minecraft/client/renderer/Tesselator.cpp b/targets/minecraft/client/renderer/Tesselator.cpp index b10c8fd3f..c243c9499 100644 --- a/targets/minecraft/client/renderer/Tesselator.cpp +++ b/targets/minecraft/client/renderer/Tesselator.cpp @@ -1,3 +1,4 @@ +#include "minecraft/util/Log.h" #include "Tesselator.h" #include @@ -6,7 +7,7 @@ #include "platform/sdl2/Render.h" #include "app/linux/LinuxGame.h" -#include "app/include/stubs.h" +#include "platform/stubs.h" #include "minecraft/client/MemoryTracker.h" bool Tesselator::TRIANGLE_MODE = false; @@ -432,7 +433,7 @@ void logLinuxPackedLightmapCoords(const char* path, int tex2, std::int16_t u, if (logCount >= 16) return; ++logCount; - app.DebugPrintf( + Log::info( "[linux-lightmap] %s raw=0x%08x packed=(%d,%d) sampled=(%.4f,%.4f)\n", path, tex2, (int)u, (int)v, u / 256.0f, v / 256.0f); } diff --git a/targets/minecraft/client/renderer/Textures.cpp b/targets/minecraft/client/renderer/Textures.cpp index eccbbe06f..29b66723a 100644 --- a/targets/minecraft/client/renderer/Textures.cpp +++ b/targets/minecraft/client/renderer/Textures.cpp @@ -1,3 +1,4 @@ +#include "minecraft/IGameServices.h" #include "Textures.h" #include @@ -10,10 +11,10 @@ #include "platform/sdl2/Render.h" #include "HttpTexture.h" #include "app/linux/LinuxGame.h" -#include "app/include/BufferedImage.h" -#include "app/include/MemTexture.h" -#include "app/include/MemTextureProcessor.h" -#include "app/include/MobSkinMemTextureProcessor.h" +#include "minecraft/client/BufferedImage.h" +#include "minecraft/client/renderer/MemTexture.h" +#include "minecraft/client/renderer/MemTextureProcessor.h" +#include "minecraft/client/renderer/MobSkinMemTextureProcessor.h" #include "util/StringHelpers.h" #include "java/Buffer.h" @@ -1003,7 +1004,7 @@ int Textures::loadMemTexture(const std::wstring& url, if (it != memTextures.end()) { texture = (*it).second; } - if (texture == nullptr && app.IsFileInMemoryTextures(url)) { + if (texture == nullptr && gameServices().isFileInMemoryTextures(url)) { // If we haven't loaded it yet, but we have the data for it then add it texture = addMemTexture(url, new MobSkinMemTextureProcessor()); } @@ -1040,7 +1041,7 @@ int Textures::loadMemTexture(const std::wstring& url, int backup) { if (it != memTextures.end()) { texture = (*it).second; } - if (texture == nullptr && app.IsFileInMemoryTextures(url)) { + if (texture == nullptr && gameServices().isFileInMemoryTextures(url)) { // If we haven't loaded it yet, but we have the data for it then add it texture = addMemTexture(url, new MobSkinMemTextureProcessor()); } @@ -1081,7 +1082,7 @@ MemTexture* Textures::addMemTexture(const std::wstring& name, // can we find it in the app mem files? std::uint8_t* pbData = nullptr; unsigned int dwBytes = 0; - app.GetMemFileDetails(name, &pbData, &dwBytes); + gameServices().getMemFileDetails(name, &pbData, &dwBytes); if (dwBytes != 0) { texture = new MemTexture(name, pbData, dwBytes, processor); diff --git a/targets/minecraft/client/renderer/TileRenderer.cpp b/targets/minecraft/client/renderer/TileRenderer.cpp index cb4390a3a..86a878035 100644 --- a/targets/minecraft/client/renderer/TileRenderer.cpp +++ b/targets/minecraft/client/renderer/TileRenderer.cpp @@ -12,9 +12,9 @@ #include "platform/sdl2/Render.h" #include "EntityTileRenderer.h" #include "GameRenderer.h" -#include "app/common/App_enums.h" -#include "app/common/src/Colours/ColourTable.h" -#include "app/include/FrameProfiler.h" +#include "minecraft/GameEnums.h" +#include "app/common/Colours/ColourTable.h" +#include "util/FrameProfiler.h" #include "Tesselator.h" #include "minecraft/Direction.h" #include "minecraft/Facing.h" diff --git a/targets/minecraft/client/renderer/entity/EntityRenderDispatcher.cpp b/targets/minecraft/client/renderer/entity/EntityRenderDispatcher.cpp index bd0a73d89..33794e6d8 100644 --- a/targets/minecraft/client/renderer/entity/EntityRenderDispatcher.cpp +++ b/targets/minecraft/client/renderer/entity/EntityRenderDispatcher.cpp @@ -1,3 +1,4 @@ +#include "minecraft/util/Log.h" #include "EntityRenderDispatcher.h" #include @@ -195,7 +196,7 @@ EntityRenderer* EntityRenderDispatcher::getRenderer(eINSTANCEOF e) { // insert elements if they don't exist if (it == renderers.end()) { - app.DebugPrintf("Couldn't find renderer for entity of type %d\n", e); + Log::info("Couldn't find renderer for entity of type %d\n", e); // New renderer mapping required in above table // __debugbreak(); assert(0); diff --git a/targets/minecraft/client/renderer/entity/LivingEntityRenderer.cpp b/targets/minecraft/client/renderer/entity/LivingEntityRenderer.cpp index 30e469227..36a56b8f1 100644 --- a/targets/minecraft/client/renderer/entity/LivingEntityRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/LivingEntityRenderer.cpp @@ -1,3 +1,4 @@ +#include "minecraft/IGameServices.h" #include "LivingEntityRenderer.h" #include @@ -6,7 +7,7 @@ #include "platform/sdl2/Render.h" #include "EntityRenderDispatcher.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/linux/LinuxGame.h" #include "java/Class.h" @@ -388,12 +389,12 @@ void LivingEntityRenderer::renderName(std::shared_ptr mob, if (!msg.empty()) { if (mob->isSneaking()) { - if (app.GetGameSettings(eGameSetting_DisplayHUD) == 0) { + if (gameServices().getGameSettings(eGameSetting_DisplayHUD) == 0) { // 4J-PB - turn off gamertag render return; } - if (app.GetGameHostOption(eGameHostOption_Gamertags) == 0) { + if (gameServices().getGameHostOption(eGameHostOption_Gamertags) == 0) { // turn off gamertags if the host has set them off return; } @@ -463,12 +464,12 @@ void LivingEntityRenderer::renderNameTag(std::shared_ptr mob, const std::wstring& name, double x, double y, double z, int maxDist, int color /*= 0xff000000*/) { - if (app.GetGameSettings(eGameSetting_DisplayHUD) == 0) { + if (gameServices().getGameSettings(eGameSetting_DisplayHUD) == 0) { // 4J-PB - turn off gamertag render return; } - if (app.GetGameHostOption(eGameHostOption_Gamertags) == 0) { + if (gameServices().getGameHostOption(eGameHostOption_Gamertags) == 0) { // turn off gamertags if the host has set them off return; } @@ -499,7 +500,7 @@ void LivingEntityRenderer::renderNameTag(std::shared_ptr mob, int readableDist = PLAYER_NAME_READABLE_FULLSCREEN; if (!RenderManager.IsHiDef()) { readableDist = PLAYER_NAME_READABLE_DISTANCE_SD; - } else if (app.GetLocalPlayerCount() > 2) { + } else if (gameServices().getLocalPlayerCount() > 2) { readableDist = PLAYER_NAME_READABLE_DISTANCE_SPLITSCREEN; } @@ -527,7 +528,7 @@ void LivingEntityRenderer::renderNameTag(std::shared_ptr mob, if (mob->instanceof(eTYPE_PLAYER)) { std::shared_ptr player = std::dynamic_pointer_cast(mob); - if (app.isXuidDeadmau5(player->getXuid())) offs = -10; + if (gameServices().isXuidDeadmau5(player->getXuid())) offs = -10; playerName = name; } else { diff --git a/targets/minecraft/client/renderer/entity/MobRenderer.cpp b/targets/minecraft/client/renderer/entity/MobRenderer.cpp index c694e55eb..190bb5373 100644 --- a/targets/minecraft/client/renderer/entity/MobRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/MobRenderer.cpp @@ -7,8 +7,8 @@ #include "platform/sdl2/Render.h" #include "EntityRenderDispatcher.h" #include "LivingEntityRenderer.h" -#include "app/common/App_enums.h" -#include "app/common/src/Colours/ColourTable.h" +#include "minecraft/GameEnums.h" +#include "app/common/Colours/ColourTable.h" #include "java/Class.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/minecraft/client/renderer/entity/PlayerRenderer.cpp b/targets/minecraft/client/renderer/entity/PlayerRenderer.cpp index 9c4acb77f..f4c1acd51 100644 --- a/targets/minecraft/client/renderer/entity/PlayerRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/PlayerRenderer.cpp @@ -1,3 +1,4 @@ +#include "minecraft/IGameServices.h" #include "PlayerRenderer.h" #include @@ -7,7 +8,7 @@ #include "platform/sdl2/Render.h" #include "EntityRenderDispatcher.h" #include "HumanoidMobRenderer.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/linux/LinuxGame.h" #include "java/Class.h" #include "minecraft/Facing.h" @@ -301,7 +302,7 @@ void PlayerRenderer::additionalRendering(std::shared_ptr _mob, } // need to add a custom texture for deadmau5 - if (mob != nullptr && app.isXuidDeadmau5(mob->getXuid()) && + if (mob != nullptr && gameServices().isXuidDeadmau5(mob->getXuid()) && bindTexture(mob->customTextureUrl, L"")) { for (int i = 0; i < 2; i++) { float yr = (mob->yRotO + (mob->yRot - mob->yRotO) * a) - @@ -522,7 +523,7 @@ void PlayerRenderer::setupRotations(std::shared_ptr _mob, // 4J Added override to stop rendering shadow if player is invisible void PlayerRenderer::renderShadow(std::shared_ptr e, double x, double y, double z, float pow, float a) { - if (app.GetGameHostOption(eGameHostOption_HostCanBeInvisible) > 0) { + if (gameServices().getGameHostOption(eGameHostOption_HostCanBeInvisible) > 0) { std::shared_ptr player = std::dynamic_pointer_cast(e); if (player != nullptr && player->hasInvisiblePrivilege()) return; } diff --git a/targets/minecraft/client/renderer/entity/PlayerRenderer.h b/targets/minecraft/client/renderer/entity/PlayerRenderer.h index 86ba38bb5..951a19701 100644 --- a/targets/minecraft/client/renderer/entity/PlayerRenderer.h +++ b/targets/minecraft/client/renderer/entity/PlayerRenderer.h @@ -2,9 +2,8 @@ #include #include -#include "app/include/NetTypes.h" -#include "app/include/SkinBox.h" -#include "app/include/XboxStubs.h" +#include "platform/NetTypes.h" +#include "minecraft/client/model/SkinBox.h" #include "MobRenderer.h" #include "minecraft/client/renderer/entity/LivingEntityRenderer.h" #include "minecraft/world/entity/player/Player.h" diff --git a/targets/minecraft/client/renderer/texture/PreStitchedTextureMap.cpp b/targets/minecraft/client/renderer/texture/PreStitchedTextureMap.cpp index e0b83b47c..03ea642c1 100644 --- a/targets/minecraft/client/renderer/texture/PreStitchedTextureMap.cpp +++ b/targets/minecraft/client/renderer/texture/PreStitchedTextureMap.cpp @@ -1,3 +1,4 @@ +#include "minecraft/util/Log.h" #include "PreStitchedTextureMap.h" #include @@ -5,7 +6,7 @@ #include "app/linux/LinuxGame.h" #include "app/linux/Stubs/winapi_stubs.h" -#include "app/include/BufferedImage.h" +#include "minecraft/client/BufferedImage.h" #include "SimpleIcon.h" #include "StitchedTexture.h" #include "Texture.h" @@ -173,7 +174,7 @@ void PreStitchedTextureMap::makeTextureAnimated(TexturePack* texturePack, #if !defined(_CONTENT_PACKAGE) if (first->getWidth() != tex->getWidth() || first->getHeight() != tex->getHeight()) { - app.DebugPrintf("%ls - first w - %d, h - %d, tex w - %d, h - %d\n", + Log::info("%ls - first w - %d, h - %d, tex w - %d, h - %d\n", textureFileName.c_str(), first->getWidth(), tex->getWidth(), first->getHeight(), tex->getHeight()); @@ -194,7 +195,7 @@ void PreStitchedTextureMap::makeTextureAnimated(TexturePack* texturePack, StitchedTexture* PreStitchedTextureMap::getTexture(const std::wstring& name) { #if !defined(_CONTENT_PACKAGE) - app.DebugPrintf("Not implemented!\n"); + Log::info("Not implemented!\n"); __debugbreak(); #endif return nullptr; @@ -215,7 +216,7 @@ Texture* PreStitchedTextureMap::getStitchedTexture() { return stitchResult; } Icon* PreStitchedTextureMap::registerIcon(const std::wstring& name) { Icon* result = nullptr; if (name.empty()) { - app.DebugPrintf("Don't register nullptr\n"); + Log::info("Don't register nullptr\n"); #if !defined(_CONTENT_PACKAGE) __debugbreak(); #endif @@ -228,7 +229,7 @@ Icon* PreStitchedTextureMap::registerIcon(const std::wstring& name) { if (result == nullptr) { #if !defined(_CONTENT_PACKAGE) - app.DebugPrintf("Could not find uv data for icon %ls\n", name.c_str()); + Log::info("Could not find uv data for icon %ls\n", name.c_str()); __debugbreak(); #endif result = missingPosition; diff --git a/targets/minecraft/client/renderer/texture/Stitcher.cpp b/targets/minecraft/client/renderer/texture/Stitcher.cpp index 5a9498de0..30f656257 100644 --- a/targets/minecraft/client/renderer/texture/Stitcher.cpp +++ b/targets/minecraft/client/renderer/texture/Stitcher.cpp @@ -1,3 +1,4 @@ +#include "minecraft/util/Log.h" #include "Stitcher.h" #include @@ -81,7 +82,7 @@ void Stitcher::stitch() { TextureHolder* textureHolder = *it; // textureHolders[i]; if (!addToStorage(textureHolder)) { - app.DebugPrintf("Stitcher exception!\n"); + Log::info("Stitcher exception!\n"); #ifndef _CONTENT_PACKAGE __debugbreak(); #endif diff --git a/targets/minecraft/client/renderer/texture/Texture.cpp b/targets/minecraft/client/renderer/texture/Texture.cpp index 74d720e11..c16c818e1 100644 --- a/targets/minecraft/client/renderer/texture/Texture.cpp +++ b/targets/minecraft/client/renderer/texture/Texture.cpp @@ -1,3 +1,4 @@ +#include "minecraft/util/Log.h" #include "Texture.h" #include @@ -7,7 +8,7 @@ #include "platform/sdl2/Render.h" #include "app/linux/LinuxGame.h" -#include "app/include/BufferedImage.h" +#include "minecraft/client/BufferedImage.h" #include "TextureManager.h" #include "java/Buffer.h" #include "java/ByteBuffer.h" @@ -344,7 +345,7 @@ void Texture::transferFromImage(BufferedImage* image) { // + // imgHeight + ") larger than the Texture dimensions (" + width + // ", " + height + "). Ignoring."); - app.DebugPrintf( + Log::info( "transferFromImage called with a BufferedImage with dimensions " "(%d, %d) larger than the Texture dimensions (%d, %d). Ignoring.\n", imgWidth, imgHeight, width, height); diff --git a/targets/minecraft/client/renderer/texture/TextureManager.cpp b/targets/minecraft/client/renderer/texture/TextureManager.cpp index b03f23e1b..79eed49ef 100644 --- a/targets/minecraft/client/renderer/texture/TextureManager.cpp +++ b/targets/minecraft/client/renderer/texture/TextureManager.cpp @@ -1,3 +1,4 @@ +#include "minecraft/util/Log.h" #include "TextureManager.h" #include @@ -6,7 +7,7 @@ #include #include "app/linux/LinuxGame.h" -#include "app/include/BufferedImage.h" +#include "minecraft/client/BufferedImage.h" #include "Stitcher.h" #include "Texture.h" #include "java/File.h" @@ -48,7 +49,7 @@ void TextureManager::registerTexture(Texture* texture) { // Minecraft.getInstance().getLogger().warning("TextureManager.registerTexture // called, but this texture has " + "already been registered. // ignoring."); - app.DebugPrintf( + Log::info( "TextureManager.registerTexture called, but this texture has " "already been registered. ignoring."); return; diff --git a/targets/minecraft/client/renderer/texture/TextureMap.cpp b/targets/minecraft/client/renderer/texture/TextureMap.cpp index c32a5249d..8421fa863 100644 --- a/targets/minecraft/client/renderer/texture/TextureMap.cpp +++ b/targets/minecraft/client/renderer/texture/TextureMap.cpp @@ -1,3 +1,4 @@ +#include "minecraft/util/Log.h" #include "TextureMap.h" #include @@ -7,7 +8,7 @@ #include "app/linux/LinuxGame.h" #include "app/linux/Stubs/winapi_stubs.h" -#include "app/include/BufferedImage.h" +#include "minecraft/client/BufferedImage.h" #include "StitchSlot.h" #include "StitchedTexture.h" #include "Stitcher.h" @@ -234,7 +235,7 @@ Texture* TextureMap::getStitchedTexture() { return stitchResult; } // 4J Stu - register is a reserved keyword in C++ Icon* TextureMap::registerIcon(const std::wstring& name) { if (name.empty()) { - app.DebugPrintf("Don't register nullptr\n"); + Log::info("Don't register nullptr\n"); #ifndef _CONTENT_PACKAGE __debugbreak(); #endif diff --git a/targets/minecraft/client/renderer/tileentity/SignRenderer.cpp b/targets/minecraft/client/renderer/tileentity/SignRenderer.cpp index 8e65c852a..239ce3f30 100644 --- a/targets/minecraft/client/renderer/tileentity/SignRenderer.cpp +++ b/targets/minecraft/client/renderer/tileentity/SignRenderer.cpp @@ -1,3 +1,4 @@ +#include "minecraft/IGameServices.h" #include "SignRenderer.h" #include @@ -5,10 +6,10 @@ #include #include "platform/sdl2/Render.h" -#include "app/common/App_enums.h" -#include "app/common/src/Colours/ColourTable.h" +#include "minecraft/GameEnums.h" +#include "app/common/Colours/ColourTable.h" #include "app/linux/LinuxGame.h" -#include "app/include/XboxStubs.h" +#include "platform/XboxStubs.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Font.h" @@ -89,7 +90,7 @@ void SignRenderer::render(std::shared_ptr _sign, double x, double y, msg = L"Censored"; // In-game font, so English only break; default: - msg = app.GetString(IDS_STRINGVERIFY_CENSORED); + msg = gameServices().getString(IDS_STRINGVERIFY_CENSORED); break; } } else { @@ -104,7 +105,7 @@ void SignRenderer::render(std::shared_ptr _sign, double x, double y, L"Awaiting Approval"; // In-game font, so English only break; default: - msg = app.GetString(IDS_STRINGVERIFY_AWAITING_APPROVAL); + msg = gameServices().getString(IDS_STRINGVERIFY_AWAITING_APPROVAL); break; } } diff --git a/targets/minecraft/client/skins/AbstractTexturePack.cpp b/targets/minecraft/client/skins/AbstractTexturePack.cpp index 688e2cc7f..b8917360b 100644 --- a/targets/minecraft/client/skins/AbstractTexturePack.cpp +++ b/targets/minecraft/client/skins/AbstractTexturePack.cpp @@ -1,3 +1,4 @@ +#include "minecraft/util/Log.h" #include "AbstractTexturePack.h" #include @@ -5,11 +6,11 @@ #include -#include "app/common/src/Colours/ColourTable.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Colours/ColourTable.h" +#include "minecraft/IGameServices.h" #include "app/linux/Linux_UIController.h" #include "app/linux/Stubs/winapi_stubs.h" -#include "app/include/BufferedImage.h" +#include "minecraft/client/BufferedImage.h" #include "util/StringHelpers.h" #include "java/File.h" #include "java/InputOutputStream/BufferedReader.h" @@ -61,7 +62,7 @@ void AbstractTexturePack::loadName() {} InputStream* AbstractTexturePack::getResource( const std::wstring& name, bool allowFallback) // throws IOException { - app.DebugPrintf("texture - %ls\n", name.c_str()); + Log::info("texture - %ls\n", name.c_str()); InputStream* is = getResourceImplementation(name); if (is == nullptr && fallback != nullptr && allowFallback) { is = fallback->getResource(name, true); @@ -136,7 +137,7 @@ std::wstring AbstractTexturePack::getAnimationString( // Minecraft::getInstance()->getLogger().info("Found animation info for: // " + animationDefinitionFile); #if !defined(_CONTENT_PACKAGE) - app.DebugPrintf("Found animation info for: %ls\n", + Log::info("Found animation info for: %ls\n", animationDefinitionFile.c_str()); #endif InputStreamReader isr(fileStream); @@ -162,7 +163,7 @@ BufferedImage* AbstractTexturePack::getImageResource( bool bTitleUpdateTexture /*=false*/, const std::wstring& drive /*=L""*/) { std::string pchTexture = wstringtofilename(File); std::string pchDrive = wstringtofilename(drive); - app.DebugPrintf("AbstractTexturePack::getImageResource - %s, drive is %s\n", + Log::info("AbstractTexturePack::getImageResource - %s, drive is %s\n", pchTexture.c_str(), pchDrive.c_str()); return new BufferedImage(TexturePack::getResource(L"/" + File), @@ -192,15 +193,15 @@ void AbstractTexturePack::loadDefaultColourTable() { m_colourTable = new ColourTable(data.data(), dataLength); } else { - app.DebugPrintf("Failed to load the default colours table\n"); - app.FatalLoadError(); + Log::info("Failed to load the default colours table\n"); + gameServices().fatalLoadError(); } } void AbstractTexturePack::loadDefaultHTMLColourTable() { - if (app.hasArchiveFile(L"HTMLColours.col")) { + if (gameServices().hasArchiveFile(L"HTMLColours.col")) { std::vector textColours = - app.getArchiveFile(L"HTMLColours.col"); + gameServices().getArchiveFile(L"HTMLColours.col"); m_colourTable->loadColoursFromData(textColours.data(), textColours.size()); } diff --git a/targets/minecraft/client/skins/DLCTexturePack.cpp b/targets/minecraft/client/skins/DLCTexturePack.cpp index 7f95d6f7c..ec7798b92 100644 --- a/targets/minecraft/client/skins/DLCTexturePack.cpp +++ b/targets/minecraft/client/skins/DLCTexturePack.cpp @@ -1,3 +1,5 @@ +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "DLCTexturePack.h" #include @@ -7,26 +9,26 @@ #include "platform/sdl2/Input.h" #include "platform/sdl2/Storage.h" -#include "app/common/App_enums.h" -#include "app/common/src/Audio/SoundEngine.h" -#include "app/common/src/Colours/ColourTable.h" -#include "app/common/src/DLC/DLCAudioFile.h" -#include "app/common/src/DLC/DLCColourTableFile.h" -#include "app/common/src/DLC/DLCFile.h" -#include "app/common/src/DLC/DLCGameRulesHeader.h" -#include "app/common/src/DLC/DLCLocalisationFile.h" -#include "app/common/src/DLC/DLCManager.h" -#include "app/common/src/DLC/DLCPack.h" -#include "app/common/src/DLC/DLCTextureFile.h" -#include "app/common/src/DLC/DLCUIDataFile.h" -#include "app/common/src/GameRules/GameRuleManager.h" -#include "app/common/src/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/common/src/Localisation/StringTable.h" -#include "app/common/src/UI/All Platforms/ArchiveFile.h" +#include "minecraft/GameEnums.h" +#include "app/common/Audio/SoundEngine.h" +#include "app/common/Colours/ColourTable.h" +#include "app/common/DLC/DLCAudioFile.h" +#include "app/common/DLC/DLCColourTableFile.h" +#include "app/common/DLC/DLCFile.h" +#include "app/common/DLC/DLCGameRulesHeader.h" +#include "app/common/DLC/DLCLocalisationFile.h" +#include "app/common/DLC/DLCManager.h" +#include "app/common/DLC/DLCPack.h" +#include "app/common/DLC/DLCTextureFile.h" +#include "app/common/DLC/DLCUIDataFile.h" +#include "app/common/GameRules/GameRuleManager.h" +#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "app/common/Localisation/StringTable.h" +#include "app/common/UI/All Platforms/ArchiveFile.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "app/linux/Stubs/winapi_stubs.h" -#include "app/include/BufferedImage.h" +#include "minecraft/client/BufferedImage.h" #include "platform/PlatformServices.h" #include "java/File.h" #include "minecraft/client/Minecraft.h" @@ -77,8 +79,8 @@ DLCTexturePack::DLCTexturePack(std::uint32_t id, DLCPack* pack, m_bLoadingData = false; m_bHasLoadedData = false; m_archiveFile = nullptr; - if (app.getLevelGenerationOptions()) - app.getLevelGenerationOptions()->setLoadedData(); + if (gameServices().getLevelGenerationOptions()) + gameServices().getLevelGenerationOptions()->setLoadedData(); m_bUsingDefaultColourTable = true; m_stringTable = nullptr; @@ -224,9 +226,9 @@ void DLCTexturePack::loadColourTable() { } // Load the text colours - if (app.hasArchiveFile(L"HTMLColours.col")) { + if (gameServices().hasArchiveFile(L"HTMLColours.col")) { std::vector textColours = - app.getArchiveFile(L"HTMLColours.col"); + gameServices().getArchiveFile(L"HTMLColours.col"); m_colourTable->loadColoursFromData(textColours.data(), textColours.size()); } @@ -244,20 +246,20 @@ void DLCTexturePack::loadData() { "TPACK") != ERROR_IO_PENDING) { // corrupt DLC m_bHasLoadedData = true; - if (app.getLevelGenerationOptions()) - app.getLevelGenerationOptions()->setLoadedData(); - app.DebugPrintf("Failed to mount texture pack DLC %d for pad %d\n", + if (gameServices().getLevelGenerationOptions()) + gameServices().getLevelGenerationOptions()->setLoadedData(); + Log::info("Failed to mount texture pack DLC %d for pad %d\n", mountIndex, InputManager.GetPrimaryPad()); } else { m_bLoadingData = true; - app.DebugPrintf("Attempted to mount DLC data for texture pack %d\n", + Log::info("Attempted to mount DLC data for texture pack %d\n", mountIndex); } } else { m_bHasLoadedData = true; - if (app.getLevelGenerationOptions()) - app.getLevelGenerationOptions()->setLoadedData(); - app.SetAction(InputManager.GetPrimaryPad(), + if (gameServices().getLevelGenerationOptions()) + gameServices().getLevelGenerationOptions()->setLoadedData(); + gameServices().setAction(InputManager.GetPrimaryPad(), eAppAction_ReloadTexturePack); } } @@ -265,7 +267,7 @@ void DLCTexturePack::loadData() { std::wstring DLCTexturePack::getFilePath(std::uint32_t packId, std::wstring filename, bool bAddDataFolder) { - return app.getFilePath(packId, filename, bAddDataFolder); + return gameServices().getFilePath(packId, filename, bAddDataFolder); } int DLCTexturePack::onPackMounted(int iPad, std::uint32_t dwErr, @@ -274,9 +276,9 @@ int DLCTexturePack::onPackMounted(int iPad, std::uint32_t dwErr, texturePack->m_bLoadingData = false; if (dwErr != ERROR_SUCCESS) { // corrupt DLC - app.DebugPrintf("Failed to mount DLC for pad %d: %u\n", iPad, dwErr); + Log::info("Failed to mount DLC for pad %d: %u\n", iPad, dwErr); } else { - app.DebugPrintf( + Log::info( "Mounted DLC for texture pack, attempting to load data\n"); texturePack->m_dlcDataPack = new DLCPack(texturePack->m_dlcInfoPack->getName(), dwLicenceMask); @@ -286,7 +288,7 @@ int DLCTexturePack::onPackMounted(int iPad, std::uint32_t dwErr, std::wstring dataFilePath = texturePack->m_dlcInfoPack->getFullDataPath(); if (!dataFilePath.empty()) { - if (!app.m_dlcManager.readDLCDataFile( + if (!gameServices().dlcReadDataFile( dwFilesProcessed, getFilePath(texturePack->m_dlcInfoPack->GetPackID(), dataFilePath), @@ -309,7 +311,7 @@ int DLCTexturePack::onPackMounted(int iPad, std::uint32_t dwErr, */ DLCPack* pack = texturePack->m_dlcInfoPack->GetParentPack(); LevelGenerationOptions* levelGen = - app.getLevelGenerationOptions(); + gameServices().getLevelGenerationOptions(); if (levelGen != nullptr && !levelGen->hasLoadedData()) { int gameRulesCount = pack->getDLCItemsCount( DLCManager::e_DLCType_GameRulesHeader); @@ -336,10 +338,10 @@ int DLCTexturePack::onPackMounted(int iPad, std::uint32_t dwErr, delete[] pbData; - app.m_gameRules.setLevelGenerationOptions( + gameServices().setLevelGenerationOptions( dlcFile->lgo); } else { - app.FatalLoadError(); + gameServices().fatalLoadError(); } } } @@ -357,7 +359,7 @@ int DLCTexturePack::onPackMounted(int iPad, std::uint32_t dwErr, // after a read fail and it's not an error? levelGen->setBaseSaveData(pbData, fileSize); } else { - app.FatalLoadError(); + gameServices().fatalLoadError(); } } } @@ -400,9 +402,9 @@ int DLCTexturePack::onPackMounted(int iPad, std::uint32_t dwErr, } texturePack->m_bHasLoadedData = true; - if (app.getLevelGenerationOptions()) - app.getLevelGenerationOptions()->setLoadedData(); - app.SetAction(InputManager.GetPrimaryPad(), eAppAction_ReloadTexturePack); + if (gameServices().getLevelGenerationOptions()) + gameServices().getLevelGenerationOptions()->setLoadedData(); + gameServices().setAction(InputManager.GetPrimaryPad(), eAppAction_ReloadTexturePack); return 0; } @@ -429,7 +431,7 @@ void DLCTexturePack::unloadUI() { } AbstractTexturePack::unloadUI(); - app.m_dlcManager.removePack(m_dlcDataPack); + gameServices().dlcRemovePack(m_dlcDataPack); m_dlcDataPack = nullptr; delete m_archiveFile; m_bHasLoadedData = false; diff --git a/targets/minecraft/client/skins/DLCTexturePack.h b/targets/minecraft/client/skins/DLCTexturePack.h index ddf4a7786..ccec65f84 100644 --- a/targets/minecraft/client/skins/DLCTexturePack.h +++ b/targets/minecraft/client/skins/DLCTexturePack.h @@ -5,7 +5,7 @@ #include "platform/PlatformTypes.h" #include "AbstractTexturePack.h" -#include "app/common/src/Localisation/StringTable.h" +#include "app/common/Localisation/StringTable.h" class DLCPack; class StringTable; diff --git a/targets/minecraft/client/skins/DefaultTexturePack.cpp b/targets/minecraft/client/skins/DefaultTexturePack.cpp index 4b86b2b19..5305d3843 100644 --- a/targets/minecraft/client/skins/DefaultTexturePack.cpp +++ b/targets/minecraft/client/skins/DefaultTexturePack.cpp @@ -1,3 +1,4 @@ +#include "minecraft/IGameServices.h" #include "DefaultTexturePack.h" @@ -17,9 +18,9 @@ DefaultTexturePack::DefaultTexturePack() } void DefaultTexturePack::loadIcon() { - if (app.hasArchiveFile(L"Graphics\\TexturePackIcon.png")) { + if (gameServices().hasArchiveFile(L"Graphics\\TexturePackIcon.png")) { std::vector ba = - app.getArchiveFile(L"Graphics\\TexturePackIcon.png"); + gameServices().getArchiveFile(L"Graphics\\TexturePackIcon.png"); m_iconData = ba.data(); m_iconSize = static_cast(ba.size()); } diff --git a/targets/minecraft/client/skins/DefaultTexturePack.h b/targets/minecraft/client/skins/DefaultTexturePack.h index b7fd41292..fa2e00689 100644 --- a/targets/minecraft/client/skins/DefaultTexturePack.h +++ b/targets/minecraft/client/skins/DefaultTexturePack.h @@ -2,8 +2,8 @@ #include #include "AbstractTexturePack.h" -#include "app/linux/LinuxGame.h" #include "java/InputOutputStream/InputStream.h" +#include "minecraft/IGameServices.h" #include "strings.h" class DefaultTexturePack : public AbstractTexturePack { @@ -22,7 +22,7 @@ public: bool hasFile(const std::wstring& name); bool isTerrainUpdateCompatible(); - std::wstring getDesc1() { return app.GetString(IDS_DEFAULT_TEXTUREPACK); } + std::wstring getDesc1() { return gameServices().getString(IDS_DEFAULT_TEXTUREPACK); } protected: //@Override diff --git a/targets/minecraft/client/skins/TexturePack.h b/targets/minecraft/client/skins/TexturePack.h index f3d36d36e..477db580f 100644 --- a/targets/minecraft/client/skins/TexturePack.h +++ b/targets/minecraft/client/skins/TexturePack.h @@ -3,7 +3,7 @@ #include #include -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" class InputStream; class Minecraft; diff --git a/targets/minecraft/client/skins/TexturePackRepository.cpp b/targets/minecraft/client/skins/TexturePackRepository.cpp index 640f4b945..7a2afdc2e 100644 --- a/targets/minecraft/client/skins/TexturePackRepository.cpp +++ b/targets/minecraft/client/skins/TexturePackRepository.cpp @@ -1,3 +1,5 @@ +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "TexturePackRepository.h" #include @@ -8,9 +10,9 @@ #include "platform/sdl2/Input.h" #include "DLCTexturePack.h" #include "DefaultTexturePack.h" -#include "app/common/App_enums.h" -#include "app/common/src/DLC/DLCManager.h" -#include "app/common/src/DLC/DLCPack.h" +#include "minecraft/GameEnums.h" +#include "app/common/DLC/DLCManager.h" +#include "app/common/DLC/DLCPack.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "java/File.h" @@ -62,13 +64,13 @@ bool TexturePackRepository::selectSkin(TexturePack* skin) { } void TexturePackRepository::selectWebSkin(const std::wstring& url) { - app.DebugPrintf( + Log::info( "TexturePackRepository::selectWebSkin is not implemented\n"); } void TexturePackRepository::downloadWebSkin(const std::wstring& url, File file) { - app.DebugPrintf( + Log::info( "TexturePackRepository::selectWebSkin is not implemented\n"); } @@ -86,12 +88,12 @@ void TexturePackRepository::updateList() { } std::wstring TexturePackRepository::getIdOrNull(File file) { - app.DebugPrintf("TexturePackRepository::getIdOrNull is not implemented\n"); + Log::info("TexturePackRepository::getIdOrNull is not implemented\n"); return L""; } std::vector TexturePackRepository::getWorkDirContents() { - app.DebugPrintf( + Log::info( "TexturePackRepository::getWorkDirContents is not implemented\n"); return std::vector(); } @@ -109,13 +111,13 @@ TexturePack* TexturePackRepository::getSelected() { } bool TexturePackRepository::shouldPromptForWebSkin() { - app.DebugPrintf( + Log::info( "TexturePackRepository::shouldPromptForWebSkin is not implemented\n"); return false; } bool TexturePackRepository::canUseWebSkin() { - app.DebugPrintf( + Log::info( "TexturePackRepository::canUseWebSkin is not implemented\n"); return false; } @@ -140,7 +142,7 @@ bool TexturePackRepository::selectTexturePackById(std::uint32_t id) { // invite games // (where they don't have the texture pack) can check this when the texture // pack is installed - app.SetRequiredTexturePackID(id); + gameServices().setRequiredTexturePackID(id); auto it = cacheById.find(id); if (it != cacheById.end()) { @@ -149,7 +151,7 @@ bool TexturePackRepository::selectTexturePackById(std::uint32_t id) { selectSkin(newPack); if (newPack->hasData()) { - app.SetAction(InputManager.GetPrimaryPad(), + gameServices().setAction(InputManager.GetPrimaryPad(), eAppAction_ReloadTexturePack); } else { newPack->loadData(); @@ -157,15 +159,15 @@ bool TexturePackRepository::selectTexturePackById(std::uint32_t id) { // Minecraft *pMinecraft = Minecraft::GetInstance(); // pMinecraft->textures->reloadAll(); } else { - app.DebugPrintf("TexturePack with id %d is already selected\n", id); + Log::info("TexturePack with id %d is already selected\n", id); } bDidSelect = true; } else { - app.DebugPrintf( + Log::info( "Failed to select texture pack %d as it is not in the list\n", id); // Fail safely if (selectSkin(DEFAULT_TEXTURE_PACK)) { - app.SetAction(InputManager.GetPrimaryPad(), + gameServices().setAction(InputManager.GetPrimaryPad(), eAppAction_ReloadTexturePack); } } diff --git a/targets/minecraft/client/title/TitleScreen.cpp b/targets/minecraft/client/title/TitleScreen.cpp index 52633dada..6f39edeaf 100644 --- a/targets/minecraft/client/title/TitleScreen.cpp +++ b/targets/minecraft/client/title/TitleScreen.cpp @@ -1,3 +1,5 @@ +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "TitleScreen.h" #include @@ -8,7 +10,7 @@ #include "platform/sdl2/Render.h" #include "app/linux/LinuxGame.h" #include "app/linux/Stubs/winapi_stubs.h" -#include "app/include/BufferedImage.h" +#include "minecraft/client/BufferedImage.h" #include "util/StringHelpers.h" #include "java/InputOutputStream/BufferedReader.h" #include "java/InputOutputStream/ByteArrayInputStream.h" @@ -41,8 +43,8 @@ TitleScreen::TitleScreen() { int splashIndex; std::wstring filename = L"splashes.txt"; - if (app.hasArchiveFile(filename)) { - std::vector splashesArray = app.getArchiveFile(filename); + if (gameServices().hasArchiveFile(filename)) { + std::vector splashesArray = gameServices().getArchiveFile(filename); ByteArrayInputStream bais(splashesArray); InputStreamReader isr(&bais); BufferedReader br(&isr); @@ -90,7 +92,7 @@ void TitleScreen::tick() { void TitleScreen::keyPressed(wchar_t eventCharacter, int eventKey) {} void TitleScreen::init() { - app.DebugPrintf("TitleScreen::init() START\n"); + Log::info("TitleScreen::init() START\n"); // 4jcraft: this is for the blured panorama background viewportTexture = @@ -141,31 +143,31 @@ if (c.get(Calendar.MONTH) + 1 == 11 && c.get(Calendar.DAY_OF_MONTH) == 9) { void TitleScreen::buttonClicked(Button* button) { if (button->id == 0) { - app.DebugPrintf( + Log::info( "TitleScreen::buttonClicked() 'Options...' if (button->id == 0)\n"); minecraft->setScreen(new OptionsScreen(this, minecraft->options)); } if (button->id == 1) { - app.DebugPrintf( + Log::info( "TitleScreen::buttonClicked() 'Singleplayer' if (button->id == " "1)\n"); minecraft->setScreen(new SelectWorldScreen(this)); } if (button->id == 2) { - app.DebugPrintf( + Log::info( "TitleScreen::buttonClicked() 'Multiplayer' if (button->id == " "2)\n"); minecraft->setScreen(new JoinMultiplayerScreen(this)); } if (button->id == 3) { - app.DebugPrintf( + Log::info( "TitleScreen::buttonClicked() 'Texture Pack' if (button->id == " "3)\n"); // minecraft->setScreen(new TexturePackSelectScreen(this)); // // 4J - TODO put back in } if (button->id == 4) { - app.DebugPrintf( + Log::info( "TitleScreen::buttonClicked() Exit Game if (button->id == 4)\n"); RenderManager.Close(); // minecraft->stop(); } diff --git a/targets/minecraft/commands/CommandDispatcher.cpp b/targets/minecraft/commands/CommandDispatcher.cpp index 634d6d371..87037c66f 100644 --- a/targets/minecraft/commands/CommandDispatcher.cpp +++ b/targets/minecraft/commands/CommandDispatcher.cpp @@ -1,3 +1,4 @@ +#include "minecraft/util/Log.h" #include "CommandDispatcher.h" #include @@ -24,7 +25,7 @@ int CommandDispatcher::performCommand(std::shared_ptr sender, #endif } } else { - app.DebugPrintf("Command %d not found!\n", command); + Log::info("Command %d not found!\n", command); } return 0; diff --git a/targets/minecraft/core/ItemDispenseBehaviors.cpp b/targets/minecraft/core/ItemDispenseBehaviors.cpp index e9b6aaac9..f3754bfee 100644 --- a/targets/minecraft/core/ItemDispenseBehaviors.cpp +++ b/targets/minecraft/core/ItemDispenseBehaviors.cpp @@ -1,9 +1,10 @@ +#include "minecraft/IGameServices.h" #include "ItemDispenseBehaviors.h" #include #include -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/linux/LinuxGame.h" #include "java/Class.h" #include "java/Random.h" @@ -448,7 +449,7 @@ std::shared_ptr TntDispenseBehavior::execute( Level* world = source->getWorld(); if (world->newPrimedTntAllowed() && - app.GetGameHostOption(eGameHostOption_TNT)) { + gameServices().getGameHostOption(eGameHostOption_TNT)) { int targetX = source->getBlockX() + facing->getStepX(); int targetY = source->getBlockY() + facing->getStepY(); int targetZ = source->getBlockZ() + facing->getStepZ(); diff --git a/targets/minecraft/network/Connection.cpp b/targets/minecraft/network/Connection.cpp index 2b049ccd1..9a77e473b 100644 --- a/targets/minecraft/network/Connection.cpp +++ b/targets/minecraft/network/Connection.cpp @@ -7,9 +7,9 @@ #include #include "platform/ShutdownManager.h" -#include "app/common/src/Network/GameNetworkManager.h" -#include "app/common/src/Network/NetworkPlayerInterface.h" -#include "app/common/src/Network/Socket.h" +#include "app/common/Network/GameNetworkManager.h" +#include "app/common/Network/NetworkPlayerInterface.h" +#include "app/common/Network/Socket.h" #include "util/StringHelpers.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "java/InputOutputStream/BufferedOutputStream.h" diff --git a/targets/minecraft/network/Connection.h b/targets/minecraft/network/Connection.h index af77b3ddc..c38b5a808 100644 --- a/targets/minecraft/network/Connection.h +++ b/targets/minecraft/network/Connection.h @@ -7,7 +7,7 @@ #include #include -#include "app/common/src/Network/Socket.h" +#include "app/common/Network/Socket.h" #include "app/linux/Stubs/winapi_stubs.h" #include "platform/C4JThread.h" #include "java/InputOutputStream/DataInputStream.h" diff --git a/targets/minecraft/network/packet/BlockRegionUpdatePacket.cpp b/targets/minecraft/network/packet/BlockRegionUpdatePacket.cpp index 3872f8c1b..035cfdb9a 100644 --- a/targets/minecraft/network/packet/BlockRegionUpdatePacket.cpp +++ b/targets/minecraft/network/packet/BlockRegionUpdatePacket.cpp @@ -1,3 +1,4 @@ +#include "minecraft/util/Log.h" #include "BlockRegionUpdatePacket.h" #include @@ -74,7 +75,7 @@ BlockRegionUpdatePacket::BlockRegionUpdatePacket(int x, int y, int z, int xs, Compression::getCompression()->CompressLZXRLE( ucTemp, &inputSize, rawBuffer.data(), (unsigned int)rawBuffer.size()); - // app.DebugPrintf("Chunk (%d,%d) compressed from %d to size %d\n", + // Log::info("Chunk (%d,%d) compressed from %d to size %d\n", // x>>4, z>>4, rawBuffer.size(), inputSize); unsigned char* ucTemp2 = new unsigned char[inputSize]; memcpy(ucTemp2, ucTemp, inputSize); @@ -118,7 +119,7 @@ void BlockRegionUpdatePacket::read(DataInputStream* dis) // throws IOException Compression::getCompression()->DecompressLZXRLE( buffer.data(), &outputSize, compressedBuffer.data(), size); } else { - app.DebugPrintf( + Log::info( "Not decompressing packet that wasn't fully read\n"); } diff --git a/targets/minecraft/network/packet/CustomPayloadPacket.cpp b/targets/minecraft/network/packet/CustomPayloadPacket.cpp index 72ccc7bb3..66f373aec 100644 --- a/targets/minecraft/network/packet/CustomPayloadPacket.cpp +++ b/targets/minecraft/network/packet/CustomPayloadPacket.cpp @@ -1,3 +1,4 @@ +#include "minecraft/util/Log.h" #include "CustomPayloadPacket.h" #include @@ -30,7 +31,7 @@ CustomPayloadPacket::CustomPayloadPacket(const std::wstring& identifier, length = data.size(); if (length > std::numeric_limits::max()) { - app.DebugPrintf("Payload may not be larger than 32K\n"); + Log::info("Payload may not be larger than 32K\n"); #ifndef _CONTENT_PACKAGE __debugbreak(); #endif diff --git a/targets/minecraft/network/packet/GameCommandPacket.cpp b/targets/minecraft/network/packet/GameCommandPacket.cpp index 13fadd380..71944da60 100644 --- a/targets/minecraft/network/packet/GameCommandPacket.cpp +++ b/targets/minecraft/network/packet/GameCommandPacket.cpp @@ -1,3 +1,4 @@ +#include "minecraft/util/Log.h" #include "GameCommandPacket.h" #include @@ -23,7 +24,7 @@ GameCommandPacket::GameCommandPacket(EGameCommand command, length = data.size(); if (length > std::numeric_limits::max()) { - app.DebugPrintf("Payload may not be larger than 32K\n"); + Log::info("Payload may not be larger than 32K\n"); #ifndef _CONTENT_PACKAGE __debugbreak(); #endif diff --git a/targets/minecraft/network/packet/LoginPacket.cpp b/targets/minecraft/network/packet/LoginPacket.cpp index 58e5bd641..6823437ad 100644 --- a/targets/minecraft/network/packet/LoginPacket.cpp +++ b/targets/minecraft/network/packet/LoginPacket.cpp @@ -1,3 +1,4 @@ +#include "minecraft/util/Log.h" #include "LoginPacket.h" #include "app/linux/LinuxGame.h" @@ -131,7 +132,7 @@ void LoginPacket::read(DataInputStream* dis) // throws IOException m_xzSize = dis->readShort(); m_hellScale = dis->read(); #endif - app.DebugPrintf("LoginPacket::read - Difficulty = %d\n", difficulty); + Log::info("LoginPacket::read - Difficulty = %d\n", difficulty); } void LoginPacket::write(DataOutputStream* dos) // throws IOException diff --git a/targets/minecraft/network/packet/Packet.cpp b/targets/minecraft/network/packet/Packet.cpp index bd77f0cd7..d2eb450c2 100644 --- a/targets/minecraft/network/packet/Packet.cpp +++ b/targets/minecraft/network/packet/Packet.cpp @@ -1,3 +1,4 @@ +#include "minecraft/util/Log.h" #include "Packet.h" #include @@ -465,7 +466,7 @@ void Packet::writeBytes(DataOutputStream* dataoutputstream, std::vector Packet::readBytes(DataInputStream* datainputstream) { int size = datainputstream->readShort(); if (size < 0) { - app.DebugPrintf("Key was smaller than nothing! Weird key!"); + Log::info("Key was smaller than nothing! Weird key!"); #if !defined(_CONTENT_PACKAGE) __debugbreak(); #endif @@ -515,7 +516,7 @@ std::shared_ptr Packet::readPacket( serverReceivedPackets.find(id) == serverReceivedPackets.end()) || (!isServer && clientReceivedPackets.find(id) == clientReceivedPackets.end())) { - // app.DebugPrintf("Bad packet id %d\n", id); + // Log::info("Bad packet id %d\n", id); __debugbreak(); assert(false); // throw new IOException(wstring(L"Bad packet id ") + @@ -527,7 +528,7 @@ std::shared_ptr Packet::readPacket( assert(false); // throw new IOException(wstring(L"Bad packet id ") + // toWString(id)); - // app.DebugPrintf("%s reading packet %d\n", isServer ? "Server" : "Client", + // Log::info("%s reading packet %d\n", isServer ? "Server" : "Client", // packet->getId()); packet->read(dis); // } @@ -563,7 +564,7 @@ void Packet::writePacket( DataOutputStream* dos) // throws IOException TODO 4J JEV, should this declare a throws? { - // app.DebugPrintf("Writing packet %d\n", packet->getId()); + // Log::info("Writing packet %d\n", packet->getId()); dos->write(packet->getId()); packet->write(dos); } diff --git a/targets/minecraft/network/packet/PlayerInfoPacket.cpp b/targets/minecraft/network/packet/PlayerInfoPacket.cpp index a85ee6d89..7ea79b2a3 100644 --- a/targets/minecraft/network/packet/PlayerInfoPacket.cpp +++ b/targets/minecraft/network/packet/PlayerInfoPacket.cpp @@ -1,4 +1,4 @@ -#include "app/common/src/Network/NetworkPlayerInterface.h" +#include "app/common/Network/NetworkPlayerInterface.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/network/packet/PacketListener.h" diff --git a/targets/minecraft/network/packet/PreLoginPacket.cpp b/targets/minecraft/network/packet/PreLoginPacket.cpp index e5542db9b..3cb9a859b 100644 --- a/targets/minecraft/network/packet/PreLoginPacket.cpp +++ b/targets/minecraft/network/packet/PreLoginPacket.cpp @@ -1,11 +1,12 @@ +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "PreLoginPacket.h" #include #include -#include "app/common/src/BuildVer/BuildVer.h" +#include "app/common/BuildVer/BuildVer.h" #include "platform/IPlatformNetwork.h" -#include "app/linux/LinuxGame.h" #include "app/linux/Stubs/winapi_stubs.h" #include "PacketListener.h" #include "java/InputOutputStream/DataInputStream.h" @@ -82,7 +83,7 @@ void PreLoginPacket::read(DataInputStream* dis) // throws IOException m_texturePackId = static_cast(dis->readInt()); // Set the name of the map so we can check it for players banned lists - app.SetUniqueMapName((char*)m_szUniqueSaveName); + gameServices().setUniqueMapName((char*)m_szUniqueSaveName); } void PreLoginPacket::write(DataOutputStream* dos) // throws IOException @@ -98,7 +99,7 @@ void PreLoginPacket::write(DataOutputStream* dos) // throws IOException dos->writePlayerUID(m_playerXuids[i]); } - app.DebugPrintf("*** PreLoginPacket::write - %s\n", m_szUniqueSaveName); + Log::info("*** PreLoginPacket::write - %s\n", m_szUniqueSaveName); for (int i = 0; i < m_iSaveNameLen; ++i) { dos->writeByte(static_cast(m_szUniqueSaveName[i])); } diff --git a/targets/minecraft/network/packet/RespawnPacket.cpp b/targets/minecraft/network/packet/RespawnPacket.cpp index 25b9bcc83..91e7cb3df 100644 --- a/targets/minecraft/network/packet/RespawnPacket.cpp +++ b/targets/minecraft/network/packet/RespawnPacket.cpp @@ -1,3 +1,4 @@ +#include "minecraft/util/Log.h" #include "RespawnPacket.h" #include @@ -37,7 +38,7 @@ RespawnPacket::RespawnPacket(char dimension, int64_t mapSeed, int mapHeight, this->m_newEntityId = newEntityId; m_xzSize = xzSize; m_hellScale = hellScale; - app.DebugPrintf("RespawnPacket - Difficulty = %d\n", difficulty); + Log::info("RespawnPacket - Difficulty = %d\n", difficulty); } void RespawnPacket::handle(PacketListener* listener) { @@ -62,7 +63,7 @@ void RespawnPacket::read(DataInputStream* dis) // throws IOException m_xzSize = dis->readShort(); m_hellScale = dis->read(); #endif - app.DebugPrintf("RespawnPacket::read - Difficulty = %d\n", difficulty); + Log::info("RespawnPacket::read - Difficulty = %d\n", difficulty); } void RespawnPacket::write(DataOutputStream* dos) // throws IOException diff --git a/targets/minecraft/network/packet/ServerSettingsChangedPacket.cpp b/targets/minecraft/network/packet/ServerSettingsChangedPacket.cpp index 9f8ac9a13..80bc466de 100644 --- a/targets/minecraft/network/packet/ServerSettingsChangedPacket.cpp +++ b/targets/minecraft/network/packet/ServerSettingsChangedPacket.cpp @@ -1,3 +1,4 @@ +#include "minecraft/util/Log.h" #include "ServerSettingsChangedPacket.h" #include "PacketListener.h" @@ -20,7 +21,7 @@ ServerSettingsChangedPacket::ServerSettingsChangedPacket(char action, this->action = action; this->data = data; - // app.DebugPrintf("ServerSettingsChangedPacket - Difficulty = + // Log::info("ServerSettingsChangedPacket - Difficulty = // %d",difficulty); } diff --git a/targets/minecraft/network/packet/SetPlayerTeamPacket.cpp b/targets/minecraft/network/packet/SetPlayerTeamPacket.cpp index 8d79d076d..cd5448d2e 100644 --- a/targets/minecraft/network/packet/SetPlayerTeamPacket.cpp +++ b/targets/minecraft/network/packet/SetPlayerTeamPacket.cpp @@ -1,3 +1,4 @@ +#include "minecraft/util/Log.h" #include "SetPlayerTeamPacket.h" #include @@ -40,13 +41,13 @@ SetPlayerTeamPacket::SetPlayerTeamPacket(PlayerTeam* team, std::vector* playerNames, int method) { if (method != METHOD_JOIN && method != METHOD_LEAVE) { - app.DebugPrintf("Method must be join or leave for player constructor"); + Log::info("Method must be join or leave for player constructor"); #ifndef _CONTENT_PACKAGE __debugbreak(); #endif } if (playerNames == nullptr || playerNames->empty()) { - app.DebugPrintf("Players cannot be null/empty"); + Log::info("Players cannot be null/empty"); #ifndef _CONTENT_PACKAGE __debugbreak(); #endif diff --git a/targets/minecraft/network/packet/TextureAndGeometryPacket.cpp b/targets/minecraft/network/packet/TextureAndGeometryPacket.cpp index 13b72c513..b1348769b 100644 --- a/targets/minecraft/network/packet/TextureAndGeometryPacket.cpp +++ b/targets/minecraft/network/packet/TextureAndGeometryPacket.cpp @@ -4,7 +4,7 @@ #include #include "app/common/Minecraft_Macros.h" -#include "app/common/src/DLC/DLCSkinFile.h" +#include "app/common/DLC/DLCSkinFile.h" #include "PacketListener.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" diff --git a/targets/minecraft/network/packet/TextureAndGeometryPacket.h b/targets/minecraft/network/packet/TextureAndGeometryPacket.h index 0a4c0908a..5247b5547 100644 --- a/targets/minecraft/network/packet/TextureAndGeometryPacket.h +++ b/targets/minecraft/network/packet/TextureAndGeometryPacket.h @@ -5,7 +5,7 @@ #include #include -#include "app/include/SkinBox.h" +#include "minecraft/client/model/SkinBox.h" #include "Packet.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/network/packet/Packet.h" diff --git a/targets/minecraft/network/packet/UpdateGameRuleProgressPacket.h b/targets/minecraft/network/packet/UpdateGameRuleProgressPacket.h index aee4f5b6d..4cf9694ed 100644 --- a/targets/minecraft/network/packet/UpdateGameRuleProgressPacket.h +++ b/targets/minecraft/network/packet/UpdateGameRuleProgressPacket.h @@ -6,7 +6,7 @@ #include #include -#include "app/common/src/GameRules/ConsoleGameRulesConstants.h" +#include "app/common/GameRules/ConsoleGameRulesConstants.h" #include "Packet.h" #include "minecraft/network/packet/Packet.h" diff --git a/targets/minecraft/server/MinecraftServer.cpp b/targets/minecraft/server/MinecraftServer.cpp index e022c7eec..a58e9a2ef 100644 --- a/targets/minecraft/server/MinecraftServer.cpp +++ b/targets/minecraft/server/MinecraftServer.cpp @@ -1,3 +1,5 @@ +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "MinecraftServer.h" #include @@ -15,11 +17,11 @@ #include "platform/sdl2/Storage.h" #include "ConsoleInput.h" #include "DispenserBootstrap.h" -#include "app/common/App_enums.h" -#include "app/common/src/GameRules/GameRuleManager.h" -#include "app/common/src/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/common/src/Network/GameNetworkManager.h" -#include "app/common/src/Network/NetworkPlayerInterface.h" +#include "minecraft/GameEnums.h" +#include "app/common/GameRules/GameRuleManager.h" +#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "app/common/Network/GameNetworkManager.h" +#include "app/common/Network/NetworkPlayerInterface.h" #include "app/linux/LinuxGame.h" #include "PlayerList.h" #include "Settings.h" @@ -66,10 +68,10 @@ #endif #include "platform/sdl2/Input.h" #include "platform/ShutdownManager.h" -#include "app/common/src/Console_Debug_enum.h" -#include "app/common/src/GameRules/LevelGeneration/ConsoleSchematicFile.h" -#include "app/common/src/Network/Socket.h" -#include "app/common/src/UI/All Platforms/UIStructs.h" +#include "app/common/Console_Debug_enum.h" +#include "app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h" +#include "app/common/Network/Socket.h" +#include "app/common/UI/All Platforms/UIStructs.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/ProgressRenderer.h" @@ -147,30 +149,30 @@ bool MinecraftServer::initServer(int64_t seed, NetworkGameInitData* initData, // 4J - removed settings = new Settings(new File(L"server.properties")); - app.DebugPrintf("\n*** SERVER SETTINGS ***\n"); - app.DebugPrintf( + Log::info("\n*** SERVER SETTINGS ***\n"); + Log::info( "ServerSettings: host-friends-only is %s\n", - (app.GetGameHostOption(eGameHostOption_FriendsOfFriends) > 0) ? "on" + (gameServices().getGameHostOption(eGameHostOption_FriendsOfFriends) > 0) ? "on" : "off"); - app.DebugPrintf("ServerSettings: game-type is %s\n", - (app.GetGameHostOption(eGameHostOption_GameType) == 0) + Log::info("ServerSettings: game-type is %s\n", + (gameServices().getGameHostOption(eGameHostOption_GameType) == 0) ? "Survival Mode" : "Creative Mode"); - app.DebugPrintf( + Log::info( "ServerSettings: pvp is %s\n", - (app.GetGameHostOption(eGameHostOption_PvP) > 0) ? "on" : "off"); - app.DebugPrintf("ServerSettings: fire spreads is %s\n", - (app.GetGameHostOption(eGameHostOption_FireSpreads) > 0) + (gameServices().getGameHostOption(eGameHostOption_PvP) > 0) ? "on" : "off"); + Log::info("ServerSettings: fire spreads is %s\n", + (gameServices().getGameHostOption(eGameHostOption_FireSpreads) > 0) ? "on" : "off"); - app.DebugPrintf( + Log::info( "ServerSettings: tnt explodes is %s\n", - (app.GetGameHostOption(eGameHostOption_TNT) > 0) ? "on" : "off"); - app.DebugPrintf("\n"); + (gameServices().getGameHostOption(eGameHostOption_TNT) > 0) ? "on" : "off"); + Log::info("\n"); // TODO 4J Stu - Init a load of settings based on data passed as params // settings->setBooleanAndSave( L"host-friends-only", - // (app.GetGameHostOption(eGameHostOption_FriendsOfFriends)>0) ); + // (gameServices().getGameHostOption(eGameHostOption_FriendsOfFriends)>0) ); // 4J - Unused // localIp = settings->getString(L"server-ip", L""); @@ -180,7 +182,7 @@ bool MinecraftServer::initServer(int64_t seed, NetworkGameInitData* initData, setAnimals(settings->getBoolean(L"spawn-animals", true)); setNpcsEnabled(settings->getBoolean(L"spawn-npcs", true)); - setPvpAllowed(app.GetGameHostOption(eGameHostOption_PvP) > 0 + setPvpAllowed(gameServices().getGameHostOption(eGameHostOption_PvP) > 0 ? true : false); // settings->getBoolean(L"pvp", true); @@ -200,12 +202,12 @@ bool MinecraftServer::initServer(int64_t seed, NetworkGameInitData* initData, setPlayers(new PlayerList(this)); // 4J-JEV: Need to wait for levelGenerationOptions to load. - while (app.getLevelGenerationOptions() != nullptr && - !app.getLevelGenerationOptions()->hasLoadedData()) + while (gameServices().getLevelGenerationOptions() != nullptr && + !gameServices().getLevelGenerationOptions()->hasLoadedData()) std::this_thread::sleep_for(std::chrono::milliseconds(1)); - if (app.getLevelGenerationOptions() != nullptr && - !app.getLevelGenerationOptions()->ready()) { + if (gameServices().getLevelGenerationOptions() != nullptr && + !gameServices().getLevelGenerationOptions()->ready()) { // TODO: Stop loading, add error message. } @@ -215,12 +217,12 @@ bool MinecraftServer::initServer(int64_t seed, NetworkGameInitData* initData, std::wstring levelTypeString; bool gameRuleUseFlatWorld = false; - if (app.getLevelGenerationOptions() != nullptr) { + if (gameServices().getLevelGenerationOptions() != nullptr) { gameRuleUseFlatWorld = - app.getLevelGenerationOptions()->getuseFlatWorld(); + gameServices().getLevelGenerationOptions()->getuseFlatWorld(); } if (gameRuleUseFlatWorld || - app.GetGameHostOption(eGameHostOption_LevelType) > 0) { + gameServices().getGameHostOption(eGameHostOption_LevelType) > 0) { levelTypeString = settings->getString(L"level-type", L"flat"); } else { levelTypeString = settings->getString(L"level-type", L"default"); @@ -376,16 +378,16 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, int gameTypeId = settings->getInt( L"gamemode", - app.GetGameHostOption( + gameServices().getGameHostOption( eGameHostOption_GameType)); // LevelSettings::GAMETYPE_SURVIVAL); GameType* gameType = LevelSettings::validateGameType(gameTypeId); - app.DebugPrintf("Default game type: %d\n", gameTypeId); + Log::info("Default game type: %d\n", gameTypeId); LevelSettings* levelSettings = new LevelSettings( levelSeed, gameType, - app.GetGameHostOption(eGameHostOption_Structures) > 0 ? true : false, + gameServices().getGameHostOption(eGameHostOption_Structures) > 0 ? true : false, isHardcore(), true, pLevelType, initData->xzSize, initData->hellScale); - if (app.GetGameHostOption(eGameHostOption_BonusChest)) + if (gameServices().getGameHostOption(eGameHostOption_BonusChest)) levelSettings->enableStartingBonusItems(); // 4J - temp - load existing level @@ -418,7 +420,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, // We are loading a save from the storage manager #if defined(SPLIT_SAVES) bool bLevelGenBaseSave = false; - LevelGenerationOptions* levelGen = app.getLevelGenerationOptions(); + LevelGenerationOptions* levelGen = gameServices().getLevelGenerationOptions(); if (levelGen != nullptr && levelGen->requiresBaseSave()) { unsigned int fileSize = 0; std::uint8_t* pvSaveData = levelGen->getBaseSaveData(fileSize); @@ -457,9 +459,9 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, if (i == 0) { levels[i] = new ServerLevel(this, storage, name, dimension, levelSettings); - if (app.getLevelGenerationOptions() != nullptr) { + if (gameServices().getLevelGenerationOptions() != nullptr) { LevelGenerationOptions* mapOptions = - app.getLevelGenerationOptions(); + gameServices().getLevelGenerationOptions(); Pos* spawnPos = mapOptions->getSpawnPos(); if (spawnPos != nullptr) { levels[i]->setSpawnPos(spawnPos); @@ -481,9 +483,9 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, // ? Difficulty::EASY : Difficulty::PEACEFUL; Minecraft* pMinecraft = Minecraft::GetInstance(); // m_lastSentDifficulty = pMinecraft->options->difficulty; - levels[i]->difficulty = app.GetGameHostOption( + levels[i]->difficulty = gameServices().getGameHostOption( eGameHostOption_Difficulty); // pMinecraft->options->difficulty; - app.DebugPrintf("MinecraftServer::loadLevel - Difficulty = %d\n", + Log::info("MinecraftServer::loadLevel - Difficulty = %d\n", levels[i]->difficulty); #if DEBUG_SERVER_DONT_SPAWN_MOBS @@ -494,9 +496,9 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, #endif levels[i]->getLevelData()->setGameType(gameType); - if (app.getLevelGenerationOptions() != nullptr) { + if (gameServices().getLevelGenerationOptions() != nullptr) { LevelGenerationOptions* mapOptions = - app.getLevelGenerationOptions(); + gameServices().getLevelGenerationOptions(); levels[i]->getLevelData()->setHasBeenInCreative( mapOptions->getLevelHasBeenInCreative()); } @@ -509,10 +511,10 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, } else { mcprogress->progressStage(IDS_PROGRESS_LOADING_SPAWN_AREA); } - app.SetGameHostOption( + gameServices().setGameHostOption( eGameHostOption_HasBeenInCreative, gameType == GameType::CREATIVE || levels[0]->getHasBeenInCreative()); - app.SetGameHostOption(eGameHostOption_Structures, + gameServices().setGameHostOption(eGameHostOption_Structures, levels[0]->isGenerateMapFeatures()); if (s_bServerHalted || !g_NetworkManager.IsInSession()) return false; @@ -552,14 +554,14 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, &numberOfBytesRead); assert(numberOfBytesRead == ba_gameRules.size()); - app.m_gameRules.loadGameRules(ba_gameRules.data(), ba_gameRules.size()); + gameServices().loadGameRules(ba_gameRules.data(), ba_gameRules.size()); csf->closeHandle(fe); } int64_t lastTime = System::currentTimeMillis(); #if defined(_LARGE_WORLDS) - if (app.GetGameNewWorldSize() > levels[0]->getLevelData()->getXZSizeOld()) { - if (!app.GetGameNewWorldSizeUseMoat()) // check the moat settings to + if (gameServices().getGameNewWorldSize() > levels[0]->getLevelData()->getXZSizeOld()) { + if (!gameServices().getGameNewWorldSizeUseMoat()) // check the moat settings to // see if we should be // overwriting the edge tiles { @@ -646,29 +648,29 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, // stronghold position? if (levels[0]->dimension->id == 0) { - app.DebugPrintf("===================================\n"); + Log::info("===================================\n"); if (!levels[0]->getLevelData()->getHasStronghold()) { int x, z; - if (app.GetTerrainFeaturePosition(eTerrainFeature_Stronghold, &x, + if (gameServices().getTerrainFeaturePosition(eTerrainFeature_Stronghold, &x, &z)) { levels[0]->getLevelData()->setXStronghold(x); levels[0]->getLevelData()->setZStronghold(z); levels[0]->getLevelData()->setHasStronghold(); - app.DebugPrintf( + Log::info( "=== FOUND stronghold in terrain features list\n"); } else { // can't find the stronghold position in the terrain feature // list. Do we have to run a post-process? - app.DebugPrintf( + Log::info( "=== Can't find stronghold in terrain features list\n"); } } else { - app.DebugPrintf("=== Leveldata has stronghold position\n"); + Log::info("=== Leveldata has stronghold position\n"); } - app.DebugPrintf("===================================\n"); + Log::info("===================================\n"); } // printf("Post processing complete at %dms\n",System::currentTimeMillis() @@ -724,7 +726,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, void MinecraftServer::overwriteBordersForNewWorldSize(ServerLevel* level) { // recreate the chunks round the border (2 chunks or 32 blocks deep), // deleting any player data from them - app.DebugPrintf("Expanding level size\n"); + Log::info("Expanding level size\n"); int oldSize = level->getLevelData()->getXZSizeOld(); // top int minVal = -oldSize / 2; @@ -758,7 +760,7 @@ void MinecraftServer::overwriteHellBordersForNewWorldSize(ServerLevel* level, int oldHellSize) { // recreate the chunks round the border (1 chunk or 16 blocks deep), // deleting any player data from them - app.DebugPrintf("Expanding level size\n"); + Log::info("Expanding level size\n"); // top int minVal = -oldHellSize / 2; int maxVal = (oldHellSize / 2) - 1; @@ -829,8 +831,8 @@ void MinecraftServer::saveAllChunks() { // 4J-JEV: Added void MinecraftServer::saveGameRules() { #if !defined(_CONTENT_PACKAGE) - if (app.DebugSettingsOn() && - app.GetGameSettingsDebugMask(InputManager.GetPrimaryPad()) & + if (gameServices().debugSettingsOn() && + gameServices().debugGetMask(InputManager.GetPrimaryPad()) & (1L << eDebugSetting_DistributableSave)) { // Do nothing } else @@ -838,7 +840,7 @@ void MinecraftServer::saveGameRules() { { uint8_t* baPtr = nullptr; unsigned int baSize = 0; - app.m_gameRules.saveGameRules(&baPtr, &baSize); + gameServices().saveGameRules(&baPtr, &baSize); if (baPtr != nullptr) { std::vector ba(baPtr, baPtr + baSize); @@ -878,7 +880,7 @@ void MinecraftServer::Suspend() { } m_suspending = false; - app.DebugPrintf("Suspend server: Elapsed time %f\n", + Log::info("Suspend server: Elapsed time %f\n", static_cast(timer.elapsed_seconds())); } @@ -893,7 +895,7 @@ void MinecraftServer::stopServer(bool didInit) { connection->stop(); - app.DebugPrintf("Stopping server\n"); + Log::info("Stopping server\n"); // logger.info("Stopping server"); // 4J-PB - If the primary player has signed out, then don't attempt to save // anything @@ -924,7 +926,7 @@ void MinecraftServer::stopServer(bool didInit) { //} saveGameRules(); - app.m_gameRules.unloadCurrentGameRules(); + gameServices().unloadCurrentGameRules(); if (levels[0] != nullptr) // This can be null if stopServer happens // very quickly due to network error { @@ -1061,7 +1063,7 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) { bool findSeed = false; if (lpParameter != nullptr) { initData = (NetworkGameInitData*)lpParameter; - initSettings = app.GetGameHostOption(eGameHostOption_All); + initSettings = gameServices().getGameHostOption(eGameHostOption_All); findSeed = initData->findSeed; m_texturePackId = initData->texturePackId; } @@ -1077,7 +1079,7 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) { if (pLevelData && pLevelData->getHasStronghold() == false) { int x, z; - if (app.GetTerrainFeaturePosition(eTerrainFeature_Stronghold, &x, + if (gameServices().getTerrainFeaturePosition(eTerrainFeature_Stronghold, &x, &z)) { pLevelData->setXStronghold(x); pLevelData->setZStronghold(z); @@ -1180,13 +1182,13 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) { eXuiServerAction eAction; void* param; for (int i = 0; i < XUSER_MAX_COUNT; i++) { - eAction = app.GetXuiServerAction(i); - param = app.GetXuiServerActionParam(i); + eAction = gameServices().getXuiServerAction(i); + param = gameServices().getXuiServerActionParam(i); switch (eAction) { case eXuiServerAction_AutoSaveGame: case eXuiServerAction_SaveGame: - app.lockSaveNotification(); + gameServices().lockSaveNotification(); if (players != nullptr) { players->saveAll( Minecraft::GetInstance()->progressRenderer); @@ -1221,7 +1223,7 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) { Minecraft::GetInstance()->progressRenderer, (eAction == eXuiServerAction_AutoSaveGame)); } - app.unlockSaveNotification(); + gameServices().unlockSaveNotification(); break; case eXuiServerAction_DropItem: // Find the player, and drop the id at their feet @@ -1279,7 +1281,7 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) { std::shared_ptr( new ServerSettingsChangedPacket( ServerSettingsChangedPacket::HOST_OPTIONS, - app.GetGameHostOption( + gameServices().getGameHostOption( eGameHostOption_Gamertags)))); break; case eXuiServerAction_ServerSettingChanged_BedrockFog: @@ -1288,7 +1290,7 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) { new ServerSettingsChangedPacket( ServerSettingsChangedPacket:: HOST_IN_GAME_SETTINGS, - app.GetGameHostOption( + gameServices().getGameHostOption( eGameHostOption_All)))); break; @@ -1302,7 +1304,7 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) { break; case eXuiServerAction_ExportSchematic: #if !defined(_CONTENT_PACKAGE) - app.lockSaveNotification(); + gameServices().lockSaveNotification(); // players->broadcastAll( // shared_ptr( new @@ -1336,7 +1338,7 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) { delete initData; } - app.unlockSaveNotification(); + gameServices().unlockSaveNotification(); #endif break; case eXuiServerAction_SetCameraLocation: @@ -1345,8 +1347,8 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) { DebugSetCameraPosition* pos = (DebugSetCameraPosition*)param; - app.DebugPrintf("DEBUG: Player=%i\n", pos->player); - app.DebugPrintf( + Log::info("DEBUG: Player=%i\n", pos->player); + Log::info( "DEBUG: Teleporting to pos=(%f.2, %f.2, %f.2), " "looking at=(%f.2,%f.2)\n", pos->m_camX, pos->m_camY, pos->m_camZ, pos->m_yRot, @@ -1369,7 +1371,7 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) { break; } - app.SetXuiServerAction(i, eXuiServerAction_Idle); + gameServices().setXuiServerAction(i, eXuiServerAction_Idle); } std::this_thread::sleep_for(std::chrono::milliseconds(1)); @@ -1438,7 +1440,7 @@ void MinecraftServer::tick() { // 4J Stu - We set the levels difficulty based on the minecraft // options - level->difficulty = app.GetGameHostOption( + level->difficulty = gameServices().getGameHostOption( eGameHostOption_Difficulty); // pMinecraft->options->difficulty; #if DEBUG_SERVER_DONT_SPAWN_MOBS @@ -1584,10 +1586,10 @@ void MinecraftServer::chunkPacketManagement_DidSendTo(INetworkPlayer* player) { if ((currentTime - s_tickStartTime) >= MAX_TICK_TIME_FOR_PACKET_SENDS) { s_hasSentEnoughPackets = true; - // app.DebugPrintf("Sending, setting enough packet flag: + // Log::info("Sending, setting enough packet flag: //%dms\n",currentTime - s_tickStartTime); } else { - // app.DebugPrintf("Sending, more time: %dms\n",currentTime + // Log::info("Sending, more time: %dms\n",currentTime //- s_tickStartTime); } @@ -1597,7 +1599,7 @@ void MinecraftServer::chunkPacketManagement_DidSendTo(INetworkPlayer* player) { } void MinecraftServer::chunkPacketManagement_PreTick() { - // app.DebugPrintf("*************************************************************************************************************************************************************************\n"); + // Log::info("*************************************************************************************************************************************************************************\n"); s_hasSentEnoughPackets = false; s_tickStartTime = System::currentTimeMillis(); s_sentTo.clear(); @@ -1640,7 +1642,7 @@ bool MinecraftServer::chunkPacketManagement_CanSendTo(INetworkPlayer* player) { auto now = time_util::clock::now(); if (player->GetSessionIndex() == s_slowQueuePlayerIndex && (now - s_slowQueueLastTime) > std::chrono::milliseconds(MINECRAFT_SERVER_SLOW_QUEUE_DELAY)) { - // app.DebugPrintf("Slow queue OK for player #%d\n", + // Log::info("Slow queue OK for player #%d\n", // player->GetSessionIndex()); return true; } @@ -1660,7 +1662,7 @@ void MinecraftServer::chunkPacketManagement_PostTick() { auto now = time_util::clock::now(); if ((s_slowQueuePacketSent) || ((now - s_slowQueueLastTime) > std::chrono::milliseconds(2 * MINECRAFT_SERVER_SLOW_QUEUE_DELAY))) { - // app.DebugPrintf("Considering cycling: (%d) %d - %d -> %d + // Log::info("Considering cycling: (%d) %d - %d -> %d //> %d\n",s_slowQueuePacketSent, time, s_slowQueueLastTime, (time - // s_slowQueueLastTime), (2*MINECRAFT_SERVER_SLOW_QUEUE_DELAY)); MinecraftServer::cycleSlowQueueIndex(); @@ -1669,7 +1671,7 @@ void MinecraftServer::chunkPacketManagement_PostTick() { } // else // { - // app.DebugPrintf("Not considering cycling: %d - %d -> %d > + // Log::info("Not considering cycling: %d - %d -> %d > //%d\n",time, s_slowQueueLastTime, (time - s_slowQueueLastTime), //(2*MINECRAFT_SERVER_SLOW_QUEUE_DELAY)); // } @@ -1700,7 +1702,7 @@ void MinecraftServer::cycleSlowQueueIndex() { } while (g_NetworkManager.IsInSession() && currentPlayerCount > 0 && s_slowQueuePlayerIndex != startingIndex && currentPlayer != nullptr && currentPlayer->IsLocal()); - // app.DebugPrintf("Cycled slow queue index to %d\n", + // Log::info("Cycled slow queue index to %d\n", // s_slowQueuePlayerIndex); } #endif diff --git a/targets/minecraft/server/PlayerList.cpp b/targets/minecraft/server/PlayerList.cpp index c9b00588a..21c45548d 100644 --- a/targets/minecraft/server/PlayerList.cpp +++ b/targets/minecraft/server/PlayerList.cpp @@ -1,3 +1,5 @@ +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "PlayerList.h" #include @@ -9,18 +11,18 @@ #include #include "platform/sdl2/Profile.h" -#include "app/common/App_enums.h" -#include "app/common/src/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" -#include "app/common/src/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h" -#include "app/common/src/GameRules/LevelRules/Rules/GameRulesInstance.h" -#include "app/common/src/Network/GameNetworkManager.h" -#include "app/common/src/Network/NetworkPlayerInterface.h" -#include "app/common/src/Network/Socket.h" -#include "app/common/src/Tutorial/Tutorial.h" -#include "app/common/src/Tutorial/TutorialEnum.h" +#include "minecraft/GameEnums.h" +#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h" +#include "app/common/GameRules/LevelRules/Rules/GameRulesInstance.h" +#include "app/common/Network/GameNetworkManager.h" +#include "app/common/Network/NetworkPlayerInterface.h" +#include "app/common/Network/Socket.h" +#include "app/common/Tutorial/Tutorial.h" +#include "app/common/Tutorial/TutorialEnum.h" #include "app/linux/LinuxGame.h" #include "app/linux/Stubs/winapi_stubs.h" -#include "app/include/NetTypes.h" +#include "platform/NetTypes.h" #include "MinecraftServer.h" #include "Settings.h" #include "minecraft/world/entity/player/SkinTypes.h" @@ -185,14 +187,14 @@ void PlayerList::placeNewPlayer(Connection* connection, Item::map_Id, 1, level->getAuxValueForMap(player->getXuid(), 0, centreXC, centreZC, mapScale))); - if (app.getGameRuleDefinitions() != nullptr) { - app.getGameRuleDefinitions()->postProcessPlayer(player); + if (gameServices().getGameRuleDefinitions() != nullptr) { + gameServices().getGameRuleDefinitions()->postProcessPlayer(player); } } if (!player->customTextureUrl.empty() && player->customTextureUrl.substr(0, 3).compare(L"def") != 0 && - !app.IsFileInMemoryTextures(player->customTextureUrl)) { + !gameServices().isFileInMemoryTextures(player->customTextureUrl)) { if (server->getConnection()->addPendingTextureRequest( player->customTextureUrl)) { #if !defined(_CONTENT_PACKAGE) @@ -206,14 +208,14 @@ void PlayerList::placeNewPlayer(Connection* connection, 0))); } } else if (!player->customTextureUrl.empty() && - app.IsFileInMemoryTextures(player->customTextureUrl)) { + gameServices().isFileInMemoryTextures(player->customTextureUrl)) { // Update the ref count on the memory texture data - app.AddMemoryTextureFile(player->customTextureUrl, nullptr, 0); + gameServices().addMemoryTextureFile(player->customTextureUrl, nullptr, 0); } if (!player->customTextureUrl2.empty() && player->customTextureUrl2.substr(0, 3).compare(L"def") != 0 && - !app.IsFileInMemoryTextures(player->customTextureUrl2)) { + !gameServices().isFileInMemoryTextures(player->customTextureUrl2)) { if (server->getConnection()->addPendingTextureRequest( player->customTextureUrl2)) { #if !defined(_CONTENT_PACKAGE) @@ -226,9 +228,9 @@ void PlayerList::placeNewPlayer(Connection* connection, new TexturePacket(player->customTextureUrl2, nullptr, 0))); } } else if (!player->customTextureUrl2.empty() && - app.IsFileInMemoryTextures(player->customTextureUrl2)) { + gameServices().isFileInMemoryTextures(player->customTextureUrl2)) { // Update the ref count on the memory texture data - app.AddMemoryTextureFile(player->customTextureUrl2, nullptr, 0); + gameServices().addMemoryTextureFile(player->customTextureUrl2, nullptr, 0); } player->setIsGuest(packet->m_isGuest); @@ -416,7 +418,7 @@ void PlayerList::validatePlayerSpawnPosition( // 4J Stu - Some adjustments to make sure the current players position is // correct Make sure that the player is on the ground, and in the centre x/z // of the current column - app.DebugPrintf("Original pos is %f, %f, %f in dimension %d\n", player->x, + Log::info("Original pos is %f, %f, %f in dimension %d\n", player->x, player->y, player->z, player->dimension); bool spawnForced = player->isRespawnForced(); @@ -437,14 +439,14 @@ void PlayerList::validatePlayerSpawnPosition( player->setPos(targetX, targetY, targetZ); - app.DebugPrintf("New pos is %f, %f, %f in dimension %d\n", player->x, + Log::info("New pos is %f, %f, %f in dimension %d\n", player->x, player->y, player->z, player->dimension); ServerLevel* level = server->getLevel(player->dimension); while (level->getCubes(player, &player->bb)->size() != 0) { player->setPos(player->x, player->y + 1, player->z); } - app.DebugPrintf("Final pos is %f, %f, %f in dimension %d\n", player->x, + Log::info("Final pos is %f, %f, %f in dimension %d\n", player->x, player->y, player->z, player->dimension); // 4J Stu - If we are in the nether and the above while loop has put us @@ -455,7 +457,7 @@ void PlayerList::validatePlayerSpawnPosition( // use this mechanism to force a spawn point in the overworld for players // who were in the save when the reset nether option was applied if (level->dimension->id == -1 && player->y > 125) { - app.DebugPrintf( + Log::info( "Player in the nether tried to spawn at y = %f, moving to " "overworld\n", player->y); @@ -485,7 +487,7 @@ void PlayerList::validatePlayerSpawnPosition( player->setPos(player->x, player->y + 1, player->z); } - app.DebugPrintf("Updated pos is %f, %f, %f in dimension %d\n", + Log::info("Updated pos is %f, %f, %f in dimension %d\n", player->x, player->y, player->z, player->dimension); } } @@ -557,7 +559,7 @@ void PlayerList::remove(std::shared_ptr player) { // removed, also remove mount because it's saved in the player's // save tag level->removeEntityImmediately(player->riding); - app.DebugPrintf("removing player mount"); + Log::info("removing player mount"); } level->removeEntity(player); level->getChunkMap()->remove(player); @@ -601,11 +603,11 @@ std::shared_ptr PlayerList::getPlayerForLogin( pendingConnection->connection->getSocket()->getPlayer(); if (networkPlayer != nullptr && !networkPlayer->IsHost()) { player->enableAllPlayerPrivileges( - app.GetGameHostOption(eGameHostOption_TrustPlayers) > 0); + gameServices().getGameHostOption(eGameHostOption_TrustPlayers) > 0); } // 4J Added - LevelRuleset* serverRuleDefs = app.getGameRuleDefinitions(); + LevelRuleset* serverRuleDefs = gameServices().getGameRuleDefinitions(); if (serverRuleDefs != nullptr) { player->gameMode->setGameRules( GameRuleDefinition::generateNewGameRulesInstance( @@ -661,14 +663,14 @@ std::shared_ptr PlayerList::respawn( if (isPrimary) { if (isEmptying) { - app.DebugPrintf("Emptying this dimension\n"); + Log::info("Emptying this dimension\n"); serverPlayer->getLevel()->getTracker()->clear(serverPlayer); } else { - app.DebugPrintf("Transferring... storing flags\n"); + Log::info("Transferring... storing flags\n"); serverPlayer->getLevel()->getTracker()->removeEntity(serverPlayer); } } else { - app.DebugPrintf("Not primary player\n"); + Log::info("Not primary player\n"); serverPlayer->getLevel()->getTracker()->removeEntity(serverPlayer); } @@ -816,7 +818,7 @@ std::shared_ptr PlayerList::respawn( if (Minecraft::GetInstance()->isTutorial() && (!Minecraft::GetInstance()->gameMode->getTutorial()->isStateCompleted( e_Tutorial_State_Food_Bar))) { - app.getGameRuleDefinitions()->postProcessPlayer(player); + gameServices().getGameRuleDefinitions()->postProcessPlayer(player); } if (oldDimension == 1 && player->dimension != 1) { @@ -863,14 +865,14 @@ void PlayerList::toggleDimension(std::shared_ptr player, if (isPrimary) { if (isEmptying) { - app.DebugPrintf("Toggle... Emptying this dimension\n"); + Log::info("Toggle... Emptying this dimension\n"); player->getLevel()->getTracker()->clear(player); } else { - app.DebugPrintf("Toggle... transferring\n"); + Log::info("Toggle... transferring\n"); player->getLevel()->getTracker()->removeEntity(player); } } else { - app.DebugPrintf("Toggle... Not primary player\n"); + Log::info("Toggle... Not primary player\n"); player->getLevel()->getTracker()->removeEntity(player); } @@ -1116,7 +1118,7 @@ void PlayerList::tick() { findAlivePlayerOnSystem(currentPlayer); if (newPlayer != nullptr) { receiveAllPlayers[dim][i] = newPlayer; - app.DebugPrintf( + Log::info( "Replacing primary player %ls with %ls in dimension " "%d\n", currentPlayer->name.c_str(), newPlayer->name.c_str(), @@ -1165,9 +1167,9 @@ bool PlayerList::isWhiteListed(const std::wstring& name) { return true; } bool PlayerList::isOp(const std::wstring& name) { return false; } bool PlayerList::isOp(std::shared_ptr player) { - bool cheatsEnabled = app.GetGameHostOption(eGameHostOption_CheatsEnabled); + bool cheatsEnabled = gameServices().getGameHostOption(eGameHostOption_CheatsEnabled); #if defined(_DEBUG_MENUS_ENABLED) - cheatsEnabled = cheatsEnabled || app.GetUseDPadForDebug(); + cheatsEnabled = cheatsEnabled || gameServices().getUseDPadForDebug(); #endif INetworkPlayer* networkPlayer = player->connection->getNetworkPlayer(); bool isOp = cheatsEnabled && @@ -1233,7 +1235,7 @@ std::vector* PlayerList::getPlayers( std::unordered_map* scoreRequirements, const std::wstring& playerName, const std::wstring& teamName, Level* level) { - app.DebugPrintf("getPlayers NOT IMPLEMENTED!"); + Log::info("getPlayers NOT IMPLEMENTED!"); return nullptr; /*if (players.empty()) return nullptr; @@ -1288,7 +1290,7 @@ std::vector* PlayerList::getPlayers( bool PlayerList::meetsScoreRequirements( std::shared_ptr player, std::unordered_map scoreRequirements) { - app.DebugPrintf("meetsScoreRequirements NOT IMPLEMENTED!"); + Log::info("meetsScoreRequirements NOT IMPLEMENTED!"); return false; // if (scoreRequirements == null || scoreRequirements.size() == 0) return @@ -1522,7 +1524,7 @@ void PlayerList::removePlayerFromReceiving(std::shared_ptr player, dimIndex = 2; #if !defined(_CONTENT_PACKAGE) - app.DebugPrintf("Requesting remove player %ls as primary in dimension %d\n", + Log::info("Requesting remove player %ls as primary in dimension %d\n", player->name.c_str(), dimIndex); #endif bool playerRemoved = false; @@ -1531,7 +1533,7 @@ void PlayerList::removePlayerFromReceiving(std::shared_ptr player, receiveAllPlayers[dimIndex].end(), player); if (it != receiveAllPlayers[dimIndex].end()) { #if !defined(_CONTENT_PACKAGE) - app.DebugPrintf( + Log::info( "Remove: Removing player %ls as primary in dimension %d\n", player->name.c_str(), dimIndex); #endif @@ -1551,7 +1553,7 @@ void PlayerList::removePlayerFromReceiving(std::shared_ptr player, otherPlayer != nullptr && otherPlayer->IsSameSystem(thisPlayer)) { #if !defined(_CONTENT_PACKAGE) - app.DebugPrintf( + Log::info( "Remove: Adding player %ls as primary in dimension %d\n", newPlayer->name.c_str(), dimIndex); #endif @@ -1561,7 +1563,7 @@ void PlayerList::removePlayerFromReceiving(std::shared_ptr player, } } else if (thisPlayer == nullptr) { #if !defined(_CONTENT_PACKAGE) - app.DebugPrintf( + Log::info( "Remove: Qnet player for %ls was nullptr so re-checking all " "players\n", player->name.c_str()); @@ -1594,7 +1596,7 @@ void PlayerList::removePlayerFromReceiving(std::shared_ptr player, } if (!foundPrimary) { #if !defined(_CONTENT_PACKAGE) - app.DebugPrintf( + Log::info( "Remove: Adding player %ls as primary in dimension " "%d\n", newPlayer->name.c_str(), newPlayerDim); @@ -1614,7 +1616,7 @@ void PlayerList::addPlayerToReceiving(std::shared_ptr player) { playerDim = 2; #if !defined(_CONTENT_PACKAGE) - app.DebugPrintf("Requesting add player %ls as primary in dimension %d\n", + Log::info("Requesting add player %ls as primary in dimension %d\n", player->name.c_str(), playerDim); #endif @@ -1624,7 +1626,7 @@ void PlayerList::addPlayerToReceiving(std::shared_ptr player) { if (thisPlayer == nullptr) { #if !defined(_CONTENT_PACKAGE) - app.DebugPrintf( + Log::info( "Add: Qnet player for player %ls is nullptr so not adding them\n", player->name.c_str()); #endif @@ -1645,7 +1647,7 @@ void PlayerList::addPlayerToReceiving(std::shared_ptr player) { if (shouldAddPlayer) { #if !defined(_CONTENT_PACKAGE) - app.DebugPrintf("Add: Adding player %ls as primary in dimension %d\n", + Log::info("Add: Adding player %ls as primary in dimension %d\n", player->name.c_str(), playerDim); #endif receiveAllPlayers[playerDim].push_back(player); diff --git a/targets/minecraft/server/level/EntityTracker.cpp b/targets/minecraft/server/level/EntityTracker.cpp index af5d0da43..3768ef7a1 100644 --- a/targets/minecraft/server/level/EntityTracker.cpp +++ b/targets/minecraft/server/level/EntityTracker.cpp @@ -7,7 +7,7 @@ #include #include -#include "app/common/src/Network/NetworkPlayerInterface.h" +#include "app/common/Network/NetworkPlayerInterface.h" #include "app/linux/Stubs/winapi_stubs.h" #include "ServerLevel.h" #include "ServerPlayer.h" diff --git a/targets/minecraft/server/level/PlayerChunkMap.cpp b/targets/minecraft/server/level/PlayerChunkMap.cpp index fb4ae3e27..9e26fdea3 100644 --- a/targets/minecraft/server/level/PlayerChunkMap.cpp +++ b/targets/minecraft/server/level/PlayerChunkMap.cpp @@ -1,3 +1,4 @@ +#include "minecraft/util/Log.h" #include "PlayerChunkMap.h" #include @@ -9,8 +10,8 @@ #include #include -#include "app/common/src/Network/GameNetworkManager.h" -#include "app/common/src/Network/NetworkPlayerInterface.h" +#include "app/common/Network/GameNetworkManager.h" +#include "app/common/Network/NetworkPlayerInterface.h" #include "app/linux/LinuxGame.h" #include "ServerChunkCache.h" #include "ServerLevel.h" @@ -64,12 +65,12 @@ void PlayerChunkMap::flagEntitiesToBeRemoved(unsigned int* flags, void PlayerChunkMap::PlayerChunk::add(std::shared_ptr player, bool sendPacket /*= true*/) { - // app.DebugPrintf("--- Adding player to chunk x=%d\tz=%d\n",x, z); + // Log::info("--- Adding player to chunk x=%d\tz=%d\n",x, z); if (find(players.begin(), players.end(), player) != players.end()) { // 4J-PB - At the start of the game, lots of chunks are added, and we // can then move into an area that is outside the diameter of our // starting area, but is inside the area loaded at the start. - app.DebugPrintf( + Log::info( "--- Adding player to chunk x=%d\t z=%d, but they are already in " "there!\n", pos.x, pos.z); @@ -103,11 +104,11 @@ void PlayerChunkMap::PlayerChunk::add(std::shared_ptr player, void PlayerChunkMap::PlayerChunk::remove(std::shared_ptr player) { PlayerChunkMap::PlayerChunk* toDelete = nullptr; - // app.DebugPrintf("--- PlayerChunkMap::PlayerChunk::remove + // Log::info("--- PlayerChunkMap::PlayerChunk::remove // x=%d\tz=%d\n",x,z); auto it = find(players.begin(), players.end(), player); if (it == players.end()) { - app.DebugPrintf( + Log::info( "--- INFO - Removing player from chunk x=%d\t z=%d, but they are " "not in that chunk!\n", pos.x, pos.z); @@ -170,7 +171,7 @@ void PlayerChunkMap::PlayerChunk::remove(std::shared_ptr player) { new ChunkVisibilityPacket(pos.x, pos.z, false))); } } else { - // app.DebugPrintf("PlayerChunkMap::PlayerChunk::remove - QNetPlayer + // Log::info("PlayerChunkMap::PlayerChunk::remove - QNetPlayer // is nullptr\n"); } } diff --git a/targets/minecraft/server/level/ServerChunkCache.cpp b/targets/minecraft/server/level/ServerChunkCache.cpp index 386c2ad9e..0ed746b98 100644 --- a/targets/minecraft/server/level/ServerChunkCache.cpp +++ b/targets/minecraft/server/level/ServerChunkCache.cpp @@ -1,3 +1,4 @@ +#include "minecraft/util/Log.h" #include "ServerChunkCache.h" #include @@ -6,7 +7,7 @@ #include -#include "app/linux/LinuxGame.h" +#include "minecraft/IGameServices.h" #include "app/linux/Stubs/winapi_stubs.h" #include "ServerLevel.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" @@ -559,7 +560,7 @@ void ServerChunkCache::flagPostProcessComplete(short flag, int x, int z) { // Are all neighbouring chunks And this one now post-processed? if (lc->terrainPopulated == LevelChunk::sTerrainPopulatedAllNeighbours) { // Special lighting patching for schematics first - app.processSchematicsLighting(lc); + gameServices().processSchematicsLighting(lc); // This would be a good time to fix up any lighting for this chunk since // all the geometry that could affect it should now be in place @@ -676,7 +677,7 @@ bool ServerChunkCache::save(bool force, ProgressListener* progressListener) { bool maxSavesReached = false; if (!force) { - // app.DebugPrintf("Unsaved chunks = %d\n", + // Log::info("Unsaved chunks = %d\n", // level->getUnsavedChunkCount() ); // Single threaded implementation for small saves for (unsigned int i = 0; i < m_loadedChunkList.size(); i++) { @@ -854,10 +855,10 @@ int ServerChunkCache::runSaveThreadProc(void* lpParam) { C4JThread:: kInfiniteTimeout); // WaitForSingleObject(params->wakeEvent,INFINITE); - // app.DebugPrintf("Save thread has started\n"); + // Log::info("Save thread has started\n"); while (params->chunkToSave != nullptr) { - // app.DebugPrintf("Save thread has started processing a chunk\n"); + // Log::info("Save thread has started processing a chunk\n"); if (params->saveEntities) params->cache->saveEntities(params->chunkToSave); @@ -868,7 +869,7 @@ int ServerChunkCache::runSaveThreadProc(void* lpParam) { params->notificationEvent ->set(); // SetEvent(params->notificationEvent); - // app.DebugPrintf("Save thread has alerted producer that it is + // Log::info("Save thread has alerted producer that it is // complete\n"); // Wait for the producer thread to tell us to go again @@ -877,7 +878,7 @@ int ServerChunkCache::runSaveThreadProc(void* lpParam) { kInfiniteTimeout); // WaitForSingleObject(params->wakeEvent,INFINITE); } - // app.DebugPrintf("Thread is exiting as it has no chunk to process\n"); + // Log::info("Thread is exiting as it has no chunk to process\n"); if (!params->useSharedThreadStorage) { Compression::ReleaseThreadStorage(); diff --git a/targets/minecraft/server/level/ServerLevel.cpp b/targets/minecraft/server/level/ServerLevel.cpp index 94275453f..05136b7f5 100644 --- a/targets/minecraft/server/level/ServerLevel.cpp +++ b/targets/minecraft/server/level/ServerLevel.cpp @@ -1,3 +1,5 @@ +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "ServerLevel.h" #include @@ -9,10 +11,10 @@ #include "platform/sdl2/Storage.h" #include "EntityTracker.h" #include "platform/ShutdownManager.h" -#include "app/common/src/Console_Debug_enum.h" -#include "app/common/src/DLC/DLCManager.h" -#include "app/common/src/DLC/DLCPack.h" -#include "app/common/src/Network/NetworkPlayerInterface.h" +#include "app/common/Console_Debug_enum.h" +#include "app/common/DLC/DLCManager.h" +#include "app/common/DLC/DLCPack.h" +#include "app/common/Network/NetworkPlayerInterface.h" #include "app/linux/LinuxGame.h" #include "PlayerChunkMap.h" #include "Pos.h" @@ -311,7 +313,7 @@ void ServerLevel::tick() { (dimension->id * dimension->id * (saveInterval / 2))) #endif { - // app.DebugPrintf("Incremental save\n"); + // Log::info("Incremental save\n"); save(false, nullptr); } @@ -323,8 +325,8 @@ void ServerLevel::tick() { // 4J: Debug setting added to keep it at day time #if !defined(_FINAL_BUILD) bool freezeTime = - app.DebugSettingsOn() && - app.GetGameSettingsDebugMask(InputManager.GetPrimaryPad()) & + gameServices().debugSettingsOn() && + gameServices().debugGetMask(InputManager.GetPrimaryPad()) & (1L << eDebugSetting_FreezeTime); if (!freezeTime) #endif @@ -489,7 +491,7 @@ void ServerLevel::tickTiles() { // AP moved this outside of the loop int prob = 100000; - if (app.GetGameSettingsDebugMask() & (1L << eDebugSetting_RegularLightning)) + if (gameServices().debugGetMask() & (1L << eDebugSetting_RegularLightning)) prob = 100; auto itEndCtp = chunksToPoll.end(); @@ -734,7 +736,7 @@ std::vector* ServerLevel::fetchTicksInChunk(LevelChunk* chunk, } } else { if (!toBeTicked.empty()) { - app.DebugPrintf("To be ticked size: %d\n", toBeTicked.size()); + Log::info("To be ticked size: %d\n", toBeTicked.size()); } for (auto it = toBeTicked.begin(); it != toBeTicked.end();) { TickNextTickData td = *it; @@ -849,7 +851,7 @@ void ServerLevel::setInitialSpawn(LevelSettings* levelSettings) { zSpawn = findBiome->z; delete findBiome; } else { - app.DebugPrintf( + Log::info( "Level::setInitialSpawn - Unable to find spawn biome\n"); } @@ -1099,7 +1101,7 @@ std::shared_ptr ServerLevel::explode(std::shared_ptr source, if (player->distanceToSqr(x, y, z) < 64 * 64) { Vec3 knockbackVec = explosion->getHitPlayerKnockback(player); - // app.DebugPrintf("Sending %s with knockback (%f,%f,%f)\n", + // Log::info("Sending %s with knockback (%f,%f,%f)\n", // knockbackOnly?"knockbackOnly":"allExplosion",knockbackVec->x,knockbackVec->y,knockbackVec->z); // If the player is not the primary on the system, then we only // want to send info for the knockback diff --git a/targets/minecraft/server/level/ServerLevelListener.cpp b/targets/minecraft/server/level/ServerLevelListener.cpp index b48dbcd92..dd2204c08 100644 --- a/targets/minecraft/server/level/ServerLevelListener.cpp +++ b/targets/minecraft/server/level/ServerLevelListener.cpp @@ -1,3 +1,4 @@ +#include "minecraft/util/Log.h" #include "ServerLevelListener.h" #include @@ -57,7 +58,7 @@ void ServerLevelListener::playSound(int iSound, double x, double y, double z, float volume, float pitch, float fClipSoundDist) { if (iSound < 0) { - app.DebugPrintf( + Log::info( "ServerLevelListener received request for sound less than 0, so " "ignoring\n"); } else { @@ -78,7 +79,7 @@ void ServerLevelListener::playSoundExceptPlayer(std::shared_ptr player, float pitch, float fSoundClipDist) { if (iSound < 0) { - app.DebugPrintf( + Log::info( "ServerLevelListener received request for sound less than 0, so " "ignoring\n"); } else { diff --git a/targets/minecraft/server/level/ServerPlayer.cpp b/targets/minecraft/server/level/ServerPlayer.cpp index 3d6764379..656141a7b 100644 --- a/targets/minecraft/server/level/ServerPlayer.cpp +++ b/targets/minecraft/server/level/ServerPlayer.cpp @@ -1,3 +1,5 @@ +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "ServerPlayer.h" #include @@ -10,10 +12,10 @@ #include "platform/sdl2/Input.h" #include "EntityTracker.h" -#include "app/common/src/Console_Debug_enum.h" -#include "app/common/src/GameRules/LevelRules/Rules/GameRulesInstance.h" -#include "app/common/src/Network/GameNetworkManager.h" -#include "app/common/src/Network/NetworkPlayerInterface.h" +#include "app/common/Console_Debug_enum.h" +#include "app/common/GameRules/LevelRules/Rules/GameRulesInstance.h" +#include "app/common/Network/GameNetworkManager.h" +#include "app/common/Network/NetworkPlayerInterface.h" #include "app/linux/LinuxGame.h" #include "ServerLevel.h" #include "ServerPlayerGameMode.h" @@ -431,11 +433,11 @@ void ServerPlayer::doChunkSendingTick(bool dontDelayChunks) { MinecraftServer::chunkPacketManagement_CanSendTo( connection->getNetworkPlayer()); - // app.DebugPrintf(">>> %d\n", + // Log::info(">>> %d\n", // canSendToPlayer); if( // connection->getNetworkPlayer() ) // { - // app.DebugPrintf("%d: + // Log::info("%d: // canSendToPlayer %d, countDelayedPackets %d // GetSendQueueSizeBytes %d done: %d\n", // connection->getNetworkPlayer()->GetSmallId(), @@ -465,12 +467,12 @@ void ServerPlayer::doChunkSendingTick(bool dontDelayChunks) { // System::currentTimeMillis(); // int64_t lastTime = // mapLastTime[connection->getNetworkPlayer()->GetUID().toString()]; - // app.DebugPrintf(" - OK + // Log::info(" - OK // to send (%d ms since last)\n", thisTime - lastTime); // mapLastTime[connection->getNetworkPlayer()->GetUID().toString()] //= thisTime; } else { - // app.DebugPrintf(" - \n"); } } @@ -505,7 +507,7 @@ void ServerPlayer::doChunkSendingTick(bool dontDelayChunks) { // finite set of chunks as the player moves if (!g_NetworkManager.SystemFlagGet( connection->getNetworkPlayer(), flagIndex)) { - // app.DebugPrintf("Creating + // Log::info("Creating // BRUP for %d %d\n",nearest.x, nearest.z); int64_t before = System::currentTimeMillis(); std::shared_ptr packet = @@ -514,7 +516,7 @@ void ServerPlayer::doChunkSendingTick(bool dontDelayChunks) { nearest.x * 16, 0, nearest.z * 16, 16, Level::maxBuildHeight, 16, level)); int64_t after = System::currentTimeMillis(); - // app.DebugPrintf(">>><<< + // Log::info(">>><<< //%d ms\n",after-before); if (dontDelayChunks) packet->shouldDelay = false; @@ -583,7 +585,7 @@ void ServerPlayer::doChunkSendingTick(bool dontDelayChunks) { void ServerPlayer::doTickB() { #if !defined(_CONTENT_PACKAGE) // check if there's a debug dimension change requested - // if(app.GetGameSettingsDebugMask(InputManager.GetPrimaryPad())&(1L<dimension->id == 0 ) // { @@ -591,11 +593,11 @@ void ServerPlayer::doTickB() { // portalTime=1; // } // unsigned int - // uiVal=app.GetGameSettingsDebugMask(InputManager.GetPrimaryPad()); - // app.SetGameSettingsDebugMask(InputManager.GetPrimaryPad(),uiVal&~(1L<dimension->id == 0 ) // { @@ -603,19 +605,19 @@ void ServerPlayer::doTickB() { // std::dynamic_pointer_cast( shared_from_this() ), 1 ); // } // unsigned int - // uiVal=app.GetGameSettingsDebugMask(InputManager.GetPrimaryPad()); - // app.SetGameSettingsDebugMask(InputManager.GetPrimaryPad(),uiVal&~(1L<dimension->id != 0) { isInsidePortal = true; portalTime = 1; } unsigned int uiVal = - app.GetGameSettingsDebugMask(InputManager.GetPrimaryPad()); - app.SetGameSettingsDebugMask( + gameServices().debugGetMask(InputManager.GetPrimaryPad()); + gameServices().setGameSettingsDebugMask( InputManager.GetPrimaryPad(), uiVal & ~(1L << eDebugSetting_GoToOverworld)); } @@ -765,7 +767,7 @@ void ServerPlayer::changeDimension(int i) { if (!connection->hasClientTickedOnce()) return; if (dimension == 1 && i == 1) { - app.DebugPrintf("Start win game\n"); + Log::info("Start win game\n"); awardStat(GenericStats::winGame(), GenericStats::param_winGame()); // All players on the same system as this player should also be removed @@ -779,7 +781,7 @@ void ServerPlayer::changeDimension(int i) { true; // We only flag this for the player in the portal connection->send(std::make_shared( GameEventPacket::WIN_GAME, thisPlayer->GetUserIndex())); - app.DebugPrintf("Sending packet to %d\n", + Log::info("Sending packet to %d\n", thisPlayer->GetUserIndex()); } if (thisPlayer != nullptr) { @@ -800,12 +802,12 @@ void ServerPlayer::changeDimension(int i) { std::shared_ptr( new GameEventPacket(GameEventPacket::WIN_GAME, thisPlayer->GetUserIndex()))); - app.DebugPrintf("Sending packet to %d\n", + Log::info("Sending packet to %d\n", thisPlayer->GetUserIndex()); } } } - app.DebugPrintf("End win game\n"); + Log::info("End win game\n"); } else { if (dimension == 0 && i == 1) { awardStat(GenericStats::theEnd(), GenericStats::param_theEnd()); @@ -920,7 +922,7 @@ bool ServerPlayer::startCrafting(int x, int y, int z) { containerMenu->containerId = containerCounter; containerMenu->addSlotListener(this); } else { - app.DebugPrintf( + Log::info( "ServerPlayer tried to open crafting container when one was " "already open\n"); } @@ -946,7 +948,7 @@ bool ServerPlayer::openFireworks(int x, int y, int z) { containerMenu->containerId = containerCounter; containerMenu->addSlotListener(this); } else { - app.DebugPrintf( + Log::info( "ServerPlayer tried to open crafting container when one was " "already open\n"); } @@ -965,7 +967,7 @@ bool ServerPlayer::startEnchanting(int x, int y, int z, containerMenu->containerId = containerCounter; containerMenu->addSlotListener(this); } else { - app.DebugPrintf( + Log::info( "ServerPlayer tried to open enchanting container when one was " "already open\n"); } @@ -985,7 +987,7 @@ bool ServerPlayer::startRepairing(int x, int y, int z) { containerMenu->containerId = containerCounter; containerMenu->addSlotListener(this); } else { - app.DebugPrintf( + Log::info( "ServerPlayer tried to open enchanting container when one was " "already open\n"); } @@ -1010,7 +1012,7 @@ bool ServerPlayer::openContainer(std::shared_ptr container) { containerMenu->containerId = containerCounter; containerMenu->addSlotListener(this); } else { - app.DebugPrintf( + Log::info( "ServerPlayer tried to open container when one was already open\n"); } @@ -1028,7 +1030,7 @@ bool ServerPlayer::openHopper(std::shared_ptr container) { containerMenu->containerId = containerCounter; containerMenu->addSlotListener(this); } else { - app.DebugPrintf( + Log::info( "ServerPlayer tried to open hopper container when one was already " "open\n"); } @@ -1047,7 +1049,7 @@ bool ServerPlayer::openHopper(std::shared_ptr container) { containerMenu->containerId = containerCounter; containerMenu->addSlotListener(this); } else { - app.DebugPrintf( + Log::info( "ServerPlayer tried to open minecart hopper container when one was " "already open\n"); } @@ -1066,7 +1068,7 @@ bool ServerPlayer::openFurnace(std::shared_ptr furnace) { containerMenu->containerId = containerCounter; containerMenu->addSlotListener(this); } else { - app.DebugPrintf( + Log::info( "ServerPlayer tried to open furnace when one was already open\n"); } @@ -1087,7 +1089,7 @@ bool ServerPlayer::openTrap(std::shared_ptr trap) { containerMenu->containerId = containerCounter; containerMenu->addSlotListener(this); } else { - app.DebugPrintf( + Log::info( "ServerPlayer tried to open dispenser when one was already open\n"); } @@ -1106,7 +1108,7 @@ bool ServerPlayer::openBrewingStand( containerMenu->containerId = containerCounter; containerMenu->addSlotListener(this); } else { - app.DebugPrintf( + Log::info( "ServerPlayer tried to open brewing stand when one was already " "open\n"); } @@ -1125,7 +1127,7 @@ bool ServerPlayer::openBeacon(std::shared_ptr beacon) { containerMenu->containerId = containerCounter; containerMenu->addSlotListener(this); } else { - app.DebugPrintf( + Log::info( "ServerPlayer tried to open beacon when one was already open\n"); } @@ -1162,7 +1164,7 @@ bool ServerPlayer::openTrading(std::shared_ptr traderTarget, rawOutput.toByteArray()))); } } else { - app.DebugPrintf( + Log::info( "ServerPlayer tried to open trading menu when one was already " "open\n"); } @@ -1540,7 +1542,7 @@ void ServerPlayer::displayClientMessage(int messageId) { break; default: - app.DebugPrintf( + Log::info( "Tried to send a chat packet to the player with an unhandled " "messageId\n"); assert(false); @@ -1549,7 +1551,7 @@ void ServerPlayer::displayClientMessage(int messageId) { // Language *language = Language::getInstance(); // wstring languageString = - // app.GetString(messageId);//language->getElement(messageId); + // gameServices().getString(messageId);//language->getElement(messageId); // connection->send( shared_ptr( new ChatPacket(L"", // messageType) ) ); } diff --git a/targets/minecraft/server/level/ServerPlayerGameMode.cpp b/targets/minecraft/server/level/ServerPlayerGameMode.cpp index 1b72ca5a8..300e3fca4 100644 --- a/targets/minecraft/server/level/ServerPlayerGameMode.cpp +++ b/targets/minecraft/server/level/ServerPlayerGameMode.cpp @@ -1,8 +1,9 @@ +#include "minecraft/IGameServices.h" #include "ServerPlayerGameMode.h" #include -#include "app/common/src/GameRules/LevelRules/Rules/GameRulesInstance.h" +#include "app/common/GameRules/LevelRules/Rules/GameRulesInstance.h" #include "ServerLevel.h" #include "ServerPlayer.h" #include "minecraft/client/Minecraft.h" @@ -151,7 +152,7 @@ void ServerPlayerGameMode::startDestroyBlock(int x, int y, int z, int face) { if (t > 0 && (progress >= - 1)) //|| (app.DebugSettingsOn() && + 1)) //|| (gameServices().debugSettingsOn() && //(player->GetDebugOptions()&(1L< @@ -10,7 +11,7 @@ #include "platform/PlatformTypes.h" #include "EntityTracker.h" -#include "app/common/src/Network/NetworkPlayerInterface.h" +#include "app/common/Network/NetworkPlayerInterface.h" #include "app/linux/LinuxGame.h" #include "ServerPlayer.h" #include "java/Class.h" @@ -440,7 +441,7 @@ void TrackedEntity::broadcast(std::shared_ptr packet) { // (packet); // if(emp!=nullptr) // { - // app.DebugPrintf("Not + // Log::info("Not // sending this SetEntityMotionPacket to player - // it's already been sent to a player on their // console\n"); @@ -597,7 +598,7 @@ void TrackedEntity::updatePlayer(EntityTracker* tracker, if (e->instanceof(eTYPE_PLAYER)) { std::shared_ptr plr = std::dynamic_pointer_cast(e); - app.DebugPrintf( + Log::info( "TrackedEntity:: Player '%ls' is now visible to player '%ls', " "%s.\n", plr->name.c_str(), sp->name.c_str(), @@ -711,7 +712,7 @@ void TrackedEntity::updatePlayers( std::shared_ptr TrackedEntity::getAddEntityPacket() { if (e->removed) { - app.DebugPrintf("Fetching addPacket for removed entity - %ls\n", + Log::info("Fetching addPacket for removed entity - %ls\n", e->getAName().c_str()); } @@ -841,7 +842,7 @@ std::shared_ptr TrackedEntity::getAddEntityPacket() { int ix = (int)frame->xTile; int iy = (int)frame->yTile; int iz = (int)frame->zTile; - app.DebugPrintf("eTYPE_ITEM_FRAME xyz %d,%d,%d\n", ix, iy, iz); + Log::info("eTYPE_ITEM_FRAME xyz %d,%d,%d\n", ix, iy, iz); } std::shared_ptr packet = diff --git a/targets/minecraft/server/network/PendingConnection.cpp b/targets/minecraft/server/network/PendingConnection.cpp index bdb7ca9c6..f3c22b92b 100644 --- a/targets/minecraft/server/network/PendingConnection.cpp +++ b/targets/minecraft/server/network/PendingConnection.cpp @@ -1,3 +1,5 @@ +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "PendingConnection.h" #include @@ -7,13 +9,13 @@ #include "platform/PlatformTypes.h" #include "platform/sdl2/Storage.h" -#include "app/common/App_enums.h" -#include "app/common/src/BuildVer/BuildVer.h" -#include "app/common/src/Network/NetworkPlayerInterface.h" +#include "minecraft/GameEnums.h" +#include "app/common/BuildVer/BuildVer.h" +#include "app/common/Network/NetworkPlayerInterface.h" #include "platform/IPlatformNetwork.h" #include "app/linux/LinuxGame.h" #include "app/linux/Stubs/winapi_stubs.h" -#include "app/include/NetTypes.h" +#include "platform/NetTypes.h" #include "PlayerConnection.h" #include "ServerConnection.h" #include "java/Random.h" @@ -66,7 +68,7 @@ void PendingConnection::disconnect(DisconnectPacket::eDisconnectReason reason) { // logger.info("Disconnecting " + getName() + ": " + reason); fprintf(stderr, "[PENDING] disconnect called with reason=%d at tick=%d\n", reason, _tick); - app.DebugPrintf("Pending connection disconnect: %d\n", reason); + Log::info("Pending connection disconnect: %d\n", reason); connection->send(std::make_shared(reason)); connection->sendAndQuit(); done = true; @@ -77,7 +79,7 @@ void PendingConnection::disconnect(DisconnectPacket::eDisconnectReason reason) { void PendingConnection::handlePreLogin(std::shared_ptr packet) { if (packet->m_netcodeVersion != MINECRAFT_NET_VERSION) { - app.DebugPrintf("Netcode version is %d not equal to %d\n", + Log::info("Netcode version is %d not equal to %d\n", packet->m_netcodeVersion, MINECRAFT_NET_VERSION); if (packet->m_netcodeVersion > MINECRAFT_NET_VERSION) { disconnect(DisconnectPacket::eDisconnect_OutdatedServer); @@ -137,7 +139,7 @@ void PendingConnection::sendPreLoginResponse() { connection->send(std::shared_ptr( new PreLoginPacket(L"-", ugcXuids, ugcXuidCount, ugcFriendsOnlyBits, server->m_ugcPlayersVersion, szUniqueMapName, - app.GetGameHostOption(eGameHostOption_All), + gameServices().getGameHostOption(eGameHostOption_All), hostIndex, server->m_texturePackId))); } } @@ -147,7 +149,7 @@ void PendingConnection::handleLogin(std::shared_ptr packet) { packet->clientVersion); // name = packet->userName; if (packet->clientVersion != SharedConstants::NETWORK_PROTOCOL_VERSION) { - app.DebugPrintf("Client version is %d not equal to %d\n", + Log::info("Client version is %d not equal to %d\n", packet->clientVersion, SharedConstants::NETWORK_PROTOCOL_VERSION); if (packet->clientVersion > SharedConstants::NETWORK_PROTOCOL_VERSION) { diff --git a/targets/minecraft/server/network/PlayerConnection.cpp b/targets/minecraft/server/network/PlayerConnection.cpp index 37d49ec11..8871671f9 100644 --- a/targets/minecraft/server/network/PlayerConnection.cpp +++ b/targets/minecraft/server/network/PlayerConnection.cpp @@ -1,3 +1,6 @@ +#include "minecraft/IGameServices.h" +#include "minecraft/GameHostOptions.h" +#include "minecraft/util/Log.h" #include "PlayerConnection.h" #include @@ -8,15 +11,15 @@ #include #include -#include "app/common/App_enums.h" -#include "app/common/src/Console_Debug_enum.h" -#include "app/common/src/DLC/DLCManager.h" -#include "app/common/src/DLC/DLCSkinFile.h" -#include "app/common/src/Network/GameNetworkManager.h" -#include "app/common/src/Network/NetworkPlayerInterface.h" -#include "app/common/src/Network/Socket.h" +#include "minecraft/GameEnums.h" +#include "app/common/Console_Debug_enum.h" +#include "app/common/DLC/DLCManager.h" +#include "app/common/DLC/DLCSkinFile.h" +#include "app/common/Network/GameNetworkManager.h" +#include "app/common/Network/NetworkPlayerInterface.h" +#include "app/common/Network/Socket.h" #include "app/linux/LinuxGame.h" -#include "app/include/SkinBox.h" +#include "minecraft/client/model/SkinBox.h" #include "ServerConnection.h" #include "java/Class.h" #include "java/InputOutputStream/ByteArrayInputStream.h" @@ -137,7 +140,7 @@ PlayerConnection::PlayerConnection(MinecraftServer* server, m_bHasClientTickedOnce = false; setShowOnMaps( - app.GetGameHostOption(eGameHostOption_Gamertags) != 0 ? true : false); + gameServices().getGameHostOption(eGameHostOption_Gamertags) != 0 ? true : false); } PlayerConnection::~PlayerConnection() { delete connection; } @@ -177,7 +180,7 @@ void PlayerConnection::disconnect(DisconnectPacket::eDisconnectReason reason) { return; } - app.DebugPrintf("PlayerConnection disconect reason: %d\n", reason); + Log::info("PlayerConnection disconect reason: %d\n", reason); player->disconnect(); // 4J Stu - Need to remove the player from the receiving list before their @@ -380,8 +383,8 @@ void PlayerConnection::handleMovePlayer( // + ", " + player->y + ", " + player->z); #if !defined(_CONTENT_PACKAGE) wprintf(L"%ls moved wrongly!\n", player->name.c_str()); - app.DebugPrintf("Got position %f, %f, %f\n", xt, yt, zt); - app.DebugPrintf("Expected %f, %f, %f\n", player->x, player->y, + Log::info("Got position %f, %f, %f\n", xt, yt, zt); + Log::info("Expected %f, %f, %f\n", player->x, player->y, player->z); #endif } @@ -811,7 +814,7 @@ void PlayerConnection::handleTexture(std::shared_ptr packet) { #endif std::uint8_t* pbData = nullptr; unsigned int dwBytes = 0; - app.GetMemFileDetails(packet->textureName, &pbData, &dwBytes); + gameServices().getMemFileDetails(packet->textureName, &pbData, &dwBytes); if (dwBytes != 0) { send(std::shared_ptr( @@ -825,7 +828,7 @@ void PlayerConnection::handleTexture(std::shared_ptr packet) { wprintf(L"Server received custom texture %ls\n", packet->textureName.c_str()); #endif - app.AddMemoryTextureFile(packet->textureName, packet->pbData, + gameServices().addMemoryTextureFile(packet->textureName, packet->pbData, packet->dataBytes); server->connection->handleTextureReceived(packet->textureName); } @@ -844,9 +847,9 @@ void PlayerConnection::handleTextureAndGeometry( #endif std::uint8_t* pbData = nullptr; unsigned int dwTextureBytes = 0; - app.GetMemFileDetails(packet->textureName, &pbData, &dwTextureBytes); + gameServices().getMemFileDetails(packet->textureName, &pbData, &dwTextureBytes); DLCSkinFile* pDLCSkinFile = - app.m_dlcManager.getSkinFile(packet->textureName); + gameServices().getDLCSkinFile(packet->textureName); if (dwTextureBytes != 0) { if (pDLCSkinFile) { @@ -864,9 +867,9 @@ void PlayerConnection::handleTextureAndGeometry( // we don't have the dlc skin, so retrieve the data from the app // store std::vector* pvSkinBoxes = - app.GetAdditionalSkinBoxes(packet->dwSkinID); + gameServices().getAdditionalSkinBoxes(packet->dwSkinID); unsigned int uiAnimOverrideBitmask = - app.GetAnimOverrideBitmask(packet->dwSkinID); + gameServices().getAnimOverrideBitmask(packet->dwSkinID); send(std::shared_ptr( new TextureAndGeometryPacket(packet->textureName, pbData, @@ -882,7 +885,7 @@ void PlayerConnection::handleTextureAndGeometry( wprintf(L"Server received custom texture %ls and geometry\n", packet->textureName.c_str()); #endif - app.AddMemoryTextureFile(packet->textureName, packet->pbData, + gameServices().addMemoryTextureFile(packet->textureName, packet->pbData, packet->dwTextureBytes); // add the geometry to the app list @@ -891,11 +894,11 @@ void PlayerConnection::handleTextureAndGeometry( wprintf(L"Adding skin boxes for skin id %X, box count %d\n", packet->dwSkinID, packet->dwBoxC); #endif - app.SetAdditionalSkinBoxes(packet->dwSkinID, packet->BoxDataA, + gameServices().setAdditionalSkinBoxes(packet->dwSkinID, packet->BoxDataA, packet->dwBoxC); } // Add the anim override - app.SetAnimOverrideBitmask(packet->dwSkinID, + gameServices().setAnimOverrideBitmask(packet->dwSkinID, packet->uiAnimOverrideBitmask); player->setCustomSkin(packet->dwSkinID); @@ -913,7 +916,7 @@ void PlayerConnection::handleTextureReceived(const std::wstring& textureName) { if (it != m_texturesRequested.end()) { std::uint8_t* pbData = nullptr; unsigned int dwBytes = 0; - app.GetMemFileDetails(textureName, &pbData, &dwBytes); + gameServices().getMemFileDetails(textureName, &pbData, &dwBytes); if (dwBytes != 0) { send(std::shared_ptr( @@ -932,8 +935,8 @@ void PlayerConnection::handleTextureAndGeometryReceived( if (it != m_texturesRequested.end()) { std::uint8_t* pbData = nullptr; unsigned int dwTextureBytes = 0; - app.GetMemFileDetails(textureName, &pbData, &dwTextureBytes); - DLCSkinFile* pDLCSkinFile = app.m_dlcManager.getSkinFile(textureName); + gameServices().getMemFileDetails(textureName, &pbData, &dwTextureBytes); + DLCSkinFile* pDLCSkinFile = gameServices().getDLCSkinFile(textureName); if (dwTextureBytes != 0) { if (pDLCSkinFile && @@ -943,11 +946,11 @@ void PlayerConnection::handleTextureAndGeometryReceived( textureName, pbData, dwTextureBytes, pDLCSkinFile))); } else { // get the data from the app - std::uint32_t dwSkinID = app.getSkinIdFromPath(textureName); + std::uint32_t dwSkinID = gameServices().getSkinIdFromPath(textureName); std::vector* pvSkinBoxes = - app.GetAdditionalSkinBoxes(dwSkinID); + gameServices().getAdditionalSkinBoxes(dwSkinID); unsigned int uiAnimOverrideBitmask = - app.GetAnimOverrideBitmask(dwSkinID); + gameServices().getAnimOverrideBitmask(dwSkinID); send(std::shared_ptr( new TextureAndGeometryPacket(textureName, pbData, @@ -963,7 +966,7 @@ void PlayerConnection::handleTextureChange( std::shared_ptr packet) { switch (packet->action) { case TextureChangePacket::e_TextureChange_Skin: - player->setCustomSkin(app.getSkinIdFromPath(packet->path)); + player->setCustomSkin(gameServices().getSkinIdFromPath(packet->path)); #if !defined(_CONTENT_PACKAGE) wprintf(L"Skin for server player %ls has changed to %ls (%d)\n", player->name.c_str(), player->customTextureUrl.c_str(), @@ -981,7 +984,7 @@ void PlayerConnection::handleTextureChange( } if (!packet->path.empty() && packet->path.substr(0, 3).compare(L"def") != 0 && - !app.IsFileInMemoryTextures(packet->path)) { + !gameServices().isFileInMemoryTextures(packet->path)) { if (server->connection->addPendingTextureRequest(packet->path)) { #if !defined(_CONTENT_PACKAGE) wprintf( @@ -993,9 +996,9 @@ void PlayerConnection::handleTextureChange( new TexturePacket(packet->path, nullptr, 0))); } } else if (!packet->path.empty() && - app.IsFileInMemoryTextures(packet->path)) { + gameServices().isFileInMemoryTextures(packet->path)) { // Update the ref count on the memory texture data - app.AddMemoryTextureFile(packet->path, nullptr, 0); + gameServices().addMemoryTextureFile(packet->path, nullptr, 0); } server->getPlayers()->broadcastAll( std::shared_ptr( @@ -1005,7 +1008,7 @@ void PlayerConnection::handleTextureChange( void PlayerConnection::handleTextureAndGeometryChange( std::shared_ptr packet) { - player->setCustomSkin(app.getSkinIdFromPath(packet->path)); + player->setCustomSkin(gameServices().getSkinIdFromPath(packet->path)); #if !defined(_CONTENT_PACKAGE) wprintf( L"PlayerConnection::handleTextureAndGeometryChange - Skin for server " @@ -1016,7 +1019,7 @@ void PlayerConnection::handleTextureAndGeometryChange( if (!packet->path.empty() && packet->path.substr(0, 3).compare(L"def") != 0 && - !app.IsFileInMemoryTextures(packet->path)) { + !gameServices().isFileInMemoryTextures(packet->path)) { if (server->connection->addPendingTextureRequest(packet->path)) { #if !defined(_CONTENT_PACKAGE) wprintf( @@ -1028,15 +1031,15 @@ void PlayerConnection::handleTextureAndGeometryChange( new TextureAndGeometryPacket(packet->path, nullptr, 0))); } } else if (!packet->path.empty() && - app.IsFileInMemoryTextures(packet->path)) { + gameServices().isFileInMemoryTextures(packet->path)) { // Update the ref count on the memory texture data - app.AddMemoryTextureFile(packet->path, nullptr, 0); + gameServices().addMemoryTextureFile(packet->path, nullptr, 0); player->setCustomSkin(packet->dwSkinID); // If we already have the texture, then we already have the model parts // too - // app.SetAdditionalSkinBoxes(packet->dwSkinID,) + // gameServices().setAdditionalSkinBoxes(packet->dwSkinID,) // DebugBreak(); } server->getPlayers()->broadcastAll( @@ -1054,46 +1057,46 @@ void PlayerConnection::handleServerSettingsChanged( INetworkPlayer* networkPlayer = getNetworkPlayer(); if ((networkPlayer != nullptr && networkPlayer->IsHost()) || player->isModerator()) { - app.SetGameHostOption( + gameServices().setGameHostOption( eGameHostOption_FireSpreads, - app.GetGameHostOption(packet->data, + GameHostOptions::get(packet->data, eGameHostOption_FireSpreads)); - app.SetGameHostOption( + gameServices().setGameHostOption( eGameHostOption_TNT, - app.GetGameHostOption(packet->data, eGameHostOption_TNT)); - app.SetGameHostOption( + GameHostOptions::get(packet->data, eGameHostOption_TNT)); + gameServices().setGameHostOption( eGameHostOption_MobGriefing, - app.GetGameHostOption(packet->data, + GameHostOptions::get(packet->data, eGameHostOption_MobGriefing)); - app.SetGameHostOption( + gameServices().setGameHostOption( eGameHostOption_KeepInventory, - app.GetGameHostOption(packet->data, + GameHostOptions::get(packet->data, eGameHostOption_KeepInventory)); - app.SetGameHostOption( + gameServices().setGameHostOption( eGameHostOption_DoMobSpawning, - app.GetGameHostOption(packet->data, + GameHostOptions::get(packet->data, eGameHostOption_DoMobSpawning)); - app.SetGameHostOption( + gameServices().setGameHostOption( eGameHostOption_DoMobLoot, - app.GetGameHostOption(packet->data, eGameHostOption_DoMobLoot)); - app.SetGameHostOption( + GameHostOptions::get(packet->data, eGameHostOption_DoMobLoot)); + gameServices().setGameHostOption( eGameHostOption_DoTileDrops, - app.GetGameHostOption(packet->data, + GameHostOptions::get(packet->data, eGameHostOption_DoTileDrops)); - app.SetGameHostOption( + gameServices().setGameHostOption( eGameHostOption_DoDaylightCycle, - app.GetGameHostOption(packet->data, + GameHostOptions::get(packet->data, eGameHostOption_DoDaylightCycle)); - app.SetGameHostOption( + gameServices().setGameHostOption( eGameHostOption_NaturalRegeneration, - app.GetGameHostOption(packet->data, + GameHostOptions::get(packet->data, eGameHostOption_NaturalRegeneration)); server->getPlayers()->broadcastAll( std::shared_ptr( new ServerSettingsChangedPacket( ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS, - app.GetGameHostOption(eGameHostOption_All)))); + gameServices().getGameHostOption(eGameHostOption_All)))); // Update the QoS data g_NetworkManager.UpdateAndSetGameSessionData(); @@ -1338,7 +1341,7 @@ void PlayerConnection::handleContainerAck( void PlayerConnection::handleSignUpdate( std::shared_ptr packet) { player->resetLastActionTime(); - app.DebugPrintf("PlayerConnection::handleSignUpdate\n"); + Log::info("PlayerConnection::handleSignUpdate\n"); ServerLevel* level = server->getLevel(player->dimension); if (level->hasChunkAt(packet->x, packet->y, packet->z)) { @@ -1406,9 +1409,9 @@ void PlayerConnection::handlePlayerInfo( unsigned int origPrivs = serverPlayer->getAllPlayerGamePrivileges(); bool trustPlayers = - app.GetGameHostOption(eGameHostOption_TrustPlayers) != 0; + gameServices().getGameHostOption(eGameHostOption_TrustPlayers) != 0; bool cheats = - app.GetGameHostOption(eGameHostOption_CheatsEnabled) != 0; + gameServices().getGameHostOption(eGameHostOption_CheatsEnabled) != 0; if (serverPlayer == player) { GameType* gameType = Player::getPlayerGamePrivilege( @@ -1605,7 +1608,7 @@ void PlayerConnection::handleCustomPayload( } else if (CustomPayloadPacket::SET_ADVENTURE_COMMAND_PACKET.compare( customPayloadPacket->identifier) == 0) { if (!server->isCommandBlockEnabled()) { - app.DebugPrintf("Command blocks not enabled"); + Log::info("Command blocks not enabled"); // player->sendMessage(ChatMessageComponent.forTranslation("advMode.notEnabled")); } else if (player->hasPermission(eGameCommand_Effect) && player->abilities.instabuild) { @@ -1688,7 +1691,7 @@ void PlayerConnection::handleCraftItem( std::shared_ptr pTempItemInst = pRecipeIngredientsRequired[iRecipe].pRecipy->assemble(nullptr); - if (app.DebugSettingsOn() && + if (gameServices().debugSettingsOn() && (player->GetDebugOptions() & (1L << eDebugSetting_CraftAnything))) { pTempItemInst->onCraftedBy( player->level, diff --git a/targets/minecraft/server/network/ServerConnection.cpp b/targets/minecraft/server/network/ServerConnection.cpp index 698827860..ff517d840 100644 --- a/targets/minecraft/server/network/ServerConnection.cpp +++ b/targets/minecraft/server/network/ServerConnection.cpp @@ -1,3 +1,5 @@ +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "ServerConnection.h" #include @@ -162,7 +164,7 @@ void ServerConnection::handleServerSettingsChanged( if (packet->action == ServerSettingsChangedPacket::HOST_DIFFICULTY) { for (unsigned int i = 0; i < pMinecraft->levels.size(); ++i) { if (pMinecraft->levels[i] != nullptr) { - app.DebugPrintf( + Log::info( "ClientConnection::handleServerSettingsChanged - " "Difficulty = %d", packet->data); @@ -174,7 +176,7 @@ void ServerConnection::handleServerSettingsChanged( // if(packet->action==ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS)// // options // { - // app.SetGameHostOption(eGameHostOption_All,packet->m_serverSettings) + // gameServices().setGameHostOption(eGameHostOption_All,packet->m_serverSettings) // } // else // { diff --git a/targets/minecraft/stats/Achievements.cpp b/targets/minecraft/stats/Achievements.cpp index 345839fef..8804318de 100644 --- a/targets/minecraft/stats/Achievements.cpp +++ b/targets/minecraft/stats/Achievements.cpp @@ -5,7 +5,7 @@ #include #include "Achievement.h" -#include "app/common/src/Console_Awards_enum.h" +#include "app/common/Console_Awards_enum.h" #include "minecraft/world/item/BowItem.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/item/PotionItem.h" diff --git a/targets/minecraft/stats/CommonStats.h b/targets/minecraft/stats/CommonStats.h index 1bf022de3..47eacd2d4 100644 --- a/targets/minecraft/stats/CommonStats.h +++ b/targets/minecraft/stats/CommonStats.h @@ -6,7 +6,7 @@ #include #include "GenericStats.h" -#include "app/common/src/Console_Awards_enum.h" +#include "app/common/Console_Awards_enum.h" #include "java/Class.h" class CommonStats : public GenericStats { diff --git a/targets/minecraft/stats/GenericStats.h b/targets/minecraft/stats/GenericStats.h index b899c167d..6d25d356a 100644 --- a/targets/minecraft/stats/GenericStats.h +++ b/targets/minecraft/stats/GenericStats.h @@ -6,7 +6,7 @@ #include #include -#include "app/common/src/Console_Awards_enum.h" +#include "app/common/Console_Awards_enum.h" #include "Stat.h" #include "Stats.h" #include "java/Class.h" @@ -19,7 +19,7 @@ class Stat; // #include "minecraft/world/damageSource/DamageSource.h" -// #include "app/common/src/Console_Awards_enum.h" +// #include "app/common/Console_Awards_enum.h" /** 4J-JEV: diff --git a/targets/minecraft/stats/Stat.h b/targets/minecraft/stats/Stat.h index 94acdc79b..a17acf774 100644 --- a/targets/minecraft/stats/Stat.h +++ b/targets/minecraft/stats/Stat.h @@ -8,6 +8,7 @@ #include #include "GenericStats.h" +#include "minecraft/IGameServices.h" #include "app/linux/LinuxGame.h" #include "StatFormatter.h" @@ -62,7 +63,7 @@ public: // 4J-JEV, for Durango stats virtual void handleParamBlob(std::shared_ptr plr, std::vector& param) { - app.DebugPrintf("'Stat.h', Unhandled AwardStat blob.\n"); + gameServices().debugPrintf("'Stat.h', Unhandled AwardStat blob.\n"); return; } }; diff --git a/targets/minecraft/stats/StatsCounter.cpp b/targets/minecraft/stats/StatsCounter.cpp index d525d0d52..cc353da2e 100644 --- a/targets/minecraft/stats/StatsCounter.cpp +++ b/targets/minecraft/stats/StatsCounter.cpp @@ -1,3 +1,4 @@ +#include "minecraft/util/Log.h" #include "StatsCounter.h" #include @@ -11,7 +12,7 @@ #include "platform/sdl2/Profile.h" #include "app/common/App_structs.h" -#include "app/common/src/Leaderboards/LeaderboardManager.h" +#include "app/common/Leaderboards/LeaderboardManager.h" #include "app/linux/LinuxGame.h" #include "minecraft/stats/Achievement.h" #include "minecraft/stats/Achievements.h" @@ -47,7 +48,7 @@ void StatsCounter::award(Stat* stat, unsigned int difficulty, } else { val->second.stats[difficulty] += count; - if (stat != GenericStats::timePlayed()) app.DebugPrintf(""); + if (stat != GenericStats::timePlayed()) Log::info(""); // If value has wrapped, cap it to UINT_MAX if (val->second.stats[difficulty] < @@ -67,7 +68,7 @@ void StatsCounter::award(Stat* stat, unsigned int difficulty, std::unordered_map::iterator leaderboardEntry = statBoards.find(stat); if (leaderboardEntry != statBoards.end()) { - app.DebugPrintf("[StatsCounter] award(): %X\n", + Log::info("[StatsCounter] award(): %X\n", leaderboardEntry->second << difficulty); modifiedBoards |= (leaderboardEntry->second << difficulty); if (flushCounter == 0) flushCounter = FLUSH_DELAY; @@ -253,7 +254,7 @@ void StatsCounter::flushLeaderboards() { writeStats(); LeaderboardManager::Instance()->FlushStats(); } else { - app.DebugPrintf( + Log::info( "Failed to open a session in order to write to leaderboard\n"); // 4J-JEV: If user was not signed in it would hit this. @@ -269,7 +270,7 @@ void StatsCounter::saveLeaderboards() { writeStats(); LeaderboardManager::Instance()->CloseSession(); } else { - app.DebugPrintf( + Log::info( "Failed to open a session in order to write to leaderboard\n"); // 4J-JEV: If user was not signed in it would hit this. @@ -355,7 +356,7 @@ void StatsCounter::dumpStatsToTTY() { std::vector::iterator statsEnd = Stats::all->end(); for (std::vector::iterator statsIter = Stats::all->begin(); statsIter != statsEnd; ++statsIter) { - app.DebugPrintf("%ls\t\t%u\t%u\t%u\t%u\n", (*statsIter)->name.c_str(), + Log::info("%ls\t\t%u\t%u\t%u\t%u\n", (*statsIter)->name.c_str(), getValue(*statsIter, 0), getValue(*statsIter, 1), getValue(*statsIter, 2), getValue(*statsIter, 3)); } diff --git a/targets/minecraft/stdafx.h b/targets/minecraft/stdafx.h index 2d8cf8455..6f70f09be 100644 --- a/targets/minecraft/stdafx.h +++ b/targets/minecraft/stdafx.h @@ -1,11 +1 @@ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently -// #pragma once - -#ifdef _WINDOWS64 -#include "app/windows/WindowsGame.h" -#else -#include "app/linux/LinuxGame.h" -#endif diff --git a/targets/minecraft/util/HtmlString.cpp b/targets/minecraft/util/HtmlString.cpp index cabed04bc..1de5a0876 100644 --- a/targets/minecraft/util/HtmlString.cpp +++ b/targets/minecraft/util/HtmlString.cpp @@ -4,7 +4,7 @@ #include #include -#include "app/linux/LinuxGame.h" +#include "minecraft/IGameServices.h" #include "util/StringHelpers.h" HtmlString::HtmlString(std::wstring text, eMinecraftColour hexColor, @@ -30,7 +30,7 @@ std::wstring HtmlString::ToString() { this->color == eMinecraftColour_NOT_SET ? eHTMLColor_7 : this->color; ss << L"" << text << ""; + << gameServices().getHTMLColour(color) << L"\">" << text << ""; if (italics) { ss << ""; diff --git a/targets/minecraft/util/HtmlString.h b/targets/minecraft/util/HtmlString.h index e560bc269..761e76cd2 100644 --- a/targets/minecraft/util/HtmlString.h +++ b/targets/minecraft/util/HtmlString.h @@ -4,7 +4,7 @@ #include #include -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" // 4J: Simple std::string wrapper that includes basic formatting information class HtmlString { diff --git a/targets/minecraft/util/Log.h b/targets/minecraft/util/Log.h new file mode 100644 index 000000000..ee70d553b --- /dev/null +++ b/targets/minecraft/util/Log.h @@ -0,0 +1,15 @@ +#pragma once + +#include +#include + +namespace Log { + +inline void info(const char* fmt, ...) { + va_list args; + va_start(args, fmt); + std::vfprintf(stderr, fmt, args); + va_end(args); +} + +} // namespace Log diff --git a/targets/minecraft/world/CompoundContainer.cpp b/targets/minecraft/world/CompoundContainer.cpp index f30488cf3..68cda39c9 100644 --- a/targets/minecraft/world/CompoundContainer.cpp +++ b/targets/minecraft/world/CompoundContainer.cpp @@ -1,3 +1,4 @@ +#include "minecraft/IGameServices.h" #include "CompoundContainer.h" #include "app/linux/LinuxGame.h" @@ -28,7 +29,7 @@ bool CompoundContainer::contains(std::shared_ptr c) { std::wstring CompoundContainer::getName() { if (c1->hasCustomName()) return c1->getName(); if (c2->hasCustomName()) return c2->getName(); - return app.GetString(name); + return gameServices().getString(name); } std::wstring CompoundContainer::getCustomName() { diff --git a/targets/minecraft/world/SimpleContainer.cpp b/targets/minecraft/world/SimpleContainer.cpp index 022bb38b4..63ed1175a 100644 --- a/targets/minecraft/world/SimpleContainer.cpp +++ b/targets/minecraft/world/SimpleContainer.cpp @@ -1,3 +1,4 @@ +#include "minecraft/IGameServices.h" #include "SimpleContainer.h" #include @@ -81,7 +82,7 @@ void SimpleContainer::setItem(unsigned int slot, unsigned int SimpleContainer::getContainerSize() { return size; } std::wstring SimpleContainer::getName() { - return stringName.empty() ? app.GetString(name) : stringName; + return stringName.empty() ? gameServices().getString(name) : stringName; } std::wstring SimpleContainer::getCustomName() { diff --git a/targets/minecraft/world/effect/AbsoptionMobEffect.h b/targets/minecraft/world/effect/AbsoptionMobEffect.h index 354d11477..6796292a3 100644 --- a/targets/minecraft/world/effect/AbsoptionMobEffect.h +++ b/targets/minecraft/world/effect/AbsoptionMobEffect.h @@ -1,6 +1,6 @@ #pragma once -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "MobEffect.h" class LivingEntity; diff --git a/targets/minecraft/world/effect/AttackDamageMobEffect.h b/targets/minecraft/world/effect/AttackDamageMobEffect.h index c0e4073f5..fdf709fe0 100644 --- a/targets/minecraft/world/effect/AttackDamageMobEffect.h +++ b/targets/minecraft/world/effect/AttackDamageMobEffect.h @@ -1,6 +1,6 @@ #pragma once -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "MobEffect.h" class AttributeModifier; diff --git a/targets/minecraft/world/effect/HealthBoostMobEffect.h b/targets/minecraft/world/effect/HealthBoostMobEffect.h index 309d629b6..a84c6d0f4 100644 --- a/targets/minecraft/world/effect/HealthBoostMobEffect.h +++ b/targets/minecraft/world/effect/HealthBoostMobEffect.h @@ -1,6 +1,6 @@ #pragma once -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "MobEffect.h" class LivingEntity; diff --git a/targets/minecraft/world/effect/InstantaneousMobEffect.cpp b/targets/minecraft/world/effect/InstantaneousMobEffect.cpp index 6f785fa1c..45d93636d 100644 --- a/targets/minecraft/world/effect/InstantaneousMobEffect.cpp +++ b/targets/minecraft/world/effect/InstantaneousMobEffect.cpp @@ -1,7 +1,7 @@ #include "minecraft/world/effect/InstantaneousMobEffect.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "minecraft/world/effect/MobEffect.h" InstantenousMobEffect::InstantenousMobEffect(int id, bool isHarmful, diff --git a/targets/minecraft/world/effect/InstantaneousMobEffect.h b/targets/minecraft/world/effect/InstantaneousMobEffect.h index a7bedb191..da911bb52 100644 --- a/targets/minecraft/world/effect/InstantaneousMobEffect.h +++ b/targets/minecraft/world/effect/InstantaneousMobEffect.h @@ -1,6 +1,6 @@ #pragma once -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "MobEffect.h" class InstantenousMobEffect : public MobEffect { diff --git a/targets/minecraft/world/effect/MobEffect.cpp b/targets/minecraft/world/effect/MobEffect.cpp index 16a7a6873..c9bb46bcf 100644 --- a/targets/minecraft/world/effect/MobEffect.cpp +++ b/targets/minecraft/world/effect/MobEffect.cpp @@ -9,7 +9,7 @@ #include #include -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "java/Class.h" #include "minecraft/SharedConstants.h" #include "minecraft/world/damageSource/DamageSource.h" diff --git a/targets/minecraft/world/effect/MobEffect.h b/targets/minecraft/world/effect/MobEffect.h index a25d16fde..e82a92e54 100644 --- a/targets/minecraft/world/effect/MobEffect.h +++ b/targets/minecraft/world/effect/MobEffect.h @@ -4,7 +4,7 @@ #include #include -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "minecraft/world/entity/ai/attributes/AttributeModifier.h" class Mob; diff --git a/targets/minecraft/world/effect/MobEffectInstance.cpp b/targets/minecraft/world/effect/MobEffectInstance.cpp index ad0c7f5f6..fd087cff4 100644 --- a/targets/minecraft/world/effect/MobEffectInstance.cpp +++ b/targets/minecraft/world/effect/MobEffectInstance.cpp @@ -1,3 +1,4 @@ +#include "minecraft/util/Log.h" #include "minecraft/world/effect/MobEffectInstance.h" @@ -49,7 +50,7 @@ MobEffectInstance::MobEffectInstance(MobEffectInstance* copy) { void MobEffectInstance::update(MobEffectInstance* takeOver) { if (id != takeOver->id) { - app.DebugPrintf( + Log::info( "This method should only be called for matching effects!"); } if (takeOver->amplifier > amplifier) { diff --git a/targets/minecraft/world/entity/Entity.cpp b/targets/minecraft/world/entity/Entity.cpp index 3aa5d565a..d9b45abb6 100644 --- a/targets/minecraft/world/entity/Entity.cpp +++ b/targets/minecraft/world/entity/Entity.cpp @@ -1,3 +1,5 @@ +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "Entity.h" #include @@ -15,7 +17,7 @@ #include "EntityIO.h" #include "EntityPos.h" #include "SyncedEntityData.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/linux/LinuxGame.h" #include "app/linux/Stubs/winapi_stubs.h" #include "java/Class.h" @@ -87,7 +89,7 @@ int Entity::getSmallId() { if (removedFound) { // Has set up the entityIdRemovingFlags vector in this case, so // we should check against this when allocating new ids - // app.DebugPrintf("getSmallId: + // Log::info("getSmallId: // Removed entities found\n"); puiRemovedFlags = entityIdRemovingFlags; } @@ -105,7 +107,7 @@ int Entity::getSmallId() { // should. if (puiRemovedFlags) { if (puiRemovedFlags[i] & uiMask) { - // app.DebugPrintf("Avoiding + // Log::info("Avoiding // using ID %d (0x%x)\n", i * 32 + // j,puiRemovedFlags[i]); uiMask >>= 1; @@ -123,7 +125,7 @@ int Entity::getSmallId() { puiUsedFlags++; } - app.DebugPrintf("Out of small entity Ids... possible leak?\n"); + Log::info("Out of small entity Ids... possible leak?\n"); __debugbreak(); return -1; } @@ -1862,10 +1864,10 @@ std::wstring Entity::getNetworkName() { return getDisplayName(); } void Entity::setAnimOverrideBitmask(unsigned int uiBitmask) { m_uiAnimOverrideBitmask = uiBitmask; - app.DebugPrintf("!!! Setting anim override bitmask to %d\n", uiBitmask); + Log::info("!!! Setting anim override bitmask to %d\n", uiBitmask); } unsigned int Entity::getAnimOverrideBitmask() { - if (app.GetGameSettings(eGameSetting_CustomSkinAnim) == 0) { + if (gameServices().getGameSettings(eGameSetting_CustomSkinAnim) == 0) { // We have a force animation for some skins (claptrap) // 4J-PB - treat all the eAnim_Disable flags as a force anim unsigned int uiIgnoreUserCustomSkinAnimSettingMask = diff --git a/targets/minecraft/world/entity/EntityIO.cpp b/targets/minecraft/world/entity/EntityIO.cpp index ec60be53c..5481afe51 100644 --- a/targets/minecraft/world/entity/EntityIO.cpp +++ b/targets/minecraft/world/entity/EntityIO.cpp @@ -1,3 +1,4 @@ +#include "minecraft/util/Log.h" #include "EntityIO.h" #include @@ -330,7 +331,7 @@ std::shared_ptr EntityIO::loadStatic(CompoundTag* tag, Level* level) { entity->load(tag); } else { #ifdef _DEBUG - app.DebugPrintf("Skipping Entity with id %ls\n", + Log::info("Skipping Entity with id %ls\n", tag->getString(L"id").c_str()); #endif } diff --git a/targets/minecraft/world/entity/EntityIO.h b/targets/minecraft/world/entity/EntityIO.h index 19c4cdaef..f7c804d8b 100644 --- a/targets/minecraft/world/entity/EntityIO.h +++ b/targets/minecraft/world/entity/EntityIO.h @@ -5,8 +5,8 @@ #include #include "Entity.h" -#include "app/common/App_enums.h" -#include "app/common/src/Colours/ColourTable.h" +#include "minecraft/GameEnums.h" +#include "app/common/Colours/ColourTable.h" #include "java/Class.h" #include "java/JavaIntHash.h" diff --git a/targets/minecraft/world/entity/LivingEntity.cpp b/targets/minecraft/world/entity/LivingEntity.cpp index bdc1612ab..61b041535 100644 --- a/targets/minecraft/world/entity/LivingEntity.cpp +++ b/targets/minecraft/world/entity/LivingEntity.cpp @@ -1,3 +1,4 @@ +#include "minecraft/util/Log.h" #include "LivingEntity.h" #include @@ -336,7 +337,7 @@ int LivingEntity::decreaseAirSupply(int currentSupply) { } } if (instanceof(eTYPE_PLAYER)) { - app.DebugPrintf("++++++++++ %s: Player decreasing air supply to %d\n", + Log::info("++++++++++ %s: Player decreasing air supply to %d\n", level->isClientSide ? "CLIENT" : "SERVER", currentSupply - 1); } diff --git a/targets/minecraft/world/entity/Painting.cpp b/targets/minecraft/world/entity/Painting.cpp index 5b3eeb6dc..ec9629088 100644 --- a/targets/minecraft/world/entity/Painting.cpp +++ b/targets/minecraft/world/entity/Painting.cpp @@ -1,3 +1,4 @@ +#include "minecraft/IGameServices.h" #include "Painting.h" #include @@ -77,7 +78,7 @@ Painting::Painting(Level* level, int xTile, int yTile, int zTile, int dir) // needed in the ctor 4J Stu - Added motive param for debugging/artists only void Painting::PaintingPostConstructor(int dir, int motive) { #ifndef _CONTENT_PACKAGE - if (app.DebugArtToolsOn() && motive >= 0) { + if (gameServices().debugArtToolsOn() && motive >= 0) { this->motive = (Motive*)Motive::values[motive]; setDir(dir); } else diff --git a/targets/minecraft/world/entity/SyncedEntityData.cpp b/targets/minecraft/world/entity/SyncedEntityData.cpp index 110ff13f6..3894f020a 100644 --- a/targets/minecraft/world/entity/SyncedEntityData.cpp +++ b/targets/minecraft/world/entity/SyncedEntityData.cpp @@ -1,3 +1,4 @@ +#include "minecraft/util/Log.h" #include "SyncedEntityData.h" #include @@ -332,7 +333,7 @@ SynchedEntityData::unpack(DataInputStream* input) // throws IOException new DataItem(itemType, itemId, Packet::readItem(input))); } break; default: - app.DebugPrintf( + Log::info( " ------ garbage data, or early end of stream due to an " "incomplete packet\n"); delete result; diff --git a/targets/minecraft/world/entity/ai/attributes/AttributeModifier.cpp b/targets/minecraft/world/entity/ai/attributes/AttributeModifier.cpp index 8850776aa..229c476e5 100644 --- a/targets/minecraft/world/entity/ai/attributes/AttributeModifier.cpp +++ b/targets/minecraft/world/entity/ai/attributes/AttributeModifier.cpp @@ -1,9 +1,10 @@ +#include "minecraft/IGameServices.h" #include "AttributeModifier.h" #include #include -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/linux/LinuxGame.h" #include "minecraft/util/HtmlString.h" #include "minecraft/world/entity/ai/attributes/Attribute.h" @@ -106,7 +107,7 @@ HtmlString AttributeModifier::getHoverText(eATTRIBUTE_ID attribute) { wchar_t formatted[256]; swprintf(formatted, 256, L"%ls%d%ls %ls", (amount > 0 ? L"+" : L"-"), (int)displayAmount, (percentage ? L"%" : L""), - app.GetString(Attribute::getName(attribute))); + gameServices().getString(Attribute::getName(attribute))); return HtmlString(formatted, color); } \ No newline at end of file diff --git a/targets/minecraft/world/entity/animal/EntityHorse.cpp b/targets/minecraft/world/entity/animal/EntityHorse.cpp index da40cc2ac..334b7f955 100644 --- a/targets/minecraft/world/entity/animal/EntityHorse.cpp +++ b/targets/minecraft/world/entity/animal/EntityHorse.cpp @@ -1,3 +1,4 @@ +#include "minecraft/util/Log.h" #include "EntityHorse.h" #include @@ -840,7 +841,7 @@ bool EntityHorse::mobInteract(std::shared_ptr player) { } doPlayerRide(player); - app.DebugPrintf( + Log::info( " Horse speed: %f\n", (float)(getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED) ->getValue())); @@ -1530,7 +1531,7 @@ double EntityHorse::generateRandomSpeed() { double speed = (0.45f + random->nextDouble() * .3 + random->nextDouble() * .3 + random->nextDouble() * .3) * 0.25f; - app.DebugPrintf(" Speed: %f\n", speed); + Log::info(" Speed: %f\n", speed); return speed; } diff --git a/targets/minecraft/world/entity/animal/Ocelot.cpp b/targets/minecraft/world/entity/animal/Ocelot.cpp index 4d5a382fb..54f8e30c3 100644 --- a/targets/minecraft/world/entity/animal/Ocelot.cpp +++ b/targets/minecraft/world/entity/animal/Ocelot.cpp @@ -1,3 +1,4 @@ +#include "minecraft/IGameServices.h" #include "Ocelot.h" #include @@ -306,7 +307,7 @@ MobGroupData* Ocelot::finalizeMobSpawn( groupData = TamableAnimal::finalizeMobSpawn(groupData); #ifndef _CONTENT_PACKAGE - if (app.DebugArtToolsOn() && (extraData != 0)) { + if (gameServices().debugArtToolsOn() && (extraData != 0)) { setTame(true); setCatType(extraData - 1); setOwnerUUID(Minecraft::GetInstance() diff --git a/targets/minecraft/world/entity/boss/enderdragon/EnderDragon.cpp b/targets/minecraft/world/entity/boss/enderdragon/EnderDragon.cpp index fca96218c..38d40462f 100644 --- a/targets/minecraft/world/entity/boss/enderdragon/EnderDragon.cpp +++ b/targets/minecraft/world/entity/boss/enderdragon/EnderDragon.cpp @@ -1,3 +1,4 @@ +#include "minecraft/util/Log.h" #include "EnderDragon.h" #include @@ -258,7 +259,7 @@ void EnderDragon::aiStep() { if (getSynchedAction() == e_EnderdragonAction_Sitting_Flaming || getSynchedAction() == e_EnderdragonAction_Sitting_Scanning || getSynchedAction() == e_EnderdragonAction_Sitting_Attacking) { - // app.DebugPrintf("flapSpeed is %f\n", flapSpeed); + // Log::info("flapSpeed is %f\n", flapSpeed); // flapTime += flapSpeed * 2; flapTime += 0.1f; } else if (inWall) { @@ -327,7 +328,7 @@ void EnderDragon::aiStep() { double yP = 0.0; double zP = 0.0; Vec3 v = getHeadLookVector(1); // getViewVector(1); - // app.DebugPrintf("View vector is (%f,%f,%f) - lsteps %d\n", v->x, + // Log::info("View vector is (%f,%f,%f) - lsteps %d\n", v->x, // v->y, v->z, lSteps); unsigned int d = 0; for(unsigned int d = 1; // d < 3; ++d) { @@ -403,7 +404,7 @@ void EnderDragon::aiStep() { if (m_flameAttacks >= SITTING_FLAME_ATTACKS_COUNT) { setSynchedAction(e_EnderdragonAction_Takeoff); #if PRINT_DRAGON_STATE_CHANGE_MESSAGES - app.DebugPrintf("Dragon action is now: Takeoff\n"); + Log::info("Dragon action is now: Takeoff\n"); #endif newTarget = true; } else { @@ -412,7 +413,7 @@ void EnderDragon::aiStep() { shared_from_this(), SITTING_ATTACK_VIEW_RANGE, SITTING_ATTACK_Y_VIEW_RANGE); #if PRINT_DRAGON_STATE_CHANGE_MESSAGES - app.DebugPrintf("Dragon action is now: SittingScanning\n"); + Log::info("Dragon action is now: SittingScanning\n"); #endif } } @@ -426,7 +427,7 @@ void EnderDragon::aiStep() { if (m_actionTicks > SITTING_SCANNING_IDLE_TICKS / 4) { setSynchedAction(e_EnderdragonAction_Sitting_Attacking); #if PRINT_DRAGON_STATE_CHANGE_MESSAGES - app.DebugPrintf("Dragon action is now: SittingAttacking\n"); + Log::info("Dragon action is now: SittingAttacking\n"); #endif m_actionTicks = ATTACK_TICKS; } @@ -434,7 +435,7 @@ void EnderDragon::aiStep() { if (m_actionTicks >= SITTING_SCANNING_IDLE_TICKS) { setSynchedAction(e_EnderdragonAction_Takeoff); #if PRINT_DRAGON_STATE_CHANGE_MESSAGES - app.DebugPrintf("Dragon action is now: Takeoff\n"); + Log::info("Dragon action is now: Takeoff\n"); #endif newTarget = true; } @@ -449,7 +450,7 @@ void EnderDragon::aiStep() { shared_from_this(), SITTING_ATTACK_VIEW_RANGE, SITTING_ATTACK_Y_VIEW_RANGE); #if PRINT_DRAGON_STATE_CHANGE_MESSAGES - app.DebugPrintf("Dragon action is now: SittingFlaming\n"); + Log::info("Dragon action is now: SittingFlaming\n"); #endif m_actionTicks = FLAME_TICKS; } @@ -462,7 +463,7 @@ void EnderDragon::aiStep() { if (dist > (10.0f * 10.0f)) { setSynchedAction(e_EnderdragonAction_HoldingPattern); #if PRINT_DRAGON_STATE_CHANGE_MESSAGES - app.DebugPrintf("Dragon action is now: HoldingPattern\n"); + Log::info("Dragon action is now: HoldingPattern\n"); #endif } } else if (newTarget || @@ -482,7 +483,7 @@ void EnderDragon::aiStep() { for (auto it = targets->begin(); it != targets->end(); ++it) { if ((*it)->instanceof(eTYPE_LIVINGENTITY)) { - // app.DebugPrintf("Attacking entity with acid\n"); + // Log::info("Attacking entity with acid\n"); std::shared_ptr e = std::dynamic_pointer_cast(*it); e->hurt(DamageSource::dragonbreath, 2); @@ -533,7 +534,7 @@ void EnderDragon::aiStep() { } } else { // setSynchedAction(e_EnderdragonAction_Sitting_Flaming); - // app.DebugPrintf("Dragon action is now : SittingFlaming\n"); + // Log::info("Dragon action is now : SittingFlaming\n"); // m_actionTicks = 0; } } else if (getSynchedAction() == @@ -707,16 +708,16 @@ void EnderDragon::aiStep() { m_acidArea = {acidX - 5, acidY - 17, acidZ - 5, acidX + 5, acidY + 4, acidZ + 5}; - // app.DebugPrintf("\nDragon is %s, yRot = %f, yRotA = %f, ss = %f, cc = + // Log::info("\nDragon is %s, yRot = %f, yRotA = %f, ss = %f, cc = // %f, ccTilt = %f\n",level->isClientSide?"client":"server", yRot, - // yRotA, ss, cc, ccTilt); app.DebugPrintf("Body (%f,%f,%f) to + // yRotA, ss, cc, ccTilt); Log::info("Body (%f,%f,%f) to // (%f,%f,%f)\n", body->bb.x0, body->bb.y0, body->bb.z0, - // body->bb.x1, body->bb.y1, body->bb.z1); app.DebugPrintf("Neck + // body->bb.x1, body->bb.y1, body->bb.z1); Log::info("Neck // (%f,%f,%f) to (%f,%f,%f)\n", neck->bb.x0, neck->bb.y0, // neck->bb.z0, neck->bb.x1, neck->bb.y1, neck->bb.z1); - // app.DebugPrintf("Head (%f,%f,%f) to (%f,%f,%f)\n", head->bb.x0, + // Log::info("Head (%f,%f,%f) to (%f,%f,%f)\n", head->bb.x0, // head->bb.y0, head->bb.z0, head->bb.x1, head->bb.y1, - // head->bb.z1); app.DebugPrintf("Acid (%f,%f,%f) to (%f,%f,%f)\n\n", + // head->bb.z1); Log::info("Acid (%f,%f,%f) to (%f,%f,%f)\n\n", // m_acidArea->x0, m_acidArea->y0, m_acidArea->z0, m_acidArea->x1, // m_acidArea->y1, m_acidArea->z1); } @@ -794,7 +795,7 @@ void EnderDragon::aiStep() { level->addEntity(ie); m_fireballCharge = 0; - app.DebugPrintf( + Log::info( "Finding new target due to having fired a fireball\n"); if (m_currentPath != nullptr) { while (!m_currentPath->isDone()) { @@ -928,12 +929,12 @@ void EnderDragon::findNewTarget() { PODIUM_X_POS, eggHeight, PODIUM_Z_POS); dist /= (8 * 8 * 8); } - // app.DebugPrintf("Adjusted dist is %f\n", dist); + // Log::info("Adjusted dist is %f\n", dist); if (random->nextInt(m_remainingCrystalsCount + 3) == 0) { setSynchedAction(e_EnderdragonAction_LandingApproach); #if PRINT_DRAGON_STATE_CHANGE_MESSAGES - app.DebugPrintf("Dragon action is now: LandingApproach\n"); + Log::info("Dragon action is now: LandingApproach\n"); #endif } // More likely to strafe a player if they are close to the egg, @@ -943,7 +944,7 @@ void EnderDragon::findNewTarget() { random->nextInt(m_remainingCrystalsCount + 2) == 0)) { setSynchedAction(e_EnderdragonAction_StrafePlayer); #if PRINT_DRAGON_STATE_CHANGE_MESSAGES - app.DebugPrintf("Dragon action is now: StrafePlayer\n"); + Log::info("Dragon action is now: StrafePlayer\n"); #endif } } @@ -954,14 +955,14 @@ void EnderDragon::findNewTarget() { (m_currentPath->isDone() && newTarget)) { setSynchedAction(e_EnderdragonAction_HoldingPattern); #if PRINT_DRAGON_STATE_CHANGE_MESSAGES - app.DebugPrintf("Dragon action is now: HoldingPattern\n"); + Log::info("Dragon action is now: HoldingPattern\n"); #endif } break; case e_EnderdragonAction_Landing: // setSynchedAction(e_EnderdragonAction_Sitting_Flaming); // #if PRINT_DRAGON_STATE_CHANGE_MESSAGES - // app.DebugPrintf("Dragon action is now: + // Log::info("Dragon action is now: // SittingFlaming\n"); #endif m_actionTicks = // FLAME_TICKS; @@ -971,7 +972,7 @@ void EnderDragon::findNewTarget() { SITTING_ATTACK_VIEW_RANGE, SITTING_ATTACK_Y_VIEW_RANGE); #if PRINT_DRAGON_STATE_CHANGE_MESSAGES - app.DebugPrintf("Dragon action is now: SittingScanning\n"); + Log::info("Dragon action is now: SittingScanning\n"); #endif m_actionTicks = 0; break; @@ -1005,7 +1006,7 @@ void EnderDragon::findNewTarget() { Vec3 aim = Vec3(playerNearestToEgg->x, 0, playerNearestToEgg->z) .normalize(); - // app.DebugPrintf("Final marker node near (%f,%d,%f)\n", + // Log::info("Final marker node near (%f,%d,%f)\n", // -aim->x*40,105,-aim->z*40 ); targetNodeIndex = findClosestNode(-aim.x * 40, 105.0, -aim.z * 40); @@ -1029,7 +1030,7 @@ void EnderDragon::findNewTarget() { if (m_currentPath != nullptr && m_currentPath->isDone()) { setSynchedAction(e_EnderdragonAction_Landing); #if PRINT_DRAGON_STATE_CHANGE_MESSAGES - app.DebugPrintf("Dragon action is now: Landing\n"); + Log::info("Dragon action is now: Landing\n"); #endif } } else if (getSynchedAction() == e_EnderdragonAction_Sitting_Flaming || @@ -1152,7 +1153,7 @@ bool EnderDragon::hurt(std::shared_ptr MultiEntityMobPart, int healthBefore = getHealth(); reallyHurt(source, damage); - // if(!level->isClientSide) app.DebugPrintf("Health is now %d\n", + // if(!level->isClientSide) Log::info("Health is now %d\n", // health); if (getHealth() <= 0 && !(getSynchedAction() == e_EnderdragonAction_Sitting_Flaming || @@ -1166,9 +1167,9 @@ bool EnderDragon::hurt(std::shared_ptr MultiEntityMobPart, m_currentPath->next(); } } - app.DebugPrintf("Dragon should be dead, so landing.\n"); + Log::info("Dragon should be dead, so landing.\n"); #if PRINT_DRAGON_STATE_CHANGE_MESSAGES - app.DebugPrintf("Dragon action is now: LandingApproach\n"); + Log::info("Dragon action is now: LandingApproach\n"); #endif findNewTarget(); } @@ -1185,7 +1186,7 @@ bool EnderDragon::hurt(std::shared_ptr MultiEntityMobPart, setSynchedAction(e_EnderdragonAction_Takeoff); newTarget = true; #if PRINT_DRAGON_STATE_CHANGE_MESSAGES - app.DebugPrintf("Dragon action is now: Takeoff\n"); + Log::info("Dragon action is now: Takeoff\n"); #endif } } @@ -1431,7 +1432,7 @@ bool EnderDragon::setSynchedAction(EEnderdragonAction action, if (force || validTransition) { entityData->set(DATA_ID_SYNCHED_ACTION, action); } else { - app.DebugPrintf("EnderDragon: Invalid state transition from %d to %d\n", + Log::info("EnderDragon: Invalid state transition from %d to %d\n", getSynchedAction(), action); } @@ -1452,7 +1453,7 @@ void EnderDragon::handleCrystalDestroyed(DamageSource* source) { if (m_remainingCrystalsCount < 0) m_remainingCrystalsCount = 0; delete crystals; - app.DebugPrintf("Crystal count is now %d\n", m_remainingCrystalsCount); + Log::info("Crystal count is now %d\n", m_remainingCrystalsCount); //--m_remainingCrystalsCount; @@ -1465,7 +1466,7 @@ void EnderDragon::handleCrystalDestroyed(DamageSource* source) { } m_actionTicks = 1; #if PRINT_DRAGON_STATE_CHANGE_MESSAGES - app.DebugPrintf("Dragon action is now: LandingApproach\n"); + Log::info("Dragon action is now: LandingApproach\n"); #endif } } else if (source->getEntity() != nullptr && @@ -1474,7 +1475,7 @@ void EnderDragon::handleCrystalDestroyed(DamageSource* source) { attackTarget = std::dynamic_pointer_cast(source->getEntity()); #if PRINT_DRAGON_STATE_CHANGE_MESSAGES - app.DebugPrintf("Dragon action is now: StrafePlayer\n"); + Log::info("Dragon action is now: StrafePlayer\n"); #endif strafeAttackTarget(); } @@ -1482,7 +1483,7 @@ void EnderDragon::handleCrystalDestroyed(DamageSource* source) { } void EnderDragon::strafeAttackTarget() { - app.DebugPrintf("Setting path to strafe attack target\n"); + Log::info("Setting path to strafe attack target\n"); int currentNodeIndex = findClosestNode(); int targetNodeIndex = findClosestNode(attackTarget->x, attackTarget->y, attackTarget->z); @@ -1528,9 +1529,9 @@ void EnderDragon::navigateToNextPathNode() { } while (yTarget < (curr.y)); } zTarget = curr.z; - app.DebugPrintf("Path node pos is (%f,%f,%f)\n", curr.x, curr.y, + Log::info("Path node pos is (%f,%f,%f)\n", curr.x, curr.y, curr.z); - app.DebugPrintf("Setting new target to (%f,%f,%f)\n", xTarget, yTarget, + Log::info("Setting new target to (%f,%f,%f)\n", xTarget, yTarget, zTarget); } } @@ -1575,7 +1576,7 @@ int EnderDragon::findClosestNode() { std::max((level->seaLevel + 10), level->getTopSolidBlock(nodeX, nodeZ) + yAdjustment); - app.DebugPrintf("Node %d is at (%d,%d,%d)\n", i, nodeX, nodeY, + Log::info("Node %d is at (%d,%d,%d)\n", i, nodeX, nodeY, nodeZ); (*m_nodes)[i] = new Node(nodeX, nodeY, nodeZ); @@ -1681,7 +1682,7 @@ Path* EnderDragon::findPath(int startIndex, int endIndex, Node* x = openSet->pop(); if (x->equals(to)) { - app.DebugPrintf("Found path from %d to %d\n", startIndex, endIndex); + Log::info("Found path from %d to %d\n", startIndex, endIndex); if (finalNode != nullptr) { finalNode->cameFrom = to; to = finalNode; @@ -1725,7 +1726,7 @@ Path* EnderDragon::findPath(int startIndex, int endIndex, } if (closest == from) return nullptr; - app.DebugPrintf("Failed to find path from %d to %d\n", startIndex, + Log::info("Failed to find path from %d to %d\n", startIndex, endIndex); if (finalNode != nullptr) { finalNode->cameFrom = closest; @@ -1755,7 +1756,7 @@ Path* EnderDragon::reconstruct_path(Node* from, Node* to) { } void EnderDragon::addAdditonalSaveData(CompoundTag* entityTag) { - app.DebugPrintf("Adding EnderDragon additional save data\n"); + Log::info("Adding EnderDragon additional save data\n"); entityTag->putShort(L"RemainingCrystals", m_remainingCrystalsCount); entityTag->putInt(L"DragonState", (int)getSynchedAction()); @@ -1763,7 +1764,7 @@ void EnderDragon::addAdditonalSaveData(CompoundTag* entityTag) { } void EnderDragon::readAdditionalSaveData(CompoundTag* tag) { - app.DebugPrintf("Reading EnderDragon additional save data\n"); + Log::info("Reading EnderDragon additional save data\n"); m_remainingCrystalsCount = tag->getShort(L"RemainingCrystals"); if (!tag->contains(L"RemainingCrystals")) m_remainingCrystalsCount = CRYSTAL_COUNT; @@ -1795,7 +1796,7 @@ float EnderDragon::getTilt(float a) { tilt = (latencyPosA[1] - latencyPosB[1]) * 10; } - // app.DebugPrintf("Tilt is %f\n", tilt); + // Log::info("Tilt is %f\n", tilt); return tilt; } @@ -1819,7 +1820,7 @@ double EnderDragon::getHeadYOffset(float a) { headYOffset = (p0[1] - p1[1]) * 1; } - // app.DebugPrintf("headYOffset is %f\n", headYOffset); + // Log::info("headYOffset is %f\n", headYOffset); return headYOffset; } @@ -1846,7 +1847,7 @@ double EnderDragon::getHeadPartYOffset(int partIndex, sqrt(distanceToSqr(PODIUM_X_POS, eggHeight, PODIUM_Z_POS)) / 4; if (dist < 1.0f) dist = 1.0f; result = partIndex / dist; - // app.DebugPrintf("getHeadPartYOffset - dist = %f, result = %f (%d)\n", + // Log::info("getHeadPartYOffset - dist = %f, result = %f (%d)\n", // dist, result, partIndex); } else if (getSynchedAction() == e_EnderdragonAction_Sitting_Flaming || getSynchedAction() == e_EnderdragonAction_Sitting_Scanning || @@ -1859,7 +1860,7 @@ double EnderDragon::getHeadPartYOffset(int partIndex, result = partPos[1] - bodyPos[1]; } } - // app.DebugPrintf("Part %d is at %f\n", partIndex, result); + // Log::info("Part %d is at %f\n", partIndex, result); return result; } @@ -1877,7 +1878,7 @@ double EnderDragon::getHeadPartYRotDiff(int partIndex, { result = partPos[0] - bodyPos[0]; } - // app.DebugPrintf("Part %d is at %f\n", partIndex, result); + // Log::info("Part %d is at %f\n", partIndex, result); return result; } diff --git a/targets/minecraft/world/entity/boss/enderdragon/EnderDragon.h b/targets/minecraft/world/entity/boss/enderdragon/EnderDragon.h index 454c74c6a..bcdca72cf 100644 --- a/targets/minecraft/world/entity/boss/enderdragon/EnderDragon.h +++ b/targets/minecraft/world/entity/boss/enderdragon/EnderDragon.h @@ -5,7 +5,7 @@ #include #include -#include "app/linux/LinuxGame.h" +#include "minecraft/IGameServices.h" #include "java/Class.h" #include "minecraft/stdafx.h" #include "minecraft/world/entity/LivingEntity.h" @@ -207,7 +207,7 @@ public: std::vector& partPos); Vec3 getHeadLookVector(float a); - virtual std::wstring getAName() { return app.GetString(IDS_ENDERDRAGON); }; + virtual std::wstring getAName() { return gameServices().getString(IDS_ENDERDRAGON); }; virtual float getHealth() { return LivingEntity::getHealth(); }; virtual float getMaxHealth() { return LivingEntity::getMaxHealth(); }; }; diff --git a/targets/minecraft/world/entity/boss/wither/WitherBoss.h b/targets/minecraft/world/entity/boss/wither/WitherBoss.h index 58ae44577..543d2671b 100644 --- a/targets/minecraft/world/entity/boss/wither/WitherBoss.h +++ b/targets/minecraft/world/entity/boss/wither/WitherBoss.h @@ -3,7 +3,7 @@ #include #include -#include "app/linux/LinuxGame.h" +#include "minecraft/IGameServices.h" #include "java/Class.h" #include "minecraft/stdafx.h" #include "minecraft/world/entity/EntitySelector.h" @@ -120,5 +120,5 @@ public: // 4J Stu - These are required for the BossMob interface virtual float getMaxHealth() { return Monster::getMaxHealth(); }; virtual float getHealth() { return Monster::getHealth(); }; - virtual std::wstring getAName() { return app.GetString(IDS_WITHER); }; + virtual std::wstring getAName() { return gameServices().getString(IDS_WITHER); }; }; \ No newline at end of file diff --git a/targets/minecraft/world/entity/item/ItemEntity.cpp b/targets/minecraft/world/entity/item/ItemEntity.cpp index 062bc1247..b0983522c 100644 --- a/targets/minecraft/world/entity/item/ItemEntity.cpp +++ b/targets/minecraft/world/entity/item/ItemEntity.cpp @@ -1,3 +1,4 @@ +#include "minecraft/util/Log.h" #include "ItemEntity.h" #include @@ -280,7 +281,7 @@ std::shared_ptr ItemEntity::getItem() { if (result == nullptr) { if (level != nullptr) { - app.DebugPrintf("Item entity %d has no item?!\n", entityId); + Log::info("Item entity %d has no item?!\n", entityId); // level.getLogger().severe("Item entity " + entityId + " has no // item?!"); } diff --git a/targets/minecraft/world/entity/item/MinecartContainer.cpp b/targets/minecraft/world/entity/item/MinecartContainer.cpp index 728e20e8f..5e3cb8fa9 100644 --- a/targets/minecraft/world/entity/item/MinecartContainer.cpp +++ b/targets/minecraft/world/entity/item/MinecartContainer.cpp @@ -1,3 +1,4 @@ +#include "minecraft/IGameServices.h" #include "MinecartContainer.h" #include @@ -119,7 +120,7 @@ bool MinecartContainer::canPlaceItem(int slot, std::wstring MinecartContainer::getName() { return hasCustomName() ? getCustomName() - : app.GetString(IDS_CONTAINER_MINECART); + : gameServices().getString(IDS_CONTAINER_MINECART); } int MinecartContainer::getMaxStackSize() { diff --git a/targets/minecraft/world/entity/monster/EnderMan.cpp b/targets/minecraft/world/entity/monster/EnderMan.cpp index b44f8fda6..2b8782aea 100644 --- a/targets/minecraft/world/entity/monster/EnderMan.cpp +++ b/targets/minecraft/world/entity/monster/EnderMan.cpp @@ -1,3 +1,4 @@ +#include "minecraft/IGameServices.h" #include "EnderMan.h" #include @@ -106,7 +107,7 @@ void EnderMan::readAdditionalSaveData(CompoundTag* tag) { std::shared_ptr EnderMan::findAttackTarget() { #ifndef _FINAL_BUILD - if (app.GetMobsDontAttackEnabled()) { + if (gameServices().debugMobsDontAttack()) { return std::shared_ptr(); } #endif diff --git a/targets/minecraft/world/entity/monster/Monster.cpp b/targets/minecraft/world/entity/monster/Monster.cpp index 8a3efd90d..b2cbfaf04 100644 --- a/targets/minecraft/world/entity/monster/Monster.cpp +++ b/targets/minecraft/world/entity/monster/Monster.cpp @@ -1,3 +1,4 @@ +#include "minecraft/IGameServices.h" #include "Monster.h" #include @@ -48,7 +49,7 @@ void Monster::tick() { std::shared_ptr Monster::findAttackTarget() { #ifndef _FINAL_BUILD - if (app.GetMobsDontAttackEnabled()) { + if (gameServices().debugMobsDontAttack()) { return std::shared_ptr(); } #endif diff --git a/targets/minecraft/world/entity/monster/PigZombie.cpp b/targets/minecraft/world/entity/monster/PigZombie.cpp index 1c7a7544b..4fbd725d3 100644 --- a/targets/minecraft/world/entity/monster/PigZombie.cpp +++ b/targets/minecraft/world/entity/monster/PigZombie.cpp @@ -1,3 +1,4 @@ +#include "minecraft/IGameServices.h" #include "PigZombie.h" #include @@ -93,7 +94,7 @@ void PigZombie::readAdditionalSaveData(CompoundTag* tag) { std::shared_ptr PigZombie::findAttackTarget() { #ifndef _FINAL_BUILD #ifdef _DEBUG_MENUS_ENABLED - if (app.GetMobsDontAttackEnabled()) { + if (gameServices().debugMobsDontAttack()) { return std::shared_ptr(); } #endif diff --git a/targets/minecraft/world/entity/monster/SharedMonsterAttributes.cpp b/targets/minecraft/world/entity/monster/SharedMonsterAttributes.cpp index a3c3e8b1d..14eedd839 100644 --- a/targets/minecraft/world/entity/monster/SharedMonsterAttributes.cpp +++ b/targets/minecraft/world/entity/monster/SharedMonsterAttributes.cpp @@ -1,3 +1,4 @@ +#include "minecraft/util/Log.h" #include "SharedMonsterAttributes.h" #include @@ -93,7 +94,7 @@ void SharedMonsterAttributes::loadAttributes(BaseAttributeMap* attributes, if (instance != nullptr) { loadAttribute(instance, tag); } else { - app.DebugPrintf("Ignoring unknown attribute '%d'", + Log::info("Ignoring unknown attribute '%d'", tag->getInt(L"ID")); } } diff --git a/targets/minecraft/world/entity/monster/Silverfish.cpp b/targets/minecraft/world/entity/monster/Silverfish.cpp index f44581675..c2ad4f2b1 100644 --- a/targets/minecraft/world/entity/monster/Silverfish.cpp +++ b/targets/minecraft/world/entity/monster/Silverfish.cpp @@ -1,3 +1,4 @@ +#include "minecraft/IGameServices.h" #include "Silverfish.h" #include @@ -43,7 +44,7 @@ bool Silverfish::makeStepSound() { return false; } std::shared_ptr Silverfish::findAttackTarget() { #ifndef _FINAL_BUILD - if (app.GetMobsDontAttackEnabled()) { + if (gameServices().debugMobsDontAttack()) { return std::shared_ptr(); } #endif diff --git a/targets/minecraft/world/entity/monster/Spider.cpp b/targets/minecraft/world/entity/monster/Spider.cpp index 31f1fb95d..3e2e1f27a 100644 --- a/targets/minecraft/world/entity/monster/Spider.cpp +++ b/targets/minecraft/world/entity/monster/Spider.cpp @@ -1,3 +1,4 @@ +#include "minecraft/IGameServices.h" #include "Spider.h" #include @@ -60,7 +61,7 @@ void Spider::registerAttributes() { std::shared_ptr Spider::findAttackTarget() { #ifndef _FINAL_BUILD #ifdef _DEBUG_MENUS_ENABLED - if (app.GetMobsDontAttackEnabled()) { + if (gameServices().debugMobsDontAttack()) { return std::shared_ptr(); } #endif diff --git a/targets/minecraft/world/entity/npc/Villager.cpp b/targets/minecraft/world/entity/npc/Villager.cpp index 07502eb47..ba0369d5f 100644 --- a/targets/minecraft/world/entity/npc/Villager.cpp +++ b/targets/minecraft/world/entity/npc/Villager.cpp @@ -1,3 +1,4 @@ +#include "minecraft/IGameServices.h" #include "Villager.h" #include @@ -796,5 +797,5 @@ std::wstring Villager::getDisplayName() { name = IDS_VILLAGER_BUTCHER; break; }; - return app.GetString(name); + return gameServices().getString(name); } diff --git a/targets/minecraft/world/entity/player/Inventory.cpp b/targets/minecraft/world/entity/player/Inventory.cpp index efc5dfe3e..4e853f9a6 100644 --- a/targets/minecraft/world/entity/player/Inventory.cpp +++ b/targets/minecraft/world/entity/player/Inventory.cpp @@ -1,3 +1,5 @@ +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "Inventory.h" #include @@ -391,14 +393,14 @@ void Inventory::setItem(unsigned int slot, std::shared_ptr item) { #ifdef _DEBUG if (item != nullptr) { std::wstring itemstring = item->toString(); - app.DebugPrintf("Inventory::setItem - slot = %d,\t item = %d ", slot, + Log::info("Inventory::setItem - slot = %d,\t item = %d ", slot, item->id); // OutputDebugStringW(itemstring.c_str()); - app.DebugPrintf("\n"); + Log::info("\n"); } #else if (item != nullptr) { - app.DebugPrintf( + Log::info( "Inventory::setItem - slot = %d,\t item = %d, aux = %d\n", slot, item->id, item->getAuxValue()); } @@ -488,7 +490,7 @@ std::shared_ptr Inventory::getItem(unsigned int slot) { */ } -std::wstring Inventory::getName() { return app.GetString(IDS_INVENTORY); } +std::wstring Inventory::getName() { return gameServices().getString(IDS_INVENTORY); } std::wstring Inventory::getCustomName() { return L""; } diff --git a/targets/minecraft/world/entity/player/Player.cpp b/targets/minecraft/world/entity/player/Player.cpp index 942b575b0..53af16211 100644 --- a/targets/minecraft/world/entity/player/Player.cpp +++ b/targets/minecraft/world/entity/player/Player.cpp @@ -1,3 +1,5 @@ +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" // 4J TODO // All the instanceof s from Java have been converted to dynamic_cast in this @@ -20,11 +22,11 @@ #include #include "Inventory.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/App_structs.h" #include "app/common/Minecraft_Macros.h" -#include "app/common/src/DLC/DLCManager.h" -#include "app/common/src/DLC/DLCSkinFile.h" +#include "app/common/DLC/DLCManager.h" +#include "app/common/DLC/DLCSkinFile.h" #include "app/linux/LinuxGame.h" #include "java/JavaMath.h" #include "java/Random.h" @@ -182,7 +184,7 @@ Player::Player(Level* level, const std::wstring& name) : LivingEntity(level) { m_OnlineXuid = INVALID_XUID; // m_bShownOnMaps = true; setShowOnMaps( - app.GetGameHostOption(eGameHostOption_Gamertags) != 0 ? true : false); + gameServices().getGameHostOption(eGameHostOption_Gamertags) != 0 ? true : false); m_bIsGuest = false; // 4J: Set UUID to name on none-XB1 consoles, may change in future but for @@ -569,34 +571,34 @@ void Player::setCustomSkin(std::uint32_t skinId) { setPlayerDefaultSkin(playerSkin); m_dwSkinId = skinId; - this->customTextureUrl = app.getSkinPathFromId(skinId); + this->customTextureUrl = gameServices().getSkinPathFromId(skinId); // set the new player additional boxes - /*vector *pvModelParts=app.GetAdditionalModelParts(m_dwSkinId); + /*vector *pvModelParts=gameServices().getAdditionalModelParts(m_dwSkinId); if(pvModelParts==nullptr) { // we don't have the data from the dlc skin yet - app.DebugPrintf("Couldn't get model parts for skin %X\n",m_dwSkinId); + Log::info("Couldn't get model parts for skin %X\n",m_dwSkinId); // do we have it from the DLC pack? DLCSkinFile *pDLCSkinFile = - app.m_dlcManager.getSkinFile(this->customTextureUrl); + gameServices().getDLCSkinFile(this->customTextureUrl); if(pDLCSkinFile!=nullptr) { const int additionalBoxCount = pDLCSkinFile->getAdditionalBoxesCount(); if(additionalBoxCount != 0) { - app.DebugPrintf("Got model parts from DLCskin for skin %X\n",m_dwSkinId); - pvModelParts=app.SetAdditionalSkinBoxes(m_dwSkinId,pDLCSkinFile->getAdditionalBoxes()); + Log::info("Got model parts from DLCskin for skin %X\n",m_dwSkinId); + pvModelParts=gameServices().setAdditionalSkinBoxesFromVec(m_dwSkinId,pDLCSkinFile->getAdditionalBoxes()); this->SetAdditionalModelParts(pvModelParts); } else { this->SetAdditionalModelParts(nullptr); } - app.SetAnimOverrideBitmask(pDLCSkinFile->getSkinID(),pDLCSkinFile->getAnimOverrideBitmask()); + gameServices().setAnimOverrideBitmask(pDLCSkinFile->getSkinID(),pDLCSkinFile->getAnimOverrideBitmask()); } else { @@ -605,7 +607,7 @@ void Player::setCustomSkin(std::uint32_t skinId) { } else { - app.DebugPrintf("Got model parts from app.GetAdditionalModelParts for skin + Log::info("Got model parts from app.GetAdditionalModelParts for skin %X\n",m_dwSkinId); this->SetAdditionalModelParts(pvModelParts); @@ -650,7 +652,7 @@ unsigned int Player::getSkinAnimOverrideBitmask(std::uint32_t skinId) { default: // This is not one of the prefined skins // Does the app have an anim override for this skin? - bitmask = app.GetAnimOverrideBitmask(skinId); + bitmask = gameServices().getAnimOverrideBitmask(skinId); break; } } @@ -670,13 +672,13 @@ void Player::setCustomCape(std::uint32_t capeId) { if (capeId > 0) { this->customTextureUrl2 = Player::getCapePathFromId(capeId); } else { - MOJANG_DATA* pMojangData = app.GetMojangDataForXuid(getOnlineXuid()); + MOJANG_DATA* pMojangData = gameServices().getMojangDataForXuid(getOnlineXuid()); if (pMojangData) { // Cape if (pMojangData->wchCape[0] != 0) { this->customTextureUrl2 = pMojangData->wchCape; } else { - if (app.DefaultCapeExists()) { + if (gameServices().defaultCapeExists()) { this->customTextureUrl2 = std::wstring(L"Special_Cape.png"); } else { this->customTextureUrl2 = std::wstring(L""); @@ -685,7 +687,7 @@ void Player::setCustomCape(std::uint32_t capeId) { } else { // if there is a custom default cloak, then set it here - if (app.DefaultCapeExists()) { + if (gameServices().defaultCapeExists()) { this->customTextureUrl2 = std::wstring(L"Special_Cape.png"); } else { this->customTextureUrl2 = std::wstring(L""); @@ -744,23 +746,23 @@ std::wstring Player::getCapePathFromId(std::uint32_t capeId) { } void Player::ChangePlayerSkin() { - if (app.vSkinNames.size() > 0) { + if (gameServices().getSkinNames().size() > 0) { m_uiPlayerCurrentSkin++; - if (m_uiPlayerCurrentSkin > app.vSkinNames.size()) { + if (m_uiPlayerCurrentSkin > gameServices().getSkinNames().size()) { m_uiPlayerCurrentSkin = 0; this->customTextureUrl = L""; } else { if (m_uiPlayerCurrentSkin > 0) { // change this players custom texture url this->customTextureUrl = - app.vSkinNames[m_uiPlayerCurrentSkin - 1]; + gameServices().getSkinNames()[m_uiPlayerCurrentSkin - 1]; } } } } void Player::prepareCustomTextures() { - MOJANG_DATA* pMojangData = app.GetMojangDataForXuid(getOnlineXuid()); + MOJANG_DATA* pMojangData = gameServices().getMojangDataForXuid(getOnlineXuid()); if (pMojangData) { // Skin @@ -776,7 +778,7 @@ void Player::prepareCustomTextures() { //} // else //{ - // if(app.DefaultCapeExists()) + // if(gameServices().defaultCapeExists()) // { // this->customTextureUrl2= wstring(L"Default_Cape.png"); // } @@ -789,7 +791,7 @@ void Player::prepareCustomTextures() { } else { // 4J Stu - Don't update the cape here, it gets set elsewhere // if there is a custom default cloak, then set it here - // if(app.DefaultCapeExists()) + // if(gameServices().defaultCapeExists()) //{ // this->customTextureUrl2= wstring(L"Default_Cape.png"); //} @@ -933,7 +935,7 @@ void Player::die(DamageSource* source) { yd = 0.1f; // 4J - TODO need to use a xuid - if (app.isXuidNotch(m_xuid)) { + if (gameServices().isXuidNotch(m_xuid)) { drop(std::make_shared(Item::apple, 1), true); } if (!level->getGameRules()->getBoolean(GameRules::RULE_KEEPINVENTORY)) { @@ -2081,7 +2083,7 @@ void Player::causeFoodExhaustion(float amount) { // 4J Stu - Added 1.8.2 bug fix (TU6) - If players cannot eat, then their // food bar should not decrease due to exhaustion - if (app.GetGameHostOption(eGameHostOption_TrustPlayers) == 0 && + if (gameServices().getGameHostOption(eGameHostOption_TrustPlayers) == 0 && getPlayerGamePrivilege(Player::ePlayerGamePrivilege_CannotBuild) != 0) return; @@ -2387,7 +2389,7 @@ void Player::setPlayerGamePrivilege(unsigned int& uiGamePrivileges, bool Player::isAllowedToUse(Tile* tile) { bool allowed = true; if (tile != nullptr && - app.GetGameHostOption(eGameHostOption_TrustPlayers) == 0) { + gameServices().getGameHostOption(eGameHostOption_TrustPlayers) == 0) { allowed = false; if (getPlayerGamePrivilege( @@ -2458,7 +2460,7 @@ bool Player::isAllowedToUse(Tile* tile) { bool Player::isAllowedToUse(std::shared_ptr item) { bool allowed = true; if (item != nullptr && - app.GetGameHostOption(eGameHostOption_TrustPlayers) == 0) { + gameServices().getGameHostOption(eGameHostOption_TrustPlayers) == 0) { if (getPlayerGamePrivilege(Player::ePlayerGamePrivilege_CannotBuild) != 0) { allowed = false; @@ -2502,7 +2504,7 @@ bool Player::isAllowedToUse(std::shared_ptr item) { bool Player::isAllowedToInteract(std::shared_ptr target) { bool allowed = true; - if (app.GetGameHostOption(eGameHostOption_TrustPlayers) == 0) { + if (gameServices().getGameHostOption(eGameHostOption_TrustPlayers) == 0) { if (target->instanceof(eTYPE_MINECART)) { if (getPlayerGamePrivilege( Player::ePlayerGamePrivilege_CanUseContainers) == 0) { @@ -2530,7 +2532,7 @@ bool Player::isAllowedToInteract(std::shared_ptr target) { bool Player::isAllowedToMine() { bool allowed = true; - if (app.GetGameHostOption(eGameHostOption_TrustPlayers) == 0) { + if (gameServices().getGameHostOption(eGameHostOption_TrustPlayers) == 0) { if (getPlayerGamePrivilege(Player::ePlayerGamePrivilege_CannotMine) != 0) { allowed = false; @@ -2542,7 +2544,7 @@ bool Player::isAllowedToMine() { bool Player::isAllowedToAttackPlayers() { bool allowed = true; if (hasInvisiblePrivilege() || - ((app.GetGameHostOption(eGameHostOption_TrustPlayers) == 0) && + ((gameServices().getGameHostOption(eGameHostOption_TrustPlayers) == 0) && getPlayerGamePrivilege( Player::ePlayerGamePrivilege_CannotAttackPlayers))) { allowed = false; @@ -2552,7 +2554,7 @@ bool Player::isAllowedToAttackPlayers() { bool Player::isAllowedToAttackAnimals() { bool allowed = true; - if ((app.GetGameHostOption(eGameHostOption_TrustPlayers) == 0) && + if ((gameServices().getGameHostOption(eGameHostOption_TrustPlayers) == 0) && getPlayerGamePrivilege( Player::ePlayerGamePrivilege_CannotAttackAnimals)) { allowed = false; @@ -2586,7 +2588,7 @@ bool Player::isAllowedToHurtEntity(std::shared_ptr target) { bool Player::isAllowedToFly() { bool allowed = false; - if (app.GetGameHostOption(eGameHostOption_HostCanFly) != 0 && + if (gameServices().getGameHostOption(eGameHostOption_HostCanFly) != 0 && getPlayerGamePrivilege(Player::ePlayerGamePrivilege_CanFly) != 0) { allowed = true; } @@ -2595,7 +2597,7 @@ bool Player::isAllowedToFly() { bool Player::isAllowedToIgnoreExhaustion() { bool allowed = false; - if ((app.GetGameHostOption(eGameHostOption_HostCanChangeHunger) != 0 && + if ((gameServices().getGameHostOption(eGameHostOption_HostCanChangeHunger) != 0 && getPlayerGamePrivilege(Player::ePlayerGamePrivilege_ClassicHunger) != 0) || (isAllowedToFly() && abilities.flying)) { @@ -2615,7 +2617,7 @@ bool Player::isAllowedToTeleport() { bool Player::hasInvisiblePrivilege() { bool enabled = false; - if (app.GetGameHostOption(eGameHostOption_HostCanBeInvisible) != 0 && + if (gameServices().getGameHostOption(eGameHostOption_HostCanBeInvisible) != 0 && getPlayerGamePrivilege(Player::ePlayerGamePrivilege_Invisible) != 0) { enabled = true; } @@ -2624,7 +2626,7 @@ bool Player::hasInvisiblePrivilege() { bool Player::hasInvulnerablePrivilege() { bool enabled = false; - if (app.GetGameHostOption(eGameHostOption_HostCanBeInvisible) != 0 && + if (gameServices().getGameHostOption(eGameHostOption_HostCanBeInvisible) != 0 && getPlayerGamePrivilege(Player::ePlayerGamePrivilege_Invulnerable) != 0) { enabled = true; @@ -2671,14 +2673,14 @@ std::vector* Player::GetAdditionalModelParts() { customTextureUrl.substr(0, 3).compare(L"def") == 0; // see if we can find the parts - m_ppAdditionalModelParts = app.GetAdditionalModelParts(m_dwSkinId); + m_ppAdditionalModelParts = gameServices().getAdditionalModelParts(m_dwSkinId); // If it's a default texture (which has no parts), we have the parts, or // we already have the texture (in which case we should have parts if // there are any) then we are done if (!hasCustomTexture || customTextureIsDefaultSkin || m_ppAdditionalModelParts != nullptr || - app.IsFileInMemoryTextures(customTextureUrl)) { + gameServices().isFileInMemoryTextures(customTextureUrl)) { m_bCheckedForModelParts = true; } if (m_ppAdditionalModelParts == nullptr && @@ -2686,28 +2688,28 @@ std::vector* Player::GetAdditionalModelParts() { m_bCheckedDLCForModelParts = true; // we don't have the data from the dlc skin yet - app.DebugPrintf( + Log::info( "m_bCheckedForModelParts Couldn't get model parts for skin " "%X\n", m_dwSkinId); // do we have it from the DLC pack? DLCSkinFile* pDLCSkinFile = - app.m_dlcManager.getSkinFile(this->customTextureUrl); + gameServices().getDLCSkinFile(this->customTextureUrl); if (pDLCSkinFile != nullptr) { const int additionalBoxCount = pDLCSkinFile->getAdditionalBoxesCount(); if (additionalBoxCount != 0) { - app.DebugPrintf( + Log::info( "m_bCheckedForModelParts Got model parts from DLCskin " "for skin %X\n", m_dwSkinId); - m_ppAdditionalModelParts = app.SetAdditionalSkinBoxes( + m_ppAdditionalModelParts = gameServices().setAdditionalSkinBoxesFromVec( m_dwSkinId, pDLCSkinFile->getAdditionalBoxes()); } - app.SetAnimOverrideBitmask( + gameServices().setAnimOverrideBitmask( pDLCSkinFile->getSkinID(), pDLCSkinFile->getAnimOverrideBitmask()); diff --git a/targets/minecraft/world/entity/projectile/Arrow.cpp b/targets/minecraft/world/entity/projectile/Arrow.cpp index a2f4cd331..29e72035c 100644 --- a/targets/minecraft/world/entity/projectile/Arrow.cpp +++ b/targets/minecraft/world/entity/projectile/Arrow.cpp @@ -1,3 +1,4 @@ +#include "minecraft/util/Log.h" #include "Arrow.h" #include @@ -182,7 +183,7 @@ void Arrow::lerpMotion(double xd, double yd, double zd) { xRotO = xRot = (float)(atan2(yd, sd) * 180 / std::numbers::pi); xRotO = xRot; yRotO = yRot; - app.DebugPrintf("%f %f : 0x%x\n", xRot, yRot, &yRot); + Log::info("%f %f : 0x%x\n", xRot, yRot, &yRot); moveTo(x, y, z, yRot, xRot); life = 0; } diff --git a/targets/minecraft/world/entity/projectile/Fireball.cpp b/targets/minecraft/world/entity/projectile/Fireball.cpp index bab78c6f4..05a6b9eb2 100644 --- a/targets/minecraft/world/entity/projectile/Fireball.cpp +++ b/targets/minecraft/world/entity/projectile/Fireball.cpp @@ -1,3 +1,4 @@ +#include "minecraft/util/Log.h" #include "Fireball.h" #include @@ -133,7 +134,7 @@ void Fireball::tick() { if (!level->isClientSide) { if ((owner != nullptr && owner->removed) || !level->hasChunkAt((int)x, (int)y, (int)z)) { - app.DebugPrintf( + Log::info( "Fireball removed - owner is null or removed is true for " "owner\n"); remove(); @@ -146,7 +147,7 @@ void Fireball::tick() { if ((x <= minXZ) || (x >= maxXZ) || (z <= minXZ) || (z >= maxXZ)) { remove(); - app.DebugPrintf("Fireball removed - end of world\n"); + Log::info("Fireball removed - end of world\n"); return; } } @@ -154,7 +155,7 @@ void Fireball::tick() { Entity::tick(); - // app.DebugPrintf("Fireball x %d, y %d, z%d\n",(int)x,(int)y,(int)z); + // Log::info("Fireball x %d, y %d, z%d\n",(int)x,(int)y,(int)z); if (shouldBurn()) setOnFire(1); @@ -164,7 +165,7 @@ void Fireball::tick() { life++; if (life == SharedConstants::TICKS_PER_SECOND * 30) { remove(); - app.DebugPrintf("Fireball removed - life is 20*60\n"); + Log::info("Fireball removed - life is 20*60\n"); } return; } else { @@ -264,7 +265,7 @@ void Fireball::tick() { xd = 0.0; zd = 0.0; yd = 0.0; - app.DebugPrintf("Removing a fireball with zero velocity\n"); + Log::info("Removing a fireball with zero velocity\n"); remove(); } } diff --git a/targets/minecraft/world/inventory/AnvilMenu.cpp b/targets/minecraft/world/inventory/AnvilMenu.cpp index 4032dcfb7..5e9fae9de 100644 --- a/targets/minecraft/world/inventory/AnvilMenu.cpp +++ b/targets/minecraft/world/inventory/AnvilMenu.cpp @@ -1,3 +1,4 @@ +#include "minecraft/util/Log.h" #include "AnvilMenu.h" #include @@ -72,7 +73,7 @@ void AnvilMenu::createResult() { int tax = 0; int namingCost = 0; - if (DEBUG_COST) app.DebugPrintf("----"); + if (DEBUG_COST) Log::info("----"); if (input == nullptr) { resultSlots->setItem(0, nullptr); @@ -89,7 +90,7 @@ void AnvilMenu::createResult() { tax += input->getBaseRepairCost() + (addition == nullptr ? 0 : addition->getBaseRepairCost()); if (DEBUG_COST) { - app.DebugPrintf( + Log::info( "Starting with base repair tax of %d (%d + %d)\n", tax, input->getBaseRepairCost(), (addition == nullptr ? 0 : addition->getBaseRepairCost())); @@ -146,7 +147,7 @@ void AnvilMenu::createResult() { result->setAuxValue(resultDamage); price += std::max(1, additional / 100); if (DEBUG_COST) { - app.DebugPrintf( + Log::info( "Repairing; price is now %d (went up by %d)\n", price, std::max(1, additional / 100)); } @@ -183,7 +184,7 @@ void AnvilMenu::createResult() { price += extra; if (DEBUG_COST) { - app.DebugPrintf( + Log::info( "Enchantment incompatibility fee; price is " "now %d (went up by %d)\n", price, extra); @@ -216,7 +217,7 @@ void AnvilMenu::createResult() { price += fee * extra; if (DEBUG_COST) { - app.DebugPrintf( + Log::info( "Enchantment increase fee; price is now %d (went " "up by %d)\n", price, fee * extra); @@ -232,7 +233,7 @@ void AnvilMenu::createResult() { price += namingCost; if (DEBUG_COST) { - app.DebugPrintf( + Log::info( "Un-naming cost; price is now %d (went up by %d)", price, namingCost); } @@ -245,7 +246,7 @@ void AnvilMenu::createResult() { price += namingCost; if (DEBUG_COST) { - app.DebugPrintf("Naming cost; price is now %d (went up by %d)", + Log::info("Naming cost; price is now %d (went up by %d)", price, namingCost); } @@ -253,7 +254,7 @@ void AnvilMenu::createResult() { tax += namingCost / 2; if (DEBUG_COST) { - app.DebugPrintf( + Log::info( "Already-named tax; tax is now %d (went up by %d)", tax, (namingCost / 2)); } @@ -290,7 +291,7 @@ void AnvilMenu::createResult() { tax += count + level * fee; if (DEBUG_COST) { - app.DebugPrintf( + Log::info( "Enchantment tax; tax is now %d (went up by %d)", tax, (count + level * fee)); } @@ -300,18 +301,18 @@ void AnvilMenu::createResult() { cost = tax + price; if (price <= 0) { - if (DEBUG_COST) app.DebugPrintf("No purchase, only tax; aborting"); + if (DEBUG_COST) Log::info("No purchase, only tax; aborting"); result = nullptr; } if (namingCost == price && namingCost > 0 && cost >= 40) { - if (DEBUG_COST) app.DebugPrintf("Cost is too high; aborting"); - app.DebugPrintf( + if (DEBUG_COST) Log::info("Cost is too high; aborting"); + Log::info( "Naming an item only, cost too high; giving discount to cap " "cost to 39 levels"); cost = 39; } if (cost >= 40 && !player->abilities.instabuild) { - if (DEBUG_COST) app.DebugPrintf("Cost is too high; aborting"); + if (DEBUG_COST) Log::info("Cost is too high; aborting"); result = nullptr; } @@ -334,10 +335,10 @@ void AnvilMenu::createResult() { if (DEBUG_COST) { if (level->isClientSide) { - app.DebugPrintf("CLIENT Cost is %d (%d price, %d tax)\n", cost, + Log::info("CLIENT Cost is %d (%d price, %d tax)\n", cost, price, tax); } else { - app.DebugPrintf("SERVER Cost is %d (%d price, %d tax)\n", cost, + Log::info("SERVER Cost is %d (%d price, %d tax)\n", cost, price, tax); } } diff --git a/targets/minecraft/world/item/ArmorItem.cpp b/targets/minecraft/world/item/ArmorItem.cpp index c329e0ba3..9a7c38108 100644 --- a/targets/minecraft/world/item/ArmorItem.cpp +++ b/targets/minecraft/world/item/ArmorItem.cpp @@ -5,7 +5,7 @@ #include #include -#include "app/common/src/Colours/ColourTable.h" +#include "app/common/Colours/ColourTable.h" #include "app/linux/Stubs/winapi_stubs.h" #include "java/Class.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/minecraft/world/item/ArmorItem.h b/targets/minecraft/world/item/ArmorItem.h index 3f8283fef..afd47df02 100644 --- a/targets/minecraft/world/item/ArmorItem.h +++ b/targets/minecraft/world/item/ArmorItem.h @@ -4,7 +4,7 @@ #include #include "Item.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "minecraft/core/DefaultDispenseItemBehavior.h" class Icon; diff --git a/targets/minecraft/world/item/BucketItem.cpp b/targets/minecraft/world/item/BucketItem.cpp index 412af3e40..7a953f5f4 100644 --- a/targets/minecraft/world/item/BucketItem.cpp +++ b/targets/minecraft/world/item/BucketItem.cpp @@ -1,3 +1,4 @@ +#include "minecraft/util/Log.h" #include "BucketItem.h" #include @@ -112,11 +113,11 @@ std::shared_ptr BucketItem::use( int zt = hr->z; if (!level->mayInteract(player, xt, yt, zt, content)) { - app.DebugPrintf("!!!!!!!!!!! Can't place that here\n"); + Log::info("!!!!!!!!!!! Can't place that here\n"); std::shared_ptr servPlayer = std::dynamic_pointer_cast(player); if (servPlayer != nullptr) { - app.DebugPrintf( + Log::info( "Sending ChatPacket::e_ChatCannotPlaceLava to player\n"); servPlayer->connection->send(std::shared_ptr( new ChatPacket(L"", ChatPacket::e_ChatCannotPlaceLava))); diff --git a/targets/minecraft/world/item/EnderEyeItem.cpp b/targets/minecraft/world/item/EnderEyeItem.cpp index 185fa0a57..66098b4f7 100644 --- a/targets/minecraft/world/item/EnderEyeItem.cpp +++ b/targets/minecraft/world/item/EnderEyeItem.cpp @@ -1,3 +1,4 @@ +#include "minecraft/util/Log.h" #include "EnderEyeItem.h" #include @@ -165,7 +166,7 @@ bool EnderEyeItem::TestUse(std::shared_ptr itemInstance, // level->getLevelData()->setZStronghold(z); // level->getLevelData()->setHasStronghold(); // - // app.DebugPrintf("=== FOUND stronghold in + // Log::info("=== FOUND stronghold in // terrain features list\n"); // // app.SetXuiServerAction(PlatformInput.GetPrimaryPad(),eXuiServerAction_StrongholdPosition); @@ -174,7 +175,7 @@ bool EnderEyeItem::TestUse(std::shared_ptr itemInstance, { // can't find the stronghold position in the terrain feature // list. Do we have to run a post-process? - app.DebugPrintf( + Log::info( "=== Can't find stronghold in terrain features list\n"); } } diff --git a/targets/minecraft/world/item/FireworksChargeItem.cpp b/targets/minecraft/world/item/FireworksChargeItem.cpp index 87c8ff857..e1ff43021 100644 --- a/targets/minecraft/world/item/FireworksChargeItem.cpp +++ b/targets/minecraft/world/item/FireworksChargeItem.cpp @@ -1,3 +1,4 @@ +#include "minecraft/IGameServices.h" #include "FireworksChargeItem.h" #include @@ -99,9 +100,9 @@ void FireworksChargeItem::appendHoverText(CompoundTag* expTag, uint8_t type = expTag->getByte(FireworksItem::TAG_E_TYPE); if (type >= FireworksItem::TYPE_MIN && type <= FireworksItem::TYPE_MAX) { lines->push_back( - HtmlString(app.GetString(FIREWORKS_CHARGE_TYPE_NAME[type]))); + HtmlString(gameServices().getString(FIREWORKS_CHARGE_TYPE_NAME[type]))); } else { - lines->push_back(HtmlString(app.GetString(IDS_FIREWORKS_CHARGE_TYPE))); + lines->push_back(HtmlString(gameServices().getString(IDS_FIREWORKS_CHARGE_TYPE))); } // colors @@ -124,12 +125,12 @@ void FireworksChargeItem::appendHoverText(CompoundTag* expTag, for (int dc = 0; dc < 16; dc++) { if (c == DyePowderItem::COLOR_RGB[dc]) { found = true; - output += app.GetString(FIREWORKS_CHARGE_COLOUR_NAME[dc]); + output += gameServices().getString(FIREWORKS_CHARGE_COLOUR_NAME[dc]); break; } } if (!found) { - output += app.GetString(IDS_FIREWORKS_CHARGE_CUSTOM); + output += gameServices().getString(IDS_FIREWORKS_CHARGE_CUSTOM); } } lines->push_back(output); @@ -141,7 +142,7 @@ void FireworksChargeItem::appendHoverText(CompoundTag* expTag, if (fadeList.size() > 0) { bool first = true; std::wstring output = - std::wstring(app.GetString(IDS_FIREWORKS_CHARGE_FADE_TO)) + L" "; + std::wstring(gameServices().getString(IDS_FIREWORKS_CHARGE_FADE_TO)) + L" "; for (unsigned int i = 0; i < fadeList.size(); ++i) { int c = fadeList[i]; if (!first) { @@ -156,12 +157,12 @@ void FireworksChargeItem::appendHoverText(CompoundTag* expTag, for (int dc = 0; dc < 16; dc++) { if (c == DyePowderItem::COLOR_RGB[dc]) { found = true; - output += app.GetString(FIREWORKS_CHARGE_COLOUR_NAME[dc]); + output += gameServices().getString(FIREWORKS_CHARGE_COLOUR_NAME[dc]); break; } } if (!found) { - output += app.GetString(IDS_FIREWORKS_CHARGE_CUSTOM); + output += gameServices().getString(IDS_FIREWORKS_CHARGE_CUSTOM); } } lines->push_back(output); @@ -170,14 +171,14 @@ void FireworksChargeItem::appendHoverText(CompoundTag* expTag, // has trail bool trail = expTag->getBoolean(FireworksItem::TAG_E_TRAIL); if (trail) { - lines->push_back(HtmlString(app.GetString(IDS_FIREWORKS_CHARGE_TRAIL))); + lines->push_back(HtmlString(gameServices().getString(IDS_FIREWORKS_CHARGE_TRAIL))); } // has flicker bool flicker = expTag->getBoolean(FireworksItem::TAG_E_FLICKER); if (flicker) { lines->push_back( - HtmlString(app.GetString(IDS_FIREWORKS_CHARGE_FLICKER))); + HtmlString(gameServices().getString(IDS_FIREWORKS_CHARGE_FLICKER))); } } diff --git a/targets/minecraft/world/item/FireworksItem.cpp b/targets/minecraft/world/item/FireworksItem.cpp index 1fccc3fba..50a1704b9 100644 --- a/targets/minecraft/world/item/FireworksItem.cpp +++ b/targets/minecraft/world/item/FireworksItem.cpp @@ -1,3 +1,4 @@ +#include "minecraft/IGameServices.h" #include "FireworksItem.h" #include @@ -65,7 +66,7 @@ void FireworksItem::appendHoverText(std::shared_ptr itemInstance, } if (fireTag->contains(TAG_FLIGHT)) { lines->push_back( - std::wstring(app.GetString(IDS_ITEM_FIREWORKS_FLIGHT)) + L" " + + std::wstring(gameServices().getString(IDS_ITEM_FIREWORKS_FLIGHT)) + L" " + toWString((fireTag->getByte(TAG_FLIGHT)))); } diff --git a/targets/minecraft/world/item/HangingEntityItem.cpp b/targets/minecraft/world/item/HangingEntityItem.cpp index dfc939a36..8bd4ceb61 100644 --- a/targets/minecraft/world/item/HangingEntityItem.cpp +++ b/targets/minecraft/world/item/HangingEntityItem.cpp @@ -1,3 +1,4 @@ +#include "minecraft/IGameServices.h" #include "HangingEntityItem.h" #include @@ -8,7 +9,7 @@ #include "Direction.h" #include "Facing.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/linux/LinuxGame.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/util/HtmlString.h" @@ -82,7 +83,7 @@ std::shared_ptr HangingEntityItem::createEntity( std::make_shared(level, x, y, z, dir); #ifndef _CONTENT_PACKAGE - if (app.DebugArtToolsOn() && auxValue > 0) { + if (gameServices().debugArtToolsOn() && auxValue > 0) { painting->PaintingPostConstructor(dir, auxValue - 1); } else #endif @@ -106,7 +107,7 @@ void HangingEntityItem::appendHoverText( std::shared_ptr itemInstance, std::shared_ptr player, std::vector* lines, bool advanced) { #ifndef _CONTENT_PACKAGE - if (eType == eTYPE_PAINTING && app.DebugArtToolsOn() && + if (eType == eTYPE_PAINTING && gameServices().debugArtToolsOn() && itemInstance->getAuxValue() > 0) { int motive = itemInstance->getAuxValue() - 1; diff --git a/targets/minecraft/world/item/Item.cpp b/targets/minecraft/world/item/Item.cpp index 7c0ebdd40..b2dccc72b 100644 --- a/targets/minecraft/world/item/Item.cpp +++ b/targets/minecraft/world/item/Item.cpp @@ -1,3 +1,5 @@ +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "Item.h" @@ -1395,7 +1397,7 @@ Item::Item(int id) : id(256 + id) { // this->id = 256 + id; if (items[256 + id] != nullptr) { - app.DebugPrintf("CONFLICT @ %d", id); + Log::info("CONFLICT @ %d", id); } items[256 + id] = this; @@ -1539,12 +1541,12 @@ Item* Item::setDescriptionId(unsigned int id) { } const wchar_t* Item::getDescription() { - return app.GetString(getDescriptionId()); + return gameServices().getString(getDescriptionId()); // return I18n::get(getDescriptionId()); } const wchar_t* Item::getDescription(std::shared_ptr instance) { - return app.GetString(getDescriptionId(instance)); + return gameServices().getString(getDescriptionId(instance)); // return I18n::get(getDescriptionId(instance)); } @@ -1638,7 +1640,7 @@ std::wstring Item::getHoverName(std::shared_ptr itemInstance) { // String elementName = ("" + // Language.getInstance().getElementName(getDescription(itemInstance))).trim(); // return elementName; - return app.GetString(getDescriptionId(itemInstance)); + return gameServices().getString(getDescriptionId(itemInstance)); } bool Item::isFoil(std::shared_ptr itemInstance) { diff --git a/targets/minecraft/world/item/PlanterTileItem.cpp b/targets/minecraft/world/item/PlanterTileItem.cpp index 13277fb4b..4561dba92 100644 --- a/targets/minecraft/world/item/PlanterTileItem.cpp +++ b/targets/minecraft/world/item/PlanterTileItem.cpp @@ -1,8 +1,9 @@ +#include "minecraft/IGameServices.h" #include "PlanterTileItem.h" #include -#include "app/common/src/Console_Debug_enum.h" +#include "app/common/Console_Debug_enum.h" #include "app/linux/LinuxGame.h" #include "minecraft/Facing.h" #include "minecraft/stats/GenericStats.h" @@ -70,8 +71,8 @@ bool TilePlanterItem::useOn(std::shared_ptr instance, // 4J-PB - If we have the debug option on, don't reduce the // number of this item #ifndef _FINAL_BUILD - if (!(app.DebugSettingsOn() && - app.GetGameSettingsDebugMask() & + if (!(gameServices().debugSettingsOn() && + gameServices().debugGetMask() & (1L << eDebugSetting_CraftAnything))) #endif { diff --git a/targets/minecraft/world/item/PotionItem.cpp b/targets/minecraft/world/item/PotionItem.cpp index 672015a08..1eb8a864e 100644 --- a/targets/minecraft/world/item/PotionItem.cpp +++ b/targets/minecraft/world/item/PotionItem.cpp @@ -1,8 +1,9 @@ +#include "minecraft/IGameServices.h" #include "PotionItem.h" #include -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" #include "java/Random.h" @@ -205,7 +206,7 @@ bool PotionItem::hasInstantenousEffects(int itemAuxValue) { std::wstring PotionItem::getHoverName( std::shared_ptr itemInstance) { if (itemInstance->getAuxValue() == 0) { - return app.GetString( + return gameServices().getString( IDS_ITEM_WATER_BOTTLE); // I18n.get("item.emptyPotion.name").trim(); } @@ -214,7 +215,7 @@ std::wstring PotionItem::getHoverName( // elementName = I18n.get("potion.prefix.grenade").trim() + " " + // elementName; elementName = replaceAll(elementName, L"{*splash*}", - app.GetString(IDS_POTION_PREFIX_GRENADE)); + gameServices().getString(IDS_POTION_PREFIX_GRENADE)); } else { elementName = replaceAll(elementName, L"{*splash*}", L""); } @@ -229,14 +230,14 @@ std::wstring PotionItem::getHoverName( elementName = replaceAll(elementName, L"{*prefix*}", L""); elementName = replaceAll( elementName, L"{*postfix*}", - app.GetString(effects->at(0)->getPostfixDescriptionId())); + gameServices().getString(effects->at(0)->getPostfixDescriptionId())); } else { // String appearanceName = // PotionBrewing.getAppearanceName(itemInstance.getAuxValue()); return // I18n.get(appearanceName).trim() + " " + elementName; elementName = replaceAll(elementName, L"{*prefix*}", - app.GetString(PotionBrewing::getAppearanceName( + gameServices().getString(PotionBrewing::getAppearanceName( itemInstance->getAuxValue()))); elementName = replaceAll(elementName, L"{*postfix*}", L""); } @@ -258,7 +259,7 @@ void PotionItem::appendHoverText(std::shared_ptr itemInstance, for (auto it = effects->begin(); it != effects->end(); ++it) { MobEffectInstance* effect = *it; std::wstring effectString = - app.GetString(effect->getDescriptionId()); + gameServices().getString(effect->getDescriptionId()); MobEffect* mobEffect = MobEffect::effects[effect->getId()]; std::unordered_map* @@ -288,18 +289,18 @@ void PotionItem::appendHoverText(std::shared_ptr itemInstance, switch (effect->getAmplifier()) { case 1: potencyString = L" "; - potencyString += app.GetString(IDS_POTION_POTENCY_1); + potencyString += gameServices().getString(IDS_POTION_POTENCY_1); break; case 2: potencyString = L" "; - potencyString += app.GetString(IDS_POTION_POTENCY_2); + potencyString += gameServices().getString(IDS_POTION_POTENCY_2); break; case 3: potencyString = L" "; - potencyString += app.GetString(IDS_POTION_POTENCY_3); + potencyString += gameServices().getString(IDS_POTION_POTENCY_3); break; default: - potencyString = app.GetString(IDS_POTION_POTENCY_0); + potencyString = gameServices().getString(IDS_POTION_POTENCY_0); break; } effectString += @@ -322,7 +323,7 @@ void PotionItem::appendHoverText(std::shared_ptr itemInstance, lines->push_back(HtmlString(effectString, color)); } } else { - std::wstring effectString = app.GetString( + std::wstring effectString = gameServices().getString( IDS_POTION_EMPTY); // I18n.get("potion.empty").trim(); lines->push_back(HtmlString(effectString, eHTMLColor_7)); //"�7" @@ -331,7 +332,7 @@ void PotionItem::appendHoverText(std::shared_ptr itemInstance, if (!modifiers.empty()) { // Add new line lines->push_back(HtmlString(L"")); - lines->push_back(HtmlString(app.GetString(IDS_POTION_EFFECTS_WHENDRANK), + lines->push_back(HtmlString(gameServices().getString(IDS_POTION_EFFECTS_WHENDRANK), eHTMLColor_5)); // Add modifier descriptions diff --git a/targets/minecraft/world/item/Rarity.h b/targets/minecraft/world/item/Rarity.h index d3981739d..49b9d3750 100644 --- a/targets/minecraft/world/item/Rarity.h +++ b/targets/minecraft/world/item/Rarity.h @@ -2,7 +2,7 @@ #include -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" class Rarity { public: diff --git a/targets/minecraft/world/item/RecordingItem.cpp b/targets/minecraft/world/item/RecordingItem.cpp index eb8f3b684..37fdd790a 100644 --- a/targets/minecraft/world/item/RecordingItem.cpp +++ b/targets/minecraft/world/item/RecordingItem.cpp @@ -6,7 +6,7 @@ #include #include -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/util/HtmlString.h" #include "minecraft/world/IconRegister.h" diff --git a/targets/minecraft/world/item/SpawnEggItem.cpp b/targets/minecraft/world/item/SpawnEggItem.cpp index 012595571..3e4dfda45 100644 --- a/targets/minecraft/world/item/SpawnEggItem.cpp +++ b/targets/minecraft/world/item/SpawnEggItem.cpp @@ -1,10 +1,11 @@ +#include "minecraft/IGameServices.h" #include "SpawnEggItem.h" #include #include #include "Facing.h" -#include "app/common/src/Colours/ColourTable.h" +#include "app/common/Colours/ColourTable.h" #include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" #include "java/Class.h" @@ -40,7 +41,7 @@ std::wstring SpawnEggItem::getHoverName( int nameId = EntityIO::getNameId(itemInstance->getAuxValue()); if (nameId >= 0) { elementName = - replaceAll(elementName, L"{*CREATURE*}", app.GetString(nameId)); + replaceAll(elementName, L"{*CREATURE*}", gameServices().getString(nameId)); // elementName += " " + I18n.get("entity." + encodeId + ".name"); } else { elementName = replaceAll(elementName, L"{*CREATURE*}", L""); @@ -153,7 +154,7 @@ std::shared_ptr SpawnEggItem::canSpawn(int iAuxVal, Level* level, } } #ifndef _CONTENT_PACKAGE - else if (app.DebugArtToolsOn()) { + else if (gameServices().debugArtToolsOn()) { canSpawn = true; } #endif @@ -179,7 +180,7 @@ bool SpawnEggItem::useOn(std::shared_ptr itemInstance, int tile = level->getTile(x, y, z); #ifndef _CONTENT_PACKAGE - if (app.DebugArtToolsOn() && tile == Tile::mobSpawner_Id) { + if (gameServices().debugArtToolsOn() && tile == Tile::mobSpawner_Id) { // 4J Stu - Force adding this as a tile update level->removeTile(x, y, z); level->setTileAndData(x, y, z, Tile::mobSpawner_Id, 0, diff --git a/targets/minecraft/world/item/TileItem.cpp b/targets/minecraft/world/item/TileItem.cpp index e1fea3621..1a38548fd 100644 --- a/targets/minecraft/world/item/TileItem.cpp +++ b/targets/minecraft/world/item/TileItem.cpp @@ -1,10 +1,12 @@ +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "TileItem.h" #include -#include "app/common/src/Console_Debug_enum.h" +#include "app/common/Console_Debug_enum.h" #include "app/linux/LinuxGame.h" #include "java/Class.h" #include "minecraft/Facing.h" @@ -153,9 +155,9 @@ bool TileItem::useOn(std::shared_ptr instance, // pMinecraft->soundEngine->GetSoundName(szStepSoundName,iStepSound); // } - // app.DebugPrintf("Place Sound - %s, Step Sound - + // Log::info("Place Sound - %s, Step Sound - // %s\n",szPlaceSoundName,szStepSoundName); - app.DebugPrintf("Place Sound - %d, Step Sound - %d\n", + Log::info("Place Sound - %d, Step Sound - %d\n", iPlaceSound, iStepSound); #endif level->playSound(x + 0.5f, y + 0.5f, z + 0.5f, @@ -165,8 +167,8 @@ bool TileItem::useOn(std::shared_ptr instance, #ifndef _FINAL_BUILD // 4J-PB - If we have the debug option on, don't reduce the // number of this item - if (!(app.DebugSettingsOn() && - app.GetGameSettingsDebugMask() & + if (!(gameServices().debugSettingsOn() && + gameServices().debugGetMask() & (1L << eDebugSetting_CraftAnything))) #endif { diff --git a/targets/minecraft/world/item/alchemy/PotionBrewing.cpp b/targets/minecraft/world/item/alchemy/PotionBrewing.cpp index d38a597d2..d77fc3283 100644 --- a/targets/minecraft/world/item/alchemy/PotionBrewing.cpp +++ b/targets/minecraft/world/item/alchemy/PotionBrewing.cpp @@ -2,8 +2,8 @@ #include -#include "app/common/App_enums.h" -#include "app/common/src/Colours/ColourTable.h" +#include "minecraft/GameEnums.h" +#include "app/common/Colours/ColourTable.h" #include "java/JavaMath.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/minecraft/world/item/crafting/Recipes.cpp b/targets/minecraft/world/item/crafting/Recipes.cpp index e1f6278b7..5adee83b7 100644 --- a/targets/minecraft/world/item/crafting/Recipes.cpp +++ b/targets/minecraft/world/item/crafting/Recipes.cpp @@ -1,3 +1,4 @@ +#include "minecraft/util/Log.h" #include "minecraft/world/item/crafting/Recipes.h" #include @@ -987,7 +988,7 @@ ShapedRecipy* Recipes::addShapedRecipy(ItemInstance* result, ...) { for (int i = 0; wchTypes[i] != L'\0'; ++i) { if (wchTypes[i + 1] == L'\0' && wchTypes[i] != L'g') { - app.DebugPrintf("Missing group type\n"); + Log::info("Missing group type\n"); } switch (wchTypes[i]) { diff --git a/targets/minecraft/world/item/crafting/ShapedRecipy.cpp b/targets/minecraft/world/item/crafting/ShapedRecipy.cpp index f881a6311..70380f05b 100644 --- a/targets/minecraft/world/item/crafting/ShapedRecipy.cpp +++ b/targets/minecraft/world/item/crafting/ShapedRecipy.cpp @@ -1,3 +1,4 @@ +#include "minecraft/util/Log.h" // package net.minecraft.world.item.crafting; // // import net.minecraft.world.inventory.CraftingContainer; @@ -97,7 +98,7 @@ int ShapedRecipy::size() { return width * height; } // 4J-PB bool ShapedRecipy::requiresRecipe(int iRecipe) { - app.DebugPrintf("ShapedRecipy %d\n", iRecipe); + Log::info("ShapedRecipy %d\n", iRecipe); int iCount = 0; for (int x = 0; x < 3; x++) { for (int y = 0; y < 3; y++) { diff --git a/targets/minecraft/world/item/enchantment/Enchantment.cpp b/targets/minecraft/world/item/enchantment/Enchantment.cpp index 21f176b27..567b0b5e8 100644 --- a/targets/minecraft/world/item/enchantment/Enchantment.cpp +++ b/targets/minecraft/world/item/enchantment/Enchantment.cpp @@ -1,10 +1,10 @@ +#include "minecraft/util/Log.h" #include "Enchantment.h" #include #include -#include "app/common/App_enums.h" -#include "app/linux/LinuxGame.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/HtmlString.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/item/enchantment/ArrowDamageEnchantment.h" @@ -109,7 +109,7 @@ void Enchantment::staticCtor() { void Enchantment::_init(int id) { if (enchantments[id] != nullptr) { - app.DebugPrintf("Duplicate enchantment id!"); + Log::info("Duplicate enchantment id!"); #ifndef _CONTENT_PACKAGE assert(0); #endif @@ -162,17 +162,17 @@ int Enchantment::getDescriptionId() { return descriptionId; } // 4jcraft: re-added old TU18 overload for java gui std::wstring Enchantment::getFullname(int level, std::wstring& unformatted) { wchar_t formatted[256]; - swprintf(formatted, 256, L"%ls %ls", app.GetString(getDescriptionId()), + swprintf(formatted, 256, L"%ls %ls", gameServices().getString(getDescriptionId()), getLevelString(level).c_str()); unformatted = formatted; swprintf(formatted, 256, L"%ls", - app.GetHTMLColour(eHTMLColor_f), unformatted.c_str()); + gameServices().getHTMLColour(eHTMLColor_f), unformatted.c_str()); return formatted; } HtmlString Enchantment::getFullname(int level) { wchar_t formatted[256]; - swprintf(formatted, 256, L"%ls %ls", app.GetString(getDescriptionId()), + swprintf(formatted, 256, L"%ls %ls", gameServices().getString(getDescriptionId()), getLevelString(level).c_str()); return HtmlString(formatted, eHTMLColor_f); @@ -214,5 +214,5 @@ std::wstring Enchantment::getLevelString(int level) { stringId = IDS_ENCHANTMENT_LEVEL_10; break; }; - return app.GetString(stringId); // I18n.get("enchantment.level." + level); + return gameServices().getString(stringId); // I18n.get("enchantment.level." + level); } \ No newline at end of file diff --git a/targets/minecraft/world/level/Explosion.cpp b/targets/minecraft/world/level/Explosion.cpp index 9b64f9c8d..099c3b33c 100644 --- a/targets/minecraft/world/level/Explosion.cpp +++ b/targets/minecraft/world/level/Explosion.cpp @@ -1,3 +1,4 @@ +#include "minecraft/util/Log.h" #include "Explosion.h" #include @@ -173,7 +174,7 @@ void Explosion::explode() { if (e->instanceof(eTYPE_PLAYER)) { std::shared_ptr player = std::dynamic_pointer_cast(e); - // app.DebugPrintf("Adding player knockback (%f,%f,%f)\n", xa * + // Log::info("Adding player knockback (%f,%f,%f)\n", xa * // pow, ya * pow, za * pow); hitPlayers.insert(playerVec3Map::value_type( player, Vec3(xa * pow, ya * pow, za * pow))); @@ -206,7 +207,7 @@ void Explosion::finalizeExplosion( if (destroyBlocks) { // toBlowArray.addAll(toBlow); // TODO 4J Stu - Reverse iterator - app.DebugPrintf("Finalizing explosion size %d\n", toBlow.size()); + Log::info("Finalizing explosion size %d\n", toBlow.size()); static const int MAX_EXPLODE_PARTICLES = 50; // 4J - try and make at most MAX_EXPLODE_PARTICLES pairs of particles int fraction = (int)toBlowArray->size() / MAX_EXPLODE_PARTICLES; diff --git a/targets/minecraft/world/level/FoliageColor.cpp b/targets/minecraft/world/level/FoliageColor.cpp index e0ee7c2a8..c406d365e 100644 --- a/targets/minecraft/world/level/FoliageColor.cpp +++ b/targets/minecraft/world/level/FoliageColor.cpp @@ -1,7 +1,7 @@ #include "FoliageColor.h" -#include "app/common/App_enums.h" -#include "app/common/src/Colours/ColourTable.h" +#include "minecraft/GameEnums.h" +#include "app/common/Colours/ColourTable.h" #include "minecraft/client/Minecraft.h" // 4J Stu - Don't use this any more diff --git a/targets/minecraft/world/level/GameRules.cpp b/targets/minecraft/world/level/GameRules.cpp index 0f5276268..9fade251c 100644 --- a/targets/minecraft/world/level/GameRules.cpp +++ b/targets/minecraft/world/level/GameRules.cpp @@ -1,8 +1,9 @@ +#include "minecraft/IGameServices.h" #include "GameRules.h" #include -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/linux/LinuxGame.h" // 4J: GameRules isn't in use anymore, just routes any requests to app game host @@ -40,21 +41,21 @@ GameRules::~GameRules() { bool GameRules::getBoolean(const int rule) { switch (rule) { case GameRules::RULE_DOFIRETICK: - return app.GetGameHostOption(eGameHostOption_FireSpreads); + return gameServices().getGameHostOption(eGameHostOption_FireSpreads); case GameRules::RULE_MOBGRIEFING: - return app.GetGameHostOption(eGameHostOption_MobGriefing); + return gameServices().getGameHostOption(eGameHostOption_MobGriefing); case GameRules::RULE_KEEPINVENTORY: - return app.GetGameHostOption(eGameHostOption_KeepInventory); + return gameServices().getGameHostOption(eGameHostOption_KeepInventory); case GameRules::RULE_DOMOBSPAWNING: - return app.GetGameHostOption(eGameHostOption_DoMobSpawning); + return gameServices().getGameHostOption(eGameHostOption_DoMobSpawning); case GameRules::RULE_DOMOBLOOT: - return app.GetGameHostOption(eGameHostOption_DoMobLoot); + return gameServices().getGameHostOption(eGameHostOption_DoMobLoot); case GameRules::RULE_DOTILEDROPS: - return app.GetGameHostOption(eGameHostOption_DoTileDrops); + return gameServices().getGameHostOption(eGameHostOption_DoTileDrops); case GameRules::RULE_NATURAL_REGENERATION: - return app.GetGameHostOption(eGameHostOption_NaturalRegeneration); + return gameServices().getGameHostOption(eGameHostOption_NaturalRegeneration); case GameRules::RULE_DAYLIGHT: - return app.GetGameHostOption(eGameHostOption_DoDaylightCycle); + return gameServices().getGameHostOption(eGameHostOption_DoDaylightCycle); default: assert(0); return false; diff --git a/targets/minecraft/world/level/Level.cpp b/targets/minecraft/world/level/Level.cpp index 4989cbcce..73d665229 100644 --- a/targets/minecraft/world/level/Level.cpp +++ b/targets/minecraft/world/level/Level.cpp @@ -1,3 +1,5 @@ +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "Level.h" #include @@ -15,13 +17,13 @@ #include "Explosion.h" #include "IPlatformInput.h" #include "LevelListener.h" -#include "app/common/App_enums.h" -#include "app/common/src/Colours/ColourTable.h" -#include "app/common/src/Console_Debug_enum.h" -#include "app/common/src/Network/GameNetworkManager.h" +#include "minecraft/GameEnums.h" +#include "app/common/Colours/ColourTable.h" +#include "app/common/Console_Debug_enum.h" +#include "app/common/Network/GameNetworkManager.h" #include "app/linux/LinuxGame.h" #include "app/linux/Stubs/winapi_stubs.h" -#include "app/include/FrameProfiler.h" +#include "util/FrameProfiler.h" #include "java/Random.h" #include "minecraft/Direction.h" #include "minecraft/Facing.h" @@ -1492,7 +1494,7 @@ void Level::playEntitySound(std::shared_ptr entity, int iSound, for (auto it = listeners.begin(); it != itEnd; it++) { // 4J-PB - if the entity is a local player, don't play the sound if (entity->GetType() == eTYPE_SERVERPLAYER) { - // app.DebugPrintf("ENTITY is serverplayer\n"); + // Log::info("ENTITY is serverplayer\n"); (*it)->playSound(iSound, entity->x, entity->y - entity->heightOffset, entity->z, @@ -2113,7 +2115,7 @@ void Level::tickEntities() { if (!e->removed) { #if !defined(_FINAL_BUILD) - if (!(app.DebugSettingsOn() && app.GetMobsDontTickEnabled() && + if (!(gameServices().debugSettingsOn() && gameServices().debugMobsDontTick() && e->instanceof(eTYPE_MOB) && !e->instanceof(eTYPE_PLAYER))) #endif { @@ -2812,8 +2814,8 @@ void Level::tickWeather() { #if !defined(_FINAL_BUILD) // debug setting added to disable weather - if (app.DebugSettingsOn()) { - if (app.GetGameSettingsDebugMask(PlatformInput.GetPrimaryPad()) & + if (gameServices().debugSettingsOn()) { + if (gameServices().debugGetMask(PlatformInput.GetPrimaryPad()) & (1L << eDebugSetting_DisableWeather)) { levelData->setThundering(false); levelData->setThunderTime(random->nextInt(TICKS_PER_DAY * 7) + @@ -3870,7 +3872,7 @@ void Level::setGameTime(int64_t time) { } else if (timeDiff > 100) { // Time differences of more than ~5 seconds are generally not real // time passing so ignore (moving dimensions does this) - app.DebugPrintf( + Log::info( "Level::setTime: Massive time difference, ignoring for time " "passed stat (%lli)\n", timeDiff); diff --git a/targets/minecraft/world/level/PortalForcer.cpp b/targets/minecraft/world/level/PortalForcer.cpp index 56a3e3fd0..6998269d6 100644 --- a/targets/minecraft/world/level/PortalForcer.cpp +++ b/targets/minecraft/world/level/PortalForcer.cpp @@ -1,3 +1,4 @@ +#include "minecraft/util/Log.h" #include "PortalForcer.h" #include @@ -261,20 +262,20 @@ bool PortalForcer::createPortal(std::shared_ptr e) { // Move the positions that we want to check away from the edge of the world if ((xc - r) < -XZOFFSET) { - app.DebugPrintf( + Log::info( "Adjusting portal creation x due to being too close to the edge\n"); xc -= ((xc - r) + XZOFFSET); } else if ((xc + r) >= XZOFFSET) { - app.DebugPrintf( + Log::info( "Adjusting portal creation x due to being too close to the edge\n"); xc -= ((xc + r) - XZOFFSET); } if ((zc - r) < -XZOFFSET) { - app.DebugPrintf( + Log::info( "Adjusting portal creation z due to being too close to the edge\n"); zc -= ((zc - r) + XZOFFSET); } else if ((zc + r) >= XZOFFSET) { - app.DebugPrintf( + Log::info( "Adjusting portal creation z due to being too close to the edge\n"); zc -= ((zc + r) - XZOFFSET); } @@ -321,7 +322,7 @@ bool PortalForcer::createPortal(std::shared_ptr e) { (xt >= XZOFFSET) || (zt < -XZOFFSET) || (zt >= XZOFFSET)) { - app.DebugPrintf( + Log::info( "Skipping possible portal " "location as at least one " "block is too close to the " @@ -383,7 +384,7 @@ bool PortalForcer::createPortal(std::shared_ptr e) { // inside the bedrock if ((xt < -XZOFFSET) || (xt >= XZOFFSET) || (zt < -XZOFFSET) || (zt >= XZOFFSET)) { - app.DebugPrintf( + Log::info( "Skipping possible portal location " "as at least one block is too " "close to the edge\n"); diff --git a/targets/minecraft/world/level/biome/Biome.cpp b/targets/minecraft/world/level/biome/Biome.cpp index f181729fc..ac9dd9663 100644 --- a/targets/minecraft/world/level/biome/Biome.cpp +++ b/targets/minecraft/world/level/biome/Biome.cpp @@ -6,8 +6,8 @@ #include #include -#include "app/common/App_enums.h" -#include "app/common/src/Colours/ColourTable.h" +#include "minecraft/GameEnums.h" +#include "app/common/Colours/ColourTable.h" #include "java/Class.h" #include "java/Random.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/minecraft/world/level/biome/Biome.h b/targets/minecraft/world/level/biome/Biome.h index d4c8fef4e..70ee2f20b 100644 --- a/targets/minecraft/world/level/biome/Biome.h +++ b/targets/minecraft/world/level/biome/Biome.h @@ -6,7 +6,7 @@ #include #include -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "java/Class.h" #include "minecraft/util/WeighedRandom.h" #include "minecraft/world/entity/Mob.h" diff --git a/targets/minecraft/world/level/biome/BiomeCache.cpp b/targets/minecraft/world/level/biome/BiomeCache.cpp index 4459b50fd..79ecc3acf 100644 --- a/targets/minecraft/world/level/biome/BiomeCache.cpp +++ b/targets/minecraft/world/level/biome/BiomeCache.cpp @@ -1,3 +1,4 @@ +#include "minecraft/IGameServices.h" #include "BiomeCache.h" #include @@ -89,7 +90,7 @@ BiomeCache::Block* BiomeCache::getBlockAt(int x, int z) { } else { block = it->second; } - block->lastUse = app.getAppTime(); + block->lastUse = gameServices().getAppTime(); return block; } @@ -107,7 +108,7 @@ float BiomeCache::getDownfall(int x, int z) { void BiomeCache::update() { std::lock_guard lock(m_CS); - int64_t now = app.getAppTime(); + int64_t now = gameServices().getAppTime(); int64_t utime = now - lastUpdateTime; if (utime > DECAY_TIME / 4 || utime < 0) { lastUpdateTime = now; diff --git a/targets/minecraft/world/level/biome/BiomeDecorator.cpp b/targets/minecraft/world/level/biome/BiomeDecorator.cpp index 193f2f6f8..339bd2f23 100644 --- a/targets/minecraft/world/level/biome/BiomeDecorator.cpp +++ b/targets/minecraft/world/level/biome/BiomeDecorator.cpp @@ -1,3 +1,4 @@ +#include "minecraft/util/Log.h" #include "minecraft/world/level/biome/BiomeDecorator.h" @@ -34,7 +35,7 @@ BiomeDecorator::BiomeDecorator(Biome* biome) { void BiomeDecorator::decorate(Level* level, Random* random, int xo, int zo) { if (this->level != nullptr) { - app.DebugPrintf("BiomeDecorator::decorate - Already decorating!!\n"); + Log::info("BiomeDecorator::decorate - Already decorating!!\n"); #ifndef _CONTENT_PACKAGE __debugbreak(); // throw new RuntimeException("Already decorating!!"); diff --git a/targets/minecraft/world/level/biome/BiomeSource.cpp b/targets/minecraft/world/level/biome/BiomeSource.cpp index 5026ee7eb..7e9657c44 100644 --- a/targets/minecraft/world/level/biome/BiomeSource.cpp +++ b/targets/minecraft/world/level/biome/BiomeSource.cpp @@ -1,3 +1,5 @@ +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "BiomeSource.h" #include @@ -5,7 +7,7 @@ #include #include "IPlatformInput.h" -#include "app/common/src/Console_Debug_enum.h" +#include "app/common/Console_Debug_enum.h" #include "app/linux/LinuxGame.h" #include "java/Random.h" #include "java/System.h" @@ -166,7 +168,7 @@ void BiomeSource::getRawBiomeBlock(std::vector& biomes, int x, int z, biomes[i] = Biome::biomes[result[i]]; #if !defined(_CONTENT_PACKAGE) if (biomes[i] == nullptr) { - app.DebugPrintf("Tried to assign null biome %d\n", result[i]); + Log::info("Tried to assign null biome %d\n", result[i]); assert(0); } #endif @@ -367,8 +369,8 @@ int64_t BiomeSource::findSeed(LevelType* generator) { mcprogress->progressStage(IDS_PROGRESS_NEW_WORLD_SEED); #if !defined(_CONTENT_PACKAGE) - if (app.DebugSettingsOn() && - app.GetGameSettingsDebugMask(PlatformInput.GetPrimaryPad()) & + if (gameServices().debugSettingsOn() && + gameServices().debugGetMask(PlatformInput.GetPrimaryPad()) & (1L << eDebugSetting_EnableBiomeOverride)) { // Do nothing } else @@ -425,7 +427,7 @@ int64_t BiomeSource::findSeed(LevelType* generator) { delete pr; #if defined(DEBUG_SEEDS) - app.DebugPrintf("%d: %d tries taken, seed used is %lld\n", k, + Log::info("%d: %d tries taken, seed used is %lld\n", k, tryCount, bestSeed); BiomeSource* biomeSource = new BiomeSource(bestSeed); diff --git a/targets/minecraft/world/level/chunk/CompressedTileStorage.cpp b/targets/minecraft/world/level/chunk/CompressedTileStorage.cpp index 7ecf7ab8d..ffeefde22 100644 --- a/targets/minecraft/world/level/chunk/CompressedTileStorage.cpp +++ b/targets/minecraft/world/level/chunk/CompressedTileStorage.cpp @@ -9,7 +9,7 @@ #include #include "app/linux/Stubs/winapi_stubs.h" -#include "app/include/NetTypes.h" +#include "platform/NetTypes.h" #include "util/Definitions.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" diff --git a/targets/minecraft/world/level/chunk/LevelChunk.cpp b/targets/minecraft/world/level/chunk/LevelChunk.cpp index e92cb29d8..765a6888d 100644 --- a/targets/minecraft/world/level/chunk/LevelChunk.cpp +++ b/targets/minecraft/world/level/chunk/LevelChunk.cpp @@ -1,3 +1,4 @@ +#include "minecraft/util/Log.h" #include "LevelChunk.h" #include @@ -8,7 +9,7 @@ #include #include -#include "app/common/src/Network/GameNetworkManager.h" +#include "app/common/Network/GameNetworkManager.h" #include "app/linux/LinuxGame.h" #include "SparseLightStorage.h" #include "java/Class.h" @@ -962,13 +963,13 @@ bool LevelChunk::setTileAndData(int x, int y, int z, int _tile, int _data) { if (te == nullptr) { te = dynamic_cast(Tile::tiles[_tile]) ->newTileEntity(level); - // app.DebugPrintf("%s: Setting tile id %d, created tileEntity + // Log::info("%s: Setting tile id %d, created tileEntity // type %d\n", level->isClientSide?"Client":"Server", _tile, // te->GetType()); level->setTileEntity(xOffs, y, zOffs, te); } if (te != nullptr) { - // app.DebugPrintf("%s: Setting tile id %d, found tileEntity + // Log::info("%s: Setting tile id %d, found tileEntity // type %d\n", level->isClientSide?"Client":"Server", _tile, // te->GetType()); te->clearCache(); @@ -1151,7 +1152,7 @@ void LevelChunk::addEntity(std::shared_ptr e) { int xc = Mth::floor(e->x / 16); int zc = Mth::floor(e->z / 16); if (xc != this->x || zc != this->z) { - app.DebugPrintf("Wrong location!"); + Log::info("Wrong location!"); // System.out.println("Wrong location! " + e); // Thread.dumpStack(); } @@ -1298,7 +1299,7 @@ void LevelChunk::setTileEntity(int x, int y, int z, ->isEntityTile()) // 4J - was !(Tile.tiles[getTile(x, y, z)] // instanceof EntityTile)) { - app.DebugPrintf( + Log::info( "Attempted to place a tile entity where there was no entity " "tile!\n"); return; @@ -1331,7 +1332,7 @@ void LevelChunk::removeTileEntity(int x, int y, int z) { tileEntities.erase(pos); if (te != nullptr) { if (level->isClientSide) { - app.DebugPrintf("Removing tile entity of type %d\n", + Log::info("Removing tile entity of type %d\n", te->GetType()); } te->setRemoved(); @@ -1430,7 +1431,7 @@ void LevelChunk::unload(bool unloadTileEntities) // 4J - added parameter level->removeEntities(entityBlocks[i]); } } - // app.DebugPrintf("Unloaded chunk %d, %d\n", x, z); + // Log::info("Unloaded chunk %d, %d\n", x, z); #if defined(_LARGE_WORLDS) if (!m_bUnloaded) // 4J-JEV: If we unload a chunk twice, we delete all the diff --git a/targets/minecraft/world/level/chunk/SparseDataStorage.cpp b/targets/minecraft/world/level/chunk/SparseDataStorage.cpp index f713b11e6..5c7bf9c6c 100644 --- a/targets/minecraft/world/level/chunk/SparseDataStorage.cpp +++ b/targets/minecraft/world/level/chunk/SparseDataStorage.cpp @@ -7,7 +7,7 @@ #include #include "app/linux/Stubs/winapi_stubs.h" -#include "app/include/NetTypes.h" +#include "platform/NetTypes.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" diff --git a/targets/minecraft/world/level/chunk/SparseLightStorage.cpp b/targets/minecraft/world/level/chunk/SparseLightStorage.cpp index 98def52b1..8d507bc7b 100644 --- a/targets/minecraft/world/level/chunk/SparseLightStorage.cpp +++ b/targets/minecraft/world/level/chunk/SparseLightStorage.cpp @@ -7,7 +7,7 @@ #include #include "app/linux/Stubs/winapi_stubs.h" -#include "app/include/NetTypes.h" +#include "platform/NetTypes.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" diff --git a/targets/minecraft/world/level/chunk/storage/ChunkStorageProfileDecorator.cpp b/targets/minecraft/world/level/chunk/storage/ChunkStorageProfileDecorator.cpp index 6bf13d9e0..36f89b42e 100644 --- a/targets/minecraft/world/level/chunk/storage/ChunkStorageProfileDecorator.cpp +++ b/targets/minecraft/world/level/chunk/storage/ChunkStorageProfileDecorator.cpp @@ -1,3 +1,4 @@ +#include "minecraft/util/Log.h" #include "ChunkStorageProfileDecorator.h" #include @@ -54,7 +55,7 @@ void ChunkStorageProfilerDecorator::tick() { 0.000001 * (double)timeSpentLoading / (double)loadCount, loadCount); #endif - app.DebugPrintf(buf); + Log::info(buf); #endif } if (saveCount > 0) { @@ -68,7 +69,7 @@ void ChunkStorageProfilerDecorator::tick() { 0.000001 * (double)timeSpentSaving / (double)loadCount, loadCount); #endif - app.DebugPrintf(buf); + Log::info(buf); #endif } counter = 0; diff --git a/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp b/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp index 0dc7b6b8c..c0dbfbbb9 100644 --- a/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp +++ b/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp @@ -1,6 +1,5 @@ -#ifdef TRACY_ENABLE -#include -#endif +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "McRegionChunkStorage.h" #include @@ -12,7 +11,7 @@ #include #include "IPlatformInput.h" -#include "app/common/src/Console_Debug_enum.h" +#include "app/common/Console_Debug_enum.h" #include "app/linux/LinuxGame.h" #include "platform/C4JThread.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" @@ -154,7 +153,7 @@ LevelChunk* McRegionChunkStorage::load(Level* level, int x, int z) { sprintf(buf, "Chunk file at %d, %d is missing level data, skipping\n", x, z); - app.DebugPrintf(buf); + Log::info(buf); delete chunkData; return nullptr; } @@ -163,7 +162,7 @@ LevelChunk* McRegionChunkStorage::load(Level* level, int x, int z) { sprintf(buf, "Chunk file at %d, %d is missing block data, skipping\n", x, z); - app.DebugPrintf(buf); + Log::info(buf); delete chunkData; return nullptr; } @@ -175,7 +174,7 @@ LevelChunk* McRegionChunkStorage::load(Level* level, int x, int z) { "Chunk file at %d, %d is in the wrong location; " "relocating. Expected %d, %d, got %d, %d\n", x, z, x, z, levelChunk->x, levelChunk->z); - app.DebugPrintf(buf); + Log::info(buf); delete levelChunk; delete chunkData; return nullptr; @@ -192,8 +191,8 @@ LevelChunk* McRegionChunkStorage::load(Level* level, int x, int z) { delete chunkData; } #if !defined(_CONTENT_PACKAGE) - if (levelChunk && app.DebugSettingsOn() && - app.GetGameSettingsDebugMask(PlatformInput.GetPrimaryPad()) & + if (levelChunk && gameServices().debugSettingsOn() && + gameServices().debugGetMask(PlatformInput.GetPrimaryPad()) & (1L << eDebugSetting_EnableBiomeOverride)) { // 4J Stu - This will force an update of the chunk's biome array levelChunk->reloadBiomes(); @@ -355,7 +354,7 @@ void McRegionChunkStorage::staticCtor() { s_saveThreads[i] = new C4JThread(runSaveThreadProc, nullptr, threadName); - // app.DebugPrintf("Created new thread: %s\n",threadName); + // Log::info("Created new thread: %s\n",threadName); // ResumeThread( saveThreads[j] ); s_saveThreads[i]->run(); diff --git a/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp b/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp index c3754e0ad..2857ea814 100644 --- a/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp +++ b/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp @@ -1,3 +1,5 @@ +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "OldChunkStorage.h" #include @@ -11,7 +13,7 @@ #include #include "IPlatformInput.h" -#include "app/common/src/Console_Debug_enum.h" +#include "app/common/Console_Debug_enum.h" #include "app/linux/LinuxGame.h" #include "util/Definitions.h" #include "java/File.h" @@ -134,7 +136,7 @@ LevelChunk* OldChunkStorage::load(Level* level, int x, int z) { sprintf(buf, "Chunk file at %d, %d is missing level data, skipping\n", x, z); - app.DebugPrintf(buf); + Log::info(buf); return nullptr; } if (!tag->getCompound(L"Level")->contains(L"Blocks")) { @@ -142,7 +144,7 @@ LevelChunk* OldChunkStorage::load(Level* level, int x, int z) { sprintf(buf, "Chunk file at %d, %d is missing block data, skipping\n", x, z); - app.DebugPrintf(buf); + Log::info(buf); return nullptr; } LevelChunk* levelChunk = @@ -153,7 +155,7 @@ LevelChunk* OldChunkStorage::load(Level* level, int x, int z) { "Chunk fileat %d, %d is in the wrong location; relocating. " "Expected %d, %d, got %d, %d\n", x, z, x, z, levelChunk->x, levelChunk->z); - app.DebugPrintf(buf); + Log::info(buf); tag->putInt(L"xPos", x); tag->putInt(L"zPos", z); levelChunk = @@ -445,8 +447,8 @@ LevelChunk* OldChunkStorage::load(Level* level, DataInputStream* dis) { } #if !defined(_CONTENT_PACKAGE) - if (app.DebugSettingsOn() && - app.GetGameSettingsDebugMask(PlatformInput.GetPrimaryPad()) & + if (gameServices().debugSettingsOn() && + gameServices().debugGetMask(PlatformInput.GetPrimaryPad()) & (1L << eDebugSetting_EnableBiomeOverride)) { // Read the biome data from the stream, but don't use it std::vector dummyBiomes(levelChunk->biomes.size()); @@ -555,8 +557,8 @@ LevelChunk* OldChunkStorage::load(Level* level, CompoundTag* tag) { // 4J removed - we shouldn't need this any more #if !defined(_CONTENT_PACKAGE) - if (app.DebugSettingsOn() && - app.GetGameSettingsDebugMask(PlatformInput.GetPrimaryPad()) & + if (gameServices().debugSettingsOn() && + gameServices().debugGetMask(PlatformInput.GetPrimaryPad()) & (1L << eDebugSetting_EnableBiomeOverride)) { // Do nothing } else diff --git a/targets/minecraft/world/level/chunk/storage/RegionFile.cpp b/targets/minecraft/world/level/chunk/storage/RegionFile.cpp index c6c0cabb5..d7151a7a8 100644 --- a/targets/minecraft/world/level/chunk/storage/RegionFile.cpp +++ b/targets/minecraft/world/level/chunk/storage/RegionFile.cpp @@ -1,6 +1,4 @@ -#ifdef TRACY_ENABLE -#include -#endif +#include "minecraft/util/Log.h" #include "RegionFile.h" #include @@ -307,7 +305,7 @@ void RegionFile::write(int x, int z, std::uint8_t* data, int sectorsNeeded = (compLength + CHUNK_HEADER_SIZE) / SECTOR_BYTES + 1; - // app.DebugPrintf(">>>>>>>>>>>>>> writing compressed data for 0x%.8x, %d + // Log::info(">>>>>>>>>>>>>> writing compressed data for 0x%.8x, %d //%d\n",fileEntry->data.regionIndex,x,z); // maximum chunk size is 1MB diff --git a/targets/minecraft/world/level/chunk/storage/ZonedChunkStorage.cpp b/targets/minecraft/world/level/chunk/storage/ZonedChunkStorage.cpp index 86421596f..8b351ab29 100644 --- a/targets/minecraft/world/level/chunk/storage/ZonedChunkStorage.cpp +++ b/targets/minecraft/world/level/chunk/storage/ZonedChunkStorage.cpp @@ -1,3 +1,4 @@ +#include "minecraft/util/Log.h" #include "ZonedChunkStorage.h" #include @@ -166,7 +167,7 @@ void ZonedChunkStorage::tick() { // try { char buf[256]; sprintf(buf, "Closing zone %I64d\n", key); - app.DebugPrintf(buf); + Log::info(buf); zoneFiles[key]->close(); zoneFiles.erase(zoneFiles.find(key)); // } catch (IOException e) { diff --git a/targets/minecraft/world/level/dimension/Dimension.cpp b/targets/minecraft/world/level/dimension/Dimension.cpp index f46257b2e..3b527b48f 100644 --- a/targets/minecraft/world/level/dimension/Dimension.cpp +++ b/targets/minecraft/world/level/dimension/Dimension.cpp @@ -1,3 +1,4 @@ +#include "minecraft/IGameServices.h" #include "Dimension.h" #include @@ -6,9 +7,9 @@ #include "HellDimension.h" #include "IPlatformInput.h" -#include "app/common/App_enums.h" -#include "app/common/src/Colours/ColourTable.h" -#include "app/common/src/Console_Debug_enum.h" +#include "minecraft/GameEnums.h" +#include "app/common/Colours/ColourTable.h" +#include "app/common/Console_Debug_enum.h" #include "app/linux/LinuxGame.h" #include "NormalDimension.h" #include "TheEndDimension.h" @@ -54,8 +55,8 @@ void Dimension::init() { #ifdef _OVERRIDE_HEIGHTMAP // 4J Stu - Added to enable overriding the heightmap from a loaded in data // file - if (app.DebugSettingsOn() && - app.GetGameSettingsDebugMask(PlatformInput.GetPrimaryPad()) & + if (gameServices().debugSettingsOn() && + gameServices().debugGetMask(PlatformInput.GetPrimaryPad()) & (1L << eDebugSetting_EnableBiomeOverride)) { biomeSource = new BiomeSource(level); } else @@ -89,8 +90,8 @@ ChunkSource* Dimension::createRandomLevelSource() const { #ifdef _OVERRIDE_HEIGHTMAP // 4J Stu - Added to enable overriding the heightmap from a loaded in data // file - if (app.DebugSettingsOn() && - app.GetGameSettingsDebugMask(PlatformInput.GetPrimaryPad()) & + if (gameServices().debugSettingsOn() && + gameServices().debugGetMask(PlatformInput.GetPrimaryPad()) & (1L << eDebugSetting_EnableHeightWaterOverride)) { return new CustomLevelSource( level, level->getSeed(), @@ -216,7 +217,7 @@ int Dimension::getSpawnYPosition() { bool Dimension::hasBedrockFog() { // 4J-PB - turn off bedrock fog if the host player doesn't want it - if (app.GetGameHostOption(eGameHostOption_BedrockFog) == 0) { + if (gameServices().getGameHostOption(eGameHostOption_BedrockFog) == 0) { return false; } diff --git a/targets/minecraft/world/level/dimension/HellDimension.cpp b/targets/minecraft/world/level/dimension/HellDimension.cpp index 2f7dc19b4..c14f59c6b 100644 --- a/targets/minecraft/world/level/dimension/HellDimension.cpp +++ b/targets/minecraft/world/level/dimension/HellDimension.cpp @@ -1,11 +1,12 @@ +#include "minecraft/IGameServices.h" #include "HellDimension.h" #include #include "IPlatformInput.h" -#include "app/common/App_enums.h" -#include "app/common/src/Colours/ColourTable.h" -#include "app/common/src/Console_Debug_enum.h" +#include "minecraft/GameEnums.h" +#include "app/common/Colours/ColourTable.h" +#include "app/common/Console_Debug_enum.h" #include "app/linux/LinuxGame.h" #include "minecraft/client/Minecraft.h" #include "minecraft/world/level/Level.h" @@ -49,8 +50,8 @@ void HellDimension::updateLightRamp() { ChunkSource* HellDimension::createRandomLevelSource() const { #ifdef _DEBUG_MENUS_ENABLED - if (app.DebugSettingsOn() && - app.GetGameSettingsDebugMask(PlatformInput.GetPrimaryPad()) & + if (gameServices().debugSettingsOn() && + gameServices().debugGetMask(PlatformInput.GetPrimaryPad()) & (1L << eDebugSetting_SuperflatNether)) { return new HellFlatLevelSource(level, level->getSeed()); } else diff --git a/targets/minecraft/world/level/dimension/TheEndDimension.cpp b/targets/minecraft/world/level/dimension/TheEndDimension.cpp index 75c4dd45e..10b1ee6ad 100644 --- a/targets/minecraft/world/level/dimension/TheEndDimension.cpp +++ b/targets/minecraft/world/level/dimension/TheEndDimension.cpp @@ -4,8 +4,8 @@ #include -#include "app/common/App_enums.h" -#include "app/common/src/Colours/ColourTable.h" +#include "minecraft/GameEnums.h" +#include "app/common/Colours/ColourTable.h" #include "minecraft/Pos.h" #include "minecraft/client/Minecraft.h" #include "minecraft/world/level/Level.h" diff --git a/targets/minecraft/world/level/levelgen/CanyonFeature.cpp b/targets/minecraft/world/level/levelgen/CanyonFeature.cpp index 0c2d2b553..21f98b440 100644 --- a/targets/minecraft/world/level/levelgen/CanyonFeature.cpp +++ b/targets/minecraft/world/level/levelgen/CanyonFeature.cpp @@ -1,9 +1,10 @@ +#include "minecraft/IGameServices.h" #include "CanyonFeature.h" #include #include -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/util/Mth.h" @@ -182,7 +183,7 @@ void CanyonFeature::addFeature(Level* level, int x, int z, int xOffs, int zOffs, thickness, yRot, xRot, 0, 0, 3.0); // 4J Add to feature list - app.AddTerrainFeaturePosition(eTerrainFeature_Ravine, + gameServices().addTerrainFeaturePosition(eTerrainFeature_Ravine, (int)(xCave / 16.0), (int)(yCave / 16.0)); } } \ No newline at end of file diff --git a/targets/minecraft/world/level/levelgen/CustomLevelSource.cpp b/targets/minecraft/world/level/levelgen/CustomLevelSource.cpp index 671dbc961..2a0fa0170 100644 --- a/targets/minecraft/world/level/levelgen/CustomLevelSource.cpp +++ b/targets/minecraft/world/level/levelgen/CustomLevelSource.cpp @@ -1,10 +1,12 @@ +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "CustomLevelSource.h" #include #include #include -#include "app/common/src/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" #include "app/linux/LinuxGame.h" #include "platform/PlatformServices.h" #include "minecraft/world/level/biome/Biome.h" @@ -48,10 +50,10 @@ CustomLevelSource::CustomLevelSource(Level* level, int64_t seed, auto result = PlatformFileIO.readFile( path, m_heightmapOverride.data(), m_heightmapOverride.size()); if (result.status == IPlatformFileIO::ReadStatus::TooLarge) { - app.DebugPrintf("Heightmap binary is too large!!\n"); + Log::info("Heightmap binary is too large!!\n"); __debugbreak(); } else if (result.status != IPlatformFileIO::ReadStatus::Ok) { - app.FatalLoadError(); + gameServices().fatalLoadError(); assert(false); } } @@ -68,10 +70,10 @@ CustomLevelSource::CustomLevelSource(Level* level, int64_t seed, memset(m_waterheightOverride.data(), level->seaLevel, m_waterheightOverride.size()); } else if (result.status == IPlatformFileIO::ReadStatus::TooLarge) { - app.DebugPrintf("waterheight binary is too large!!\n"); + Log::info("waterheight binary is too large!!\n"); __debugbreak(); } else if (result.status != IPlatformFileIO::ReadStatus::Ok) { - app.FatalLoadError(); + gameServices().fatalLoadError(); } } @@ -130,7 +132,7 @@ void CustomLevelSource::prepareHeights(int xOffs, int zOffs, (xMapStart * 16 + x + (xc * CHUNK_WIDTH)); int mapHeight = m_heightmapOverride[mapIndex]; waterHeight = m_waterheightOverride[mapIndex]; - // app.DebugPrintf("MapHeight = %d, y = %d\n", + // Log::info("MapHeight = %d, y = %d\n", // mapHeight, yc * CHUNK_HEIGHT + y); /////////////////////////////////////////////////////////////////// // 4J - add this chunk of code to make land @@ -260,7 +262,7 @@ void CustomLevelSource::buildSurfaces(int xOffs, int zOffs, uint8_t top = b->topMaterial; uint8_t material = b->material; - LevelGenerationOptions* lgo = app.getLevelGenerationOptions(); + LevelGenerationOptions* lgo = gameServices().getLevelGenerationOptions(); if (lgo != nullptr) { lgo->getBiomeOverride(b->id, material, top); } @@ -527,7 +529,7 @@ void CustomLevelSource::postProcess(ChunkSource* parent, int xt, int zt) { biome->decorate(level, pprandom, xo, zo); - app.processSchematics(parent->getChunk(xt, zt)); + gameServices().processSchematics(parent->getChunk(xt, zt)); MobSpawner::postProcessSpawnMobs(level, biome, xo + 8, zo + 8, 16, 16, pprandom); diff --git a/targets/minecraft/world/level/levelgen/FlatLevelSource.cpp b/targets/minecraft/world/level/levelgen/FlatLevelSource.cpp index 42b58d265..aa2a15c4d 100644 --- a/targets/minecraft/world/level/levelgen/FlatLevelSource.cpp +++ b/targets/minecraft/world/level/levelgen/FlatLevelSource.cpp @@ -1,3 +1,4 @@ +#include "minecraft/IGameServices.h" #include "FlatLevelSource.h" #include @@ -105,7 +106,7 @@ void FlatLevelSource::postProcess(ChunkSource* parent, int xt, int zt) { villageFeature->postProcess(level, pprandom, xt, zt); } - app.processSchematics(parent->getChunk(xt, zt)); + gameServices().processSchematics(parent->getChunk(xt, zt)); } bool FlatLevelSource::save(bool force, ProgressListener* progressListener) { diff --git a/targets/minecraft/world/level/levelgen/HellFlatLevelSource.cpp b/targets/minecraft/world/level/levelgen/HellFlatLevelSource.cpp index 700f66641..2b8c7b5d8 100644 --- a/targets/minecraft/world/level/levelgen/HellFlatLevelSource.cpp +++ b/targets/minecraft/world/level/levelgen/HellFlatLevelSource.cpp @@ -1,3 +1,4 @@ +#include "minecraft/IGameServices.h" #include "HellFlatLevelSource.h" #include @@ -181,7 +182,7 @@ void HellFlatLevelSource::postProcess(ChunkSource* parent, int xt, int zt) { HeavyTile::instaFall = false; - app.processSchematics(parent->getChunk(xt, zt)); + gameServices().processSchematics(parent->getChunk(xt, zt)); } bool HellFlatLevelSource::save(bool force, ProgressListener* progressListener) { diff --git a/targets/minecraft/world/level/levelgen/HellRandomLevelSource.cpp b/targets/minecraft/world/level/levelgen/HellRandomLevelSource.cpp index 4dd0b186d..aa04a7543 100644 --- a/targets/minecraft/world/level/levelgen/HellRandomLevelSource.cpp +++ b/targets/minecraft/world/level/levelgen/HellRandomLevelSource.cpp @@ -1,3 +1,4 @@ +#include "minecraft/IGameServices.h" #include "HellRandomLevelSource.h" #include @@ -528,7 +529,7 @@ void HellRandomLevelSource::postProcess(ChunkSource* parent, int xt, int zt) { HeavyTile::instaFall = false; - app.processSchematics(parent->getChunk(xt, zt)); + gameServices().processSchematics(parent->getChunk(xt, zt)); } bool HellRandomLevelSource::save(bool force, diff --git a/targets/minecraft/world/level/levelgen/RandomLevelSource.cpp b/targets/minecraft/world/level/levelgen/RandomLevelSource.cpp index a98f0f523..29b610e64 100644 --- a/targets/minecraft/world/level/levelgen/RandomLevelSource.cpp +++ b/targets/minecraft/world/level/levelgen/RandomLevelSource.cpp @@ -1,3 +1,4 @@ +#include "minecraft/IGameServices.h" #include "RandomLevelSource.h" #include @@ -5,7 +6,7 @@ #include -#include "app/common/src/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" #include "app/linux/LinuxGame.h" #include "util/Timer.h" #include "java/Random.h" @@ -408,7 +409,7 @@ void RandomLevelSource::buildSurfaces(int xOffs, int zOffs, uint8_t top = b->topMaterial; uint8_t material = b->material; - LevelGenerationOptions* lgo = app.getLevelGenerationOptions(); + LevelGenerationOptions* lgo = gameServices().getLevelGenerationOptions(); if (lgo != nullptr) { lgo->getBiomeOverride(b->id, material, top); } @@ -798,7 +799,7 @@ void RandomLevelSource::postProcess(ChunkSource* parent, int xt, int zt) { biome->decorate(level, pprandom, xo, zo); - app.processSchematics(parent->getChunk(xt, zt)); + gameServices().processSchematics(parent->getChunk(xt, zt)); MobSpawner::postProcessSpawnMobs(level, biome, xo + 8, zo + 8, 16, 16, pprandom); diff --git a/targets/minecraft/world/level/levelgen/TheEndLevelRandomLevelSource.cpp b/targets/minecraft/world/level/levelgen/TheEndLevelRandomLevelSource.cpp index a331b7656..19bf567a3 100644 --- a/targets/minecraft/world/level/levelgen/TheEndLevelRandomLevelSource.cpp +++ b/targets/minecraft/world/level/levelgen/TheEndLevelRandomLevelSource.cpp @@ -1,3 +1,4 @@ +#include "minecraft/IGameServices.h" #include "TheEndLevelRandomLevelSource.h" #include @@ -402,7 +403,7 @@ void TheEndLevelRandomLevelSource::postProcess(ChunkSource* parent, int xt, HeavyTile::instaFall = false; - app.processSchematics(parent->getChunk(xt, zt)); + gameServices().processSchematics(parent->getChunk(xt, zt)); } bool TheEndLevelRandomLevelSource::save(bool force, diff --git a/targets/minecraft/world/level/levelgen/feature/BasicTreeFeature.cpp b/targets/minecraft/world/level/levelgen/feature/BasicTreeFeature.cpp index a2f877de2..087eefc0a 100644 --- a/targets/minecraft/world/level/levelgen/feature/BasicTreeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/BasicTreeFeature.cpp @@ -1,3 +1,5 @@ +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "BasicTreeFeature.h" #include @@ -5,7 +7,7 @@ #include #include -#include "app/common/src/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" #include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/util/Mth.h" @@ -450,14 +452,14 @@ bool BasicTree::checkLocation() { // 4J Stu Added to stop tree features generating areas previously place by // game rule generation - if (app.getLevelGenerationOptions() != nullptr) { + if (gameServices().getLevelGenerationOptions() != nullptr) { LevelGenerationOptions* levelGenOptions = - app.getLevelGenerationOptions(); + gameServices().getLevelGenerationOptions(); bool intersects = levelGenOptions->checkIntersects( startPosition[0], startPosition[1], startPosition[2], endPosition[0], endPosition[1], endPosition[2]); if (intersects) { - // app.DebugPrintf("Skipping reeds feature generation as it overlaps + // Log::info("Skipping reeds feature generation as it overlaps // a game rule structure\n"); return false; } diff --git a/targets/minecraft/world/level/levelgen/feature/BirchFeature.cpp b/targets/minecraft/world/level/levelgen/feature/BirchFeature.cpp index 1b80880ad..9cc463d87 100644 --- a/targets/minecraft/world/level/levelgen/feature/BirchFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/BirchFeature.cpp @@ -1,8 +1,10 @@ +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "BirchFeature.h" #include -#include "app/common/src/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" #include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/world/level/Level.h" @@ -44,15 +46,15 @@ bool BirchFeature::place(Level* level, Random* random, int x, int y, int z) { // 4J Stu Added to stop tree features generating areas previously place by // game rule generation - if (app.getLevelGenerationOptions() != nullptr) { + if (gameServices().getLevelGenerationOptions() != nullptr) { LevelGenerationOptions* levelGenOptions = - app.getLevelGenerationOptions(); + gameServices().getLevelGenerationOptions(); int radius = 3; bool intersects = levelGenOptions->checkIntersects( x - radius, y - 1, z - radius, x + radius, y + treeHeight, z + radius); if (intersects) { - // app.DebugPrintf("Skipping reeds feature generation as it overlaps + // Log::info("Skipping reeds feature generation as it overlaps // a game rule structure\n"); return false; } diff --git a/targets/minecraft/world/level/levelgen/feature/CaveFeature.cpp b/targets/minecraft/world/level/levelgen/feature/CaveFeature.cpp index 711774532..f106f7c6c 100644 --- a/targets/minecraft/world/level/levelgen/feature/CaveFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/CaveFeature.cpp @@ -1,3 +1,5 @@ +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "CaveFeature.h" #include @@ -5,7 +7,7 @@ #include #include -#include "app/common/src/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" #include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/util/Mth.h" @@ -46,14 +48,14 @@ bool CaveFeature::place(Level* level, Random* random, int x, int y, int z) { // 4J Stu Added to stop cave features generating areas previously place // by game rule generation - if (app.getLevelGenerationOptions() != nullptr) { + if (gameServices().getLevelGenerationOptions() != nullptr) { LevelGenerationOptions* levelGenOptions = - app.getLevelGenerationOptions(); + gameServices().getLevelGenerationOptions(); bool intersects = levelGenOptions->checkIntersects( (xx - r / 2), (yy - hr / 2), (zz - r / 2), (xx + r / 2), (yy + hr / 2), (zz + r / 2)); if (intersects) { - // app.DebugPrintf("Skipping cave feature generation as it + // Log::info("Skipping cave feature generation as it // overlaps a game rule structure\n"); return false; } diff --git a/targets/minecraft/world/level/levelgen/feature/FlowerFeature.cpp b/targets/minecraft/world/level/levelgen/feature/FlowerFeature.cpp index 95e1645cb..cfd5b65e3 100644 --- a/targets/minecraft/world/level/levelgen/feature/FlowerFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/FlowerFeature.cpp @@ -1,6 +1,8 @@ +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "FlowerFeature.h" -#include "app/common/src/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" #include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/world/level/Level.h" @@ -12,13 +14,13 @@ FlowerFeature::FlowerFeature(int tile) { this->tile = tile; } bool FlowerFeature::place(Level* level, Random* random, int x, int y, int z) { // 4J Stu Added to stop tree features generating areas previously place by // game rule generation - if (app.getLevelGenerationOptions() != nullptr) { + if (gameServices().getLevelGenerationOptions() != nullptr) { LevelGenerationOptions* levelGenOptions = - app.getLevelGenerationOptions(); + gameServices().getLevelGenerationOptions(); bool intersects = levelGenOptions->checkIntersects(x - 8, y - 4, z - 8, x + 8, y + 4, z + 8); if (intersects) { - // app.DebugPrintf("Skipping reeds feature generation as it overlaps + // Log::info("Skipping reeds feature generation as it overlaps // a game rule structure\n"); return false; } diff --git a/targets/minecraft/world/level/levelgen/feature/LakeFeature.cpp b/targets/minecraft/world/level/levelgen/feature/LakeFeature.cpp index 8bda16c58..c13c1d68a 100644 --- a/targets/minecraft/world/level/levelgen/feature/LakeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/LakeFeature.cpp @@ -1,6 +1,8 @@ +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "LakeFeature.h" -#include "app/common/src/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" #include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/world/level/Level.h" @@ -24,8 +26,8 @@ bool LakeFeature::place(Level* level, Random* random, int x, int y, int z) { bool grid[16 * 16 * 8] = {0}; LevelGenerationOptions* levelGenOptions = nullptr; - if (app.getLevelGenerationOptions() != nullptr) { - levelGenOptions = app.getLevelGenerationOptions(); + if (gameServices().getLevelGenerationOptions() != nullptr) { + levelGenOptions = gameServices().getLevelGenerationOptions(); int minX = x; int minY = y; @@ -38,7 +40,7 @@ bool LakeFeature::place(Level* level, Random* random, int x, int y, int z) { bool intersects = levelGenOptions->checkIntersects(minX, minY, minZ, maxX, maxY, maxZ); if (intersects) { - // app.DebugPrintf("Skipping reeds feature generation as it overlaps + // Log::info("Skipping reeds feature generation as it overlaps // a game rule structure\n"); return false; } diff --git a/targets/minecraft/world/level/levelgen/feature/MegaTreeFeature.cpp b/targets/minecraft/world/level/levelgen/feature/MegaTreeFeature.cpp index 386604164..a2d426b29 100644 --- a/targets/minecraft/world/level/levelgen/feature/MegaTreeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/MegaTreeFeature.cpp @@ -1,8 +1,10 @@ +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "MegaTreeFeature.h" #include -#include "app/common/src/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" #include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/util/Mth.h" @@ -26,14 +28,14 @@ bool MegaTreeFeature::place(Level* level, Random* random, int x, int y, int z) { // 4J Stu Added to stop tree features generating areas previously place by // game rule generation - if (app.getLevelGenerationOptions() != nullptr) { + if (gameServices().getLevelGenerationOptions() != nullptr) { LevelGenerationOptions* levelGenOptions = - app.getLevelGenerationOptions(); + gameServices().getLevelGenerationOptions(); bool intersects = levelGenOptions->checkIntersects( x - 2, y - 1, z - 2, x + 2, y + treeHeight, z + 2); if (intersects) { - // app.DebugPrintf("Skipping reeds feature generation as it overlaps + // Log::info("Skipping reeds feature generation as it overlaps // a game rule structure\n"); return false; } diff --git a/targets/minecraft/world/level/levelgen/feature/OreFeature.cpp b/targets/minecraft/world/level/levelgen/feature/OreFeature.cpp index 93d748087..4068466f4 100644 --- a/targets/minecraft/world/level/levelgen/feature/OreFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/OreFeature.cpp @@ -1,8 +1,10 @@ +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "OreFeature.h" #include -#include "app/common/src/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" #include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/util/Mth.h" @@ -37,8 +39,8 @@ bool OreFeature::place(Level* level, Random* random, int x, int y, int z) { bool collisionsExpected = false; LevelGenerationOptions* levelGenOptions = nullptr; - if (app.getLevelGenerationOptions() != nullptr) { - levelGenOptions = app.getLevelGenerationOptions(); + if (gameServices().getLevelGenerationOptions() != nullptr) { + levelGenOptions = gameServices().getLevelGenerationOptions(); // 4J Stu - Optimise schematic intersection checks by first checking the // max possible bounding box of this place call @@ -88,7 +90,7 @@ bool OreFeature::place(Level* level, Random* random, int x, int y, int z) { bool intersects = levelGenOptions->checkIntersects(xt0, yt0, zt0, xt1, yt1, zt1); if (intersects) { - // app.DebugPrintf("Skipping ore feature generation as it + // Log::info("Skipping ore feature generation as it // overlaps a game rule structure\n"); continue; } diff --git a/targets/minecraft/world/level/levelgen/feature/PineFeature.cpp b/targets/minecraft/world/level/levelgen/feature/PineFeature.cpp index 18cf4734f..468438eec 100644 --- a/targets/minecraft/world/level/levelgen/feature/PineFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/PineFeature.cpp @@ -1,8 +1,10 @@ +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "PineFeature.h" #include -#include "app/common/src/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" #include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/world/level/Level.h" @@ -25,14 +27,14 @@ bool PineFeature::place(Level* level, Random* random, int x, int y, int z) { // 4J Stu Added to stop tree features generating areas previously place by // game rule generation - if (app.getLevelGenerationOptions() != nullptr) { + if (gameServices().getLevelGenerationOptions() != nullptr) { LevelGenerationOptions* levelGenOptions = - app.getLevelGenerationOptions(); + gameServices().getLevelGenerationOptions(); bool intersects = levelGenOptions->checkIntersects( x - topRadius, y - 1, z - topRadius, x + topRadius, y + treeHeight, z + topRadius); if (intersects) { - // app.DebugPrintf("Skipping reeds feature generation as it overlaps + // Log::info("Skipping reeds feature generation as it overlaps // a game rule structure\n"); return false; } diff --git a/targets/minecraft/world/level/levelgen/feature/ReedsFeature.cpp b/targets/minecraft/world/level/levelgen/feature/ReedsFeature.cpp index e48443ab0..9006cc7af 100644 --- a/targets/minecraft/world/level/levelgen/feature/ReedsFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/ReedsFeature.cpp @@ -1,6 +1,8 @@ +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "ReedsFeature.h" -#include "app/common/src/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" #include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/world/level/Level.h" @@ -15,13 +17,13 @@ bool ReedsFeature::place(Level* level, Random* random, int x, int y, int z) { // 4J Stu Added to stop reed features generating areas previously place // by game rule generation - if (app.getLevelGenerationOptions() != nullptr) { + if (gameServices().getLevelGenerationOptions() != nullptr) { LevelGenerationOptions* levelGenOptions = - app.getLevelGenerationOptions(); + gameServices().getLevelGenerationOptions(); bool intersects = levelGenOptions->checkIntersects(x2, y2, z2, x2, y2, z2); if (intersects) { - // app.DebugPrintf("Skipping reeds feature generation as it + // Log::info("Skipping reeds feature generation as it // overlaps a game rule structure\n"); continue; } diff --git a/targets/minecraft/world/level/levelgen/feature/SandFeature.cpp b/targets/minecraft/world/level/levelgen/feature/SandFeature.cpp index 6ac800f6a..2e8307244 100644 --- a/targets/minecraft/world/level/levelgen/feature/SandFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/SandFeature.cpp @@ -1,6 +1,8 @@ +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "SandFeature.h" -#include "app/common/src/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" #include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/world/level/Level.h" @@ -26,14 +28,14 @@ bool SandFeature::place(Level* level, Random* random, int x, int y, int z) { // 4J Stu Added to stop tree features generating areas previously place by // game rule generation - if (app.getLevelGenerationOptions() != nullptr) { + if (gameServices().getLevelGenerationOptions() != nullptr) { LevelGenerationOptions* levelGenOptions = - app.getLevelGenerationOptions(); + gameServices().getLevelGenerationOptions(); bool intersects = levelGenOptions->checkIntersects( x - r, y - yr, z - r, x + r, y + yr, z + r); if (intersects) { level->setInstaTick(false); - // app.DebugPrintf("Skipping reeds feature generation as it overlaps + // Log::info("Skipping reeds feature generation as it overlaps // a game rule structure\n"); return false; } diff --git a/targets/minecraft/world/level/levelgen/feature/SpikeFeature.cpp b/targets/minecraft/world/level/levelgen/feature/SpikeFeature.cpp index b6cb58dbb..f24fbc8fd 100644 --- a/targets/minecraft/world/level/levelgen/feature/SpikeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/SpikeFeature.cpp @@ -1,3 +1,4 @@ +#include "minecraft/util/Log.h" #include "SpikeFeature.h" #include @@ -59,7 +60,7 @@ bool SpikeFeature::place(Level* level, Random* random, int x, int y, int z) { bool SpikeFeature::placeWithIndex(Level* level, Random* random, int x, int y, int z, int iIndex, int iRadius) { - app.DebugPrintf("Spike - %d,%d,%d - index %d\n", x, y, z, iIndex); + Log::info("Spike - %d,%d,%d - index %d\n", x, y, z, iIndex); int hh = 12 + (iIndex * 3); @@ -104,7 +105,7 @@ bool SpikeFeature::placeWithIndex(Level* level, Random* random, int x, int y, } } } else { - app.DebugPrintf("Breaking out of spike feature\n"); + Log::info("Breaking out of spike feature\n"); break; } } @@ -132,7 +133,7 @@ bool SpikeFeature::placeWithIndex(Level* level, Random* random, int x, int y, } } } else { - app.DebugPrintf("Breaking out of spike feature\n"); + Log::info("Breaking out of spike feature\n"); break; } } diff --git a/targets/minecraft/world/level/levelgen/feature/SpringFeature.cpp b/targets/minecraft/world/level/levelgen/feature/SpringFeature.cpp index d2d946620..34833deb5 100644 --- a/targets/minecraft/world/level/levelgen/feature/SpringFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/SpringFeature.cpp @@ -1,6 +1,8 @@ +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "SpringFeature.h" -#include "app/common/src/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" #include "app/linux/LinuxGame.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/tile/Tile.h" @@ -10,12 +12,12 @@ SpringFeature::SpringFeature(int tile) { this->tile = tile; } bool SpringFeature::place(Level* level, Random* random, int x, int y, int z) { // 4J Stu Added to stop spring features generating areas previously place by // game rule generation - if (app.getLevelGenerationOptions() != nullptr) { + if (gameServices().getLevelGenerationOptions() != nullptr) { LevelGenerationOptions* levelGenOptions = - app.getLevelGenerationOptions(); + gameServices().getLevelGenerationOptions(); bool intersects = levelGenOptions->checkIntersects(x, y, z, x, y, z); if (intersects) { - // app.DebugPrintf("Skipping spring feature generation as it + // Log::info("Skipping spring feature generation as it // overlaps a game rule structure\n"); return false; } diff --git a/targets/minecraft/world/level/levelgen/feature/SpruceFeature.cpp b/targets/minecraft/world/level/levelgen/feature/SpruceFeature.cpp index 202ac78dd..eeebb62fa 100644 --- a/targets/minecraft/world/level/levelgen/feature/SpruceFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/SpruceFeature.cpp @@ -1,8 +1,10 @@ +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "SpruceFeature.h" #include -#include "app/common/src/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" #include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/world/level/Level.h" @@ -28,14 +30,14 @@ bool SpruceFeature::place(Level* level, Random* random, int x, int y, int z) { // 4J Stu Added to stop tree features generating areas previously place by // game rule generation - if (app.getLevelGenerationOptions() != nullptr) { + if (gameServices().getLevelGenerationOptions() != nullptr) { LevelGenerationOptions* levelGenOptions = - app.getLevelGenerationOptions(); + gameServices().getLevelGenerationOptions(); bool intersects = levelGenOptions->checkIntersects( x - leafRadius, y - 1, z - leafRadius, x + leafRadius, y + treeHeight, z + leafRadius); if (intersects) { - // app.DebugPrintf("Skipping reeds feature generation as it overlaps + // Log::info("Skipping reeds feature generation as it overlaps // a game rule structure\n"); return false; } diff --git a/targets/minecraft/world/level/levelgen/feature/SwampTreeFeature.cpp b/targets/minecraft/world/level/levelgen/feature/SwampTreeFeature.cpp index 773fba1af..79c962cca 100644 --- a/targets/minecraft/world/level/levelgen/feature/SwampTreeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/SwampTreeFeature.cpp @@ -1,8 +1,10 @@ +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "SwampTreeFeature.h" #include -#include "app/common/src/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" #include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/world/level/Level.h" @@ -20,13 +22,13 @@ bool SwampTreeFeature::place(Level* level, Random* random, int x, int y, // 4J Stu Added to stop tree features generating areas previously place by // game rule generation - if (app.getLevelGenerationOptions() != nullptr) { + if (gameServices().getLevelGenerationOptions() != nullptr) { LevelGenerationOptions* levelGenOptions = - app.getLevelGenerationOptions(); + gameServices().getLevelGenerationOptions(); bool intersects = levelGenOptions->checkIntersects( x - 3, y - 1, z - 3, x + 3, y + treeHeight, z + 3); if (intersects) { - // app.DebugPrintf("Skipping reeds feature generation as it overlaps + // Log::info("Skipping reeds feature generation as it overlaps // a game rule structure\n"); return false; } diff --git a/targets/minecraft/world/level/levelgen/feature/TreeFeature.cpp b/targets/minecraft/world/level/levelgen/feature/TreeFeature.cpp index 6acad9303..5ebcfa2b2 100644 --- a/targets/minecraft/world/level/levelgen/feature/TreeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/TreeFeature.cpp @@ -1,8 +1,10 @@ +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "TreeFeature.h" #include -#include "app/common/src/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" #include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/Direction.h" @@ -34,14 +36,14 @@ bool TreeFeature::place(Level* level, Random* random, int x, int y, int z) { // 4J Stu Added to stop tree features generating areas previously place by // game rule generation - if (app.getLevelGenerationOptions() != nullptr) { + if (gameServices().getLevelGenerationOptions() != nullptr) { LevelGenerationOptions* levelGenOptions = - app.getLevelGenerationOptions(); + gameServices().getLevelGenerationOptions(); bool intersects = levelGenOptions->checkIntersects( x - 2, y - 1, z - 2, x + 2, y + treeHeight, z + 2); if (intersects) { - // app.DebugPrintf("Skipping reeds feature generation as it overlaps + // Log::info("Skipping reeds feature generation as it overlaps // a game rule structure\n"); return false; } diff --git a/targets/minecraft/world/level/levelgen/structure/MineShaftFeature.cpp b/targets/minecraft/world/level/levelgen/structure/MineShaftFeature.cpp index af89bbe44..8e3f98a02 100644 --- a/targets/minecraft/world/level/levelgen/structure/MineShaftFeature.cpp +++ b/targets/minecraft/world/level/levelgen/structure/MineShaftFeature.cpp @@ -1,3 +1,4 @@ +#include "minecraft/IGameServices.h" #include "minecraft/world/level/levelgen/structure/MineShaftFeature.h" @@ -8,8 +9,8 @@ #include #include -#include "app/common/App_enums.h" -#include "app/common/src/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "minecraft/GameEnums.h" +#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" #include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/util/Mth.h" @@ -34,7 +35,7 @@ MineShaftFeature::MineShaftFeature( bool MineShaftFeature::isFeatureChunk(int x, int z, bool bIsSuperflat) { bool forcePlacement = false; - LevelGenerationOptions* levelGenOptions = app.getLevelGenerationOptions(); + LevelGenerationOptions* levelGenOptions = gameServices().getLevelGenerationOptions(); if (levelGenOptions != nullptr) { forcePlacement = levelGenOptions->isFeatureChunk(x, z, eFeature_Mineshaft); @@ -46,7 +47,7 @@ bool MineShaftFeature::isFeatureChunk(int x, int z, bool bIsSuperflat) { StructureStart* MineShaftFeature::createStructureStart(int x, int z) { // 4J added - app.AddTerrainFeaturePosition(eTerrainFeature_Mineshaft, x, z); + gameServices().addTerrainFeaturePosition(eTerrainFeature_Mineshaft, x, z); return new MineShaftStart(level, random, x, z); } \ No newline at end of file diff --git a/targets/minecraft/world/level/levelgen/structure/NetherBridgeFeature.cpp b/targets/minecraft/world/level/levelgen/structure/NetherBridgeFeature.cpp index 0ead8b346..e1d850262 100644 --- a/targets/minecraft/world/level/levelgen/structure/NetherBridgeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/structure/NetherBridgeFeature.cpp @@ -1,9 +1,10 @@ +#include "minecraft/IGameServices.h" #include "NetherBridgeFeature.h" #include #include -#include "app/common/src/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" #include "app/linux/LinuxGame.h" #include "NetherBridgePieces.h" #include "java/Class.h" @@ -59,7 +60,7 @@ bool NetherBridgeFeature::isFeatureChunk(int x, int z, bool bIsSuperflat) { } bool forcePlacement = false; - LevelGenerationOptions* levelGenOptions = app.getLevelGenerationOptions(); + LevelGenerationOptions* levelGenOptions = gameServices().getLevelGenerationOptions(); if (levelGenOptions != nullptr) { forcePlacement = levelGenOptions->isFeatureChunk(x, z, eFeature_NetherBridge); diff --git a/targets/minecraft/world/level/levelgen/structure/RandomScatteredLargeFeature.cpp b/targets/minecraft/world/level/levelgen/structure/RandomScatteredLargeFeature.cpp index 05e1932bf..22a6317b3 100644 --- a/targets/minecraft/world/level/levelgen/structure/RandomScatteredLargeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/structure/RandomScatteredLargeFeature.cpp @@ -1,9 +1,10 @@ +#include "minecraft/IGameServices.h" #include "RandomScatteredLargeFeature.h" #include #include -#include "app/common/src/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" #include "app/linux/LinuxGame.h" #include "ScatteredFeaturePieces.h" #include "java/Class.h" @@ -67,7 +68,7 @@ bool RandomScatteredLargeFeature::isFeatureChunk(int x, int z, z = zz; bool forcePlacement = false; - LevelGenerationOptions* levelGenOptions = app.getLevelGenerationOptions(); + LevelGenerationOptions* levelGenOptions = gameServices().getLevelGenerationOptions(); if (levelGenOptions != nullptr) { forcePlacement = levelGenOptions->isFeatureChunk(x, z, eFeature_Temples); diff --git a/targets/minecraft/world/level/levelgen/structure/ScatteredFeaturePieces.cpp b/targets/minecraft/world/level/levelgen/structure/ScatteredFeaturePieces.cpp index a74726325..c07076160 100644 --- a/targets/minecraft/world/level/levelgen/structure/ScatteredFeaturePieces.cpp +++ b/targets/minecraft/world/level/levelgen/structure/ScatteredFeaturePieces.cpp @@ -1,3 +1,4 @@ +#include "minecraft/IGameServices.h" #include "ScatteredFeaturePieces.h" #include @@ -5,7 +6,7 @@ #include #include -#include "app/common/src/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" #include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/Direction.h" @@ -60,7 +61,7 @@ ScatteredFeaturePieces::ScatteredFeaturePiece::ScatteredFeaturePiece( orientation = random->nextInt(4); - LevelGenerationOptions* levelGenOptions = app.getLevelGenerationOptions(); + LevelGenerationOptions* levelGenOptions = gameServices().getLevelGenerationOptions(); if (levelGenOptions != nullptr) { int tempOrientation = 0; if (levelGenOptions->isFeatureChunk(west >> 4, north >> 4, diff --git a/targets/minecraft/world/level/levelgen/structure/StrongholdFeature.cpp b/targets/minecraft/world/level/levelgen/structure/StrongholdFeature.cpp index 8d2f06d5d..8435768a2 100644 --- a/targets/minecraft/world/level/levelgen/structure/StrongholdFeature.cpp +++ b/targets/minecraft/world/level/levelgen/structure/StrongholdFeature.cpp @@ -1,3 +1,5 @@ +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "StrongholdFeature.h" #include @@ -8,8 +10,8 @@ #include #include -#include "app/common/App_enums.h" -#include "app/common/src/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "minecraft/GameEnums.h" +#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" #include "app/linux/LinuxGame.h" #include "app/linux/Stubs/winapi_stubs.h" #include "StrongholdPieces.h" @@ -161,12 +163,12 @@ bool StrongholdFeature::isFeatureChunk(int x, int z, bool bIsSuperflat) { } #endif - app.DebugPrintf( + Log::info( "Placed stronghold in valid biome at (%d, %d), (%d, " "%d)\n", selectedX, selectedZ, position->x, position->z); // 4J added - app.AddTerrainFeaturePosition(eTerrainFeature_Stronghold, + gameServices().addTerrainFeaturePosition(eTerrainFeature_Stronghold, selectedX, selectedZ); // 4J Added @@ -196,7 +198,7 @@ bool StrongholdFeature::isFeatureChunk(int x, int z, bool bIsSuperflat) { // one we tried, so store it in the save so Eye of Ender works Fix // for #81933 - GAMEPLAY: The Eye of Ender occasionally does not // appear when used to try and locate the End Portal. - app.AddTerrainFeaturePosition(eTerrainFeature_Stronghold, + gameServices().addTerrainFeaturePosition(eTerrainFeature_Stronghold, strongholdPos[0]->x, strongholdPos[0]->z); } @@ -207,7 +209,7 @@ bool StrongholdFeature::isFeatureChunk(int x, int z, bool bIsSuperflat) { for (int i = 0; i < strongholdPos_length; i++) { bool forcePlacement = false; LevelGenerationOptions* levelGenOptions = - app.getLevelGenerationOptions(); + gameServices().getLevelGenerationOptions(); if (levelGenOptions != nullptr) { forcePlacement = levelGenOptions->isFeatureChunk(x, z, eFeature_Stronghold); diff --git a/targets/minecraft/world/level/levelgen/structure/StrongholdPieces.cpp b/targets/minecraft/world/level/levelgen/structure/StrongholdPieces.cpp index d473dcf0e..8d5ffd42b 100644 --- a/targets/minecraft/world/level/levelgen/structure/StrongholdPieces.cpp +++ b/targets/minecraft/world/level/levelgen/structure/StrongholdPieces.cpp @@ -1,3 +1,4 @@ +#include "minecraft/IGameServices.h" #include "StrongholdPieces.h" #include @@ -6,7 +7,7 @@ #include #include -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" #include "java/Random.h" @@ -1970,7 +1971,7 @@ bool StrongholdPieces::PortalRoom::postProcess(Level* level, Random* random, // 4J Stu - The mob spawner location is close enough for the map // icon display, and this ensures that we only need to set the // position once - app.AddTerrainFeaturePosition(eTerrainFeature_StrongholdEndPortal, + gameServices().addTerrainFeaturePosition(eTerrainFeature_StrongholdEndPortal, x, z); level->getLevelData()->setXStrongholdEndPortal(x); level->getLevelData()->setZStrongholdEndPortal(z); diff --git a/targets/minecraft/world/level/levelgen/structure/StructureFeatureIO.cpp b/targets/minecraft/world/level/levelgen/structure/StructureFeatureIO.cpp index 9de107b29..84d15d80c 100644 --- a/targets/minecraft/world/level/levelgen/structure/StructureFeatureIO.cpp +++ b/targets/minecraft/world/level/levelgen/structure/StructureFeatureIO.cpp @@ -1,3 +1,4 @@ +#include "minecraft/util/Log.h" #include "StructureFeatureIO.h" #include @@ -95,7 +96,7 @@ StructureStart* StructureFeatureIO::loadStaticStart(CompoundTag* tag, if (start != nullptr) { start->load(level, tag); } else { - app.DebugPrintf("Skipping Structure with id %ls", + Log::info("Skipping Structure with id %ls", tag->getString(L"id").c_str()); } return start; @@ -113,7 +114,7 @@ StructurePiece* StructureFeatureIO::loadStaticPiece(CompoundTag* tag, if (piece != nullptr) { piece->load(level, tag); } else { - app.DebugPrintf("Skipping Piece with id %ls", + Log::info("Skipping Piece with id %ls", tag->getString(L"id").c_str()); } return piece; diff --git a/targets/minecraft/world/level/levelgen/structure/VillageFeature.cpp b/targets/minecraft/world/level/levelgen/structure/VillageFeature.cpp index 790e66aa9..0f9c3ed28 100644 --- a/targets/minecraft/world/level/levelgen/structure/VillageFeature.cpp +++ b/targets/minecraft/world/level/levelgen/structure/VillageFeature.cpp @@ -1,11 +1,13 @@ +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "VillageFeature.h" #include #include #include -#include "app/common/App_enums.h" -#include "app/common/src/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "minecraft/GameEnums.h" +#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" #include "app/linux/LinuxGame.h" #include "VillagePieces.h" #include "java/Random.h" @@ -84,7 +86,7 @@ bool VillageFeature::isFeatureChunk(int x, int z, bool bIsSuperflat) { z = zz; bool forcePlacement = false; - LevelGenerationOptions* levelGenOptions = app.getLevelGenerationOptions(); + LevelGenerationOptions* levelGenOptions = gameServices().getLevelGenerationOptions(); if (levelGenOptions != nullptr) { forcePlacement = levelGenOptions->isFeatureChunk(x, z, eFeature_Village); @@ -94,7 +96,7 @@ bool VillageFeature::isFeatureChunk(int x, int z, bool bIsSuperflat) { bool biomeOk = level->getBiomeSource()->containsOnly( x * 16 + 8, z * 16 + 8, 0, allowedBiomes); if (biomeOk) { - // app.DebugPrintf("Biome ok for Village at %d, %d\n",(x * 16 + + // Log::info("Biome ok for Village at %d, %d\n",(x * 16 + // 8),(z * 16 + 8)); return true; } @@ -105,7 +107,7 @@ bool VillageFeature::isFeatureChunk(int x, int z, bool bIsSuperflat) { StructureStart* VillageFeature::createStructureStart(int x, int z) { // 4J added - app.AddTerrainFeaturePosition(eTerrainFeature_Village, x, z); + gameServices().addTerrainFeaturePosition(eTerrainFeature_Village, x, z); return new VillageStart(level, random, x, z, villageSizeModifier, m_iXZSize); diff --git a/targets/minecraft/world/level/material/MaterialColor.h b/targets/minecraft/world/level/material/MaterialColor.h index 4e40de3eb..bb4d004d8 100644 --- a/targets/minecraft/world/level/material/MaterialColor.h +++ b/targets/minecraft/world/level/material/MaterialColor.h @@ -1,6 +1,6 @@ #pragma once -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" class MaterialColor { public: diff --git a/targets/minecraft/world/level/newbiome/layer/BiomeOverrideLayer.cpp b/targets/minecraft/world/level/newbiome/layer/BiomeOverrideLayer.cpp index 51a46ae9a..1026245ad 100644 --- a/targets/minecraft/world/level/newbiome/layer/BiomeOverrideLayer.cpp +++ b/targets/minecraft/world/level/newbiome/layer/BiomeOverrideLayer.cpp @@ -1,8 +1,9 @@ +#include "minecraft/util/Log.h" #include "BiomeOverrideLayer.h" #include -#include "app/linux/LinuxGame.h" +#include "minecraft/IGameServices.h" #include "platform/PlatformServices.h" #include "minecraft/world/level/newbiome/layer/Layer.h" #if defined(__linux__) @@ -18,14 +19,14 @@ BiomeOverrideLayer::BiomeOverrideLayer(int seedMixup) : Layer(seedMixup) { auto result = PlatformFileIO.readFile( path, m_biomeOverride.data(), m_biomeOverride.size()); if (result.status == IPlatformFileIO::ReadStatus::NotFound) { - app.DebugPrintf("Biome override not found, using plains as default\n"); + Log::info("Biome override not found, using plains as default\n"); memset(m_biomeOverride.data(), Biome::plains->id, m_biomeOverride.size()); } else if (result.status == IPlatformFileIO::ReadStatus::TooLarge) { - app.DebugPrintf("Biomemap binary is too large!!\n"); + Log::info("Biomemap binary is too large!!\n"); __debugbreak(); } else if (result.status != IPlatformFileIO::ReadStatus::Ok) { - app.FatalLoadError(); + gameServices().fatalLoadError(); } } } diff --git a/targets/minecraft/world/level/newbiome/layer/Layer.cpp b/targets/minecraft/world/level/newbiome/layer/Layer.cpp index c73a4db47..8e587c898 100644 --- a/targets/minecraft/world/level/newbiome/layer/Layer.cpp +++ b/targets/minecraft/world/level/newbiome/layer/Layer.cpp @@ -1,3 +1,4 @@ +#include "minecraft/IGameServices.h" #include "minecraft/world/level/newbiome/layer/Layer.h" #include @@ -7,7 +8,7 @@ #include "BiomeOverrideLayer.h" #include "IPlatformInput.h" -#include "app/common/src/Console_Debug_enum.h" +#include "app/common/Console_Debug_enum.h" #include "app/linux/LinuxGame.h" #include "minecraft/world/level/LevelType.h" #include "minecraft/world/level/newbiome/layer/AddIslandLayer.h" @@ -110,8 +111,8 @@ std::vector> Layer::getDefaultLayers( #if !defined(_CONTENT_PACKAGE) #if defined(_BIOME_OVERRIDE) - if (app.DebugSettingsOn() && - app.GetGameSettingsDebugMask(PlatformInput.GetPrimaryPad()) & + if (gameServices().debugSettingsOn() && + gameServices().debugGetMask(PlatformInput.GetPrimaryPad()) & (1L << eDebugSetting_EnableBiomeOverride)) { biomeLayer = std::make_shared(1); } diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileConverter.cpp b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileConverter.cpp index 6b67ddfce..ad6efcbd5 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileConverter.cpp +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileConverter.cpp @@ -8,7 +8,7 @@ #include #include -#include "app/common/src/GameRules/GameRuleManager.h" +#include "app/common/GameRules/GameRuleManager.h" #include "java/InputOutputStream/BufferedOutputStream.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp index a46f9615f..24a668711 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp @@ -1,3 +1,5 @@ +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.h" #include @@ -13,9 +15,9 @@ #include #include "platform/PlatformTypes.h" -#include "app/common/App_enums.h" -#include "app/common/src/BuildVer/BuildVer.h" -#include "app/common/src/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "minecraft/GameEnums.h" +#include "app/common/BuildVer/BuildVer.h" +#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" #include "app/linux/LinuxGame.h" #include "app/linux/Stubs/winapi_stubs.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" @@ -66,7 +68,7 @@ ConsoleSaveFileOriginal::ConsoleSaveFileOriginal( // Load a save from the game rules bool bLevelGenBaseSave = false; - LevelGenerationOptions* levelGen = app.getLevelGenerationOptions(); + LevelGenerationOptions* levelGen = gameServices().getLevelGenerationOptions(); if (pvSaveData == nullptr && levelGen != nullptr && levelGen->requiresBaseSave()) { pvSaveData = levelGen->getBaseSaveData(fileSize); @@ -115,7 +117,7 @@ ConsoleSaveFileOriginal::ConsoleSaveFileOriginal( } else { unsigned int storageLength; PlatformStorage.GetSaveData(pvSaveMem, &storageLength); - app.DebugPrintf("Filesize - %d, Adjusted size - %d\n", fileSize, + Log::info("Filesize - %d, Adjusted size - %d\n", fileSize, storageLength); fileSize = storageLength; } @@ -129,7 +131,7 @@ ConsoleSaveFileOriginal::ConsoleSaveFileOriginal( if (decompSize == 0) { // 4J Stu - Saves created between 2/12/2011 and 7/12/2011 // will have this problem - app.DebugPrintf("Invalid save data format\n"); + Log::info("Invalid save data format\n"); std::memset(pvSourceData, 0, fileSize); // Clear the first 8 bytes that reference the header header.WriteHeader(pvSourceData); @@ -606,7 +608,7 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail) { std::chrono::steady_clock::now() - startTime) .count(); - app.DebugPrintf("Check buffer size: Elapsed time %f\n", fElapsedTime); + Log::info("Check buffer size: Elapsed time %f\n", fElapsedTime); // We add 4 bytes to the start so that we can signal compressed data // And another 4 bytes to store the decompressed data size @@ -626,14 +628,14 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail) { std::chrono::steady_clock::now() - startTime) .count(); - app.DebugPrintf("Compress: Elapsed time %f\n", fElapsedTime); + Log::info("Compress: Elapsed time %f\n", fElapsedTime); std::fill_n(compData, 8, std::uint8_t{0}); int saveVer = 0; memcpy(compData, &saveVer, sizeof(int)); memcpy(compData + 4, &fileSize, sizeof(int)); - app.DebugPrintf("Save data compressed from %d to %d\n", fileSize, + Log::info("Save data compressed from %d to %d\n", fileSize, compLength); std::uint8_t* pbThumbnailData = nullptr; @@ -643,7 +645,7 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail) { unsigned int dwDataSizeSaveImage = 0; #ifdef _WINDOWS64 - app.GetSaveThumbnail(&pbThumbnailData, &dwThumbnailDataSize, + gameServices().getSaveThumbnail(&pbThumbnailData, &dwThumbnailDataSize, &pbDataSaveImage, &dwDataSizeSaveImage); #endif @@ -660,9 +662,9 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail) { hasSeed = true; } - int iTextMetadataBytes = app.CreateImageTextData( + int iTextMetadataBytes = gameServices().createImageTextData( bTextMetadata, seed, hasSeed, - app.GetGameHostOption(eGameHostOption_All), + gameServices().getGameHostOption(eGameHostOption_All), Minecraft::GetInstance()->getCurrentTexturePackId()); int32_t saveOrCheckpointId = 0; @@ -673,14 +675,14 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail) { PlatformStorage.SetSaveImages(pbThumbnailData, dwThumbnailDataSize, pbDataSaveImage, dwDataSizeSaveImage, bTextMetadata, iTextMetadataBytes); - app.DebugPrintf("Save thumbnail size %d\n", dwThumbnailDataSize); + Log::info("Save thumbnail size %d\n", dwThumbnailDataSize); // save the data PlatformStorage.SaveSaveData( &ConsoleSaveFileOriginal::SaveSaveDataCallback, this); #ifndef _CONTENT_PACKAGE - if (app.DebugSettingsOn()) { - if (app.GetWriteSavesToFolderEnabled()) { + if (gameServices().debugSettingsOn()) { + if (gameServices().getWriteSavesToFolderEnabled()) { DebugFlushToFile(compData, compLength + 8); } } @@ -867,10 +869,10 @@ void ConsoleSaveFileOriginal::ConvertToLocalPlatform() { std::wstring suffix(L".mcr"); if (fName.compare(fName.length() - suffix.length(), suffix.length(), suffix) == 0) { - app.DebugPrintf("Processing a region file: %ls\n", fName.c_str()); + Log::info("Processing a region file: %ls\n", fName.c_str()); ConvertRegionFile(File(fe->data.filename)); } else { - app.DebugPrintf("%ls is not a region file, ignoring\n", + Log::info("%ls is not a region file, ignoring\n", fName.c_str()); } } diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp index 92645bd2f..353f50448 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp @@ -1,3 +1,5 @@ +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.h" #include @@ -14,9 +16,9 @@ #include #include "platform/PlatformTypes.h" -#include "app/common/App_enums.h" -#include "app/common/src/BuildVer/BuildVer.h" -#include "app/common/src/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "minecraft/GameEnums.h" +#include "app/common/BuildVer/BuildVer.h" +#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" #include "app/linux/LinuxGame.h" #include "app/linux/Stubs/winapi_stubs.h" #include "util/Timer.h" @@ -197,7 +199,7 @@ void ConsoleSaveFileSplit::RegionFileReference::Compress() { assert((dataOut - dataCompressed) == outputSize); dataCompressedSize = outputSize; // std::int64_t endTime = System::currentTimeMillis(); - // app.DebugPrintf("Compressing region file 0x%.8x from %d to %d bytes - + // Log::info("Compressing region file 0x%.8x from %d to %d bytes - //%dms\n", fileEntry->data.regionIndex, fileEntry->data.length, // dataCompressedSize, endTime - startTime); } @@ -277,7 +279,7 @@ void ConsoleSaveFileSplit::RegionFileReference::Decompress() { assert(0); } // std::int64_t endTime = System::currentTimeMillis(); - // app.DebugPrintf("Decompressing region file from 0x%.8x %d to %d bytes - + // Log::info("Decompressing region file from 0x%.8x %d to %d bytes - //%dms\n", fileEntry->data.regionIndex, dataCompressedSize, // fileEntry->data.length, endTime - startTime);// } @@ -337,7 +339,7 @@ unsigned int ConsoleSaveFileSplit::RegionFileReference::GetCompressedSize() { // Release dataCompressed void ConsoleSaveFileSplit::RegionFileReference::ReleaseCompressed() { - // app.DebugPrintf("Releasing compressed data for region file from + // Log::info("Releasing compressed data for region file from // 0x%.8x\n", fileEntry->data.regionIndex ); free(dataCompressed); dataCompressed = nullptr; @@ -367,7 +369,7 @@ ConsoleSaveFileSplit::ConsoleSaveFileSplit( // Load a save from the game rules bool bLevelGenBaseSave = false; - LevelGenerationOptions* levelGen = app.getLevelGenerationOptions(); + LevelGenerationOptions* levelGen = gameServices().getLevelGenerationOptions(); if (pvSaveData == nullptr && levelGen != nullptr && levelGen->requiresBaseSave()) { pvSaveData = levelGen->getBaseSaveData(fileSize); @@ -491,7 +493,7 @@ void ConsoleSaveFileSplit::_init(const std::wstring& fileName, void* pvSaveData, } else { unsigned int storageLength; PlatformStorage.GetSaveData(pvSaveMem, &storageLength); - app.DebugPrintf("Filesize - %d, Adjusted size - %d\n", fileSize, + Log::info("Filesize - %d, Adjusted size - %d\n", fileSize, storageLength); fileSize = storageLength; } @@ -504,7 +506,7 @@ void ConsoleSaveFileSplit::_init(const std::wstring& fileName, void* pvSaveData, if (decompSize == 0) { // 4J Stu - Saves created between 2/12/2011 and 7/12/2011 will // have this problem - app.DebugPrintf("Invalid save data format\n"); + Log::info("Invalid save data format\n"); memset(pvSaveMem, 0, fileSize); // Clear the first 8 bytes that reference the header header.WriteHeader(pvSaveMem); @@ -538,7 +540,7 @@ void ConsoleSaveFileSplit::_init(const std::wstring& fileName, void* pvSaveData, } else { // Corrupt save, although most of the terrain should // actually be ok - app.DebugPrintf("Failed to decompress save data!\n"); + Log::info("Failed to decompress save data!\n"); #if !defined(_CONTENT_PACKAGE) __debugbreak(); #endif @@ -721,7 +723,7 @@ bool ConsoleSaveFileSplit::writeFile(FileEntry* file, const void* lpBuffer, memcpy(fileRef->data + file->currentFilePointer, lpBuffer, nNumberOfBytesToWrite); - // app.DebugPrintf(">>>>>>>>>>>>>> writing a region file's + // Log::info(">>>>>>>>>>>>>> writing a region file's // data 0x%.8x, 0x%x offset %d of %d bytes (writing %d // bytes)\n",file->data.regionIndex,fileRef->data,file->currentFilePointer, // file->getFileSize(), nNumberOfBytesToWrite); @@ -788,7 +790,7 @@ bool ConsoleSaveFileSplit::zeroFile(FileEntry* file, memset(fileRef->data + file->currentFilePointer, 0, nNumberOfBytesToWrite); - // app.DebugPrintf(">>>>>>>>>>>>>> writing a region file's + // Log::info(">>>>>>>>>>>>>> writing a region file's // data 0x%.8x, 0x%x offset %d of %d bytes (writing %d // bytes)\n",file->data.regionIndex,fileRef->data,file->currentFilePointer, // file->getFileSize(), nNumberOfBytesToWrite); @@ -966,7 +968,7 @@ void ConsoleSaveFileSplit::tick() { writeHistory.push_back(writeEvent); regionRef->Compress(); - // app.DebugPrintf("Tick: Writing region 0x%.8x, compressed + // Log::info("Tick: Writing region 0x%.8x, compressed // as %d bytes\n",regionRef->fileEntry->getRegionFileIndex(), // regionRef->dataCompressedSize); PlatformStorage.UpdateSubfile(regionRef->index, @@ -1275,7 +1277,7 @@ void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail) { // The storage manage might potentially be busy doing a sub-file write // initiated from the tick. Wait until this is totally processed. while (PlatformStorage.GetSaveState() != IPlatformStorage::ESaveGame_Idle) { - app.DebugPrintf("Flush wait\n"); + Log::info("Flush wait\n"); std::this_thread::sleep_for(std::chrono::milliseconds(10)); } @@ -1314,7 +1316,7 @@ void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail) { Compression::getCompression()->Compress(nullptr, &compLength, pvSaveMem, fileSize); - app.DebugPrintf("Check buffer size: Elapsed time %f\n", + Log::info("Check buffer size: Elapsed time %f\n", static_cast(timer.elapsed_seconds())); // We add 4 bytes to the start so that we can signal compressed data @@ -1331,7 +1333,7 @@ void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail) { Compression::getCompression()->Compress(compData + 8, &compLength, pvSaveMem, fileSize); - app.DebugPrintf("Compress: Elapsed time %f\n", + Log::info("Compress: Elapsed time %f\n", static_cast(timer.elapsed_seconds())); memset(compData, 0, 8); @@ -1339,7 +1341,7 @@ void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail) { memcpy(compData, &saveVer, sizeof(int)); memcpy(compData + 4, &fileSize, sizeof(int)); - app.DebugPrintf("Save data compressed from %d to %d\n", fileSize, + Log::info("Save data compressed from %d to %d\n", fileSize, compLength); if (updateThumbnail) { @@ -1363,16 +1365,16 @@ void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail) { hasSeed = true; } - int iTextMetadataBytes = app.CreateImageTextData( + int iTextMetadataBytes = gameServices().createImageTextData( bTextMetadata, seed, hasSeed, - app.GetGameHostOption(eGameHostOption_All), + gameServices().getGameHostOption(eGameHostOption_All), Minecraft::GetInstance()->getCurrentTexturePackId()); // set the icon and save image PlatformStorage.SetSaveImages(pbThumbnailData, dwThumbnailDataSize, pbDataSaveImage, dwDataSizeSaveImage, bTextMetadata, iTextMetadataBytes); - app.DebugPrintf("Save thumbnail size %d\n", dwThumbnailDataSize); + Log::info("Save thumbnail size %d\n", dwThumbnailDataSize); } int32_t saveOrCheckpointId = 0; @@ -1384,8 +1386,8 @@ void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail) { return SaveSaveDataCallback(this, bRes); }); #if !defined(_CONTENT_PACKAGE) - if (app.DebugSettingsOn()) { - if (app.GetWriteSavesToFolderEnabled()) { + if (gameServices().debugSettingsOn()) { + if (gameServices().getWriteSavesToFolderEnabled()) { DebugFlushToFile(compData, compLength + 8); } } @@ -1593,10 +1595,10 @@ void ConsoleSaveFileSplit::ConvertToLocalPlatform() { std::wstring suffix(L".mcr"); if (fName.compare(fName.length() - suffix.length(), suffix.length(), suffix) == 0) { - app.DebugPrintf("Processing a region file: %ls\n", fName.c_str()); + Log::info("Processing a region file: %ls\n", fName.c_str()); ConvertRegionFile(File(fe->data.filename)); } else { - app.DebugPrintf("%ls is not a region file, ignoring\n", + Log::info("%ls is not a region file, ignoring\n", fName.c_str()); } } diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.cpp b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.cpp index 129c81425..8f8521493 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.cpp +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.cpp @@ -1,3 +1,4 @@ +#include "minecraft/util/Log.h" // #define _DEBUG_FILE_HEADER @@ -106,7 +107,7 @@ void FileHeader::WriteHeader(void* saveMem) { *(versions + 1) = versionNumber; #if defined(_DEBUG_FILE_HEADER) - app.DebugPrintf( + Log::info( "Write save file with original version: %d, and current version %d\n", m_originalSaveVersion, versionNumber); #endif @@ -114,7 +115,7 @@ void FileHeader::WriteHeader(void* saveMem) { char* headerPosition = (char*)saveMem + headerOffset; #if defined(_DEBUG_FILE_HEADER) - app.DebugPrintf("\n\nWrite file Header: Offset = %d, Size = %d\n", + Log::info("\n\nWrite file Header: Offset = %d, Size = %d\n", headerOffset, headerSize); #endif @@ -178,10 +179,10 @@ void FileHeader::ReadHeader( if (isSaveEndianDifferent()) System::ReverseSHORT(&m_saveVersion); #if defined(_DEBUG_FILE_HEADER) - app.DebugPrintf( + Log::info( "Read save file with orignal version: %d, and current version %d\n", m_originalSaveVersion, m_saveVersion); - app.DebugPrintf("\n\nRead file Header: Offset = %d, Size = %d\n", + Log::info("\n\nRead file Header: Offset = %d, Size = %d\n", headerOffset, headerSize); #endif @@ -236,7 +237,7 @@ void FileHeader::ReadHeader( lastFile = entry; fileTable.push_back(entry); #if defined(_DEBUG_FILE_HEADER) - app.DebugPrintf( + Log::info( "File: %ls, Start = %d, Length = %d, End = %d, Timestamp = " "%lld\n", entry->data.filename, entry->data.startOffset, @@ -268,7 +269,7 @@ void FileHeader::ReadHeader( lastFile = entry; fileTable.push_back(entry); #if defined(_DEBUG_FILE_HEADER) - app.DebugPrintf( + Log::info( "File: %ls, Start = %d, Length = %d, End = %d\n", entry->data.filename, entry->data.startOffset, entry->data.length, @@ -281,7 +282,7 @@ void FileHeader::ReadHeader( } break; default: #if !defined(_CONTENT_PACKAGE) - app.DebugPrintf("********** Invalid save version %d\n", + Log::info("********** Invalid save version %d\n", m_saveVersion); __debugbreak(); #endif diff --git a/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp b/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp index 6ba4a2049..a565ba700 100644 --- a/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp +++ b/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp @@ -1,3 +1,5 @@ +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "DirectoryLevelStorage.h" #include @@ -12,8 +14,8 @@ #include "IPlatformInput.h" #include "LevelData.h" -#include "app/common/src/Console_Debug_enum.h" -#include "app/common/src/GameRules/GameRuleManager.h" +#include "app/common/Console_Debug_enum.h" +#include "app/common/GameRules/GameRuleManager.h" #include "app/linux/LinuxGame.h" #include "app/linux/Stubs/winapi_stubs.h" #include "util/StringHelpers.h" @@ -131,7 +133,7 @@ void DirectoryLevelStorage::PlayerMappings::addMapping(int id, int centreX, (((int64_t)(centreX & 0x1FFFFFFF)) << 5) | ((scale & 0x7) << 2) | (dimension & 0x3); m_mappings[index] = id; - // app.DebugPrintf("Adding mapping: %d - (%d,%d)/%d/%d [%I64d - + // Log::info("Adding mapping: %d - (%d,%d)/%d/%d [%I64d - // 0x%016llx]\n", id, centreX, centreZ, dimension, scale, index, index); } @@ -143,7 +145,7 @@ bool DirectoryLevelStorage::PlayerMappings::getMapping(int& id, int centreX, // int64_t xMasked = centreX & 0x1FFFFFFF; // int64_t zShifted = zMasked << 34; // int64_t xShifted = xMasked << 5; - // app.DebugPrintf("xShifted = %d (0x%016x), zShifted = %I64d + // Log::info("xShifted = %d (0x%016x), zShifted = %I64d // (0x%016llx)\n", xShifted, xShifted, zShifted, zShifted); int64_t index = (((int64_t)(centreZ & 0x1FFFFFFF)) << 34) | (((int64_t)(centreX & 0x1FFFFFFF)) << 5) | @@ -151,11 +153,11 @@ bool DirectoryLevelStorage::PlayerMappings::getMapping(int& id, int centreX, auto it = m_mappings.find(index); if (it != m_mappings.end()) { id = it->second; - // app.DebugPrintf("Found mapping: %d - (%d,%d)/%d/%d [%I64d - + // Log::info("Found mapping: %d - (%d,%d)/%d/%d [%I64d - // 0x%016llx]\n", id, centreX, centreZ, dimension, scale, index, index); return true; } else { - // app.DebugPrintf("Failed to find mapping: (%d,%d)/%d/%d [%I64d - + // Log::info("Failed to find mapping: (%d,%d)/%d/%d [%I64d - // 0x%016llx]\n", centreX, centreZ, dimension, scale, index, index); return false; } @@ -165,7 +167,7 @@ void DirectoryLevelStorage::PlayerMappings::writeMappings( DataOutputStream* dos) { dos->writeInt(m_mappings.size()); for (auto it = m_mappings.begin(); it != m_mappings.end(); ++it) { - app.DebugPrintf(" -- %lld (0x%016llx) = %d\n", it->first, it->first, + Log::info(" -- %lld (0x%016llx) = %d\n", it->first, it->first, it->second); dos->writeLong(it->first); dos->writeInt(it->second); @@ -178,7 +180,7 @@ void DirectoryLevelStorage::PlayerMappings::readMappings(DataInputStream* dis) { int64_t index = dis->readLong(); int id = dis->readInt(); m_mappings[index] = id; - app.DebugPrintf(" -- %lld (0x%016llx) = %d\n", index, index, id); + Log::info(" -- %lld (0x%016llx) = %d\n", index, index, id); } } #endif @@ -275,16 +277,16 @@ LevelData* DirectoryLevelStorage::prepareLevel() { ByteArrayInputStream bais(data); DataInputStream dis(&bais); int count = dis.readInt(); - app.DebugPrintf("Loading %d mappings\n", count); + Log::info("Loading %d mappings\n", count); for (unsigned int i = 0; i < count; ++i) { PlayerUID playerUid = dis.readPlayerUID(); #if defined(_WINDOWS64) || defined(__linux__) - app.DebugPrintf(" -- %d\n", playerUid); + Log::info(" -- %d\n", playerUid); #else #if defined(__linux__) - app.DebugPrintf(" -- %d\n", playerUid); + Log::info(" -- %d\n", playerUid); #else - app.DebugPrintf(" -- %ls\n", playerUid.toWString().c_str()); + Log::info(" -- %ls\n", playerUid.toWString().c_str()); #endif #endif m_playerMappings[playerUid].readMappings(&dis); @@ -402,7 +404,7 @@ void DirectoryLevelStorage::save(std::shared_ptr player) { delete it->second; } m_cachedSaveData[realFile.getName()] = bos; - app.DebugPrintf( + Log::info( "Cached saving of file %ls due to saves being disabled\n", realFile.getName().c_str()); } else { @@ -412,7 +414,7 @@ void DirectoryLevelStorage::save(std::shared_ptr player) { } delete tag; } else if (playerXuid != INVALID_XUID) { - app.DebugPrintf("Not saving player as their XUID is a guest\n"); + Log::info("Not saving player as their XUID is a guest\n"); dontSaveMapMappingForPlayer(playerXuid); } } @@ -436,7 +438,7 @@ CompoundTag* DirectoryLevelStorage::loadPlayerDataTag(PlayerUID xuid) { ByteArrayInputStream bis(bos->buf, 0, bos->size()); CompoundTag* tag = NbtIo::readCompressed(&bis); bis.reset(); - app.DebugPrintf("Loaded player data from cached file %ls\n", + Log::info("Loaded player data from cached file %ls\n", realFile.getName().c_str()); return tag; } else if (m_saveFile->doesFileExist(realFile)) { @@ -456,8 +458,8 @@ void DirectoryLevelStorage::clearOldPlayerFiles() { if (playerFiles != nullptr) { #if !defined(_FINAL_BUILD) - if (app.DebugSettingsOn() && - app.GetGameSettingsDebugMask(PlatformInput.GetPrimaryPad()) & + if (gameServices().debugSettingsOn() && + gameServices().debugGetMask(PlatformInput.GetPrimaryPad()) & (1L << eDebugSetting_DistributableSave)) { for (unsigned int i = 0; i < playerFiles->size(); ++i) { FileEntry* file = playerFiles->at(i); @@ -502,8 +504,8 @@ std::wstring DirectoryLevelStorage::getLevelId() { return levelId; } void DirectoryLevelStorage::flushSaveFile(bool autosave) { #if !defined(_CONTENT_PACKAGE) - if (app.DebugSettingsOn() && - app.GetGameSettingsDebugMask(PlatformInput.GetPrimaryPad()) & + if (gameServices().debugSettingsOn() && + gameServices().debugGetMask(PlatformInput.GetPrimaryPad()) & (1L << eDebugSetting_DistributableSave)) { // Delete gamerules files if it exists ConsoleSavePath gameRulesFiles(GAME_RULE_SAVENAME); @@ -518,7 +520,7 @@ void DirectoryLevelStorage::flushSaveFile(bool autosave) { // 4J Added void DirectoryLevelStorage::resetNetherPlayerPositions() { - if (app.GetResetNether()) { + if (gameServices().getResetNether()) { std::vector* playerFiles = m_saveFile->getFilesWithPrefix(playerDir.getName()); @@ -635,16 +637,16 @@ void DirectoryLevelStorage::saveMapIdLookup() { ByteArrayOutputStream baos; DataOutputStream dos(&baos); dos.writeInt(m_playerMappings.size()); - app.DebugPrintf("Saving %d mappings\n", m_playerMappings.size()); + Log::info("Saving %d mappings\n", m_playerMappings.size()); for (auto it = m_playerMappings.begin(); it != m_playerMappings.end(); ++it) { #if defined(_WINDOWS64) || defined(__linux__) - app.DebugPrintf(" -- %d\n", it->first); + Log::info(" -- %d\n", it->first); #else #if defined(__linux__) - app.DebugPrintf(" -- %d\n", it->first); + Log::info(" -- %d\n", it->first); #else - app.DebugPrintf(" -- %ls\n", it->first.toWString().c_str()); + Log::info(" -- %ls\n", it->first.toWString().c_str()); #endif #endif dos.writePlayerUID(it->first); @@ -756,7 +758,7 @@ void DirectoryLevelStorage::saveAllCachedData() { ConsoleSaveFileOutputStream fos = ConsoleSaveFileOutputStream(m_saveFile, realFile); - app.DebugPrintf("Actually writing cached file %ls\n", + Log::info("Actually writing cached file %ls\n", it->first.c_str()); fos.write(bos->buf, 0, bos->size()); delete bos; diff --git a/targets/minecraft/world/level/storage/LevelData.cpp b/targets/minecraft/world/level/storage/LevelData.cpp index 83893ee61..c416a7f37 100644 --- a/targets/minecraft/world/level/storage/LevelData.cpp +++ b/targets/minecraft/world/level/storage/LevelData.cpp @@ -1,3 +1,4 @@ +#include "minecraft/IGameServices.h" #include "LevelData.h" #include @@ -6,7 +7,7 @@ #include #include "app/common/App_Defines.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/linux/LinuxGame.h" #include "java/System.h" #include "minecraft/world/level/GameRules.h" @@ -123,12 +124,12 @@ LevelData::LevelData(CompoundTag* tag) { m_smallEdgeMoat = tag->getInt(L"SmallMoat"); m_mediumEdgeMoat = tag->getInt(L"MediumMoat"); - int newWorldSize = app.GetGameNewWorldSize(); - int newHellScale = app.GetGameNewHellScale(); + int newWorldSize = gameServices().getGameNewWorldSize(); + int newHellScale = gameServices().getGameNewHellScale(); m_hellScaleOld = m_hellScale; m_xzSizeOld = m_xzSize; if (newWorldSize > m_xzSize) { - bool bUseMoat = app.GetGameNewWorldSizeUseMoat(); + bool bUseMoat = gameServices().getGameNewWorldSizeUseMoat(); switch (m_xzSize) { case LEVEL_WIDTH_CLASSIC: m_classicEdgeMoat = bUseMoat; @@ -182,7 +183,7 @@ LevelData::LevelData(CompoundTag* tag) { assert(0); break; } - app.SetGameHostOption(eGameHostOption_WorldSize, hostOptionworldSize); + gameServices().setGameHostOption(eGameHostOption_WorldSize, hostOptionworldSize); #endif /* 4J - we don't store this anymore @@ -516,7 +517,7 @@ void LevelData::setGameType(GameType* gameType) { // 4J Added hasBeenInCreative = hasBeenInCreative || (gameType == GameType::CREATIVE) || - (app.GetGameHostOption(eGameHostOption_CheatsEnabled) > 0); + (gameServices().getGameHostOption(eGameHostOption_CheatsEnabled) > 0); } bool LevelData::useNewSeaLevel() { return newSeaLevel; } diff --git a/targets/minecraft/world/level/storage/McRegionLevelStorage.cpp b/targets/minecraft/world/level/storage/McRegionLevelStorage.cpp index 07ec7b43c..e03642af4 100644 --- a/targets/minecraft/world/level/storage/McRegionLevelStorage.cpp +++ b/targets/minecraft/world/level/storage/McRegionLevelStorage.cpp @@ -1,3 +1,5 @@ +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "McRegionLevelStorage.h" #include @@ -36,7 +38,7 @@ ChunkStorage* McRegionLevelStorage::createChunkStorage(Dimension* dimension) { // File folder = getFolder(); if (dynamic_cast(dimension) != nullptr) { - if (app.GetResetNether()) { + if (gameServices().getResetNether()) { #ifdef SPLIT_SAVES std::vector* netherFiles = m_saveFile->getRegionFilesByDimension(1); @@ -79,7 +81,7 @@ ChunkStorage* McRegionLevelStorage::createChunkStorage(Dimension* dimension) { // For versions before TU9 (TU7 and 8) we generate a part of The // End, but we want to scrap it if it exists so that it is replaced // with the TU9+ version - app.DebugPrintf( + Log::info( "Loaded save version number is: %d, required to keep The End " "is: %d\n", m_saveFile->getSaveVersion(), SAVE_FILE_VERSION_NEW_END); diff --git a/targets/minecraft/world/level/tile/FireTile.cpp b/targets/minecraft/world/level/tile/FireTile.cpp index 29be2d805..d7f43dcc8 100644 --- a/targets/minecraft/world/level/tile/FireTile.cpp +++ b/targets/minecraft/world/level/tile/FireTile.cpp @@ -1,10 +1,11 @@ +#include "minecraft/IGameServices.h" #include "FireTile.h" #include #include -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/core/particles/ParticleTypes.h" @@ -161,7 +162,7 @@ void FireTile::tick(Level* level, int x, int y, int z, Random* random) { checkBurnOut(level, x, y + 1, z, 250 + extra, random, age); checkBurnOut(level, x, y, z - 1, 300 + extra, random, age); checkBurnOut(level, x, y, z + 1, 300 + extra, random, age); - if (app.GetGameHostOption(eGameHostOption_FireSpreads)) { + if (gameServices().getGameHostOption(eGameHostOption_FireSpreads)) { for (int xx = x - 1; xx <= x + 1; xx++) { for (int zz = z - 1; zz <= z + 1; zz++) { for (int yy = y - 1; yy <= y + 4; yy++) { @@ -207,7 +208,7 @@ void FireTile::checkBurnOut(Level* level, int x, int y, int z, int chance, if (random->nextInt(chance) < odds) { bool wasTnt = level->getTile(x, y, z) == Tile::tnt_Id; if (random->nextInt(age + 10) < 5 && !level->isRainingAt(x, y, z) && - app.GetGameHostOption(eGameHostOption_FireSpreads)) { + gameServices().getGameHostOption(eGameHostOption_FireSpreads)) { int tAge = age + random->nextInt(5) / 4; if (tAge > 15) tAge = 15; level->setTileAndData(x, y, z, id, tAge, Tile::UPDATE_ALL); diff --git a/targets/minecraft/world/level/tile/GrassTile.cpp b/targets/minecraft/world/level/tile/GrassTile.cpp index 8e90949ce..9c059ac8d 100644 --- a/targets/minecraft/world/level/tile/GrassTile.cpp +++ b/targets/minecraft/world/level/tile/GrassTile.cpp @@ -2,8 +2,8 @@ #include -#include "app/common/App_enums.h" -#include "app/common/src/Colours/ColourTable.h" +#include "minecraft/GameEnums.h" +#include "app/common/Colours/ColourTable.h" #include "java/Random.h" #include "minecraft/Facing.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/minecraft/world/level/tile/LeafTile.cpp b/targets/minecraft/world/level/tile/LeafTile.cpp index b7fc672cd..a72d1b6a4 100644 --- a/targets/minecraft/world/level/tile/LeafTile.cpp +++ b/targets/minecraft/world/level/tile/LeafTile.cpp @@ -2,8 +2,8 @@ #include -#include "app/common/App_enums.h" -#include "app/common/src/Colours/ColourTable.h" +#include "minecraft/GameEnums.h" +#include "app/common/Colours/ColourTable.h" #include "java/Random.h" #include "minecraft/client/Minecraft.h" #include "minecraft/core/particles/ParticleTypes.h" diff --git a/targets/minecraft/world/level/tile/NotGateTile.cpp b/targets/minecraft/world/level/tile/NotGateTile.cpp index 0d76cd7b1..f813da13e 100644 --- a/targets/minecraft/world/level/tile/NotGateTile.cpp +++ b/targets/minecraft/world/level/tile/NotGateTile.cpp @@ -1,3 +1,4 @@ +#include "minecraft/util/Log.h" #include "NotGateTile.h" #include "app/linux/LinuxGame.h" @@ -122,7 +123,7 @@ void NotGateTile::tick(Level* level, int x, int y, int z, Random* random) { level->getData(x, y, z), Tile::UPDATE_ALL); if (isToggledTooFrequently(level, x, y, z, true)) { - app.DebugPrintf( + Log::info( "Torch at (%d,%d,%d) has toggled too many times\n", x, y, z); @@ -148,7 +149,7 @@ void NotGateTile::tick(Level* level, int x, int y, int z, Random* random) { level->getData(x, y, z), Tile::UPDATE_ALL); } else { - app.DebugPrintf( + Log::info( "Torch at (%d,%d,%d) has toggled too many times\n", x, y, z); } diff --git a/targets/minecraft/world/level/tile/NoteBlockTile.cpp b/targets/minecraft/world/level/tile/NoteBlockTile.cpp index dcc937b22..d51fca491 100644 --- a/targets/minecraft/world/level/tile/NoteBlockTile.cpp +++ b/targets/minecraft/world/level/tile/NoteBlockTile.cpp @@ -1,3 +1,4 @@ +#include "minecraft/util/Log.h" #include "NoteBlockTile.h" #include @@ -15,12 +16,12 @@ NoteBlockTile::NoteBlockTile(int id) : BaseEntityTile(id, Material::wood) {} void NoteBlockTile::neighborChanged(Level* level, int x, int y, int z, int type) { - app.DebugPrintf("-------- Neighbour changed type %d\n", type); + Log::info("-------- Neighbour changed type %d\n", type); bool signal = level->hasNeighborSignal(x, y, z); std::shared_ptr mte = std::dynamic_pointer_cast( level->getTileEntity(x, y, z)); - app.DebugPrintf("-------- Signal is %s, tile is currently %s\n", + Log::info("-------- Signal is %s, tile is currently %s\n", signal ? "true" : "false", mte->on ? "ON" : "OFF"); if (mte != nullptr && mte->on != signal) { if (signal) { @@ -85,7 +86,7 @@ bool NoteBlockTile::triggerEvent(Level* level, int x, int y, int z, int i, iSound = eSoundType_NOTE_HARP; break; } - app.DebugPrintf("NoteBlockTile::triggerEvent - playSound - pitch = %f\n", + Log::info("NoteBlockTile::triggerEvent - playSound - pitch = %f\n", pitch); level->playSound(x + 0.5, y + 0.5, z + 0.5, iSound, 3, pitch); level->addParticle(eParticleType_note, x + 0.5, y + 1.2, z + 0.5, diff --git a/targets/minecraft/world/level/tile/RedStoneDustTile.cpp b/targets/minecraft/world/level/tile/RedStoneDustTile.cpp index fe188b611..b86cb2a52 100644 --- a/targets/minecraft/world/level/tile/RedStoneDustTile.cpp +++ b/targets/minecraft/world/level/tile/RedStoneDustTile.cpp @@ -6,8 +6,8 @@ #include #include "DiodeTile.h" -#include "app/common/App_enums.h" -#include "app/common/src/Colours/ColourTable.h" +#include "minecraft/GameEnums.h" +#include "app/common/Colours/ColourTable.h" #include "java/Random.h" #include "minecraft/Direction.h" #include "minecraft/Facing.h" diff --git a/targets/minecraft/world/level/tile/StemTile.cpp b/targets/minecraft/world/level/tile/StemTile.cpp index 7b50a4f1c..bd269ffbb 100644 --- a/targets/minecraft/world/level/tile/StemTile.cpp +++ b/targets/minecraft/world/level/tile/StemTile.cpp @@ -2,8 +2,8 @@ #include -#include "app/common/App_enums.h" -#include "app/common/src/Colours/ColourTable.h" +#include "minecraft/GameEnums.h" +#include "app/common/Colours/ColourTable.h" #include "java/Random.h" #include "minecraft/client/Minecraft.h" #include "minecraft/world/IconRegister.h" diff --git a/targets/minecraft/world/level/tile/StoneMonsterTile.cpp b/targets/minecraft/world/level/tile/StoneMonsterTile.cpp index 6fc9a8d2e..63e367005 100644 --- a/targets/minecraft/world/level/tile/StoneMonsterTile.cpp +++ b/targets/minecraft/world/level/tile/StoneMonsterTile.cpp @@ -1,3 +1,4 @@ +#include "minecraft/IGameServices.h" #include "StoneMonsterTile.h" #include @@ -25,7 +26,7 @@ StoneMonsterTile::StoneMonsterTile(int id) : Tile(id, Material::clay) { Icon* StoneMonsterTile::getTexture(int face, int data) { #ifndef _CONTENT_PACKAGE - if (app.DebugArtToolsOn()) { + if (gameServices().debugArtToolsOn()) { return Tile::fire->getTexture(face, 0); } #endif diff --git a/targets/minecraft/world/level/tile/TallGrassPlantTile.cpp b/targets/minecraft/world/level/tile/TallGrassPlantTile.cpp index 4e65b1ae8..48cad4309 100644 --- a/targets/minecraft/world/level/tile/TallGrassPlantTile.cpp +++ b/targets/minecraft/world/level/tile/TallGrassPlantTile.cpp @@ -2,8 +2,8 @@ #include -#include "app/common/App_enums.h" -#include "app/common/src/Colours/ColourTable.h" +#include "minecraft/GameEnums.h" +#include "app/common/Colours/ColourTable.h" #include "java/Random.h" #include "minecraft/client/Minecraft.h" #include "minecraft/stats/GenericStats.h" diff --git a/targets/minecraft/world/level/tile/Tile.cpp b/targets/minecraft/world/level/tile/Tile.cpp index 7e2766700..b4cc3c2c8 100644 --- a/targets/minecraft/world/level/tile/Tile.cpp +++ b/targets/minecraft/world/level/tile/Tile.cpp @@ -1,3 +1,4 @@ +#include "minecraft/util/Log.h" #include "Tile.h" #include @@ -2672,7 +2673,7 @@ Tile::SoundType::SoundType(eMATERIALSOUND_TYPE eMaterialSound, float volume, this->iBreakSound = eSoundType_DIG_WOOD; break; default: - app.DebugPrintf("NO BREAK SOUND!\n"); + Log::info("NO BREAK SOUND!\n"); this->iBreakSound = -1; break; } @@ -2714,7 +2715,7 @@ Tile::SoundType::SoundType(eMATERIALSOUND_TYPE eMaterialSound, float volume, this->iStepSound = eSoundType_STEP_LADDER; break; default: - app.DebugPrintf("NO STEP SOUND!\n"); + Log::info("NO STEP SOUND!\n"); this->iStepSound = -1; break; diff --git a/targets/minecraft/world/level/tile/TntTile.cpp b/targets/minecraft/world/level/tile/TntTile.cpp index e3bfbf899..f0002b1f0 100644 --- a/targets/minecraft/world/level/tile/TntTile.cpp +++ b/targets/minecraft/world/level/tile/TntTile.cpp @@ -1,8 +1,9 @@ +#include "minecraft/IGameServices.h" #include "TntTile.h" #include -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/linux/LinuxGame.h" #include "java/Class.h" #include "java/Random.h" @@ -35,7 +36,7 @@ Icon* TntTile::getTexture(int face, int data) { void TntTile::onPlace(Level* level, int x, int y, int z) { Tile::onPlace(level, x, y, z); if (level->hasNeighborSignal(x, y, z) && - app.GetGameHostOption(eGameHostOption_TNT)) { + gameServices().getGameHostOption(eGameHostOption_TNT)) { destroy(level, x, y, z, EXPLODE_BIT); level->removeTile(x, y, z); } @@ -43,7 +44,7 @@ void TntTile::onPlace(Level* level, int x, int y, int z) { void TntTile::neighborChanged(Level* level, int x, int y, int z, int type) { if (level->hasNeighborSignal(x, y, z) && - app.GetGameHostOption(eGameHostOption_TNT)) { + gameServices().getGameHostOption(eGameHostOption_TNT)) { destroy(level, x, y, z, EXPLODE_BIT); level->removeTile(x, y, z); } @@ -63,7 +64,7 @@ void TntTile::wasExploded(Level* level, int x, int y, int z, // TNT blocks are triggered by explosions even though "TNT explodes" option // is unchecked. if (level->newPrimedTntAllowed() && - app.GetGameHostOption(eGameHostOption_TNT)) { + gameServices().getGameHostOption(eGameHostOption_TNT)) { std::shared_ptr primed = std::shared_ptr( new PrimedTnt(level, x + 0.5f, y + 0.5f, z + 0.5f, explosion->getSourceMob())); @@ -84,7 +85,7 @@ void TntTile::destroy(Level* level, int x, int y, int z, int data, if ((data & EXPLODE_BIT) == 1) { // 4J - added condition to have finite limit of these if (level->newPrimedTntAllowed() && - app.GetGameHostOption(eGameHostOption_TNT)) { + gameServices().getGameHostOption(eGameHostOption_TNT)) { std::shared_ptr tnt = std::shared_ptr( new PrimedTnt(level, x + 0.5f, y + 0.5f, z + 0.5f, source)); level->addEntity(tnt); diff --git a/targets/minecraft/world/level/tile/WaterLilyTile.cpp b/targets/minecraft/world/level/tile/WaterLilyTile.cpp index 896b82c5c..ec4dda5da 100644 --- a/targets/minecraft/world/level/tile/WaterLilyTile.cpp +++ b/targets/minecraft/world/level/tile/WaterLilyTile.cpp @@ -3,8 +3,8 @@ #include #include -#include "app/common/App_enums.h" -#include "app/common/src/Colours/ColourTable.h" +#include "minecraft/GameEnums.h" +#include "app/common/Colours/ColourTable.h" #include "java/Class.h" #include "minecraft/client/Minecraft.h" #include "minecraft/world/entity/Entity.h" diff --git a/targets/minecraft/world/level/tile/entity/BeaconTileEntity.cpp b/targets/minecraft/world/level/tile/entity/BeaconTileEntity.cpp index c2c85b71e..e9a6a6701 100644 --- a/targets/minecraft/world/level/tile/entity/BeaconTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/BeaconTileEntity.cpp @@ -1,3 +1,4 @@ +#include "minecraft/IGameServices.h" #include "BeaconTileEntity.h" #include @@ -281,7 +282,7 @@ void BeaconTileEntity::setItem(unsigned int slot, } std::wstring BeaconTileEntity::getName() { - return hasCustomName() ? name : app.GetString(IDS_CONTAINER_BEACON); + return hasCustomName() ? name : gameServices().getString(IDS_CONTAINER_BEACON); } std::wstring BeaconTileEntity::getCustomName() { diff --git a/targets/minecraft/world/level/tile/entity/BrewingStandTileEntity.cpp b/targets/minecraft/world/level/tile/entity/BrewingStandTileEntity.cpp index 85e48f505..7fbeaa2e3 100644 --- a/targets/minecraft/world/level/tile/entity/BrewingStandTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/BrewingStandTileEntity.cpp @@ -1,3 +1,4 @@ +#include "minecraft/IGameServices.h" #include "BrewingStandTileEntity.h" #include @@ -40,7 +41,7 @@ BrewingStandTileEntity::BrewingStandTileEntity() { BrewingStandTileEntity::~BrewingStandTileEntity() {} std::wstring BrewingStandTileEntity::getName() { - return hasCustomName() ? name : app.GetString(IDS_TILE_BREWINGSTAND); + return hasCustomName() ? name : gameServices().getString(IDS_TILE_BREWINGSTAND); } std::wstring BrewingStandTileEntity::getCustomName() { diff --git a/targets/minecraft/world/level/tile/entity/ChestTileEntity.cpp b/targets/minecraft/world/level/tile/entity/ChestTileEntity.cpp index bd03d0e9d..4159c4131 100644 --- a/targets/minecraft/world/level/tile/entity/ChestTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/ChestTileEntity.cpp @@ -1,3 +1,4 @@ +#include "minecraft/IGameServices.h" #include "ChestTileEntity.h" #include @@ -109,7 +110,7 @@ void ChestTileEntity::setItem(unsigned int slot, } std::wstring ChestTileEntity::getName() { - return hasCustomName() ? name : app.GetString(IDS_TILE_CHEST); + return hasCustomName() ? name : gameServices().getString(IDS_TILE_CHEST); } std::wstring ChestTileEntity::getCustomName() { diff --git a/targets/minecraft/world/level/tile/entity/DispenserTileEntity.cpp b/targets/minecraft/world/level/tile/entity/DispenserTileEntity.cpp index 492558328..447debca7 100644 --- a/targets/minecraft/world/level/tile/entity/DispenserTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/DispenserTileEntity.cpp @@ -1,3 +1,4 @@ +#include "minecraft/IGameServices.h" #include "DispenserTileEntity.h" #include @@ -124,7 +125,7 @@ int DispenserTileEntity::addItem(std::shared_ptr item) { } std::wstring DispenserTileEntity::getName() { - return hasCustomName() ? name : app.GetString(IDS_TILE_DISPENSER); + return hasCustomName() ? name : gameServices().getString(IDS_TILE_DISPENSER); } std::wstring DispenserTileEntity::getCustomName() { diff --git a/targets/minecraft/world/level/tile/entity/DropperTileEntity.cpp b/targets/minecraft/world/level/tile/entity/DropperTileEntity.cpp index 7e8a9b991..c673ce788 100644 --- a/targets/minecraft/world/level/tile/entity/DropperTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/DropperTileEntity.cpp @@ -1,3 +1,4 @@ +#include "minecraft/IGameServices.h" #include "DropperTileEntity.h" #include @@ -8,7 +9,7 @@ #include "strings.h" std::wstring DropperTileEntity::getName() { - return hasCustomName() ? name : app.GetString(IDS_CONTAINER_DROPPER); + return hasCustomName() ? name : gameServices().getString(IDS_CONTAINER_DROPPER); } // 4J Added diff --git a/targets/minecraft/world/level/tile/entity/EnchantmentTableTileEntity.cpp b/targets/minecraft/world/level/tile/entity/EnchantmentTableTileEntity.cpp index 11371e655..fe25b339a 100644 --- a/targets/minecraft/world/level/tile/entity/EnchantmentTableTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/EnchantmentTableTileEntity.cpp @@ -1,3 +1,4 @@ +#include "minecraft/IGameServices.h" #include "EnchantmentTableTileEntity.h" #include @@ -93,7 +94,7 @@ void EnchantmentTableEntity::tick() { } std::wstring EnchantmentTableEntity::getName() { - return hasCustomName() ? name : app.GetString(IDS_ENCHANT); + return hasCustomName() ? name : gameServices().getString(IDS_ENCHANT); } std::wstring EnchantmentTableEntity::getCustomName() { diff --git a/targets/minecraft/world/level/tile/entity/FurnaceTileEntity.cpp b/targets/minecraft/world/level/tile/entity/FurnaceTileEntity.cpp index 519cbd231..ba010f8ed 100644 --- a/targets/minecraft/world/level/tile/entity/FurnaceTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/FurnaceTileEntity.cpp @@ -1,3 +1,4 @@ +#include "minecraft/IGameServices.h" #include "FurnaceTileEntity.h" #include @@ -97,7 +98,7 @@ void FurnaceTileEntity::setItem(unsigned int slot, } std::wstring FurnaceTileEntity::getName() { - return hasCustomName() ? name : app.GetString(IDS_TILE_FURNACE); + return hasCustomName() ? name : gameServices().getString(IDS_TILE_FURNACE); } std::wstring FurnaceTileEntity::getCustomName() { diff --git a/targets/minecraft/world/level/tile/entity/HopperTileEntity.cpp b/targets/minecraft/world/level/tile/entity/HopperTileEntity.cpp index 39a184427..c601889e8 100644 --- a/targets/minecraft/world/level/tile/entity/HopperTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/HopperTileEntity.cpp @@ -1,3 +1,4 @@ +#include "minecraft/IGameServices.h" #include "HopperTileEntity.h" #include @@ -109,7 +110,7 @@ void HopperTileEntity::setItem(unsigned int slot, } std::wstring HopperTileEntity::getName() { - return hasCustomName() ? name : app.GetString(IDS_CONTAINER_HOPPER); + return hasCustomName() ? name : gameServices().getString(IDS_CONTAINER_HOPPER); } std::wstring HopperTileEntity::getCustomName() { diff --git a/targets/minecraft/world/level/tile/entity/TheEndPortalTile.cpp b/targets/minecraft/world/level/tile/entity/TheEndPortalTile.cpp index 0e4824612..ce34769cc 100644 --- a/targets/minecraft/world/level/tile/entity/TheEndPortalTile.cpp +++ b/targets/minecraft/world/level/tile/entity/TheEndPortalTile.cpp @@ -2,8 +2,7 @@ #include -#include "app/common/App_enums.h" -#include "app/linux/LinuxGame.h" +#include "minecraft/IGameServices.h" #include "TheEndPortalTileEntity.h" #include "java/Class.h" #include "java/Random.h" @@ -72,7 +71,7 @@ void TheEndPortal::entityInside(Level* level, int x, int y, int z, x = z = 0; if (level->dimension == 0 && !level->getLevelData()->getHasStrongholdEndPortal() && - app.GetTerrainFeaturePosition( + gameServices().getTerrainFeaturePosition( eTerrainFeature_StrongholdEndPortal, &x, &z)) { level->getLevelData()->setXStrongholdEndPortal(x); level->getLevelData()->setZStrongholdEndPortal(z); diff --git a/targets/minecraft/world/level/tile/entity/TileEntity.cpp b/targets/minecraft/world/level/tile/entity/TileEntity.cpp index 908e58d19..6944e7d46 100644 --- a/targets/minecraft/world/level/tile/entity/TileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/TileEntity.cpp @@ -1,3 +1,4 @@ +#include "minecraft/util/Log.h" #include "TileEntity.h" #include @@ -136,7 +137,7 @@ std::shared_ptr TileEntity::loadStatic(CompoundTag* tag) { entity->load(tag); } else { #ifdef _DEBUG - app.DebugPrintf("Skipping TileEntity with id %ls.\n", + Log::info("Skipping TileEntity with id %ls.\n", tag->getString(L"id").c_str()); #endif } diff --git a/targets/platform/IPlatformNetwork.h b/targets/platform/IPlatformNetwork.h index 1dc546e8a..ce5c682b3 100644 --- a/targets/platform/IPlatformNetwork.h +++ b/targets/platform/IPlatformNetwork.h @@ -6,7 +6,7 @@ #include #include "PlatformTypes.h" -#include "app/include/NetTypes.h" +#include "platform/NetTypes.h" #ifndef VER_NETWORK #define VER_NETWORK 560 diff --git a/targets/app/include/NetTypes.h b/targets/platform/NetTypes.h similarity index 100% rename from targets/app/include/NetTypes.h rename to targets/platform/NetTypes.h diff --git a/targets/app/include/XboxStubs.h b/targets/platform/XboxStubs.h similarity index 94% rename from targets/app/include/XboxStubs.h rename to targets/platform/XboxStubs.h index 287f5cf33..e3030b358 100644 --- a/targets/app/include/XboxStubs.h +++ b/targets/platform/XboxStubs.h @@ -5,11 +5,8 @@ #include "platform/PlatformTypes.h" -// XUI forward declarations +// XUI handle type (used by App_structs.h for SceneStackPair) typedef struct _XUIOBJ* HXUIOBJ; -typedef struct _XUICLASS* HXUICLASS; -typedef struct _XUIBRUSH* HXUIBRUSH; -typedef struct _XUIDC* HXUIDC; bool IsEqualXUID(PlayerUID a, PlayerUID b); @@ -50,11 +47,6 @@ bool IsEqualXUID(PlayerUID a, PlayerUID b); #define VK_PAD_RTHUMB_DOWNRIGHT 0x5836 #define VK_PAD_RTHUMB_DOWNLEFT 0x5837 -// D3D stubs -inline constexpr int D3DBLEND_CONSTANTALPHA = 0; -inline constexpr int D3DBLEND_INVCONSTANTALPHA = 0; -inline constexpr int D3DPT_QUADLIST = 0; - // XUI string table class CXuiStringTable { public: @@ -150,6 +142,7 @@ uint32_t XGetLanguage(); uint32_t XGetLocale(); uint32_t XEnableGuestSignin(bool fEnable); +// System notification constants (used by Game.cpp notification handler) inline constexpr int XN_SYS_SIGNINCHANGED = 0; inline constexpr int XN_SYS_INPUTDEVICESCHANGED = 1; inline constexpr int XN_LIVE_CONTENT_INSTALLED = 2; diff --git a/targets/app/include/stubs.h b/targets/platform/stubs.h similarity index 100% rename from targets/app/include/stubs.h rename to targets/platform/stubs.h diff --git a/targets/util/include/util/Definitions.h b/targets/util/Definitions.h similarity index 100% rename from targets/util/include/util/Definitions.h rename to targets/util/Definitions.h diff --git a/targets/app/src/FrameProfiler.cpp b/targets/util/FrameProfiler.cpp similarity index 100% rename from targets/app/src/FrameProfiler.cpp rename to targets/util/FrameProfiler.cpp diff --git a/targets/app/include/FrameProfiler.h b/targets/util/FrameProfiler.h similarity index 100% rename from targets/app/include/FrameProfiler.h rename to targets/util/FrameProfiler.h diff --git a/targets/util/src/StringHelpers.cpp b/targets/util/StringHelpers.cpp similarity index 100% rename from targets/util/src/StringHelpers.cpp rename to targets/util/StringHelpers.cpp diff --git a/targets/util/include/util/StringHelpers.h b/targets/util/StringHelpers.h similarity index 100% rename from targets/util/include/util/StringHelpers.h rename to targets/util/StringHelpers.h diff --git a/targets/util/include/util/Timer.h b/targets/util/Timer.h similarity index 100% rename from targets/util/include/util/Timer.h rename to targets/util/Timer.h diff --git a/targets/util/meson.build b/targets/util/meson.build index 8f33dc703..dab85918c 100644 --- a/targets/util/meson.build +++ b/targets/util/meson.build @@ -4,13 +4,13 @@ simdutf_dep = dependency('simdutf', ) lib_util = static_library('util', - files('src/StringHelpers.cpp'), + files('StringHelpers.cpp', 'FrameProfiler.cpp'), dependencies: [simdutf_dep], - include_directories : include_directories('include', '..'), + include_directories : include_directories('.', '..'), cpp_args : global_cpp_args + global_cpp_defs, ) util_dep = declare_dependency( link_with : lib_util, - include_directories : include_directories('include'), + include_directories : include_directories('.'), )