From 5d9bcac156b8430c5aaedd21bfd5fcec110ef4d3 Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Mon, 6 Apr 2026 16:14:25 +1000 Subject: [PATCH] refactor: decouple minecraft/ from app/ via IGameServices virtual interface --- targets/app/common/AppGameServices.cpp | 463 +++++++++++++ targets/app/common/AppGameServices.h | 185 +++++ targets/app/common/App_structs.h | 16 +- targets/app/common/Colours/ColourTable.cpp | 2 +- targets/app/common/Colours/ColourTable.h | 2 +- targets/app/common/DLC/DLCSkinFile.cpp | 2 +- targets/app/common/DLC/DLCSkinFile.h | 2 +- targets/app/common/Game.cpp | 10 +- targets/app/common/Game.h | 2 +- .../LevelGenerationOptions.cpp | 2 +- targets/app/common/GameSettingsManager.cpp | 2 +- targets/app/common/Game_XuiActions.cpp | 4 +- targets/app/common/IPlatformGame.h | 2 +- targets/app/common/LocalizationManager.cpp | 2 +- targets/app/common/LocalizationManager.h | 2 +- .../app/common/Network/GameNetworkManager.cpp | 2 +- .../Network/PlatformNetworkManagerInterface.h | 2 +- .../Network/PlatformNetworkManagerStub.h | 2 +- targets/app/common/SkinManager.h | 2 +- targets/app/common/TerrainFeatureManager.h | 2 +- .../common/Tutorial/Tasks/ControllerTask.cpp | 2 +- targets/app/common/Tutorial/Tutorial.cpp | 2 +- .../IUIScene_AbstractContainerMenu.cpp | 2 +- .../UI/All Platforms/IUIScene_BeaconMenu.cpp | 2 +- .../All Platforms/IUIScene_CraftingMenu.cpp | 2 +- .../common/UI/All Platforms/IUIScene_HUD.cpp | 2 +- .../UI/All Platforms/IUIScene_PauseMenu.cpp | 2 +- .../UI/Components/UIComponent_Tooltips.cpp | 2 +- .../UI/Components/UIComponent_Tooltips.h | 2 +- .../Components/UIComponent_TutorialPopup.cpp | 2 +- .../app/common/UI/Components/UIScene_HUD.cpp | 2 +- .../Controls/UIControl_EnchantmentButton.cpp | 2 +- .../Controls/UIControl_PlayerSkinPreview.cpp | 2 +- .../Debug/UIScene_DebugCreateSchematic.cpp | 2 +- .../UI/Scenes/Debug/UIScene_DebugOverlay.cpp | 2 +- .../Scenes/Debug/UIScene_DebugSetCamera.cpp | 2 +- .../UIScene_CreateWorldMenu.cpp | 2 +- .../UIScene_DLCMainMenu.cpp | 2 +- .../Frontend Menu screens/UIScene_EULA.cpp | 2 +- .../UIScene_JoinMenu.cpp | 2 +- .../UIScene_LaunchMoreOptionsMenu.cpp | 2 +- .../UIScene_LoadMenu.cpp | 2 +- .../UIScene_LoadOrJoinMenu.cpp | 2 +- .../UIScene_MainMenu.cpp | 2 +- .../UIScene_NewUpdateMessage.cpp | 2 +- .../Help & Options/UIScene_ControlsMenu.cpp | 2 +- .../Help & Options/UIScene_HowToPlay.cpp | 2 +- .../Help & Options/UIScene_LanguageSelector.h | 2 +- .../UIScene_SettingsAudioMenu.cpp | 2 +- .../UIScene_SettingsControlMenu.cpp | 2 +- .../UIScene_SettingsGraphicsMenu.cpp | 2 +- .../UIScene_SettingsOptionsMenu.cpp | 2 +- .../Help & Options/UIScene_SettingsUIMenu.cpp | 2 +- .../Help & Options/UIScene_SkinSelectMenu.cpp | 2 +- .../Help & Options/UIScene_SkinSelectMenu.h | 2 +- .../UIScene_DeathMenu.cpp | 2 +- .../In-Game Menu Screens/UIScene_EndPoem.cpp | 2 +- .../UIScene_InGameHostOptionsMenu.cpp | 2 +- .../UIScene_InGameInfoMenu.cpp | 2 +- .../UIScene_InGamePlayerOptionsMenu.cpp | 2 +- .../UIScene_PauseMenu.cpp | 2 +- .../UI/Scenes/UIScene_ConnectingProgress.cpp | 2 +- .../UI/Scenes/UIScene_FullscreenProgress.cpp | 2 +- targets/app/common/UI/UIController.cpp | 2 +- targets/app/linux/LinuxGame.cpp | 2 +- targets/app/linux/LinuxGame.h | 2 +- targets/app/linux/Linux_Minecraft.cpp | 152 +--- .../App_enums.h => minecraft/GameEnums.h} | 0 targets/minecraft/GameHostOptions.cpp | 18 - targets/minecraft/GameHostOptions.h | 10 +- targets/minecraft/GameServices.cpp | 654 ------------------ targets/minecraft/GameServices.h | 305 -------- targets/minecraft/GameTypes.h | 20 + targets/minecraft/IGameServices.cpp | 15 + targets/minecraft/IGameServices.h | 235 +++++++ targets/minecraft/client/BufferedImage.cpp | 12 +- targets/minecraft/client/Minecraft.cpp | 102 ++- .../client/gui/CreateWorldScreen.cpp | 41 +- targets/minecraft/client/gui/Gui.cpp | 33 +- targets/minecraft/client/gui/Minimap.cpp | 2 +- targets/minecraft/client/gui/PauseScreen.cpp | 10 +- targets/minecraft/client/gui/Screen.cpp | 6 +- .../gui/inventory/AbstractContainerScreen.cpp | 4 +- .../gui/inventory/BeaconPowerButton.cpp | 4 +- .../gui/inventory/CreativeInventoryScreen.cpp | 6 +- .../minecraft/client/model/HumanoidModel.h | 2 +- .../minecraft/client/{ => model}/SkinBox.h | 0 targets/minecraft/client/model/geom/Model.h | 2 +- .../minecraft/client/model/geom/ModelPart.h | 2 +- .../client/multiplayer/ClientConnection.cpp | 363 +++++----- .../multiplayer/MultiPlayerGameMode.cpp | 6 +- .../client/multiplayer/MultiPlayerLevel.cpp | 6 +- .../multiplayer/MultiPlayerLocalPlayer.cpp | 10 +- .../client/particle/DragonBreathParticle.cpp | 2 +- .../client/particle/DripParticle.cpp | 2 +- .../particle/EnchantmentTableParticle.cpp | 2 +- .../client/particle/EnderParticle.cpp | 2 +- .../client/particle/ExplodeParticle.cpp | 2 +- .../client/particle/HugeExplosionParticle.cpp | 2 +- .../client/particle/NetherPortalParticle.cpp | 2 +- .../client/particle/NoteParticle.cpp | 2 +- .../client/particle/SmokeParticle.cpp | 2 +- .../client/particle/SuspendedParticle.cpp | 2 +- targets/minecraft/client/player/Input.cpp | 17 +- .../minecraft/client/player/LocalPlayer.cpp | 58 +- .../client/renderer/GameRenderer.cpp | 12 +- .../client/renderer/ItemInHandRenderer.cpp | 8 +- .../client/renderer/LevelRenderer.cpp | 29 +- .../minecraft/client/renderer/LevelRenderer.h | 2 +- .../minecraft/client/renderer/Textures.cpp | 8 +- .../client/renderer/TileRenderer.cpp | 2 +- .../renderer/entity/LivingEntityRenderer.cpp | 17 +- .../client/renderer/entity/MobRenderer.cpp | 2 +- .../client/renderer/entity/PlayerRenderer.cpp | 9 +- .../client/renderer/entity/PlayerRenderer.h | 2 +- .../renderer/tileentity/SignRenderer.cpp | 8 +- .../client/skins/AbstractTexturePack.cpp | 8 +- .../minecraft/client/skins/DLCTexturePack.cpp | 42 +- .../client/skins/DefaultTexturePack.cpp | 6 +- .../client/skins/DefaultTexturePack.h | 4 +- targets/minecraft/client/skins/TexturePack.h | 2 +- .../client/skins/TexturePackRepository.cpp | 10 +- .../minecraft/client/title/TitleScreen.cpp | 6 +- .../minecraft/core/ItemDispenseBehaviors.cpp | 6 +- targets/minecraft/locale/Strings.cpp | 16 - targets/minecraft/locale/Strings.h | 12 - .../network/packet/PreLoginPacket.cpp | 4 +- .../network/packet/TextureAndGeometryPacket.h | 2 +- targets/minecraft/server/MinecraftServer.cpp | 96 ++- targets/minecraft/server/PlayerList.cpp | 31 +- .../server/level/ServerChunkCache.cpp | 4 +- .../minecraft/server/level/ServerLevel.cpp | 8 +- .../minecraft/server/level/ServerPlayer.cpp | 24 +- .../server/level/ServerPlayerGameMode.cpp | 4 +- .../server/network/PendingConnection.cpp | 6 +- .../server/network/PlayerConnection.cpp | 83 ++- .../server/network/ServerConnection.cpp | 4 +- targets/minecraft/stats/Stat.h | 4 +- targets/minecraft/util/DebugSettings.cpp | 33 - targets/minecraft/util/DebugSettings.h | 20 - targets/minecraft/util/HtmlString.cpp | 4 +- targets/minecraft/util/HtmlString.h | 2 +- targets/minecraft/world/CompoundContainer.cpp | 4 +- targets/minecraft/world/SimpleContainer.cpp | 4 +- .../world/effect/AbsoptionMobEffect.h | 2 +- .../world/effect/AttackDamageMobEffect.h | 2 +- .../world/effect/HealthBoostMobEffect.h | 2 +- .../world/effect/InstantaneousMobEffect.cpp | 2 +- .../world/effect/InstantaneousMobEffect.h | 2 +- targets/minecraft/world/effect/MobEffect.cpp | 2 +- targets/minecraft/world/effect/MobEffect.h | 2 +- targets/minecraft/world/entity/Entity.cpp | 6 +- targets/minecraft/world/entity/EntityIO.h | 2 +- targets/minecraft/world/entity/Painting.cpp | 4 +- .../ai/attributes/AttributeModifier.cpp | 6 +- .../minecraft/world/entity/animal/Ocelot.cpp | 4 +- .../entity/boss/enderdragon/EnderDragon.h | 4 +- .../world/entity/boss/wither/WitherBoss.h | 4 +- .../world/entity/item/MinecartContainer.cpp | 4 +- .../world/entity/monster/EnderMan.cpp | 4 +- .../world/entity/monster/Monster.cpp | 4 +- .../world/entity/monster/PigZombie.cpp | 4 +- .../world/entity/monster/Silverfish.cpp | 4 +- .../minecraft/world/entity/monster/Spider.cpp | 4 +- .../minecraft/world/entity/npc/Villager.cpp | 4 +- .../world/entity/player/Inventory.cpp | 4 +- .../minecraft/world/entity/player/Player.cpp | 71 +- targets/minecraft/world/item/ArmorItem.h | 2 +- .../world/item/FireworksChargeItem.cpp | 20 +- .../minecraft/world/item/FireworksItem.cpp | 4 +- .../world/item/HangingEntityItem.cpp | 8 +- targets/minecraft/world/item/Item.cpp | 8 +- .../minecraft/world/item/PlanterTileItem.cpp | 6 +- targets/minecraft/world/item/PotionItem.cpp | 26 +- targets/minecraft/world/item/Rarity.h | 2 +- .../minecraft/world/item/RecordingItem.cpp | 2 +- targets/minecraft/world/item/SpawnEggItem.cpp | 9 +- targets/minecraft/world/item/TileItem.cpp | 6 +- .../world/item/alchemy/PotionBrewing.cpp | 2 +- .../world/item/enchantment/Enchantment.cpp | 11 +- .../minecraft/world/level/FoliageColor.cpp | 2 +- targets/minecraft/world/level/GameRules.cpp | 20 +- targets/minecraft/world/level/Level.cpp | 10 +- targets/minecraft/world/level/biome/Biome.cpp | 2 +- targets/minecraft/world/level/biome/Biome.h | 2 +- .../world/level/biome/BiomeCache.cpp | 6 +- .../world/level/biome/BiomeSource.cpp | 6 +- .../chunk/storage/McRegionChunkStorage.cpp | 6 +- .../level/chunk/storage/OldChunkStorage.cpp | 10 +- .../world/level/dimension/Dimension.cpp | 15 +- .../world/level/dimension/HellDimension.cpp | 8 +- .../world/level/dimension/TheEndDimension.cpp | 2 +- .../world/level/levelgen/CanyonFeature.cpp | 6 +- .../level/levelgen/CustomLevelSource.cpp | 10 +- .../world/level/levelgen/FlatLevelSource.cpp | 4 +- .../level/levelgen/HellFlatLevelSource.cpp | 4 +- .../level/levelgen/HellRandomLevelSource.cpp | 4 +- .../level/levelgen/RandomLevelSource.cpp | 6 +- .../levelgen/TheEndLevelRandomLevelSource.cpp | 4 +- .../levelgen/feature/BasicTreeFeature.cpp | 6 +- .../level/levelgen/feature/BirchFeature.cpp | 6 +- .../level/levelgen/feature/CaveFeature.cpp | 6 +- .../level/levelgen/feature/FlowerFeature.cpp | 6 +- .../level/levelgen/feature/LakeFeature.cpp | 6 +- .../levelgen/feature/MegaTreeFeature.cpp | 6 +- .../level/levelgen/feature/OreFeature.cpp | 6 +- .../level/levelgen/feature/PineFeature.cpp | 6 +- .../level/levelgen/feature/ReedsFeature.cpp | 6 +- .../level/levelgen/feature/SandFeature.cpp | 6 +- .../level/levelgen/feature/SpringFeature.cpp | 6 +- .../level/levelgen/feature/SpruceFeature.cpp | 6 +- .../levelgen/feature/SwampTreeFeature.cpp | 6 +- .../level/levelgen/feature/TreeFeature.cpp | 6 +- .../levelgen/structure/MineShaftFeature.cpp | 8 +- .../structure/NetherBridgeFeature.cpp | 4 +- .../structure/RandomScatteredLargeFeature.cpp | 4 +- .../structure/ScatteredFeaturePieces.cpp | 4 +- .../levelgen/structure/StrongholdFeature.cpp | 10 +- .../levelgen/structure/StrongholdPieces.cpp | 6 +- .../levelgen/structure/VillageFeature.cpp | 8 +- .../world/level/material/MaterialColor.h | 2 +- .../newbiome/layer/BiomeOverrideLayer.cpp | 4 +- .../world/level/newbiome/layer/Layer.cpp | 6 +- .../ConsoleSaveFileOriginal.cpp | 18 +- .../ConsoleSaveFileSplit.cpp | 16 +- .../level/storage/DirectoryLevelStorage.cpp | 13 +- .../world/level/storage/LevelData.cpp | 15 +- .../level/storage/McRegionLevelStorage.cpp | 4 +- .../minecraft/world/level/tile/FireTile.cpp | 8 +- .../minecraft/world/level/tile/GrassTile.cpp | 2 +- .../minecraft/world/level/tile/LeafTile.cpp | 2 +- .../world/level/tile/RedStoneDustTile.cpp | 2 +- .../minecraft/world/level/tile/StemTile.cpp | 2 +- .../world/level/tile/StoneMonsterTile.cpp | 4 +- .../world/level/tile/TallGrassPlantTile.cpp | 2 +- .../minecraft/world/level/tile/TntTile.cpp | 12 +- .../world/level/tile/WaterLilyTile.cpp | 2 +- .../level/tile/entity/BeaconTileEntity.cpp | 4 +- .../tile/entity/BrewingStandTileEntity.cpp | 4 +- .../level/tile/entity/ChestTileEntity.cpp | 4 +- .../level/tile/entity/DispenserTileEntity.cpp | 4 +- .../level/tile/entity/DropperTileEntity.cpp | 4 +- .../entity/EnchantmentTableTileEntity.cpp | 4 +- .../level/tile/entity/FurnaceTileEntity.cpp | 4 +- .../level/tile/entity/HopperTileEntity.cpp | 4 +- .../level/tile/entity/TheEndPortalTile.cpp | 4 +- 246 files changed, 1897 insertions(+), 2224 deletions(-) create mode 100644 targets/app/common/AppGameServices.cpp create mode 100644 targets/app/common/AppGameServices.h rename targets/{app/common/App_enums.h => minecraft/GameEnums.h} (100%) delete mode 100644 targets/minecraft/GameServices.cpp delete mode 100644 targets/minecraft/GameServices.h create mode 100644 targets/minecraft/GameTypes.h create mode 100644 targets/minecraft/IGameServices.cpp create mode 100644 targets/minecraft/IGameServices.h rename targets/minecraft/client/{ => model}/SkinBox.h (100%) delete mode 100644 targets/minecraft/locale/Strings.cpp delete mode 100644 targets/minecraft/locale/Strings.h delete mode 100644 targets/minecraft/util/DebugSettings.cpp delete mode 100644 targets/minecraft/util/DebugSettings.h 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 90ae49112..408db6ccf 100644 --- a/targets/app/common/App_structs.h +++ b/targets/app/common/App_structs.h @@ -4,11 +4,12 @@ #include "platform/sdl2/Storage.h" #include "app/common/App_Defines.h" -#include "app/common/App_enums.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/SkinBox.h" +#include "minecraft/client/model/SkinBox.h" #include "platform/XboxStubs.h" typedef struct { @@ -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/Colours/ColourTable.cpp b/targets/app/common/Colours/ColourTable.cpp index c739b8e14..f8e7fe237 100644 --- a/targets/app/common/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/Colours/ColourTable.h b/targets/app/common/Colours/ColourTable.h index 657ec9140..021e39c5c 100644 --- a/targets/app/common/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/DLC/DLCSkinFile.cpp b/targets/app/common/DLC/DLCSkinFile.cpp index 12a46dc9a..0f3a1612c 100644 --- a/targets/app/common/DLC/DLCSkinFile.cpp +++ b/targets/app/common/DLC/DLCSkinFile.cpp @@ -7,7 +7,7 @@ #include "DLCManager.h" #include "app/common/DLC/DLCFile.h" #include "app/linux/LinuxGame.h" -#include "minecraft/client/SkinBox.h" +#include "minecraft/client/model/SkinBox.h" #include "platform/XboxStubs.h" DLCSkinFile::DLCSkinFile(const std::wstring& path) diff --git a/targets/app/common/DLC/DLCSkinFile.h b/targets/app/common/DLC/DLCSkinFile.h index c740d0cc2..ab925f7cd 100644 --- a/targets/app/common/DLC/DLCSkinFile.h +++ b/targets/app/common/DLC/DLCSkinFile.h @@ -6,7 +6,7 @@ #include "DLCFile.h" #include "app/common/DLC/DLCManager.h" -#include "minecraft/client/SkinBox.h" +#include "minecraft/client/model/SkinBox.h" #include "minecraft/client/model/HumanoidModel.h" class DLCSkinFile : public DLCFile { diff --git a/targets/app/common/Game.cpp b/targets/app/common/Game.cpp index 82f255a6d..eca6a2359 100644 --- a/targets/app/common/Game.cpp +++ b/targets/app/common/Game.cpp @@ -7,7 +7,7 @@ #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/Console_Debug_enum.h" #include "app/common/DLC/DLCManager.h" @@ -23,7 +23,7 @@ #include "app/linux/Linux_UIController.h" #include "app/linux/Stubs/winapi_stubs.h" #include "platform/NetTypes.h" -#include "minecraft/client/SkinBox.h" +#include "minecraft/client/model/SkinBox.h" #include "platform/XboxStubs.h" #include "platform/PlatformServices.h" #include "java/Class.h" @@ -114,8 +114,6 @@ const float Game::fSafeZoneX = 64.0f; // 5% of 1280 const float Game::fSafeZoneY = 36.0f; // 5% of 720 Game::Game() { - GameHostOptions::init(&m_uiGameHostSettings); - if (GAME_SETTINGS_PROFILE_DATA_BYTES != sizeof(GAME_SETTINGS)) { DebugPrintf( "WARNING: The size of the profile GAME_SETTINGS struct has " @@ -414,12 +412,12 @@ void Game::FatalLoadError() {} void Game::SetGameHostOption(eGameHostOption eVal, unsigned int uiVal) { - GameHostOptions::set(eVal, uiVal); + GameHostOptions::set(m_uiGameHostSettings, eVal, uiVal); } unsigned int Game::GetGameHostOption(eGameHostOption eVal) { - return GameHostOptions::get(eVal); + return GameHostOptions::get(m_uiGameHostSettings, eVal); } diff --git a/targets/app/common/Game.h b/targets/app/common/Game.h index dfcc83fb3..16901e30b 100644 --- a/targets/app/common/Game.h +++ b/targets/app/common/Game.h @@ -31,7 +31,7 @@ #include "app/common/UI/All Platforms/ArchiveFile.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "platform/NetTypes.h" -#include "minecraft/client/SkinBox.h" +#include "minecraft/client/model/SkinBox.h" #include "platform/XboxStubs.h" #include "minecraft/network/packet/DisconnectPacket.h" #include "minecraft/world/entity/item/MinecartHopper.h" diff --git a/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp b/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp index 8400e8eed..476557a6b 100644 --- a/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp +++ b/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp @@ -6,7 +6,7 @@ #include #include -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/DLC/DLCGameRulesHeader.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" diff --git a/targets/app/common/GameSettingsManager.cpp b/targets/app/common/GameSettingsManager.cpp index 918b87dc5..b70d4d6d6 100644 --- a/targets/app/common/GameSettingsManager.cpp +++ b/targets/app/common/GameSettingsManager.cpp @@ -2,7 +2,7 @@ #include "app/common/Game.h" #include "app/common/App_Defines.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/Console_Debug_enum.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/UI/All Platforms/UIEnums.h" diff --git a/targets/app/common/Game_XuiActions.cpp b/targets/app/common/Game_XuiActions.cpp index 9eaedbead..598169e03 100644 --- a/targets/app/common/Game_XuiActions.cpp +++ b/targets/app/common/Game_XuiActions.cpp @@ -7,7 +7,7 @@ #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/Console_Debug_enum.h" #include "app/common/DLC/DLCManager.h" @@ -23,7 +23,7 @@ #include "app/linux/Linux_UIController.h" #include "app/linux/Stubs/winapi_stubs.h" #include "platform/NetTypes.h" -#include "minecraft/client/SkinBox.h" +#include "minecraft/client/model/SkinBox.h" #include "platform/XboxStubs.h" #include "platform/PlatformServices.h" #include "java/Class.h" 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/LocalizationManager.cpp b/targets/app/common/LocalizationManager.cpp index 964cb2c91..b58bf74a8 100644 --- a/targets/app/common/LocalizationManager.cpp +++ b/targets/app/common/LocalizationManager.cpp @@ -6,7 +6,7 @@ #include -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/App_structs.h" #include "app/common/Localisation/StringTable.h" #include "app/common/Colours/ColourTable.h" diff --git a/targets/app/common/LocalizationManager.h b/targets/app/common/LocalizationManager.h index 05fd71492..ad98c8e4a 100644 --- a/targets/app/common/LocalizationManager.h +++ b/targets/app/common/LocalizationManager.h @@ -5,7 +5,7 @@ #include #include -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/App_structs.h" #include "platform/XboxStubs.h" diff --git a/targets/app/common/Network/GameNetworkManager.cpp b/targets/app/common/Network/GameNetworkManager.cpp index 2534ae59c..e7ad30899 100644 --- a/targets/app/common/Network/GameNetworkManager.cpp +++ b/targets/app/common/Network/GameNetworkManager.cpp @@ -13,7 +13,7 @@ #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/GameRules/GameRuleManager.h" #include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" diff --git a/targets/app/common/Network/PlatformNetworkManagerInterface.h b/targets/app/common/Network/PlatformNetworkManagerInterface.h index 7cd52ea0b..83f792714 100644 --- a/targets/app/common/Network/PlatformNetworkManagerInterface.h +++ b/targets/app/common/Network/PlatformNetworkManagerInterface.h @@ -6,7 +6,7 @@ #include #endif #include "platform/NetTypes.h" -#include "minecraft/client/SkinBox.h" +#include "minecraft/client/model/SkinBox.h" #include "NetworkPlayerInterface.h" #include "SessionInfo.h" #include "platform/C4JThread.h" diff --git a/targets/app/common/Network/PlatformNetworkManagerStub.h b/targets/app/common/Network/PlatformNetworkManagerStub.h index c2899b1b2..572326b58 100644 --- a/targets/app/common/Network/PlatformNetworkManagerStub.h +++ b/targets/app/common/Network/PlatformNetworkManagerStub.h @@ -6,7 +6,7 @@ #include "platform/PlatformTypes.h" #include "platform/NetTypes.h" -#include "minecraft/client/SkinBox.h" +#include "minecraft/client/model/SkinBox.h" #include "platform/XboxStubs.h" #include "NetworkPlayerInterface.h" #include "platform/IPlatformNetwork.h" diff --git a/targets/app/common/SkinManager.h b/targets/app/common/SkinManager.h index fbbbddc80..eb92265cf 100644 --- a/targets/app/common/SkinManager.h +++ b/targets/app/common/SkinManager.h @@ -7,7 +7,7 @@ #include #include "app/common/App_structs.h" -#include "minecraft/client/SkinBox.h" +#include "minecraft/client/model/SkinBox.h" #include "platform/XboxStubs.h" class ModelPart; diff --git a/targets/app/common/TerrainFeatureManager.h b/targets/app/common/TerrainFeatureManager.h index 58fa3647d..16cb46a1a 100644 --- a/targets/app/common/TerrainFeatureManager.h +++ b/targets/app/common/TerrainFeatureManager.h @@ -2,7 +2,7 @@ #include -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/App_structs.h" class TerrainFeatureManager { diff --git a/targets/app/common/Tutorial/Tasks/ControllerTask.cpp b/targets/app/common/Tutorial/Tasks/ControllerTask.cpp index c59a87c06..c1dce5cdb 100644 --- a/targets/app/common/Tutorial/Tasks/ControllerTask.cpp +++ b/targets/app/common/Tutorial/Tasks/ControllerTask.cpp @@ -7,7 +7,7 @@ #include #include "platform/sdl2/Input.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/Tutorial/Constraints/InputConstraint.h" #include "app/common/Tutorial/Tasks/TutorialTask.h" #include "app/linux/LinuxGame.h" diff --git a/targets/app/common/Tutorial/Tutorial.cpp b/targets/app/common/Tutorial/Tutorial.cpp index 8c572353e..9a82d358b 100644 --- a/targets/app/common/Tutorial/Tutorial.cpp +++ b/targets/app/common/Tutorial/Tutorial.cpp @@ -8,7 +8,7 @@ #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/Tutorial/Constraints/TutorialConstraint.h" #include "app/common/Tutorial/Hints/DiggerItemHint.h" diff --git a/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp index 3f6d69e52..d1fb9835a 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp @@ -10,7 +10,7 @@ #include "platform/InputActions.h" #include "platform/sdl2/Input.h" #include "platform/sdl2/Render.h" -#include "app/common/App_enums.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" diff --git a/targets/app/common/UI/All Platforms/IUIScene_BeaconMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_BeaconMenu.cpp index 1b7585330..ab5330c4b 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_BeaconMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_BeaconMenu.cpp @@ -5,7 +5,7 @@ #include #include -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h" #include "app/linux/LinuxGame.h" #include "java/InputOutputStream/ByteArrayOutputStream.h" diff --git a/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp index fc519fd23..af15c437d 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp @@ -10,7 +10,7 @@ #include "platform/InputActions.h" #include "platform/sdl2/Profile.h" #include "platform/sdl2/Render.h" -#include "app/common/App_enums.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" diff --git a/targets/app/common/UI/All Platforms/IUIScene_HUD.cpp b/targets/app/common/UI/All Platforms/IUIScene_HUD.cpp index 6aa71f154..f16a119db 100644 --- a/targets/app/common/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/UI/All Platforms/IUIScene_PauseMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.cpp index 50ff3383b..301b7a922 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.cpp @@ -10,7 +10,7 @@ #include #include "platform/sdl2/Profile.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" #include "app/common/GameRules/GameRuleManager.h" diff --git a/targets/app/common/UI/Components/UIComponent_Tooltips.cpp b/targets/app/common/UI/Components/UIComponent_Tooltips.cpp index 8e5d7f82b..0014b18d3 100644 --- a/targets/app/common/UI/Components/UIComponent_Tooltips.cpp +++ b/targets/app/common/UI/Components/UIComponent_Tooltips.cpp @@ -2,7 +2,7 @@ #include "platform/sdl2/Profile.h" #include "platform/sdl2/Render.h" -#include "app/common/App_enums.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" diff --git a/targets/app/common/UI/Components/UIComponent_Tooltips.h b/targets/app/common/UI/Components/UIComponent_Tooltips.h index 95d02f872..e07969066 100644 --- a/targets/app/common/UI/Components/UIComponent_Tooltips.h +++ b/targets/app/common/UI/Components/UIComponent_Tooltips.h @@ -5,7 +5,7 @@ #include "platform/PlatformTypes.h" #include "platform/InputActions.h" #include "platform/sdl2/Render.h" -#include "app/common/App_enums.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" diff --git a/targets/app/common/UI/Components/UIComponent_TutorialPopup.cpp b/targets/app/common/UI/Components/UIComponent_TutorialPopup.cpp index 1248ee97a..254070b62 100644 --- a/targets/app/common/UI/Components/UIComponent_TutorialPopup.cpp +++ b/targets/app/common/UI/Components/UIComponent_TutorialPopup.cpp @@ -5,7 +5,7 @@ #include #include "platform/sdl2/Profile.h" -#include "app/common/App_enums.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" diff --git a/targets/app/common/UI/Components/UIScene_HUD.cpp b/targets/app/common/UI/Components/UIScene_HUD.cpp index b509b9048..1af9a6776 100644 --- a/targets/app/common/UI/Components/UIScene_HUD.cpp +++ b/targets/app/common/UI/Components/UIScene_HUD.cpp @@ -5,7 +5,7 @@ #include #include "platform/sdl2/Profile.h" -#include "app/common/App_enums.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" diff --git a/targets/app/common/UI/Controls/UIControl_EnchantmentButton.cpp b/targets/app/common/UI/Controls/UIControl_EnchantmentButton.cpp index d6249f361..d62242c7a 100644 --- a/targets/app/common/UI/Controls/UIControl_EnchantmentButton.cpp +++ b/targets/app/common/UI/Controls/UIControl_EnchantmentButton.cpp @@ -6,7 +6,7 @@ #include #include "platform/sdl2/Render.h" -#include "app/common/App_enums.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" diff --git a/targets/app/common/UI/Controls/UIControl_PlayerSkinPreview.cpp b/targets/app/common/UI/Controls/UIControl_PlayerSkinPreview.cpp index 44431a5cd..a8672eb73 100644 --- a/targets/app/common/UI/Controls/UIControl_PlayerSkinPreview.cpp +++ b/targets/app/common/UI/Controls/UIControl_PlayerSkinPreview.cpp @@ -7,7 +7,7 @@ #include #include "platform/sdl2/Render.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/UI/Controls/UIControl.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp b/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp index a5e32a378..726eba47b 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp @@ -6,7 +6,7 @@ #include "platform/InputActions.h" #include "platform/sdl2/Input.h" #include "platform/sdl2/Profile.h" -#include "app/common/App_enums.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" diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp index 43a94eada..59e3d96b3 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp @@ -7,7 +7,7 @@ #include "platform/InputActions.h" #include "platform/sdl2/Profile.h" -#include "app/common/App_enums.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" diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp b/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp index e932828ce..581d81420 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp @@ -8,7 +8,7 @@ #include "platform/InputActions.h" #include "platform/sdl2/Input.h" #include "platform/sdl2/Profile.h" -#include "app/common/App_enums.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" diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.cpp index f08adb7f5..fd55a5b58 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.cpp @@ -11,7 +11,7 @@ #include "platform/sdl2/Input.h" #include "platform/sdl2/Profile.h" #include "app/common/App_Defines.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" #include "app/common/Network/GameNetworkManager.h" diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.cpp index 9aa84b2fb..f803dd8b1 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.cpp @@ -2,7 +2,7 @@ #include "UIScene_DLCMainMenu.h" #include "platform/InputActions.h" -#include "app/common/App_enums.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" diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_EULA.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_EULA.cpp index b22ef9812..af1e574e5 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_EULA.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_EULA.cpp @@ -8,7 +8,7 @@ #include "platform/sdl2/Input.h" #include "platform/sdl2/Profile.h" #include "app/common/App_Defines.h" -#include "app/common/App_enums.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" diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_JoinMenu.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_JoinMenu.cpp index 0cf43cd4d..f2fd29f87 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_JoinMenu.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_JoinMenu.cpp @@ -8,7 +8,7 @@ #include "platform/InputActions.h" #include "platform/sdl2/Profile.h" #include "app/common/App_Defines.h" -#include "app/common/App_enums.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" diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LaunchMoreOptionsMenu.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LaunchMoreOptionsMenu.cpp index 741b81b57..3977355c9 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LaunchMoreOptionsMenu.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LaunchMoreOptionsMenu.cpp @@ -9,7 +9,7 @@ #include "platform/sdl2/Profile.h" #include "platform/sdl2/Render.h" #include "app/common/App_Defines.h" -#include "app/common/App_enums.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" diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.cpp index 0b0b0663e..45034a7e6 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.cpp @@ -9,7 +9,7 @@ #include "platform/sdl2/Profile.h" #include "platform/sdl2/Render.h" #include "app/common/App_Defines.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" #include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.cpp index 459a3d3b6..43676d4d3 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.cpp @@ -10,7 +10,7 @@ #include "platform/sdl2/Input.h" #include "platform/sdl2/Profile.h" #include "app/common/App_Defines.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/DLC/DLCManager.h" #include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" #include "app/common/Network/GameNetworkManager.h" diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.cpp index f3a1566fa..3b9a12f68 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.cpp @@ -11,7 +11,7 @@ #include "platform/sdl2/Profile.h" #include "platform/sdl2/Render.h" #include "app/common/App_Defines.h" -#include "app/common/App_enums.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" diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_NewUpdateMessage.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_NewUpdateMessage.cpp index 5b1ed77e3..c49d994fa 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_NewUpdateMessage.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_NewUpdateMessage.cpp @@ -5,7 +5,7 @@ #include "platform/InputActions.h" #include "app/common/App_Defines.h" -#include "app/common/App_enums.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" diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_ControlsMenu.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_ControlsMenu.cpp index a3fcc453f..2de72d80e 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_ControlsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_ControlsMenu.cpp @@ -6,7 +6,7 @@ #include "platform/InputActions.h" #include "platform/sdl2/Input.h" -#include "app/common/App_enums.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" diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlay.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlay.cpp index 872a43ebf..916bd3dd1 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlay.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlay.cpp @@ -7,7 +7,7 @@ #include #include "platform/InputActions.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.h index fb951667e..2e5422a42 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.h @@ -9,7 +9,7 @@ #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" #include "platform/NetTypes.h" -#include "minecraft/client/SkinBox.h" +#include "minecraft/client/model/SkinBox.h" #include "platform/XboxStubs.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.cpp index 22f17594a..6c8ef57cb 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.cpp @@ -4,7 +4,7 @@ #include #include "platform/InputActions.h" -#include "app/common/App_enums.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" diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.cpp index 620254241..8775cbce6 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.cpp @@ -3,7 +3,7 @@ #include #include "platform/InputActions.h" -#include "app/common/App_enums.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" diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.cpp index ced6b9473..aad9811cb 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.cpp @@ -4,7 +4,7 @@ #include "platform/InputActions.h" #include "platform/sdl2/Profile.h" -#include "app/common/App_enums.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" diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.cpp index e6ba8479a..d9cbf6935 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.cpp @@ -6,7 +6,7 @@ #include "platform/InputActions.h" #include "platform/sdl2/Profile.h" #include "platform/sdl2/Render.h" -#include "app/common/App_enums.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" diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.cpp index 85c35961d..103459bf2 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.cpp @@ -5,7 +5,7 @@ #include "platform/InputActions.h" #include "platform/sdl2/Profile.h" -#include "app/common/App_enums.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" diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp index c6be93226..a9dc5777e 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp @@ -20,7 +20,7 @@ #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "minecraft/client/SkinBox.h" +#include "minecraft/client/model/SkinBox.h" #include "util/StringHelpers.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.h index 55541476c..bd2b004cd 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.h @@ -15,7 +15,7 @@ #include "app/linux/Stubs/iggy_stubs.h" #endif #include "app/linux/Iggy/include/rrCore.h" -#include "minecraft/client/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/UI/Scenes/In-Game Menu Screens/UIScene_DeathMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_DeathMenu.cpp index 0197e91be..955a61c1f 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_DeathMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_DeathMenu.cpp @@ -6,7 +6,7 @@ #include "platform/InputActions.h" #include "platform/sdl2/Profile.h" #include "platform/sdl2/Storage.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialMode.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_EndPoem.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_EndPoem.cpp index 09627e855..b4f2dd238 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_EndPoem.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_EndPoem.cpp @@ -9,7 +9,7 @@ #include "platform/PlatformTypes.h" #include "platform/InputActions.h" #include "platform/sdl2/Profile.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameHostOptionsMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameHostOptionsMenu.cpp index ef72faa51..e8f4e7386 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameHostOptionsMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameHostOptionsMenu.cpp @@ -4,7 +4,7 @@ #include #include "platform/InputActions.h" -#include "app/common/App_enums.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" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.cpp index d15737608..5f5bb4d07 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.cpp @@ -5,7 +5,7 @@ #include "platform/PlatformTypes.h" #include "platform/InputActions.h" #include "platform/sdl2/Profile.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/Console_Debug_enum.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/Network/NetworkPlayerInterface.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.cpp index 1a31ea9c5..f0af5a898 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.cpp @@ -4,7 +4,7 @@ #include #include "platform/InputActions.h" -#include "app/common/App_enums.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" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.cpp index 9922ddaff..1f2d7c3b9 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.cpp @@ -7,7 +7,7 @@ #include "platform/InputActions.h" #include "platform/sdl2/Profile.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" #include "app/common/Network/GameNetworkManager.h" diff --git a/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.cpp b/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.cpp index 0dfd409f6..c00a2d1ba 100644 --- a/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.cpp +++ b/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.cpp @@ -3,7 +3,7 @@ #include "platform/InputActions.h" #include "platform/sdl2/Profile.h" -#include "app/common/App_enums.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" diff --git a/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.cpp b/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.cpp index 1b5fed537..61869e35a 100644 --- a/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.cpp +++ b/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.cpp @@ -7,7 +7,7 @@ #include "platform/PlatformTypes.h" #include "platform/InputActions.h" #include "platform/sdl2/Profile.h" -#include "app/common/App_enums.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" diff --git a/targets/app/common/UI/UIController.cpp b/targets/app/common/UI/UIController.cpp index 726d2efca..8f77249dd 100644 --- a/targets/app/common/UI/UIController.cpp +++ b/targets/app/common/UI/UIController.cpp @@ -12,7 +12,7 @@ #include "platform/sdl2/Input.h" #include "platform/sdl2/Profile.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/Audio/SoundEngine.h" #include "app/common/DLC/DLCManager.h" #include "app/common/Network/GameNetworkManager.h" diff --git a/targets/app/linux/LinuxGame.cpp b/targets/app/linux/LinuxGame.cpp index 8db25144a..c2d5ba72b 100644 --- a/targets/app/linux/LinuxGame.cpp +++ b/targets/app/linux/LinuxGame.cpp @@ -7,7 +7,7 @@ #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/Network/GameNetworkManager.h" #include "app/common/UI/All Platforms/UIStructs.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 e2ccc11d2..93c109dc2 100644 --- a/targets/app/linux/Linux_Minecraft.cpp +++ b/targets/app/linux/Linux_Minecraft.cpp @@ -1,7 +1,5 @@ +#include "app/common/AppGameServices.h" #include "app/common/GameMenuService.h" -#include "minecraft/GameServices.h" -#include "minecraft/util/DebugSettings.h" -#include "minecraft/locale/Strings.h" // Minecraft.cpp : Defines the entry point for the application. // @@ -455,153 +453,9 @@ int main(int argc, const char* argv[]) { app.loadMediaArchive(); app.loadStringTable(); - Strings::init([](int id) { return app.GetString(id); }); - DebugSettings::init( - [] { return app.DebugSettingsOn(); }, - [] { return app.DebugArtToolsOn(); }, - [](int iPad, bool overridePlayer) { - return app.GetGameSettingsDebugMask(iPad, overridePlayer); - }, - [] { return app.GetMobsDontAttackEnabled(); }, - [] { return app.GetMobsDontTickEnabled(); }, - [] { return app.GetFreezePlayers(); }); - GameServices::initLevelGen( - [] { return app.getLevelGenerationOptions(); }, - [] { return app.getGameRuleDefinitions(); }); - GameServices::initTextureCache( - [](const std::wstring& n, std::uint8_t* d, unsigned int s) { - app.AddMemoryTextureFile(n, d, s); - }, - [](const std::wstring& n) { app.RemoveMemoryTextureFile(n); }, - [](const std::wstring& n, std::uint8_t** d, unsigned int* s) { - app.GetMemFileDetails(n, d, s); - }, - [](const std::wstring& n) { return app.IsFileInMemoryTextures(n); }); - GameServices::initPlayerSettings( - [](int iPad, int s) { - return app.GetGameSettings(iPad, static_cast(s)); - }, - [](int s) { - return app.GetGameSettings(static_cast(s)); - }); - GameServices::initAppTime([] { return app.getAppTime(); }); - GameServices::initGameState( - [] { return app.GetGameStarted(); }, - [](bool v) { app.SetGameStarted(v); }, - [] { return app.GetTutorialMode(); }, - [](bool v) { app.SetTutorialMode(v); }, - [] { return app.IsAppPaused(); }, - [] { return app.GetLocalPlayerCount(); }, - [] { return app.AutosaveDue(); }, - [] { app.SetAutosaveTimerTime(); }, - [] { return app.SecondsToAutosave(); }, - [](DisconnectPacket::eDisconnectReason r) { app.SetDisconnectReason(r); }, - [] { app.lockSaveNotification(); }, - [] { app.unlockSaveNotification(); }, - [] { return app.GetResetNether(); }, - [] { return app.GetUseDPadForDebug(); }, - [] { return app.GetWriteSavesToFolderEnabled(); }, - [] { return app.IsLocalMultiplayerAvailable(); }, - [] { return app.DLCInstallPending(); }, - [] { return app.DLCInstallProcessCompleted(); }, - [] { return app.CanRecordStatsAndAchievements(); }, - [] { return app.GetTMSGlobalFileListRead(); }, - [](std::uint32_t id) { app.SetRequiredTexturePackID(id); }, - [](int iPad, int idx) { app.SetSpecialTutorialCompletionFlag(iPad, idx); }, - [](int iPad, bool v) { app.SetBanListCheck(iPad, v); }, - [](int iPad) { return app.GetBanListCheck(iPad); }, - [] { return app.GetGameNewWorldSize(); }, - [] { return app.GetGameNewWorldSizeUseMoat(); }, - [] { return app.GetGameNewHellScale(); } - ); - GameServices::initUIDispatch( - [](int iPad, eXuiAction a, void* p) { app.SetAction(iPad, a, p); }, - [](int iPad, eXuiServerAction a, void* p) { app.SetXuiServerAction(iPad, a, p); }, - [](int iPad) { return app.GetXuiAction(iPad); }, - [](int iPad) { return app.GetXuiServerAction(iPad); }, - [](int iPad) { return app.GetXuiServerActionParam(iPad); }, - [](eXuiAction a) { app.SetGlobalXuiAction(a); }, - [] { app.HandleButtonPresses(); }, - [](int iPad, eTMSAction a) { app.SetTMSAction(iPad, a); } - ); - GameServices::initSkinCape( - [](int iPad) { return app.GetPlayerSkinName(iPad); }, - [](int iPad) { return app.GetPlayerSkinId(iPad); }, - [](int iPad) { return app.GetPlayerCapeName(iPad); }, - [](int iPad) { return app.GetPlayerCapeId(iPad); }, - [](int iPad) { return app.GetAdditionalModelParts(iPad); }, - [](std::uint32_t id, SKIN_BOX* a, unsigned int c) { - app.SetAdditionalSkinBoxes(id, a, c); - }, - [](std::uint32_t id) { return app.GetAdditionalSkinBoxes(id); }, - [](std::uint32_t id) { return app.GetAdditionalModelParts(id); }, - [](std::uint32_t id, std::vector* v) { - return app.SetAdditionalSkinBoxes(id, v); - }, - [](std::uint32_t id, unsigned int m) { app.SetAnimOverrideBitmask(id, m); }, - [](std::uint32_t id) { return app.GetAnimOverrideBitmask(id); }, - [](const std::wstring& s) { return Game::getSkinIdFromPath(s); }, - [](std::uint32_t id) { return Game::getSkinPathFromId(id); }, - [] { return app.DefaultCapeExists(); }, - [](PlayerUID x) { return app.isXuidNotch(x); }, - [](PlayerUID x) { return app.isXuidDeadmau5(x); } - ); - GameServices::initPlatformFeatures( - [] { app.FatalLoadError(); }, - [](int iPad, int ctx) { app.SetRichPresenceContext(iPad, ctx); }, - [] { app.CaptureSaveThumbnail(); }, - [](std::uint8_t** d, unsigned int* s) { app.GetSaveThumbnail(d, s); }, - [](int iPad, eTMSAction a, bool cb) { app.ReadBannedList(iPad, a, cb); }, - [](std::uint8_t id, int16_t col, unsigned int priv) { - app.UpdatePlayerInfo(id, col, priv); - }, - [](std::uint8_t id) { return app.GetPlayerPrivileges(id); }, - [](int iPad, unsigned int v) { app.SetGameSettingsDebugMask(iPad, v); } - ); - GameServices::initSchematics( - [](LevelChunk* c) { app.processSchematics(c); }, - [](LevelChunk* c) { app.processSchematicsLighting(c); }, - [](_eTerrainFeatureType t, int x, int z) { - app.AddTerrainFeaturePosition(t, x, z); - }, - [](_eTerrainFeatureType t, int* x, int* z) { - return app.GetTerrainFeaturePosition(t, x, z); - }, - [] { app.loadDefaultGameRules(); } - ); - GameServices::initArchive( - [](const std::wstring& f) { return app.hasArchiveFile(f); }, - [](const std::wstring& f) { return app.getArchiveFile(f); } - ); - GameServices::initStringsAndMisc( - [](eMinecraftColour c) { return app.GetHTMLColour(c); }, - [](int type) { return app.getEntityName(static_cast(type)); }, - [](const std::wstring& k) { return app.GetGameRulesString(k); }, - [](std::uint8_t* m, int64_t s, bool h, unsigned int ho, unsigned int tp) { - return app.CreateImageTextData(m, s, h, ho, tp); - }, - [](std::uint32_t p, std::wstring f, bool a, std::wstring mp) { - return app.getFilePath(p, f, a, mp); - }, - [] { return app.GetUniqueMapName(); }, - [](char* n) { app.SetUniqueMapName(n); }, - [](int iPad) { return app.GetOpacityTimer(iPad); }, - [](int iPad) { app.SetOpacityTimer(iPad); }, - [](int iPad) { app.TickOpacityTimer(iPad); }, - [](int iPad, PlayerUID x, char* n) { - return app.IsInBannedLevelList(iPad, x, n); - }, - [](PlayerUID x) { return app.GetMojangDataForXuid(x); }, - [](const char* msg) { app.DebugPrintf("%s", msg); } - ); - GameServices::initMemberAccess( - &app.m_dlcManager, - &app.m_gameRules, - &app.vSkinNames, - app.m_terrainFeatureManager.features() - ); static GameMenuService menuService(app); - GameServices::initMenuService(&menuService); + 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/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 index 74c9fcd01..33bd30311 100644 --- a/targets/minecraft/GameHostOptions.cpp +++ b/targets/minecraft/GameHostOptions.cpp @@ -1,25 +1,7 @@ #include "minecraft/GameHostOptions.h" -#include - namespace GameHostOptions { -static unsigned int* s_settings = nullptr; - -void init(unsigned int* settingsPtr) { - s_settings = settingsPtr; -} - -unsigned int get(eGameHostOption option) { - assert(s_settings); - return get(*s_settings, option); -} - -void set(eGameHostOption option, unsigned int value) { - assert(s_settings); - set(*s_settings, option, value); -} - unsigned int get(unsigned int settings, eGameHostOption option) { switch (option) { case eGameHostOption_FriendsOfFriends: diff --git a/targets/minecraft/GameHostOptions.h b/targets/minecraft/GameHostOptions.h index 6aca553b8..0d27f5dae 100644 --- a/targets/minecraft/GameHostOptions.h +++ b/targets/minecraft/GameHostOptions.h @@ -3,16 +3,14 @@ #include #include "app/common/App_Defines.h" -#include "app/common/App_enums.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); -// Global game settings - initialized by app layer at startup -void init(unsigned int* settingsPtr); -unsigned int get(eGameHostOption option); -void set(eGameHostOption option, unsigned int value); - } // namespace GameHostOptions diff --git a/targets/minecraft/GameServices.cpp b/targets/minecraft/GameServices.cpp deleted file mode 100644 index 4ec90720b..000000000 --- a/targets/minecraft/GameServices.cpp +++ /dev/null @@ -1,654 +0,0 @@ -#include "minecraft/GameServices.h" - -#include - -namespace GameServices { - -// Level generation - -static LevelGenOptsFn s_levelGenOpts = nullptr; -static GameRuleDefsFn s_gameRuleDefs = nullptr; - -void initLevelGen(LevelGenOptsFn levelGenOpts, GameRuleDefsFn gameRuleDefs) { - s_levelGenOpts = levelGenOpts; - s_gameRuleDefs = gameRuleDefs; -} - -LevelGenerationOptions* getLevelGenerationOptions() { - assert(s_levelGenOpts); - return s_levelGenOpts(); -} - -LevelRuleset* getGameRuleDefinitions() { - assert(s_gameRuleDefs); - return s_gameRuleDefs(); -} - -// Texture cache - -static AddTexFn s_addTex = nullptr; -static RemoveTexFn s_removeTex = nullptr; -static GetTexDetailsFn s_getTexDetails = nullptr; -static HasTexFn s_hasTex = nullptr; - -void initTextureCache(AddTexFn add, RemoveTexFn remove, - GetTexDetailsFn getDetails, HasTexFn has) { - s_addTex = add; - s_removeTex = remove; - s_getTexDetails = getDetails; - s_hasTex = has; -} - -void addMemoryTextureFile(const std::wstring& name, std::uint8_t* data, - unsigned int size) { - if (s_addTex) s_addTex(name, data, size); -} - -void removeMemoryTextureFile(const std::wstring& name) { - if (s_removeTex) s_removeTex(name); -} - -void getMemFileDetails(const std::wstring& name, std::uint8_t** data, - unsigned int* size) { - if (s_getTexDetails) s_getTexDetails(name, data, size); -} - -bool isFileInMemoryTextures(const std::wstring& name) { - return s_hasTex ? s_hasTex(name) : false; -} - -// Per-player settings - -static GetSettingsFn s_getSettings = nullptr; -static GetSettingsNoArgFn s_getSettingsNoArg = nullptr; - -void initPlayerSettings(GetSettingsFn getSettings, - GetSettingsNoArgFn getSettingsNoArg) { - s_getSettings = getSettings; - s_getSettingsNoArg = getSettingsNoArg; -} - -unsigned char getGameSettings(int iPad, int setting) { - return s_getSettings ? s_getSettings(iPad, setting) : 0; -} - -unsigned char getGameSettings(int setting) { - return s_getSettingsNoArg ? s_getSettingsNoArg(setting) : 0; -} - -// App time - -static AppTimeFn s_appTime = nullptr; - -void initAppTime(AppTimeFn fn) { s_appTime = fn; } - -float getAppTime() { return s_appTime ? s_appTime() : 0.0f; } - -// Game state - -static bool (*s_getGameStarted)() = nullptr; -static void (*s_setGameStarted)(bool) = nullptr; -static bool (*s_getTutorialMode)() = nullptr; -static void (*s_setTutorialMode)(bool) = nullptr; -static bool (*s_isAppPaused)() = nullptr; -static int (*s_getLocalPlayerCount)() = nullptr; -static bool (*s_autosaveDue)() = nullptr; -static void (*s_setAutosaveTimerTime)() = nullptr; -static int64_t (*s_secondsToAutosave)() = nullptr; -static void (*s_setDisconnectReason)(DisconnectPacket::eDisconnectReason) = nullptr; -static void (*s_lockSaveNotify)() = nullptr; -static void (*s_unlockSaveNotify)() = nullptr; -static bool (*s_getResetNether)() = nullptr; -static bool (*s_getUseDPadForDebug)() = nullptr; -static bool (*s_getWriteSavesToFolderEnabled)() = nullptr; -static bool (*s_isLocalMultiplayerAvailable)() = nullptr; -static bool (*s_dlcInstallPending)() = nullptr; -static bool (*s_dlcInstallProcessCompleted)() = nullptr; -static bool (*s_canRecordStatsAndAchievements)() = nullptr; -static bool (*s_getTMSGlobalFileListRead)() = nullptr; -static void (*s_setRequiredTexturePackID)(std::uint32_t) = nullptr; -static void (*s_setSpecialTutorialCompletionFlag)(int, int) = nullptr; -static void (*s_setBanListCheck)(int, bool) = nullptr; -static bool (*s_getBanListCheck)(int) = nullptr; -static unsigned int (*s_getGameNewWorldSize)() = nullptr; -static unsigned int (*s_getGameNewWorldSizeUseMoat)() = nullptr; -static unsigned int (*s_getGameNewHellScale)() = nullptr; - -void initGameState( - bool (*getGameStartedFn)(), - void (*setGameStartedFn)(bool), - bool (*getTutorialModeFn)(), - void (*setTutorialModeFn)(bool), - bool (*isAppPausedFn)(), - int (*getLocalPlayerCountFn)(), - bool (*autosaveDueFn)(), - void (*setAutosaveTimerTimeFn)(), - int64_t (*secondsToAutosaveFn)(), - void (*setDisconnectReasonFn)(DisconnectPacket::eDisconnectReason), - void (*lockSaveNotifyFn)(), - void (*unlockSaveNotifyFn)(), - bool (*getResetNetherFn)(), - bool (*getUseDPadForDebugFn)(), - bool (*getWriteSavesToFolderEnabledFn)(), - bool (*isLocalMultiplayerAvailableFn)(), - bool (*dlcInstallPendingFn)(), - bool (*dlcInstallProcessCompletedFn)(), - bool (*canRecordStatsAndAchievementsFn)(), - bool (*getTMSGlobalFileListReadFn)(), - void (*setRequiredTexturePackIDFn)(std::uint32_t), - void (*setSpecialTutorialCompletionFlagFn)(int, int), - void (*setBanListCheckFn)(int, bool), - bool (*getBanListCheckFn)(int), - unsigned int (*getGameNewWorldSizeFn)(), - unsigned int (*getGameNewWorldSizeUseMoatFn)(), - unsigned int (*getGameNewHellScaleFn)() -) { - s_getGameStarted = getGameStartedFn; - s_setGameStarted = setGameStartedFn; - s_getTutorialMode = getTutorialModeFn; - s_setTutorialMode = setTutorialModeFn; - s_isAppPaused = isAppPausedFn; - s_getLocalPlayerCount = getLocalPlayerCountFn; - s_autosaveDue = autosaveDueFn; - s_setAutosaveTimerTime = setAutosaveTimerTimeFn; - s_secondsToAutosave = secondsToAutosaveFn; - s_setDisconnectReason = setDisconnectReasonFn; - s_lockSaveNotify = lockSaveNotifyFn; - s_unlockSaveNotify = unlockSaveNotifyFn; - s_getResetNether = getResetNetherFn; - s_getUseDPadForDebug = getUseDPadForDebugFn; - s_getWriteSavesToFolderEnabled = getWriteSavesToFolderEnabledFn; - s_isLocalMultiplayerAvailable = isLocalMultiplayerAvailableFn; - s_dlcInstallPending = dlcInstallPendingFn; - s_dlcInstallProcessCompleted = dlcInstallProcessCompletedFn; - s_canRecordStatsAndAchievements = canRecordStatsAndAchievementsFn; - s_getTMSGlobalFileListRead = getTMSGlobalFileListReadFn; - s_setRequiredTexturePackID = setRequiredTexturePackIDFn; - s_setSpecialTutorialCompletionFlag = setSpecialTutorialCompletionFlagFn; - s_setBanListCheck = setBanListCheckFn; - s_getBanListCheck = getBanListCheckFn; - s_getGameNewWorldSize = getGameNewWorldSizeFn; - s_getGameNewWorldSizeUseMoat = getGameNewWorldSizeUseMoatFn; - s_getGameNewHellScale = getGameNewHellScaleFn; -} - -bool getGameStarted() { return s_getGameStarted ? s_getGameStarted() : false; } -void setGameStarted(bool val) { if (s_setGameStarted) s_setGameStarted(val); } -bool getTutorialMode() { return s_getTutorialMode ? s_getTutorialMode() : false; } -void setTutorialMode(bool val) { if (s_setTutorialMode) s_setTutorialMode(val); } -bool isAppPaused() { return s_isAppPaused ? s_isAppPaused() : false; } -int getLocalPlayerCount() { return s_getLocalPlayerCount ? s_getLocalPlayerCount() : 0; } -bool autosaveDue() { return s_autosaveDue ? s_autosaveDue() : false; } -void setAutosaveTimerTime() { if (s_setAutosaveTimerTime) s_setAutosaveTimerTime(); } -int64_t secondsToAutosave() { return s_secondsToAutosave ? s_secondsToAutosave() : 0; } -void setDisconnectReason(DisconnectPacket::eDisconnectReason reason) { - if (s_setDisconnectReason) s_setDisconnectReason(reason); -} -void lockSaveNotification() { if (s_lockSaveNotify) s_lockSaveNotify(); } -void unlockSaveNotification() { if (s_unlockSaveNotify) s_unlockSaveNotify(); } -bool getResetNether() { return s_getResetNether ? s_getResetNether() : false; } -bool getUseDPadForDebug() { return s_getUseDPadForDebug ? s_getUseDPadForDebug() : false; } -bool getWriteSavesToFolderEnabled() { - return s_getWriteSavesToFolderEnabled ? s_getWriteSavesToFolderEnabled() : false; -} -bool isLocalMultiplayerAvailable() { - return s_isLocalMultiplayerAvailable ? s_isLocalMultiplayerAvailable() : false; -} -bool dlcInstallPending() { return s_dlcInstallPending ? s_dlcInstallPending() : false; } -bool dlcInstallProcessCompleted() { - return s_dlcInstallProcessCompleted ? s_dlcInstallProcessCompleted() : false; -} -bool canRecordStatsAndAchievements() { - return s_canRecordStatsAndAchievements ? s_canRecordStatsAndAchievements() : false; -} -bool getTMSGlobalFileListRead() { - return s_getTMSGlobalFileListRead ? s_getTMSGlobalFileListRead() : true; -} -void setRequiredTexturePackID(std::uint32_t id) { - if (s_setRequiredTexturePackID) s_setRequiredTexturePackID(id); -} -void setSpecialTutorialCompletionFlag(int iPad, int index) { - if (s_setSpecialTutorialCompletionFlag) s_setSpecialTutorialCompletionFlag(iPad, index); -} -void setBanListCheck(int iPad, bool val) { - if (s_setBanListCheck) s_setBanListCheck(iPad, val); -} -bool getBanListCheck(int iPad) { - return s_getBanListCheck ? s_getBanListCheck(iPad) : false; -} -unsigned int getGameNewWorldSize() { - return s_getGameNewWorldSize ? s_getGameNewWorldSize() : 0; -} -unsigned int getGameNewWorldSizeUseMoat() { - return s_getGameNewWorldSizeUseMoat ? s_getGameNewWorldSizeUseMoat() : 0; -} -unsigned int getGameNewHellScale() { - return s_getGameNewHellScale ? s_getGameNewHellScale() : 0; -} - -// UI dispatch - -static void (*s_setAction)(int, eXuiAction, void*) = nullptr; -static void (*s_setXuiServerAction)(int, eXuiServerAction, void*) = nullptr; -static eXuiAction (*s_getXuiAction)(int) = nullptr; -static eXuiServerAction (*s_getXuiServerAction)(int) = nullptr; -static void* (*s_getXuiServerActionParam)(int) = nullptr; -static void (*s_setGlobalXuiAction)(eXuiAction) = nullptr; -static void (*s_handleButtonPresses)() = nullptr; -static void (*s_setTMSAction)(int, eTMSAction) = nullptr; - -void initUIDispatch( - void (*setActionFn)(int, eXuiAction, void*), - void (*setXuiServerActionFn)(int, eXuiServerAction, void*), - eXuiAction (*getXuiActionFn)(int), - eXuiServerAction (*getXuiServerActionFn)(int), - void* (*getXuiServerActionParamFn)(int), - void (*setGlobalXuiActionFn)(eXuiAction), - void (*handleButtonPressesFn)(), - void (*setTMSActionFn)(int, eTMSAction) -) { - s_setAction = setActionFn; - s_setXuiServerAction = setXuiServerActionFn; - s_getXuiAction = getXuiActionFn; - s_getXuiServerAction = getXuiServerActionFn; - s_getXuiServerActionParam = getXuiServerActionParamFn; - s_setGlobalXuiAction = setGlobalXuiActionFn; - s_handleButtonPresses = handleButtonPressesFn; - s_setTMSAction = setTMSActionFn; -} - -void setAction(int iPad, eXuiAction action, void* param) { - if (s_setAction) s_setAction(iPad, action, param); -} -void setXuiServerAction(int iPad, eXuiServerAction action, void* param) { - if (s_setXuiServerAction) s_setXuiServerAction(iPad, action, param); -} -eXuiAction getXuiAction(int iPad) { - return s_getXuiAction ? s_getXuiAction(iPad) : eAppAction_Idle; -} -eXuiServerAction getXuiServerAction(int iPad) { - return s_getXuiServerAction ? s_getXuiServerAction(iPad) : eXuiServerAction_Idle; -} -void* getXuiServerActionParam(int iPad) { - return s_getXuiServerActionParam ? s_getXuiServerActionParam(iPad) : nullptr; -} -void setGlobalXuiAction(eXuiAction action) { - if (s_setGlobalXuiAction) s_setGlobalXuiAction(action); -} -void handleButtonPresses() { - if (s_handleButtonPresses) s_handleButtonPresses(); -} -void setTMSAction(int iPad, eTMSAction action) { - if (s_setTMSAction) s_setTMSAction(iPad, action); -} - -// Skin / cape / animation - -static std::wstring (*s_getPlayerSkinName)(int) = nullptr; -static std::uint32_t (*s_getPlayerSkinId)(int) = nullptr; -static std::wstring (*s_getPlayerCapeName)(int) = nullptr; -static std::uint32_t (*s_getPlayerCapeId)(int) = nullptr; -static std::uint32_t (*s_getAdditionalModelPartsForPad)(int) = nullptr; -static void (*s_setAdditionalSkinBoxes)(std::uint32_t, SKIN_BOX*, unsigned int) = nullptr; -static std::vector* (*s_getAdditionalSkinBoxes)(std::uint32_t) = nullptr; -static std::vector* (*s_getAdditionalModelParts)(std::uint32_t) = nullptr; -static std::vector* (*s_setAdditionalSkinBoxesFromVec)( - std::uint32_t, std::vector*) = nullptr; -static void (*s_setAnimOverrideBitmask)(std::uint32_t, unsigned int) = nullptr; -static unsigned int (*s_getAnimOverrideBitmask)(std::uint32_t) = nullptr; -static std::uint32_t (*s_skinIdFromPath)(const std::wstring&) = nullptr; -static std::wstring (*s_skinPathFromId)(std::uint32_t) = nullptr; -static bool (*s_defaultCapeExists)() = nullptr; -static bool (*s_isXuidNotch)(PlayerUID) = nullptr; -static bool (*s_isXuidDeadmau5)(PlayerUID) = nullptr; - -void initSkinCape( - std::wstring (*getPlayerSkinNameFn)(int), - std::uint32_t (*getPlayerSkinIdFn)(int), - std::wstring (*getPlayerCapeNameFn)(int), - std::uint32_t (*getPlayerCapeIdFn)(int), - std::uint32_t (*getAdditionalModelPartsForPadFn)(int), - void (*setAdditionalSkinBoxesFn)(std::uint32_t, SKIN_BOX*, unsigned int), - std::vector* (*getAdditionalSkinBoxesFn)(std::uint32_t), - std::vector* (*getAdditionalModelPartsFn)(std::uint32_t), - std::vector* (*setAdditionalSkinBoxesFromVecFn)( - std::uint32_t, std::vector*), - void (*setAnimOverrideBitmaskFn)(std::uint32_t, unsigned int), - unsigned int (*getAnimOverrideBitmaskFn)(std::uint32_t), - std::uint32_t (*skinIdFromPathFn)(const std::wstring&), - std::wstring (*skinPathFromIdFn)(std::uint32_t), - bool (*defaultCapeExistsFn)(), - bool (*isXuidNotchFn)(PlayerUID), - bool (*isXuidDeadmau5Fn)(PlayerUID) -) { - s_getPlayerSkinName = getPlayerSkinNameFn; - s_getPlayerSkinId = getPlayerSkinIdFn; - s_getPlayerCapeName = getPlayerCapeNameFn; - s_getPlayerCapeId = getPlayerCapeIdFn; - s_getAdditionalModelPartsForPad = getAdditionalModelPartsForPadFn; - s_setAdditionalSkinBoxes = setAdditionalSkinBoxesFn; - s_getAdditionalSkinBoxes = getAdditionalSkinBoxesFn; - s_getAdditionalModelParts = getAdditionalModelPartsFn; - s_setAdditionalSkinBoxesFromVec = setAdditionalSkinBoxesFromVecFn; - s_setAnimOverrideBitmask = setAnimOverrideBitmaskFn; - s_getAnimOverrideBitmask = getAnimOverrideBitmaskFn; - s_skinIdFromPath = skinIdFromPathFn; - s_skinPathFromId = skinPathFromIdFn; - s_defaultCapeExists = defaultCapeExistsFn; - s_isXuidNotch = isXuidNotchFn; - s_isXuidDeadmau5 = isXuidDeadmau5Fn; -} - -std::wstring getPlayerSkinName(int iPad) { - return s_getPlayerSkinName ? s_getPlayerSkinName(iPad) : L""; -} -std::uint32_t getPlayerSkinId(int iPad) { - return s_getPlayerSkinId ? s_getPlayerSkinId(iPad) : 0; -} -std::wstring getPlayerCapeName(int iPad) { - return s_getPlayerCapeName ? s_getPlayerCapeName(iPad) : L""; -} -std::uint32_t getPlayerCapeId(int iPad) { - return s_getPlayerCapeId ? s_getPlayerCapeId(iPad) : 0; -} -std::uint32_t getAdditionalModelPartsForPad(int iPad) { - return s_getAdditionalModelPartsForPad ? s_getAdditionalModelPartsForPad(iPad) : 0; -} -void setAdditionalSkinBoxes(std::uint32_t dwSkinID, SKIN_BOX* boxA, - unsigned int boxC) { - if (s_setAdditionalSkinBoxes) s_setAdditionalSkinBoxes(dwSkinID, boxA, boxC); -} -std::vector* getAdditionalSkinBoxes(std::uint32_t dwSkinID) { - return s_getAdditionalSkinBoxes ? s_getAdditionalSkinBoxes(dwSkinID) : nullptr; -} -std::vector* getAdditionalModelParts(std::uint32_t dwSkinID) { - return s_getAdditionalModelParts ? s_getAdditionalModelParts(dwSkinID) : nullptr; -} -std::vector* setAdditionalSkinBoxesFromVec( - std::uint32_t dwSkinID, std::vector* pvSkinBoxA) { - return s_setAdditionalSkinBoxesFromVec - ? s_setAdditionalSkinBoxesFromVec(dwSkinID, pvSkinBoxA) - : nullptr; -} -void setAnimOverrideBitmask(std::uint32_t dwSkinID, unsigned int bitmask) { - if (s_setAnimOverrideBitmask) s_setAnimOverrideBitmask(dwSkinID, bitmask); -} -unsigned int getAnimOverrideBitmask(std::uint32_t dwSkinID) { - return s_getAnimOverrideBitmask ? s_getAnimOverrideBitmask(dwSkinID) : 0; -} -std::uint32_t getSkinIdFromPath(const std::wstring& skin) { - return s_skinIdFromPath ? s_skinIdFromPath(skin) : 0; -} -std::wstring getSkinPathFromId(std::uint32_t skinId) { - return s_skinPathFromId ? s_skinPathFromId(skinId) : L""; -} -bool defaultCapeExists() { - return s_defaultCapeExists ? s_defaultCapeExists() : false; -} -bool isXuidNotch(PlayerUID xuid) { - return s_isXuidNotch ? s_isXuidNotch(xuid) : false; -} -bool isXuidDeadmau5(PlayerUID xuid) { - return s_isXuidDeadmau5 ? s_isXuidDeadmau5(xuid) : false; -} - -// Platform features - -static void (*s_fatalLoadError)() = nullptr; -static void (*s_setRichPresenceContext)(int, int) = nullptr; -static void (*s_captureSaveThumbnail)() = nullptr; -static void (*s_getSaveThumbnail)(std::uint8_t**, unsigned int*) = nullptr; -static void (*s_readBannedList)(int, eTMSAction, bool) = nullptr; -static void (*s_updatePlayerInfo)(std::uint8_t, int16_t, unsigned int) = nullptr; -static unsigned int (*s_getPlayerPrivileges)(std::uint8_t) = nullptr; -static void (*s_setGameSettingsDebugMask)(int, unsigned int) = nullptr; - -void initPlatformFeatures( - void (*fatalLoadErrorFn)(), - void (*setRichPresenceContextFn)(int, int), - void (*captureSaveThumbnailFn)(), - void (*getSaveThumbnailFn)(std::uint8_t**, unsigned int*), - void (*readBannedListFn)(int, eTMSAction, bool), - void (*updatePlayerInfoFn)(std::uint8_t, int16_t, unsigned int), - unsigned int (*getPlayerPrivilegesFn)(std::uint8_t), - void (*setGameSettingsDebugMaskFn)(int, unsigned int) -) { - s_fatalLoadError = fatalLoadErrorFn; - s_setRichPresenceContext = setRichPresenceContextFn; - s_captureSaveThumbnail = captureSaveThumbnailFn; - s_getSaveThumbnail = getSaveThumbnailFn; - s_readBannedList = readBannedListFn; - s_updatePlayerInfo = updatePlayerInfoFn; - s_getPlayerPrivileges = getPlayerPrivilegesFn; - s_setGameSettingsDebugMask = setGameSettingsDebugMaskFn; -} - -void fatalLoadError() { - if (s_fatalLoadError) s_fatalLoadError(); -} -void setRichPresenceContext(int iPad, int contextId) { - if (s_setRichPresenceContext) s_setRichPresenceContext(iPad, contextId); -} -void captureSaveThumbnail() { - if (s_captureSaveThumbnail) s_captureSaveThumbnail(); -} -void getSaveThumbnail(std::uint8_t** data, unsigned int* size) { - if (s_getSaveThumbnail) s_getSaveThumbnail(data, size); -} -void readBannedList(int iPad, eTMSAction action, bool bCallback) { - if (s_readBannedList) s_readBannedList(iPad, action, bCallback); -} -void updatePlayerInfo(std::uint8_t networkSmallId, int16_t playerColourIndex, - unsigned int playerPrivileges) { - if (s_updatePlayerInfo) s_updatePlayerInfo(networkSmallId, playerColourIndex, playerPrivileges); -} -unsigned int getPlayerPrivileges(std::uint8_t networkSmallId) { - return s_getPlayerPrivileges ? s_getPlayerPrivileges(networkSmallId) : 0; -} -void setGameSettingsDebugMask(int iPad, unsigned int uiVal) { - if (s_setGameSettingsDebugMask) s_setGameSettingsDebugMask(iPad, uiVal); -} - -// Schematics / terrain - -static void (*s_processSchematics)(LevelChunk*) = nullptr; -static void (*s_processSchematicsLighting)(LevelChunk*) = nullptr; -static void (*s_addTerrainFeaturePosition)(_eTerrainFeatureType, int, int) = nullptr; -static bool (*s_getTerrainFeaturePosition)(_eTerrainFeatureType, int*, int*) = nullptr; -static void (*s_loadDefaultGameRules)() = nullptr; - -void initSchematics( - void (*processSchematicsFn)(LevelChunk*), - void (*processSchematicsLightingFn)(LevelChunk*), - void (*addTerrainFeaturePositionFn)(_eTerrainFeatureType, int, int), - bool (*getTerrainFeaturePositionFn)(_eTerrainFeatureType, int*, int*), - void (*loadDefaultGameRulesFn)() -) { - s_processSchematics = processSchematicsFn; - s_processSchematicsLighting = processSchematicsLightingFn; - s_addTerrainFeaturePosition = addTerrainFeaturePositionFn; - s_getTerrainFeaturePosition = getTerrainFeaturePositionFn; - s_loadDefaultGameRules = loadDefaultGameRulesFn; -} - -void processSchematics(LevelChunk* chunk) { - if (s_processSchematics) s_processSchematics(chunk); -} -void processSchematicsLighting(LevelChunk* chunk) { - if (s_processSchematicsLighting) s_processSchematicsLighting(chunk); -} -void addTerrainFeaturePosition(_eTerrainFeatureType type, int x, int z) { - if (s_addTerrainFeaturePosition) s_addTerrainFeaturePosition(type, x, z); -} -bool getTerrainFeaturePosition(_eTerrainFeatureType type, int* pX, int* pZ) { - return s_getTerrainFeaturePosition ? s_getTerrainFeaturePosition(type, pX, pZ) : false; -} -void loadDefaultGameRules() { - if (s_loadDefaultGameRules) s_loadDefaultGameRules(); -} - -// Archive / resources - -static bool (*s_hasArchiveFile)(const std::wstring&) = nullptr; -static std::vector (*s_getArchiveFile)(const std::wstring&) = nullptr; - -void initArchive( - bool (*hasArchiveFileFn)(const std::wstring&), - std::vector (*getArchiveFileFn)(const std::wstring&) -) { - s_hasArchiveFile = hasArchiveFileFn; - s_getArchiveFile = getArchiveFileFn; -} - -bool hasArchiveFile(const std::wstring& filename) { - return s_hasArchiveFile ? s_hasArchiveFile(filename) : false; -} -std::vector getArchiveFile(const std::wstring& filename) { - return s_getArchiveFile ? s_getArchiveFile(filename) : std::vector{}; -} - -// Strings / formatting / misc queries - -static int (*s_getHTMLColour)(eMinecraftColour) = nullptr; -static std::wstring (*s_getEntityName)(EntityTypeId) = nullptr; -static const wchar_t* (*s_getGameRulesString)(const std::wstring&) = nullptr; -static unsigned int (*s_createImageTextData)(std::uint8_t*, int64_t, bool, - unsigned int, unsigned int) = nullptr; -static std::wstring (*s_getFilePath)(std::uint32_t, std::wstring, bool, - std::wstring) = nullptr; -static char* (*s_getUniqueMapName)() = nullptr; -static void (*s_setUniqueMapName)(char*) = nullptr; -static unsigned int (*s_getOpacityTimer)(int) = nullptr; -static void (*s_setOpacityTimer)(int) = nullptr; -static void (*s_tickOpacityTimer)(int) = nullptr; -static bool (*s_isInBannedLevelList)(int, PlayerUID, char*) = nullptr; -static MOJANG_DATA* (*s_getMojangDataForXuid)(PlayerUID) = nullptr; -static void (*s_debugPrintf)(const char*) = nullptr; - -void initStringsAndMisc( - int (*getHTMLColourFn)(eMinecraftColour), - std::wstring (*getEntityNameFn)(EntityTypeId), - const wchar_t* (*getGameRulesStringFn)(const std::wstring&), - unsigned int (*createImageTextDataFn)(std::uint8_t*, int64_t, bool, - unsigned int, unsigned int), - std::wstring (*getFilePathFn)(std::uint32_t, std::wstring, bool, - std::wstring), - char* (*getUniqueMapNameFn)(), - void (*setUniqueMapNameFn)(char*), - unsigned int (*getOpacityTimerFn)(int), - void (*setOpacityTimerFn)(int), - void (*tickOpacityTimerFn)(int), - bool (*isInBannedLevelListFn)(int, PlayerUID, char*), - MOJANG_DATA* (*getMojangDataForXuidFn)(PlayerUID), - void (*debugPrintfFn)(const char*) -) { - s_getHTMLColour = getHTMLColourFn; - s_getEntityName = getEntityNameFn; - s_getGameRulesString = getGameRulesStringFn; - s_createImageTextData = createImageTextDataFn; - s_getFilePath = getFilePathFn; - s_getUniqueMapName = getUniqueMapNameFn; - s_setUniqueMapName = setUniqueMapNameFn; - s_getOpacityTimer = getOpacityTimerFn; - s_setOpacityTimer = setOpacityTimerFn; - s_tickOpacityTimer = tickOpacityTimerFn; - s_isInBannedLevelList = isInBannedLevelListFn; - s_getMojangDataForXuid = getMojangDataForXuidFn; - s_debugPrintf = debugPrintfFn; -} - -int getHTMLColour(eMinecraftColour colour) { - return s_getHTMLColour ? s_getHTMLColour(colour) : 0; -} -int getHTMLColor(eMinecraftColour colour) { return getHTMLColour(colour); } -std::wstring getEntityName(EntityTypeId type) { - return s_getEntityName ? s_getEntityName(type) : L""; -} -const wchar_t* getGameRulesString(const std::wstring& key) { - return s_getGameRulesString ? s_getGameRulesString(key) : L""; -} -unsigned int createImageTextData(std::uint8_t* textMetadata, int64_t seed, - bool hasSeed, unsigned int uiHostOptions, - unsigned int uiTexturePackId) { - return s_createImageTextData - ? s_createImageTextData(textMetadata, seed, hasSeed, - uiHostOptions, uiTexturePackId) - : 0; -} -std::wstring getFilePath(std::uint32_t packId, std::wstring filename, - bool bAddDataFolder, std::wstring mountPoint) { - return s_getFilePath ? s_getFilePath(packId, filename, bAddDataFolder, mountPoint) : L""; -} -char* getUniqueMapName() { - return s_getUniqueMapName ? s_getUniqueMapName() : nullptr; -} -void setUniqueMapName(char* name) { - if (s_setUniqueMapName) s_setUniqueMapName(name); -} -unsigned int getOpacityTimer(int iPad) { - return s_getOpacityTimer ? s_getOpacityTimer(iPad) : 0; -} -void setOpacityTimer(int iPad) { - if (s_setOpacityTimer) s_setOpacityTimer(iPad); -} -void tickOpacityTimer(int iPad) { - if (s_tickOpacityTimer) s_tickOpacityTimer(iPad); -} -bool isInBannedLevelList(int iPad, PlayerUID xuid, char* levelName) { - return s_isInBannedLevelList ? s_isInBannedLevelList(iPad, xuid, levelName) : false; -} -MOJANG_DATA* getMojangDataForXuid(PlayerUID xuid) { - return s_getMojangDataForXuid ? s_getMojangDataForXuid(xuid) : nullptr; -} -void debugPrintf(const char* msg) { - if (s_debugPrintf) s_debugPrintf(msg); -} - -// Member variable access - -static DLCManager* s_dlcManager = nullptr; -static GameRuleManager* s_gameRules = nullptr; -static std::vector* s_skinNames = nullptr; -static std::vector* s_terrainFeatures = nullptr; - -void initMemberAccess( - DLCManager* dlcManager, - GameRuleManager* gameRules, - std::vector* skinNames, - std::vector* terrainFeatures -) { - s_dlcManager = dlcManager; - s_gameRules = gameRules; - s_skinNames = skinNames; - s_terrainFeatures = terrainFeatures; -} - -DLCManager& getDLCManager() { - assert(s_dlcManager); - return *s_dlcManager; -} -GameRuleManager& getGameRules() { - assert(s_gameRules); - return *s_gameRules; -} -std::vector& getSkinNames() { - assert(s_skinNames); - return *s_skinNames; -} -std::vector& getTerrainFeatures() { - assert(s_terrainFeatures); - return *s_terrainFeatures; -} - -// Menu service - -static IMenuService* s_menuService = nullptr; - -void initMenuService(IMenuService* service) { s_menuService = service; } - -IMenuService& menus() { - assert(s_menuService); - return *s_menuService; -} - -} // namespace GameServices diff --git a/targets/minecraft/GameServices.h b/targets/minecraft/GameServices.h deleted file mode 100644 index 3cb714849..000000000 --- a/targets/minecraft/GameServices.h +++ /dev/null @@ -1,305 +0,0 @@ -#pragma once - -#include -#include -#include - -// Forward declarations - minecraft types -class LevelGenerationOptions; -class LevelRuleset; -class LevelChunk; -class ModelPart; - -// Forward declarations - app types (opaque pointers only) -class DLCManager; -class GameRuleManager; - -// SKIN_BOX, FEATURE_DATA, MOJANG_DATA are C-style typedef'd structs -// that cannot be forward-declared. Include the lightweight headers. -#include "minecraft/client/SkinBox.h" -#include "app/common/App_structs.h" - -// Enums needed by callers - pulled from app layer. -// These are small POD enums safe to include transitively. -#include "app/common/App_enums.h" -#include "platform/PlatformTypes.h" // PlayerUID -#include "minecraft/network/packet/DisconnectPacket.h" // eDisconnectReason -#include "minecraft/client/IMenuService.h" - -// eINSTANCEOF lives in java/Class.h which is heavyweight. -// We use int here and cast at init/call sites. -using EntityTypeId = int; - -namespace GameServices { -using LevelGenOptsFn = LevelGenerationOptions* (*)(); -using GameRuleDefsFn = LevelRuleset* (*)(); - -void initLevelGen(LevelGenOptsFn levelGenOpts, GameRuleDefsFn gameRuleDefs); -[[nodiscard]] LevelGenerationOptions* getLevelGenerationOptions(); -[[nodiscard]] LevelRuleset* getGameRuleDefinitions(); -using AddTexFn = void (*)(const std::wstring&, std::uint8_t*, unsigned int); -using RemoveTexFn = void (*)(const std::wstring&); -using GetTexDetailsFn = void (*)(const std::wstring&, std::uint8_t**, - unsigned int*); -using HasTexFn = bool (*)(const std::wstring&); - -void initTextureCache(AddTexFn add, RemoveTexFn remove, - GetTexDetailsFn getDetails, HasTexFn has); -void addMemoryTextureFile(const std::wstring& name, std::uint8_t* data, - unsigned int size); -void removeMemoryTextureFile(const std::wstring& name); -void getMemFileDetails(const std::wstring& name, std::uint8_t** data, - unsigned int* size); -[[nodiscard]] bool isFileInMemoryTextures(const std::wstring& name); -using GetSettingsFn = unsigned char (*)(int iPad, int setting); -using GetSettingsNoArgFn = unsigned char (*)(int setting); - -void initPlayerSettings(GetSettingsFn getSettings, - GetSettingsNoArgFn getSettingsNoArg); -[[nodiscard]] unsigned char getGameSettings(int iPad, int setting); -[[nodiscard]] unsigned char getGameSettings(int setting); -using AppTimeFn = float (*)(); - -void initAppTime(AppTimeFn fn); -[[nodiscard]] float getAppTime(); - -// Game state - -void initGameState( - bool (*getGameStarted)(), - void (*setGameStarted)(bool), - bool (*getTutorialMode)(), - void (*setTutorialMode)(bool), - bool (*isAppPaused)(), - int (*getLocalPlayerCount)(), - bool (*autosaveDue)(), - void (*setAutosaveTimerTime)(), - int64_t (*secondsToAutosave)(), - void (*setDisconnectReason)(DisconnectPacket::eDisconnectReason), - void (*lockSaveNotify)(), - void (*unlockSaveNotify)(), - bool (*getResetNether)(), - bool (*getUseDPadForDebug)(), - bool (*getWriteSavesToFolderEnabled)(), - bool (*isLocalMultiplayerAvailable)(), - bool (*dlcInstallPending)(), - bool (*dlcInstallProcessCompleted)(), - bool (*canRecordStatsAndAchievements)(), - bool (*getTMSGlobalFileListRead)(), - void (*setRequiredTexturePackID)(std::uint32_t), - void (*setSpecialTutorialCompletionFlag)(int iPad, int index), - void (*setBanListCheck)(int iPad, bool), - bool (*getBanListCheck)(int iPad), - unsigned int (*getGameNewWorldSize)(), - unsigned int (*getGameNewWorldSizeUseMoat)(), - unsigned int (*getGameNewHellScale)() -); - -[[nodiscard]] bool getGameStarted(); -void setGameStarted(bool val); -[[nodiscard]] bool getTutorialMode(); -void setTutorialMode(bool val); -[[nodiscard]] bool isAppPaused(); -[[nodiscard]] int getLocalPlayerCount(); -[[nodiscard]] bool autosaveDue(); -void setAutosaveTimerTime(); -[[nodiscard]] int64_t secondsToAutosave(); -void setDisconnectReason(DisconnectPacket::eDisconnectReason reason); -void lockSaveNotification(); -void unlockSaveNotification(); -[[nodiscard]] bool getResetNether(); -[[nodiscard]] bool getUseDPadForDebug(); -[[nodiscard]] bool getWriteSavesToFolderEnabled(); -[[nodiscard]] bool isLocalMultiplayerAvailable(); -[[nodiscard]] bool dlcInstallPending(); -[[nodiscard]] bool dlcInstallProcessCompleted(); -[[nodiscard]] bool canRecordStatsAndAchievements(); -[[nodiscard]] bool getTMSGlobalFileListRead(); -void setRequiredTexturePackID(std::uint32_t id); -void setSpecialTutorialCompletionFlag(int iPad, int index); -void setBanListCheck(int iPad, bool val); -[[nodiscard]] bool getBanListCheck(int iPad); -[[nodiscard]] unsigned int getGameNewWorldSize(); -[[nodiscard]] unsigned int getGameNewWorldSizeUseMoat(); -[[nodiscard]] unsigned int getGameNewHellScale(); - -// UI dispatch - -void initUIDispatch( - void (*setAction)(int iPad, eXuiAction action, void* param), - void (*setXuiServerAction)(int iPad, eXuiServerAction action, void* param), - eXuiAction (*getXuiAction)(int iPad), - eXuiServerAction (*getXuiServerAction)(int iPad), - void* (*getXuiServerActionParam)(int iPad), - void (*setGlobalXuiAction)(eXuiAction action), - void (*handleButtonPresses)(), - void (*setTMSAction)(int iPad, eTMSAction action) -); - -void setAction(int iPad, eXuiAction action, void* param = nullptr); -void setXuiServerAction(int iPad, eXuiServerAction action, - void* param = nullptr); -[[nodiscard]] eXuiAction getXuiAction(int iPad); -[[nodiscard]] eXuiServerAction getXuiServerAction(int iPad); -[[nodiscard]] void* getXuiServerActionParam(int iPad); -void setGlobalXuiAction(eXuiAction action); -void handleButtonPresses(); -void setTMSAction(int iPad, eTMSAction action); - -// Skin / cape / animation - -void initSkinCape( - 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 (*getAdditionalModelPartsForPad)(int iPad), - void (*setAdditionalSkinBoxes)(std::uint32_t dwSkinID, SKIN_BOX* boxA, - unsigned int boxC), - std::vector* (*getAdditionalSkinBoxes)(std::uint32_t dwSkinID), - std::vector* (*getAdditionalModelParts)(std::uint32_t dwSkinID), - std::vector* (*setAdditionalSkinBoxesFromVec)( - std::uint32_t dwSkinID, std::vector* pvSkinBoxA), - void (*setAnimOverrideBitmask)(std::uint32_t dwSkinID, unsigned int bitmask), - unsigned int (*getAnimOverrideBitmask)(std::uint32_t dwSkinID), - std::uint32_t (*skinIdFromPath)(const std::wstring& skin), - std::wstring (*skinPathFromId)(std::uint32_t skinId), - bool (*defaultCapeExists)(), - bool (*isXuidNotch)(PlayerUID xuid), - bool (*isXuidDeadmau5)(PlayerUID xuid) -); - -[[nodiscard]] std::wstring getPlayerSkinName(int iPad); -[[nodiscard]] std::uint32_t getPlayerSkinId(int iPad); -[[nodiscard]] std::wstring getPlayerCapeName(int iPad); -[[nodiscard]] std::uint32_t getPlayerCapeId(int iPad); -[[nodiscard]] std::uint32_t getAdditionalModelPartsForPad(int iPad); -void setAdditionalSkinBoxes(std::uint32_t dwSkinID, SKIN_BOX* boxA, - unsigned int boxC); -[[nodiscard]] std::vector* getAdditionalSkinBoxes( - std::uint32_t dwSkinID); -[[nodiscard]] std::vector* getAdditionalModelParts( - std::uint32_t dwSkinID); -std::vector* setAdditionalSkinBoxesFromVec( - std::uint32_t dwSkinID, std::vector* pvSkinBoxA); -void setAnimOverrideBitmask(std::uint32_t dwSkinID, unsigned int bitmask); -[[nodiscard]] unsigned int getAnimOverrideBitmask(std::uint32_t dwSkinID); -[[nodiscard]] std::uint32_t getSkinIdFromPath(const std::wstring& skin); -[[nodiscard]] std::wstring getSkinPathFromId(std::uint32_t skinId); -[[nodiscard]] bool defaultCapeExists(); -[[nodiscard]] bool isXuidNotch(PlayerUID xuid); -[[nodiscard]] bool isXuidDeadmau5(PlayerUID xuid); - -// Platform features - -void initPlatformFeatures( - void (*fatalLoadError)(), - void (*setRichPresenceContext)(int iPad, int contextId), - void (*captureSaveThumbnail)(), - void (*getSaveThumbnail)(std::uint8_t**, unsigned int*), - void (*readBannedList)(int iPad, eTMSAction action, bool bCallback), - void (*updatePlayerInfo)(std::uint8_t networkSmallId, - int16_t playerColourIndex, - unsigned int playerPrivileges), - unsigned int (*getPlayerPrivileges)(std::uint8_t networkSmallId), - void (*setGameSettingsDebugMask)(int iPad, unsigned int uiVal) -); - -void fatalLoadError(); -void setRichPresenceContext(int iPad, int contextId); -void captureSaveThumbnail(); -void getSaveThumbnail(std::uint8_t** data, unsigned int* size); -void readBannedList(int iPad, eTMSAction action = (eTMSAction)0, - bool bCallback = false); -void updatePlayerInfo(std::uint8_t networkSmallId, int16_t playerColourIndex, - unsigned int playerPrivileges); -[[nodiscard]] unsigned int getPlayerPrivileges(std::uint8_t networkSmallId); -void setGameSettingsDebugMask(int iPad, unsigned int uiVal); - -// Schematics / terrain - -void initSchematics( - void (*processSchematics)(LevelChunk* chunk), - void (*processSchematicsLighting)(LevelChunk* chunk), - void (*addTerrainFeaturePosition)(_eTerrainFeatureType, int, int), - bool (*getTerrainFeaturePosition)(_eTerrainFeatureType, int*, int*), - void (*loadDefaultGameRules)() -); - -void processSchematics(LevelChunk* chunk); -void processSchematicsLighting(LevelChunk* chunk); -void addTerrainFeaturePosition(_eTerrainFeatureType type, int x, int z); -[[nodiscard]] bool getTerrainFeaturePosition(_eTerrainFeatureType type, - int* pX, int* pZ); -void loadDefaultGameRules(); - -// Archive / resources - -void initArchive( - bool (*hasArchiveFile)(const std::wstring&), - std::vector (*getArchiveFile)(const std::wstring&) -); - -[[nodiscard]] bool hasArchiveFile(const std::wstring& filename); -[[nodiscard]] std::vector getArchiveFile( - const std::wstring& filename); - -// Strings / formatting / misc queries - -void initStringsAndMisc( - int (*getHTMLColour)(eMinecraftColour), - std::wstring (*getEntityName)(EntityTypeId), - const wchar_t* (*getGameRulesString)(const std::wstring&), - unsigned int (*createImageTextData)(std::uint8_t*, int64_t, bool, - unsigned int, unsigned int), - std::wstring (*getFilePath)(std::uint32_t, std::wstring, bool, - std::wstring), - char* (*getUniqueMapName)(), - void (*setUniqueMapName)(char*), - unsigned int (*getOpacityTimer)(int iPad), - void (*setOpacityTimer)(int iPad), - void (*tickOpacityTimer)(int iPad), - bool (*isInBannedLevelList)(int iPad, PlayerUID xuid, char* levelName), - MOJANG_DATA* (*getMojangDataForXuid)(PlayerUID xuid), - void (*debugPrintf)(const char*) -); - -[[nodiscard]] int getHTMLColour(eMinecraftColour colour); -[[nodiscard]] int getHTMLColor(eMinecraftColour colour); -[[nodiscard]] std::wstring getEntityName(EntityTypeId type); -[[nodiscard]] const wchar_t* getGameRulesString(const std::wstring& key); -[[nodiscard]] unsigned int createImageTextData(std::uint8_t* textMetadata, - int64_t seed, bool hasSeed, - unsigned int uiHostOptions, - unsigned int uiTexturePackId); -[[nodiscard]] std::wstring getFilePath(std::uint32_t packId, - std::wstring filename, - bool bAddDataFolder, - std::wstring mountPoint = L"TPACK:"); -[[nodiscard]] char* getUniqueMapName(); -void setUniqueMapName(char* name); -[[nodiscard]] unsigned int getOpacityTimer(int iPad); -void setOpacityTimer(int iPad); -void tickOpacityTimer(int iPad); -[[nodiscard]] bool isInBannedLevelList(int iPad, PlayerUID xuid, - char* levelName); -[[nodiscard]] MOJANG_DATA* getMojangDataForXuid(PlayerUID xuid); -void debugPrintf(const char* msg); - -// Member variable access (opaque pointers) - -void initMemberAccess( - DLCManager* dlcManager, - GameRuleManager* gameRules, - std::vector* skinNames, - std::vector* terrainFeatures -); - -[[nodiscard]] DLCManager& getDLCManager(); -[[nodiscard]] GameRuleManager& getGameRules(); -[[nodiscard]] std::vector& getSkinNames(); -[[nodiscard]] std::vector& getTerrainFeatures(); -void initMenuService(IMenuService* service); -[[nodiscard]] IMenuService& menus(); - -} // namespace GameServices 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..e3910cfb7 --- /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; + [[nodiscard]] 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/minecraft/client/BufferedImage.cpp b/targets/minecraft/client/BufferedImage.cpp index d3080a7b4..49d64c33a 100644 --- a/targets/minecraft/client/BufferedImage.cpp +++ b/targets/minecraft/client/BufferedImage.cpp @@ -10,7 +10,7 @@ #include "app/common/DLC/DLCFile.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" -#include "minecraft/GameServices.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 (GameServices::hasArchiveFile(archiveKey)) { - std::vector ba = GameServices::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) GameServices::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) GameServices::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 { - GameServices::fatalLoadError(); + gameServices().fatalLoadError(); } } diff --git a/targets/minecraft/client/Minecraft.cpp b/targets/minecraft/client/Minecraft.cpp index 290fbf64b..a83545736 100644 --- a/targets/minecraft/client/Minecraft.cpp +++ b/targets/minecraft/client/Minecraft.cpp @@ -1,7 +1,5 @@ -#include "minecraft/GameServices.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/IMenuService.h" -#include "minecraft/util/DebugSettings.h" -#include "minecraft/GameHostOptions.h" #include "minecraft/util/Log.h" #include "Minecraft.h" @@ -19,7 +17,7 @@ #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/Audio/SoundEngine.h" #include "app/common/DLC/DLCManager.h" #include "app/common/Network/GameNetworkManager.h" @@ -284,7 +282,7 @@ void Minecraft::clearConnectionFailed() { m_connectionFailed[i] = false; m_connectionFailedReason[i] = DisconnectPacket::eDisconnect_None; } - GameServices::setDisconnectReason(DisconnectPacket::eDisconnect_None); + gameServices().setDisconnectReason(DisconnectPacket::eDisconnect_None); } void Minecraft::connectTo(const std::wstring& server, int port) { @@ -718,7 +716,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 (GameServices::getGameSettings(InputManager.GetPrimaryPad(), + if (gameServices().getGameSettings(InputManager.GetPrimaryPad(), eGameSetting_SplitScreenVertical)) { localplayers[i]->m_iScreenSection = C4JRender::VIEWPORT_TYPE_SPLIT_LEFT + found; @@ -741,7 +739,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 (GameServices::getGameStarted()) { + if (gameServices().getGameStarted()) { if ((localplayers[i]->m_iScreenSection >= C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT) && (localplayers[i]->m_iScreenSection <= @@ -790,7 +788,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 (GameServices::getGameStarted()) ui.UpdatePlayerBasePositions(); + if (gameServices().getGameStarted()) ui.UpdatePlayerBasePositions(); } // Add a temporary player so that the viewports get re-arranged, and add the @@ -872,7 +870,7 @@ std::shared_ptr Minecraft::createExtraLocalPlayer( mpLevel->addClientConnection(clientConnection); } - if (GameServices::getTutorialMode()) { + if (gameServices().getTutorialMode()) { localgameModes[idx] = new FullTutorialMode(idx, this, clientConnection); } else { @@ -926,7 +924,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(GameServices::getGameStarted()) + // if(gameServices().getGameStarted()) // { // ui.CloseUIScenes(idx); // } @@ -1069,7 +1067,7 @@ void Minecraft::run_middle() { // set the timer bAutosaveTimerSet=true; - GameServices::setAutosaveTimerTime(); + gameServices().setAutosaveTimerTime(); } else*/ { @@ -1078,7 +1076,7 @@ void Minecraft::run_middle() { // player has a app action running , or has any crafting // or containers open, don't autosave if (!StorageManager.GetSaveDisabled() && - (GameServices::getXuiAction(InputManager.GetPrimaryPad()) == + (gameServices().getXuiAction(InputManager.GetPrimaryPad()) == eAppAction_Idle)) { if (!ui.IsPauseMenuDisplayed( InputManager.GetPrimaryPad()) && @@ -1087,7 +1085,7 @@ void Minecraft::run_middle() { // check if the autotimer countdown has reached // zero unsigned char ucAutosaveVal = - GameServices::getGameSettings( + gameServices().getGameSettings( InputManager.GetPrimaryPad(), eGameSetting_Autosave); bool bTrialTexturepack = false; @@ -1116,7 +1114,7 @@ void Minecraft::run_middle() { // check whether we need to save this tick if ((ucAutosaveVal != 0) && !bTrialTexturepack) { - if (GameServices::autosaveDue()) { + if (gameServices().autosaveDue()) { // disable the autosave countdown ui.ShowAutosaveCountdownTimer(false); @@ -1124,10 +1122,10 @@ void Minecraft::run_middle() { Log::info("+++++++++++\n"); Log::info("+++Autosave\n"); Log::info("+++++++++++\n"); - GameServices::setAction( + gameServices().setAction( InputManager.GetPrimaryPad(), eAppAction_AutosaveSaveGame); - // GameServices::setAutosaveTimerTime(); + // gameServices().setAutosaveTimerTime(); #if !defined(_CONTENT_PACKAGE) { // print the time @@ -1150,7 +1148,7 @@ void Minecraft::run_middle() { #endif } else { int64_t uiTimeToAutosave = - GameServices::secondsToAutosave(); + gameServices().secondsToAutosave(); if (uiTimeToAutosave < 6) { ui.ShowAutosaveCountdownTimer(true); @@ -1171,14 +1169,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] && (GameServices::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()) { - GameServices::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 @@ -1186,15 +1184,15 @@ void Minecraft::run_middle() { g_NetworkManager.GetHostPlayer(); PlayerUID xuid = pHostPlayer->GetUID(); - if (GameServices::isInBannedLevelList( - i, xuid, GameServices::getUniqueMapName())) { + if (gameServices().isInBannedLevelList( + i, xuid, gameServices().getUniqueMapName())) { // put up a message box asking if the player // would like to unban this level 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 - GameServices::setAction(i, eAppAction_LevelInBanLevelList, + gameServices().setAction(i, eAppAction_LevelInBanLevelList, (void*)true); } } @@ -1202,10 +1200,10 @@ void Minecraft::run_middle() { } if (!ProfileManager.IsSystemUIDisplayed() && - GameServices::dlcInstallProcessCompleted() && - !GameServices::dlcInstallPending() && - GameServices::getDLCManager().NeedsCorruptCheck()) { - GameServices::getDLCManager().checkForCorruptDLCAndAlert(); + gameServices().dlcInstallProcessCompleted() && + !gameServices().dlcInstallPending() && + gameServices().dlcNeedsCorruptCheck()) { + gameServices().dlcCheckForCorrupt(); } // When we go into the first loaded level, check if the console @@ -1218,7 +1216,7 @@ void Minecraft::run_middle() { if (iFirstTimeCountdown == 0) { bFirstTimeIntoGame = false; - if (GameServices::isLocalMultiplayerAvailable()) { + if (gameServices().isLocalMultiplayerAvailable()) { for (int i = 0; i < XUSER_MAX_COUNT; i++) { if ((localplayers[i] == nullptr) && InputManager.IsPadConnected(i)) { @@ -1297,7 +1295,7 @@ void Minecraft::run_middle() { 1LL << MINECRAFT_ACTION_GAME_INFO; #if !defined(_FINAL_BUILD) - if (DebugSettings::isOn() && GameServices::getUseDPadForDebug()) { + if (gameServices().debugSettingsOn() && gameServices().getUseDPadForDebug()) { localplayers[i]->ullDpad_last = 0; localplayers[i]->ullDpad_this = 0; localplayers[i]->ullDpad_filtered = 0; @@ -1375,7 +1373,7 @@ void Minecraft::run_middle() { // || InputManager.ButtonPressed(i, // MINECRAFT_ACTION_ACTION)) { - GameServices::setOpacityTimer(i); + gameServices().setOpacityTimer(i); } } else { // 4J Stu - This doesn't make any sense with the way we @@ -1542,7 +1540,7 @@ void Minecraft::run_middle() { // again if (i != 0) { InputManager.Tick(); - GameServices::handleButtonPresses(); + gameServices().handleButtonPresses(); } ticks++; @@ -1662,12 +1660,12 @@ void Minecraft::run_middle() { if (i == iPrimaryPad) { // check to see if we need to capture a // screenshot for the save game thumbnail - switch (GameServices::getXuiAction(i)) { + switch (gameServices().getXuiAction(i)) { case eAppAction_ExitWorldCapturedThumbnail: case eAppAction_SaveGameCapturedThumbnail: case eAppAction_AutosaveSaveGameCapturedThumbnail: // capture the save thumbnail - GameServices::captureSaveThumbnail(); + gameServices().captureSaveThumbnail(); break; default: break; @@ -1780,7 +1778,7 @@ void Minecraft::run_middle() { g_NetworkManager.GetPlayerCount() == 1 && screen != nullptr && screen->isPauseScreen(); #else - pause = GameServices::isAppPaused(); + pause = gameServices().isAppPaused(); #endif #if !defined(_CONTENT_PACKAGE) @@ -2015,7 +2013,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) - GameServices::tickOpacityTimer(iPad); + gameServices().tickOpacityTimer(iPad); // 4J added if (bFirst) levelRenderer->destroyedTileManager->tick(); @@ -3040,7 +3038,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { // have the // privilege { - if (GameHostOptions::get( + if (gameServices().getGameHostOption( eGameHostOption_PvP) && player->isAllowedToAttackPlayers()) { *piAction = IDS_TOOLTIPS_HIT; @@ -3366,7 +3364,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { } } - if (DebugSettings::isOn()) { + if (gameServices().debugSettingsOn()) { if (player->ullButtonsPressed & (1LL << MINECRAFT_ACTION_CHANGE_SKIN)) { player->ChangePlayerSkin(); @@ -3376,7 +3374,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { if (player->missTime > 0) player->missTime--; #if defined(_DEBUG_MENUS_ENABLED) - if (DebugSettings::isOn()) { + if (gameServices().debugSettingsOn()) { // 4J-PB - debugoverlay for primary player only if (iPad == InputManager.GetPrimaryPad()) { if ((player->ullButtonsPressed & @@ -3393,7 +3391,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { if ((player->ullButtonsPressed & (1LL << MINECRAFT_ACTION_SPAWN_CREEPER)) && - DebugSettings::mobsDontAttack()) { + gameServices().debugMobsDontAttack()) { // shared_ptr mob = // std::dynamic_pointer_cast(Creeper::_class->newInstance( // level )); shared_ptr mob = @@ -3437,7 +3435,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { #if defined(ENABLE_JAVA_GUIS) setScreen(new InventoryScreen(player)); #else - GameServices::menus().openInventory(iPad, std::static_pointer_cast(player)); + gameServices().menus().openInventory(iPad, std::static_pointer_cast(player)); #endif } @@ -3458,7 +3456,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { setScreen(new CreativeInventoryScreen(player)); } #else - GameServices::menus().openCreative(iPad, std::static_pointer_cast(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 @@ -3475,7 +3473,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { &hitResult->pos, false, &usedItem); } else { ui.PlayUISFX(eSFX_Press); - GameServices::menus().openCrafting2x2(iPad, std::static_pointer_cast(player)); + gameServices().menus().openCrafting2x2(iPad, std::static_pointer_cast(player)); } #endif } @@ -3543,9 +3541,9 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { // printf("Input Detected!\n"); // // // see if we can react to this - // if(GameServices::getXuiAction(iPad)==eAppAction_Idle) + // if(gameServices().getXuiAction(iPad)==eAppAction_Idle) // { - // GameServices::setAction(iPad,eAppAction_DebugText,(void*)wchInput); + // gameServices().setAction(iPad,eAppAction_DebugText,(void*)wchInput); // } // } // } @@ -3972,7 +3970,7 @@ void Minecraft::fileDownloaded(const std::wstring& name, File* file) { std::wstring Minecraft::gatherStats1() { // return levelRenderer->gatherStats1(); return L"Time to autosave: " + - toWString(GameServices::secondsToAutosave()) + L"s"; + toWString(gameServices().secondsToAutosave()) + L"s"; } std::wstring Minecraft::gatherStats2() { @@ -4045,7 +4043,7 @@ void Minecraft::respawnPlayer(int iPad, int dimension, int newEntityId) { } // Set the animation override if the skin has one - std::uint32_t dwSkinID = GameServices::getSkinIdFromPath(player->customTextureUrl); + std::uint32_t dwSkinID = gameServices().getSkinIdFromPath(player->customTextureUrl); if (GET_IS_DLC_SKIN_FROM_BITMASK(dwSkinID)) { player->setAnimOverrideBitmask( player->getSkinAnimOverrideBitmask(dwSkinID)); @@ -4059,14 +4057,14 @@ void Minecraft::respawnPlayer(int iPad, int dimension, int newEntityId) { createPrimaryLocalPlayer(iPad); // update the debugoptions - GameServices::setGameSettingsDebugMask(InputManager.GetPrimaryPad(), - DebugSettings::getMask(-1, true)); + gameServices().setGameSettingsDebugMask(InputManager.GetPrimaryPad(), + gameServices().debugGetMask(-1, true)); } else { storeExtraLocalPlayer(iPad); } player->setShowOnMaps( - GameHostOptions::get(eGameHostOption_Gamertags) != 0 ? true : false); + gameServices().getGameHostOption(eGameHostOption_Gamertags) != 0 ? true : false); player->resetPos(); level->addEntity(player); @@ -4208,7 +4206,7 @@ void Minecraft::main() { User::staticCtor(); Tutorial::staticCtor(); ColourTable::staticCtor(); - GameServices::loadDefaultGameRules(); + gameServices().loadDefaultGameRules(); #if defined(_LARGE_WORLDS) LevelRenderer::staticCtor(); @@ -4436,7 +4434,7 @@ bool Minecraft::isTutorial() { void Minecraft::playerStartedTutorial(int iPad) { // If the app doesn't think we are in a tutorial mode then just ignore this // add - if (GameServices::getTutorialMode()) + if (gameServices().getTutorialMode()) m_inFullTutorialBits = m_inFullTutorialBits | (1 << iPad); } @@ -4444,13 +4442,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) { - GameServices::setTutorialMode(false); + gameServices().setTutorialMode(false); return; } m_inFullTutorialBits = m_inFullTutorialBits & ~(1 << iPad); if (m_inFullTutorialBits == 0) { - GameServices::setTutorialMode(false); + gameServices().setTutorialMode(false); } } diff --git a/targets/minecraft/client/gui/CreateWorldScreen.cpp b/targets/minecraft/client/gui/CreateWorldScreen.cpp index 61e16b7ff..b5facb94f 100644 --- a/targets/minecraft/client/gui/CreateWorldScreen.cpp +++ b/targets/minecraft/client/gui/CreateWorldScreen.cpp @@ -1,5 +1,4 @@ -#include "minecraft/GameServices.h" -#include "minecraft/GameHostOptions.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Log.h" #include "CreateWorldScreen.h" @@ -13,7 +12,7 @@ #include "Button.h" #include "EditBox.h" #include "MessageScreen.h" -#include "app/common/App_enums.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" @@ -253,38 +252,38 @@ void CreateWorldScreen::buttonClicked(Button* button) { param->texturePackId = 0; param->settings = 0; - GameHostOptions::set(eGameHostOption_Difficulty, + gameServices().setGameHostOption(eGameHostOption_Difficulty, minecraft->options->difficulty); - GameHostOptions::set(eGameHostOption_FriendsOfFriends, + gameServices().setGameHostOption(eGameHostOption_FriendsOfFriends, moreOptionsParams->bAllowFriendsOfFriends); - GameHostOptions::set(eGameHostOption_Gamertags, 1); - GameHostOptions::set(eGameHostOption_BedrockFog, 0); - GameHostOptions::set(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()); - GameHostOptions::set(eGameHostOption_LevelType, + gameServices().setGameHostOption(eGameHostOption_LevelType, moreOptionsParams->bFlatWorld); - GameHostOptions::set(eGameHostOption_Structures, + gameServices().setGameHostOption(eGameHostOption_Structures, moreOptionsParams->bStructures); - GameHostOptions::set(eGameHostOption_BonusChest, + gameServices().setGameHostOption(eGameHostOption_BonusChest, moreOptionsParams->bBonusChest); - GameHostOptions::set(eGameHostOption_PvP, moreOptionsParams->bPVP); - GameHostOptions::set(eGameHostOption_TrustPlayers, + gameServices().setGameHostOption(eGameHostOption_PvP, moreOptionsParams->bPVP); + gameServices().setGameHostOption(eGameHostOption_TrustPlayers, moreOptionsParams->bTrust); - GameHostOptions::set(eGameHostOption_FireSpreads, + gameServices().setGameHostOption(eGameHostOption_FireSpreads, moreOptionsParams->bFireSpreads); - GameHostOptions::set(eGameHostOption_TNT, moreOptionsParams->bTNT); - GameHostOptions::set(eGameHostOption_HostCanFly, + gameServices().setGameHostOption(eGameHostOption_TNT, moreOptionsParams->bTNT); + gameServices().setGameHostOption(eGameHostOption_HostCanFly, moreOptionsParams->bHostPrivileges); - GameHostOptions::set(eGameHostOption_HostCanChangeHunger, + gameServices().setGameHostOption(eGameHostOption_HostCanChangeHunger, moreOptionsParams->bHostPrivileges); - GameHostOptions::set(eGameHostOption_HostCanBeInvisible, + gameServices().setGameHostOption(eGameHostOption_HostCanBeInvisible, moreOptionsParams->bHostPrivileges); - GameHostOptions::set(eGameHostOption_CheatsEnabled, + gameServices().setGameHostOption(eGameHostOption_CheatsEnabled, moreOptionsParams->bHostPrivileges); - param->settings = GameHostOptions::get(eGameHostOption_All); + param->settings = gameServices().getGameHostOption(eGameHostOption_All); param->xzSize = LEVEL_MAX_WIDTH; param->hellScale = HELL_LEVEL_MAX_SCALE; @@ -297,7 +296,7 @@ void CreateWorldScreen::buttonClicked(Button* button) { loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; loadingParams->lpParam = param; - GameServices::setAutosaveTimerTime(); + gameServices().setAutosaveTimerTime(); UIFullscreenProgressCompletionData* completionData = new UIFullscreenProgressCompletionData(); diff --git a/targets/minecraft/client/gui/Gui.cpp b/targets/minecraft/client/gui/Gui.cpp index 891b438c1..bf7c23d0a 100644 --- a/targets/minecraft/client/gui/Gui.cpp +++ b/targets/minecraft/client/gui/Gui.cpp @@ -1,5 +1,4 @@ -#include "minecraft/GameServices.h" -#include "minecraft/locale/Strings.h" +#include "minecraft/IGameServices.h" #include "Gui.h" #include @@ -9,7 +8,7 @@ #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" @@ -114,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 = GameServices::getGameSettings(iPad, eGameSetting_UISize) + 2; + guiScale = gameServices().getGameSettings(iPad, eGameSetting_UISize) + 2; } else { guiScale = - GameServices::getGameSettings(iPad, eGameSetting_UISizeSplitscreen) + 2; + gameServices().getGameSettings(iPad, eGameSetting_UISizeSplitscreen) + 2; } ScreenSizeCalculator ssc(minecraft->options, minecraft->width, @@ -248,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) && - !(GameServices::getXuiAction(iPad) == + !(gameServices().getXuiAction(iPad) == eAppAction_AutosaveSaveGameCapturedThumbnail); // if tooltips are off, set the y offset to zero - if (GameServices::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; @@ -276,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 (GameServices::getGameSettings(iPad, eGameSetting_DisplayHUD) == 0) { + if (gameServices().getGameSettings(iPad, eGameSetting_DisplayHUD) == 0) { bDisplayGui = false; } @@ -335,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 = GameServices::getGameSettings( + unsigned char ucAlpha = gameServices().getGameSettings( InputManager.GetPrimaryPad(), eGameSetting_InterfaceOpacity); // If the user has started to navigate their quickselect bar, ignore the @@ -343,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 = GameServices::getOpacityTimer(iPad); + unsigned int uiOpacityTimer = gameServices().getOpacityTimer(iPad); if (uiOpacityTimer != 0) { if (uiOpacityTimer < 10) { float fStep = (80.0f - (float)ucAlpha) / 10.0f; @@ -730,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 (GameServices::getGameSettings(iPad, eGameSetting_AnimatedCharacter)) { + if (gameServices().getGameSettings(iPad, eGameSetting_AnimatedCharacter)) { // int playerIdx = minecraft->player->GetXboxPad(); static int characterDisplayTimer[4] = {0}; @@ -979,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 < GameServices::getTerrainFeatures().size(); i++) { - FEATURE_DATA* pFeatureData = GameServices::getTerrainFeatures()[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", " + @@ -1467,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 && - GameServices::getGameSettings(i, eGameSetting_DeathMessages) == 0)) { + gameServices().getGameSettings(i, eGameSetting_DeathMessages) == 0)) { guiMessages[i].insert(guiMessages[i].begin(), GuiMessage(string)); while (guiMessages[i].size() > 50) { @@ -1476,7 +1475,7 @@ void Gui::addMessage(const std::wstring& _string, int iPad, } } } else if (!(bIsDeathMessage && - GameServices::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(); @@ -1511,7 +1510,7 @@ float Gui::getJukeboxOpacity(int iPad) { void Gui::setNowPlaying(const std::wstring& string) { // overlayMessageString = L"Now playing: " + string; - overlayMessageString = Strings::get(IDS_NOWPLAYING) + string; + overlayMessageString = gameServices().getString(IDS_NOWPLAYING) + string; overlayMessageTime = 20 * 3; animateOverlayMessageColor = true; } @@ -1519,7 +1518,7 @@ void Gui::setNowPlaying(const std::wstring& string) { void Gui::displayClientMessage(int messageId, int iPad) { // Language *language = Language::getInstance(); std::wstring languageString = - Strings::get(messageId); // language->getElement(messageId); + gameServices().getString(messageId); // language->getElement(messageId); addMessage(languageString, iPad); } diff --git a/targets/minecraft/client/gui/Minimap.cpp b/targets/minecraft/client/gui/Minimap.cpp index f37182957..73d939e0e 100644 --- a/targets/minecraft/client/gui/Minimap.cpp +++ b/targets/minecraft/client/gui/Minimap.cpp @@ -9,7 +9,7 @@ #include "platform/sdl2/Render.h" #include "Font.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/Colours/ColourTable.h" #include "minecraft/client/BufferedImage.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/minecraft/client/gui/PauseScreen.cpp b/targets/minecraft/client/gui/PauseScreen.cpp index 038c26c04..1f11ea04f 100644 --- a/targets/minecraft/client/gui/PauseScreen.cpp +++ b/targets/minecraft/client/gui/PauseScreen.cpp @@ -1,4 +1,4 @@ -#include "minecraft/GameServices.h" +#include "minecraft/IGameServices.h" #include "PauseScreen.h" #include @@ -11,7 +11,7 @@ #include "platform/sdl2/Input.h" #include "Button.h" #include "MessageScreen.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/Network/GameNetworkManager.h" #include "app/linux/LinuxGame.h" #include "OptionsScreen.h" @@ -33,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) - GameServices::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"))); @@ -71,7 +71,7 @@ void PauseScreen::exitWorld(Minecraft* minecraft, bool save) { if (g_NetworkManager.IsHost()) { server->setSaveOnExit(save); } - GameServices::setAction(minecraft->player->GetXboxPad(), eAppAction_ExitWorld); + gameServices().setAction(minecraft->player->GetXboxPad(), eAppAction_ExitWorld); } void PauseScreen::buttonClicked(Button* button) { @@ -91,7 +91,7 @@ void PauseScreen::buttonClicked(Button* button) { exitWorld(minecraft, true); } if (button->id == 4) { - GameServices::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/Screen.cpp b/targets/minecraft/client/gui/Screen.cpp index 1f1fa4fc3..d7095ec8c 100644 --- a/targets/minecraft/client/gui/Screen.cpp +++ b/targets/minecraft/client/gui/Screen.cpp @@ -1,11 +1,11 @@ -#include "minecraft/GameServices.h" +#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 "minecraft/GameEnums.h" #include "app/common/Audio/SoundEngine.h" #include "app/common/Network/GameNetworkManager.h" #include "app/linux/LinuxGame.h" @@ -44,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) - GameServices::setXuiServerAction(InputManager.GetPrimaryPad(), + gameServices().setXuiServerAction(InputManager.GetPrimaryPad(), eXuiServerAction_PauseServer, (void*)false); } } diff --git a/targets/minecraft/client/gui/inventory/AbstractContainerScreen.cpp b/targets/minecraft/client/gui/inventory/AbstractContainerScreen.cpp index 909890eab..92aba34cf 100644 --- a/targets/minecraft/client/gui/inventory/AbstractContainerScreen.cpp +++ b/targets/minecraft/client/gui/inventory/AbstractContainerScreen.cpp @@ -1,4 +1,4 @@ -#include "minecraft/GameServices.h" +#include "minecraft/IGameServices.h" #include "AbstractContainerScreen.h" #include @@ -249,7 +249,7 @@ void AbstractContainerScreen::renderTooltip(std::shared_ptr item, } if (!cleanedLines.empty()) { - lineColors[0] = GameServices::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 b0810ae5d..41ae1c2fc 100644 --- a/targets/minecraft/client/gui/inventory/BeaconPowerButton.cpp +++ b/targets/minecraft/client/gui/inventory/BeaconPowerButton.cpp @@ -1,4 +1,4 @@ -#include "minecraft/locale/Strings.h" +#include "minecraft/IGameServices.h" #include "BeaconPowerButton.h" #include @@ -35,7 +35,7 @@ void BeaconPowerButton::renderTooltip(int xm, int ym) { MobEffect* effect = MobEffect::effects[effectId]; if (!effect) return; - std::wstring name = Strings::get(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 624674746..48d17c954 100644 --- a/targets/minecraft/client/gui/inventory/CreativeInventoryScreen.cpp +++ b/targets/minecraft/client/gui/inventory/CreativeInventoryScreen.cpp @@ -1,4 +1,4 @@ -#include "minecraft/locale/Strings.h" +#include "minecraft/IGameServices.h" #include "CreativeInventoryScreen.h" #include @@ -412,7 +412,7 @@ void CreativeInventoryScreen::renderLabels() { IUIScene_CreativeMenu::TabSpec* spec = IUIScene_CreativeMenu::specs[selectedTabIndex]; if (spec) { - std::wstring tabName = Strings::get(spec->m_descriptionId); + std::wstring tabName = gameServices().getString(spec->m_descriptionId); font->draw(tabName, 8, 6, 0x404040); } } @@ -590,7 +590,7 @@ bool CreativeInventoryScreen::renderIconTooltip(int tab, int mouseX, glDisable(GL_LIGHTING); glDisable(GL_DEPTH_TEST); renderTooltip( - Strings::get(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/model/HumanoidModel.h b/targets/minecraft/client/model/HumanoidModel.h index f42c4b428..ee3c4f092 100644 --- a/targets/minecraft/client/model/HumanoidModel.h +++ b/targets/minecraft/client/model/HumanoidModel.h @@ -1,5 +1,5 @@ #pragma once -#include "minecraft/client/SkinBox.h" +#include "minecraft/client/model/SkinBox.h" #include "minecraft/client/model/geom/Model.h" class ModelPart; diff --git a/targets/minecraft/client/SkinBox.h b/targets/minecraft/client/model/SkinBox.h similarity index 100% rename from targets/minecraft/client/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 276c58a95..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 "minecraft/client/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 72fe9aeea..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 "minecraft/client/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 e687e9877..5c5531979 100644 --- a/targets/minecraft/client/multiplayer/ClientConnection.cpp +++ b/targets/minecraft/client/multiplayer/ClientConnection.cpp @@ -1,7 +1,4 @@ -#include "minecraft/GameServices.h" -#include "minecraft/util/DebugSettings.h" -#include "minecraft/GameHostOptions.h" -#include "minecraft/locale/Strings.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Log.h" #include "ClientConnection.h" @@ -18,7 +15,7 @@ #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/ConsoleGameMode.h" #include "app/common/DLC/DLCManager.h" @@ -279,7 +276,7 @@ void ClientConnection::handleLogin(std::shared_ptr packet) { MOJANG_DATA* pMojangData = nullptr; if (!g_NetworkManager.IsLocalGame()) { - pMojangData = GameServices::getMojangDataForXuid(OnlineXuid); + pMojangData = gameServices().getMojangDataForXuid(OnlineXuid); } if (!g_NetworkManager.IsHost()) { @@ -319,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 = GameServices::isFileInMemoryTextures(wstr); + bRes = gameServices().isFileInMemoryTextures(wstr); if (!bRes) { } if (bRes) { - GameServices::addMemoryTextureFile(wstr, pBuffer, dwSize); + gameServices().addMemoryTextureFile(wstr, pBuffer, dwSize); } } @@ -332,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 = GameServices::isFileInMemoryTextures(wstr); + bRes = gameServices().isFileInMemoryTextures(wstr); if (!bRes) { } if (bRes) { - GameServices::addMemoryTextureFile(wstr, pBuffer, dwSize); + gameServices().addMemoryTextureFile(wstr, pBuffer, dwSize); } } } // If we're online, read the banned game list - GameServices::readBannedList(iUserID); + gameServices().readBannedList(iUserID); // mark the level as not checked against banned levels - it'll be // checked once the level starts - GameServices::setBanListCheck(iUserID, false); + gameServices().setBanListCheck(iUserID, false); } if (m_userIndex == InputManager.GetPrimaryPad()) { - if (GameServices::getTutorialMode()) { + if (gameServices().getTutorialMode()) { minecraft->gameMode = new FullTutorialMode( InputManager.GetPrimaryPad(), minecraft, this); } else { @@ -387,8 +384,8 @@ void ClientConnection::handleLogin(std::shared_ptr packet) { } minecraft->player->setPlayerIndex(packet->m_playerIndex); - minecraft->player->setCustomSkin(GameServices::getPlayerSkinId(m_userIndex)); - minecraft->player->setCustomCape(GameServices::getPlayerCapeId(m_userIndex)); + minecraft->player->setCustomSkin(gameServices().getPlayerSkinId(m_userIndex)); + minecraft->player->setCustomCape(gameServices().getPlayerCapeId(m_userIndex)); minecraft->createPrimaryLocalPlayer(InputManager.GetPrimaryPad()); @@ -397,7 +394,7 @@ void ClientConnection::handleLogin(std::shared_ptr packet) { minecraft->player->entityId = packet->clientVersion; std::uint8_t networkSmallId = getSocket()->getSmallId(); - GameServices::updatePlayerInfo(networkSmallId, packet->m_playerIndex, + gameServices().updatePlayerInfo(networkSmallId, packet->m_playerIndex, packet->m_uiGamePrivileges); minecraft->player->setPlayerGamePrivilege( Player::ePlayerGamePrivilege_All, packet->m_uiGamePrivileges); @@ -415,8 +412,8 @@ void ClientConnection::handleLogin(std::shared_ptr packet) { displayPrivilegeChanges(minecraft->player, startingPrivileges); // update the debugoptions - GameServices::setGameSettingsDebugMask(InputManager.GetPrimaryPad(), - DebugSettings::getMask(-1, true)); + gameServices().setGameSettingsDebugMask(InputManager.GetPrimaryPad(), + gameServices().debugGetMask(-1, true)); } else { // 4J-PB - this isn't the level we want // level = (MultiPlayerLevel *)minecraft->level; @@ -474,11 +471,11 @@ void ClientConnection::handleLogin(std::shared_ptr packet) { player->entityId = packet->clientVersion; player->setPlayerIndex(packet->m_playerIndex); - player->setCustomSkin(GameServices::getPlayerSkinId(m_userIndex)); - player->setCustomCape(GameServices::getPlayerCapeId(m_userIndex)); + player->setCustomSkin(gameServices().getPlayerSkinId(m_userIndex)); + player->setCustomCape(gameServices().getPlayerCapeId(m_userIndex)); std::uint8_t networkSmallId = getSocket()->getSmallId(); - GameServices::updatePlayerInfo(networkSmallId, packet->m_playerIndex, + gameServices().updatePlayerInfo(networkSmallId, packet->m_playerIndex, packet->m_uiGamePrivileges); player->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_All, packet->m_uiGamePrivileges); @@ -923,7 +920,7 @@ void ClientConnection::handleAddPlayer( if (!player->customTextureUrl.empty() && player->customTextureUrl.substr(0, 3).compare(L"def") != 0 && - !GameServices::isFileInMemoryTextures(player->customTextureUrl)) { + !gameServices().isFileInMemoryTextures(player->customTextureUrl)) { if (minecraft->addPendingClientTextureRequest( player->customTextureUrl)) { Log::info( @@ -936,9 +933,9 @@ void ClientConnection::handleAddPlayer( 0))); } } else if (!player->customTextureUrl.empty() && - GameServices::isFileInMemoryTextures(player->customTextureUrl)) { + gameServices().isFileInMemoryTextures(player->customTextureUrl)) { // Update the ref count on the memory texture data - GameServices::addMemoryTextureFile(player->customTextureUrl, nullptr, 0); + gameServices().addMemoryTextureFile(player->customTextureUrl, nullptr, 0); } Log::info("Custom skin for player %ls is %ls\n", player->name.c_str(), @@ -946,7 +943,7 @@ void ClientConnection::handleAddPlayer( if (!player->customTextureUrl2.empty() && player->customTextureUrl2.substr(0, 3).compare(L"def") != 0 && - !GameServices::isFileInMemoryTextures(player->customTextureUrl2)) { + !gameServices().isFileInMemoryTextures(player->customTextureUrl2)) { if (minecraft->addPendingClientTextureRequest( player->customTextureUrl2)) { Log::info( @@ -957,9 +954,9 @@ void ClientConnection::handleAddPlayer( new TexturePacket(player->customTextureUrl2, nullptr, 0))); } } else if (!player->customTextureUrl2.empty() && - GameServices::isFileInMemoryTextures(player->customTextureUrl2)) { + gameServices().isFileInMemoryTextures(player->customTextureUrl2)) { // Update the ref count on the memory texture data - GameServices::addMemoryTextureFile(player->customTextureUrl2, nullptr, 0); + gameServices().addMemoryTextureFile(player->customTextureUrl2, nullptr, 0); } Log::info("Custom cape for player %ls is %ls\n", player->name.c_str(), @@ -1119,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 (GameServices::getGameStarted()) { + if (gameServices().getGameStarted()) { ui.CloseUIScenes(m_userIndex); } } @@ -1342,9 +1339,9 @@ void ClientConnection::handleDisconnect( Minecraft* pMinecraft = Minecraft::GetInstance(); pMinecraft->connectionDisconnected(m_userIndex, packet->reason); - GameServices::setDisconnectReason(packet->reason); + gameServices().setDisconnectReason(packet->reason); - GameServices::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)); @@ -1374,7 +1371,7 @@ void ClientConnection::onDisconnect(DisconnectPacket::eDisconnectReason reason, &ClientConnection::HostDisconnectReturned, nullptr); } else { - GameServices::setAction(m_userIndex, eAppAction_ExitWorld, (void*)true); + gameServices().setAction(m_userIndex, eAppAction_ExitWorld, (void*)true); } // minecraft->setLevel(nullptr); @@ -1499,327 +1496,327 @@ void ClientConnection::handleChat(std::shared_ptr packet) { switch (packet->m_messageType) { case ChatPacket::e_ChatBedOccupied: - message = Strings::get(IDS_TILE_BED_OCCUPIED); + message = gameServices().getString(IDS_TILE_BED_OCCUPIED); break; case ChatPacket::e_ChatBedNoSleep: - message = Strings::get(IDS_TILE_BED_NO_SLEEP); + message = gameServices().getString(IDS_TILE_BED_NO_SLEEP); break; case ChatPacket::e_ChatBedNotValid: - message = Strings::get(IDS_TILE_BED_NOT_VALID); + message = gameServices().getString(IDS_TILE_BED_NOT_VALID); break; case ChatPacket::e_ChatBedNotSafe: - message = Strings::get(IDS_TILE_BED_NOTSAFE); + message = gameServices().getString(IDS_TILE_BED_NOTSAFE); break; case ChatPacket::e_ChatBedPlayerSleep: - message = Strings::get(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 = Strings::get(IDS_TILE_BED_MESLEEP); + message = gameServices().getString(IDS_TILE_BED_MESLEEP); break; case ChatPacket::e_ChatPlayerJoinedGame: - message = Strings::get(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 = Strings::get(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 = Strings::get(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; - GameServices::setGlobalXuiAction(eAppAction_DisplayLavaMessage); + gameServices().setGlobalXuiAction(eAppAction_DisplayLavaMessage); break; case ChatPacket::e_ChatDeathInFire: - message = Strings::get(IDS_DEATH_INFIRE); + message = gameServices().getString(IDS_DEATH_INFIRE); replacePlayer = true; break; case ChatPacket::e_ChatDeathOnFire: - message = Strings::get(IDS_DEATH_ONFIRE); + message = gameServices().getString(IDS_DEATH_ONFIRE); replacePlayer = true; break; case ChatPacket::e_ChatDeathLava: - message = Strings::get(IDS_DEATH_LAVA); + message = gameServices().getString(IDS_DEATH_LAVA); replacePlayer = true; break; case ChatPacket::e_ChatDeathInWall: - message = Strings::get(IDS_DEATH_INWALL); + message = gameServices().getString(IDS_DEATH_INWALL); replacePlayer = true; break; case ChatPacket::e_ChatDeathDrown: - message = Strings::get(IDS_DEATH_DROWN); + message = gameServices().getString(IDS_DEATH_DROWN); replacePlayer = true; break; case ChatPacket::e_ChatDeathStarve: - message = Strings::get(IDS_DEATH_STARVE); + message = gameServices().getString(IDS_DEATH_STARVE); replacePlayer = true; break; case ChatPacket::e_ChatDeathCactus: - message = Strings::get(IDS_DEATH_CACTUS); + message = gameServices().getString(IDS_DEATH_CACTUS); replacePlayer = true; break; case ChatPacket::e_ChatDeathFall: - message = Strings::get(IDS_DEATH_FALL); + message = gameServices().getString(IDS_DEATH_FALL); replacePlayer = true; break; case ChatPacket::e_ChatDeathOutOfWorld: - message = Strings::get(IDS_DEATH_OUTOFWORLD); + message = gameServices().getString(IDS_DEATH_OUTOFWORLD); replacePlayer = true; break; case ChatPacket::e_ChatDeathGeneric: - message = Strings::get(IDS_DEATH_GENERIC); + message = gameServices().getString(IDS_DEATH_GENERIC); replacePlayer = true; break; case ChatPacket::e_ChatDeathExplosion: - message = Strings::get(IDS_DEATH_EXPLOSION); + message = gameServices().getString(IDS_DEATH_EXPLOSION); replacePlayer = true; break; case ChatPacket::e_ChatDeathMagic: - message = Strings::get(IDS_DEATH_MAGIC); + message = gameServices().getString(IDS_DEATH_MAGIC); replacePlayer = true; break; case ChatPacket::e_ChatDeathAnvil: - message = Strings::get(IDS_DEATH_FALLING_ANVIL); + message = gameServices().getString(IDS_DEATH_FALLING_ANVIL); replacePlayer = true; break; case ChatPacket::e_ChatDeathFallingBlock: - message = Strings::get(IDS_DEATH_FALLING_TILE); + message = gameServices().getString(IDS_DEATH_FALLING_TILE); replacePlayer = true; break; case ChatPacket::e_ChatDeathDragonBreath: - message = Strings::get(IDS_DEATH_DRAGON_BREATH); + message = gameServices().getString(IDS_DEATH_DRAGON_BREATH); replacePlayer = true; break; case ChatPacket::e_ChatDeathMob: - message = Strings::get(IDS_DEATH_MOB); + message = gameServices().getString(IDS_DEATH_MOB); replacePlayer = true; replaceEntitySource = true; break; case ChatPacket::e_ChatDeathPlayer: - message = Strings::get(IDS_DEATH_PLAYER); + message = gameServices().getString(IDS_DEATH_PLAYER); replacePlayer = true; replaceEntitySource = true; break; case ChatPacket::e_ChatDeathArrow: - message = Strings::get(IDS_DEATH_ARROW); + message = gameServices().getString(IDS_DEATH_ARROW); replacePlayer = true; replaceEntitySource = true; break; case ChatPacket::e_ChatDeathFireball: - message = Strings::get(IDS_DEATH_FIREBALL); + message = gameServices().getString(IDS_DEATH_FIREBALL); replacePlayer = true; replaceEntitySource = true; break; case ChatPacket::e_ChatDeathThrown: - message = Strings::get(IDS_DEATH_THROWN); + message = gameServices().getString(IDS_DEATH_THROWN); replacePlayer = true; replaceEntitySource = true; break; case ChatPacket::e_ChatDeathIndirectMagic: - message = Strings::get(IDS_DEATH_INDIRECT_MAGIC); + message = gameServices().getString(IDS_DEATH_INDIRECT_MAGIC); replacePlayer = true; replaceEntitySource = true; break; case ChatPacket::e_ChatDeathThorns: - message = Strings::get(IDS_DEATH_THORNS); + message = gameServices().getString(IDS_DEATH_THORNS); replacePlayer = true; replaceEntitySource = true; break; case ChatPacket::e_ChatDeathFellAccidentLadder: - message = Strings::get(IDS_DEATH_FELL_ACCIDENT_LADDER); + message = gameServices().getString(IDS_DEATH_FELL_ACCIDENT_LADDER); replacePlayer = true; break; case ChatPacket::e_ChatDeathFellAccidentVines: - message = Strings::get(IDS_DEATH_FELL_ACCIDENT_VINES); + message = gameServices().getString(IDS_DEATH_FELL_ACCIDENT_VINES); replacePlayer = true; break; case ChatPacket::e_ChatDeathFellAccidentWater: - message = Strings::get(IDS_DEATH_FELL_ACCIDENT_WATER); + message = gameServices().getString(IDS_DEATH_FELL_ACCIDENT_WATER); replacePlayer = true; break; case ChatPacket::e_ChatDeathFellAccidentGeneric: - message = Strings::get(IDS_DEATH_FELL_ACCIDENT_GENERIC); + message = gameServices().getString(IDS_DEATH_FELL_ACCIDENT_GENERIC); replacePlayer = true; break; case ChatPacket::e_ChatDeathFellKiller: - // message=Strings::get(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 = Strings::get(IDS_DEATH_FALL); + message = gameServices().getString(IDS_DEATH_FALL); replacePlayer = true; break; case ChatPacket::e_ChatDeathFellAssist: - message = Strings::get(IDS_DEATH_FELL_ASSIST); + message = gameServices().getString(IDS_DEATH_FELL_ASSIST); replacePlayer = true; replaceEntitySource = true; break; case ChatPacket::e_ChatDeathFellAssistItem: - message = Strings::get(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 = Strings::get(IDS_DEATH_FELL_FINISH); + message = gameServices().getString(IDS_DEATH_FELL_FINISH); replacePlayer = true; replaceEntitySource = true; break; case ChatPacket::e_ChatDeathFellFinishItem: - message = Strings::get(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 = Strings::get(IDS_DEATH_INFIRE_PLAYER); + message = gameServices().getString(IDS_DEATH_INFIRE_PLAYER); replacePlayer = true; replaceEntitySource = true; break; case ChatPacket::e_ChatDeathOnFirePlayer: - message = Strings::get(IDS_DEATH_ONFIRE_PLAYER); + message = gameServices().getString(IDS_DEATH_ONFIRE_PLAYER); replacePlayer = true; replaceEntitySource = true; break; case ChatPacket::e_ChatDeathLavaPlayer: - message = Strings::get(IDS_DEATH_LAVA_PLAYER); + message = gameServices().getString(IDS_DEATH_LAVA_PLAYER); replacePlayer = true; replaceEntitySource = true; break; case ChatPacket::e_ChatDeathDrownPlayer: - message = Strings::get(IDS_DEATH_DROWN_PLAYER); + message = gameServices().getString(IDS_DEATH_DROWN_PLAYER); replacePlayer = true; replaceEntitySource = true; break; case ChatPacket::e_ChatDeathCactusPlayer: - message = Strings::get(IDS_DEATH_CACTUS_PLAYER); + message = gameServices().getString(IDS_DEATH_CACTUS_PLAYER); replacePlayer = true; replaceEntitySource = true; break; case ChatPacket::e_ChatDeathExplosionPlayer: - message = Strings::get(IDS_DEATH_EXPLOSION_PLAYER); + message = gameServices().getString(IDS_DEATH_EXPLOSION_PLAYER); replacePlayer = true; replaceEntitySource = true; break; case ChatPacket::e_ChatDeathWither: - message = Strings::get(IDS_DEATH_WITHER); + message = gameServices().getString(IDS_DEATH_WITHER); replacePlayer = true; break; case ChatPacket::e_ChatDeathPlayerItem: - message = Strings::get(IDS_DEATH_PLAYER_ITEM); + message = gameServices().getString(IDS_DEATH_PLAYER_ITEM); replacePlayer = true; replaceEntitySource = true; replaceItem = true; break; case ChatPacket::e_ChatDeathArrowItem: - message = Strings::get(IDS_DEATH_ARROW_ITEM); + message = gameServices().getString(IDS_DEATH_ARROW_ITEM); replacePlayer = true; replaceEntitySource = true; replaceItem = true; break; case ChatPacket::e_ChatDeathFireballItem: - message = Strings::get(IDS_DEATH_FIREBALL_ITEM); + message = gameServices().getString(IDS_DEATH_FIREBALL_ITEM); replacePlayer = true; replaceEntitySource = true; replaceItem = true; break; case ChatPacket::e_ChatDeathThrownItem: - message = Strings::get(IDS_DEATH_THROWN_ITEM); + message = gameServices().getString(IDS_DEATH_THROWN_ITEM); replacePlayer = true; replaceEntitySource = true; replaceItem = true; break; case ChatPacket::e_ChatDeathIndirectMagicItem: - message = Strings::get(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 = Strings::get(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 = Strings::get(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 = Strings::get(IDS_MAX_ENEMIES_SPAWNED); + message = gameServices().getString(IDS_MAX_ENEMIES_SPAWNED); break; // Spawn eggs case ChatPacket::e_ChatPlayerMaxVillagers: - message = Strings::get(IDS_MAX_VILLAGERS_SPAWNED); + message = gameServices().getString(IDS_MAX_VILLAGERS_SPAWNED); break; case ChatPacket::e_ChatPlayerMaxPigsSheepCows: - message = Strings::get(IDS_MAX_PIGS_SHEEP_COWS_CATS_SPAWNED); + message = gameServices().getString(IDS_MAX_PIGS_SHEEP_COWS_CATS_SPAWNED); break; case ChatPacket::e_ChatPlayerMaxChickens: - message = Strings::get(IDS_MAX_CHICKENS_SPAWNED); + message = gameServices().getString(IDS_MAX_CHICKENS_SPAWNED); break; case ChatPacket::e_ChatPlayerMaxSquid: - message = Strings::get(IDS_MAX_SQUID_SPAWNED); + message = gameServices().getString(IDS_MAX_SQUID_SPAWNED); break; case ChatPacket::e_ChatPlayerMaxMooshrooms: - message = Strings::get(IDS_MAX_MOOSHROOMS_SPAWNED); + message = gameServices().getString(IDS_MAX_MOOSHROOMS_SPAWNED); break; case ChatPacket::e_ChatPlayerMaxWolves: - message = Strings::get(IDS_MAX_WOLVES_SPAWNED); + message = gameServices().getString(IDS_MAX_WOLVES_SPAWNED); break; case ChatPacket::e_ChatPlayerMaxBats: - message = Strings::get(IDS_MAX_BATS_SPAWNED); + message = gameServices().getString(IDS_MAX_BATS_SPAWNED); break; // Breeding case ChatPacket::e_ChatPlayerMaxBredPigsSheepCows: - message = Strings::get(IDS_MAX_PIGS_SHEEP_COWS_CATS_BRED); + message = gameServices().getString(IDS_MAX_PIGS_SHEEP_COWS_CATS_BRED); break; case ChatPacket::e_ChatPlayerMaxBredChickens: - message = Strings::get(IDS_MAX_CHICKENS_BRED); + message = gameServices().getString(IDS_MAX_CHICKENS_BRED); break; case ChatPacket::e_ChatPlayerMaxBredMooshrooms: - message = Strings::get(IDS_MAX_MUSHROOMCOWS_BRED); + message = gameServices().getString(IDS_MAX_MUSHROOMCOWS_BRED); break; case ChatPacket::e_ChatPlayerMaxBredWolves: - message = Strings::get(IDS_MAX_WOLVES_BRED); + message = gameServices().getString(IDS_MAX_WOLVES_BRED); break; // can't shear the mooshroom case ChatPacket::e_ChatPlayerCantShearMooshroom: - message = Strings::get(IDS_CANT_SHEAR_MOOSHROOM); + message = gameServices().getString(IDS_CANT_SHEAR_MOOSHROOM); break; // Paintings/Item Frames case ChatPacket::e_ChatPlayerMaxHangingEntities: - message = Strings::get(IDS_MAX_HANGINGENTITIES); + message = gameServices().getString(IDS_MAX_HANGINGENTITIES); break; // Enemy spawn eggs in peaceful case ChatPacket::e_ChatPlayerCantSpawnInPeaceful: - message = Strings::get(IDS_CANT_SPAWN_IN_PEACEFUL); + message = gameServices().getString(IDS_CANT_SPAWN_IN_PEACEFUL); break; // Enemy spawn eggs in peaceful case ChatPacket::e_ChatPlayerMaxBoats: - message = Strings::get(IDS_MAX_BOATS); + message = gameServices().getString(IDS_MAX_BOATS); break; case ChatPacket::e_ChatCommandTeleportSuccess: - message = Strings::get(IDS_COMMAND_TELEPORT_SUCCESS); + message = gameServices().getString(IDS_COMMAND_TELEPORT_SUCCESS); replacePlayer = true; if (packet->m_intArgs[0] == eTYPE_SERVERPLAYER) { message = @@ -1827,15 +1824,15 @@ void ClientConnection::handleChat(std::shared_ptr packet) { } else { message = replaceAll( message, L"{*DESTINATION*}", - GameServices::getEntityName((EntityTypeId)packet->m_intArgs[0])); + gameServices().getEntityName((EntityTypeId)packet->m_intArgs[0])); } break; case ChatPacket::e_ChatCommandTeleportMe: - message = Strings::get(IDS_COMMAND_TELEPORT_ME); + message = gameServices().getString(IDS_COMMAND_TELEPORT_ME); replacePlayer = true; break; case ChatPacket::e_ChatCommandTeleportToMe: - message = Strings::get(IDS_COMMAND_TELEPORT_TO_ME); + message = gameServices().getString(IDS_COMMAND_TELEPORT_TO_ME); replacePlayer = true; break; @@ -1860,7 +1857,7 @@ void ClientConnection::handleChat(std::shared_ptr packet) { entityName = packet->m_stringArgs[1]; } else { entityName = - GameServices::getEntityName((EntityTypeId)packet->m_intArgs[0]); + gameServices().getEntityName((EntityTypeId)packet->m_intArgs[0]); } message = replaceAll(message, L"{*SOURCE*}", entityName); @@ -1934,12 +1931,12 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) { if (!g_NetworkManager.IsHost()) { // set the game host settings - GameHostOptions::set(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 (GameServices::getTMSGlobalFileListRead() == false) { - GameServices::setTMSAction(InputManager.GetPrimaryPad(), + if (gameServices().getTMSGlobalFileListRead() == false) { + gameServices().setTMSAction(InputManager.GetPrimaryPad(), eTMSAction_TMSPP_RetrieveFiles_RunPlayGame); } } @@ -1969,8 +1966,8 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) { "Exiting world on handling Pre-Login packet due UGC " "privileges: %d\n", reason); - GameServices::setDisconnectReason(reason); - GameServices::setAction(InputManager.GetPrimaryPad(), eAppAction_ExitWorld, + gameServices().setDisconnectReason(reason); + gameServices().setAction(InputManager.GetPrimaryPad(), eAppAction_ExitWorld, (void*)true); } else { if (!isFriendsWithHost) @@ -1997,7 +1994,7 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) { IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_SINGLE_LOCAL, uiIDA, 1, m_userIndex); - GameServices::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 @@ -2005,10 +2002,10 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) { // Minecraft::GetInstance()->connectionDisconnected( // m_userIndex , reason ); done = true; // connection->flush(); connection->close(reason); - // GameServices::setAction(m_userIndex,eAppAction_ExitPlayer); + // gameServices().setAction(m_userIndex,eAppAction_ExitPlayer); // 4J-PB - doing this instead - GameServices::setAction(m_userIndex, eAppAction_ExitPlayerPreLogin); + gameServices().setAction(m_userIndex, eAppAction_ExitPlayerPreLogin); } } else { // Texture pack handling @@ -2069,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, GameServices::getPlayerSkinId(m_userIndex), - GameServices::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"); @@ -2271,7 +2268,7 @@ void ClientConnection::handleTexture(std::shared_ptr packet) { #endif std::uint8_t* pbData = nullptr; unsigned int dwBytes = 0; - GameServices::getMemFileDetails(packet->textureName, &pbData, &dwBytes); + gameServices().getMemFileDetails(packet->textureName, &pbData, &dwBytes); if (dwBytes != 0) { send(std::shared_ptr( @@ -2283,7 +2280,7 @@ void ClientConnection::handleTexture(std::shared_ptr packet) { wprintf(L"Client received custom texture %ls\n", packet->textureName.c_str()); #endif - GameServices::addMemoryTextureFile(packet->textureName, packet->pbData, + gameServices().addMemoryTextureFile(packet->textureName, packet->pbData, packet->dataBytes); Minecraft::GetInstance()->handleClientTextureReceived( packet->textureName); @@ -2306,9 +2303,9 @@ void ClientConnection::handleTextureAndGeometry( #endif std::uint8_t* pbData = nullptr; unsigned int dwBytes = 0; - GameServices::getMemFileDetails(packet->textureName, &pbData, &dwBytes); + gameServices().getMemFileDetails(packet->textureName, &pbData, &dwBytes); DLCSkinFile* pDLCSkinFile = - GameServices::getDLCManager().getSkinFile(packet->textureName); + gameServices().getDLCSkinFile(packet->textureName); if (dwBytes != 0) { if (pDLCSkinFile) { @@ -2324,12 +2321,12 @@ void ClientConnection::handleTextureAndGeometry( } } else { unsigned int uiAnimOverrideBitmask = - GameServices::getAnimOverrideBitmask(packet->dwSkinID); + gameServices().getAnimOverrideBitmask(packet->dwSkinID); send(std::shared_ptr( new TextureAndGeometryPacket( packet->textureName, pbData, dwBytes, - GameServices::getAdditionalSkinBoxes(packet->dwSkinID), + gameServices().getAdditionalSkinBoxes(packet->dwSkinID), uiAnimOverrideBitmask))); } } @@ -2340,15 +2337,15 @@ void ClientConnection::handleTextureAndGeometry( packet->textureName.c_str()); #endif // Add the texture data - GameServices::addMemoryTextureFile(packet->textureName, packet->pbData, + gameServices().addMemoryTextureFile(packet->textureName, packet->pbData, packet->dwTextureBytes); // Add the geometry data if (packet->dwBoxC != 0) { - GameServices::setAdditionalSkinBoxes(packet->dwSkinID, packet->BoxDataA, + gameServices().setAdditionalSkinBoxes(packet->dwSkinID, packet->BoxDataA, packet->dwBoxC); } // Add the anim override - GameServices::setAnimOverrideBitmask(packet->dwSkinID, + gameServices().setAnimOverrideBitmask(packet->dwSkinID, packet->uiAnimOverrideBitmask); // clear out the pending texture request @@ -2376,7 +2373,7 @@ void ClientConnection::handleTextureChange( switch (packet->action) { case TextureChangePacket::e_TextureChange_Skin: - player->setCustomSkin(GameServices::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(), @@ -2395,7 +2392,7 @@ void ClientConnection::handleTextureChange( if (!packet->path.empty() && packet->path.substr(0, 3).compare(L"def") != 0 && - !GameServices::isFileInMemoryTextures(packet->path)) { + !gameServices().isFileInMemoryTextures(packet->path)) { if (minecraft->addPendingClientTextureRequest(packet->path)) { #if !defined(_CONTENT_PACKAGE) wprintf( @@ -2407,9 +2404,9 @@ void ClientConnection::handleTextureChange( new TexturePacket(packet->path, nullptr, 0))); } } else if (!packet->path.empty() && - GameServices::isFileInMemoryTextures(packet->path)) { + gameServices().isFileInMemoryTextures(packet->path)) { // Update the ref count on the memory texture data - GameServices::addMemoryTextureFile(packet->path, nullptr, 0); + gameServices().addMemoryTextureFile(packet->path, nullptr, 0); } } @@ -2431,7 +2428,7 @@ void ClientConnection::handleTextureAndGeometryChange( } if (isLocalPlayer) return; - player->setCustomSkin(GameServices::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", @@ -2441,7 +2438,7 @@ void ClientConnection::handleTextureAndGeometryChange( if (!packet->path.empty() && packet->path.substr(0, 3).compare(L"def") != 0 && - !GameServices::isFileInMemoryTextures(packet->path)) { + !gameServices().isFileInMemoryTextures(packet->path)) { if (minecraft->addPendingClientTextureRequest(packet->path)) { #if !defined(_CONTENT_PACKAGE) wprintf( @@ -2454,9 +2451,9 @@ void ClientConnection::handleTextureAndGeometryChange( new TextureAndGeometryPacket(packet->path, nullptr, 0))); } } else if (!packet->path.empty() && - GameServices::isFileInMemoryTextures(packet->path)) { + gameServices().isFileInMemoryTextures(packet->path)) { // Update the ref count on the memory texture data - GameServices::addMemoryTextureFile(packet->path, nullptr, 0); + gameServices().addMemoryTextureFile(packet->path, nullptr, 0); } } @@ -2548,13 +2545,13 @@ void ClientConnection::handleRespawn(std::shared_ptr packet) { // with the inventory menu open ui.CloseUIScenes(m_userIndex); - if (GameServices::getLocalPlayerCount() > 1) { + if (gameServices().getLocalPlayerCount() > 1) { ui.NavigateToScene(m_userIndex, eUIScene_ConnectingProgress, param); } else { ui.NavigateToScene(m_userIndex, eUIScene_ConnectingProgress, param); } - GameServices::setAction(m_userIndex, eAppAction_WaitForDimensionChangeComplete); + gameServices().setAction(m_userIndex, eAppAction_WaitForDimensionChangeComplete); } // minecraft->respawnPlayer(minecraft->player->GetXboxPad(),true, @@ -3023,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 - GameServices::setGameStarted(false); - GameServices::setAction(InputManager.GetPrimaryPad(), + gameServices().setGameStarted(false); + gameServices().setAction(InputManager.GetPrimaryPad(), eAppAction_RemoteServerSave); } } else if (event == GameEventPacket::STOP_SAVING) { - if (!g_NetworkManager.IsHost()) GameServices::setGameStarted(true); + if (!g_NetworkManager.IsHost()) gameServices().setGameStarted(true); } else if (event == GameEventPacket::SUCCESSFUL_BOW_HIT) { std::shared_ptr player = minecraft->localplayers[m_userIndex]; @@ -3111,7 +3108,7 @@ bool ClientConnection::isServerPacketListener() { return false; } void ClientConnection::handlePlayerInfo( std::shared_ptr packet) { unsigned int startingPrivileges = - GameServices::getPlayerPrivileges(packet->m_networkSmallId); + gameServices().getPlayerPrivileges(packet->m_networkSmallId); INetworkPlayer* networkPlayer = g_NetworkManager.GetPlayerBySmallId(packet->m_networkSmallId); @@ -3124,7 +3121,7 @@ void ClientConnection::handlePlayerInfo( } // 4J Stu - Repurposed this packet for player info that we want - GameServices::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); @@ -3166,58 +3163,58 @@ void ClientConnection::displayPrivilegeChanges( Player::getPlayerGamePrivilege(oldPrivileges, priv)) { privOn = Player::getPlayerGamePrivilege(newPrivileges, priv); std::wstring message = L""; - if (GameHostOptions::get(eGameHostOption_TrustPlayers) == 0) { + if (gameServices().getGameHostOption(eGameHostOption_TrustPlayers) == 0) { switch (priv) { case Player::ePlayerGamePrivilege_CannotMine: if (privOn) - message = Strings::get(IDS_PRIV_MINE_TOGGLE_ON); + message = gameServices().getString(IDS_PRIV_MINE_TOGGLE_ON); else - message = Strings::get(IDS_PRIV_MINE_TOGGLE_OFF); + message = gameServices().getString(IDS_PRIV_MINE_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_CannotBuild: if (privOn) - message = Strings::get(IDS_PRIV_BUILD_TOGGLE_ON); + message = gameServices().getString(IDS_PRIV_BUILD_TOGGLE_ON); else - message = Strings::get(IDS_PRIV_BUILD_TOGGLE_OFF); + message = gameServices().getString(IDS_PRIV_BUILD_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_CanUseDoorsAndSwitches: if (privOn) message = - Strings::get(IDS_PRIV_USE_DOORS_TOGGLE_ON); + gameServices().getString(IDS_PRIV_USE_DOORS_TOGGLE_ON); else message = - Strings::get(IDS_PRIV_USE_DOORS_TOGGLE_OFF); + gameServices().getString(IDS_PRIV_USE_DOORS_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_CanUseContainers: if (privOn) - message = Strings::get( + message = gameServices().getString( IDS_PRIV_USE_CONTAINERS_TOGGLE_ON); else - message = Strings::get( + message = gameServices().getString( IDS_PRIV_USE_CONTAINERS_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_CannotAttackAnimals: if (privOn) message = - Strings::get(IDS_PRIV_ATTACK_ANIMAL_TOGGLE_ON); + gameServices().getString(IDS_PRIV_ATTACK_ANIMAL_TOGGLE_ON); else - message = Strings::get( + message = gameServices().getString( IDS_PRIV_ATTACK_ANIMAL_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_CannotAttackMobs: if (privOn) message = - Strings::get(IDS_PRIV_ATTACK_MOB_TOGGLE_ON); + gameServices().getString(IDS_PRIV_ATTACK_MOB_TOGGLE_ON); else message = - Strings::get(IDS_PRIV_ATTACK_MOB_TOGGLE_OFF); + gameServices().getString(IDS_PRIV_ATTACK_MOB_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_CannotAttackPlayers: if (privOn) message = - Strings::get(IDS_PRIV_ATTACK_PLAYER_TOGGLE_ON); + gameServices().getString(IDS_PRIV_ATTACK_PLAYER_TOGGLE_ON); else - message = Strings::get( + message = gameServices().getString( IDS_PRIV_ATTACK_PLAYER_TOGGLE_OFF); break; default: @@ -3227,75 +3224,75 @@ void ClientConnection::displayPrivilegeChanges( switch (priv) { case Player::ePlayerGamePrivilege_Op: if (privOn) - message = Strings::get(IDS_PRIV_MODERATOR_TOGGLE_ON); + message = gameServices().getString(IDS_PRIV_MODERATOR_TOGGLE_ON); else - message = Strings::get(IDS_PRIV_MODERATOR_TOGGLE_OFF); + message = gameServices().getString(IDS_PRIV_MODERATOR_TOGGLE_OFF); break; default: break; }; - if (GameHostOptions::get(eGameHostOption_CheatsEnabled) != 0) { + if (gameServices().getGameHostOption(eGameHostOption_CheatsEnabled) != 0) { switch (priv) { case Player::ePlayerGamePrivilege_CanFly: if (privOn) - message = Strings::get(IDS_PRIV_FLY_TOGGLE_ON); + message = gameServices().getString(IDS_PRIV_FLY_TOGGLE_ON); else - message = Strings::get(IDS_PRIV_FLY_TOGGLE_OFF); + message = gameServices().getString(IDS_PRIV_FLY_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_ClassicHunger: if (privOn) message = - Strings::get(IDS_PRIV_EXHAUSTION_TOGGLE_ON); + gameServices().getString(IDS_PRIV_EXHAUSTION_TOGGLE_ON); else message = - Strings::get(IDS_PRIV_EXHAUSTION_TOGGLE_OFF); + gameServices().getString(IDS_PRIV_EXHAUSTION_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_Invisible: if (privOn) message = - Strings::get(IDS_PRIV_INVISIBLE_TOGGLE_ON); + gameServices().getString(IDS_PRIV_INVISIBLE_TOGGLE_ON); else message = - Strings::get(IDS_PRIV_INVISIBLE_TOGGLE_OFF); + gameServices().getString(IDS_PRIV_INVISIBLE_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_Invulnerable: if (privOn) message = - Strings::get(IDS_PRIV_INVULNERABLE_TOGGLE_ON); + gameServices().getString(IDS_PRIV_INVULNERABLE_TOGGLE_ON); else message = - Strings::get(IDS_PRIV_INVULNERABLE_TOGGLE_OFF); + gameServices().getString(IDS_PRIV_INVULNERABLE_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_CanToggleInvisible: if (privOn) message = - Strings::get(IDS_PRIV_CAN_INVISIBLE_TOGGLE_ON); + gameServices().getString(IDS_PRIV_CAN_INVISIBLE_TOGGLE_ON); else - message = Strings::get( + message = gameServices().getString( IDS_PRIV_CAN_INVISIBLE_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_CanToggleFly: if (privOn) - message = Strings::get(IDS_PRIV_CAN_FLY_TOGGLE_ON); + message = gameServices().getString(IDS_PRIV_CAN_FLY_TOGGLE_ON); else message = - Strings::get(IDS_PRIV_CAN_FLY_TOGGLE_OFF); + gameServices().getString(IDS_PRIV_CAN_FLY_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_CanToggleClassicHunger: if (privOn) - message = Strings::get( + message = gameServices().getString( IDS_PRIV_CAN_EXHAUSTION_TOGGLE_ON); else - message = Strings::get( + message = gameServices().getString( IDS_PRIV_CAN_EXHAUSTION_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_CanTeleport: if (privOn) message = - Strings::get(IDS_PRIV_CAN_TELEPORT_TOGGLE_ON); + gameServices().getString(IDS_PRIV_CAN_TELEPORT_TOGGLE_ON); else message = - Strings::get(IDS_PRIV_CAN_TELEPORT_TOGGLE_OFF); + gameServices().getString(IDS_PRIV_CAN_TELEPORT_TOGGLE_OFF); break; default: break; @@ -3370,7 +3367,7 @@ Connection* ClientConnection::getConnection() { return connection; } void ClientConnection::handleServerSettingsChanged( std::shared_ptr packet) { if (packet->action == ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS) { - GameHostOptions::set(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) { @@ -3384,7 +3381,7 @@ void ClientConnection::handleServerSettingsChanged( } else { // options // minecraft->options->SetGamertagSetting((packet->data==0)?false:true); - GameHostOptions::set(eGameHostOption_Gamertags, packet->data); + gameServices().setGameHostOption(eGameHostOption_Gamertags, packet->data); } } @@ -3405,7 +3402,7 @@ void ClientConnection::handleUpdateProgress( void ClientConnection::handleUpdateGameRuleProgressPacket( std::shared_ptr packet) { - const wchar_t* string = GameServices::getGameRulesString(packet->m_messageId); + const wchar_t* string = gameServices().getGameRulesString(packet->m_messageId); if (string != nullptr) { std::wstring message(string); message = GameRuleDefinition::generateDescriptionString( @@ -3422,7 +3419,7 @@ void ClientConnection::handleUpdateGameRuleProgressPacket( Log::info( "handleUpdateGameRuleProgressPacket: Data tag is in range, so " "updating profile data\n"); - GameServices::setSpecialTutorialCompletionFlag(m_userIndex, + gameServices().setSpecialTutorialCompletionFlag(m_userIndex, packet->m_dataTag - 1); } } @@ -3444,7 +3441,7 @@ int ClientConnection::HostDisconnectReturned( // no upsell, we're about to quit MinecraftServer::getInstance()->setSaveOnExit(false); // flag a app action of exit game - GameServices::setAction(iPad, eAppAction_ExitWorld); + gameServices().setAction(iPad, eAppAction_ExitWorld); } } @@ -3465,7 +3462,7 @@ int ClientConnection::HostDisconnectReturned( } else { MinecraftServer::getInstance()->setSaveOnExit(true); // flag a app action of exit game - GameServices::setAction(iPad, eAppAction_ExitWorld); + gameServices().setAction(iPad, eAppAction_ExitWorld); } return 0; @@ -3485,7 +3482,7 @@ int ClientConnection::ExitGameAndSaveReturned( MinecraftServer::getInstance()->setSaveOnExit(false); } // flag a app action of exit game - GameServices::setAction(iPad, eAppAction_ExitWorld); + gameServices().setAction(iPad, eAppAction_ExitWorld); return 0; } diff --git a/targets/minecraft/client/multiplayer/MultiPlayerGameMode.cpp b/targets/minecraft/client/multiplayer/MultiPlayerGameMode.cpp index 4f076b37b..906a106d7 100644 --- a/targets/minecraft/client/multiplayer/MultiPlayerGameMode.cpp +++ b/targets/minecraft/client/multiplayer/MultiPlayerGameMode.cpp @@ -1,4 +1,4 @@ -#include "minecraft/util/DebugSettings.h" +#include "minecraft/IGameServices.h" #include "MultiPlayerGameMode.h" #include @@ -150,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 - // ||(DebugSettings::isOn() && - // DebugSettings::getMask(InputManager.GetPrimaryPad())&(1L< @@ -122,8 +122,8 @@ void MultiPlayerLevel::tick() { // 4J: Debug setting added to keep it at day time #if !defined(_FINAL_BUILD) bool freezeTime = - DebugSettings::isOn() && - DebugSettings::getMask(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 4ed8d21b4..dcdbfa22d 100644 --- a/targets/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp +++ b/targets/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp @@ -1,4 +1,4 @@ -#include "minecraft/GameServices.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Log.h" #include "MultiPlayerLocalPlayer.h" @@ -74,11 +74,11 @@ void MultiplayerLocalPlayer::tick() { // bool bIsisPrimaryHost=g_NetworkManager.IsHost() && // (InputManager.GetPrimaryPad()==m_iPad); - /*if((GameServices::getGameSettings(m_iPad,eGameSetting_PlayerVisibleInMap)!=0) != + /*if((gameServices().getGameSettings(m_iPad,eGameSetting_PlayerVisibleInMap)!=0) != m_bShownOnMaps) { m_bShownOnMaps = - (GameServices::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 @@ -379,7 +379,7 @@ void MultiplayerLocalPlayer::setAndBroadcastCustomSkin(std::uint32_t skinId) { if (getCustomSkin() != oldSkinIndex) connection->send(std::shared_ptr( new TextureAndGeometryChangePacket( - shared_from_this(), GameServices::getPlayerSkinName(GetXboxPad())))); + shared_from_this(), gameServices().getPlayerSkinName(GetXboxPad())))); } void MultiplayerLocalPlayer::setAndBroadcastCustomCape(std::uint32_t capeId) { @@ -392,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, - GameServices::getPlayerCapeName(GetXboxPad()))); + gameServices().getPlayerCapeName(GetXboxPad()))); } // 4J added for testing. This moves the player in a repeated sequence of 2 diff --git a/targets/minecraft/client/particle/DragonBreathParticle.cpp b/targets/minecraft/client/particle/DragonBreathParticle.cpp index c492d7599..95fb45e85 100644 --- a/targets/minecraft/client/particle/DragonBreathParticle.cpp +++ b/targets/minecraft/client/particle/DragonBreathParticle.cpp @@ -1,6 +1,6 @@ #include "DragonBreathParticle.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/Colours/ColourTable.h" #include "java/JavaMath.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/minecraft/client/particle/DripParticle.cpp b/targets/minecraft/client/particle/DripParticle.cpp index f841597e9..a91826588 100644 --- a/targets/minecraft/client/particle/DripParticle.cpp +++ b/targets/minecraft/client/particle/DripParticle.cpp @@ -2,7 +2,7 @@ #include -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/Colours/ColourTable.h" #include "java/JavaMath.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/minecraft/client/particle/EnchantmentTableParticle.cpp b/targets/minecraft/client/particle/EnchantmentTableParticle.cpp index 825d1f50a..5f1fc3a4c 100644 --- a/targets/minecraft/client/particle/EnchantmentTableParticle.cpp +++ b/targets/minecraft/client/particle/EnchantmentTableParticle.cpp @@ -1,6 +1,6 @@ #include "EnchantmentTableParticle.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/Colours/ColourTable.h" #include "java/JavaMath.h" #include "java/Random.h" diff --git a/targets/minecraft/client/particle/EnderParticle.cpp b/targets/minecraft/client/particle/EnderParticle.cpp index d6a223566..09b440886 100644 --- a/targets/minecraft/client/particle/EnderParticle.cpp +++ b/targets/minecraft/client/particle/EnderParticle.cpp @@ -1,6 +1,6 @@ #include "EnderParticle.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/Colours/ColourTable.h" #include "java/JavaMath.h" #include "java/Random.h" diff --git a/targets/minecraft/client/particle/ExplodeParticle.cpp b/targets/minecraft/client/particle/ExplodeParticle.cpp index d3a08edae..497e50880 100644 --- a/targets/minecraft/client/particle/ExplodeParticle.cpp +++ b/targets/minecraft/client/particle/ExplodeParticle.cpp @@ -1,6 +1,6 @@ #include "ExplodeParticle.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/Colours/ColourTable.h" #include "java/JavaMath.h" #include "java/Random.h" diff --git a/targets/minecraft/client/particle/HugeExplosionParticle.cpp b/targets/minecraft/client/particle/HugeExplosionParticle.cpp index 8f4934ba1..8ee5059e0 100644 --- a/targets/minecraft/client/particle/HugeExplosionParticle.cpp +++ b/targets/minecraft/client/particle/HugeExplosionParticle.cpp @@ -3,7 +3,7 @@ #include #include "platform/sdl2/Render.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/Colours/ColourTable.h" #include "java/Random.h" #include "minecraft/client/Lighting.h" diff --git a/targets/minecraft/client/particle/NetherPortalParticle.cpp b/targets/minecraft/client/particle/NetherPortalParticle.cpp index fd758dead..2f74cf654 100644 --- a/targets/minecraft/client/particle/NetherPortalParticle.cpp +++ b/targets/minecraft/client/particle/NetherPortalParticle.cpp @@ -1,6 +1,6 @@ #include "NetherPortalParticle.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/Colours/ColourTable.h" #include "java/JavaMath.h" #include "java/Random.h" diff --git a/targets/minecraft/client/particle/NoteParticle.cpp b/targets/minecraft/client/particle/NoteParticle.cpp index 265f1e9d5..e9544152e 100644 --- a/targets/minecraft/client/particle/NoteParticle.cpp +++ b/targets/minecraft/client/particle/NoteParticle.cpp @@ -2,7 +2,7 @@ #include -#include "app/common/App_enums.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 a1f5a2690..a4cd52689 100644 --- a/targets/minecraft/client/particle/SmokeParticle.cpp +++ b/targets/minecraft/client/particle/SmokeParticle.cpp @@ -1,6 +1,6 @@ #include "SmokeParticle.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/Colours/ColourTable.h" #include "java/JavaMath.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/minecraft/client/particle/SuspendedParticle.cpp b/targets/minecraft/client/particle/SuspendedParticle.cpp index 1cd551b34..2251c52ab 100644 --- a/targets/minecraft/client/particle/SuspendedParticle.cpp +++ b/targets/minecraft/client/particle/SuspendedParticle.cpp @@ -2,7 +2,7 @@ #include -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/Colours/ColourTable.h" #include "java/JavaMath.h" #include "java/Random.h" diff --git a/targets/minecraft/client/player/Input.cpp b/targets/minecraft/client/player/Input.cpp index 3de25df4e..d41178e7c 100644 --- a/targets/minecraft/client/player/Input.cpp +++ b/targets/minecraft/client/player/Input.cpp @@ -1,5 +1,4 @@ -#include "minecraft/GameServices.h" -#include "minecraft/util/DebugSettings.h" +#include "minecraft/IGameServices.h" #include "Input.h" #include @@ -7,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" @@ -52,7 +51,7 @@ void Input::tick(LocalPlayer* player) { ya = 0.0f; #ifndef _CONTENT_PACKAGE - if (DebugSettings::freezePlayers()) { + if (gameServices().debugFreezePlayers()) { xa = ya = 0.0f; player->abilities.flying = true; } @@ -89,7 +88,7 @@ void Input::tick(LocalPlayer* player) { pMinecraft->localgameModes[iPad]->isInputAllowed( MINECRAFT_ACTION_LOOK_RIGHT)) tx = InputManager.GetJoypadStick_RX(iPad) * - (((float)GameServices::getGameSettings(iPad, + (((float)gameServices().getGameSettings(iPad, eGameSetting_Sensitivity_InGame)) / 100.0f); // apply sensitivity to look if (pMinecraft->localgameModes[iPad]->isInputAllowed( @@ -97,16 +96,16 @@ void Input::tick(LocalPlayer* player) { pMinecraft->localgameModes[iPad]->isInputAllowed( MINECRAFT_ACTION_LOOK_DOWN)) ty = InputManager.GetJoypadStick_RY(iPad) * - (((float)GameServices::getGameSettings(iPad, + (((float)gameServices().getGameSettings(iPad, eGameSetting_Sensitivity_InGame)) / 100.0f); // apply sensitivity to look #ifndef _CONTENT_PACKAGE - if (DebugSettings::freezePlayers()) tx = ty = 0.0f; + if (gameServices().debugFreezePlayers()) tx = ty = 0.0f; #endif // 4J: WESTY : Invert look Y if required. - if (GameServices::getGameSettings(iPad, eGameSetting_ControlInvertLook)) { + if (gameServices().getGameSettings(iPad, eGameSetting_ControlInvertLook)) { ty = -ty; } @@ -129,7 +128,7 @@ void Input::tick(LocalPlayer* player) { pMinecraft->localgameModes[iPad]->isInputAllowed(MINECRAFT_ACTION_JUMP); #ifndef _CONTENT_PACKAGE - if (DebugSettings::freezePlayers()) 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 c0792812c..ff2fb41d1 100644 --- a/targets/minecraft/client/player/LocalPlayer.cpp +++ b/targets/minecraft/client/player/LocalPlayer.cpp @@ -1,5 +1,5 @@ #include "minecraft/client/IMenuService.h" -#include "minecraft/GameServices.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Log.h" #include "LocalPlayer.h" @@ -117,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 = GameServices::getMojangDataForXuid(getOnlineXuid()); + MOJANG_DATA* pMojangData = gameServices().getMojangDataForXuid(getOnlineXuid()); if (pMojangData) { customTextureUrl = pMojangData->wchSkin; } @@ -592,11 +592,11 @@ void LocalPlayer::openTextEdit(std::shared_ptr tileEntity) { bool success; if (tileEntity->GetType() == eTYPE_SIGNTILEENTITY) { - success = GameServices::menus().openSign( + success = gameServices().menus().openSign( GetXboxPad(), std::dynamic_pointer_cast(tileEntity)); } else if (tileEntity->GetType() == eTYPE_COMMANDBLOCKTILEENTITY) { - success = GameServices::menus().openCommandBlock( + success = gameServices().menus().openCommandBlock( GetXboxPad(), std::dynamic_pointer_cast(tileEntity)); } @@ -610,7 +610,7 @@ bool LocalPlayer::openContainer(std::shared_ptr container) { minecraft->setScreen(new ContainerScreen(inventory, container)); bool success = true; #else - bool success = GameServices::menus().openContainer(GetXboxPad(), inventory, container); + bool success = gameServices().menus().openContainer(GetXboxPad(), inventory, container); if (success) ui.PlayUISFX(eSFX_Press); #endif // minecraft->setScreen(new ContainerScreen(inventory, container)); @@ -622,7 +622,7 @@ bool LocalPlayer::openHopper(std::shared_ptr container) { minecraft->setScreen(new HopperScreen(inventory, container)); bool success = true; #else - bool success = GameServices::menus().openHopper(GetXboxPad(), inventory, container); + bool success = gameServices().menus().openHopper(GetXboxPad(), inventory, container); if (success) ui.PlayUISFX(eSFX_Press); #endif return success; @@ -633,7 +633,7 @@ bool LocalPlayer::openHopper(std::shared_ptr container) { minecraft->setScreen(new HopperScreen(inventory, container)); bool success = true; #else - bool success = GameServices::menus().openHopperMinecart(GetXboxPad(), inventory, container); + bool success = gameServices().menus().openHopperMinecart(GetXboxPad(), inventory, container); if (success) ui.PlayUISFX(eSFX_Press); #endif return success; @@ -645,7 +645,7 @@ bool LocalPlayer::openHorseInventory(std::shared_ptr horse, minecraft->setScreen(new HorseInventoryScreen(inventory, container, horse)); bool success = true; #else - bool success = GameServices::menus().openHorse(GetXboxPad(), inventory, container, horse); + bool success = gameServices().menus().openHorse(GetXboxPad(), inventory, container, horse); if (success) ui.PlayUISFX(eSFX_Press); #endif return success; @@ -656,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 = GameServices::menus().openCrafting3x3( + bool success = gameServices().menus().openCrafting3x3( GetXboxPad(), std::dynamic_pointer_cast(shared_from_this()), x, y, z); if (success) ui.PlayUISFX(eSFX_Press); @@ -667,7 +667,7 @@ bool LocalPlayer::startCrafting(int x, int y, int z) { } bool LocalPlayer::openFireworks(int x, int y, int z) { - bool success = GameServices::menus().openFireworks( + bool success = gameServices().menus().openFireworks( GetXboxPad(), std::dynamic_pointer_cast(shared_from_this()), x, y, z); if (success) ui.PlayUISFX(eSFX_Press); @@ -681,7 +681,7 @@ bool LocalPlayer::startEnchanting(int x, int y, int z, bool success = true; #else bool success = - GameServices::menus().openEnchanting(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; @@ -693,7 +693,7 @@ bool LocalPlayer::startRepairing(int x, int y, int z) { bool success = true; #else bool success = - GameServices::menus().openRepairing(GetXboxPad(), inventory, level, x, y, z); + gameServices().menus().openRepairing(GetXboxPad(), inventory, level, x, y, z); if (success) ui.PlayUISFX(eSFX_Press); #endif return success; @@ -704,7 +704,7 @@ bool LocalPlayer::openFurnace(std::shared_ptr furnace) { minecraft->setScreen(new FurnaceScreen(inventory, furnace)); bool success = true; #else - bool success = GameServices::menus().openFurnace(GetXboxPad(), inventory, furnace); + bool success = gameServices().menus().openFurnace(GetXboxPad(), inventory, furnace); if (success) ui.PlayUISFX(eSFX_Press); #endif return success; @@ -717,7 +717,7 @@ bool LocalPlayer::openBrewingStand( bool success = true; #else bool success = - GameServices::menus().openBrewingStand(GetXboxPad(), inventory, brewingStand); + gameServices().menus().openBrewingStand(GetXboxPad(), inventory, brewingStand); if (success) ui.PlayUISFX(eSFX_Press); #endif return success; @@ -728,7 +728,7 @@ bool LocalPlayer::openBeacon(std::shared_ptr beacon) { minecraft->setScreen(new BeaconScreen(inventory, beacon)); bool success = true; #else - bool success = GameServices::menus().openBeacon(GetXboxPad(), inventory, beacon); + bool success = gameServices().menus().openBeacon(GetXboxPad(), inventory, beacon); if (success) ui.PlayUISFX(eSFX_Press); #endif return success; @@ -739,7 +739,7 @@ bool LocalPlayer::openTrap(std::shared_ptr trap) { minecraft->setScreen(new TrapScreen(inventory, trap)); bool success = true; #else - bool success = GameServices::menus().openTrap(GetXboxPad(), inventory, trap); + bool success = gameServices().menus().openTrap(GetXboxPad(), inventory, trap); if (success) ui.PlayUISFX(eSFX_Press); #endif return success; @@ -752,7 +752,7 @@ bool LocalPlayer::openTrading(std::shared_ptr traderTarget, bool success = true; #else bool success = - GameServices::menus().openTrading(GetXboxPad(), inventory, traderTarget, level, name); + gameServices().menus().openTrading(GetXboxPad(), inventory, traderTarget, level, name); if (success) ui.PlayUISFX(eSFX_Press); #endif return success; @@ -826,7 +826,7 @@ void LocalPlayer::displayClientMessage(int messageId) { void LocalPlayer::awardStat(Stat* stat, const std::vector& param) { int count = CommonStats::readParam(param); - if (!GameServices::canRecordStatsAndAchievements()) return; + if (!gameServices().canRecordStatsAndAchievements()) return; if (stat == nullptr) return; if (stat->isAchievement()) { @@ -1576,39 +1576,39 @@ void LocalPlayer::updateRichPresence() { std::shared_ptr selectedItem = inventory->getSelected(); if (selectedItem != nullptr && selectedItem->id == Item::fishingRod_Id) { - GameServices::setRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_FISHING); + gameServices().setRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_FISHING); } else if (selectedItem != nullptr && selectedItem->id == Item::map_Id) { - GameServices::setRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_MAP); + gameServices().setRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_MAP); } else if ((riding != nullptr) && riding->instanceof(eTYPE_MINECART)) { - GameServices::setRichPresenceContext(m_iPad, + gameServices().setRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_RIDING_MINECART); } else if ((riding != nullptr) && riding->instanceof(eTYPE_BOAT)) { - GameServices::setRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_BOATING); + gameServices().setRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_BOATING); } else if ((riding != nullptr) && riding->instanceof(eTYPE_PIG)) { - GameServices::setRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_RIDING_PIG); + gameServices().setRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_RIDING_PIG); } else if (this->dimension == -1) { - GameServices::setRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_NETHER); + gameServices().setRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_NETHER); } else if (minecraft->soundEngine->GetIsPlayingStreamingCDMusic()) { - GameServices::setRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_CD); + gameServices().setRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_CD); } else { - GameServices::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 = GameServices::getAppTime(); + m_sessionTimeStart = gameServices().getAppTime(); m_dimensionTimeStart = m_sessionTimeStart; } float LocalPlayer::getSessionTimer(void) { - return GameServices::getAppTime() - m_sessionTimeStart; + return gameServices().getAppTime() - m_sessionTimeStart; } float LocalPlayer::getAndResetChangeDimensionTimer() { - float appTime = GameServices::getAppTime(); + float appTime = gameServices().getAppTime(); float returnVal = appTime - m_dimensionTimeStart; m_dimensionTimeStart = appTime; return returnVal; diff --git a/targets/minecraft/client/renderer/GameRenderer.cpp b/targets/minecraft/client/renderer/GameRenderer.cpp index 3fac3bd98..87228a1eb 100644 --- a/targets/minecraft/client/renderer/GameRenderer.cpp +++ b/targets/minecraft/client/renderer/GameRenderer.cpp @@ -1,4 +1,4 @@ -#include "minecraft/GameServices.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Log.h" #include "GameRenderer.h" @@ -15,7 +15,7 @@ #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/Colours/ColourTable.h" #include "app/linux/LinuxGame.h" @@ -665,7 +665,7 @@ void GameRenderer::setupCamera(float a, int eye) { bool bNoBobbingAnim = (mc->player->getAnimOverrideBitmask() & (1 << HumanoidModel::eAnim_NoBobbing)) != 0; - if (GameServices::getGameSettings(mc->player->GetXboxPad(), eGameSetting_ViewBob) && + if (gameServices().getGameSettings(mc->player->GetXboxPad(), eGameSetting_ViewBob) && !mc->player->abilities.flying && !bNoLegAnim && !bNoBobbingAnim) bobView(a); @@ -719,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) && - GameServices::getGameSettings(localplayer->GetXboxPad(), + gameServices().getGameSettings(localplayer->GetXboxPad(), eGameSetting_DisplayHand) == 0) renderHand = false; } @@ -760,7 +760,7 @@ void GameRenderer::renderItemInHand(float a, int eye) { bool bNoLegAnim = (localplayer->getAnimOverrideBitmask() & ((1 << HumanoidModel::eAnim_NoLegAnim) | (1 << HumanoidModel::eAnim_NoBobbing))) != 0; - if (GameServices::getGameSettings(localplayer->GetXboxPad(), eGameSetting_ViewBob) && + if (gameServices().getGameSettings(localplayer->GetXboxPad(), eGameSetting_ViewBob) && !localplayer->abilities.flying && !bNoLegAnim) bobView(a); @@ -792,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 (GameServices::getGameSettings(localplayer->GetXboxPad(), eGameSetting_ViewBob) && + if (gameServices().getGameSettings(localplayer->GetXboxPad(), eGameSetting_ViewBob) && !localplayer->abilities.flying && !bNoLegAnim) bobView(a); } diff --git a/targets/minecraft/client/renderer/ItemInHandRenderer.cpp b/targets/minecraft/client/renderer/ItemInHandRenderer.cpp index 7505637c6..b16b03ed5 100644 --- a/targets/minecraft/client/renderer/ItemInHandRenderer.cpp +++ b/targets/minecraft/client/renderer/ItemInHandRenderer.cpp @@ -1,4 +1,4 @@ -#include "minecraft/GameServices.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Log.h" #include "ItemInHandRenderer.h" @@ -9,7 +9,7 @@ #include #include "platform/sdl2/Render.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/Colours/ColourTable.h" #include "app/linux/LinuxGame.h" #include "Tesselator.h" @@ -549,7 +549,7 @@ void ItemInHandRenderer::render(float a) { player->inventory->getSelected(); if ((itemInstance && (itemInstance->getItem()->id == Item::map_Id)) || - GameServices::getGameSettings(localPlayer->GetXboxPad(), + gameServices().getGameSettings(localPlayer->GetXboxPad(), eGameSetting_DisplayHand) != 0) { playerRenderer->renderHand(); } @@ -766,7 +766,7 @@ void ItemInHandRenderer::render(float a) { player->inventory->getSelected(); if ((itemInstance && (itemInstance->getItem()->id == Item::map_Id)) || - GameServices::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 f0e596964..03173d8b2 100644 --- a/targets/minecraft/client/renderer/LevelRenderer.cpp +++ b/targets/minecraft/client/renderer/LevelRenderer.cpp @@ -1,5 +1,4 @@ -#include "minecraft/GameServices.h" -#include "minecraft/util/DebugSettings.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Log.h" #include "LevelRenderer.h" @@ -21,7 +20,7 @@ #include "platform/sdl2/Render.h" #include "Chunk.h" #include "GameRenderer.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/Audio/SoundEngine.h" #include "app/common/Colours/ColourTable.h" #include "app/common/Console_Debug_enum.h" @@ -448,8 +447,8 @@ void LevelRenderer::setLevel(int playerIndex, MultiPlayerLevel* level) { } void LevelRenderer::AddDLCSkinsToMemTextures() { - for (int i = 0; i < GameServices::getSkinNames().size(); i++) { - textures->addMemTexture(GameServices::getSkinNames()[i], + for (int i = 0; i < gameServices().getSkinNames().size(); i++) { + textures->addMemTexture(gameServices().getSkinNames()[i], new MobSkinMemTextureProcessor()); } } @@ -1165,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 (GameServices::getGameSettings(InputManager.GetPrimaryPad(), + if (gameServices().getGameSettings(InputManager.GetPrimaryPad(), eGameSetting_Clouds) == 0) { return; } @@ -1178,8 +1177,8 @@ void LevelRenderer::renderClouds(float alpha) { return; } - if (DebugSettings::isOn()) { - if (DebugSettings::getMask(InputManager.GetPrimaryPad()) & + if (gameServices().debugSettingsOn()) { + if (gameServices().debugGetMask(InputManager.GetPrimaryPad()) & (1L << eDebugSetting_FreezeTime)) { iTicks = m_freezeticks; } @@ -1256,8 +1255,8 @@ void LevelRenderer::renderClouds(float alpha) { glDisable(GL_BLEND); glEnable(GL_CULL_FACE); - if (DebugSettings::isOn()) { - if (!(DebugSettings::getMask(InputManager.GetPrimaryPad()) & + if (gameServices().debugSettingsOn()) { + if (!(gameServices().debugGetMask(InputManager.GetPrimaryPad()) & (1L << eDebugSetting_FreezeTime))) { m_freezeticks = iTicks; } @@ -1442,8 +1441,8 @@ void LevelRenderer::renderAdvancedClouds(float alpha) { int iTicks = ticks; - if (DebugSettings::isOn()) { - if (DebugSettings::getMask(InputManager.GetPrimaryPad()) & + if (gameServices().debugSettingsOn()) { + if (gameServices().debugGetMask(InputManager.GetPrimaryPad()) & (1L << eDebugSetting_FreezeTime)) { iTicks = m_freezeticks; } @@ -1689,8 +1688,8 @@ void LevelRenderer::renderAdvancedClouds(float alpha) { glDisable(GL_BLEND); glEnable(GL_CULL_FACE); - if (DebugSettings::isOn()) { - if (!(DebugSettings::getMask(InputManager.GetPrimaryPad()) & + if (gameServices().debugSettingsOn()) { + if (!(gameServices().debugGetMask(InputManager.GetPrimaryPad()) & (1L << eDebugSetting_FreezeTime))) { m_freezeticks = iTicks; } @@ -2221,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 (GameServices::getGameSettings(iPad, eGameSetting_DisplayHUD) == 0) return; + if (gameServices().getGameSettings(iPad, eGameSetting_DisplayHUD) == 0) return; RenderManager.StateSetLightingEnable(false); glDisable(GL_TEXTURE_2D); diff --git a/targets/minecraft/client/renderer/LevelRenderer.h b/targets/minecraft/client/renderer/LevelRenderer.h index 0de9fcc4d..12e02de73 100644 --- a/targets/minecraft/client/renderer/LevelRenderer.h +++ b/targets/minecraft/client/renderer/LevelRenderer.h @@ -1,6 +1,6 @@ #pragma once #include "platform/NetTypes.h" -#include "minecraft/client/SkinBox.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/Textures.cpp b/targets/minecraft/client/renderer/Textures.cpp index 73cf2ddd4..29b66723a 100644 --- a/targets/minecraft/client/renderer/Textures.cpp +++ b/targets/minecraft/client/renderer/Textures.cpp @@ -1,4 +1,4 @@ -#include "minecraft/GameServices.h" +#include "minecraft/IGameServices.h" #include "Textures.h" #include @@ -1004,7 +1004,7 @@ int Textures::loadMemTexture(const std::wstring& url, if (it != memTextures.end()) { texture = (*it).second; } - if (texture == nullptr && GameServices::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()); } @@ -1041,7 +1041,7 @@ int Textures::loadMemTexture(const std::wstring& url, int backup) { if (it != memTextures.end()) { texture = (*it).second; } - if (texture == nullptr && GameServices::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()); } @@ -1082,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; - GameServices::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 43f7a327e..86a878035 100644 --- a/targets/minecraft/client/renderer/TileRenderer.cpp +++ b/targets/minecraft/client/renderer/TileRenderer.cpp @@ -12,7 +12,7 @@ #include "platform/sdl2/Render.h" #include "EntityTileRenderer.h" #include "GameRenderer.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/Colours/ColourTable.h" #include "util/FrameProfiler.h" #include "Tesselator.h" diff --git a/targets/minecraft/client/renderer/entity/LivingEntityRenderer.cpp b/targets/minecraft/client/renderer/entity/LivingEntityRenderer.cpp index ca7a436a3..36a56b8f1 100644 --- a/targets/minecraft/client/renderer/entity/LivingEntityRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/LivingEntityRenderer.cpp @@ -1,5 +1,4 @@ -#include "minecraft/GameServices.h" -#include "minecraft/GameHostOptions.h" +#include "minecraft/IGameServices.h" #include "LivingEntityRenderer.h" #include @@ -8,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" @@ -390,12 +389,12 @@ void LivingEntityRenderer::renderName(std::shared_ptr mob, if (!msg.empty()) { if (mob->isSneaking()) { - if (GameServices::getGameSettings(eGameSetting_DisplayHUD) == 0) { + if (gameServices().getGameSettings(eGameSetting_DisplayHUD) == 0) { // 4J-PB - turn off gamertag render return; } - if (GameHostOptions::get(eGameHostOption_Gamertags) == 0) { + if (gameServices().getGameHostOption(eGameHostOption_Gamertags) == 0) { // turn off gamertags if the host has set them off return; } @@ -465,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 (GameServices::getGameSettings(eGameSetting_DisplayHUD) == 0) { + if (gameServices().getGameSettings(eGameSetting_DisplayHUD) == 0) { // 4J-PB - turn off gamertag render return; } - if (GameHostOptions::get(eGameHostOption_Gamertags) == 0) { + if (gameServices().getGameHostOption(eGameHostOption_Gamertags) == 0) { // turn off gamertags if the host has set them off return; } @@ -501,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 (GameServices::getLocalPlayerCount() > 2) { + } else if (gameServices().getLocalPlayerCount() > 2) { readableDist = PLAYER_NAME_READABLE_DISTANCE_SPLITSCREEN; } @@ -529,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 (GameServices::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 81381c4cc..190bb5373 100644 --- a/targets/minecraft/client/renderer/entity/MobRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/MobRenderer.cpp @@ -7,7 +7,7 @@ #include "platform/sdl2/Render.h" #include "EntityRenderDispatcher.h" #include "LivingEntityRenderer.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/Colours/ColourTable.h" #include "java/Class.h" diff --git a/targets/minecraft/client/renderer/entity/PlayerRenderer.cpp b/targets/minecraft/client/renderer/entity/PlayerRenderer.cpp index 07b5041a3..f4c1acd51 100644 --- a/targets/minecraft/client/renderer/entity/PlayerRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/PlayerRenderer.cpp @@ -1,5 +1,4 @@ -#include "minecraft/GameServices.h" -#include "minecraft/GameHostOptions.h" +#include "minecraft/IGameServices.h" #include "PlayerRenderer.h" #include @@ -9,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" @@ -303,7 +302,7 @@ void PlayerRenderer::additionalRendering(std::shared_ptr _mob, } // need to add a custom texture for deadmau5 - if (mob != nullptr && GameServices::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) - @@ -524,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 (GameHostOptions::get(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 662861ace..951a19701 100644 --- a/targets/minecraft/client/renderer/entity/PlayerRenderer.h +++ b/targets/minecraft/client/renderer/entity/PlayerRenderer.h @@ -3,7 +3,7 @@ #include #include "platform/NetTypes.h" -#include "minecraft/client/SkinBox.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/tileentity/SignRenderer.cpp b/targets/minecraft/client/renderer/tileentity/SignRenderer.cpp index 5c9b0d935..239ce3f30 100644 --- a/targets/minecraft/client/renderer/tileentity/SignRenderer.cpp +++ b/targets/minecraft/client/renderer/tileentity/SignRenderer.cpp @@ -1,4 +1,4 @@ -#include "minecraft/locale/Strings.h" +#include "minecraft/IGameServices.h" #include "SignRenderer.h" #include @@ -6,7 +6,7 @@ #include #include "platform/sdl2/Render.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/Colours/ColourTable.h" #include "app/linux/LinuxGame.h" #include "platform/XboxStubs.h" @@ -90,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 = Strings::get(IDS_STRINGVERIFY_CENSORED); + msg = gameServices().getString(IDS_STRINGVERIFY_CENSORED); break; } } else { @@ -105,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 = Strings::get(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 04951d109..b8917360b 100644 --- a/targets/minecraft/client/skins/AbstractTexturePack.cpp +++ b/targets/minecraft/client/skins/AbstractTexturePack.cpp @@ -7,7 +7,7 @@ #include #include "app/common/Colours/ColourTable.h" -#include "minecraft/GameServices.h" +#include "minecraft/IGameServices.h" #include "app/linux/Linux_UIController.h" #include "app/linux/Stubs/winapi_stubs.h" #include "minecraft/client/BufferedImage.h" @@ -194,14 +194,14 @@ void AbstractTexturePack::loadDefaultColourTable() { } else { Log::info("Failed to load the default colours table\n"); - GameServices::fatalLoadError(); + gameServices().fatalLoadError(); } } void AbstractTexturePack::loadDefaultHTMLColourTable() { - if (GameServices::hasArchiveFile(L"HTMLColours.col")) { + if (gameServices().hasArchiveFile(L"HTMLColours.col")) { std::vector textColours = - GameServices::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 f6ced500d..ec7798b92 100644 --- a/targets/minecraft/client/skins/DLCTexturePack.cpp +++ b/targets/minecraft/client/skins/DLCTexturePack.cpp @@ -1,4 +1,4 @@ -#include "minecraft/GameServices.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Log.h" #include "DLCTexturePack.h" @@ -9,7 +9,7 @@ #include "platform/sdl2/Input.h" #include "platform/sdl2/Storage.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/Audio/SoundEngine.h" #include "app/common/Colours/ColourTable.h" #include "app/common/DLC/DLCAudioFile.h" @@ -79,8 +79,8 @@ DLCTexturePack::DLCTexturePack(std::uint32_t id, DLCPack* pack, m_bLoadingData = false; m_bHasLoadedData = false; m_archiveFile = nullptr; - if (GameServices::getLevelGenerationOptions()) - GameServices::getLevelGenerationOptions()->setLoadedData(); + if (gameServices().getLevelGenerationOptions()) + gameServices().getLevelGenerationOptions()->setLoadedData(); m_bUsingDefaultColourTable = true; m_stringTable = nullptr; @@ -226,9 +226,9 @@ void DLCTexturePack::loadColourTable() { } // Load the text colours - if (GameServices::hasArchiveFile(L"HTMLColours.col")) { + if (gameServices().hasArchiveFile(L"HTMLColours.col")) { std::vector textColours = - GameServices::getArchiveFile(L"HTMLColours.col"); + gameServices().getArchiveFile(L"HTMLColours.col"); m_colourTable->loadColoursFromData(textColours.data(), textColours.size()); } @@ -246,8 +246,8 @@ void DLCTexturePack::loadData() { "TPACK") != ERROR_IO_PENDING) { // corrupt DLC m_bHasLoadedData = true; - if (GameServices::getLevelGenerationOptions()) - GameServices::getLevelGenerationOptions()->setLoadedData(); + if (gameServices().getLevelGenerationOptions()) + gameServices().getLevelGenerationOptions()->setLoadedData(); Log::info("Failed to mount texture pack DLC %d for pad %d\n", mountIndex, InputManager.GetPrimaryPad()); } else { @@ -257,9 +257,9 @@ void DLCTexturePack::loadData() { } } else { m_bHasLoadedData = true; - if (GameServices::getLevelGenerationOptions()) - GameServices::getLevelGenerationOptions()->setLoadedData(); - GameServices::setAction(InputManager.GetPrimaryPad(), + if (gameServices().getLevelGenerationOptions()) + gameServices().getLevelGenerationOptions()->setLoadedData(); + gameServices().setAction(InputManager.GetPrimaryPad(), eAppAction_ReloadTexturePack); } } @@ -267,7 +267,7 @@ void DLCTexturePack::loadData() { std::wstring DLCTexturePack::getFilePath(std::uint32_t packId, std::wstring filename, bool bAddDataFolder) { - return GameServices::getFilePath(packId, filename, bAddDataFolder); + return gameServices().getFilePath(packId, filename, bAddDataFolder); } int DLCTexturePack::onPackMounted(int iPad, std::uint32_t dwErr, @@ -288,7 +288,7 @@ int DLCTexturePack::onPackMounted(int iPad, std::uint32_t dwErr, std::wstring dataFilePath = texturePack->m_dlcInfoPack->getFullDataPath(); if (!dataFilePath.empty()) { - if (!GameServices::getDLCManager().readDLCDataFile( + if (!gameServices().dlcReadDataFile( dwFilesProcessed, getFilePath(texturePack->m_dlcInfoPack->GetPackID(), dataFilePath), @@ -311,7 +311,7 @@ int DLCTexturePack::onPackMounted(int iPad, std::uint32_t dwErr, */ DLCPack* pack = texturePack->m_dlcInfoPack->GetParentPack(); LevelGenerationOptions* levelGen = - GameServices::getLevelGenerationOptions(); + gameServices().getLevelGenerationOptions(); if (levelGen != nullptr && !levelGen->hasLoadedData()) { int gameRulesCount = pack->getDLCItemsCount( DLCManager::e_DLCType_GameRulesHeader); @@ -338,10 +338,10 @@ int DLCTexturePack::onPackMounted(int iPad, std::uint32_t dwErr, delete[] pbData; - GameServices::getGameRules().setLevelGenerationOptions( + gameServices().setLevelGenerationOptions( dlcFile->lgo); } else { - GameServices::fatalLoadError(); + gameServices().fatalLoadError(); } } } @@ -359,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 { - GameServices::fatalLoadError(); + gameServices().fatalLoadError(); } } } @@ -402,9 +402,9 @@ int DLCTexturePack::onPackMounted(int iPad, std::uint32_t dwErr, } texturePack->m_bHasLoadedData = true; - if (GameServices::getLevelGenerationOptions()) - GameServices::getLevelGenerationOptions()->setLoadedData(); - GameServices::setAction(InputManager.GetPrimaryPad(), eAppAction_ReloadTexturePack); + if (gameServices().getLevelGenerationOptions()) + gameServices().getLevelGenerationOptions()->setLoadedData(); + gameServices().setAction(InputManager.GetPrimaryPad(), eAppAction_ReloadTexturePack); return 0; } @@ -431,7 +431,7 @@ void DLCTexturePack::unloadUI() { } AbstractTexturePack::unloadUI(); - GameServices::getDLCManager().removePack(m_dlcDataPack); + gameServices().dlcRemovePack(m_dlcDataPack); m_dlcDataPack = nullptr; delete m_archiveFile; m_bHasLoadedData = false; diff --git a/targets/minecraft/client/skins/DefaultTexturePack.cpp b/targets/minecraft/client/skins/DefaultTexturePack.cpp index 9c1543771..5305d3843 100644 --- a/targets/minecraft/client/skins/DefaultTexturePack.cpp +++ b/targets/minecraft/client/skins/DefaultTexturePack.cpp @@ -1,4 +1,4 @@ -#include "minecraft/GameServices.h" +#include "minecraft/IGameServices.h" #include "DefaultTexturePack.h" @@ -18,9 +18,9 @@ DefaultTexturePack::DefaultTexturePack() } void DefaultTexturePack::loadIcon() { - if (GameServices::hasArchiveFile(L"Graphics\\TexturePackIcon.png")) { + if (gameServices().hasArchiveFile(L"Graphics\\TexturePackIcon.png")) { std::vector ba = - GameServices::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 8f33b5b71..fa2e00689 100644 --- a/targets/minecraft/client/skins/DefaultTexturePack.h +++ b/targets/minecraft/client/skins/DefaultTexturePack.h @@ -3,7 +3,7 @@ #include "AbstractTexturePack.h" #include "java/InputOutputStream/InputStream.h" -#include "minecraft/locale/Strings.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 Strings::get(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 53cdf640f..7a2afdc2e 100644 --- a/targets/minecraft/client/skins/TexturePackRepository.cpp +++ b/targets/minecraft/client/skins/TexturePackRepository.cpp @@ -1,4 +1,4 @@ -#include "minecraft/GameServices.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Log.h" #include "TexturePackRepository.h" @@ -10,7 +10,7 @@ #include "platform/sdl2/Input.h" #include "DLCTexturePack.h" #include "DefaultTexturePack.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" #include "app/linux/LinuxGame.h" @@ -142,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 - GameServices::setRequiredTexturePackID(id); + gameServices().setRequiredTexturePackID(id); auto it = cacheById.find(id); if (it != cacheById.end()) { @@ -151,7 +151,7 @@ bool TexturePackRepository::selectTexturePackById(std::uint32_t id) { selectSkin(newPack); if (newPack->hasData()) { - GameServices::setAction(InputManager.GetPrimaryPad(), + gameServices().setAction(InputManager.GetPrimaryPad(), eAppAction_ReloadTexturePack); } else { newPack->loadData(); @@ -167,7 +167,7 @@ bool TexturePackRepository::selectTexturePackById(std::uint32_t id) { "Failed to select texture pack %d as it is not in the list\n", id); // Fail safely if (selectSkin(DEFAULT_TEXTURE_PACK)) { - GameServices::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 04c657856..6f39edeaf 100644 --- a/targets/minecraft/client/title/TitleScreen.cpp +++ b/targets/minecraft/client/title/TitleScreen.cpp @@ -1,4 +1,4 @@ -#include "minecraft/GameServices.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Log.h" #include "TitleScreen.h" @@ -43,8 +43,8 @@ TitleScreen::TitleScreen() { int splashIndex; std::wstring filename = L"splashes.txt"; - if (GameServices::hasArchiveFile(filename)) { - std::vector splashesArray = GameServices::getArchiveFile(filename); + if (gameServices().hasArchiveFile(filename)) { + std::vector splashesArray = gameServices().getArchiveFile(filename); ByteArrayInputStream bais(splashesArray); InputStreamReader isr(&bais); BufferedReader br(&isr); diff --git a/targets/minecraft/core/ItemDispenseBehaviors.cpp b/targets/minecraft/core/ItemDispenseBehaviors.cpp index 7be8e1053..f3754bfee 100644 --- a/targets/minecraft/core/ItemDispenseBehaviors.cpp +++ b/targets/minecraft/core/ItemDispenseBehaviors.cpp @@ -1,10 +1,10 @@ -#include "minecraft/GameHostOptions.h" +#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" @@ -449,7 +449,7 @@ std::shared_ptr TntDispenseBehavior::execute( Level* world = source->getWorld(); if (world->newPrimedTntAllowed() && - GameHostOptions::get(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/locale/Strings.cpp b/targets/minecraft/locale/Strings.cpp deleted file mode 100644 index 3c30d9a0b..000000000 --- a/targets/minecraft/locale/Strings.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include "minecraft/locale/Strings.h" - -#include - -namespace Strings { - -static LookupFn s_lookup = nullptr; - -void init(LookupFn fn) { s_lookup = fn; } - -const wchar_t* get(int id) { - assert(s_lookup && "Strings::init() must be called before Strings::get()"); - return s_lookup(id); -} - -} // namespace Strings diff --git a/targets/minecraft/locale/Strings.h b/targets/minecraft/locale/Strings.h deleted file mode 100644 index 73f7db0b9..000000000 --- a/targets/minecraft/locale/Strings.h +++ /dev/null @@ -1,12 +0,0 @@ -#pragma once - -#include - -namespace Strings { - -using LookupFn = const wchar_t* (*)(int); - -void init(LookupFn fn); -[[nodiscard]] const wchar_t* get(int id); - -} // namespace Strings diff --git a/targets/minecraft/network/packet/PreLoginPacket.cpp b/targets/minecraft/network/packet/PreLoginPacket.cpp index 5de0a2d42..3cb9a859b 100644 --- a/targets/minecraft/network/packet/PreLoginPacket.cpp +++ b/targets/minecraft/network/packet/PreLoginPacket.cpp @@ -1,3 +1,4 @@ +#include "minecraft/IGameServices.h" #include "minecraft/util/Log.h" #include "PreLoginPacket.h" @@ -6,7 +7,6 @@ #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" @@ -83,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 diff --git a/targets/minecraft/network/packet/TextureAndGeometryPacket.h b/targets/minecraft/network/packet/TextureAndGeometryPacket.h index 604454666..5247b5547 100644 --- a/targets/minecraft/network/packet/TextureAndGeometryPacket.h +++ b/targets/minecraft/network/packet/TextureAndGeometryPacket.h @@ -5,7 +5,7 @@ #include #include -#include "minecraft/client/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/server/MinecraftServer.cpp b/targets/minecraft/server/MinecraftServer.cpp index 49bc094d8..a58e9a2ef 100644 --- a/targets/minecraft/server/MinecraftServer.cpp +++ b/targets/minecraft/server/MinecraftServer.cpp @@ -1,6 +1,4 @@ -#include "minecraft/GameServices.h" -#include "minecraft/util/DebugSettings.h" -#include "minecraft/GameHostOptions.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Log.h" #include "MinecraftServer.h" @@ -19,7 +17,7 @@ #include "platform/sdl2/Storage.h" #include "ConsoleInput.h" #include "DispenserBootstrap.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/GameRules/GameRuleManager.h" #include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" #include "app/common/Network/GameNetworkManager.h" @@ -154,27 +152,27 @@ bool MinecraftServer::initServer(int64_t seed, NetworkGameInitData* initData, Log::info("\n*** SERVER SETTINGS ***\n"); Log::info( "ServerSettings: host-friends-only is %s\n", - (GameHostOptions::get(eGameHostOption_FriendsOfFriends) > 0) ? "on" + (gameServices().getGameHostOption(eGameHostOption_FriendsOfFriends) > 0) ? "on" : "off"); Log::info("ServerSettings: game-type is %s\n", - (GameHostOptions::get(eGameHostOption_GameType) == 0) + (gameServices().getGameHostOption(eGameHostOption_GameType) == 0) ? "Survival Mode" : "Creative Mode"); Log::info( "ServerSettings: pvp is %s\n", - (GameHostOptions::get(eGameHostOption_PvP) > 0) ? "on" : "off"); + (gameServices().getGameHostOption(eGameHostOption_PvP) > 0) ? "on" : "off"); Log::info("ServerSettings: fire spreads is %s\n", - (GameHostOptions::get(eGameHostOption_FireSpreads) > 0) + (gameServices().getGameHostOption(eGameHostOption_FireSpreads) > 0) ? "on" : "off"); Log::info( "ServerSettings: tnt explodes is %s\n", - (GameHostOptions::get(eGameHostOption_TNT) > 0) ? "on" : "off"); + (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", - // (GameHostOptions::get(eGameHostOption_FriendsOfFriends)>0) ); + // (gameServices().getGameHostOption(eGameHostOption_FriendsOfFriends)>0) ); // 4J - Unused // localIp = settings->getString(L"server-ip", L""); @@ -184,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(GameHostOptions::get(eGameHostOption_PvP) > 0 + setPvpAllowed(gameServices().getGameHostOption(eGameHostOption_PvP) > 0 ? true : false); // settings->getBoolean(L"pvp", true); @@ -204,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 (GameServices::getLevelGenerationOptions() != nullptr && - !GameServices::getLevelGenerationOptions()->hasLoadedData()) + while (gameServices().getLevelGenerationOptions() != nullptr && + !gameServices().getLevelGenerationOptions()->hasLoadedData()) std::this_thread::sleep_for(std::chrono::milliseconds(1)); - if (GameServices::getLevelGenerationOptions() != nullptr && - !GameServices::getLevelGenerationOptions()->ready()) { + if (gameServices().getLevelGenerationOptions() != nullptr && + !gameServices().getLevelGenerationOptions()->ready()) { // TODO: Stop loading, add error message. } @@ -219,12 +217,12 @@ bool MinecraftServer::initServer(int64_t seed, NetworkGameInitData* initData, std::wstring levelTypeString; bool gameRuleUseFlatWorld = false; - if (GameServices::getLevelGenerationOptions() != nullptr) { + if (gameServices().getLevelGenerationOptions() != nullptr) { gameRuleUseFlatWorld = - GameServices::getLevelGenerationOptions()->getuseFlatWorld(); + gameServices().getLevelGenerationOptions()->getuseFlatWorld(); } if (gameRuleUseFlatWorld || - GameHostOptions::get(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"); @@ -380,16 +378,16 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, int gameTypeId = settings->getInt( L"gamemode", - GameHostOptions::get( + gameServices().getGameHostOption( eGameHostOption_GameType)); // LevelSettings::GAMETYPE_SURVIVAL); GameType* gameType = LevelSettings::validateGameType(gameTypeId); Log::info("Default game type: %d\n", gameTypeId); LevelSettings* levelSettings = new LevelSettings( levelSeed, gameType, - GameHostOptions::get(eGameHostOption_Structures) > 0 ? true : false, + gameServices().getGameHostOption(eGameHostOption_Structures) > 0 ? true : false, isHardcore(), true, pLevelType, initData->xzSize, initData->hellScale); - if (GameHostOptions::get(eGameHostOption_BonusChest)) + if (gameServices().getGameHostOption(eGameHostOption_BonusChest)) levelSettings->enableStartingBonusItems(); // 4J - temp - load existing level @@ -422,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 = GameServices::getLevelGenerationOptions(); + LevelGenerationOptions* levelGen = gameServices().getLevelGenerationOptions(); if (levelGen != nullptr && levelGen->requiresBaseSave()) { unsigned int fileSize = 0; std::uint8_t* pvSaveData = levelGen->getBaseSaveData(fileSize); @@ -461,9 +459,9 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, if (i == 0) { levels[i] = new ServerLevel(this, storage, name, dimension, levelSettings); - if (GameServices::getLevelGenerationOptions() != nullptr) { + if (gameServices().getLevelGenerationOptions() != nullptr) { LevelGenerationOptions* mapOptions = - GameServices::getLevelGenerationOptions(); + gameServices().getLevelGenerationOptions(); Pos* spawnPos = mapOptions->getSpawnPos(); if (spawnPos != nullptr) { levels[i]->setSpawnPos(spawnPos); @@ -485,7 +483,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, // ? Difficulty::EASY : Difficulty::PEACEFUL; Minecraft* pMinecraft = Minecraft::GetInstance(); // m_lastSentDifficulty = pMinecraft->options->difficulty; - levels[i]->difficulty = GameHostOptions::get( + levels[i]->difficulty = gameServices().getGameHostOption( eGameHostOption_Difficulty); // pMinecraft->options->difficulty; Log::info("MinecraftServer::loadLevel - Difficulty = %d\n", levels[i]->difficulty); @@ -498,9 +496,9 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, #endif levels[i]->getLevelData()->setGameType(gameType); - if (GameServices::getLevelGenerationOptions() != nullptr) { + if (gameServices().getLevelGenerationOptions() != nullptr) { LevelGenerationOptions* mapOptions = - GameServices::getLevelGenerationOptions(); + gameServices().getLevelGenerationOptions(); levels[i]->getLevelData()->setHasBeenInCreative( mapOptions->getLevelHasBeenInCreative()); } @@ -513,10 +511,10 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, } else { mcprogress->progressStage(IDS_PROGRESS_LOADING_SPAWN_AREA); } - GameHostOptions::set( + gameServices().setGameHostOption( eGameHostOption_HasBeenInCreative, gameType == GameType::CREATIVE || levels[0]->getHasBeenInCreative()); - GameHostOptions::set(eGameHostOption_Structures, + gameServices().setGameHostOption(eGameHostOption_Structures, levels[0]->isGenerateMapFeatures()); if (s_bServerHalted || !g_NetworkManager.IsInSession()) return false; @@ -556,14 +554,14 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, &numberOfBytesRead); assert(numberOfBytesRead == ba_gameRules.size()); - GameServices::getGameRules().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 (GameServices::getGameNewWorldSize() > levels[0]->getLevelData()->getXZSizeOld()) { - if (!GameServices::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 { @@ -654,7 +652,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, if (!levels[0]->getLevelData()->getHasStronghold()) { int x, z; - if (GameServices::getTerrainFeaturePosition(eTerrainFeature_Stronghold, &x, + if (gameServices().getTerrainFeaturePosition(eTerrainFeature_Stronghold, &x, &z)) { levels[0]->getLevelData()->setXStronghold(x); levels[0]->getLevelData()->setZStronghold(z); @@ -833,8 +831,8 @@ void MinecraftServer::saveAllChunks() { // 4J-JEV: Added void MinecraftServer::saveGameRules() { #if !defined(_CONTENT_PACKAGE) - if (DebugSettings::isOn() && - DebugSettings::getMask(InputManager.GetPrimaryPad()) & + if (gameServices().debugSettingsOn() && + gameServices().debugGetMask(InputManager.GetPrimaryPad()) & (1L << eDebugSetting_DistributableSave)) { // Do nothing } else @@ -842,7 +840,7 @@ void MinecraftServer::saveGameRules() { { uint8_t* baPtr = nullptr; unsigned int baSize = 0; - GameServices::getGameRules().saveGameRules(&baPtr, &baSize); + gameServices().saveGameRules(&baPtr, &baSize); if (baPtr != nullptr) { std::vector ba(baPtr, baPtr + baSize); @@ -928,7 +926,7 @@ void MinecraftServer::stopServer(bool didInit) { //} saveGameRules(); - GameServices::getGameRules().unloadCurrentGameRules(); + gameServices().unloadCurrentGameRules(); if (levels[0] != nullptr) // This can be null if stopServer happens // very quickly due to network error { @@ -1065,7 +1063,7 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) { bool findSeed = false; if (lpParameter != nullptr) { initData = (NetworkGameInitData*)lpParameter; - initSettings = GameHostOptions::get(eGameHostOption_All); + initSettings = gameServices().getGameHostOption(eGameHostOption_All); findSeed = initData->findSeed; m_texturePackId = initData->texturePackId; } @@ -1081,7 +1079,7 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) { if (pLevelData && pLevelData->getHasStronghold() == false) { int x, z; - if (GameServices::getTerrainFeaturePosition(eTerrainFeature_Stronghold, &x, + if (gameServices().getTerrainFeaturePosition(eTerrainFeature_Stronghold, &x, &z)) { pLevelData->setXStronghold(x); pLevelData->setZStronghold(z); @@ -1184,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 = GameServices::getXuiServerAction(i); - param = GameServices::getXuiServerActionParam(i); + eAction = gameServices().getXuiServerAction(i); + param = gameServices().getXuiServerActionParam(i); switch (eAction) { case eXuiServerAction_AutoSaveGame: case eXuiServerAction_SaveGame: - GameServices::lockSaveNotification(); + gameServices().lockSaveNotification(); if (players != nullptr) { players->saveAll( Minecraft::GetInstance()->progressRenderer); @@ -1225,7 +1223,7 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) { Minecraft::GetInstance()->progressRenderer, (eAction == eXuiServerAction_AutoSaveGame)); } - GameServices::unlockSaveNotification(); + gameServices().unlockSaveNotification(); break; case eXuiServerAction_DropItem: // Find the player, and drop the id at their feet @@ -1283,7 +1281,7 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) { std::shared_ptr( new ServerSettingsChangedPacket( ServerSettingsChangedPacket::HOST_OPTIONS, - GameHostOptions::get( + gameServices().getGameHostOption( eGameHostOption_Gamertags)))); break; case eXuiServerAction_ServerSettingChanged_BedrockFog: @@ -1292,7 +1290,7 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) { new ServerSettingsChangedPacket( ServerSettingsChangedPacket:: HOST_IN_GAME_SETTINGS, - GameHostOptions::get( + gameServices().getGameHostOption( eGameHostOption_All)))); break; @@ -1306,7 +1304,7 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) { break; case eXuiServerAction_ExportSchematic: #if !defined(_CONTENT_PACKAGE) - GameServices::lockSaveNotification(); + gameServices().lockSaveNotification(); // players->broadcastAll( // shared_ptr( new @@ -1340,7 +1338,7 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) { delete initData; } - GameServices::unlockSaveNotification(); + gameServices().unlockSaveNotification(); #endif break; case eXuiServerAction_SetCameraLocation: @@ -1373,7 +1371,7 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) { break; } - GameServices::setXuiServerAction(i, eXuiServerAction_Idle); + gameServices().setXuiServerAction(i, eXuiServerAction_Idle); } std::this_thread::sleep_for(std::chrono::milliseconds(1)); @@ -1442,7 +1440,7 @@ void MinecraftServer::tick() { // 4J Stu - We set the levels difficulty based on the minecraft // options - level->difficulty = GameHostOptions::get( + level->difficulty = gameServices().getGameHostOption( eGameHostOption_Difficulty); // pMinecraft->options->difficulty; #if DEBUG_SERVER_DONT_SPAWN_MOBS diff --git a/targets/minecraft/server/PlayerList.cpp b/targets/minecraft/server/PlayerList.cpp index e627815ca..21c45548d 100644 --- a/targets/minecraft/server/PlayerList.cpp +++ b/targets/minecraft/server/PlayerList.cpp @@ -1,5 +1,4 @@ -#include "minecraft/GameServices.h" -#include "minecraft/GameHostOptions.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Log.h" #include "PlayerList.h" @@ -12,7 +11,7 @@ #include #include "platform/sdl2/Profile.h" -#include "app/common/App_enums.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" @@ -188,14 +187,14 @@ void PlayerList::placeNewPlayer(Connection* connection, Item::map_Id, 1, level->getAuxValueForMap(player->getXuid(), 0, centreXC, centreZC, mapScale))); - if (GameServices::getGameRuleDefinitions() != nullptr) { - GameServices::getGameRuleDefinitions()->postProcessPlayer(player); + if (gameServices().getGameRuleDefinitions() != nullptr) { + gameServices().getGameRuleDefinitions()->postProcessPlayer(player); } } if (!player->customTextureUrl.empty() && player->customTextureUrl.substr(0, 3).compare(L"def") != 0 && - !GameServices::isFileInMemoryTextures(player->customTextureUrl)) { + !gameServices().isFileInMemoryTextures(player->customTextureUrl)) { if (server->getConnection()->addPendingTextureRequest( player->customTextureUrl)) { #if !defined(_CONTENT_PACKAGE) @@ -209,14 +208,14 @@ void PlayerList::placeNewPlayer(Connection* connection, 0))); } } else if (!player->customTextureUrl.empty() && - GameServices::isFileInMemoryTextures(player->customTextureUrl)) { + gameServices().isFileInMemoryTextures(player->customTextureUrl)) { // Update the ref count on the memory texture data - GameServices::addMemoryTextureFile(player->customTextureUrl, nullptr, 0); + gameServices().addMemoryTextureFile(player->customTextureUrl, nullptr, 0); } if (!player->customTextureUrl2.empty() && player->customTextureUrl2.substr(0, 3).compare(L"def") != 0 && - !GameServices::isFileInMemoryTextures(player->customTextureUrl2)) { + !gameServices().isFileInMemoryTextures(player->customTextureUrl2)) { if (server->getConnection()->addPendingTextureRequest( player->customTextureUrl2)) { #if !defined(_CONTENT_PACKAGE) @@ -229,9 +228,9 @@ void PlayerList::placeNewPlayer(Connection* connection, new TexturePacket(player->customTextureUrl2, nullptr, 0))); } } else if (!player->customTextureUrl2.empty() && - GameServices::isFileInMemoryTextures(player->customTextureUrl2)) { + gameServices().isFileInMemoryTextures(player->customTextureUrl2)) { // Update the ref count on the memory texture data - GameServices::addMemoryTextureFile(player->customTextureUrl2, nullptr, 0); + gameServices().addMemoryTextureFile(player->customTextureUrl2, nullptr, 0); } player->setIsGuest(packet->m_isGuest); @@ -604,11 +603,11 @@ std::shared_ptr PlayerList::getPlayerForLogin( pendingConnection->connection->getSocket()->getPlayer(); if (networkPlayer != nullptr && !networkPlayer->IsHost()) { player->enableAllPlayerPrivileges( - GameHostOptions::get(eGameHostOption_TrustPlayers) > 0); + gameServices().getGameHostOption(eGameHostOption_TrustPlayers) > 0); } // 4J Added - LevelRuleset* serverRuleDefs = GameServices::getGameRuleDefinitions(); + LevelRuleset* serverRuleDefs = gameServices().getGameRuleDefinitions(); if (serverRuleDefs != nullptr) { player->gameMode->setGameRules( GameRuleDefinition::generateNewGameRulesInstance( @@ -819,7 +818,7 @@ std::shared_ptr PlayerList::respawn( if (Minecraft::GetInstance()->isTutorial() && (!Minecraft::GetInstance()->gameMode->getTutorial()->isStateCompleted( e_Tutorial_State_Food_Bar))) { - GameServices::getGameRuleDefinitions()->postProcessPlayer(player); + gameServices().getGameRuleDefinitions()->postProcessPlayer(player); } if (oldDimension == 1 && player->dimension != 1) { @@ -1168,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 = GameHostOptions::get(eGameHostOption_CheatsEnabled); + bool cheatsEnabled = gameServices().getGameHostOption(eGameHostOption_CheatsEnabled); #if defined(_DEBUG_MENUS_ENABLED) - cheatsEnabled = cheatsEnabled || GameServices::getUseDPadForDebug(); + cheatsEnabled = cheatsEnabled || gameServices().getUseDPadForDebug(); #endif INetworkPlayer* networkPlayer = player->connection->getNetworkPlayer(); bool isOp = cheatsEnabled && diff --git a/targets/minecraft/server/level/ServerChunkCache.cpp b/targets/minecraft/server/level/ServerChunkCache.cpp index 82f2c8de1..0ed746b98 100644 --- a/targets/minecraft/server/level/ServerChunkCache.cpp +++ b/targets/minecraft/server/level/ServerChunkCache.cpp @@ -7,7 +7,7 @@ #include -#include "minecraft/GameServices.h" +#include "minecraft/IGameServices.h" #include "app/linux/Stubs/winapi_stubs.h" #include "ServerLevel.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" @@ -560,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 - GameServices::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 diff --git a/targets/minecraft/server/level/ServerLevel.cpp b/targets/minecraft/server/level/ServerLevel.cpp index 3520b8de9..05136b7f5 100644 --- a/targets/minecraft/server/level/ServerLevel.cpp +++ b/targets/minecraft/server/level/ServerLevel.cpp @@ -1,4 +1,4 @@ -#include "minecraft/util/DebugSettings.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Log.h" #include "ServerLevel.h" @@ -325,8 +325,8 @@ void ServerLevel::tick() { // 4J: Debug setting added to keep it at day time #if !defined(_FINAL_BUILD) bool freezeTime = - DebugSettings::isOn() && - DebugSettings::getMask(InputManager.GetPrimaryPad()) & + gameServices().debugSettingsOn() && + gameServices().debugGetMask(InputManager.GetPrimaryPad()) & (1L << eDebugSetting_FreezeTime); if (!freezeTime) #endif @@ -491,7 +491,7 @@ void ServerLevel::tickTiles() { // AP moved this outside of the loop int prob = 100000; - if (DebugSettings::getMask() & (1L << eDebugSetting_RegularLightning)) + if (gameServices().debugGetMask() & (1L << eDebugSetting_RegularLightning)) prob = 100; auto itEndCtp = chunksToPoll.end(); diff --git a/targets/minecraft/server/level/ServerPlayer.cpp b/targets/minecraft/server/level/ServerPlayer.cpp index 7d358093b..656141a7b 100644 --- a/targets/minecraft/server/level/ServerPlayer.cpp +++ b/targets/minecraft/server/level/ServerPlayer.cpp @@ -1,6 +1,4 @@ -#include "minecraft/GameServices.h" -#include "minecraft/util/DebugSettings.h" -#include "minecraft/locale/Strings.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Log.h" #include "ServerPlayer.h" @@ -587,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(DebugSettings::getMask(InputManager.GetPrimaryPad())&(1L<dimension->id == 0 ) // { @@ -595,11 +593,11 @@ void ServerPlayer::doTickB() { // portalTime=1; // } // unsigned int - // uiVal=DebugSettings::getMask(InputManager.GetPrimaryPad()); - // GameServices::setGameSettingsDebugMask(InputManager.GetPrimaryPad(),uiVal&~(1L<dimension->id == 0 ) // { @@ -607,19 +605,19 @@ void ServerPlayer::doTickB() { // std::dynamic_pointer_cast( shared_from_this() ), 1 ); // } // unsigned int - // uiVal=DebugSettings::getMask(InputManager.GetPrimaryPad()); - // GameServices::setGameSettingsDebugMask(InputManager.GetPrimaryPad(),uiVal&~(1L<dimension->id != 0) { isInsidePortal = true; portalTime = 1; } unsigned int uiVal = - DebugSettings::getMask(InputManager.GetPrimaryPad()); - GameServices::setGameSettingsDebugMask( + gameServices().debugGetMask(InputManager.GetPrimaryPad()); + gameServices().setGameSettingsDebugMask( InputManager.GetPrimaryPad(), uiVal & ~(1L << eDebugSetting_GoToOverworld)); } @@ -1553,7 +1551,7 @@ void ServerPlayer::displayClientMessage(int messageId) { // Language *language = Language::getInstance(); // wstring languageString = - // Strings::get(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 551879c0d..300e3fca4 100644 --- a/targets/minecraft/server/level/ServerPlayerGameMode.cpp +++ b/targets/minecraft/server/level/ServerPlayerGameMode.cpp @@ -1,4 +1,4 @@ -#include "minecraft/util/DebugSettings.h" +#include "minecraft/IGameServices.h" #include "ServerPlayerGameMode.h" #include @@ -152,7 +152,7 @@ void ServerPlayerGameMode::startDestroyBlock(int x, int y, int z, int face) { if (t > 0 && (progress >= - 1)) //|| (DebugSettings::isOn() && + 1)) //|| (gameServices().debugSettingsOn() && //(player->GetDebugOptions()&(1L<send(std::shared_ptr( new PreLoginPacket(L"-", ugcXuids, ugcXuidCount, ugcFriendsOnlyBits, server->m_ugcPlayersVersion, szUniqueMapName, - GameHostOptions::get(eGameHostOption_All), + gameServices().getGameHostOption(eGameHostOption_All), hostIndex, server->m_texturePackId))); } } diff --git a/targets/minecraft/server/network/PlayerConnection.cpp b/targets/minecraft/server/network/PlayerConnection.cpp index 57bbf5846..8871671f9 100644 --- a/targets/minecraft/server/network/PlayerConnection.cpp +++ b/targets/minecraft/server/network/PlayerConnection.cpp @@ -1,5 +1,4 @@ -#include "minecraft/GameServices.h" -#include "minecraft/util/DebugSettings.h" +#include "minecraft/IGameServices.h" #include "minecraft/GameHostOptions.h" #include "minecraft/util/Log.h" #include "PlayerConnection.h" @@ -12,7 +11,7 @@ #include #include -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/Console_Debug_enum.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCSkinFile.h" @@ -20,7 +19,7 @@ #include "app/common/Network/NetworkPlayerInterface.h" #include "app/common/Network/Socket.h" #include "app/linux/LinuxGame.h" -#include "minecraft/client/SkinBox.h" +#include "minecraft/client/model/SkinBox.h" #include "ServerConnection.h" #include "java/Class.h" #include "java/InputOutputStream/ByteArrayInputStream.h" @@ -141,7 +140,7 @@ PlayerConnection::PlayerConnection(MinecraftServer* server, m_bHasClientTickedOnce = false; setShowOnMaps( - GameHostOptions::get(eGameHostOption_Gamertags) != 0 ? true : false); + gameServices().getGameHostOption(eGameHostOption_Gamertags) != 0 ? true : false); } PlayerConnection::~PlayerConnection() { delete connection; } @@ -815,7 +814,7 @@ void PlayerConnection::handleTexture(std::shared_ptr packet) { #endif std::uint8_t* pbData = nullptr; unsigned int dwBytes = 0; - GameServices::getMemFileDetails(packet->textureName, &pbData, &dwBytes); + gameServices().getMemFileDetails(packet->textureName, &pbData, &dwBytes); if (dwBytes != 0) { send(std::shared_ptr( @@ -829,7 +828,7 @@ void PlayerConnection::handleTexture(std::shared_ptr packet) { wprintf(L"Server received custom texture %ls\n", packet->textureName.c_str()); #endif - GameServices::addMemoryTextureFile(packet->textureName, packet->pbData, + gameServices().addMemoryTextureFile(packet->textureName, packet->pbData, packet->dataBytes); server->connection->handleTextureReceived(packet->textureName); } @@ -848,9 +847,9 @@ void PlayerConnection::handleTextureAndGeometry( #endif std::uint8_t* pbData = nullptr; unsigned int dwTextureBytes = 0; - GameServices::getMemFileDetails(packet->textureName, &pbData, &dwTextureBytes); + gameServices().getMemFileDetails(packet->textureName, &pbData, &dwTextureBytes); DLCSkinFile* pDLCSkinFile = - GameServices::getDLCManager().getSkinFile(packet->textureName); + gameServices().getDLCSkinFile(packet->textureName); if (dwTextureBytes != 0) { if (pDLCSkinFile) { @@ -868,9 +867,9 @@ void PlayerConnection::handleTextureAndGeometry( // we don't have the dlc skin, so retrieve the data from the app // store std::vector* pvSkinBoxes = - GameServices::getAdditionalSkinBoxes(packet->dwSkinID); + gameServices().getAdditionalSkinBoxes(packet->dwSkinID); unsigned int uiAnimOverrideBitmask = - GameServices::getAnimOverrideBitmask(packet->dwSkinID); + gameServices().getAnimOverrideBitmask(packet->dwSkinID); send(std::shared_ptr( new TextureAndGeometryPacket(packet->textureName, pbData, @@ -886,7 +885,7 @@ void PlayerConnection::handleTextureAndGeometry( wprintf(L"Server received custom texture %ls and geometry\n", packet->textureName.c_str()); #endif - GameServices::addMemoryTextureFile(packet->textureName, packet->pbData, + gameServices().addMemoryTextureFile(packet->textureName, packet->pbData, packet->dwTextureBytes); // add the geometry to the app list @@ -895,11 +894,11 @@ void PlayerConnection::handleTextureAndGeometry( wprintf(L"Adding skin boxes for skin id %X, box count %d\n", packet->dwSkinID, packet->dwBoxC); #endif - GameServices::setAdditionalSkinBoxes(packet->dwSkinID, packet->BoxDataA, + gameServices().setAdditionalSkinBoxes(packet->dwSkinID, packet->BoxDataA, packet->dwBoxC); } // Add the anim override - GameServices::setAnimOverrideBitmask(packet->dwSkinID, + gameServices().setAnimOverrideBitmask(packet->dwSkinID, packet->uiAnimOverrideBitmask); player->setCustomSkin(packet->dwSkinID); @@ -917,7 +916,7 @@ void PlayerConnection::handleTextureReceived(const std::wstring& textureName) { if (it != m_texturesRequested.end()) { std::uint8_t* pbData = nullptr; unsigned int dwBytes = 0; - GameServices::getMemFileDetails(textureName, &pbData, &dwBytes); + gameServices().getMemFileDetails(textureName, &pbData, &dwBytes); if (dwBytes != 0) { send(std::shared_ptr( @@ -936,8 +935,8 @@ void PlayerConnection::handleTextureAndGeometryReceived( if (it != m_texturesRequested.end()) { std::uint8_t* pbData = nullptr; unsigned int dwTextureBytes = 0; - GameServices::getMemFileDetails(textureName, &pbData, &dwTextureBytes); - DLCSkinFile* pDLCSkinFile = GameServices::getDLCManager().getSkinFile(textureName); + gameServices().getMemFileDetails(textureName, &pbData, &dwTextureBytes); + DLCSkinFile* pDLCSkinFile = gameServices().getDLCSkinFile(textureName); if (dwTextureBytes != 0) { if (pDLCSkinFile && @@ -947,11 +946,11 @@ void PlayerConnection::handleTextureAndGeometryReceived( textureName, pbData, dwTextureBytes, pDLCSkinFile))); } else { // get the data from the app - std::uint32_t dwSkinID = GameServices::getSkinIdFromPath(textureName); + std::uint32_t dwSkinID = gameServices().getSkinIdFromPath(textureName); std::vector* pvSkinBoxes = - GameServices::getAdditionalSkinBoxes(dwSkinID); + gameServices().getAdditionalSkinBoxes(dwSkinID); unsigned int uiAnimOverrideBitmask = - GameServices::getAnimOverrideBitmask(dwSkinID); + gameServices().getAnimOverrideBitmask(dwSkinID); send(std::shared_ptr( new TextureAndGeometryPacket(textureName, pbData, @@ -967,7 +966,7 @@ void PlayerConnection::handleTextureChange( std::shared_ptr packet) { switch (packet->action) { case TextureChangePacket::e_TextureChange_Skin: - player->setCustomSkin(GameServices::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(), @@ -985,7 +984,7 @@ void PlayerConnection::handleTextureChange( } if (!packet->path.empty() && packet->path.substr(0, 3).compare(L"def") != 0 && - !GameServices::isFileInMemoryTextures(packet->path)) { + !gameServices().isFileInMemoryTextures(packet->path)) { if (server->connection->addPendingTextureRequest(packet->path)) { #if !defined(_CONTENT_PACKAGE) wprintf( @@ -997,9 +996,9 @@ void PlayerConnection::handleTextureChange( new TexturePacket(packet->path, nullptr, 0))); } } else if (!packet->path.empty() && - GameServices::isFileInMemoryTextures(packet->path)) { + gameServices().isFileInMemoryTextures(packet->path)) { // Update the ref count on the memory texture data - GameServices::addMemoryTextureFile(packet->path, nullptr, 0); + gameServices().addMemoryTextureFile(packet->path, nullptr, 0); } server->getPlayers()->broadcastAll( std::shared_ptr( @@ -1009,7 +1008,7 @@ void PlayerConnection::handleTextureChange( void PlayerConnection::handleTextureAndGeometryChange( std::shared_ptr packet) { - player->setCustomSkin(GameServices::getSkinIdFromPath(packet->path)); + player->setCustomSkin(gameServices().getSkinIdFromPath(packet->path)); #if !defined(_CONTENT_PACKAGE) wprintf( L"PlayerConnection::handleTextureAndGeometryChange - Skin for server " @@ -1020,7 +1019,7 @@ void PlayerConnection::handleTextureAndGeometryChange( if (!packet->path.empty() && packet->path.substr(0, 3).compare(L"def") != 0 && - !GameServices::isFileInMemoryTextures(packet->path)) { + !gameServices().isFileInMemoryTextures(packet->path)) { if (server->connection->addPendingTextureRequest(packet->path)) { #if !defined(_CONTENT_PACKAGE) wprintf( @@ -1032,15 +1031,15 @@ void PlayerConnection::handleTextureAndGeometryChange( new TextureAndGeometryPacket(packet->path, nullptr, 0))); } } else if (!packet->path.empty() && - GameServices::isFileInMemoryTextures(packet->path)) { + gameServices().isFileInMemoryTextures(packet->path)) { // Update the ref count on the memory texture data - GameServices::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 - // GameServices::setAdditionalSkinBoxes(packet->dwSkinID,) + // gameServices().setAdditionalSkinBoxes(packet->dwSkinID,) // DebugBreak(); } server->getPlayers()->broadcastAll( @@ -1058,37 +1057,37 @@ void PlayerConnection::handleServerSettingsChanged( INetworkPlayer* networkPlayer = getNetworkPlayer(); if ((networkPlayer != nullptr && networkPlayer->IsHost()) || player->isModerator()) { - GameHostOptions::set( + gameServices().setGameHostOption( eGameHostOption_FireSpreads, GameHostOptions::get(packet->data, eGameHostOption_FireSpreads)); - GameHostOptions::set( + gameServices().setGameHostOption( eGameHostOption_TNT, GameHostOptions::get(packet->data, eGameHostOption_TNT)); - GameHostOptions::set( + gameServices().setGameHostOption( eGameHostOption_MobGriefing, GameHostOptions::get(packet->data, eGameHostOption_MobGriefing)); - GameHostOptions::set( + gameServices().setGameHostOption( eGameHostOption_KeepInventory, GameHostOptions::get(packet->data, eGameHostOption_KeepInventory)); - GameHostOptions::set( + gameServices().setGameHostOption( eGameHostOption_DoMobSpawning, GameHostOptions::get(packet->data, eGameHostOption_DoMobSpawning)); - GameHostOptions::set( + gameServices().setGameHostOption( eGameHostOption_DoMobLoot, GameHostOptions::get(packet->data, eGameHostOption_DoMobLoot)); - GameHostOptions::set( + gameServices().setGameHostOption( eGameHostOption_DoTileDrops, GameHostOptions::get(packet->data, eGameHostOption_DoTileDrops)); - GameHostOptions::set( + gameServices().setGameHostOption( eGameHostOption_DoDaylightCycle, GameHostOptions::get(packet->data, eGameHostOption_DoDaylightCycle)); - GameHostOptions::set( + gameServices().setGameHostOption( eGameHostOption_NaturalRegeneration, GameHostOptions::get(packet->data, eGameHostOption_NaturalRegeneration)); @@ -1097,7 +1096,7 @@ void PlayerConnection::handleServerSettingsChanged( std::shared_ptr( new ServerSettingsChangedPacket( ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS, - GameHostOptions::get(eGameHostOption_All)))); + gameServices().getGameHostOption(eGameHostOption_All)))); // Update the QoS data g_NetworkManager.UpdateAndSetGameSessionData(); @@ -1410,9 +1409,9 @@ void PlayerConnection::handlePlayerInfo( unsigned int origPrivs = serverPlayer->getAllPlayerGamePrivileges(); bool trustPlayers = - GameHostOptions::get(eGameHostOption_TrustPlayers) != 0; + gameServices().getGameHostOption(eGameHostOption_TrustPlayers) != 0; bool cheats = - GameHostOptions::get(eGameHostOption_CheatsEnabled) != 0; + gameServices().getGameHostOption(eGameHostOption_CheatsEnabled) != 0; if (serverPlayer == player) { GameType* gameType = Player::getPlayerGamePrivilege( @@ -1692,7 +1691,7 @@ void PlayerConnection::handleCraftItem( std::shared_ptr pTempItemInst = pRecipeIngredientsRequired[iRecipe].pRecipy->assemble(nullptr); - if (DebugSettings::isOn() && + 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 9890f39ff..ff517d840 100644 --- a/targets/minecraft/server/network/ServerConnection.cpp +++ b/targets/minecraft/server/network/ServerConnection.cpp @@ -1,4 +1,4 @@ -#include "minecraft/GameHostOptions.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Log.h" #include "ServerConnection.h" @@ -176,7 +176,7 @@ void ServerConnection::handleServerSettingsChanged( // if(packet->action==ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS)// // options // { - // GameHostOptions::set(eGameHostOption_All,packet->m_serverSettings) + // gameServices().setGameHostOption(eGameHostOption_All,packet->m_serverSettings) // } // else // { diff --git a/targets/minecraft/stats/Stat.h b/targets/minecraft/stats/Stat.h index c4103a00d..a17acf774 100644 --- a/targets/minecraft/stats/Stat.h +++ b/targets/minecraft/stats/Stat.h @@ -8,7 +8,7 @@ #include #include "GenericStats.h" -#include "minecraft/GameServices.h" +#include "minecraft/IGameServices.h" #include "app/linux/LinuxGame.h" #include "StatFormatter.h" @@ -63,7 +63,7 @@ public: // 4J-JEV, for Durango stats virtual void handleParamBlob(std::shared_ptr plr, std::vector& param) { - GameServices::debugPrintf("'Stat.h', Unhandled AwardStat blob.\n"); + gameServices().debugPrintf("'Stat.h', Unhandled AwardStat blob.\n"); return; } }; diff --git a/targets/minecraft/util/DebugSettings.cpp b/targets/minecraft/util/DebugSettings.cpp deleted file mode 100644 index 59246dd1c..000000000 --- a/targets/minecraft/util/DebugSettings.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include "minecraft/util/DebugSettings.h" - -#include - -namespace DebugSettings { - -static BoolFn s_debugOn = nullptr; -static BoolFn s_artToolsOn = nullptr; -static MaskFn s_mask = nullptr; -static BoolFn s_mobsDontAttack = nullptr; -static BoolFn s_mobsDontTick = nullptr; -static BoolFn s_freezePlayers = nullptr; - -void init(BoolFn debugOn, BoolFn artToolsOn, MaskFn mask, - BoolFn mobsDontAttack, BoolFn mobsDontTick, BoolFn freezePlayers) { - s_debugOn = debugOn; - s_artToolsOn = artToolsOn; - s_mask = mask; - s_mobsDontAttack = mobsDontAttack; - s_mobsDontTick = mobsDontTick; - s_freezePlayers = freezePlayers; -} - -bool isOn() { return s_debugOn && s_debugOn(); } -bool artToolsOn() { return s_artToolsOn && s_artToolsOn(); } -unsigned int getMask(int iPad, bool overridePlayer) { - return s_mask ? s_mask(iPad, overridePlayer) : 0; -} -bool mobsDontAttack() { return s_mobsDontAttack && s_mobsDontAttack(); } -bool mobsDontTick() { return s_mobsDontTick && s_mobsDontTick(); } -bool freezePlayers() { return s_freezePlayers && s_freezePlayers(); } - -} // namespace DebugSettings diff --git a/targets/minecraft/util/DebugSettings.h b/targets/minecraft/util/DebugSettings.h deleted file mode 100644 index 9f5f86071..000000000 --- a/targets/minecraft/util/DebugSettings.h +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once - -#include - -namespace DebugSettings { - -using BoolFn = bool (*)(); -using MaskFn = unsigned int (*)(int, bool); - -void init(BoolFn debugOn, BoolFn artToolsOn, MaskFn mask, - BoolFn mobsDontAttack, BoolFn mobsDontTick, BoolFn freezePlayers); - -[[nodiscard]] bool isOn(); -[[nodiscard]] bool artToolsOn(); -[[nodiscard]] unsigned int getMask(int iPad = -1, bool overridePlayer = false); -[[nodiscard]] bool mobsDontAttack(); -[[nodiscard]] bool mobsDontTick(); -[[nodiscard]] bool freezePlayers(); - -} // namespace DebugSettings diff --git a/targets/minecraft/util/HtmlString.cpp b/targets/minecraft/util/HtmlString.cpp index 5f6f2e36c..1de5a0876 100644 --- a/targets/minecraft/util/HtmlString.cpp +++ b/targets/minecraft/util/HtmlString.cpp @@ -4,7 +4,7 @@ #include #include -#include "minecraft/GameServices.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/world/CompoundContainer.cpp b/targets/minecraft/world/CompoundContainer.cpp index 44291b516..68cda39c9 100644 --- a/targets/minecraft/world/CompoundContainer.cpp +++ b/targets/minecraft/world/CompoundContainer.cpp @@ -1,4 +1,4 @@ -#include "minecraft/locale/Strings.h" +#include "minecraft/IGameServices.h" #include "CompoundContainer.h" #include "app/linux/LinuxGame.h" @@ -29,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 Strings::get(name); + return gameServices().getString(name); } std::wstring CompoundContainer::getCustomName() { diff --git a/targets/minecraft/world/SimpleContainer.cpp b/targets/minecraft/world/SimpleContainer.cpp index 5daf48601..63ed1175a 100644 --- a/targets/minecraft/world/SimpleContainer.cpp +++ b/targets/minecraft/world/SimpleContainer.cpp @@ -1,4 +1,4 @@ -#include "minecraft/locale/Strings.h" +#include "minecraft/IGameServices.h" #include "SimpleContainer.h" #include @@ -82,7 +82,7 @@ void SimpleContainer::setItem(unsigned int slot, unsigned int SimpleContainer::getContainerSize() { return size; } std::wstring SimpleContainer::getName() { - return stringName.empty() ? Strings::get(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/entity/Entity.cpp b/targets/minecraft/world/entity/Entity.cpp index 0325d5581..d9b45abb6 100644 --- a/targets/minecraft/world/entity/Entity.cpp +++ b/targets/minecraft/world/entity/Entity.cpp @@ -1,4 +1,4 @@ -#include "minecraft/GameServices.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Log.h" #include "Entity.h" @@ -17,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" @@ -1867,7 +1867,7 @@ void Entity::setAnimOverrideBitmask(unsigned int uiBitmask) { Log::info("!!! Setting anim override bitmask to %d\n", uiBitmask); } unsigned int Entity::getAnimOverrideBitmask() { - if (GameServices::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.h b/targets/minecraft/world/entity/EntityIO.h index 4f70e5001..f7c804d8b 100644 --- a/targets/minecraft/world/entity/EntityIO.h +++ b/targets/minecraft/world/entity/EntityIO.h @@ -5,7 +5,7 @@ #include #include "Entity.h" -#include "app/common/App_enums.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/Painting.cpp b/targets/minecraft/world/entity/Painting.cpp index 886925747..ec9629088 100644 --- a/targets/minecraft/world/entity/Painting.cpp +++ b/targets/minecraft/world/entity/Painting.cpp @@ -1,4 +1,4 @@ -#include "minecraft/util/DebugSettings.h" +#include "minecraft/IGameServices.h" #include "Painting.h" #include @@ -78,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 (DebugSettings::artToolsOn() && motive >= 0) { + if (gameServices().debugArtToolsOn() && motive >= 0) { this->motive = (Motive*)Motive::values[motive]; setDir(dir); } else diff --git a/targets/minecraft/world/entity/ai/attributes/AttributeModifier.cpp b/targets/minecraft/world/entity/ai/attributes/AttributeModifier.cpp index 7d70fd197..229c476e5 100644 --- a/targets/minecraft/world/entity/ai/attributes/AttributeModifier.cpp +++ b/targets/minecraft/world/entity/ai/attributes/AttributeModifier.cpp @@ -1,10 +1,10 @@ -#include "minecraft/locale/Strings.h" +#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" @@ -107,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""), - Strings::get(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/Ocelot.cpp b/targets/minecraft/world/entity/animal/Ocelot.cpp index 9696a91f4..54f8e30c3 100644 --- a/targets/minecraft/world/entity/animal/Ocelot.cpp +++ b/targets/minecraft/world/entity/animal/Ocelot.cpp @@ -1,4 +1,4 @@ -#include "minecraft/util/DebugSettings.h" +#include "minecraft/IGameServices.h" #include "Ocelot.h" #include @@ -307,7 +307,7 @@ MobGroupData* Ocelot::finalizeMobSpawn( groupData = TamableAnimal::finalizeMobSpawn(groupData); #ifndef _CONTENT_PACKAGE - if (DebugSettings::artToolsOn() && (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.h b/targets/minecraft/world/entity/boss/enderdragon/EnderDragon.h index 5ccc23053..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 "minecraft/locale/Strings.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 Strings::get(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 3603ceef4..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 "minecraft/locale/Strings.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 Strings::get(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/MinecartContainer.cpp b/targets/minecraft/world/entity/item/MinecartContainer.cpp index 2ea706a43..5e3cb8fa9 100644 --- a/targets/minecraft/world/entity/item/MinecartContainer.cpp +++ b/targets/minecraft/world/entity/item/MinecartContainer.cpp @@ -1,4 +1,4 @@ -#include "minecraft/locale/Strings.h" +#include "minecraft/IGameServices.h" #include "MinecartContainer.h" #include @@ -120,7 +120,7 @@ bool MinecartContainer::canPlaceItem(int slot, std::wstring MinecartContainer::getName() { return hasCustomName() ? getCustomName() - : Strings::get(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 82924b9a1..2b8782aea 100644 --- a/targets/minecraft/world/entity/monster/EnderMan.cpp +++ b/targets/minecraft/world/entity/monster/EnderMan.cpp @@ -1,4 +1,4 @@ -#include "minecraft/util/DebugSettings.h" +#include "minecraft/IGameServices.h" #include "EnderMan.h" #include @@ -107,7 +107,7 @@ void EnderMan::readAdditionalSaveData(CompoundTag* tag) { std::shared_ptr EnderMan::findAttackTarget() { #ifndef _FINAL_BUILD - if (DebugSettings::mobsDontAttack()) { + 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 fd68cc0bf..b2cbfaf04 100644 --- a/targets/minecraft/world/entity/monster/Monster.cpp +++ b/targets/minecraft/world/entity/monster/Monster.cpp @@ -1,4 +1,4 @@ -#include "minecraft/util/DebugSettings.h" +#include "minecraft/IGameServices.h" #include "Monster.h" #include @@ -49,7 +49,7 @@ void Monster::tick() { std::shared_ptr Monster::findAttackTarget() { #ifndef _FINAL_BUILD - if (DebugSettings::mobsDontAttack()) { + 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 5cec18648..4fbd725d3 100644 --- a/targets/minecraft/world/entity/monster/PigZombie.cpp +++ b/targets/minecraft/world/entity/monster/PigZombie.cpp @@ -1,4 +1,4 @@ -#include "minecraft/util/DebugSettings.h" +#include "minecraft/IGameServices.h" #include "PigZombie.h" #include @@ -94,7 +94,7 @@ void PigZombie::readAdditionalSaveData(CompoundTag* tag) { std::shared_ptr PigZombie::findAttackTarget() { #ifndef _FINAL_BUILD #ifdef _DEBUG_MENUS_ENABLED - if (DebugSettings::mobsDontAttack()) { + if (gameServices().debugMobsDontAttack()) { return std::shared_ptr(); } #endif diff --git a/targets/minecraft/world/entity/monster/Silverfish.cpp b/targets/minecraft/world/entity/monster/Silverfish.cpp index 316d554c6..c2ad4f2b1 100644 --- a/targets/minecraft/world/entity/monster/Silverfish.cpp +++ b/targets/minecraft/world/entity/monster/Silverfish.cpp @@ -1,4 +1,4 @@ -#include "minecraft/util/DebugSettings.h" +#include "minecraft/IGameServices.h" #include "Silverfish.h" #include @@ -44,7 +44,7 @@ bool Silverfish::makeStepSound() { return false; } std::shared_ptr Silverfish::findAttackTarget() { #ifndef _FINAL_BUILD - if (DebugSettings::mobsDontAttack()) { + 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 576b4ba79..3e2e1f27a 100644 --- a/targets/minecraft/world/entity/monster/Spider.cpp +++ b/targets/minecraft/world/entity/monster/Spider.cpp @@ -1,4 +1,4 @@ -#include "minecraft/util/DebugSettings.h" +#include "minecraft/IGameServices.h" #include "Spider.h" #include @@ -61,7 +61,7 @@ void Spider::registerAttributes() { std::shared_ptr Spider::findAttackTarget() { #ifndef _FINAL_BUILD #ifdef _DEBUG_MENUS_ENABLED - if (DebugSettings::mobsDontAttack()) { + 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 5a5728ab1..ba0369d5f 100644 --- a/targets/minecraft/world/entity/npc/Villager.cpp +++ b/targets/minecraft/world/entity/npc/Villager.cpp @@ -1,4 +1,4 @@ -#include "minecraft/locale/Strings.h" +#include "minecraft/IGameServices.h" #include "Villager.h" #include @@ -797,5 +797,5 @@ std::wstring Villager::getDisplayName() { name = IDS_VILLAGER_BUTCHER; break; }; - return Strings::get(name); + return gameServices().getString(name); } diff --git a/targets/minecraft/world/entity/player/Inventory.cpp b/targets/minecraft/world/entity/player/Inventory.cpp index ce40e3948..4e853f9a6 100644 --- a/targets/minecraft/world/entity/player/Inventory.cpp +++ b/targets/minecraft/world/entity/player/Inventory.cpp @@ -1,4 +1,4 @@ -#include "minecraft/locale/Strings.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Log.h" #include "Inventory.h" @@ -490,7 +490,7 @@ std::shared_ptr Inventory::getItem(unsigned int slot) { */ } -std::wstring Inventory::getName() { return Strings::get(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 07d784b58..53af16211 100644 --- a/targets/minecraft/world/entity/player/Player.cpp +++ b/targets/minecraft/world/entity/player/Player.cpp @@ -1,5 +1,4 @@ -#include "minecraft/GameServices.h" -#include "minecraft/GameHostOptions.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Log.h" // 4J TODO @@ -23,7 +22,7 @@ #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/DLC/DLCManager.h" @@ -185,7 +184,7 @@ Player::Player(Level* level, const std::wstring& name) : LivingEntity(level) { m_OnlineXuid = INVALID_XUID; // m_bShownOnMaps = true; setShowOnMaps( - GameHostOptions::get(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 @@ -572,10 +571,10 @@ void Player::setCustomSkin(std::uint32_t skinId) { setPlayerDefaultSkin(playerSkin); m_dwSkinId = skinId; - this->customTextureUrl = GameServices::getSkinPathFromId(skinId); + this->customTextureUrl = gameServices().getSkinPathFromId(skinId); // set the new player additional boxes - /*vector *pvModelParts=GameServices::getAdditionalModelParts(m_dwSkinId); + /*vector *pvModelParts=gameServices().getAdditionalModelParts(m_dwSkinId); if(pvModelParts==nullptr) { @@ -584,7 +583,7 @@ void Player::setCustomSkin(std::uint32_t skinId) { // do we have it from the DLC pack? DLCSkinFile *pDLCSkinFile = - GameServices::getDLCManager().getSkinFile(this->customTextureUrl); + gameServices().getDLCSkinFile(this->customTextureUrl); if(pDLCSkinFile!=nullptr) { @@ -592,14 +591,14 @@ void Player::setCustomSkin(std::uint32_t skinId) { pDLCSkinFile->getAdditionalBoxesCount(); if(additionalBoxCount != 0) { Log::info("Got model parts from DLCskin for skin %X\n",m_dwSkinId); - pvModelParts=GameServices::setAdditionalSkinBoxesFromVec(m_dwSkinId,pDLCSkinFile->getAdditionalBoxes()); + pvModelParts=gameServices().setAdditionalSkinBoxesFromVec(m_dwSkinId,pDLCSkinFile->getAdditionalBoxes()); this->SetAdditionalModelParts(pvModelParts); } else { this->SetAdditionalModelParts(nullptr); } - GameServices::setAnimOverrideBitmask(pDLCSkinFile->getSkinID(),pDLCSkinFile->getAnimOverrideBitmask()); + gameServices().setAnimOverrideBitmask(pDLCSkinFile->getSkinID(),pDLCSkinFile->getAnimOverrideBitmask()); } else { @@ -653,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 = GameServices::getAnimOverrideBitmask(skinId); + bitmask = gameServices().getAnimOverrideBitmask(skinId); break; } } @@ -673,13 +672,13 @@ void Player::setCustomCape(std::uint32_t capeId) { if (capeId > 0) { this->customTextureUrl2 = Player::getCapePathFromId(capeId); } else { - MOJANG_DATA* pMojangData = GameServices::getMojangDataForXuid(getOnlineXuid()); + MOJANG_DATA* pMojangData = gameServices().getMojangDataForXuid(getOnlineXuid()); if (pMojangData) { // Cape if (pMojangData->wchCape[0] != 0) { this->customTextureUrl2 = pMojangData->wchCape; } else { - if (GameServices::defaultCapeExists()) { + if (gameServices().defaultCapeExists()) { this->customTextureUrl2 = std::wstring(L"Special_Cape.png"); } else { this->customTextureUrl2 = std::wstring(L""); @@ -688,7 +687,7 @@ void Player::setCustomCape(std::uint32_t capeId) { } else { // if there is a custom default cloak, then set it here - if (GameServices::defaultCapeExists()) { + if (gameServices().defaultCapeExists()) { this->customTextureUrl2 = std::wstring(L"Special_Cape.png"); } else { this->customTextureUrl2 = std::wstring(L""); @@ -747,23 +746,23 @@ std::wstring Player::getCapePathFromId(std::uint32_t capeId) { } void Player::ChangePlayerSkin() { - if (GameServices::getSkinNames().size() > 0) { + if (gameServices().getSkinNames().size() > 0) { m_uiPlayerCurrentSkin++; - if (m_uiPlayerCurrentSkin > GameServices::getSkinNames().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 = - GameServices::getSkinNames()[m_uiPlayerCurrentSkin - 1]; + gameServices().getSkinNames()[m_uiPlayerCurrentSkin - 1]; } } } } void Player::prepareCustomTextures() { - MOJANG_DATA* pMojangData = GameServices::getMojangDataForXuid(getOnlineXuid()); + MOJANG_DATA* pMojangData = gameServices().getMojangDataForXuid(getOnlineXuid()); if (pMojangData) { // Skin @@ -779,7 +778,7 @@ void Player::prepareCustomTextures() { //} // else //{ - // if(GameServices::defaultCapeExists()) + // if(gameServices().defaultCapeExists()) // { // this->customTextureUrl2= wstring(L"Default_Cape.png"); // } @@ -792,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(GameServices::defaultCapeExists()) + // if(gameServices().defaultCapeExists()) //{ // this->customTextureUrl2= wstring(L"Default_Cape.png"); //} @@ -936,7 +935,7 @@ void Player::die(DamageSource* source) { yd = 0.1f; // 4J - TODO need to use a xuid - if (GameServices::isXuidNotch(m_xuid)) { + if (gameServices().isXuidNotch(m_xuid)) { drop(std::make_shared(Item::apple, 1), true); } if (!level->getGameRules()->getBoolean(GameRules::RULE_KEEPINVENTORY)) { @@ -2084,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 (GameHostOptions::get(eGameHostOption_TrustPlayers) == 0 && + if (gameServices().getGameHostOption(eGameHostOption_TrustPlayers) == 0 && getPlayerGamePrivilege(Player::ePlayerGamePrivilege_CannotBuild) != 0) return; @@ -2390,7 +2389,7 @@ void Player::setPlayerGamePrivilege(unsigned int& uiGamePrivileges, bool Player::isAllowedToUse(Tile* tile) { bool allowed = true; if (tile != nullptr && - GameHostOptions::get(eGameHostOption_TrustPlayers) == 0) { + gameServices().getGameHostOption(eGameHostOption_TrustPlayers) == 0) { allowed = false; if (getPlayerGamePrivilege( @@ -2461,7 +2460,7 @@ bool Player::isAllowedToUse(Tile* tile) { bool Player::isAllowedToUse(std::shared_ptr item) { bool allowed = true; if (item != nullptr && - GameHostOptions::get(eGameHostOption_TrustPlayers) == 0) { + gameServices().getGameHostOption(eGameHostOption_TrustPlayers) == 0) { if (getPlayerGamePrivilege(Player::ePlayerGamePrivilege_CannotBuild) != 0) { allowed = false; @@ -2505,7 +2504,7 @@ bool Player::isAllowedToUse(std::shared_ptr item) { bool Player::isAllowedToInteract(std::shared_ptr target) { bool allowed = true; - if (GameHostOptions::get(eGameHostOption_TrustPlayers) == 0) { + if (gameServices().getGameHostOption(eGameHostOption_TrustPlayers) == 0) { if (target->instanceof(eTYPE_MINECART)) { if (getPlayerGamePrivilege( Player::ePlayerGamePrivilege_CanUseContainers) == 0) { @@ -2533,7 +2532,7 @@ bool Player::isAllowedToInteract(std::shared_ptr target) { bool Player::isAllowedToMine() { bool allowed = true; - if (GameHostOptions::get(eGameHostOption_TrustPlayers) == 0) { + if (gameServices().getGameHostOption(eGameHostOption_TrustPlayers) == 0) { if (getPlayerGamePrivilege(Player::ePlayerGamePrivilege_CannotMine) != 0) { allowed = false; @@ -2545,7 +2544,7 @@ bool Player::isAllowedToMine() { bool Player::isAllowedToAttackPlayers() { bool allowed = true; if (hasInvisiblePrivilege() || - ((GameHostOptions::get(eGameHostOption_TrustPlayers) == 0) && + ((gameServices().getGameHostOption(eGameHostOption_TrustPlayers) == 0) && getPlayerGamePrivilege( Player::ePlayerGamePrivilege_CannotAttackPlayers))) { allowed = false; @@ -2555,7 +2554,7 @@ bool Player::isAllowedToAttackPlayers() { bool Player::isAllowedToAttackAnimals() { bool allowed = true; - if ((GameHostOptions::get(eGameHostOption_TrustPlayers) == 0) && + if ((gameServices().getGameHostOption(eGameHostOption_TrustPlayers) == 0) && getPlayerGamePrivilege( Player::ePlayerGamePrivilege_CannotAttackAnimals)) { allowed = false; @@ -2589,7 +2588,7 @@ bool Player::isAllowedToHurtEntity(std::shared_ptr target) { bool Player::isAllowedToFly() { bool allowed = false; - if (GameHostOptions::get(eGameHostOption_HostCanFly) != 0 && + if (gameServices().getGameHostOption(eGameHostOption_HostCanFly) != 0 && getPlayerGamePrivilege(Player::ePlayerGamePrivilege_CanFly) != 0) { allowed = true; } @@ -2598,7 +2597,7 @@ bool Player::isAllowedToFly() { bool Player::isAllowedToIgnoreExhaustion() { bool allowed = false; - if ((GameHostOptions::get(eGameHostOption_HostCanChangeHunger) != 0 && + if ((gameServices().getGameHostOption(eGameHostOption_HostCanChangeHunger) != 0 && getPlayerGamePrivilege(Player::ePlayerGamePrivilege_ClassicHunger) != 0) || (isAllowedToFly() && abilities.flying)) { @@ -2618,7 +2617,7 @@ bool Player::isAllowedToTeleport() { bool Player::hasInvisiblePrivilege() { bool enabled = false; - if (GameHostOptions::get(eGameHostOption_HostCanBeInvisible) != 0 && + if (gameServices().getGameHostOption(eGameHostOption_HostCanBeInvisible) != 0 && getPlayerGamePrivilege(Player::ePlayerGamePrivilege_Invisible) != 0) { enabled = true; } @@ -2627,7 +2626,7 @@ bool Player::hasInvisiblePrivilege() { bool Player::hasInvulnerablePrivilege() { bool enabled = false; - if (GameHostOptions::get(eGameHostOption_HostCanBeInvisible) != 0 && + if (gameServices().getGameHostOption(eGameHostOption_HostCanBeInvisible) != 0 && getPlayerGamePrivilege(Player::ePlayerGamePrivilege_Invulnerable) != 0) { enabled = true; @@ -2674,14 +2673,14 @@ std::vector* Player::GetAdditionalModelParts() { customTextureUrl.substr(0, 3).compare(L"def") == 0; // see if we can find the parts - m_ppAdditionalModelParts = GameServices::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 || - GameServices::isFileInMemoryTextures(customTextureUrl)) { + gameServices().isFileInMemoryTextures(customTextureUrl)) { m_bCheckedForModelParts = true; } if (m_ppAdditionalModelParts == nullptr && @@ -2696,7 +2695,7 @@ std::vector* Player::GetAdditionalModelParts() { // do we have it from the DLC pack? DLCSkinFile* pDLCSkinFile = - GameServices::getDLCManager().getSkinFile(this->customTextureUrl); + gameServices().getDLCSkinFile(this->customTextureUrl); if (pDLCSkinFile != nullptr) { const int additionalBoxCount = @@ -2706,11 +2705,11 @@ std::vector* Player::GetAdditionalModelParts() { "m_bCheckedForModelParts Got model parts from DLCskin " "for skin %X\n", m_dwSkinId); - m_ppAdditionalModelParts = GameServices::setAdditionalSkinBoxesFromVec( + m_ppAdditionalModelParts = gameServices().setAdditionalSkinBoxesFromVec( m_dwSkinId, pDLCSkinFile->getAdditionalBoxes()); } - GameServices::setAnimOverrideBitmask( + gameServices().setAnimOverrideBitmask( pDLCSkinFile->getSkinID(), pDLCSkinFile->getAnimOverrideBitmask()); 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/FireworksChargeItem.cpp b/targets/minecraft/world/item/FireworksChargeItem.cpp index 107cc7291..e1ff43021 100644 --- a/targets/minecraft/world/item/FireworksChargeItem.cpp +++ b/targets/minecraft/world/item/FireworksChargeItem.cpp @@ -1,4 +1,4 @@ -#include "minecraft/locale/Strings.h" +#include "minecraft/IGameServices.h" #include "FireworksChargeItem.h" #include @@ -100,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(Strings::get(FIREWORKS_CHARGE_TYPE_NAME[type]))); + HtmlString(gameServices().getString(FIREWORKS_CHARGE_TYPE_NAME[type]))); } else { - lines->push_back(HtmlString(Strings::get(IDS_FIREWORKS_CHARGE_TYPE))); + lines->push_back(HtmlString(gameServices().getString(IDS_FIREWORKS_CHARGE_TYPE))); } // colors @@ -125,12 +125,12 @@ void FireworksChargeItem::appendHoverText(CompoundTag* expTag, for (int dc = 0; dc < 16; dc++) { if (c == DyePowderItem::COLOR_RGB[dc]) { found = true; - output += Strings::get(FIREWORKS_CHARGE_COLOUR_NAME[dc]); + output += gameServices().getString(FIREWORKS_CHARGE_COLOUR_NAME[dc]); break; } } if (!found) { - output += Strings::get(IDS_FIREWORKS_CHARGE_CUSTOM); + output += gameServices().getString(IDS_FIREWORKS_CHARGE_CUSTOM); } } lines->push_back(output); @@ -142,7 +142,7 @@ void FireworksChargeItem::appendHoverText(CompoundTag* expTag, if (fadeList.size() > 0) { bool first = true; std::wstring output = - std::wstring(Strings::get(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) { @@ -157,12 +157,12 @@ void FireworksChargeItem::appendHoverText(CompoundTag* expTag, for (int dc = 0; dc < 16; dc++) { if (c == DyePowderItem::COLOR_RGB[dc]) { found = true; - output += Strings::get(FIREWORKS_CHARGE_COLOUR_NAME[dc]); + output += gameServices().getString(FIREWORKS_CHARGE_COLOUR_NAME[dc]); break; } } if (!found) { - output += Strings::get(IDS_FIREWORKS_CHARGE_CUSTOM); + output += gameServices().getString(IDS_FIREWORKS_CHARGE_CUSTOM); } } lines->push_back(output); @@ -171,14 +171,14 @@ void FireworksChargeItem::appendHoverText(CompoundTag* expTag, // has trail bool trail = expTag->getBoolean(FireworksItem::TAG_E_TRAIL); if (trail) { - lines->push_back(HtmlString(Strings::get(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(Strings::get(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 81fa87b89..50a1704b9 100644 --- a/targets/minecraft/world/item/FireworksItem.cpp +++ b/targets/minecraft/world/item/FireworksItem.cpp @@ -1,4 +1,4 @@ -#include "minecraft/locale/Strings.h" +#include "minecraft/IGameServices.h" #include "FireworksItem.h" #include @@ -66,7 +66,7 @@ void FireworksItem::appendHoverText(std::shared_ptr itemInstance, } if (fireTag->contains(TAG_FLIGHT)) { lines->push_back( - std::wstring(Strings::get(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 1cdc9de53..8bd4ceb61 100644 --- a/targets/minecraft/world/item/HangingEntityItem.cpp +++ b/targets/minecraft/world/item/HangingEntityItem.cpp @@ -1,4 +1,4 @@ -#include "minecraft/util/DebugSettings.h" +#include "minecraft/IGameServices.h" #include "HangingEntityItem.h" #include @@ -9,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" @@ -83,7 +83,7 @@ std::shared_ptr HangingEntityItem::createEntity( std::make_shared(level, x, y, z, dir); #ifndef _CONTENT_PACKAGE - if (DebugSettings::artToolsOn() && auxValue > 0) { + if (gameServices().debugArtToolsOn() && auxValue > 0) { painting->PaintingPostConstructor(dir, auxValue - 1); } else #endif @@ -107,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 && DebugSettings::artToolsOn() && + 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 628b3edb4..b2dccc72b 100644 --- a/targets/minecraft/world/item/Item.cpp +++ b/targets/minecraft/world/item/Item.cpp @@ -1,4 +1,4 @@ -#include "minecraft/locale/Strings.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Log.h" #include "Item.h" @@ -1541,12 +1541,12 @@ Item* Item::setDescriptionId(unsigned int id) { } const wchar_t* Item::getDescription() { - return Strings::get(getDescriptionId()); + return gameServices().getString(getDescriptionId()); // return I18n::get(getDescriptionId()); } const wchar_t* Item::getDescription(std::shared_ptr instance) { - return Strings::get(getDescriptionId(instance)); + return gameServices().getString(getDescriptionId(instance)); // return I18n::get(getDescriptionId(instance)); } @@ -1640,7 +1640,7 @@ std::wstring Item::getHoverName(std::shared_ptr itemInstance) { // String elementName = ("" + // Language.getInstance().getElementName(getDescription(itemInstance))).trim(); // return elementName; - return Strings::get(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 095953675..4561dba92 100644 --- a/targets/minecraft/world/item/PlanterTileItem.cpp +++ b/targets/minecraft/world/item/PlanterTileItem.cpp @@ -1,4 +1,4 @@ -#include "minecraft/util/DebugSettings.h" +#include "minecraft/IGameServices.h" #include "PlanterTileItem.h" #include @@ -71,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 (!(DebugSettings::isOn() && - DebugSettings::getMask() & + 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 07f6079a6..1eb8a864e 100644 --- a/targets/minecraft/world/item/PotionItem.cpp +++ b/targets/minecraft/world/item/PotionItem.cpp @@ -1,9 +1,9 @@ -#include "minecraft/locale/Strings.h" +#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" @@ -206,7 +206,7 @@ bool PotionItem::hasInstantenousEffects(int itemAuxValue) { std::wstring PotionItem::getHoverName( std::shared_ptr itemInstance) { if (itemInstance->getAuxValue() == 0) { - return Strings::get( + return gameServices().getString( IDS_ITEM_WATER_BOTTLE); // I18n.get("item.emptyPotion.name").trim(); } @@ -215,7 +215,7 @@ std::wstring PotionItem::getHoverName( // elementName = I18n.get("potion.prefix.grenade").trim() + " " + // elementName; elementName = replaceAll(elementName, L"{*splash*}", - Strings::get(IDS_POTION_PREFIX_GRENADE)); + gameServices().getString(IDS_POTION_PREFIX_GRENADE)); } else { elementName = replaceAll(elementName, L"{*splash*}", L""); } @@ -230,14 +230,14 @@ std::wstring PotionItem::getHoverName( elementName = replaceAll(elementName, L"{*prefix*}", L""); elementName = replaceAll( elementName, L"{*postfix*}", - Strings::get(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*}", - Strings::get(PotionBrewing::getAppearanceName( + gameServices().getString(PotionBrewing::getAppearanceName( itemInstance->getAuxValue()))); elementName = replaceAll(elementName, L"{*postfix*}", L""); } @@ -259,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 = - Strings::get(effect->getDescriptionId()); + gameServices().getString(effect->getDescriptionId()); MobEffect* mobEffect = MobEffect::effects[effect->getId()]; std::unordered_map* @@ -289,18 +289,18 @@ void PotionItem::appendHoverText(std::shared_ptr itemInstance, switch (effect->getAmplifier()) { case 1: potencyString = L" "; - potencyString += Strings::get(IDS_POTION_POTENCY_1); + potencyString += gameServices().getString(IDS_POTION_POTENCY_1); break; case 2: potencyString = L" "; - potencyString += Strings::get(IDS_POTION_POTENCY_2); + potencyString += gameServices().getString(IDS_POTION_POTENCY_2); break; case 3: potencyString = L" "; - potencyString += Strings::get(IDS_POTION_POTENCY_3); + potencyString += gameServices().getString(IDS_POTION_POTENCY_3); break; default: - potencyString = Strings::get(IDS_POTION_POTENCY_0); + potencyString = gameServices().getString(IDS_POTION_POTENCY_0); break; } effectString += @@ -323,7 +323,7 @@ void PotionItem::appendHoverText(std::shared_ptr itemInstance, lines->push_back(HtmlString(effectString, color)); } } else { - std::wstring effectString = Strings::get( + std::wstring effectString = gameServices().getString( IDS_POTION_EMPTY); // I18n.get("potion.empty").trim(); lines->push_back(HtmlString(effectString, eHTMLColor_7)); //"�7" @@ -332,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(Strings::get(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 6bb4587d6..3e4dfda45 100644 --- a/targets/minecraft/world/item/SpawnEggItem.cpp +++ b/targets/minecraft/world/item/SpawnEggItem.cpp @@ -1,5 +1,4 @@ -#include "minecraft/util/DebugSettings.h" -#include "minecraft/locale/Strings.h" +#include "minecraft/IGameServices.h" #include "SpawnEggItem.h" #include @@ -42,7 +41,7 @@ std::wstring SpawnEggItem::getHoverName( int nameId = EntityIO::getNameId(itemInstance->getAuxValue()); if (nameId >= 0) { elementName = - replaceAll(elementName, L"{*CREATURE*}", Strings::get(nameId)); + replaceAll(elementName, L"{*CREATURE*}", gameServices().getString(nameId)); // elementName += " " + I18n.get("entity." + encodeId + ".name"); } else { elementName = replaceAll(elementName, L"{*CREATURE*}", L""); @@ -155,7 +154,7 @@ std::shared_ptr SpawnEggItem::canSpawn(int iAuxVal, Level* level, } } #ifndef _CONTENT_PACKAGE - else if (DebugSettings::artToolsOn()) { + else if (gameServices().debugArtToolsOn()) { canSpawn = true; } #endif @@ -181,7 +180,7 @@ bool SpawnEggItem::useOn(std::shared_ptr itemInstance, int tile = level->getTile(x, y, z); #ifndef _CONTENT_PACKAGE - if (DebugSettings::artToolsOn() && 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 c9e3c7daf..1a38548fd 100644 --- a/targets/minecraft/world/item/TileItem.cpp +++ b/targets/minecraft/world/item/TileItem.cpp @@ -1,4 +1,4 @@ -#include "minecraft/util/DebugSettings.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Log.h" @@ -167,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 (!(DebugSettings::isOn() && - DebugSettings::getMask() & + 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 165836c7e..d77fc3283 100644 --- a/targets/minecraft/world/item/alchemy/PotionBrewing.cpp +++ b/targets/minecraft/world/item/alchemy/PotionBrewing.cpp @@ -2,7 +2,7 @@ #include -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/Colours/ColourTable.h" #include "java/JavaMath.h" #include "minecraft/SharedConstants.h" diff --git a/targets/minecraft/world/item/enchantment/Enchantment.cpp b/targets/minecraft/world/item/enchantment/Enchantment.cpp index 646b480e1..567b0b5e8 100644 --- a/targets/minecraft/world/item/enchantment/Enchantment.cpp +++ b/targets/minecraft/world/item/enchantment/Enchantment.cpp @@ -1,11 +1,10 @@ -#include "minecraft/locale/Strings.h" #include "minecraft/util/Log.h" #include "Enchantment.h" #include #include -#include "minecraft/GameServices.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/HtmlString.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/item/enchantment/ArrowDamageEnchantment.h" @@ -163,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", Strings::get(getDescriptionId()), + swprintf(formatted, 256, L"%ls %ls", gameServices().getString(getDescriptionId()), getLevelString(level).c_str()); unformatted = formatted; swprintf(formatted, 256, L"%ls", - GameServices::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", Strings::get(getDescriptionId()), + swprintf(formatted, 256, L"%ls %ls", gameServices().getString(getDescriptionId()), getLevelString(level).c_str()); return HtmlString(formatted, eHTMLColor_f); @@ -215,5 +214,5 @@ std::wstring Enchantment::getLevelString(int level) { stringId = IDS_ENCHANTMENT_LEVEL_10; break; }; - return Strings::get(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/FoliageColor.cpp b/targets/minecraft/world/level/FoliageColor.cpp index adb4d396d..c406d365e 100644 --- a/targets/minecraft/world/level/FoliageColor.cpp +++ b/targets/minecraft/world/level/FoliageColor.cpp @@ -1,6 +1,6 @@ #include "FoliageColor.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/Colours/ColourTable.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/minecraft/world/level/GameRules.cpp b/targets/minecraft/world/level/GameRules.cpp index e421a7599..9fade251c 100644 --- a/targets/minecraft/world/level/GameRules.cpp +++ b/targets/minecraft/world/level/GameRules.cpp @@ -1,9 +1,9 @@ -#include "minecraft/GameHostOptions.h" +#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 @@ -41,21 +41,21 @@ GameRules::~GameRules() { bool GameRules::getBoolean(const int rule) { switch (rule) { case GameRules::RULE_DOFIRETICK: - return GameHostOptions::get(eGameHostOption_FireSpreads); + return gameServices().getGameHostOption(eGameHostOption_FireSpreads); case GameRules::RULE_MOBGRIEFING: - return GameHostOptions::get(eGameHostOption_MobGriefing); + return gameServices().getGameHostOption(eGameHostOption_MobGriefing); case GameRules::RULE_KEEPINVENTORY: - return GameHostOptions::get(eGameHostOption_KeepInventory); + return gameServices().getGameHostOption(eGameHostOption_KeepInventory); case GameRules::RULE_DOMOBSPAWNING: - return GameHostOptions::get(eGameHostOption_DoMobSpawning); + return gameServices().getGameHostOption(eGameHostOption_DoMobSpawning); case GameRules::RULE_DOMOBLOOT: - return GameHostOptions::get(eGameHostOption_DoMobLoot); + return gameServices().getGameHostOption(eGameHostOption_DoMobLoot); case GameRules::RULE_DOTILEDROPS: - return GameHostOptions::get(eGameHostOption_DoTileDrops); + return gameServices().getGameHostOption(eGameHostOption_DoTileDrops); case GameRules::RULE_NATURAL_REGENERATION: - return GameHostOptions::get(eGameHostOption_NaturalRegeneration); + return gameServices().getGameHostOption(eGameHostOption_NaturalRegeneration); case GameRules::RULE_DAYLIGHT: - return GameHostOptions::get(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 48e4ae151..73d665229 100644 --- a/targets/minecraft/world/level/Level.cpp +++ b/targets/minecraft/world/level/Level.cpp @@ -1,4 +1,4 @@ -#include "minecraft/util/DebugSettings.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Log.h" #include "Level.h" @@ -17,7 +17,7 @@ #include "Explosion.h" #include "IPlatformInput.h" #include "LevelListener.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/Colours/ColourTable.h" #include "app/common/Console_Debug_enum.h" #include "app/common/Network/GameNetworkManager.h" @@ -2115,7 +2115,7 @@ void Level::tickEntities() { if (!e->removed) { #if !defined(_FINAL_BUILD) - if (!(DebugSettings::isOn() && DebugSettings::mobsDontTick() && + if (!(gameServices().debugSettingsOn() && gameServices().debugMobsDontTick() && e->instanceof(eTYPE_MOB) && !e->instanceof(eTYPE_PLAYER))) #endif { @@ -2814,8 +2814,8 @@ void Level::tickWeather() { #if !defined(_FINAL_BUILD) // debug setting added to disable weather - if (DebugSettings::isOn()) { - if (DebugSettings::getMask(PlatformInput.GetPrimaryPad()) & + if (gameServices().debugSettingsOn()) { + if (gameServices().debugGetMask(PlatformInput.GetPrimaryPad()) & (1L << eDebugSetting_DisableWeather)) { levelData->setThundering(false); levelData->setThunderTime(random->nextInt(TICKS_PER_DAY * 7) + diff --git a/targets/minecraft/world/level/biome/Biome.cpp b/targets/minecraft/world/level/biome/Biome.cpp index 10f1e9645..ac9dd9663 100644 --- a/targets/minecraft/world/level/biome/Biome.cpp +++ b/targets/minecraft/world/level/biome/Biome.cpp @@ -6,7 +6,7 @@ #include #include -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/Colours/ColourTable.h" #include "java/Class.h" #include "java/Random.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 1d93a3244..79ecc3acf 100644 --- a/targets/minecraft/world/level/biome/BiomeCache.cpp +++ b/targets/minecraft/world/level/biome/BiomeCache.cpp @@ -1,4 +1,4 @@ -#include "minecraft/GameServices.h" +#include "minecraft/IGameServices.h" #include "BiomeCache.h" #include @@ -90,7 +90,7 @@ BiomeCache::Block* BiomeCache::getBlockAt(int x, int z) { } else { block = it->second; } - block->lastUse = GameServices::getAppTime(); + block->lastUse = gameServices().getAppTime(); return block; } @@ -108,7 +108,7 @@ float BiomeCache::getDownfall(int x, int z) { void BiomeCache::update() { std::lock_guard lock(m_CS); - int64_t now = GameServices::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/BiomeSource.cpp b/targets/minecraft/world/level/biome/BiomeSource.cpp index 06b0fe2fb..7e9657c44 100644 --- a/targets/minecraft/world/level/biome/BiomeSource.cpp +++ b/targets/minecraft/world/level/biome/BiomeSource.cpp @@ -1,4 +1,4 @@ -#include "minecraft/util/DebugSettings.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Log.h" #include "BiomeSource.h" @@ -369,8 +369,8 @@ int64_t BiomeSource::findSeed(LevelType* generator) { mcprogress->progressStage(IDS_PROGRESS_NEW_WORLD_SEED); #if !defined(_CONTENT_PACKAGE) - if (DebugSettings::isOn() && - DebugSettings::getMask(PlatformInput.GetPrimaryPad()) & + if (gameServices().debugSettingsOn() && + gameServices().debugGetMask(PlatformInput.GetPrimaryPad()) & (1L << eDebugSetting_EnableBiomeOverride)) { // Do nothing } else diff --git a/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp b/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp index e83bbc2ec..94a88f486 100644 --- a/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp +++ b/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp @@ -1,4 +1,4 @@ -#include "minecraft/util/DebugSettings.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Log.h" #include "McRegionChunkStorage.h" @@ -184,8 +184,8 @@ LevelChunk* McRegionChunkStorage::load(Level* level, int x, int z) { delete chunkData; } #if !defined(_CONTENT_PACKAGE) - if (levelChunk && DebugSettings::isOn() && - DebugSettings::getMask(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(); diff --git a/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp b/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp index 9c02c07e5..2857ea814 100644 --- a/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp +++ b/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp @@ -1,4 +1,4 @@ -#include "minecraft/util/DebugSettings.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Log.h" #include "OldChunkStorage.h" @@ -447,8 +447,8 @@ LevelChunk* OldChunkStorage::load(Level* level, DataInputStream* dis) { } #if !defined(_CONTENT_PACKAGE) - if (DebugSettings::isOn() && - DebugSettings::getMask(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()); @@ -557,8 +557,8 @@ LevelChunk* OldChunkStorage::load(Level* level, CompoundTag* tag) { // 4J removed - we shouldn't need this any more #if !defined(_CONTENT_PACKAGE) - if (DebugSettings::isOn() && - DebugSettings::getMask(PlatformInput.GetPrimaryPad()) & + if (gameServices().debugSettingsOn() && + gameServices().debugGetMask(PlatformInput.GetPrimaryPad()) & (1L << eDebugSetting_EnableBiomeOverride)) { // Do nothing } else diff --git a/targets/minecraft/world/level/dimension/Dimension.cpp b/targets/minecraft/world/level/dimension/Dimension.cpp index f16da9554..3b527b48f 100644 --- a/targets/minecraft/world/level/dimension/Dimension.cpp +++ b/targets/minecraft/world/level/dimension/Dimension.cpp @@ -1,5 +1,4 @@ -#include "minecraft/util/DebugSettings.h" -#include "minecraft/GameHostOptions.h" +#include "minecraft/IGameServices.h" #include "Dimension.h" #include @@ -8,7 +7,7 @@ #include "HellDimension.h" #include "IPlatformInput.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/Colours/ColourTable.h" #include "app/common/Console_Debug_enum.h" #include "app/linux/LinuxGame.h" @@ -56,8 +55,8 @@ void Dimension::init() { #ifdef _OVERRIDE_HEIGHTMAP // 4J Stu - Added to enable overriding the heightmap from a loaded in data // file - if (DebugSettings::isOn() && - DebugSettings::getMask(PlatformInput.GetPrimaryPad()) & + if (gameServices().debugSettingsOn() && + gameServices().debugGetMask(PlatformInput.GetPrimaryPad()) & (1L << eDebugSetting_EnableBiomeOverride)) { biomeSource = new BiomeSource(level); } else @@ -91,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 (DebugSettings::isOn() && - DebugSettings::getMask(PlatformInput.GetPrimaryPad()) & + if (gameServices().debugSettingsOn() && + gameServices().debugGetMask(PlatformInput.GetPrimaryPad()) & (1L << eDebugSetting_EnableHeightWaterOverride)) { return new CustomLevelSource( level, level->getSeed(), @@ -218,7 +217,7 @@ int Dimension::getSpawnYPosition() { bool Dimension::hasBedrockFog() { // 4J-PB - turn off bedrock fog if the host player doesn't want it - if (GameHostOptions::get(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 d4dfbd919..c14f59c6b 100644 --- a/targets/minecraft/world/level/dimension/HellDimension.cpp +++ b/targets/minecraft/world/level/dimension/HellDimension.cpp @@ -1,10 +1,10 @@ -#include "minecraft/util/DebugSettings.h" +#include "minecraft/IGameServices.h" #include "HellDimension.h" #include #include "IPlatformInput.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/Colours/ColourTable.h" #include "app/common/Console_Debug_enum.h" #include "app/linux/LinuxGame.h" @@ -50,8 +50,8 @@ void HellDimension::updateLightRamp() { ChunkSource* HellDimension::createRandomLevelSource() const { #ifdef _DEBUG_MENUS_ENABLED - if (DebugSettings::isOn() && - DebugSettings::getMask(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 f9dbf1f9d..10b1ee6ad 100644 --- a/targets/minecraft/world/level/dimension/TheEndDimension.cpp +++ b/targets/minecraft/world/level/dimension/TheEndDimension.cpp @@ -4,7 +4,7 @@ #include -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/Colours/ColourTable.h" #include "minecraft/Pos.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/minecraft/world/level/levelgen/CanyonFeature.cpp b/targets/minecraft/world/level/levelgen/CanyonFeature.cpp index 5c390abfa..21f98b440 100644 --- a/targets/minecraft/world/level/levelgen/CanyonFeature.cpp +++ b/targets/minecraft/world/level/levelgen/CanyonFeature.cpp @@ -1,10 +1,10 @@ -#include "minecraft/GameServices.h" +#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" @@ -183,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 - GameServices::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 352cf46b7..2a0fa0170 100644 --- a/targets/minecraft/world/level/levelgen/CustomLevelSource.cpp +++ b/targets/minecraft/world/level/levelgen/CustomLevelSource.cpp @@ -1,4 +1,4 @@ -#include "minecraft/GameServices.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Log.h" #include "CustomLevelSource.h" @@ -53,7 +53,7 @@ CustomLevelSource::CustomLevelSource(Level* level, int64_t seed, Log::info("Heightmap binary is too large!!\n"); __debugbreak(); } else if (result.status != IPlatformFileIO::ReadStatus::Ok) { - GameServices::fatalLoadError(); + gameServices().fatalLoadError(); assert(false); } } @@ -73,7 +73,7 @@ CustomLevelSource::CustomLevelSource(Level* level, int64_t seed, Log::info("waterheight binary is too large!!\n"); __debugbreak(); } else if (result.status != IPlatformFileIO::ReadStatus::Ok) { - GameServices::fatalLoadError(); + gameServices().fatalLoadError(); } } @@ -262,7 +262,7 @@ void CustomLevelSource::buildSurfaces(int xOffs, int zOffs, uint8_t top = b->topMaterial; uint8_t material = b->material; - LevelGenerationOptions* lgo = GameServices::getLevelGenerationOptions(); + LevelGenerationOptions* lgo = gameServices().getLevelGenerationOptions(); if (lgo != nullptr) { lgo->getBiomeOverride(b->id, material, top); } @@ -529,7 +529,7 @@ void CustomLevelSource::postProcess(ChunkSource* parent, int xt, int zt) { biome->decorate(level, pprandom, xo, zo); - GameServices::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 f33ae8c20..aa2a15c4d 100644 --- a/targets/minecraft/world/level/levelgen/FlatLevelSource.cpp +++ b/targets/minecraft/world/level/levelgen/FlatLevelSource.cpp @@ -1,4 +1,4 @@ -#include "minecraft/GameServices.h" +#include "minecraft/IGameServices.h" #include "FlatLevelSource.h" #include @@ -106,7 +106,7 @@ void FlatLevelSource::postProcess(ChunkSource* parent, int xt, int zt) { villageFeature->postProcess(level, pprandom, xt, zt); } - GameServices::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 196d5b48a..2b8c7b5d8 100644 --- a/targets/minecraft/world/level/levelgen/HellFlatLevelSource.cpp +++ b/targets/minecraft/world/level/levelgen/HellFlatLevelSource.cpp @@ -1,4 +1,4 @@ -#include "minecraft/GameServices.h" +#include "minecraft/IGameServices.h" #include "HellFlatLevelSource.h" #include @@ -182,7 +182,7 @@ void HellFlatLevelSource::postProcess(ChunkSource* parent, int xt, int zt) { HeavyTile::instaFall = false; - GameServices::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 9c008da28..aa04a7543 100644 --- a/targets/minecraft/world/level/levelgen/HellRandomLevelSource.cpp +++ b/targets/minecraft/world/level/levelgen/HellRandomLevelSource.cpp @@ -1,4 +1,4 @@ -#include "minecraft/GameServices.h" +#include "minecraft/IGameServices.h" #include "HellRandomLevelSource.h" #include @@ -529,7 +529,7 @@ void HellRandomLevelSource::postProcess(ChunkSource* parent, int xt, int zt) { HeavyTile::instaFall = false; - GameServices::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 f6575a32e..29b610e64 100644 --- a/targets/minecraft/world/level/levelgen/RandomLevelSource.cpp +++ b/targets/minecraft/world/level/levelgen/RandomLevelSource.cpp @@ -1,4 +1,4 @@ -#include "minecraft/GameServices.h" +#include "minecraft/IGameServices.h" #include "RandomLevelSource.h" #include @@ -409,7 +409,7 @@ void RandomLevelSource::buildSurfaces(int xOffs, int zOffs, uint8_t top = b->topMaterial; uint8_t material = b->material; - LevelGenerationOptions* lgo = GameServices::getLevelGenerationOptions(); + LevelGenerationOptions* lgo = gameServices().getLevelGenerationOptions(); if (lgo != nullptr) { lgo->getBiomeOverride(b->id, material, top); } @@ -799,7 +799,7 @@ void RandomLevelSource::postProcess(ChunkSource* parent, int xt, int zt) { biome->decorate(level, pprandom, xo, zo); - GameServices::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 854e93cca..19bf567a3 100644 --- a/targets/minecraft/world/level/levelgen/TheEndLevelRandomLevelSource.cpp +++ b/targets/minecraft/world/level/levelgen/TheEndLevelRandomLevelSource.cpp @@ -1,4 +1,4 @@ -#include "minecraft/GameServices.h" +#include "minecraft/IGameServices.h" #include "TheEndLevelRandomLevelSource.h" #include @@ -403,7 +403,7 @@ void TheEndLevelRandomLevelSource::postProcess(ChunkSource* parent, int xt, HeavyTile::instaFall = false; - GameServices::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 57d2798f8..087eefc0a 100644 --- a/targets/minecraft/world/level/levelgen/feature/BasicTreeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/BasicTreeFeature.cpp @@ -1,4 +1,4 @@ -#include "minecraft/GameServices.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Log.h" #include "BasicTreeFeature.h" @@ -452,9 +452,9 @@ bool BasicTree::checkLocation() { // 4J Stu Added to stop tree features generating areas previously place by // game rule generation - if (GameServices::getLevelGenerationOptions() != nullptr) { + if (gameServices().getLevelGenerationOptions() != nullptr) { LevelGenerationOptions* levelGenOptions = - GameServices::getLevelGenerationOptions(); + gameServices().getLevelGenerationOptions(); bool intersects = levelGenOptions->checkIntersects( startPosition[0], startPosition[1], startPosition[2], endPosition[0], endPosition[1], endPosition[2]); diff --git a/targets/minecraft/world/level/levelgen/feature/BirchFeature.cpp b/targets/minecraft/world/level/levelgen/feature/BirchFeature.cpp index 22c35b1f5..9cc463d87 100644 --- a/targets/minecraft/world/level/levelgen/feature/BirchFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/BirchFeature.cpp @@ -1,4 +1,4 @@ -#include "minecraft/GameServices.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Log.h" #include "BirchFeature.h" @@ -46,9 +46,9 @@ 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 (GameServices::getLevelGenerationOptions() != nullptr) { + if (gameServices().getLevelGenerationOptions() != nullptr) { LevelGenerationOptions* levelGenOptions = - GameServices::getLevelGenerationOptions(); + gameServices().getLevelGenerationOptions(); int radius = 3; bool intersects = levelGenOptions->checkIntersects( x - radius, y - 1, z - radius, x + radius, y + treeHeight, diff --git a/targets/minecraft/world/level/levelgen/feature/CaveFeature.cpp b/targets/minecraft/world/level/levelgen/feature/CaveFeature.cpp index 14b041d64..f106f7c6c 100644 --- a/targets/minecraft/world/level/levelgen/feature/CaveFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/CaveFeature.cpp @@ -1,4 +1,4 @@ -#include "minecraft/GameServices.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Log.h" #include "CaveFeature.h" @@ -48,9 +48,9 @@ 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 (GameServices::getLevelGenerationOptions() != nullptr) { + if (gameServices().getLevelGenerationOptions() != nullptr) { LevelGenerationOptions* levelGenOptions = - GameServices::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)); diff --git a/targets/minecraft/world/level/levelgen/feature/FlowerFeature.cpp b/targets/minecraft/world/level/levelgen/feature/FlowerFeature.cpp index b4be07c41..cfd5b65e3 100644 --- a/targets/minecraft/world/level/levelgen/feature/FlowerFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/FlowerFeature.cpp @@ -1,4 +1,4 @@ -#include "minecraft/GameServices.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Log.h" #include "FlowerFeature.h" @@ -14,9 +14,9 @@ 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 (GameServices::getLevelGenerationOptions() != nullptr) { + if (gameServices().getLevelGenerationOptions() != nullptr) { LevelGenerationOptions* levelGenOptions = - GameServices::getLevelGenerationOptions(); + gameServices().getLevelGenerationOptions(); bool intersects = levelGenOptions->checkIntersects(x - 8, y - 4, z - 8, x + 8, y + 4, z + 8); if (intersects) { diff --git a/targets/minecraft/world/level/levelgen/feature/LakeFeature.cpp b/targets/minecraft/world/level/levelgen/feature/LakeFeature.cpp index 1a8b4cb64..c13c1d68a 100644 --- a/targets/minecraft/world/level/levelgen/feature/LakeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/LakeFeature.cpp @@ -1,4 +1,4 @@ -#include "minecraft/GameServices.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Log.h" #include "LakeFeature.h" @@ -26,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 (GameServices::getLevelGenerationOptions() != nullptr) { - levelGenOptions = GameServices::getLevelGenerationOptions(); + if (gameServices().getLevelGenerationOptions() != nullptr) { + levelGenOptions = gameServices().getLevelGenerationOptions(); int minX = x; int minY = y; diff --git a/targets/minecraft/world/level/levelgen/feature/MegaTreeFeature.cpp b/targets/minecraft/world/level/levelgen/feature/MegaTreeFeature.cpp index ef62e1726..a2d426b29 100644 --- a/targets/minecraft/world/level/levelgen/feature/MegaTreeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/MegaTreeFeature.cpp @@ -1,4 +1,4 @@ -#include "minecraft/GameServices.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Log.h" #include "MegaTreeFeature.h" @@ -28,9 +28,9 @@ 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 (GameServices::getLevelGenerationOptions() != nullptr) { + if (gameServices().getLevelGenerationOptions() != nullptr) { LevelGenerationOptions* levelGenOptions = - GameServices::getLevelGenerationOptions(); + gameServices().getLevelGenerationOptions(); bool intersects = levelGenOptions->checkIntersects( x - 2, y - 1, z - 2, x + 2, y + treeHeight, z + 2); diff --git a/targets/minecraft/world/level/levelgen/feature/OreFeature.cpp b/targets/minecraft/world/level/levelgen/feature/OreFeature.cpp index d603b76a6..4068466f4 100644 --- a/targets/minecraft/world/level/levelgen/feature/OreFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/OreFeature.cpp @@ -1,4 +1,4 @@ -#include "minecraft/GameServices.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Log.h" #include "OreFeature.h" @@ -39,8 +39,8 @@ bool OreFeature::place(Level* level, Random* random, int x, int y, int z) { bool collisionsExpected = false; LevelGenerationOptions* levelGenOptions = nullptr; - if (GameServices::getLevelGenerationOptions() != nullptr) { - levelGenOptions = GameServices::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 diff --git a/targets/minecraft/world/level/levelgen/feature/PineFeature.cpp b/targets/minecraft/world/level/levelgen/feature/PineFeature.cpp index 13b0778bf..468438eec 100644 --- a/targets/minecraft/world/level/levelgen/feature/PineFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/PineFeature.cpp @@ -1,4 +1,4 @@ -#include "minecraft/GameServices.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Log.h" #include "PineFeature.h" @@ -27,9 +27,9 @@ 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 (GameServices::getLevelGenerationOptions() != nullptr) { + if (gameServices().getLevelGenerationOptions() != nullptr) { LevelGenerationOptions* levelGenOptions = - GameServices::getLevelGenerationOptions(); + gameServices().getLevelGenerationOptions(); bool intersects = levelGenOptions->checkIntersects( x - topRadius, y - 1, z - topRadius, x + topRadius, y + treeHeight, z + topRadius); diff --git a/targets/minecraft/world/level/levelgen/feature/ReedsFeature.cpp b/targets/minecraft/world/level/levelgen/feature/ReedsFeature.cpp index 992bed873..9006cc7af 100644 --- a/targets/minecraft/world/level/levelgen/feature/ReedsFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/ReedsFeature.cpp @@ -1,4 +1,4 @@ -#include "minecraft/GameServices.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Log.h" #include "ReedsFeature.h" @@ -17,9 +17,9 @@ 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 (GameServices::getLevelGenerationOptions() != nullptr) { + if (gameServices().getLevelGenerationOptions() != nullptr) { LevelGenerationOptions* levelGenOptions = - GameServices::getLevelGenerationOptions(); + gameServices().getLevelGenerationOptions(); bool intersects = levelGenOptions->checkIntersects(x2, y2, z2, x2, y2, z2); if (intersects) { diff --git a/targets/minecraft/world/level/levelgen/feature/SandFeature.cpp b/targets/minecraft/world/level/levelgen/feature/SandFeature.cpp index 0aa467cb4..2e8307244 100644 --- a/targets/minecraft/world/level/levelgen/feature/SandFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/SandFeature.cpp @@ -1,4 +1,4 @@ -#include "minecraft/GameServices.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Log.h" #include "SandFeature.h" @@ -28,9 +28,9 @@ 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 (GameServices::getLevelGenerationOptions() != nullptr) { + if (gameServices().getLevelGenerationOptions() != nullptr) { LevelGenerationOptions* levelGenOptions = - GameServices::getLevelGenerationOptions(); + gameServices().getLevelGenerationOptions(); bool intersects = levelGenOptions->checkIntersects( x - r, y - yr, z - r, x + r, y + yr, z + r); if (intersects) { diff --git a/targets/minecraft/world/level/levelgen/feature/SpringFeature.cpp b/targets/minecraft/world/level/levelgen/feature/SpringFeature.cpp index f72d07540..34833deb5 100644 --- a/targets/minecraft/world/level/levelgen/feature/SpringFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/SpringFeature.cpp @@ -1,4 +1,4 @@ -#include "minecraft/GameServices.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Log.h" #include "SpringFeature.h" @@ -12,9 +12,9 @@ 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 (GameServices::getLevelGenerationOptions() != nullptr) { + if (gameServices().getLevelGenerationOptions() != nullptr) { LevelGenerationOptions* levelGenOptions = - GameServices::getLevelGenerationOptions(); + gameServices().getLevelGenerationOptions(); bool intersects = levelGenOptions->checkIntersects(x, y, z, x, y, z); if (intersects) { // Log::info("Skipping spring feature generation as it diff --git a/targets/minecraft/world/level/levelgen/feature/SpruceFeature.cpp b/targets/minecraft/world/level/levelgen/feature/SpruceFeature.cpp index fe43a42a7..eeebb62fa 100644 --- a/targets/minecraft/world/level/levelgen/feature/SpruceFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/SpruceFeature.cpp @@ -1,4 +1,4 @@ -#include "minecraft/GameServices.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Log.h" #include "SpruceFeature.h" @@ -30,9 +30,9 @@ 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 (GameServices::getLevelGenerationOptions() != nullptr) { + if (gameServices().getLevelGenerationOptions() != nullptr) { LevelGenerationOptions* levelGenOptions = - GameServices::getLevelGenerationOptions(); + gameServices().getLevelGenerationOptions(); bool intersects = levelGenOptions->checkIntersects( x - leafRadius, y - 1, z - leafRadius, x + leafRadius, y + treeHeight, z + leafRadius); diff --git a/targets/minecraft/world/level/levelgen/feature/SwampTreeFeature.cpp b/targets/minecraft/world/level/levelgen/feature/SwampTreeFeature.cpp index bc81aac38..79c962cca 100644 --- a/targets/minecraft/world/level/levelgen/feature/SwampTreeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/SwampTreeFeature.cpp @@ -1,4 +1,4 @@ -#include "minecraft/GameServices.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Log.h" #include "SwampTreeFeature.h" @@ -22,9 +22,9 @@ 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 (GameServices::getLevelGenerationOptions() != nullptr) { + if (gameServices().getLevelGenerationOptions() != nullptr) { LevelGenerationOptions* levelGenOptions = - GameServices::getLevelGenerationOptions(); + gameServices().getLevelGenerationOptions(); bool intersects = levelGenOptions->checkIntersects( x - 3, y - 1, z - 3, x + 3, y + treeHeight, z + 3); if (intersects) { diff --git a/targets/minecraft/world/level/levelgen/feature/TreeFeature.cpp b/targets/minecraft/world/level/levelgen/feature/TreeFeature.cpp index d9c41eb43..5ebcfa2b2 100644 --- a/targets/minecraft/world/level/levelgen/feature/TreeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/TreeFeature.cpp @@ -1,4 +1,4 @@ -#include "minecraft/GameServices.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Log.h" #include "TreeFeature.h" @@ -36,9 +36,9 @@ 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 (GameServices::getLevelGenerationOptions() != nullptr) { + if (gameServices().getLevelGenerationOptions() != nullptr) { LevelGenerationOptions* levelGenOptions = - GameServices::getLevelGenerationOptions(); + gameServices().getLevelGenerationOptions(); bool intersects = levelGenOptions->checkIntersects( x - 2, y - 1, z - 2, x + 2, y + treeHeight, z + 2); diff --git a/targets/minecraft/world/level/levelgen/structure/MineShaftFeature.cpp b/targets/minecraft/world/level/levelgen/structure/MineShaftFeature.cpp index ca9301eef..8e3f98a02 100644 --- a/targets/minecraft/world/level/levelgen/structure/MineShaftFeature.cpp +++ b/targets/minecraft/world/level/levelgen/structure/MineShaftFeature.cpp @@ -1,4 +1,4 @@ -#include "minecraft/GameServices.h" +#include "minecraft/IGameServices.h" #include "minecraft/world/level/levelgen/structure/MineShaftFeature.h" @@ -9,7 +9,7 @@ #include #include -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" #include "app/linux/LinuxGame.h" #include "java/Random.h" @@ -35,7 +35,7 @@ MineShaftFeature::MineShaftFeature( bool MineShaftFeature::isFeatureChunk(int x, int z, bool bIsSuperflat) { bool forcePlacement = false; - LevelGenerationOptions* levelGenOptions = GameServices::getLevelGenerationOptions(); + LevelGenerationOptions* levelGenOptions = gameServices().getLevelGenerationOptions(); if (levelGenOptions != nullptr) { forcePlacement = levelGenOptions->isFeatureChunk(x, z, eFeature_Mineshaft); @@ -47,7 +47,7 @@ bool MineShaftFeature::isFeatureChunk(int x, int z, bool bIsSuperflat) { StructureStart* MineShaftFeature::createStructureStart(int x, int z) { // 4J added - GameServices::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 fef8d89d5..e1d850262 100644 --- a/targets/minecraft/world/level/levelgen/structure/NetherBridgeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/structure/NetherBridgeFeature.cpp @@ -1,4 +1,4 @@ -#include "minecraft/GameServices.h" +#include "minecraft/IGameServices.h" #include "NetherBridgeFeature.h" #include @@ -60,7 +60,7 @@ bool NetherBridgeFeature::isFeatureChunk(int x, int z, bool bIsSuperflat) { } bool forcePlacement = false; - LevelGenerationOptions* levelGenOptions = GameServices::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 0c795f2ed..22a6317b3 100644 --- a/targets/minecraft/world/level/levelgen/structure/RandomScatteredLargeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/structure/RandomScatteredLargeFeature.cpp @@ -1,4 +1,4 @@ -#include "minecraft/GameServices.h" +#include "minecraft/IGameServices.h" #include "RandomScatteredLargeFeature.h" #include @@ -68,7 +68,7 @@ bool RandomScatteredLargeFeature::isFeatureChunk(int x, int z, z = zz; bool forcePlacement = false; - LevelGenerationOptions* levelGenOptions = GameServices::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 d1d9386c4..c07076160 100644 --- a/targets/minecraft/world/level/levelgen/structure/ScatteredFeaturePieces.cpp +++ b/targets/minecraft/world/level/levelgen/structure/ScatteredFeaturePieces.cpp @@ -1,4 +1,4 @@ -#include "minecraft/GameServices.h" +#include "minecraft/IGameServices.h" #include "ScatteredFeaturePieces.h" #include @@ -61,7 +61,7 @@ ScatteredFeaturePieces::ScatteredFeaturePiece::ScatteredFeaturePiece( orientation = random->nextInt(4); - LevelGenerationOptions* levelGenOptions = GameServices::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 1d6d245f9..8435768a2 100644 --- a/targets/minecraft/world/level/levelgen/structure/StrongholdFeature.cpp +++ b/targets/minecraft/world/level/levelgen/structure/StrongholdFeature.cpp @@ -1,4 +1,4 @@ -#include "minecraft/GameServices.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Log.h" #include "StrongholdFeature.h" @@ -10,7 +10,7 @@ #include #include -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" #include "app/linux/LinuxGame.h" #include "app/linux/Stubs/winapi_stubs.h" @@ -168,7 +168,7 @@ bool StrongholdFeature::isFeatureChunk(int x, int z, bool bIsSuperflat) { "%d)\n", selectedX, selectedZ, position->x, position->z); // 4J added - GameServices::addTerrainFeaturePosition(eTerrainFeature_Stronghold, + gameServices().addTerrainFeaturePosition(eTerrainFeature_Stronghold, selectedX, selectedZ); // 4J Added @@ -198,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. - GameServices::addTerrainFeaturePosition(eTerrainFeature_Stronghold, + gameServices().addTerrainFeaturePosition(eTerrainFeature_Stronghold, strongholdPos[0]->x, strongholdPos[0]->z); } @@ -209,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 = - GameServices::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 c4b78cf3a..8d5ffd42b 100644 --- a/targets/minecraft/world/level/levelgen/structure/StrongholdPieces.cpp +++ b/targets/minecraft/world/level/levelgen/structure/StrongholdPieces.cpp @@ -1,4 +1,4 @@ -#include "minecraft/GameServices.h" +#include "minecraft/IGameServices.h" #include "StrongholdPieces.h" #include @@ -7,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" @@ -1971,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 - GameServices::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/VillageFeature.cpp b/targets/minecraft/world/level/levelgen/structure/VillageFeature.cpp index e28b106a4..0f9c3ed28 100644 --- a/targets/minecraft/world/level/levelgen/structure/VillageFeature.cpp +++ b/targets/minecraft/world/level/levelgen/structure/VillageFeature.cpp @@ -1,4 +1,4 @@ -#include "minecraft/GameServices.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Log.h" #include "VillageFeature.h" @@ -6,7 +6,7 @@ #include #include -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" #include "app/linux/LinuxGame.h" #include "VillagePieces.h" @@ -86,7 +86,7 @@ bool VillageFeature::isFeatureChunk(int x, int z, bool bIsSuperflat) { z = zz; bool forcePlacement = false; - LevelGenerationOptions* levelGenOptions = GameServices::getLevelGenerationOptions(); + LevelGenerationOptions* levelGenOptions = gameServices().getLevelGenerationOptions(); if (levelGenOptions != nullptr) { forcePlacement = levelGenOptions->isFeatureChunk(x, z, eFeature_Village); @@ -107,7 +107,7 @@ bool VillageFeature::isFeatureChunk(int x, int z, bool bIsSuperflat) { StructureStart* VillageFeature::createStructureStart(int x, int z) { // 4J added - GameServices::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 df9eb0334..1026245ad 100644 --- a/targets/minecraft/world/level/newbiome/layer/BiomeOverrideLayer.cpp +++ b/targets/minecraft/world/level/newbiome/layer/BiomeOverrideLayer.cpp @@ -3,7 +3,7 @@ #include -#include "minecraft/GameServices.h" +#include "minecraft/IGameServices.h" #include "platform/PlatformServices.h" #include "minecraft/world/level/newbiome/layer/Layer.h" #if defined(__linux__) @@ -26,7 +26,7 @@ BiomeOverrideLayer::BiomeOverrideLayer(int seedMixup) : Layer(seedMixup) { Log::info("Biomemap binary is too large!!\n"); __debugbreak(); } else if (result.status != IPlatformFileIO::ReadStatus::Ok) { - GameServices::fatalLoadError(); + gameServices().fatalLoadError(); } } } diff --git a/targets/minecraft/world/level/newbiome/layer/Layer.cpp b/targets/minecraft/world/level/newbiome/layer/Layer.cpp index 087b78780..8e587c898 100644 --- a/targets/minecraft/world/level/newbiome/layer/Layer.cpp +++ b/targets/minecraft/world/level/newbiome/layer/Layer.cpp @@ -1,4 +1,4 @@ -#include "minecraft/util/DebugSettings.h" +#include "minecraft/IGameServices.h" #include "minecraft/world/level/newbiome/layer/Layer.h" #include @@ -111,8 +111,8 @@ std::vector> Layer::getDefaultLayers( #if !defined(_CONTENT_PACKAGE) #if defined(_BIOME_OVERRIDE) - if (DebugSettings::isOn() && - DebugSettings::getMask(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/ConsoleSaveFileOriginal.cpp b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp index a3c0e2ab1..24a668711 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp @@ -1,6 +1,4 @@ -#include "minecraft/GameServices.h" -#include "minecraft/util/DebugSettings.h" -#include "minecraft/GameHostOptions.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Log.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.h" @@ -17,7 +15,7 @@ #include #include "platform/PlatformTypes.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/BuildVer/BuildVer.h" #include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" #include "app/linux/LinuxGame.h" @@ -70,7 +68,7 @@ ConsoleSaveFileOriginal::ConsoleSaveFileOriginal( // Load a save from the game rules bool bLevelGenBaseSave = false; - LevelGenerationOptions* levelGen = GameServices::getLevelGenerationOptions(); + LevelGenerationOptions* levelGen = gameServices().getLevelGenerationOptions(); if (pvSaveData == nullptr && levelGen != nullptr && levelGen->requiresBaseSave()) { pvSaveData = levelGen->getBaseSaveData(fileSize); @@ -647,7 +645,7 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail) { unsigned int dwDataSizeSaveImage = 0; #ifdef _WINDOWS64 - GameServices::getSaveThumbnail(&pbThumbnailData, &dwThumbnailDataSize, + gameServices().getSaveThumbnail(&pbThumbnailData, &dwThumbnailDataSize, &pbDataSaveImage, &dwDataSizeSaveImage); #endif @@ -664,9 +662,9 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail) { hasSeed = true; } - int iTextMetadataBytes = GameServices::createImageTextData( + int iTextMetadataBytes = gameServices().createImageTextData( bTextMetadata, seed, hasSeed, - GameHostOptions::get(eGameHostOption_All), + gameServices().getGameHostOption(eGameHostOption_All), Minecraft::GetInstance()->getCurrentTexturePackId()); int32_t saveOrCheckpointId = 0; @@ -683,8 +681,8 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail) { PlatformStorage.SaveSaveData( &ConsoleSaveFileOriginal::SaveSaveDataCallback, this); #ifndef _CONTENT_PACKAGE - if (DebugSettings::isOn()) { - if (GameServices::getWriteSavesToFolderEnabled()) { + if (gameServices().debugSettingsOn()) { + if (gameServices().getWriteSavesToFolderEnabled()) { DebugFlushToFile(compData, compLength + 8); } } diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp index fb6f632a1..353f50448 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp @@ -1,6 +1,4 @@ -#include "minecraft/GameServices.h" -#include "minecraft/util/DebugSettings.h" -#include "minecraft/GameHostOptions.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Log.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.h" @@ -18,7 +16,7 @@ #include #include "platform/PlatformTypes.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/BuildVer/BuildVer.h" #include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" #include "app/linux/LinuxGame.h" @@ -371,7 +369,7 @@ ConsoleSaveFileSplit::ConsoleSaveFileSplit( // Load a save from the game rules bool bLevelGenBaseSave = false; - LevelGenerationOptions* levelGen = GameServices::getLevelGenerationOptions(); + LevelGenerationOptions* levelGen = gameServices().getLevelGenerationOptions(); if (pvSaveData == nullptr && levelGen != nullptr && levelGen->requiresBaseSave()) { pvSaveData = levelGen->getBaseSaveData(fileSize); @@ -1367,9 +1365,9 @@ void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail) { hasSeed = true; } - int iTextMetadataBytes = GameServices::createImageTextData( + int iTextMetadataBytes = gameServices().createImageTextData( bTextMetadata, seed, hasSeed, - GameHostOptions::get(eGameHostOption_All), + gameServices().getGameHostOption(eGameHostOption_All), Minecraft::GetInstance()->getCurrentTexturePackId()); // set the icon and save image @@ -1388,8 +1386,8 @@ void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail) { return SaveSaveDataCallback(this, bRes); }); #if !defined(_CONTENT_PACKAGE) - if (DebugSettings::isOn()) { - if (GameServices::getWriteSavesToFolderEnabled()) { + if (gameServices().debugSettingsOn()) { + if (gameServices().getWriteSavesToFolderEnabled()) { DebugFlushToFile(compData, compLength + 8); } } diff --git a/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp b/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp index d3fc3b884..a565ba700 100644 --- a/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp +++ b/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp @@ -1,5 +1,4 @@ -#include "minecraft/GameServices.h" -#include "minecraft/util/DebugSettings.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Log.h" #include "DirectoryLevelStorage.h" @@ -459,8 +458,8 @@ void DirectoryLevelStorage::clearOldPlayerFiles() { if (playerFiles != nullptr) { #if !defined(_FINAL_BUILD) - if (DebugSettings::isOn() && - DebugSettings::getMask(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); @@ -505,8 +504,8 @@ std::wstring DirectoryLevelStorage::getLevelId() { return levelId; } void DirectoryLevelStorage::flushSaveFile(bool autosave) { #if !defined(_CONTENT_PACKAGE) - if (DebugSettings::isOn() && - DebugSettings::getMask(PlatformInput.GetPrimaryPad()) & + if (gameServices().debugSettingsOn() && + gameServices().debugGetMask(PlatformInput.GetPrimaryPad()) & (1L << eDebugSetting_DistributableSave)) { // Delete gamerules files if it exists ConsoleSavePath gameRulesFiles(GAME_RULE_SAVENAME); @@ -521,7 +520,7 @@ void DirectoryLevelStorage::flushSaveFile(bool autosave) { // 4J Added void DirectoryLevelStorage::resetNetherPlayerPositions() { - if (GameServices::getResetNether()) { + if (gameServices().getResetNether()) { std::vector* playerFiles = m_saveFile->getFilesWithPrefix(playerDir.getName()); diff --git a/targets/minecraft/world/level/storage/LevelData.cpp b/targets/minecraft/world/level/storage/LevelData.cpp index e4cb26caf..c416a7f37 100644 --- a/targets/minecraft/world/level/storage/LevelData.cpp +++ b/targets/minecraft/world/level/storage/LevelData.cpp @@ -1,5 +1,4 @@ -#include "minecraft/GameServices.h" -#include "minecraft/GameHostOptions.h" +#include "minecraft/IGameServices.h" #include "LevelData.h" #include @@ -8,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" @@ -125,12 +124,12 @@ LevelData::LevelData(CompoundTag* tag) { m_smallEdgeMoat = tag->getInt(L"SmallMoat"); m_mediumEdgeMoat = tag->getInt(L"MediumMoat"); - int newWorldSize = GameServices::getGameNewWorldSize(); - int newHellScale = GameServices::getGameNewHellScale(); + int newWorldSize = gameServices().getGameNewWorldSize(); + int newHellScale = gameServices().getGameNewHellScale(); m_hellScaleOld = m_hellScale; m_xzSizeOld = m_xzSize; if (newWorldSize > m_xzSize) { - bool bUseMoat = GameServices::getGameNewWorldSizeUseMoat(); + bool bUseMoat = gameServices().getGameNewWorldSizeUseMoat(); switch (m_xzSize) { case LEVEL_WIDTH_CLASSIC: m_classicEdgeMoat = bUseMoat; @@ -184,7 +183,7 @@ LevelData::LevelData(CompoundTag* tag) { assert(0); break; } - GameHostOptions::set(eGameHostOption_WorldSize, hostOptionworldSize); + gameServices().setGameHostOption(eGameHostOption_WorldSize, hostOptionworldSize); #endif /* 4J - we don't store this anymore @@ -518,7 +517,7 @@ void LevelData::setGameType(GameType* gameType) { // 4J Added hasBeenInCreative = hasBeenInCreative || (gameType == GameType::CREATIVE) || - (GameHostOptions::get(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 8ce8a768a..e03642af4 100644 --- a/targets/minecraft/world/level/storage/McRegionLevelStorage.cpp +++ b/targets/minecraft/world/level/storage/McRegionLevelStorage.cpp @@ -1,4 +1,4 @@ -#include "minecraft/GameServices.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Log.h" #include "McRegionLevelStorage.h" @@ -38,7 +38,7 @@ ChunkStorage* McRegionLevelStorage::createChunkStorage(Dimension* dimension) { // File folder = getFolder(); if (dynamic_cast(dimension) != nullptr) { - if (GameServices::getResetNether()) { + if (gameServices().getResetNether()) { #ifdef SPLIT_SAVES std::vector* netherFiles = m_saveFile->getRegionFilesByDimension(1); diff --git a/targets/minecraft/world/level/tile/FireTile.cpp b/targets/minecraft/world/level/tile/FireTile.cpp index 9134d8dc5..d7f43dcc8 100644 --- a/targets/minecraft/world/level/tile/FireTile.cpp +++ b/targets/minecraft/world/level/tile/FireTile.cpp @@ -1,11 +1,11 @@ -#include "minecraft/GameHostOptions.h" +#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" @@ -162,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 (GameHostOptions::get(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++) { @@ -208,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) && - GameHostOptions::get(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 c7b04b999..9c059ac8d 100644 --- a/targets/minecraft/world/level/tile/GrassTile.cpp +++ b/targets/minecraft/world/level/tile/GrassTile.cpp @@ -2,7 +2,7 @@ #include -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/Colours/ColourTable.h" #include "java/Random.h" #include "minecraft/Facing.h" diff --git a/targets/minecraft/world/level/tile/LeafTile.cpp b/targets/minecraft/world/level/tile/LeafTile.cpp index f1321c3d0..a72d1b6a4 100644 --- a/targets/minecraft/world/level/tile/LeafTile.cpp +++ b/targets/minecraft/world/level/tile/LeafTile.cpp @@ -2,7 +2,7 @@ #include -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/Colours/ColourTable.h" #include "java/Random.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/minecraft/world/level/tile/RedStoneDustTile.cpp b/targets/minecraft/world/level/tile/RedStoneDustTile.cpp index 8992d8968..b86cb2a52 100644 --- a/targets/minecraft/world/level/tile/RedStoneDustTile.cpp +++ b/targets/minecraft/world/level/tile/RedStoneDustTile.cpp @@ -6,7 +6,7 @@ #include #include "DiodeTile.h" -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/Colours/ColourTable.h" #include "java/Random.h" #include "minecraft/Direction.h" diff --git a/targets/minecraft/world/level/tile/StemTile.cpp b/targets/minecraft/world/level/tile/StemTile.cpp index 6d778b074..bd269ffbb 100644 --- a/targets/minecraft/world/level/tile/StemTile.cpp +++ b/targets/minecraft/world/level/tile/StemTile.cpp @@ -2,7 +2,7 @@ #include -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/Colours/ColourTable.h" #include "java/Random.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/minecraft/world/level/tile/StoneMonsterTile.cpp b/targets/minecraft/world/level/tile/StoneMonsterTile.cpp index 1ca2a0920..63e367005 100644 --- a/targets/minecraft/world/level/tile/StoneMonsterTile.cpp +++ b/targets/minecraft/world/level/tile/StoneMonsterTile.cpp @@ -1,4 +1,4 @@ -#include "minecraft/util/DebugSettings.h" +#include "minecraft/IGameServices.h" #include "StoneMonsterTile.h" #include @@ -26,7 +26,7 @@ StoneMonsterTile::StoneMonsterTile(int id) : Tile(id, Material::clay) { Icon* StoneMonsterTile::getTexture(int face, int data) { #ifndef _CONTENT_PACKAGE - if (DebugSettings::artToolsOn()) { + 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 e54120810..48cad4309 100644 --- a/targets/minecraft/world/level/tile/TallGrassPlantTile.cpp +++ b/targets/minecraft/world/level/tile/TallGrassPlantTile.cpp @@ -2,7 +2,7 @@ #include -#include "app/common/App_enums.h" +#include "minecraft/GameEnums.h" #include "app/common/Colours/ColourTable.h" #include "java/Random.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/minecraft/world/level/tile/TntTile.cpp b/targets/minecraft/world/level/tile/TntTile.cpp index 1d8b44794..f0002b1f0 100644 --- a/targets/minecraft/world/level/tile/TntTile.cpp +++ b/targets/minecraft/world/level/tile/TntTile.cpp @@ -1,9 +1,9 @@ -#include "minecraft/GameHostOptions.h" +#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" @@ -36,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) && - GameHostOptions::get(eGameHostOption_TNT)) { + gameServices().getGameHostOption(eGameHostOption_TNT)) { destroy(level, x, y, z, EXPLODE_BIT); level->removeTile(x, y, z); } @@ -44,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) && - GameHostOptions::get(eGameHostOption_TNT)) { + gameServices().getGameHostOption(eGameHostOption_TNT)) { destroy(level, x, y, z, EXPLODE_BIT); level->removeTile(x, y, z); } @@ -64,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() && - GameHostOptions::get(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())); @@ -85,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() && - GameHostOptions::get(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 0d4976d56..ec4dda5da 100644 --- a/targets/minecraft/world/level/tile/WaterLilyTile.cpp +++ b/targets/minecraft/world/level/tile/WaterLilyTile.cpp @@ -3,7 +3,7 @@ #include #include -#include "app/common/App_enums.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/world/level/tile/entity/BeaconTileEntity.cpp b/targets/minecraft/world/level/tile/entity/BeaconTileEntity.cpp index 333d9a272..e9a6a6701 100644 --- a/targets/minecraft/world/level/tile/entity/BeaconTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/BeaconTileEntity.cpp @@ -1,4 +1,4 @@ -#include "minecraft/locale/Strings.h" +#include "minecraft/IGameServices.h" #include "BeaconTileEntity.h" #include @@ -282,7 +282,7 @@ void BeaconTileEntity::setItem(unsigned int slot, } std::wstring BeaconTileEntity::getName() { - return hasCustomName() ? name : Strings::get(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 a42c37b54..7fbeaa2e3 100644 --- a/targets/minecraft/world/level/tile/entity/BrewingStandTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/BrewingStandTileEntity.cpp @@ -1,4 +1,4 @@ -#include "minecraft/locale/Strings.h" +#include "minecraft/IGameServices.h" #include "BrewingStandTileEntity.h" #include @@ -41,7 +41,7 @@ BrewingStandTileEntity::BrewingStandTileEntity() { BrewingStandTileEntity::~BrewingStandTileEntity() {} std::wstring BrewingStandTileEntity::getName() { - return hasCustomName() ? name : Strings::get(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 9ef3d2f27..4159c4131 100644 --- a/targets/minecraft/world/level/tile/entity/ChestTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/ChestTileEntity.cpp @@ -1,4 +1,4 @@ -#include "minecraft/locale/Strings.h" +#include "minecraft/IGameServices.h" #include "ChestTileEntity.h" #include @@ -110,7 +110,7 @@ void ChestTileEntity::setItem(unsigned int slot, } std::wstring ChestTileEntity::getName() { - return hasCustomName() ? name : Strings::get(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 bd6c4b004..447debca7 100644 --- a/targets/minecraft/world/level/tile/entity/DispenserTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/DispenserTileEntity.cpp @@ -1,4 +1,4 @@ -#include "minecraft/locale/Strings.h" +#include "minecraft/IGameServices.h" #include "DispenserTileEntity.h" #include @@ -125,7 +125,7 @@ int DispenserTileEntity::addItem(std::shared_ptr item) { } std::wstring DispenserTileEntity::getName() { - return hasCustomName() ? name : Strings::get(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 6522ce614..c673ce788 100644 --- a/targets/minecraft/world/level/tile/entity/DropperTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/DropperTileEntity.cpp @@ -1,4 +1,4 @@ -#include "minecraft/locale/Strings.h" +#include "minecraft/IGameServices.h" #include "DropperTileEntity.h" #include @@ -9,7 +9,7 @@ #include "strings.h" std::wstring DropperTileEntity::getName() { - return hasCustomName() ? name : Strings::get(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 0c6ede03c..fe25b339a 100644 --- a/targets/minecraft/world/level/tile/entity/EnchantmentTableTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/EnchantmentTableTileEntity.cpp @@ -1,4 +1,4 @@ -#include "minecraft/locale/Strings.h" +#include "minecraft/IGameServices.h" #include "EnchantmentTableTileEntity.h" #include @@ -94,7 +94,7 @@ void EnchantmentTableEntity::tick() { } std::wstring EnchantmentTableEntity::getName() { - return hasCustomName() ? name : Strings::get(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 feb650deb..ba010f8ed 100644 --- a/targets/minecraft/world/level/tile/entity/FurnaceTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/FurnaceTileEntity.cpp @@ -1,4 +1,4 @@ -#include "minecraft/locale/Strings.h" +#include "minecraft/IGameServices.h" #include "FurnaceTileEntity.h" #include @@ -98,7 +98,7 @@ void FurnaceTileEntity::setItem(unsigned int slot, } std::wstring FurnaceTileEntity::getName() { - return hasCustomName() ? name : Strings::get(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 d90aad5f0..c601889e8 100644 --- a/targets/minecraft/world/level/tile/entity/HopperTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/HopperTileEntity.cpp @@ -1,4 +1,4 @@ -#include "minecraft/locale/Strings.h" +#include "minecraft/IGameServices.h" #include "HopperTileEntity.h" #include @@ -110,7 +110,7 @@ void HopperTileEntity::setItem(unsigned int slot, } std::wstring HopperTileEntity::getName() { - return hasCustomName() ? name : Strings::get(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 6e6187df5..ce34769cc 100644 --- a/targets/minecraft/world/level/tile/entity/TheEndPortalTile.cpp +++ b/targets/minecraft/world/level/tile/entity/TheEndPortalTile.cpp @@ -2,7 +2,7 @@ #include -#include "minecraft/GameServices.h" +#include "minecraft/IGameServices.h" #include "TheEndPortalTileEntity.h" #include "java/Class.h" #include "java/Random.h" @@ -71,7 +71,7 @@ void TheEndPortal::entityInside(Level* level, int x, int y, int z, x = z = 0; if (level->dimension == 0 && !level->getLevelData()->getHasStrongholdEndPortal() && - GameServices::getTerrainFeaturePosition( + gameServices().getTerrainFeaturePosition( eTerrainFeature_StrongholdEndPortal, &x, &z)) { level->getLevelData()->setXStrongholdEndPortal(x); level->getLevelData()->setZStrongholdEndPortal(z);