From fac7d99e95fb1492d2ed2d949f95f4d7996071d9 Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Thu, 9 Apr 2026 10:17:55 +1000 Subject: [PATCH] style: clang-format the entire project --- targets/app/common/AppGameServices.cpp | 92 +- targets/app/common/AppGameServices.h | 22 +- targets/app/common/App_structs.h | 11 +- targets/app/common/ArchiveManager.cpp | 2 +- targets/app/common/Audio/SoundEngine.cpp | 54 +- targets/app/common/Audio/SoundEngine.h | 2 +- targets/app/common/Audio/SoundNames.cpp | 8 +- targets/app/common/BannedListManager.cpp | 11 +- targets/app/common/DLC/DLCColourTableFile.cpp | 2 +- targets/app/common/DLC/DLCFile.cpp | 2 +- targets/app/common/DLC/DLCManager.cpp | 29 +- targets/app/common/DLC/DLCManager.h | 75 +- targets/app/common/DLC/DLCPack.cpp | 6 +- targets/app/common/DLC/DLCPack.h | 2 +- targets/app/common/DLC/DLCSkinFile.cpp | 10 +- targets/app/common/DLC/DLCSkinFile.h | 2 +- targets/app/common/DLCController.cpp | 45 +- targets/app/common/DLCController.h | 7 +- targets/app/common/DebugOptions.cpp | 3 +- targets/app/common/Game.cpp | 152 +- targets/app/common/Game.h | 299 +- targets/app/common/GameMenuService.cpp | 65 +- targets/app/common/GameMenuService.h | 5 +- .../app/common/GameRules/ConsoleGameRules.h | 4 +- .../app/common/GameRules/GameRuleManager.cpp | 8 +- .../app/common/GameRules/GameRuleManager.h | 2 +- .../ApplySchematicRuleDefinition.cpp | 8 +- .../LevelGeneration/BiomeOverride.cpp | 4 +- .../ConsoleGenerateStructure.cpp | 10 +- .../LevelGeneration/ConsoleSchematicFile.cpp | 15 +- .../LevelGeneration/ConsoleSchematicFile.h | 1 - .../LevelGenerationOptions.cpp | 15 +- .../LevelGeneration/StartFeature.cpp | 4 +- .../XboxStructureActionGenerateBox.cpp | 6 +- .../XboxStructureActionGenerateBox.h | 2 +- .../XboxStructureActionPlaceBlock.cpp | 6 +- .../XboxStructureActionPlaceBlock.h | 2 +- .../XboxStructureActionPlaceContainer.cpp | 4 +- .../XboxStructureActionPlaceContainer.h | 2 +- .../XboxStructureActionPlaceSpawner.cpp | 7 +- .../XboxStructureActionPlaceSpawner.h | 2 +- .../AddEnchantmentRuleDefinition.cpp | 6 +- .../AddEnchantmentRuleDefinition.h | 2 +- .../RuleDefinitions/AddItemRuleDefinition.cpp | 6 +- .../RuleDefinitions/AddItemRuleDefinition.h | 2 +- .../CollectItemRuleDefinition.cpp | 13 +- .../CollectItemRuleDefinition.h | 2 +- .../CompleteAllRuleDefinition.cpp | 6 +- .../CompleteAllRuleDefinition.h | 4 +- .../CompoundGameRuleDefinition.cpp | 4 +- .../CompoundGameRuleDefinition.h | 2 +- .../RuleDefinitions/GameRuleDefinition.cpp | 17 +- .../RuleDefinitions/LevelRuleset.cpp | 2 +- .../NamedAreaRuleDefinition.cpp | 6 +- .../RuleDefinitions/NamedAreaRuleDefinition.h | 2 +- .../UpdatePlayerRuleDefinition.cpp | 6 +- .../UpdatePlayerRuleDefinition.h | 2 +- .../RuleDefinitions/UseTileRuleDefinition.cpp | 4 +- .../RuleDefinitions/UseTileRuleDefinition.h | 4 +- .../GameRules/LevelRules/Rules/GameRule.cpp | 7 +- targets/app/common/GameSettingsManager.h | 11 +- targets/app/common/Game_XuiActions.cpp | 26 +- targets/app/common/IPlatformGame.h | 3 +- .../Leaderboards/IPlatformLeaderboard.h | 3 +- .../Leaderboards/LeaderboardInterface.h | 11 +- .../Leaderboards/LeaderboardManager.cpp | 3 +- .../app/common/Localisation/StringTable.cpp | 2 +- targets/app/common/LocalizationManager.cpp | 21 +- targets/app/common/LocalizationManager.h | 4 +- targets/app/common/MenuController.cpp | 49 +- targets/app/common/MenuController.h | 18 +- .../app/common/Network/GameNetworkManager.cpp | 59 +- .../app/common/Network/GameNetworkManager.h | 14 +- targets/app/common/Network/IPlatformNetwork.h | 13 +- .../app/common/Network/NetworkPlayerQNet.cpp | 2 +- .../app/common/Network/NetworkPlayerQNet.h | 2 +- .../Network/PlatformNetworkManagerInterface.h | 10 +- .../Network/PlatformNetworkManagerStub.cpp | 51 +- .../Network/PlatformNetworkManagerStub.h | 16 +- targets/app/common/Network/Socket.cpp | 4 +- targets/app/common/Network/Socket.h | 4 +- targets/app/common/NetworkController.h | 14 +- targets/app/common/SaveManager.cpp | 5 +- targets/app/common/SkinManager.cpp | 24 +- targets/app/common/SkinManager.h | 6 +- targets/app/common/TerrainFeatureManager.h | 2 +- .../Constraints/ChangeStateConstraint.cpp | 2 +- .../Constraints/ChangeStateConstraint.h | 2 +- targets/app/common/Tutorial/FullTutorial.cpp | 12 +- targets/app/common/Tutorial/FullTutorial.h | 2 +- targets/app/common/Tutorial/Hints/AreaHint.h | 2 +- .../common/Tutorial/Hints/DiggerItemHint.cpp | 2 +- .../common/Tutorial/Hints/DiggerItemHint.h | 2 +- .../common/Tutorial/Hints/LookAtEntityHint.h | 4 +- .../common/Tutorial/Hints/LookAtTileHint.h | 4 +- .../app/common/Tutorial/Hints/TakeItemHint.h | 4 +- targets/app/common/Tutorial/Tasks/AreaTask.h | 2 +- .../app/common/Tutorial/Tasks/ChoiceTask.cpp | 6 +- .../app/common/Tutorial/Tasks/ChoiceTask.h | 2 +- .../common/Tutorial/Tasks/ControllerTask.cpp | 8 +- .../Tutorial/Tasks/FullTutorialActiveTask.h | 2 +- .../common/Tutorial/Tasks/HorseChoiceTask.cpp | 2 +- .../app/common/Tutorial/Tasks/InfoTask.cpp | 4 +- .../Tutorial/Tasks/ProcedureCompoundTask.h | 2 +- .../common/Tutorial/Tasks/ProgressFlagTask.h | 2 +- .../common/Tutorial/Tasks/RideEntityTask.cpp | 2 +- .../app/common/Tutorial/Tasks/StatTask.cpp | 6 +- .../common/Tutorial/Tasks/StateChangeTask.h | 2 +- targets/app/common/Tutorial/Tutorial.cpp | 50 +- targets/app/common/Tutorial/Tutorial.h | 7 +- .../common/UI/All Platforms/ArchiveFile.cpp | 14 +- .../common/UI/All Platforms/IUIController.h | 2 +- .../IUIScene_AbstractContainerMenu.cpp | 10 +- .../IUIScene_AbstractContainerMenu.h | 2 +- .../All Platforms/IUIScene_CommandBlockMenu.h | 2 - .../All Platforms/IUIScene_CraftingMenu.cpp | 2 +- .../UI/All Platforms/IUIScene_CraftingMenu.h | 3 +- .../UI/All Platforms/IUIScene_PauseMenu.h | 18 +- .../app/common/UI/All Platforms/UIStructs.h | 4 +- .../common/UI/Components/UIComponent_Chat.cpp | 2 +- .../common/UI/Components/UIComponent_Chat.h | 2 +- .../common/UI/Components/UIComponent_Logo.cpp | 2 +- .../Components/UIComponent_MenuBackground.cpp | 6 +- .../Components/UIComponent_MenuBackground.h | 2 +- .../UI/Components/UIComponent_Panorama.cpp | 2 +- .../UI/Components/UIComponent_Panorama.h | 2 +- .../Components/UIComponent_PressStartToPlay.h | 2 +- .../UI/Components/UIComponent_Tooltips.cpp | 6 +- .../UI/Components/UIComponent_Tooltips.h | 6 +- .../Components/UIComponent_TutorialPopup.cpp | 15 +- .../UI/Components/UIComponent_TutorialPopup.h | 5 +- .../app/common/UI/Components/UIScene_HUD.cpp | 13 +- .../app/common/UI/Components/UIScene_HUD.h | 2 +- .../app/common/UI/Controls/UIControl_Base.cpp | 3 +- .../UI/Controls/UIControl_DynamicLabel.cpp | 3 +- .../UI/Controls/UIControl_DynamicLabel.h | 2 +- .../UI/Controls/UIControl_EnchantmentBook.cpp | 2 +- .../Controls/UIControl_EnchantmentButton.cpp | 16 +- .../common/UI/Controls/UIControl_HTMLLabel.h | 2 +- .../UI/Controls/UIControl_LeaderboardList.cpp | 5 +- .../UI/Controls/UIControl_LeaderboardList.h | 11 +- .../UI/Controls/UIControl_MinecraftHorse.cpp | 4 +- .../UI/Controls/UIControl_MinecraftPlayer.cpp | 4 +- .../Controls/UIControl_PlayerSkinPreview.cpp | 5 +- .../common/UI/Controls/UIControl_Slider.cpp | 2 +- .../app/common/UI/Controls/UIControl_Slider.h | 2 +- .../UI/Controls/UIControl_TexturePackList.h | 2 +- .../Debug/UIScene_DebugCreateSchematic.cpp | 8 +- .../UI/Scenes/Debug/UIScene_DebugOptions.cpp | 2 +- .../UI/Scenes/Debug/UIScene_DebugOptions.h | 2 +- .../UI/Scenes/Debug/UIScene_DebugOverlay.cpp | 6 +- .../Scenes/Debug/UIScene_DebugSetCamera.cpp | 12 +- .../IUIScene_StartGame.cpp | 2 +- .../IUIScene_StartGame.h | 10 +- .../UIScene_CreateWorldMenu.cpp | 41 +- .../UIScene_CreateWorldMenu.h | 2 +- .../UIScene_DLCMainMenu.cpp | 6 +- .../UIScene_DLCMainMenu.h | 2 +- .../UIScene_DLCOffersMenu.cpp | 4 +- .../UIScene_DLCOffersMenu.h | 2 +- .../Frontend Menu screens/UIScene_EULA.cpp | 16 +- .../UIScene_JoinMenu.cpp | 4 +- .../Frontend Menu screens/UIScene_JoinMenu.h | 2 +- .../UIScene_LaunchMoreOptionsMenu.cpp | 14 +- .../UIScene_LeaderboardsMenu.cpp | 17 +- .../UIScene_LeaderboardsMenu.h | 4 +- .../UIScene_LoadMenu.cpp | 30 +- .../Frontend Menu screens/UIScene_LoadMenu.h | 12 +- .../UIScene_LoadOrJoinMenu.cpp | 76 +- .../UIScene_LoadOrJoinMenu.h | 28 +- .../UIScene_MainMenu.cpp | 88 +- .../Frontend Menu screens/UIScene_MainMenu.h | 2 +- .../UIScene_NewUpdateMessage.cpp | 4 +- .../UIScene_SaveMessage.cpp | 13 +- .../UIScene_TrialExitUpsell.cpp | 4 +- .../Help & Options/UIScene_ControlsMenu.cpp | 14 +- .../Scenes/Help & Options/UIScene_Credits.cpp | 22 +- .../UIScene_HelpAndOptionsMenu.cpp | 2 +- .../Help & Options/UIScene_HowToPlay.cpp | 4 +- .../Help & Options/UIScene_HowToPlayMenu.cpp | 4 +- .../Help & Options/UIScene_LanguageSelector.h | 4 +- .../UIScene_SettingsAudioMenu.cpp | 2 +- .../UIScene_SettingsControlMenu.cpp | 2 +- .../UIScene_SettingsGraphicsMenu.cpp | 4 +- .../Help & Options/UIScene_SettingsMenu.cpp | 2 +- .../Help & Options/UIScene_SettingsMenu.h | 6 +- .../UIScene_SettingsOptionsMenu.cpp | 9 +- .../Help & Options/UIScene_SettingsUIMenu.cpp | 4 +- .../Help & Options/UIScene_SkinSelectMenu.cpp | 20 +- .../Help & Options/UIScene_SkinSelectMenu.h | 7 +- .../UIScene_AbstractContainerMenu.cpp | 4 +- .../UIScene_AbstractContainerMenu.h | 2 +- .../Containers/UIScene_AnvilMenu.cpp | 12 +- .../Containers/UIScene_AnvilMenu.h | 2 +- .../Containers/UIScene_BrewingStandMenu.cpp | 2 +- .../Containers/UIScene_BrewingStandMenu.h | 2 +- .../Containers/UIScene_ContainerMenu.h | 2 +- .../Containers/UIScene_CreativeMenu.cpp | 2 +- .../Containers/UIScene_DispenserMenu.h | 2 +- .../Containers/UIScene_EnchantingMenu.cpp | 2 +- .../Containers/UIScene_EnchantingMenu.h | 2 +- .../Containers/UIScene_FurnaceMenu.cpp | 2 +- .../Containers/UIScene_FurnaceMenu.h | 2 +- .../Containers/UIScene_HopperMenu.h | 2 +- .../Containers/UIScene_InventoryMenu.cpp | 2 +- .../Containers/UIScene_TradingMenu.cpp | 4 +- .../UIScene_CraftingMenu.cpp | 2 +- .../UIScene_DeathMenu.cpp | 6 +- .../In-Game Menu Screens/UIScene_EndPoem.cpp | 8 +- .../UIScene_InGameHostOptionsMenu.cpp | 4 +- .../UIScene_InGameInfoMenu.cpp | 10 +- .../UIScene_InGameInfoMenu.h | 2 +- .../UIScene_InGamePlayerOptionsMenu.cpp | 4 +- .../UIScene_InGamePlayerOptionsMenu.h | 2 +- .../UIScene_InGameSaveManagementMenu.cpp | 8 +- .../UIScene_InGameSaveManagementMenu.h | 6 +- .../UIScene_PauseMenu.cpp | 4 +- .../In-Game Menu Screens/UIScene_PauseMenu.h | 2 +- .../UIScene_SignEntryMenu.cpp | 10 +- .../UIScene_TeleportMenu.cpp | 4 +- .../UI/Scenes/UIScene_ConnectingProgress.cpp | 4 +- .../UI/Scenes/UIScene_FullscreenProgress.cpp | 11 +- .../app/common/UI/Scenes/UIScene_Keyboard.cpp | 6 +- .../common/UI/Scenes/UIScene_MessageBox.cpp | 10 +- .../app/common/UI/Scenes/UIScene_MessageBox.h | 2 +- .../UI/Scenes/UIScene_QuadrantSignin.cpp | 21 +- targets/app/common/UI/UIBitmapFont.cpp | 4 +- targets/app/common/UI/UIController.cpp | 85 +- targets/app/common/UI/UIController.h | 31 +- targets/app/common/UI/UIGroup.cpp | 8 +- targets/app/common/UI/UIGroup.h | 4 +- targets/app/common/UI/UILayer.cpp | 5 +- targets/app/common/UI/UILayer.h | 5 +- targets/app/common/UI/UIScene.h | 8 +- targets/app/common/UI/UITTFFont.cpp | 2 +- targets/app/common/XboxStubs.cpp | 3 +- targets/app/linux/Iggy/include/iggy.h | 13 +- .../Leaderboards/LinuxLeaderboardManager.h | 2 +- targets/app/linux/LinuxGame.cpp | 27 +- targets/app/linux/Stubs/iggy_stubs.h | 9 +- .../app/windows/Iggy/gdraw/gdraw_d3d11.cpp | 4 +- targets/app/windows/Iggy/include/gdraw.h | 4 +- targets/app/windows/Iggy/include/iggy.h | 13 +- targets/app/windows/Iggy/include/rrCore.h | 3613 +++++++++-------- targets/app/windows/Windows64_App.cpp | 17 +- .../app/windows/Windows64_UIController.cpp | 3 +- targets/app/windows/WindowsGame.h | 1 - targets/app/windows/XML/ATGXmlParser.h | 4 +- targets/app/windows/XML/xmlFilesCallback.h | 13 +- .../app/windows/src/Windows64_Minecraft.cpp | 258 +- targets/java/include/java/ByteBuffer.h | 2 +- .../java/InputOutputStream/GZIPInputStream.h | 2 +- .../java/InputOutputStream/GZIPOutputStream.h | 2 +- targets/java/src/File.cpp | 8 +- .../ByteArrayInputStream.cpp | 6 +- .../src/InputOutputStream/FileInputStream.cpp | 6 +- .../InputOutputStream/FileOutputStream.cpp | 6 +- targets/minecraft/BuildVer.h | 6 +- targets/minecraft/Facing.cpp | 2 +- targets/minecraft/GameHostOptions.cpp | 86 +- targets/minecraft/IGameServices.cpp | 4 +- targets/minecraft/IGameServices.h | 72 +- targets/minecraft/SharedConstants.h | 3 +- targets/minecraft/XuiActionPayload.h | 8 +- targets/minecraft/client/BufferedImage.cpp | 28 +- targets/minecraft/client/Camera.cpp | 5 +- targets/minecraft/client/IMenuService.h | 9 +- targets/minecraft/client/Lighting.cpp | 6 +- targets/minecraft/client/MemoryTracker.cpp | 5 +- targets/minecraft/client/Minecraft.cpp | 35 +- targets/minecraft/client/Minecraft.h | 4 +- targets/minecraft/client/Options.cpp | 23 +- targets/minecraft/client/gui/Button.cpp | 4 +- targets/minecraft/client/gui/ChatScreen.cpp | 7 +- .../client/gui/CreateWorldScreen.cpp | 55 +- .../minecraft/client/gui/CreateWorldScreen.h | 2 +- targets/minecraft/client/gui/DeathScreen.cpp | 6 +- targets/minecraft/client/gui/EditBox.cpp | 2 +- targets/minecraft/client/gui/ErrorScreen.cpp | 3 +- targets/minecraft/client/gui/Font.cpp | 2 +- targets/minecraft/client/gui/Font.h | 3 +- targets/minecraft/client/gui/Gui.cpp | 86 +- targets/minecraft/client/gui/Gui.h | 2 +- targets/minecraft/client/gui/GuiComponent.cpp | 9 +- .../minecraft/client/gui/InBedChatScreen.cpp | 4 +- .../client/gui/JoinMultiplayerScreen.cpp | 12 +- targets/minecraft/client/gui/Minimap.cpp | 7 +- .../minecraft/client/gui/NameEntryScreen.cpp | 8 +- targets/minecraft/client/gui/PauseScreen.cpp | 18 +- .../client/gui/RenameWorldScreen.cpp | 4 +- targets/minecraft/client/gui/Screen.cpp | 19 +- .../client/gui/SelectWorldScreen.cpp | 7 +- targets/minecraft/client/gui/SlideButton.cpp | 4 +- .../client/gui/TradeSwitchButton.cpp | 3 +- .../gui/achievement/AchievementPopup.cpp | 10 +- .../gui/achievement/AchievementScreen.cpp | 6 +- .../gui/achievement/AchievementScreen.h | 1 - .../client/gui/achievement/StatsScreen.cpp | 4 +- .../gui/inventory/AbstractBeaconButton.cpp | 6 +- .../gui/inventory/AbstractContainerScreen.cpp | 9 +- .../gui/inventory/BeaconCancelButton.cpp | 4 +- .../gui/inventory/BeaconPowerButton.cpp | 4 +- .../client/gui/inventory/BeaconPowerButton.h | 1 - .../client/gui/inventory/BeaconScreen.cpp | 6 +- .../client/gui/inventory/BeaconScreen.h | 1 - .../gui/inventory/BrewingStandScreen.cpp | 9 +- .../client/gui/inventory/BrewingStandScreen.h | 1 - .../client/gui/inventory/ContainerScreen.cpp | 6 +- .../client/gui/inventory/CraftingScreen.cpp | 2 +- .../gui/inventory/CreativeInventoryScreen.cpp | 27 +- .../gui/inventory/EnchantmentScreen.cpp | 12 +- .../client/gui/inventory/FurnaceScreen.cpp | 8 +- .../client/gui/inventory/HopperScreen.cpp | 6 +- .../gui/inventory/HorseInventoryScreen.cpp | 3 +- .../gui/inventory/HorseInventoryScreen.h | 1 - .../client/gui/inventory/InventoryScreen.cpp | 4 +- .../client/gui/inventory/MerchantScreen.cpp | 5 +- .../client/gui/inventory/MerchantScreen.h | 1 - .../client/gui/inventory/RepairScreen.cpp | 9 +- .../client/gui/inventory/TextEditScreen.cpp | 4 +- .../client/gui/inventory/TrapScreen.cpp | 4 +- .../client/gui/particle/GuiParticle.cpp | 4 +- targets/minecraft/client/level/DemoLevel.h | 1 - targets/minecraft/client/model/BookModel.h | 2 +- targets/minecraft/client/model/ChestModel.cpp | 4 +- .../minecraft/client/model/ChickenModel.cpp | 4 +- targets/minecraft/client/model/GhastModel.cpp | 4 +- .../minecraft/client/model/HumanoidModel.cpp | 6 +- targets/minecraft/client/model/ModelHorse.cpp | 4 +- .../minecraft/client/model/OcelotModel.cpp | 4 +- targets/minecraft/client/model/OcelotModel.h | 2 +- .../minecraft/client/model/QuadrupedModel.cpp | 5 +- targets/minecraft/client/model/WolfModel.cpp | 4 +- .../client/model/dragon/DragonModel.cpp | 5 +- .../client/model/dragon/EnderCrystalModel.cpp | 5 +- targets/minecraft/client/model/geom/Model.h | 2 +- .../minecraft/client/model/geom/ModelPart.cpp | 6 +- .../minecraft/client/model/geom/ModelPart.h | 2 +- .../client/multiplayer/ClientConnection.cpp | 313 +- .../client/multiplayer/ClientConnection.h | 5 +- .../multiplayer/MultiPlayerChunkCache.cpp | 9 +- .../multiplayer/MultiPlayerChunkCache.h | 2 - .../multiplayer/MultiPlayerGameMode.cpp | 7 +- .../client/multiplayer/MultiPlayerLevel.cpp | 12 +- .../client/multiplayer/MultiPlayerLevel.h | 2 - .../multiplayer/MultiPlayerLocalPlayer.cpp | 25 +- .../client/particle/DragonBreathParticle.cpp | 4 +- .../client/particle/DripParticle.cpp | 4 +- .../particle/EnchantmentTableParticle.cpp | 4 +- .../client/particle/EnderParticle.cpp | 4 +- .../client/particle/ExplodeParticle.cpp | 4 +- .../client/particle/FootstepParticle.cpp | 6 +- .../client/particle/HugeExplosionParticle.cpp | 10 +- .../client/particle/NetherPortalParticle.cpp | 4 +- .../client/particle/NoteParticle.cpp | 2 +- .../minecraft/client/particle/Particle.cpp | 4 +- .../client/particle/ParticleEngine.cpp | 11 +- .../client/particle/SmokeParticle.cpp | 4 +- .../client/particle/SuspendedParticle.cpp | 4 +- .../client/particle/TakeAnimationParticle.cpp | 6 +- targets/minecraft/client/player/Input.cpp | 14 +- .../minecraft/client/player/LocalPlayer.cpp | 94 +- targets/minecraft/client/player/LocalPlayer.h | 1 - .../minecraft/client/player/RemotePlayer.cpp | 2 +- .../minecraft/client/player/RemotePlayer.h | 1 - targets/minecraft/client/renderer/Chunk.cpp | 7 +- .../client/renderer/GameRenderer.cpp | 76 +- .../minecraft/client/renderer/GameRenderer.h | 2 +- .../client/renderer/ItemInHandRenderer.cpp | 24 +- .../client/renderer/LevelRenderer.cpp | 64 +- .../minecraft/client/renderer/LevelRenderer.h | 8 +- .../client/renderer/OffsettedRenderList.cpp | 4 +- .../minecraft/client/renderer/Tesselator.cpp | 13 +- .../minecraft/client/renderer/Textures.cpp | 73 +- targets/minecraft/client/renderer/Textures.h | 1 - .../client/renderer/TileRenderer.cpp | 11 +- .../client/renderer/culling/Frustum.cpp | 5 +- .../client/renderer/entity/ArrowRenderer.cpp | 6 +- .../client/renderer/entity/BatRenderer.cpp | 5 +- .../client/renderer/entity/BoatRenderer.cpp | 4 +- .../renderer/entity/CaveSpiderRenderer.cpp | 4 +- .../renderer/entity/CreeperRenderer.cpp | 5 +- .../renderer/entity/DefaultRenderer.cpp | 2 +- .../renderer/entity/EnderCrystalRenderer.cpp | 4 +- .../renderer/entity/EnderDragonRenderer.cpp | 5 +- .../renderer/entity/EndermanRenderer.cpp | 6 +- .../entity/EntityRenderDispatcher.cpp | 7 +- .../client/renderer/entity/EntityRenderer.cpp | 11 +- .../renderer/entity/ExperienceOrbRenderer.cpp | 5 +- .../renderer/entity/FallingTileRenderer.cpp | 5 +- .../renderer/entity/FireballRenderer.cpp | 5 +- .../renderer/entity/FishingHookRenderer.cpp | 5 +- .../client/renderer/entity/GhastRenderer.cpp | 4 +- .../renderer/entity/GiantMobRenderer.cpp | 4 +- .../client/renderer/entity/HorseRenderer.cpp | 5 +- .../renderer/entity/HumanoidMobRenderer.cpp | 7 +- .../renderer/entity/ItemFrameRenderer.cpp | 4 +- .../client/renderer/entity/ItemRenderer.cpp | 7 +- .../renderer/entity/ItemSpriteRenderer.cpp | 5 +- .../renderer/entity/LavaSlimeRenderer.cpp | 4 +- .../renderer/entity/LeashKnotRenderer.cpp | 5 +- .../renderer/entity/LightningBoltRenderer.cpp | 5 +- .../renderer/entity/LivingEntityRenderer.cpp | 24 +- .../renderer/entity/MinecartRenderer.cpp | 4 +- .../client/renderer/entity/MobRenderer.cpp | 11 +- .../renderer/entity/MushroomCowRenderer.cpp | 6 +- .../client/renderer/entity/OcelotRenderer.cpp | 4 +- .../renderer/entity/PaintingRenderer.cpp | 6 +- .../client/renderer/entity/PlayerRenderer.cpp | 17 +- .../client/renderer/entity/PlayerRenderer.h | 4 +- .../client/renderer/entity/SheepRenderer.cpp | 4 +- .../renderer/entity/SkeletonRenderer.cpp | 4 +- .../client/renderer/entity/SlimeRenderer.cpp | 5 +- .../renderer/entity/SnowManRenderer.cpp | 4 +- .../client/renderer/entity/SpiderRenderer.cpp | 5 +- .../client/renderer/entity/SquidRenderer.cpp | 4 +- .../renderer/entity/TntMinecartRenderer.cpp | 5 +- .../client/renderer/entity/TntRenderer.cpp | 5 +- .../renderer/entity/VillagerGolemRenderer.cpp | 5 +- .../renderer/entity/VillagerRenderer.cpp | 4 +- .../client/renderer/entity/WitchRenderer.cpp | 4 +- .../renderer/entity/WitherBossRenderer.cpp | 5 +- .../renderer/entity/WitherSkullRenderer.cpp | 5 +- .../client/renderer/entity/WolfRenderer.cpp | 4 +- .../client/renderer/entity/ZombieRenderer.cpp | 2 +- .../texture/PreStitchedTextureMap.cpp | 9 +- .../client/renderer/texture/StitchSlot.cpp | 7 +- .../renderer/texture/StitchedTexture.cpp | 2 +- .../client/renderer/texture/Stitcher.cpp | 2 +- .../client/renderer/texture/Texture.cpp | 21 +- .../client/renderer/texture/Texture.h | 14 +- .../client/renderer/texture/TextureHolder.cpp | 4 +- .../renderer/texture/TextureManager.cpp | 4 +- .../client/renderer/texture/TextureMap.cpp | 8 +- .../renderer/texture/custom/ClockTexture.cpp | 2 +- .../texture/custom/CompassTexture.cpp | 2 +- .../renderer/tileentity/BeaconRenderer.cpp | 5 +- .../renderer/tileentity/ChestRenderer.cpp | 5 +- .../tileentity/EnchantTableRenderer.cpp | 5 +- .../tileentity/EnderChestRenderer.cpp | 5 +- .../tileentity/MobSpawnerRenderer.cpp | 4 +- .../tileentity/PistonPieceRenderer.cpp | 5 +- .../renderer/tileentity/SignRenderer.cpp | 20 +- .../renderer/tileentity/SkullTileRenderer.cpp | 9 +- .../tileentity/TheEndPortalRenderer.cpp | 5 +- .../tileentity/TileEntityRenderDispatcher.cpp | 5 +- .../client/resources/Colours/ColourTable.cpp | 7 +- .../client/skins/AbstractTexturePack.cpp | 24 +- .../client/skins/AbstractTexturePack.h | 6 +- .../minecraft/client/skins/DLCTexturePack.cpp | 40 +- .../minecraft/client/skins/DLCTexturePack.h | 12 +- .../client/skins/DefaultTexturePack.cpp | 3 +- .../client/skins/DefaultTexturePack.h | 4 +- .../client/skins/FolderTexturePack.cpp | 2 +- .../client/skins/FolderTexturePack.h | 2 +- .../minecraft/client/skins/TexturePack.cpp | 5 +- targets/minecraft/client/skins/TexturePack.h | 15 +- .../client/skins/TexturePackRepository.cpp | 35 +- .../minecraft/client/title/TitleScreen.cpp | 21 +- targets/minecraft/commands/AdminLogCommand.h | 11 +- targets/minecraft/commands/Command.h | 2 +- .../minecraft/commands/CommandDispatcher.cpp | 2 +- .../commands/common/EnchantItemCommand.cpp | 2 +- .../commands/common/GiveItemCommand.cpp | 2 +- .../core/DefaultDispenseItemBehavior.h | 4 +- .../minecraft/core/ItemDispenseBehaviors.cpp | 6 +- targets/minecraft/network/Connection.cpp | 10 +- targets/minecraft/network/Connection.h | 3 +- targets/minecraft/network/INetworkService.h | 5 +- .../network/packet/AddGlobalEntityPacket.cpp | 2 +- .../network/packet/AddPlayerPacket.h | 2 +- .../packet/BlockRegionUpdatePacket.cpp | 7 +- .../network/packet/CustomPayloadPacket.cpp | 2 +- .../network/packet/GameCommandPacket.cpp | 2 +- .../minecraft/network/packet/LoginPacket.cpp | 2 +- .../minecraft/network/packet/LoginPacket.h | 2 +- targets/minecraft/network/packet/Packet.cpp | 14 +- .../network/packet/PlayerInfoPacket.cpp | 2 +- .../network/packet/PreLoginPacket.cpp | 6 +- .../minecraft/network/packet/PreLoginPacket.h | 2 +- .../network/packet/RespawnPacket.cpp | 2 +- .../packet/ServerSettingsChangedPacket.cpp | 2 +- .../network/packet/SetPlayerTeamPacket.cpp | 2 +- .../packet/TextureAndGeometryChangePacket.cpp | 2 +- .../packet/TextureAndGeometryPacket.cpp | 4 +- .../network/packet/TextureAndGeometryPacket.h | 2 +- .../packet/UpdateGameRuleProgressPacket.h | 2 +- targets/minecraft/server/ConsoleInput.cpp | 3 +- targets/minecraft/server/MinecraftServer.cpp | 136 +- targets/minecraft/server/MinecraftServer.h | 7 +- targets/minecraft/server/PlayerList.cpp | 67 +- targets/minecraft/server/PlayerList.h | 2 +- targets/minecraft/server/ServerInterface.h | 2 +- targets/minecraft/server/Settings.cpp | 2 +- targets/minecraft/server/Settings.h | 2 +- .../server/commands/TeleportCommand.h | 2 +- .../minecraft/server/level/CreativeMode.cpp | 5 - targets/minecraft/server/level/DemoMode.cpp | 2 - .../minecraft/server/level/EntityTracker.cpp | 54 +- targets/minecraft/server/level/GameMode.cpp | 7 - .../minecraft/server/level/PlayerChunkMap.cpp | 6 +- .../server/level/ServerChunkCache.cpp | 19 +- .../minecraft/server/level/ServerChunkCache.h | 4 +- .../minecraft/server/level/ServerLevel.cpp | 75 +- targets/minecraft/server/level/ServerLevel.h | 3 +- .../server/level/ServerLevelListener.cpp | 2 +- .../minecraft/server/level/ServerPlayer.cpp | 43 +- targets/minecraft/server/level/ServerPlayer.h | 8 +- .../server/level/ServerPlayerGameMode.cpp | 4 +- .../minecraft/server/level/SurvivalMode.cpp | 4 - .../minecraft/server/level/TrackedEntity.cpp | 81 +- .../server/network/PendingConnection.cpp | 32 +- .../server/network/PlayerConnection.cpp | 104 +- .../server/network/PlayerConnection.h | 2 +- .../server/network/ServerConnection.cpp | 6 +- targets/minecraft/stats/Achievement.cpp | 9 +- targets/minecraft/stats/Achievements.cpp | 16 +- targets/minecraft/stats/CommonStats.h | 2 +- targets/minecraft/stats/GenericStats.h | 2 +- targets/minecraft/stats/NumberFormatters.h | 2 +- targets/minecraft/stats/Stat.h | 2 +- targets/minecraft/stats/Stats.cpp | 36 +- targets/minecraft/stats/StatsCounter.cpp | 16 +- targets/minecraft/util/HtmlString.h | 2 +- targets/minecraft/util/WeighedRandom.cpp | 2 +- targets/minecraft/world/CompoundContainer.cpp | 2 +- targets/minecraft/world/SimpleContainer.cpp | 2 +- .../world/damageSource/CombatEntry.cpp | 4 +- .../world/damageSource/CombatTracker.cpp | 21 +- .../world/damageSource/EntityDamageSource.cpp | 11 +- .../IndirectEntityDamageSource.cpp | 4 +- .../world/effect/AbsoptionMobEffect.h | 2 +- .../world/effect/AttackDamageMobEffect.h | 2 +- .../world/effect/HealthBoostMobEffect.h | 2 +- .../world/effect/InstantaneousMobEffect.h | 2 +- targets/minecraft/world/effect/MobEffect.cpp | 6 +- .../world/effect/MobEffectInstance.cpp | 6 +- targets/minecraft/world/entity/Entity.cpp | 17 +- targets/minecraft/world/entity/Entity.h | 4 +- targets/minecraft/world/entity/EntityIO.cpp | 11 +- targets/minecraft/world/entity/EntityIO.h | 9 +- .../minecraft/world/entity/EntitySelector.cpp | 6 +- .../minecraft/world/entity/HangingEntity.cpp | 15 +- targets/minecraft/world/entity/ItemFrame.cpp | 2 +- .../minecraft/world/entity/LivingEntity.cpp | 45 +- targets/minecraft/world/entity/Mob.cpp | 27 +- targets/minecraft/world/entity/Painting.cpp | 4 +- targets/minecraft/world/entity/Painting.h | 2 +- .../minecraft/world/entity/PathfinderMob.cpp | 3 +- .../world/entity/SyncedEntityData.cpp | 2 +- .../ai/attributes/AttributeModifier.cpp | 2 +- .../world/entity/ai/control/LookControl.cpp | 2 +- .../entity/ai/goal/ControlledByPlayerGoal.cpp | 4 +- .../world/entity/ai/goal/MeleeAttackGoal.cpp | 2 +- .../entity/ai/goal/RunAroundLikeCrazyGoal.cpp | 2 +- .../target/NearestAttackableTargetGoal.cpp | 2 +- .../entity/ai/goal/target/TargetGoal.cpp | 2 +- .../minecraft/world/entity/animal/Animal.cpp | 22 +- .../world/entity/animal/EntityHorse.cpp | 28 +- .../minecraft/world/entity/animal/Ocelot.cpp | 6 +- targets/minecraft/world/entity/animal/Pig.cpp | 4 +- .../world/entity/animal/VillagerGolem.cpp | 4 +- .../minecraft/world/entity/animal/Wolf.cpp | 18 +- .../entity/boss/enderdragon/EnderCrystal.cpp | 4 +- .../entity/boss/enderdragon/EnderDragon.cpp | 34 +- .../entity/boss/enderdragon/EnderDragon.h | 6 +- .../world/entity/boss/wither/WitherBoss.cpp | 28 +- .../world/entity/boss/wither/WitherBoss.h | 6 +- .../world/entity/global/GlobalEntity.h | 2 +- .../world/entity/global/LightningBolt.h | 1 - targets/minecraft/world/entity/item/Boat.cpp | 21 +- .../world/entity/item/ItemEntity.cpp | 2 +- .../minecraft/world/entity/item/Minecart.cpp | 30 +- .../world/entity/item/MinecartContainer.cpp | 2 +- .../world/entity/item/MinecartRideable.cpp | 4 +- .../world/entity/monster/CaveSpider.cpp | 2 +- .../world/entity/monster/Creeper.cpp | 11 +- .../world/entity/monster/EnderMan.cpp | 12 +- .../minecraft/world/entity/monster/Enemy.cpp | 2 +- .../minecraft/world/entity/monster/Ghast.cpp | 4 +- .../world/entity/monster/Monster.cpp | 6 +- .../world/entity/monster/PigZombie.cpp | 6 +- .../monster/SharedMonsterAttributes.cpp | 5 +- .../world/entity/monster/Silverfish.cpp | 2 +- .../world/entity/monster/Skeleton.cpp | 13 +- .../minecraft/world/entity/monster/Spider.cpp | 2 +- .../minecraft/world/entity/monster/Zombie.cpp | 9 +- .../world/entity/npc/ClientSideMerchant.h | 3 +- .../minecraft/world/entity/npc/Villager.cpp | 8 +- .../world/entity/player/Inventory.cpp | 15 +- .../minecraft/world/entity/player/Player.cpp | 92 +- .../minecraft/world/entity/player/Player.h | 8 +- .../world/entity/projectile/Arrow.cpp | 32 +- .../world/entity/projectile/Fireball.cpp | 4 +- .../world/entity/projectile/Snowball.cpp | 2 +- .../world/entity/projectile/Throwable.cpp | 4 +- .../entity/projectile/ThrownEnderpearl.cpp | 4 +- .../world/entity/projectile/WitherSkull.cpp | 2 +- .../minecraft/world/inventory/AnvilMenu.cpp | 26 +- targets/minecraft/world/item/ArmorItem.cpp | 10 +- targets/minecraft/world/item/BowItem.cpp | 2 +- targets/minecraft/world/item/BucketItem.cpp | 2 +- targets/minecraft/world/item/ClockItem.h | 2 +- targets/minecraft/world/item/CompassItem.h | 2 +- .../minecraft/world/item/DyePowderItem.cpp | 4 +- .../world/item/EnchantedBookItem.cpp | 6 +- targets/minecraft/world/item/EnderEyeItem.cpp | 2 +- .../world/item/FireworksChargeItem.cpp | 27 +- .../minecraft/world/item/FireworksItem.cpp | 8 +- .../world/item/HangingEntityItem.cpp | 2 +- targets/minecraft/world/item/Item.cpp | 5 +- targets/minecraft/world/item/ItemInstance.cpp | 6 +- targets/minecraft/world/item/MapItem.cpp | 8 +- targets/minecraft/world/item/NameTagItem.cpp | 2 +- .../minecraft/world/item/PlanterTileItem.cpp | 2 +- targets/minecraft/world/item/PotionItem.cpp | 45 +- targets/minecraft/world/item/SaddleItem.cpp | 2 +- targets/minecraft/world/item/SkullItem.cpp | 8 +- targets/minecraft/world/item/SpawnEggItem.cpp | 22 +- targets/minecraft/world/item/TileItem.cpp | 12 +- .../world/item/alchemy/PotionBrewing.cpp | 8 +- .../world/item/alchemy/PotionBrewing.h | 4 +- .../world/item/crafting/ArmorDyeRecipe.cpp | 2 +- .../world/item/crafting/ArmorRecipes.cpp | 12 +- .../world/item/crafting/ClothDyeRecipes.cpp | 3 +- .../minecraft/world/item/crafting/Recipes.cpp | 38 +- .../minecraft/world/item/crafting/Recipes.h | 2 +- .../minecraft/world/item/crafting/Recipy.h | 2 +- .../world/item/crafting/ShapedRecipy.cpp | 5 +- .../world/item/crafting/ShapelessRecipy.cpp | 2 +- .../world/item/crafting/StructureRecipes.cpp | 3 +- .../world/item/crafting/WeaponRecipes.cpp | 4 +- .../world/item/enchantment/Enchantment.cpp | 11 +- .../item/enchantment/EnchantmentHelper.cpp | 11 +- .../world/item/trading/MerchantRecipeList.cpp | 3 +- .../minecraft/world/level/BaseMobSpawner.cpp | 10 +- targets/minecraft/world/level/ChunkPos.cpp | 2 +- targets/minecraft/world/level/Coord.h | 2 +- targets/minecraft/world/level/Explosion.cpp | 8 +- .../minecraft/world/level/FoliageColor.cpp | 2 +- targets/minecraft/world/level/GameRules.cpp | 23 +- .../level/GameRules/GameRuleDefinition.h | 7 +- .../level/GameRules/LevelGenerationOptions.h | 5 +- targets/minecraft/world/level/Level.cpp | 39 +- targets/minecraft/world/level/Level.h | 8 +- .../minecraft/world/level/PortalForcer.cpp | 2 +- targets/minecraft/world/level/biome/Biome.cpp | 4 +- targets/minecraft/world/level/biome/Biome.h | 2 +- .../world/level/biome/BiomeCache.cpp | 2 +- .../world/level/biome/BiomeDecorator.cpp | 3 +- .../world/level/biome/BiomeSource.cpp | 12 +- .../minecraft/world/level/biome/BiomeSource.h | 1 - .../minecraft/world/level/biome/IceBiome.cpp | 2 +- .../level/chunk/CompressedTileStorage.cpp | 6 +- .../world/level/chunk/LevelChunk.cpp | 22 +- .../world/level/chunk/SparseDataStorage.cpp | 12 +- .../world/level/chunk/SparseLightStorage.cpp | 12 +- .../storage/ChunkStorageProfileDecorator.cpp | 2 +- .../chunk/storage/McRegionChunkStorage.cpp | 40 +- .../chunk/storage/McRegionChunkStorage.h | 2 +- .../chunk/storage/MemoryChunkStorage.cpp | 3 - .../world/level/chunk/storage/NbtSlotFile.cpp | 3 +- .../level/chunk/storage/OldChunkStorage.cpp | 24 +- .../world/level/chunk/storage/RegionFile.cpp | 4 +- .../world/level/chunk/storage/RegionFile.h | 2 +- .../level/chunk/storage/RegionFileCache.cpp | 10 +- .../level/chunk/storage/RegionFileCache.h | 9 +- .../world/level/chunk/storage/ZoneFile.cpp | 3 +- .../level/chunk/storage/ZonedChunkStorage.cpp | 17 +- .../world/level/dimension/Dimension.cpp | 10 +- .../world/level/dimension/HellDimension.cpp | 8 +- .../world/level/dimension/TheEndDimension.cpp | 2 +- .../world/level/levelgen/CanyonFeature.cpp | 8 +- .../level/levelgen/CustomLevelSource.cpp | 15 +- .../world/level/levelgen/FlatLevelSource.cpp | 2 +- .../level/levelgen/HellFlatLevelSource.cpp | 6 +- .../level/levelgen/HellRandomLevelSource.cpp | 2 +- .../level/levelgen/RandomLevelSource.cpp | 9 +- .../levelgen/TheEndLevelRandomLevelSource.cpp | 2 +- .../levelgen/feature/BasicTreeFeature.cpp | 6 +- .../level/levelgen/feature/BirchFeature.cpp | 6 +- .../level/levelgen/feature/CaveFeature.cpp | 6 +- .../world/level/levelgen/feature/Feature.h | 2 +- .../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/SpikeFeature.cpp | 2 +- .../level/levelgen/feature/SpringFeature.cpp | 4 +- .../level/levelgen/feature/SpruceFeature.cpp | 6 +- .../levelgen/feature/SwampTreeFeature.cpp | 6 +- .../level/levelgen/feature/TreeFeature.cpp | 6 +- .../level/levelgen/flat/FlatGeneratorInfo.cpp | 8 +- .../level/levelgen/structure/BoundingBox.cpp | 2 +- .../levelgen/structure/MineShaftFeature.cpp | 10 +- .../structure/NetherBridgeFeature.cpp | 7 +- .../structure/RandomScatteredLargeFeature.cpp | 7 +- .../structure/ScatteredFeaturePieces.cpp | 7 +- .../levelgen/structure/SkyIslandDimension.cpp | 5 - .../levelgen/structure/StrongholdFeature.cpp | 16 +- .../levelgen/structure/StrongholdPieces.cpp | 10 +- .../levelgen/structure/StructureFeatureIO.cpp | 7 +- .../structure/StructureFeatureSavedData.cpp | 4 +- .../levelgen/structure/VillageFeature.cpp | 11 +- .../newbiome/layer/BiomeOverrideLayer.cpp | 8 +- .../world/level/newbiome/layer/Layer.cpp | 4 +- .../minecraft/world/level/pathfinder/Node.cpp | 2 +- .../ConsoleSaveFileIO/ConsoleSaveFile.h | 2 +- .../ConsoleSaveFileConverter.cpp | 8 +- .../ConsoleSaveFileOriginal.cpp | 30 +- .../ConsoleSaveFileOriginal.h | 2 +- .../ConsoleSaveFileSplit.cpp | 48 +- .../ConsoleSaveFileIO/ConsoleSaveFileSplit.h | 2 +- .../storage/ConsoleSaveFileIO/FileHeader.cpp | 25 +- .../storage/ConsoleSaveFileIO/FileHeader.h | 11 +- .../storage/ConsoleSaveFileIO/compression.cpp | 24 +- .../world/level/storage/DerivedLevelData.cpp | 4 +- .../level/storage/DirectoryLevelStorage.cpp | 22 +- .../level/storage/DirectoryLevelStorage.h | 2 +- .../storage/DirectoryLevelStorageSource.cpp | 4 +- .../world/level/storage/LevelData.cpp | 13 +- .../world/level/storage/LevelStorage.h | 2 +- .../level/storage/McRegionLevelStorage.cpp | 4 +- .../level/storage/MemoryLevelStorage.cpp | 4 - .../world/level/storage/MemoryLevelStorage.h | 4 - .../storage/MemoryLevelStorageSource.cpp | 4 +- .../world/level/storage/SavedDataStorage.h | 2 +- .../minecraft/world/level/tile/CarrotTile.cpp | 2 +- .../world/level/tile/CauldronTile.cpp | 2 +- .../minecraft/world/level/tile/CocoaTile.cpp | 3 +- .../minecraft/world/level/tile/CropTile.cpp | 2 +- .../world/level/tile/DispenserTile.h | 1 - .../minecraft/world/level/tile/DoorTile.cpp | 4 +- .../world/level/tile/DropperTile.cpp | 3 +- .../minecraft/world/level/tile/FarmTile.cpp | 2 +- .../minecraft/world/level/tile/FireTile.cpp | 4 +- .../world/level/tile/FurnaceTile.cpp | 4 +- .../minecraft/world/level/tile/GrassTile.cpp | 4 +- .../world/level/tile/HugeMushroomTile.cpp | 3 +- .../minecraft/world/level/tile/LeafTile.cpp | 4 +- .../world/level/tile/NetherWartTile.cpp | 2 +- .../world/level/tile/NotGateTile.cpp | 12 +- .../world/level/tile/NoteBlockTile.cpp | 7 +- .../minecraft/world/level/tile/PotatoTile.cpp | 2 +- .../world/level/tile/PressurePlateTile.cpp | 2 +- .../world/level/tile/RedStoneDustTile.cpp | 4 +- .../world/level/tile/SmoothStoneBrickTile.cpp | 4 +- .../minecraft/world/level/tile/StemTile.cpp | 4 +- .../world/level/tile/StoneMonsterTile.cpp | 2 +- .../world/level/tile/TallGrassPlantTile.cpp | 6 +- targets/minecraft/world/level/tile/Tile.cpp | 8 +- .../minecraft/world/level/tile/TntTile.cpp | 8 +- .../minecraft/world/level/tile/TreeTile.cpp | 2 +- .../world/level/tile/WaterLilyTile.cpp | 6 +- .../minecraft/world/level/tile/WoodTile.cpp | 2 +- .../level/tile/entity/BeaconTileEntity.cpp | 5 +- .../tile/entity/BrewingStandTileEntity.cpp | 5 +- .../level/tile/entity/ChestTileEntity.cpp | 2 +- .../level/tile/entity/CommandBlockEntity.cpp | 4 +- .../level/tile/entity/DispenserTileEntity.cpp | 5 +- .../level/tile/entity/DropperTileEntity.cpp | 5 +- .../entity/EnchantmentTableTileEntity.cpp | 2 +- .../level/tile/entity/FurnaceTileEntity.cpp | 2 +- .../level/tile/entity/HopperTileEntity.cpp | 5 +- .../level/tile/entity/SignTileEntity.cpp | 6 +- .../level/tile/entity/TheEndPortalTile.cpp | 4 +- .../world/level/tile/entity/TileEntity.cpp | 4 +- targets/minecraft/world/scores/PlayerTeam.cpp | 3 +- targets/minecraft/world/scores/Team.h | 3 +- .../world/scores/criteria/ObjectiveCriteria.h | 3 +- targets/nbt/include/nbt/IntTag.h | 4 +- targets/platform/C4JThread.cpp | 3 +- targets/platform/PlatformTypes.h | 16 +- targets/platform/ShutdownManager.cpp | 1 + targets/platform/fs/IPlatformFilesystem.h | 6 +- targets/platform/fs/fs.h | 12 +- targets/platform/fs/std/StdFilesystem.cpp | 12 +- targets/platform/fs/std/StdFilesystem.h | 6 +- targets/platform/input/IPlatformInput.h | 7 +- targets/platform/input/input.h | 4 +- targets/platform/input/sdl2/SDL2Input.cpp | 4 +- targets/platform/profile/IPlatformProfile.h | 13 +- targets/platform/profile/ProfileConstants.h | 1 - targets/platform/profile/profile.h | 4 +- targets/platform/profile/stub/StubProfile.cpp | 10 +- targets/platform/profile/stub/StubProfile.h | 6 +- targets/platform/renderer/gl/GLRenderer.cpp | 60 +- targets/platform/renderer/gl/GLRenderer.h | 1 - targets/platform/renderer/gl/gl_compat.h | 131 +- targets/platform/renderer/gl/render_stubs.cpp | 4 +- targets/platform/renderer/renderer.h | 4 +- targets/platform/sound/IPlatformSound.h | 6 +- .../sound/miniaudio/MiniaudioSound.cpp | 20 +- targets/platform/storage/IPlatformStorage.h | 25 +- targets/platform/storage/storage.h | 4 +- targets/platform/storage/stub/StubStorage.cpp | 64 +- targets/platform/storage/stub/StubStorage.h | 13 +- targets/platform/stubs.h | 3 +- targets/util/StringHelpers.h | 4 +- targets/util/Timer.h | 24 +- 803 files changed, 6092 insertions(+), 6095 deletions(-) diff --git a/targets/app/common/AppGameServices.cpp b/targets/app/common/AppGameServices.cpp index b18b8e986..323996113 100644 --- a/targets/app/common/AppGameServices.cpp +++ b/targets/app/common/AppGameServices.cpp @@ -8,19 +8,13 @@ AppGameServices::AppGameServices(Game& game, IMenuService& menus) // -- Strings -- -const char* AppGameServices::getString(int id) { - return Game::GetString(id); -} +const char* AppGameServices::getString(int id) { return Game::GetString(id); } // -- Debug settings -- -bool AppGameServices::debugSettingsOn() { - return game_.DebugSettingsOn(); -} +bool AppGameServices::debugSettingsOn() { return game_.DebugSettingsOn(); } -bool AppGameServices::debugArtToolsOn() { - return game_.DebugArtToolsOn(); -} +bool AppGameServices::debugArtToolsOn() { return game_.DebugArtToolsOn(); } unsigned int AppGameServices::debugGetMask(int iPad, bool overridePlayer) { return game_.GetGameSettingsDebugMask(iPad, overridePlayer); @@ -34,9 +28,7 @@ bool AppGameServices::debugMobsDontTick() { return game_.GetMobsDontTickEnabled(); } -bool AppGameServices::debugFreezePlayers() { - return game_.GetFreezePlayers(); -} +bool AppGameServices::debugFreezePlayers() { return game_.GetFreezePlayers(); } // -- Game host options -- @@ -93,9 +85,7 @@ unsigned char AppGameServices::getGameSettings(int setting) { // -- App time -- -float AppGameServices::getAppTime() { - return game_.getAppTime(); -} +float AppGameServices::getAppTime() { return game_.getAppTime(); } // -- Game state -- @@ -104,10 +94,14 @@ 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(); } +int AppGameServices::getLocalPlayerCount() { + return game_.GetLocalPlayerCount(); +} bool AppGameServices::autosaveDue() { return game_.AutosaveDue(); } void AppGameServices::setAutosaveTimerTime() { game_.SetAutosaveTimerTime(); } -int64_t AppGameServices::secondsToAutosave() { return game_.SecondsToAutosave(); } +int64_t AppGameServices::secondsToAutosave() { + return game_.SecondsToAutosave(); +} void AppGameServices::setDisconnectReason( DisconnectPacket::eDisconnectReason reason) { @@ -115,9 +109,13 @@ void AppGameServices::setDisconnectReason( } void AppGameServices::lockSaveNotification() { game_.lockSaveNotification(); } -void AppGameServices::unlockSaveNotification() { game_.unlockSaveNotification(); } +void AppGameServices::unlockSaveNotification() { + game_.unlockSaveNotification(); +} bool AppGameServices::getResetNether() { return game_.GetResetNether(); } -bool AppGameServices::getUseDPadForDebug() { return game_.GetUseDPadForDebug(); } +bool AppGameServices::getUseDPadForDebug() { + return game_.GetUseDPadForDebug(); +} bool AppGameServices::getWriteSavesToFolderEnabled() { return game_.GetWriteSavesToFolderEnabled(); @@ -127,9 +125,7 @@ bool AppGameServices::isLocalMultiplayerAvailable() { return game_.IsLocalMultiplayerAvailable(); } -bool AppGameServices::dlcInstallPending() { - return game_.DLCInstallPending(); -} +bool AppGameServices::dlcInstallPending() { return game_.DLCInstallPending(); } bool AppGameServices::dlcInstallProcessCompleted() { return game_.DLCInstallProcessCompleted(); @@ -198,9 +194,7 @@ void AppGameServices::setGlobalXuiAction(eXuiAction action) { game_.SetGlobalXuiAction(action); } -void AppGameServices::handleButtonPresses() { - game_.HandleButtonPresses(); -} +void AppGameServices::handleButtonPresses() { game_.HandleButtonPresses(); } void AppGameServices::setTMSAction(int iPad, eTMSAction action) { game_.SetTMSAction(iPad, action); @@ -254,8 +248,7 @@ void AppGameServices::setAnimOverrideBitmask(std::uint32_t dwSkinID, game_.SetAnimOverrideBitmask(dwSkinID, bitmask); } -unsigned int AppGameServices::getAnimOverrideBitmask( - std::uint32_t dwSkinID) { +unsigned int AppGameServices::getAnimOverrideBitmask(std::uint32_t dwSkinID) { return game_.GetAnimOverrideBitmask(dwSkinID); } @@ -267,9 +260,7 @@ std::string AppGameServices::getSkinPathFromId(std::uint32_t skinId) { return Game::getSkinPathFromId(skinId); } -bool AppGameServices::defaultCapeExists() { - return game_.DefaultCapeExists(); -} +bool AppGameServices::defaultCapeExists() { return game_.DefaultCapeExists(); } bool AppGameServices::isXuidNotch(PlayerUID xuid) { return game_.isXuidNotch(xuid); @@ -305,8 +296,7 @@ void AppGameServices::updatePlayerInfo(std::uint8_t networkSmallId, game_.UpdatePlayerInfo(networkSmallId, playerColourIndex, playerPrivileges); } -unsigned int AppGameServices::getPlayerPrivileges( - std::uint8_t networkSmallId) { +unsigned int AppGameServices::getPlayerPrivileges(std::uint8_t networkSmallId) { return game_.GetPlayerPrivileges(networkSmallId); } @@ -334,9 +324,7 @@ bool AppGameServices::getTerrainFeaturePosition(_eTerrainFeatureType type, return game_.GetTerrainFeaturePosition(type, pX, pZ); } -void AppGameServices::loadDefaultGameRules() { - game_.loadDefaultGameRules(); -} +void AppGameServices::loadDefaultGameRules() { game_.loadDefaultGameRules(); } // -- Archive / resources -- @@ -363,24 +351,21 @@ const char* AppGameServices::getGameRulesString(const std::string& 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); +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::string AppGameServices::getFilePath(std::uint32_t packId, - std::string filename, - bool bAddDataFolder, - std::string mountPoint) { + std::string filename, + bool bAddDataFolder, + std::string mountPoint) { return game_.getFilePath(packId, filename, bAddDataFolder, mountPoint); } -char* AppGameServices::getUniqueMapName() { - return game_.GetUniqueMapName(); -} +char* AppGameServices::getUniqueMapName() { return game_.GetUniqueMapName(); } void AppGameServices::setUniqueMapName(char* name) { game_.SetUniqueMapName(name); @@ -390,9 +375,7 @@ unsigned int AppGameServices::getOpacityTimer(int iPad) { return game_.GetOpacityTimer(iPad); } -void AppGameServices::setOpacityTimer(int iPad) { - game_.SetOpacityTimer(iPad); -} +void AppGameServices::setOpacityTimer(int iPad) { game_.SetOpacityTimer(iPad); } void AppGameServices::tickOpacityTimer(int iPad) { game_.TickOpacityTimer(iPad); @@ -423,8 +406,8 @@ unsigned int AppGameServices::dlcCheckForCorrupt(bool showMessage) { return game_.m_dlcManager.checkForCorruptDLCAndAlert(showMessage); } bool AppGameServices::dlcReadDataFile(unsigned int& filesProcessed, - const std::string& path, - DLCPack* pack, bool fromArchive) { + const std::string& path, DLCPack* pack, + bool fromArchive) { return game_.m_dlcManager.readDLCDataFile(filesProcessed, path, pack, fromArchive); } @@ -435,7 +418,7 @@ void AppGameServices::dlcRemovePack(DLCPack* pack) { // -- Game rules -- LevelGenerationOptions* AppGameServices::loadGameRules(std::uint8_t* data, - unsigned int size) { + unsigned int size) { return game_.m_gameRules.loadGameRules(data, size); } void AppGameServices::saveGameRules(std::uint8_t** data, unsigned int* size) { @@ -444,7 +427,8 @@ void AppGameServices::saveGameRules(std::uint8_t** data, unsigned int* size) { void AppGameServices::unloadCurrentGameRules() { game_.m_gameRules.unloadCurrentGameRules(); } -void AppGameServices::setLevelGenerationOptions(LevelGenerationOptions* levelGen) { +void AppGameServices::setLevelGenerationOptions( + LevelGenerationOptions* levelGen) { game_.m_gameRules.setLevelGenerationOptions(levelGen); } diff --git a/targets/app/common/AppGameServices.h b/targets/app/common/AppGameServices.h index dfa10d396..4cc9b43a1 100644 --- a/targets/app/common/AppGameServices.h +++ b/targets/app/common/AppGameServices.h @@ -22,8 +22,7 @@ public: // -- Game host options -- unsigned int getGameHostOption(eGameHostOption option) override; - void setGameHostOption(eGameHostOption option, - unsigned int value) override; + void setGameHostOption(eGameHostOption option, unsigned int value) override; // -- Level generation -- LevelGenerationOptions* getLevelGenerationOptions() override; @@ -113,8 +112,7 @@ public: 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 readBannedList(int iPad, eTMSAction action, bool bCallback) override; void updatePlayerInfo(std::uint8_t networkSmallId, int16_t playerColourIndex, unsigned int playerPrivileges) override; @@ -139,13 +137,12 @@ public: int getHTMLColour(eMinecraftColour colour) override; std::string getEntityName(EntityTypeId type) override; const char* getGameRulesString(const std::string& key) override; - unsigned int createImageTextData(std::uint8_t* textMetadata, - int64_t seed, bool hasSeed, - unsigned int uiHostOptions, + unsigned int createImageTextData(std::uint8_t* textMetadata, int64_t seed, + bool hasSeed, unsigned int uiHostOptions, unsigned int uiTexturePackId) override; std::string getFilePath(std::uint32_t packId, std::string filename, - bool bAddDataFolder, - std::string mountPoint) override; + bool bAddDataFolder, + std::string mountPoint) override; char* getUniqueMapName() override; void setUniqueMapName(char* name) override; unsigned int getOpacityTimer(int iPad) override; @@ -160,14 +157,13 @@ public: DLCSkinFile* getDLCSkinFile(const std::string& name) override; bool dlcNeedsCorruptCheck() override; unsigned int dlcCheckForCorrupt(bool showMessage) override; - bool dlcReadDataFile(unsigned int& filesProcessed, - const std::string& path, DLCPack* pack, - bool fromArchive) override; + bool dlcReadDataFile(unsigned int& filesProcessed, const std::string& path, + DLCPack* pack, bool fromArchive) override; void dlcRemovePack(DLCPack* pack) override; // -- Game rules -- LevelGenerationOptions* loadGameRules(std::uint8_t* data, - unsigned int size) override; + unsigned int size) override; void saveGameRules(std::uint8_t** data, unsigned int* size) override; void unloadCurrentGameRules() override; void setLevelGenerationOptions(LevelGenerationOptions* levelGen) override; diff --git a/targets/app/common/App_structs.h b/targets/app/common/App_structs.h index 537048244..92eebb5f2 100644 --- a/targets/app/common/App_structs.h +++ b/targets/app/common/App_structs.h @@ -2,16 +2,15 @@ #include -#include "platform/storage/storage.h" -#include "minecraft/GameTypes.h" -#include "platform/profile/ProfileConstants.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/GameEnums.h" +#include "minecraft/GameTypes.h" #include "minecraft/client/model/SkinBox.h" +#include "platform/NetTypes.h" #include "platform/XboxStubs.h" +#include "platform/profile/ProfileConstants.h" +#include "platform/storage/storage.h" typedef struct { char* wchFilename; diff --git a/targets/app/common/ArchiveManager.cpp b/targets/app/common/ArchiveManager.cpp index 6ad335052..51dd2b9d3 100644 --- a/targets/app/common/ArchiveManager.cpp +++ b/targets/app/common/ArchiveManager.cpp @@ -9,8 +9,8 @@ #include "minecraft/client/Minecraft.h" #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" -#include "platform/fs/fs.h" #include "platform/PlatformTypes.h" +#include "platform/fs/fs.h" ArchiveManager::ArchiveManager() : m_mediaArchive(nullptr), m_dwRequiredTexturePackID(0) {} diff --git a/targets/app/common/Audio/SoundEngine.cpp b/targets/app/common/Audio/SoundEngine.cpp index 543d15ee6..76abaccbe 100644 --- a/targets/app/common/Audio/SoundEngine.cpp +++ b/targets/app/common/Audio/SoundEngine.cpp @@ -10,13 +10,9 @@ #include #include -#include "platform/PlatformTypes.h" -#include "platform/PlatformTypes.h" #include "app/common/Audio/Consoles_SoundEngine.h" #include "app/linux/Iggy/include/rrCore.h" #include "app/linux/LinuxGame.h" -#include "platform/C4JThread.h" -#include "platform/fs/fs.h" #include "java/Random.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" @@ -24,6 +20,9 @@ #include "minecraft/util/Mth.h" #include "minecraft/world/entity/Mob.h" #include "minecraft/world/level/storage/LevelData.h" +#include "platform/C4JThread.h" +#include "platform/PlatformTypes.h" +#include "platform/fs/fs.h" #if defined(__linux__) #define STB_VORBIS_HEADER_ONLY @@ -132,7 +131,8 @@ struct MiniAudioSound { bool active; }; -SoundEngine::SoundEngine() : m_audio(std::make_unique()) {} +SoundEngine::SoundEngine() + : m_audio(std::make_unique()) {} SoundEngine::~SoundEngine() = default; std::vector m_activeSounds; void SoundEngine::init(Options* pOptions) { @@ -167,7 +167,8 @@ void SoundEngine::init(Options* pOptions) { m_audio->engineConfig = ma_engine_config_init(); m_audio->engineConfig.listenerCount = MAX_LOCAL_PLAYERS; - if (ma_engine_init(&m_audio->engineConfig, &m_audio->engine) != MA_SUCCESS) { + if (ma_engine_init(&m_audio->engineConfig, &m_audio->engine) != + MA_SUCCESS) { app.DebugPrintf("Failed to initialize miniaudio engine\n"); return; } @@ -192,9 +193,8 @@ void SoundEngine::play(int iSound, float x, float y, float z, float volume, if (szId[i] == '.') szId[i] = '/'; std::string base = PlatformFilesystem.getBasePath().string() + "/"; - const char* roots[] = { - "Sound/Minecraft/", "app/common/Sound/Minecraft/", - "app/common/res/TitleUpdate/res/Sound/Minecraft/"}; + const char* roots[] = {"Sound/Minecraft/", "app/common/Sound/Minecraft/", + "app/common/res/TitleUpdate/res/Sound/Minecraft/"}; char finalPath[512] = {0}; bool found = false; @@ -237,8 +237,9 @@ void SoundEngine::play(int iSound, float x, float y, float z, float volume, s->info.pitch = pitch; s->info.bIs3D = true; - if (ma_sound_init_from_file(&m_audio->engine, finalPath, MA_SOUND_FLAG_ASYNC, - nullptr, nullptr, &s->sound) == MA_SUCCESS) { + if (ma_sound_init_from_file(&m_audio->engine, finalPath, + MA_SOUND_FLAG_ASYNC, nullptr, nullptr, + &s->sound) == MA_SUCCESS) { ma_sound_set_spatialization_enabled(&s->sound, MA_TRUE); ma_sound_set_min_distance(&s->sound, 2.0f); ma_sound_set_max_distance(&s->sound, 48.0f); @@ -289,8 +290,9 @@ void SoundEngine::playUI(int iSound, float volume, float pitch) { s->info.pitch = pitch; s->info.bIs3D = false; - if (ma_sound_init_from_file(&m_audio->engine, finalPath, MA_SOUND_FLAG_ASYNC, - nullptr, nullptr, &s->sound) == MA_SUCCESS) { + if (ma_sound_init_from_file(&m_audio->engine, finalPath, + MA_SOUND_FLAG_ASYNC, nullptr, nullptr, + &s->sound) == MA_SUCCESS) { ma_sound_set_spatialization_enabled(&s->sound, MA_FALSE); ma_sound_set_volume(&s->sound, volume * m_MasterEffectsVolume); ma_sound_set_pitch(&s->sound, pitch); @@ -432,7 +434,8 @@ int SoundEngine::OpenStreamThreadProc(void* lpParameter) { ma_result result = ma_sound_init_from_file( &soundEngine->m_audio->engine, soundEngine->m_szStreamName, - MA_SOUND_FLAG_STREAM, nullptr, nullptr, &soundEngine->m_audio->musicStream); + MA_SOUND_FLAG_STREAM, nullptr, nullptr, + &soundEngine->m_audio->musicStream); if (result != MA_SUCCESS) { app.DebugPrintf( @@ -442,7 +445,8 @@ int SoundEngine::OpenStreamThreadProc(void* lpParameter) { return 0; } - ma_sound_set_spatialization_enabled(&soundEngine->m_audio->musicStream, MA_FALSE); + ma_sound_set_spatialization_enabled(&soundEngine->m_audio->musicStream, + MA_FALSE); ma_sound_set_looping(&soundEngine->m_audio->musicStream, MA_FALSE); soundEngine->m_musicStreamActive = true; @@ -460,27 +464,29 @@ void SoundEngine::playMusicTick() { return; } if (m_musicID != -1) { - std::string base = PlatformFilesystem.getBasePath().string() + "/"; + std::string base = + PlatformFilesystem.getBasePath().string() + "/"; bool isCD = (m_musicID >= m_iStream_CD_1); const char* folder = isCD ? "cds/" : "music/"; const char* track = m_szStreamFileA[m_musicID]; bool found = false; m_szStreamName[0] = '\0'; - const char* roots[] = {"app/common/music/", - "music/", "./"}; + const char* roots[] = {"app/common/music/", "music/", "./"}; for (const char* r : roots) { for (const char* e : {".ogg", ".mp3", ".wav"}) { // try with folder prefix (music/ or cds/) - snprintf(m_szStreamName, sizeof(m_szStreamName), "%s%s%s%s%s", base.c_str(), r, folder, - track, e); + snprintf(m_szStreamName, sizeof(m_szStreamName), + "%s%s%s%s%s", base.c_str(), r, folder, track, + e); if (PlatformFilesystem.exists(m_szStreamName)) { found = true; break; } // try without folder prefix - snprintf(m_szStreamName, sizeof(m_szStreamName), "%s%s%s%s", base.c_str(), r, track, e); + snprintf(m_szStreamName, sizeof(m_szStreamName), + "%s%s%s%s", base.c_str(), r, track, e); if (PlatformFilesystem.exists(m_szStreamName)) { found = true; break; @@ -526,7 +532,8 @@ void SoundEngine::playMusicTick() { m_StreamingAudioInfo.y, m_StreamingAudioInfo.z); } - ma_sound_set_pitch(&m_audio->musicStream, m_StreamingAudioInfo.pitch); + ma_sound_set_pitch(&m_audio->musicStream, + m_StreamingAudioInfo.pitch); ma_sound_set_volume( &m_audio->musicStream, m_StreamingAudioInfo.volume * getMasterMusicVolume()); @@ -683,7 +690,8 @@ void SoundEngine::updateMiniAudio() { m_ListenerA[i].vOrientFront.y, m_ListenerA[i].vOrientFront.z); - ma_engine_listener_set_world_up(&m_audio->engine, 0, 0.0f, 1.0f, 0.0f); + ma_engine_listener_set_world_up(&m_audio->engine, 0, 0.0f, 1.0f, + 0.0f); break; } diff --git a/targets/app/common/Audio/SoundEngine.h b/targets/app/common/Audio/SoundEngine.h index d769d859e..f4e604b39 100644 --- a/targets/app/common/Audio/SoundEngine.h +++ b/targets/app/common/Audio/SoundEngine.h @@ -7,10 +7,10 @@ class Random; #include #include -#include "platform/PlatformTypes.h" #include "app/common/Audio/Consoles_SoundEngine.h" #include "app/linux/Iggy/include/rrCore.h" #include "minecraft/sounds/SoundTypes.h" +#include "platform/PlatformTypes.h" // Forward-declare the miniaudio backing state. The full struct lives in // SoundEngine.cpp where miniaudio.h is actually included. This keeps diff --git a/targets/app/common/Audio/SoundNames.cpp b/targets/app/common/Audio/SoundNames.cpp index 5b4bbe127..dd44c7f52 100644 --- a/targets/app/common/Audio/SoundNames.cpp +++ b/targets/app/common/Audio/SoundNames.cpp @@ -58,7 +58,7 @@ const char* ConsoleSoundEngine::wchSoundNames[eSoundType_MAX] = { "mob/cat/meow", // eSoundType_MOB_CAT_MEOW // 4J-PB - correct the name of the event for hitting ocelots "mob/cat/hitt", // eSoundType_MOB_CAT_HITT - // "mob.irongolem.throw", // + // "mob.irongolem.throw", // // eSoundType_MOB_IRONGOLEM_THROW "mob.irongolem.hit", //// eSoundType_MOB_IRONGOLEM_HIT "mob.irongolem.death", //// eSoundType_MOB_IRONGOLEM_DEATH "mob.irongolem.walk", @@ -205,11 +205,11 @@ const char* ConsoleSoundEngine::wchSoundNames[eSoundType_MAX] = { "mob/horse/jump", // eSoundType_MOB_HORSE_JUMP, "mob/witch/idle", // eSoundType_MOB_WITCH_IDLE, <--- - // missing + // missing "mob/witch/hurt", // eSoundType_MOB_WITCH_HURT, <--- - // missing + // missing "mob/witch/death", // eSoundType_MOB_WITCH_DEATH, <--- - // missing + // missing "mob/slime/big", // eSoundType_MOB_SLIME_BIG, "mob/slime/small", // eSoundType_MOB_SLIME_SMALL, diff --git a/targets/app/common/BannedListManager.cpp b/targets/app/common/BannedListManager.cpp index fecd02beb..838530ad6 100644 --- a/targets/app/common/BannedListManager.cpp +++ b/targets/app/common/BannedListManager.cpp @@ -29,8 +29,8 @@ void BannedListManager::invalidate(int iPad) { } } -void BannedListManager::addLevel(int iPad, PlayerUID xuid, - char* pszLevelName, bool bWriteToTMS) { +void BannedListManager::addLevel(int iPad, PlayerUID xuid, char* pszLevelName, + bool bWriteToTMS) { // we will have retrieved the banned level list from TMS, so add this one to // it and write it back to TMS @@ -64,8 +64,7 @@ void BannedListManager::addLevel(int iPad, PlayerUID xuid, // update telemetry too } -bool BannedListManager::isInList(int iPad, PlayerUID xuid, - char* pszLevelName) { +bool BannedListManager::isInList(int iPad, PlayerUID xuid, char* pszLevelName) { for (auto it = m_vBannedListA[iPad]->begin(); it != m_vBannedListA[iPad]->end(); ++it) { PBANNEDLISTDATA pData = *it; @@ -126,6 +125,4 @@ void BannedListManager::setUniqueMapName(char* pszUniqueMapName) { memcpy(m_pszUniqueMapName, pszUniqueMapName, 14); } -char* BannedListManager::getUniqueMapName() { - return m_pszUniqueMapName; -} +char* BannedListManager::getUniqueMapName() { return m_pszUniqueMapName; } diff --git a/targets/app/common/DLC/DLCColourTableFile.cpp b/targets/app/common/DLC/DLCColourTableFile.cpp index 479ec07d8..8cf7ed6b3 100644 --- a/targets/app/common/DLC/DLCColourTableFile.cpp +++ b/targets/app/common/DLC/DLCColourTableFile.cpp @@ -1,10 +1,10 @@ #include "DLCColourTableFile.h" #include "DLCManager.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "app/common/DLC/DLCFile.h" #include "app/linux/LinuxGame.h" #include "minecraft/client/Minecraft.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" diff --git a/targets/app/common/DLC/DLCFile.cpp b/targets/app/common/DLC/DLCFile.cpp index ecb33974a..33e712c9c 100644 --- a/targets/app/common/DLC/DLCFile.cpp +++ b/targets/app/common/DLC/DLCFile.cpp @@ -2,8 +2,8 @@ #include -#include "minecraft/Minecraft_Macros.h" #include "app/common/DLC/DLCManager.h" +#include "minecraft/Minecraft_Macros.h" DLCFile::DLCFile(DLCManager::EDLCType type, const std::string& path) { m_type = type; diff --git a/targets/app/common/DLC/DLCManager.cpp b/targets/app/common/DLC/DLCManager.cpp index bbf34088e..f729b54e6 100644 --- a/targets/app/common/DLC/DLCManager.cpp +++ b/targets/app/common/DLC/DLCManager.cpp @@ -13,20 +13,19 @@ #include #include -#include "simdutf.h" - -#include "platform/profile/profile.h" -#include "platform/storage/storage.h" #include "DLCFile.h" #include "DLCPack.h" #include "app/common/GameRules/GameRuleManager.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "platform/fs/fs.h" -#include "util/StringHelpers.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/skins/TexturePackRepository.h" +#include "platform/fs/fs.h" +#include "platform/profile/profile.h" +#include "platform/storage/storage.h" +#include "simdutf.h" #include "strings.h" +#include "util/StringHelpers.h" // 4jcraft, this is the size of wchar_t on disk // the DLC was created on windows, with wchar_t beeing 2 bytes and UTF-16 @@ -71,7 +70,8 @@ std::string getMountedDlcReadPath(const std::string& path) { std::string readPath = path; #if defined(_WINDOWS64) - const std::string mountedPath = PlatformStorage.GetMountedPath(path.c_str()); + const std::string mountedPath = + PlatformStorage.GetMountedPath(path.c_str()); if (!mountedPath.empty()) { readPath = mountedPath; } @@ -240,7 +240,7 @@ unsigned int DLCManager::getPackIndex(DLCPack* pack, bool& found, if (pack == nullptr) { app.DebugPrintf( "DLCManager: Attempting to find the index for a nullptr pack\n"); - //assert(0); + // assert(0); return foundIndex; } if (type != e_DLCType_All) { @@ -401,10 +401,12 @@ bool DLCManager::processDLCDataFile(unsigned int& dwFilesProcessed, // for details, read in the function below #define DLC_PARAM_WSTR(buf, off) \ - DLC_WSTRING((buf) + (off) + offsetof(IPlatformStorage::DLC_FILE_PARAM, wchData)) + DLC_WSTRING((buf) + (off) + \ + offsetof(IPlatformStorage::DLC_FILE_PARAM, wchData)) #define DLC_DETAIL_WSTR(buf, off) \ - DLC_WSTRING((buf) + (off) + offsetof(IPlatformStorage::DLC_FILE_DETAILS, wchFile)) + DLC_WSTRING((buf) + (off) + \ + offsetof(IPlatformStorage::DLC_FILE_DETAILS, wchFile)) { std::unordered_map parameterMapping; unsigned int uiCurrentByte = 0; @@ -462,7 +464,8 @@ bool DLCManager::processDLCDataFile(unsigned int& dwFilesProcessed, uiCurrentByte += DLC_PARAM_ADV(parBuf.dwWchCount); DLC_READ_PARAM(&parBuf, pbData, uiCurrentByte); } - // ulCurrentByte+=ulParameterCount * sizeof(IPlatformStorage::DLC_FILE_PARAM); + // ulCurrentByte+=ulParameterCount * + // sizeof(IPlatformStorage::DLC_FILE_PARAM); unsigned int uiFileCount; DLC_READ_UINT(&uiFileCount, pbData, uiCurrentByte); @@ -477,7 +480,9 @@ bool DLCManager::processDLCDataFile(unsigned int& dwFilesProcessed, DLC_READ_DETAIL(&fileBuf, pbData, dwTemp); } std::uint8_t* pbTemp = - &pbData[dwTemp]; //+ sizeof(IPlatformStorage::DLC_FILE_DETAILS)*ulFileCount; + &pbData + [dwTemp]; //+ + //sizeof(IPlatformStorage::DLC_FILE_DETAILS)*ulFileCount; DLC_READ_DETAIL(&fileBuf, pbData, uiCurrentByte); for (unsigned int i = 0; i < uiFileCount; i++) { diff --git a/targets/app/common/DLC/DLCManager.h b/targets/app/common/DLC/DLCManager.h index 0adc2a57d..9f3ef0662 100644 --- a/targets/app/common/DLC/DLCManager.h +++ b/targets/app/common/DLC/DLCManager.h @@ -21,33 +21,58 @@ public: static constexpr EDLCType e_DLCType_Skin = ::minecraft::dlc::e_DLCType_Skin; static constexpr EDLCType e_DLCType_Cape = ::minecraft::dlc::e_DLCType_Cape; - static constexpr EDLCType e_DLCType_Texture = ::minecraft::dlc::e_DLCType_Texture; - static constexpr EDLCType e_DLCType_UIData = ::minecraft::dlc::e_DLCType_UIData; - static constexpr EDLCType e_DLCType_PackConfig = ::minecraft::dlc::e_DLCType_PackConfig; - static constexpr EDLCType e_DLCType_TexturePack = ::minecraft::dlc::e_DLCType_TexturePack; - static constexpr EDLCType e_DLCType_LocalisationData = ::minecraft::dlc::e_DLCType_LocalisationData; - static constexpr EDLCType e_DLCType_GameRules = ::minecraft::dlc::e_DLCType_GameRules; - static constexpr EDLCType e_DLCType_Audio = ::minecraft::dlc::e_DLCType_Audio; - static constexpr EDLCType e_DLCType_ColourTable = ::minecraft::dlc::e_DLCType_ColourTable; - static constexpr EDLCType e_DLCType_GameRulesHeader = ::minecraft::dlc::e_DLCType_GameRulesHeader; + static constexpr EDLCType e_DLCType_Texture = + ::minecraft::dlc::e_DLCType_Texture; + static constexpr EDLCType e_DLCType_UIData = + ::minecraft::dlc::e_DLCType_UIData; + static constexpr EDLCType e_DLCType_PackConfig = + ::minecraft::dlc::e_DLCType_PackConfig; + static constexpr EDLCType e_DLCType_TexturePack = + ::minecraft::dlc::e_DLCType_TexturePack; + static constexpr EDLCType e_DLCType_LocalisationData = + ::minecraft::dlc::e_DLCType_LocalisationData; + static constexpr EDLCType e_DLCType_GameRules = + ::minecraft::dlc::e_DLCType_GameRules; + static constexpr EDLCType e_DLCType_Audio = + ::minecraft::dlc::e_DLCType_Audio; + static constexpr EDLCType e_DLCType_ColourTable = + ::minecraft::dlc::e_DLCType_ColourTable; + static constexpr EDLCType e_DLCType_GameRulesHeader = + ::minecraft::dlc::e_DLCType_GameRulesHeader; static constexpr EDLCType e_DLCType_Max = ::minecraft::dlc::e_DLCType_Max; static constexpr EDLCType e_DLCType_All = ::minecraft::dlc::e_DLCType_All; - static constexpr EDLCParameterType e_DLCParamType_Invalid = ::minecraft::dlc::e_DLCParamType_Invalid; - static constexpr EDLCParameterType e_DLCParamType_DisplayName = ::minecraft::dlc::e_DLCParamType_DisplayName; - static constexpr EDLCParameterType e_DLCParamType_ThemeName = ::minecraft::dlc::e_DLCParamType_ThemeName; - static constexpr EDLCParameterType e_DLCParamType_Free = ::minecraft::dlc::e_DLCParamType_Free; - static constexpr EDLCParameterType e_DLCParamType_Credit = ::minecraft::dlc::e_DLCParamType_Credit; - static constexpr EDLCParameterType e_DLCParamType_Cape = ::minecraft::dlc::e_DLCParamType_Cape; - static constexpr EDLCParameterType e_DLCParamType_Box = ::minecraft::dlc::e_DLCParamType_Box; - static constexpr EDLCParameterType e_DLCParamType_Anim = ::minecraft::dlc::e_DLCParamType_Anim; - static constexpr EDLCParameterType e_DLCParamType_PackId = ::minecraft::dlc::e_DLCParamType_PackId; - static constexpr EDLCParameterType e_DLCParamType_NetherParticleColour = ::minecraft::dlc::e_DLCParamType_NetherParticleColour; - static constexpr EDLCParameterType e_DLCParamType_EnchantmentTextColour = ::minecraft::dlc::e_DLCParamType_EnchantmentTextColour; - static constexpr EDLCParameterType e_DLCParamType_EnchantmentTextFocusColour = ::minecraft::dlc::e_DLCParamType_EnchantmentTextFocusColour; - static constexpr EDLCParameterType e_DLCParamType_DataPath = ::minecraft::dlc::e_DLCParamType_DataPath; - static constexpr EDLCParameterType e_DLCParamType_PackVersion = ::minecraft::dlc::e_DLCParamType_PackVersion; - static constexpr EDLCParameterType e_DLCParamType_Max = ::minecraft::dlc::e_DLCParamType_Max; + static constexpr EDLCParameterType e_DLCParamType_Invalid = + ::minecraft::dlc::e_DLCParamType_Invalid; + static constexpr EDLCParameterType e_DLCParamType_DisplayName = + ::minecraft::dlc::e_DLCParamType_DisplayName; + static constexpr EDLCParameterType e_DLCParamType_ThemeName = + ::minecraft::dlc::e_DLCParamType_ThemeName; + static constexpr EDLCParameterType e_DLCParamType_Free = + ::minecraft::dlc::e_DLCParamType_Free; + static constexpr EDLCParameterType e_DLCParamType_Credit = + ::minecraft::dlc::e_DLCParamType_Credit; + static constexpr EDLCParameterType e_DLCParamType_Cape = + ::minecraft::dlc::e_DLCParamType_Cape; + static constexpr EDLCParameterType e_DLCParamType_Box = + ::minecraft::dlc::e_DLCParamType_Box; + static constexpr EDLCParameterType e_DLCParamType_Anim = + ::minecraft::dlc::e_DLCParamType_Anim; + static constexpr EDLCParameterType e_DLCParamType_PackId = + ::minecraft::dlc::e_DLCParamType_PackId; + static constexpr EDLCParameterType e_DLCParamType_NetherParticleColour = + ::minecraft::dlc::e_DLCParamType_NetherParticleColour; + static constexpr EDLCParameterType e_DLCParamType_EnchantmentTextColour = + ::minecraft::dlc::e_DLCParamType_EnchantmentTextColour; + static constexpr EDLCParameterType + e_DLCParamType_EnchantmentTextFocusColour = + ::minecraft::dlc::e_DLCParamType_EnchantmentTextFocusColour; + static constexpr EDLCParameterType e_DLCParamType_DataPath = + ::minecraft::dlc::e_DLCParamType_DataPath; + static constexpr EDLCParameterType e_DLCParamType_PackVersion = + ::minecraft::dlc::e_DLCParamType_PackVersion; + static constexpr EDLCParameterType e_DLCParamType_Max = + ::minecraft::dlc::e_DLCParamType_Max; const static char* wchTypeNamesA[e_DLCParamType_Max]; @@ -85,7 +110,7 @@ public: EDLCType type = e_DLCType_All); DLCSkinFile* getSkinFile( const std::string& path); // Will hunt all packs of type skin to find - // the right skinfile + // the right skinfile DLCPack* getPackContainingSkin(const std::string& path); unsigned int getPackIndexContainingSkin(const std::string& path, diff --git a/targets/app/common/DLC/DLCPack.cpp b/targets/app/common/DLC/DLCPack.cpp index 97c6ac41c..d0f78b64d 100644 --- a/targets/app/common/DLC/DLCPack.cpp +++ b/targets/app/common/DLC/DLCPack.cpp @@ -6,7 +6,6 @@ #include #include -#include "platform/profile/profile.h" #include "DLCAudioFile.h" #include "DLCCapeFile.h" #include "DLCColourTableFile.h" @@ -15,12 +14,13 @@ #include "DLCLocalisationFile.h" #include "DLCTextureFile.h" #include "DLCUIDataFile.h" -#include "minecraft/Console_Debug_enum.h" #include "app/common/DLC/DLCFile.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCSkinFile.h" -#include "minecraft/locale/StringTable.h" #include "app/linux/LinuxGame.h" +#include "minecraft/Console_Debug_enum.h" +#include "minecraft/locale/StringTable.h" +#include "platform/profile/profile.h" #include "util/StringHelpers.h" DLCPack::DLCPack(const std::string& name, std::uint32_t dwLicenseMask) { diff --git a/targets/app/common/DLC/DLCPack.h b/targets/app/common/DLC/DLCPack.h index 60c19d5bc..f225bdcd5 100644 --- a/targets/app/common/DLC/DLCPack.h +++ b/targets/app/common/DLC/DLCPack.h @@ -5,9 +5,9 @@ #include #include -#include "platform/PlatformTypes.h" #include "DLCManager.h" #include "app/common/DLC/DLCSkinFile.h" +#include "platform/PlatformTypes.h" class DLCFile; class DLCSkinFile; diff --git a/targets/app/common/DLC/DLCSkinFile.cpp b/targets/app/common/DLC/DLCSkinFile.cpp index e120d94a8..2f13329c6 100644 --- a/targets/app/common/DLC/DLCSkinFile.cpp +++ b/targets/app/common/DLC/DLCSkinFile.cpp @@ -3,12 +3,12 @@ #include #include -#include "platform/renderer/renderer.h" #include "DLCManager.h" #include "app/common/DLC/DLCFile.h" #include "app/linux/LinuxGame.h" #include "minecraft/client/model/SkinBox.h" #include "platform/XboxStubs.h" +#include "platform/renderer/renderer.h" DLCSkinFile::DLCSkinFile(const std::string& path) : DLCFile(DLCManager::e_DLCType_Skin, path) { @@ -56,8 +56,8 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type, int maximumChars = 55; - bool bIsSDMode = - !PlatformRenderer.IsHiDef() && !PlatformRenderer.IsWidescreen(); + bool bIsSDMode = !PlatformRenderer.IsHiDef() && + !PlatformRenderer.IsWidescreen(); if (bIsSDMode) { maximumChars = 45; @@ -111,8 +111,8 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type, memset(pSkinBox, 0, sizeof(SKIN_BOX)); sscanf(value.c_str(), "%9s%f%f%f%f%f%f%f%f", wchBodyPart, - &pSkinBox->fX, &pSkinBox->fY, &pSkinBox->fZ, &pSkinBox->fW, - &pSkinBox->fH, &pSkinBox->fD, &pSkinBox->fU, &pSkinBox->fV); + &pSkinBox->fX, &pSkinBox->fY, &pSkinBox->fZ, &pSkinBox->fW, + &pSkinBox->fH, &pSkinBox->fD, &pSkinBox->fU, &pSkinBox->fV); if (strcmp(wchBodyPart, "HEAD") == 0) { pSkinBox->ePart = eBodyPart_Head; diff --git a/targets/app/common/DLC/DLCSkinFile.h b/targets/app/common/DLC/DLCSkinFile.h index 4e4d12389..fbcc7c2ef 100644 --- a/targets/app/common/DLC/DLCSkinFile.h +++ b/targets/app/common/DLC/DLCSkinFile.h @@ -6,8 +6,8 @@ #include "DLCFile.h" #include "app/common/DLC/DLCManager.h" -#include "minecraft/client/model/SkinBox.h" #include "minecraft/client/model/HumanoidModel.h" +#include "minecraft/client/model/SkinBox.h" class DLCSkinFile : public DLCFile { private: diff --git a/targets/app/common/DLCController.cpp b/targets/app/common/DLCController.cpp index 69aea9f52..bdbb1a044 100644 --- a/targets/app/common/DLCController.cpp +++ b/targets/app/common/DLCController.cpp @@ -1,20 +1,20 @@ #include "app/common/DLCController.h" -#include "app/common/Game.h" -#include "app/common/DLC/DLCPack.h" +#include +#include + #include "app/common/DLC/DLCManager.h" +#include "app/common/DLC/DLCPack.h" #include "app/common/DLC/DLCSkinFile.h" +#include "app/common/Game.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" -#include "platform/storage/storage.h" -#include "platform/profile/profile.h" #include "platform/XboxStubs.h" - -#include -#include +#include "platform/profile/profile.h" +#include "platform/storage/storage.h" DLCController::DLCController() { m_pDLCFileBuffer = nullptr; @@ -75,10 +75,9 @@ bool DLCController::startInstallDLCProcess(int iPad) { "--- DLCController::startInstallDLCProcess - " "PlatformStorage.GetInstalledDLC\n"); - PlatformStorage.GetInstalledDLC( - iPad, [this](int iInstalledC, int pad) { - return dlcInstalledCallback(iInstalledC, pad); - }); + PlatformStorage.GetInstalledDLC(iPad, [this](int iInstalledC, int pad) { + return dlcInstalledCallback(iInstalledC, pad); + }); return true; } else { app.DebugPrintf( @@ -193,7 +192,7 @@ void DLCController::handleDLC(DLCPack* pack) { PlatformStorage.GetMountedDLCFileList("DLCDrive", dlcFilenames); for (int i = 0; i < dlcFilenames.size(); i++) { app.m_dlcManager.readDLCDataFile(dwFilesProcessed, dlcFilenames[i], - pack); + pack); } if (dwFilesProcessed == 0) app.m_dlcManager.removePack(pack); } @@ -313,8 +312,7 @@ bool DLCController::getDLCFullOfferIDForPackID(const int iPackID, } } -DLC_INFO* DLCController::getDLCInfoForTrialOfferID( - uint64_t ullOfferID_Trial) { +DLC_INFO* DLCController::getDLCInfoForTrialOfferID(uint64_t ullOfferID_Trial) { if (DLCInfo_Trial.size() > 0) { auto it = DLCInfo_Trial.find(ullOfferID_Trial); if (it == DLCInfo_Trial.end()) { @@ -436,12 +434,13 @@ bool DLCController::retrieveNextDLCContent() { app.DebugPrintf("RetrieveNextDLCContent - type = %d\n", pCurrent->dwType); #endif - IPlatformStorage::EDLCStatus status = PlatformStorage.GetDLCOffers( - PlatformProfile.GetPrimaryPad(), - [this](int iOfferC, std::uint32_t dwType, int pad) { - return dlcOffersReturned(iOfferC, dwType, pad); - }, - pCurrent->dwType); + IPlatformStorage::EDLCStatus status = + PlatformStorage.GetDLCOffers( + PlatformProfile.GetPrimaryPad(), + [this](int iOfferC, std::uint32_t dwType, int pad) { + return dlcOffersReturned(iOfferC, dwType, pad); + }, + pCurrent->dwType); if (status == IPlatformStorage::EDLC_Pending) { pCurrent->eState = e_DLC_ContentState_Retrieving; } else { @@ -669,9 +668,9 @@ unsigned int DLCController::addTMSPPFileTypeRequest(eDLCContentType eType, return 1; } -int DLCController::tmsPPFileReturned(void* pParam, int iPad, int iUserData, - IPlatformStorage::PTMSPP_FILEDATA pFileData, - const char* szFilename) { +int DLCController::tmsPPFileReturned( + void* pParam, int iPad, int iUserData, + IPlatformStorage::PTMSPP_FILEDATA pFileData, const char* szFilename) { DLCController* pClass = (DLCController*)pParam; { diff --git a/targets/app/common/DLCController.h b/targets/app/common/DLCController.h index fbec77634..2ef3a520b 100644 --- a/targets/app/common/DLCController.h +++ b/targets/app/common/DLCController.h @@ -8,8 +8,8 @@ #include "app/common/App_structs.h" #include "app/common/DLC/DLCManager.h" -#include "platform/storage/storage.h" #include "platform/XboxStubs.h" +#include "platform/storage/storage.h" struct SCreditTextItemDef; @@ -36,9 +36,8 @@ public: int iPad); // DLC info registration - static int32_t registerDLCData(char*, char*, int, uint64_t, uint64_t, - char*, unsigned int, int, - char* pDataFile); + static int32_t registerDLCData(char*, char*, int, uint64_t, uint64_t, char*, + unsigned int, int, char* pDataFile); bool getDLCFullOfferIDForSkinID(const std::string& FirstSkin, uint64_t* pullVal); bool getDLCFullOfferIDForPackID(const int iPackID, uint64_t* pullVal); diff --git a/targets/app/common/DebugOptions.cpp b/targets/app/common/DebugOptions.cpp index b8a7bd099..3f16e4d91 100644 --- a/targets/app/common/DebugOptions.cpp +++ b/targets/app/common/DebugOptions.cpp @@ -27,7 +27,6 @@ DebugOptions::DebugOptions() { #if defined(_DEBUG_MENUS_ENABLED) bool DebugOptions::debugArtToolsOn(unsigned int debugMask) { - return settingsOn() && - (debugMask & (1L << eDebugSetting_ArtTools)) != 0; + return settingsOn() && (debugMask & (1L << eDebugSetting_ArtTools)) != 0; } #endif diff --git a/targets/app/common/Game.cpp b/targets/app/common/Game.cpp index 9dbb035e5..7bd8be6ef 100644 --- a/targets/app/common/Game.cpp +++ b/targets/app/common/Game.cpp @@ -1,34 +1,27 @@ -#include "minecraft/GameHostOptions.h" #include "app/common/Game.h" -#include "platform/PlatformTypes.h" -#include "platform/profile/profile.h" -#include "platform/renderer/renderer.h" -#include "platform/storage/storage.h" -#include "minecraft/GameTypes.h" -#include "minecraft/GameEnums.h" #include "app/common/App_structs.h" -#include "minecraft/Console_Debug_enum.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCSkinFile.h" #include "app/common/GameRules/GameRuleManager.h" #include "app/common/Network/GameNetworkManager.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Scenes/UIScene_FullscreenProgress.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "platform/NetTypes.h" -#include "minecraft/client/model/SkinBox.h" -#include "platform/XboxStubs.h" #include "java/Class.h" #include "java/File.h" #include "java/Random.h" +#include "minecraft/Console_Debug_enum.h" +#include "minecraft/GameEnums.h" +#include "minecraft/GameHostOptions.h" +#include "minecraft/GameTypes.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/Options.h" #include "minecraft/client/ProgressRenderer.h" +#include "minecraft/client/model/SkinBox.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/client/multiplayer/ClientConnection.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" @@ -39,6 +32,7 @@ #include "minecraft/client/renderer/entity/EntityRenderer.h" #include "minecraft/client/skins/TexturePack.h" #include "minecraft/network/packet/DisconnectPacket.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/stats/StatsCounter.h" #include "minecraft/world/Container.h" @@ -47,6 +41,12 @@ #include "minecraft/world/item/crafting/Recipy.h" #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/level/tile/entity/HopperTileEntity.h" +#include "platform/NetTypes.h" +#include "platform/PlatformTypes.h" +#include "platform/XboxStubs.h" +#include "platform/profile/profile.h" +#include "platform/renderer/renderer.h" +#include "platform/storage/storage.h" #include "strings.h" #if defined(_WINDOWS64) #include "app/windows/XML/ATGXmlParser.h" @@ -71,24 +71,24 @@ #include #include -#include "platform/input/input.h" #include "app/common/Audio/SoundEngine.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "app/common/DLC/DLCPack.h" -#include "minecraft/locale/StringTable.h" #include "app/common/UI/All Platforms/ArchiveFile.h" #include "app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.h" #include "minecraft/Minecraft_Macros.h" -#include "util/Timer.h" -#include "util/StringHelpers.h" -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "minecraft/client/User.h" #include "minecraft/client/gui/Gui.h" #include "minecraft/client/renderer/entity/EntityRenderDispatcher.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/client/skins/DLCTexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" +#include "minecraft/locale/StringTable.h" #include "minecraft/server/PlayerList.h" #include "minecraft/server/level/ServerPlayer.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" +#include "platform/input/input.h" +#include "util/StringHelpers.h" +#include "util/Timer.h" class BeaconTileEntity; class BrewingStandTileEntity; @@ -189,31 +189,14 @@ void Game::SetAppPaused(bool val) { m_bIsAppPaused = val; } // Load*Menu methods moved to MenuController - ////////////////////////////////////////////// // GAME SETTINGS ////////////////////////////////////////////// - - - - - // Skin/Cape/FavoriteSkin methods moved to SkinManager // Mash-up pack worlds - - - - - - - - - - - /////////////////////////// // // Remove the debug settings in the content package build @@ -221,16 +204,10 @@ void Game::SetAppPaused(bool val) { m_bIsAppPaused = val; } //////////////////////////// #if !defined(_DEBUG_MENUS_ENABLED) - - #else - - #endif - - int Game::BannedLevelDialogReturned( void* pParam, int iPad, const IPlatformStorage::EMessageResult result) { Game* pApp = (Game*)pParam; @@ -284,11 +261,8 @@ int Game::GetLocalPlayerCount(void) { return iPlayerC; } - - // Installed DLC callback - // 4J-JEV: For the sake of clarity in DLCMountedCallback. #if defined(_WINDOWS64) #define CONTENT_DATA_DISPLAY_NAME(a) (a.szDisplayName) @@ -326,7 +300,6 @@ int Game::GetLocalPlayerCount(void) { // } // } - // int Game::DLCReadCallback(void* // pParam,IPlatformStorage::DLC_FILE_DETAILS *pDLCData) // { @@ -365,8 +338,9 @@ void Game::UpdateTime() { } bool Game::isXuidDeadmau5(PlayerUID xuid) { - auto it = DLCController::MojangData.find(xuid); // 4J Stu - The .at and [] accessors - // insert elements if they don't exist + auto it = DLCController::MojangData.find( + xuid); // 4J Stu - The .at and [] accessors + // insert elements if they don't exist if (it != DLCController::MojangData.end()) { MOJANG_DATA* pMojangData = DLCController::MojangData[xuid]; if (pMojangData && pMojangData->eXuid == eXUID_Deadmau5) { @@ -383,12 +357,6 @@ void Game::ExitGame() {} // Invites - - - - - - ////////////////////////////////////////////////////////////////////////// // // FatalLoadError @@ -400,26 +368,16 @@ void Game::ExitGame() {} ////////////////////////////////////////////////////////////////////////// void Game::FatalLoadError() {} - - - - - // Game Host options -void Game::SetGameHostOption(eGameHostOption eVal, - unsigned int uiVal) { +void Game::SetGameHostOption(eGameHostOption eVal, unsigned int uiVal) { GameHostOptions::set(m_uiGameHostSettings, eVal, uiVal); } - unsigned int Game::GetGameHostOption(eGameHostOption eVal) { return GameHostOptions::get(m_uiGameHostSettings, eVal); } - - - void Game::processSchematics(LevelChunk* levelChunk) { m_gameRules.processSchematics(levelChunk); } @@ -428,12 +386,9 @@ void Game::processSchematicsLighting(LevelChunk* levelChunk) { m_gameRules.processSchematicsLighting(levelChunk); } -void Game::loadDefaultGameRules() { - m_gameRules.loadDefaultGameRules(); -} +void Game::loadDefaultGameRules() { m_gameRules.loadDefaultGameRules(); } -void Game::setLevelGenerationOptions( - LevelGenerationOptions* levelGen) { +void Game::setLevelGenerationOptions(LevelGenerationOptions* levelGen) { m_gameRules.setLevelGenerationOptions(levelGen); } @@ -441,16 +396,8 @@ const char* Game::GetGameRulesString(const std::string& key) { return m_gameRules.GetGameRulesString(key); } - - -// PNG_TAG_tEXt, FromBigEndian, GetImageTextData, CreateImageTextData moved to MenuController - - - - - - - +// PNG_TAG_tEXt, FromBigEndian, GetImageTextData, CreateImageTextData moved to +// MenuController std::string Game::getEntityName(eINSTANCEOF type) { switch (type) { @@ -506,12 +453,8 @@ std::string Game::getEntityName(eINSTANCEOF type) { // m_dwContentTypeA moved to DLCController - - - - -int32_t Game::RegisterMojangData(char* pXuidName, PlayerUID xuid, - char* pSkin, char* pCape) { +int32_t Game::RegisterMojangData(char* pXuidName, PlayerUID xuid, char* pSkin, + char* pCape) { int32_t hr = 0; eXUID eTempXuid = eXUID_Undefined; MOJANG_DATA* pMojangData = nullptr; @@ -579,33 +522,12 @@ int32_t Game::RegisterConfigValues(char* pType, int iValue) { #endif - - - - - - - - - - - - - - - - - - - // DLC - - - // AUTOSAVE void Game::SetAutosaveTimerTime(void) { - int settingValue = GetGameSettings(PlatformProfile.GetPrimaryPad(), eGameSetting_Autosave); + int settingValue = + GetGameSettings(PlatformProfile.GetPrimaryPad(), eGameSetting_Autosave); m_saveManager.setAutosaveTimerTime(settingValue); } @@ -641,7 +563,8 @@ bool Game::IsLocalMultiplayerAvailable() { // #else // for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) // { - // if( (i!=userIndex) && (PlatformInput.IsPadConnected(i) || + // if( (i!=userIndex) && (PlatformInput.IsPadConnected(i) + //|| // PlatformProfile.IsSignedIn(i)) ) // { // iOtherConnectedControllers++; @@ -654,10 +577,8 @@ bool Game::IsLocalMultiplayerAvailable() { // (moved to manager class) -std::string Game::getFilePath(std::uint32_t packId, - std::string filename, - bool bAddDataFolder, - std::string mountPoint) { +std::string Game::getFilePath(std::uint32_t packId, std::string filename, + bool bAddDataFolder, std::string mountPoint) { std::string path = getRootPath(packId, true, bAddDataFolder, mountPoint) + filename; File f(path); @@ -689,9 +610,8 @@ std::string titleUpdateTexturePackRoot = "Windows64\\DLC\\"; std::string titleUpdateTexturePackRoot = "CU\\DLC\\"; #endif -std::string Game::getRootPath(std::uint32_t packId, - bool allowOverride, bool bAddDataFolder, - std::string mountPoint) { +std::string Game::getRootPath(std::uint32_t packId, bool allowOverride, + bool bAddDataFolder, std::string mountPoint) { std::string path = mountPoint; if (allowOverride) { switch (packId) { diff --git a/targets/app/common/Game.h b/targets/app/common/Game.h index 0a68d6ae0..a67163e99 100644 --- a/targets/app/common/Game.h +++ b/targets/app/common/Game.h @@ -3,38 +3,38 @@ #include #include -#include "util/Timer.h" #include "platform/profile/profile.h" #include "platform/storage/storage.h" +#include "util/Timer.h" // using namespace std; +#include "app/common/App_structs.h" #include "app/common/ArchiveManager.h" +#include "app/common/Audio/Consoles_SoundEngine.h" #include "app/common/BannedListManager.h" -#include "app/common/DebugOptions.h" +#include "app/common/DLC/DLCManager.h" #include "app/common/DLCController.h" +#include "app/common/DebugOptions.h" +#include "app/common/GameRules/GameRuleManager.h" #include "app/common/GameSettingsManager.h" #include "app/common/IPlatformGame.h" -#include "app/common/App_structs.h" #include "app/common/LocalizationManager.h" #include "app/common/MenuController.h" #include "app/common/NetworkController.h" #include "app/common/SaveManager.h" #include "app/common/SkinManager.h" #include "app/common/TerrainFeatureManager.h" -#include "app/common/Audio/Consoles_SoundEngine.h" -#include "app/common/DLC/DLCManager.h" -#include "minecraft/world/level/ConsoleGameRulesConstants.h" -#include "app/common/GameRules/GameRuleManager.h" -#include "minecraft/locale/StringTable.h" #include "app/common/Tutorial/TutorialEnum.h" #include "app/common/UI/All Platforms/ArchiveFile.h" #include "app/common/UI/All Platforms/UIStructs.h" -#include "platform/NetTypes.h" #include "minecraft/client/model/SkinBox.h" -#include "platform/XboxStubs.h" +#include "minecraft/locale/StringTable.h" #include "minecraft/network/packet/DisconnectPacket.h" #include "minecraft/world/entity/item/MinecartHopper.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" +#include "platform/NetTypes.h" +#include "platform/XboxStubs.h" // JoinFromInviteData moved to NetworkController.h @@ -145,7 +145,8 @@ public: bool IsAppPaused(); void SetAppPaused(bool val); - int displaySavingMessage(const IPlatformStorage::ESavingMessage eMsg, int iPad) { + int displaySavingMessage(const IPlatformStorage::ESavingMessage eMsg, + int iPad) { return m_gameSettingsManager.displaySavingMessage(eMsg, iPad); } bool GetGameStarted() { return m_bGameStarted; } @@ -169,7 +170,8 @@ public: bool LoadEnchantingMenu(int iPad, std::shared_ptr inventory, int x, int y, int z, Level* level, const std::string& name) { - return m_menuController.loadEnchantingMenu(iPad, inventory, x, y, z, level, name); + return m_menuController.loadEnchantingMenu(iPad, inventory, x, y, z, + level, name); } bool LoadFurnaceMenu(int iPad, std::shared_ptr inventory, std::shared_ptr furnace) { @@ -178,7 +180,8 @@ public: bool LoadBrewingStandMenu( int iPad, std::shared_ptr inventory, std::shared_ptr brewingStand) { - return m_menuController.loadBrewingStandMenu(iPad, inventory, brewingStand); + return m_menuController.loadBrewingStandMenu(iPad, inventory, + brewingStand); } bool LoadContainerMenu(int iPad, std::shared_ptr inventory, std::shared_ptr container) { @@ -204,12 +207,14 @@ public: } bool LoadRepairingMenu(int iPad, std::shared_ptr inventory, Level* level, int x, int y, int z) { - return m_menuController.loadRepairingMenu(iPad, inventory, level, x, y, z); + return m_menuController.loadRepairingMenu(iPad, inventory, level, x, y, + z); } bool LoadTradingMenu(int iPad, std::shared_ptr inventory, std::shared_ptr trader, Level* level, const std::string& name) { - return m_menuController.loadTradingMenu(iPad, inventory, trader, level, name); + return m_menuController.loadTradingMenu(iPad, inventory, trader, level, + name); } bool LoadCommandBlockMenu( @@ -227,7 +232,8 @@ public: bool LoadHorseMenu(int iPad, std::shared_ptr inventory, std::shared_ptr container, std::shared_ptr horse) { - return m_menuController.loadHorseMenu(iPad, inventory, container, horse); + return m_menuController.loadHorseMenu(iPad, inventory, container, + horse); } bool LoadBeaconMenu(int iPad, std::shared_ptr inventory, std::shared_ptr beacon) { @@ -242,21 +248,31 @@ public: } static const char* GetString(int iID); - StringTable* getStringTable() const { return m_localizationManager.getStringTable(); } + StringTable* getStringTable() const { + return m_localizationManager.getStringTable(); + } eGameMode GetGameMode() { return m_eGameMode; } void SetGameMode(eGameMode eMode) { m_eGameMode = eMode; } - eXuiAction GetGlobalXuiAction() { return m_menuController.getGlobalXuiAction(); } - void SetGlobalXuiAction(eXuiAction action) { m_menuController.setGlobalXuiAction(action); } - eXuiAction GetXuiAction(int iPad) { return m_menuController.getXuiAction(iPad); } + eXuiAction GetGlobalXuiAction() { + return m_menuController.getGlobalXuiAction(); + } + void SetGlobalXuiAction(eXuiAction action) { + m_menuController.setGlobalXuiAction(action); + } + eXuiAction GetXuiAction(int iPad) { + return m_menuController.getXuiAction(iPad); + } void SetAction(int iPad, eXuiAction action, void* param = nullptr) { m_menuController.setAction(iPad, action, param); } void SetTMSAction(int iPad, eTMSAction action) { m_menuController.setTMSAction(iPad, action); } - eTMSAction GetTMSAction(int iPad) { return m_menuController.getTMSAction(iPad); } + eTMSAction GetTMSAction(int iPad) { + return m_menuController.getTMSAction(iPad); + } eXuiServerAction GetXuiServerAction(int iPad) { return m_menuController.getXuiServerAction(iPad); } @@ -281,10 +297,16 @@ public: m_networkController.setDisconnectReason(bVal); } - bool GetChangingSessionType() { return m_networkController.getChangingSessionType(); } - void SetChangingSessionType(bool bVal) { m_networkController.setChangingSessionType(bVal); } + bool GetChangingSessionType() { + return m_networkController.getChangingSessionType(); + } + void SetChangingSessionType(bool bVal) { + m_networkController.setChangingSessionType(bVal); + } - bool GetReallyChangingSessionType() { return m_networkController.getReallyChangingSessionType(); } + bool GetReallyChangingSessionType() { + return m_networkController.getReallyChangingSessionType(); + } void SetReallyChangingSessionType(bool bVal) { m_networkController.setReallyChangingSessionType(bVal); } @@ -340,13 +362,15 @@ public: static int OldProfileVersionCallback(void* pParam, unsigned char* pucData, const unsigned short usVersion, const int iPad) { - return GameSettingsManager::oldProfileVersionCallback(pParam, pucData, usVersion, iPad); + return GameSettingsManager::oldProfileVersionCallback(pParam, pucData, + usVersion, iPad); } - static int DefaultOptionsCallback(void* pParam, - IPlatformProfile::PROFILESETTINGS* pSettings, - const int iPad) { - return GameSettingsManager::defaultOptionsCallback(pParam, pSettings, iPad); + static int DefaultOptionsCallback( + void* pParam, IPlatformProfile::PROFILESETTINGS* pSettings, + const int iPad) { + return GameSettingsManager::defaultOptionsCallback(pParam, pSettings, + iPad); } int SetDefaultOptions(IPlatformProfile::PROFILESETTINGS* pSettings, const int iPad) { @@ -376,7 +400,8 @@ public: m_skinManager.setPlayerCape(iPad, dwCapeId, GameSettingsA); } void SetPlayerFavoriteSkin(int iPad, int iIndex, unsigned int uiSkinID) { - m_skinManager.setPlayerFavoriteSkin(iPad, iIndex, uiSkinID, GameSettingsA); + m_skinManager.setPlayerFavoriteSkin(iPad, iIndex, uiSkinID, + GameSettingsA); } unsigned int GetPlayerFavoriteSkin(int iPad, int iIndex) { return m_skinManager.getPlayerFavoriteSkin(iPad, iIndex, GameSettingsA); @@ -427,9 +452,7 @@ public: void SetOpacityTimer(int iPad) { m_menuController.setOpacityTimer(iPad); } // 6 seconds - void TickOpacityTimer(int iPad) { - m_menuController.tickOpacityTimer(iPad); - } + void TickOpacityTimer(int iPad) { m_menuController.tickOpacityTimer(iPad); } public: std::string GetPlayerSkinName(int iPad) { @@ -449,7 +472,8 @@ public: } void CheckGameSettingsChanged(bool bOverride5MinuteTimer = false, int iPad = XUSER_INDEX_ANY) { - m_gameSettingsManager.checkGameSettingsChanged(bOverride5MinuteTimer, iPad); + m_gameSettingsManager.checkGameSettingsChanged(bOverride5MinuteTimer, + iPad); } void ApplyGameSettingsChanged(int iPad) { m_gameSettingsManager.applyGameSettingsChanged(iPad); @@ -462,7 +486,8 @@ public: } unsigned int GetGameSettingsDebugMask(int iPad = -1, bool bOverridePlayer = false) { - return m_gameSettingsManager.getGameSettingsDebugMask(iPad, bOverridePlayer); + return m_gameSettingsManager.getGameSettingsDebugMask(iPad, + bOverridePlayer); } void SetGameSettingsDebugMask(int iPad, unsigned int uiVal) { m_gameSettingsManager.setGameSettingsDebugMask(iPad, uiVal); @@ -485,13 +510,15 @@ public: static int SignoutExitWorldThreadProc(void* lpParameter) { return NetworkController::signoutExitWorldThreadProc(lpParameter); } - static int PrimaryPlayerSignedOutReturned(void* pParam, int iPad, - const IPlatformStorage::EMessageResult result) { - return NetworkController::primaryPlayerSignedOutReturned(pParam, iPad, result); + static int PrimaryPlayerSignedOutReturned( + void* pParam, int iPad, const IPlatformStorage::EMessageResult result) { + return NetworkController::primaryPlayerSignedOutReturned(pParam, iPad, + result); } - static int EthernetDisconnectReturned(void* pParam, int iPad, - const IPlatformStorage::EMessageResult result) { - return NetworkController::ethernetDisconnectReturned(pParam, iPad, result); + static int EthernetDisconnectReturned( + void* pParam, int iPad, const IPlatformStorage::EMessageResult result) { + return NetworkController::ethernetDisconnectReturned(pParam, iPad, + result); } static void ProfileReadErrorCallback(void* pParam) { NetworkController::profileReadErrorCallback(pParam); @@ -504,15 +531,20 @@ public: static void NotificationsCallback(void* pParam, std::uint32_t dwNotification, unsigned int uiParam) { - NetworkController::notificationsCallback(pParam, dwNotification, uiParam); + NetworkController::notificationsCallback(pParam, dwNotification, + uiParam); } // for the ethernet being disconnected static void LiveLinkChangeCallback(void* pParam, bool bConnected) { NetworkController::liveLinkChangeCallback(pParam, bConnected); } - bool GetLiveLinkRequired() { return m_networkController.getLiveLinkRequired(); } - void SetLiveLinkRequired(bool required) { m_networkController.setLiveLinkRequired(required); } + bool GetLiveLinkRequired() { + return m_networkController.getLiveLinkRequired(); + } + void SetLiveLinkRequired(bool required) { + m_networkController.setLiveLinkRequired(required); + } #if defined(_DEBUG_MENUS_ENABLED) bool DebugSettingsOn() { return m_debugOptions.settingsOn(); } @@ -523,11 +555,15 @@ public: #endif void SetDebugSequence(const char* pchSeq); // bool UploadFileToGlobalStorage(int iQuadrant, - // IPlatformStorage::eGlobalStorage eStorageFacility, std::string *wsFile ); + // IPlatformStorage::eGlobalStorage eStorageFacility, std::string *wsFile ); // Installed DLC - delegated to DLCController - bool StartInstallDLCProcess(int iPad) { return m_dlcController.startInstallDLCProcess(iPad); } - int dlcInstalledCallback(int iOfferC, int iPad) { return m_dlcController.dlcInstalledCallback(iOfferC, iPad); } + bool StartInstallDLCProcess(int iPad) { + return m_dlcController.startInstallDLCProcess(iPad); + } + int dlcInstalledCallback(int iOfferC, int iPad) { + return m_dlcController.dlcInstalledCallback(iOfferC, iPad); + } void HandleDLCLicenseChange(); int dlcMountedCallback(int iPad, std::uint32_t dwErr, std::uint32_t dwLicenceMask) { @@ -536,11 +572,12 @@ public: void MountNextDLC(int iPad) { m_dlcController.mountNextDLC(iPad); } void HandleDLC(DLCPack* pack) { m_dlcController.handleDLC(pack); } bool DLCInstallPending() { return m_dlcController.dlcInstallPending(); } - bool DLCInstallProcessCompleted() { return m_dlcController.dlcInstallProcessCompleted(); } + bool DLCInstallProcessCompleted() { + return m_dlcController.dlcInstallProcessCompleted(); + } void ClearDLCInstalled() { m_dlcController.clearDLCInstalled(); } - static int MarketplaceCountsCallback(void* pParam, - IPlatformStorage::DLC_TMS_DETAILS* details, - int iPad) { + static int MarketplaceCountsCallback( + void* pParam, IPlatformStorage::DLC_TMS_DETAILS* details, int iPad) { return DLCController::marketplaceCountsCallback(pParam, details, iPad); } @@ -558,9 +595,7 @@ public: virtual void StoreLaunchData(); virtual void ExitGame(); - bool isXuidNotch(PlayerUID xuid) { - return m_skinManager.isXuidNotch(xuid); - } + bool isXuidNotch(PlayerUID xuid) { return m_skinManager.isXuidNotch(xuid); } bool isXuidDeadmau5(PlayerUID xuid); void AddMemoryTextureFile(const std::string& wName, std::uint8_t* pbData, @@ -597,9 +632,7 @@ public: return m_archiveManager.getTPConfigVal(pwchDataFile); } - bool DefaultCapeExists() { - return m_skinManager.defaultCapeExists(); - } + bool DefaultCapeExists() { return m_skinManager.defaultCapeExists(); } // void InstallDefaultCape(); // attempt to install the default cape once // per game launch @@ -607,11 +640,14 @@ public: void ProcessInvite(std::uint32_t dwUserIndex, std::uint32_t dwLocalUsersMask, const INVITE_INFO* pInviteInfo) { - m_networkController.processInvite(dwUserIndex, dwLocalUsersMask, pInviteInfo); + m_networkController.processInvite(dwUserIndex, dwLocalUsersMask, + pInviteInfo); } // Add credits for DLC installed - delegated to DLCController - void AddCreditText(const char* lpStr) { m_dlcController.addCreditText(lpStr); } + void AddCreditText(const char* lpStr) { + m_dlcController.addCreditText(lpStr); + } private: std::unordered_map m_GTS_Files; @@ -654,14 +690,16 @@ public: bool m_bTutorialMode; bool m_bIsAppPaused; - // m_bChangingSessionType and m_bReallyChangingSessionType moved to NetworkController + // m_bChangingSessionType and m_bReallyChangingSessionType moved to + // NetworkController // trial, and trying to unlock full // version on an upsell void loadMediaArchive() { m_archiveManager.loadMediaArchive(); } void loadStringTable() { - m_localizationManager.loadStringTable(m_archiveManager.getMediaArchive()); + m_localizationManager.loadStringTable( + m_archiveManager.getMediaArchive()); } public: @@ -676,10 +714,10 @@ public: } private: - static int BannedLevelDialogReturned(void* pParam, int iPad, - const IPlatformStorage::EMessageResult); - static int TexturePackDialogReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result) { + static int BannedLevelDialogReturned( + void* pParam, int iPad, const IPlatformStorage::EMessageResult); + static int TexturePackDialogReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { return MenuController::texturePackDialogReturned(pParam, iPad, result); } @@ -703,7 +741,8 @@ private: eGameMode m_eGameMode; // single or multiplayer // GameSettingsA reference alias into GameSettingsManager - GAME_SETTINGS* (&GameSettingsA)[XUSER_MAX_COUNT] = m_gameSettingsManager.GameSettingsA; + GAME_SETTINGS* (&GameSettingsA)[XUSER_MAX_COUNT] = + m_gameSettingsManager.GameSettingsA; // m_uiLastSignInData moved to NetworkController @@ -728,7 +767,6 @@ public: } private: - static int UnlockFullExitReturned(void* pParam, int iPad, IPlatformStorage::EMessageResult result) { return MenuController::unlockFullExitReturned(pParam, iPad, result); @@ -737,8 +775,8 @@ private: IPlatformStorage::EMessageResult result) { return MenuController::unlockFullSaveReturned(pParam, iPad, result); } - static int UnlockFullInviteReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result) { + static int UnlockFullInviteReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { return MenuController::unlockFullInviteReturned(pParam, iPad, result); } static int TrialOverReturned(void* pParam, int iPad, @@ -751,21 +789,25 @@ private: } static int ExitAndJoinFromInviteSaveDialogReturned( void* pParam, int iPad, IPlatformStorage::EMessageResult result) { - return NetworkController::exitAndJoinFromInviteSaveDialogReturned(pParam, iPad, result); + return NetworkController::exitAndJoinFromInviteSaveDialogReturned( + pParam, iPad, result); } static int ExitAndJoinFromInviteAndSaveReturned( void* pParam, int iPad, IPlatformStorage::EMessageResult result) { - return NetworkController::exitAndJoinFromInviteAndSaveReturned(pParam, iPad, result); + return NetworkController::exitAndJoinFromInviteAndSaveReturned( + pParam, iPad, result); } static int ExitAndJoinFromInviteDeclineSaveReturned( void* pParam, int iPad, IPlatformStorage::EMessageResult result) { - return NetworkController::exitAndJoinFromInviteDeclineSaveReturned(pParam, iPad, result); + return NetworkController::exitAndJoinFromInviteDeclineSaveReturned( + pParam, iPad, result); } - static int FatalErrorDialogReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); + static int FatalErrorDialogReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); static int WarningTrialTexturePackReturned( void* pParam, int iPad, IPlatformStorage::EMessageResult result) { - return NetworkController::warningTrialTexturePackReturned(pParam, iPad, result); + return NetworkController::warningTrialTexturePackReturned(pParam, iPad, + result); } JoinFromInviteData& m_InviteData = m_networkController.m_InviteData; @@ -794,7 +836,7 @@ public: return m_localizationManager.getHTMLFontSize(size); } std::string FormatHTMLString(int iPad, const std::string& desc, - int shadowColour = 0xFFFFFFFF) { + int shadowColour = 0xFFFFFFFF) { return m_localizationManager.formatHTMLString(iPad, desc, shadowColour); } std::string GetActionReplacement(int iPad, unsigned char ucAction) { @@ -818,7 +860,8 @@ public: } static int ExitGameFromRemoteSaveDialogReturned( void* pParam, int iPad, IPlatformStorage::EMessageResult result) { - return MenuController::exitGameFromRemoteSaveDialogReturned(pParam, iPad, result); + return MenuController::exitGameFromRemoteSaveDialogReturned( + pParam, iPad, result); } // XML @@ -840,10 +883,11 @@ public: MOJANG_DATA* GetMojangDataForXuid(PlayerUID xuid); static int32_t RegisterConfigValues(char* pType, int iValue); - static int32_t RegisterDLCData(char* a, char* b, int c, uint64_t d, uint64_t e, - char* f, unsigned int g, int h, + static int32_t RegisterDLCData(char* a, char* b, int c, uint64_t d, + uint64_t e, char* f, unsigned int g, int h, char* pDataFile) { - return DLCController::registerDLCData(a, b, c, d, e, f, g, h, pDataFile); + return DLCController::registerDLCData(a, b, c, d, e, f, g, h, + pDataFile); } bool GetDLCFullOfferIDForSkinID(const std::string& FirstSkin, uint64_t* pullVal) { @@ -856,8 +900,12 @@ public: return m_dlcController.getDLCInfoForFullOfferID(ullOfferID_Full); } - unsigned int GetDLCCreditsCount() { return m_dlcController.getDLCCreditsCount(); } - SCreditTextItemDef* GetDLCCredits(int iIndex) { return m_dlcController.getDLCCredits(iIndex); } + unsigned int GetDLCCreditsCount() { + return m_dlcController.getDLCCreditsCount(); + } + SCreditTextItemDef* GetDLCCredits(int iIndex) { + return m_dlcController.getDLCCredits(iIndex); + } // TMS void ReadDLCFileFromTMS(int iPad, eTMSAction action, @@ -880,11 +928,11 @@ public: // Sign-in info moved to NetworkController public: - // void OverrideFontRenderer(bool set, bool immediate = true); // void ToggleFontRenderer() { // OverrideFontRenderer(!m_bFontRendererOverridden,false); } - BANNEDLIST (&BannedListA)[XUSER_MAX_COUNT] = m_bannedListManager.BannedListA; + BANNEDLIST (&BannedListA) + [XUSER_MAX_COUNT] = m_bannedListManager.BannedListA; public: void SetBanListCheck(int iPad, bool bVal) { @@ -902,7 +950,8 @@ public: // m_uiOpacityCountDown moved to MenuController // DLC flags moved to DLCController // Host options - m_uiGameHostSettings moved to GameSettingsManager - unsigned int& m_uiGameHostSettings = m_gameSettingsManager.m_uiGameHostSettings; + unsigned int& m_uiGameHostSettings = + m_gameSettingsManager.m_uiGameHostSettings; #if defined(_LARGE_WORLDS) unsigned int m_GameNewWorldSize; @@ -945,13 +994,17 @@ public: // World seed from png image - delegated to MenuController void GetImageTextData(std::uint8_t* imageData, unsigned int imageBytes, unsigned char* seedText, unsigned int& uiHostOptions, - bool& bHostOptionsRead, std::uint32_t& uiTexturePack) { - m_menuController.getImageTextData(imageData, imageBytes, seedText, uiHostOptions, bHostOptionsRead, uiTexturePack); + bool& bHostOptionsRead, + std::uint32_t& uiTexturePack) { + m_menuController.getImageTextData(imageData, imageBytes, seedText, + uiHostOptions, bHostOptionsRead, + uiTexturePack); } unsigned int CreateImageTextData(std::uint8_t* textMetadata, int64_t seed, bool hasSeed, unsigned int uiHostOptions, unsigned int uiTexturePackId) { - return m_menuController.createImageTextData(textMetadata, seed, hasSeed, uiHostOptions, uiTexturePackId); + return m_menuController.createImageTextData( + textMetadata, seed, hasSeed, uiHostOptions, uiTexturePackId); } // Game rules @@ -979,7 +1032,8 @@ public: void UpdatePlayerInfo(std::uint8_t networkSmallId, int16_t playerColourIndex, unsigned int playerGamePrivileges) { - m_networkController.updatePlayerInfo(networkSmallId, playerColourIndex, playerGamePrivileges); + m_networkController.updatePlayerInfo(networkSmallId, playerColourIndex, + playerGamePrivileges); } short GetPlayerColour(std::uint8_t networkSmallId) { return m_networkController.getPlayerColour(networkSmallId); @@ -994,7 +1048,9 @@ public: bool bPromote = false) { return m_dlcController.addDLCRequest(eContentType, bPromote); } - bool RetrieveNextDLCContent() { return m_dlcController.retrieveNextDLCContent(); } + bool RetrieveNextDLCContent() { + return m_dlcController.retrieveNextDLCContent(); + } bool CheckTMSDLCCanStop() { return m_dlcController.checkTMSDLCCanStop(); } int dlcOffersReturned(int iOfferC, std::uint32_t dwType, int iPad) { return m_dlcController.dlcOffersReturned(iOfferC, dwType, iPad); @@ -1010,26 +1066,45 @@ public: return m_dlcController.dlcContentRetrieved(eType); } void TickDLCOffersRetrieved() { m_dlcController.tickDLCOffersRetrieved(); } - void ClearAndResetDLCDownloadQueue() { m_dlcController.clearAndResetDLCDownloadQueue(); } - bool RetrieveNextTMSPPContent() { return m_dlcController.retrieveNextTMSPPContent(); } - void TickTMSPPFilesRetrieved() { m_dlcController.tickTMSPPFilesRetrieved(); } - void ClearTMSPPFilesRetrieved() { m_dlcController.clearTMSPPFilesRetrieved(); } + void ClearAndResetDLCDownloadQueue() { + m_dlcController.clearAndResetDLCDownloadQueue(); + } + bool RetrieveNextTMSPPContent() { + return m_dlcController.retrieveNextTMSPPContent(); + } + void TickTMSPPFilesRetrieved() { + m_dlcController.tickTMSPPFilesRetrieved(); + } + void ClearTMSPPFilesRetrieved() { + m_dlcController.clearTMSPPFilesRetrieved(); + } unsigned int AddTMSPPFileTypeRequest(eDLCContentType eType, bool bPromote = false) { return m_dlcController.addTMSPPFileTypeRequest(eType, bPromote); } - int GetDLCInfoTexturesOffersCount() { return m_dlcController.getDLCInfoTexturesOffersCount(); } + int GetDLCInfoTexturesOffersCount() { + return m_dlcController.getDLCInfoTexturesOffersCount(); + } static int TMSPPFileReturned(void* pParam, int iPad, int iUserData, IPlatformStorage::PTMSPP_FILEDATA pFileData, const char* szFilename) { - return DLCController::tmsPPFileReturned(pParam, iPad, iUserData, pFileData, szFilename); + return DLCController::tmsPPFileReturned(pParam, iPad, iUserData, + pFileData, szFilename); + } + DLC_INFO* GetDLCInfoTrialOffer(int iIndex) { + return m_dlcController.getDLCInfoTrialOffer(iIndex); + } + DLC_INFO* GetDLCInfoFullOffer(int iIndex) { + return m_dlcController.getDLCInfoFullOffer(iIndex); } - DLC_INFO* GetDLCInfoTrialOffer(int iIndex) { return m_dlcController.getDLCInfoTrialOffer(iIndex); } - DLC_INFO* GetDLCInfoFullOffer(int iIndex) { return m_dlcController.getDLCInfoFullOffer(iIndex); } - int GetDLCInfoTrialOffersCount() { return m_dlcController.getDLCInfoTrialOffersCount(); } - int GetDLCInfoFullOffersCount() { return m_dlcController.getDLCInfoFullOffersCount(); } + int GetDLCInfoTrialOffersCount() { + return m_dlcController.getDLCInfoTrialOffersCount(); + } + int GetDLCInfoFullOffersCount() { + return m_dlcController.getDLCInfoFullOffersCount(); + } bool GetDLCFullOfferIDForPackID(const int iPackID, uint64_t* pullVal) { return m_dlcController.getDLCFullOfferIDForPackID(iPackID, pullVal); } @@ -1046,8 +1121,10 @@ public: // Download status members moved to DLCController bool m_bCorruptSaveDeleted; - std::uint8_t*& m_pBannedListFileBuffer = m_bannedListManager.m_pBannedListFileBuffer; - unsigned int& m_dwBannedListFileSize = m_bannedListManager.m_dwBannedListFileSize; + std::uint8_t*& m_pBannedListFileBuffer = + m_bannedListManager.m_pBannedListFileBuffer; + unsigned int& m_dwBannedListFileSize = + m_bannedListManager.m_dwBannedListFileSize; public: unsigned int& m_dwDLCFileSize = m_dlcController.m_dwDLCFileSize; @@ -1094,8 +1171,7 @@ public: int LoadLocalTMSFile(char* wchTMSFile, eFileExtensionType eExt) override = 0; void FreeLocalTMSFiles(eTMSFileType eType) override = 0; - int GetLocalTMSFileIndex(char* wchTMSFile, - bool bFilenameIncludesExtension, + int GetLocalTMSFileIndex(char* wchTMSFile, bool bFilenameIncludesExtension, eFileExtensionType eEXT) override = 0; virtual bool GetTMSGlobalFileListRead() { return true; } @@ -1132,7 +1208,9 @@ private: // 4J-PB - language and locale functions public: - void LocaleAndLanguageInit() { m_localizationManager.localeAndLanguageInit(); } + void LocaleAndLanguageInit() { + m_localizationManager.localeAndLanguageInit(); + } void getLocale(std::vector& vecWstrLocales) { m_localizationManager.getLocale(vecWstrLocales); } @@ -1143,15 +1221,17 @@ public: return m_localizationManager.get_xcLang(pwchLocale); } - void SetTickTMSDLCFiles(bool bVal) { m_dlcController.setTickTMSDLCFiles(bVal); } + void SetTickTMSDLCFiles(bool bVal) { + m_dlcController.setTickTMSDLCFiles(bVal); + } std::string getFilePath(std::uint32_t packId, std::string filename, - bool bAddDataFolder, - std::string mountPoint = "TPACK:"); + bool bAddDataFolder, + std::string mountPoint = "TPACK:"); private: std::string getRootPath(std::uint32_t packId, bool allowOverride, - bool bAddDataFolder, std::string mountPoint); + bool bAddDataFolder, std::string mountPoint); public: #if defined(_WINDOWS64) @@ -1161,6 +1241,5 @@ public: #endif }; - // singleton // extern CMinecraftApp app; \ No newline at end of file diff --git a/targets/app/common/GameMenuService.cpp b/targets/app/common/GameMenuService.cpp index a264ed789..7ed1b82c1 100644 --- a/targets/app/common/GameMenuService.cpp +++ b/targets/app/common/GameMenuService.cpp @@ -2,57 +2,88 @@ #include "app/common/Game.h" -bool GameMenuService::openInventory(int iPad, std::shared_ptr player, bool navigateBack) { +bool GameMenuService::openInventory(int iPad, + std::shared_ptr player, + bool navigateBack) { return game_.LoadInventoryMenu(iPad, player, navigateBack); } -bool GameMenuService::openCreative(int iPad, std::shared_ptr player, bool navigateBack) { +bool GameMenuService::openCreative(int iPad, + std::shared_ptr player, + bool navigateBack) { return game_.LoadCreativeMenu(iPad, player, navigateBack); } -bool GameMenuService::openCrafting2x2(int iPad, std::shared_ptr player) { +bool GameMenuService::openCrafting2x2(int iPad, + std::shared_ptr player) { return game_.LoadCrafting2x2Menu(iPad, player); } -bool GameMenuService::openCrafting3x3(int iPad, std::shared_ptr player, int x, int y, int z) { +bool GameMenuService::openCrafting3x3(int iPad, + std::shared_ptr player, + int x, int y, int z) { return game_.LoadCrafting3x3Menu(iPad, player, x, y, z); } -bool GameMenuService::openEnchanting(int iPad, std::shared_ptr inventory, int x, int y, int z, Level* level, const std::string& name) { +bool GameMenuService::openEnchanting(int iPad, + std::shared_ptr inventory, + int x, int y, int z, Level* level, + const std::string& name) { return game_.LoadEnchantingMenu(iPad, inventory, x, y, z, level, name); } -bool GameMenuService::openFurnace(int iPad, std::shared_ptr inventory, std::shared_ptr furnace) { +bool GameMenuService::openFurnace(int iPad, + std::shared_ptr inventory, + std::shared_ptr furnace) { return game_.LoadFurnaceMenu(iPad, inventory, furnace); } -bool GameMenuService::openBrewingStand(int iPad, std::shared_ptr inventory, std::shared_ptr brewingStand) { +bool GameMenuService::openBrewingStand( + int iPad, std::shared_ptr inventory, + std::shared_ptr brewingStand) { return game_.LoadBrewingStandMenu(iPad, inventory, brewingStand); } -bool GameMenuService::openContainer(int iPad, std::shared_ptr inventory, std::shared_ptr container) { +bool GameMenuService::openContainer(int iPad, + std::shared_ptr inventory, + std::shared_ptr container) { return game_.LoadContainerMenu(iPad, inventory, container); } -bool GameMenuService::openTrap(int iPad, std::shared_ptr inventory, std::shared_ptr trap) { +bool GameMenuService::openTrap(int iPad, std::shared_ptr inventory, + std::shared_ptr trap) { return game_.LoadTrapMenu(iPad, inventory, trap); } -bool GameMenuService::openFireworks(int iPad, std::shared_ptr player, int x, int y, int z) { +bool GameMenuService::openFireworks(int iPad, + std::shared_ptr player, int x, + int y, int z) { return game_.LoadFireworksMenu(iPad, player, x, y, z); } bool GameMenuService::openSign(int iPad, std::shared_ptr sign) { return game_.LoadSignEntryMenu(iPad, sign); } -bool GameMenuService::openRepairing(int iPad, std::shared_ptr inventory, Level* level, int x, int y, int z) { +bool GameMenuService::openRepairing(int iPad, + std::shared_ptr inventory, + Level* level, int x, int y, int z) { return game_.LoadRepairingMenu(iPad, inventory, level, x, y, z); } -bool GameMenuService::openTrading(int iPad, std::shared_ptr inventory, std::shared_ptr trader, Level* level, const std::string& name) { +bool GameMenuService::openTrading(int iPad, + std::shared_ptr inventory, + std::shared_ptr trader, + Level* level, const std::string& name) { return game_.LoadTradingMenu(iPad, inventory, trader, level, name); } -bool GameMenuService::openCommandBlock(int iPad, std::shared_ptr commandBlock) { +bool GameMenuService::openCommandBlock( + int iPad, std::shared_ptr commandBlock) { return game_.LoadCommandBlockMenu(iPad, commandBlock); } -bool GameMenuService::openHopper(int iPad, std::shared_ptr inventory, std::shared_ptr hopper) { +bool GameMenuService::openHopper(int iPad, std::shared_ptr inventory, + std::shared_ptr hopper) { return game_.LoadHopperMenu(iPad, inventory, hopper); } -bool GameMenuService::openHopperMinecart(int iPad, std::shared_ptr inventory, std::shared_ptr hopper) { +bool GameMenuService::openHopperMinecart( + int iPad, std::shared_ptr inventory, + std::shared_ptr hopper) { return game_.LoadHopperMenu(iPad, inventory, hopper); } -bool GameMenuService::openHorse(int iPad, std::shared_ptr inventory, std::shared_ptr container, std::shared_ptr horse) { +bool GameMenuService::openHorse(int iPad, std::shared_ptr inventory, + std::shared_ptr container, + std::shared_ptr horse) { return game_.LoadHorseMenu(iPad, inventory, container, horse); } -bool GameMenuService::openBeacon(int iPad, std::shared_ptr inventory, std::shared_ptr beacon) { +bool GameMenuService::openBeacon(int iPad, std::shared_ptr inventory, + std::shared_ptr beacon) { return game_.LoadBeaconMenu(iPad, inventory, beacon); } diff --git a/targets/app/common/GameMenuService.h b/targets/app/common/GameMenuService.h index a864deb6e..744f38544 100644 --- a/targets/app/common/GameMenuService.h +++ b/targets/app/common/GameMenuService.h @@ -40,9 +40,8 @@ public: int iPad, std::shared_ptr commandBlock) override; bool openHopper(int iPad, std::shared_ptr inventory, std::shared_ptr hopper) override; - bool openHopperMinecart( - int iPad, std::shared_ptr inventory, - std::shared_ptr hopper) override; + bool openHopperMinecart(int iPad, std::shared_ptr inventory, + std::shared_ptr hopper) override; bool openHorse(int iPad, std::shared_ptr inventory, std::shared_ptr container, std::shared_ptr horse) override; diff --git a/targets/app/common/GameRules/ConsoleGameRules.h b/targets/app/common/GameRules/ConsoleGameRules.h index a4c57d938..6f27b83d1 100644 --- a/targets/app/common/GameRules/ConsoleGameRules.h +++ b/targets/app/common/GameRules/ConsoleGameRules.h @@ -5,7 +5,6 @@ #include "app/common/GameRules/LevelGeneration/BiomeOverride.h" #include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.h" #include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h" -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "app/common/GameRules/LevelGeneration/StartFeature.h" #include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.h" #include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h" @@ -16,10 +15,11 @@ #include "app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h" -#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.h" #include "minecraft/world/level/GameRules/GameRule.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "minecraft/world/level/GameRules/GameRulesInstance.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" diff --git a/targets/app/common/GameRules/GameRuleManager.cpp b/targets/app/common/GameRules/GameRuleManager.cpp index a090c4dcb..af49ff1c6 100644 --- a/targets/app/common/GameRules/GameRuleManager.cpp +++ b/targets/app/common/GameRules/GameRuleManager.cpp @@ -13,20 +13,20 @@ #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" #include "app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h" -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "app/common/GameRules/LevelGeneration/LevelGenerators.h" #include "app/common/GameRules/LevelRules/LevelRules.h" -#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h" -#include "minecraft/locale/StringTable.h" #include "app/linux/LinuxGame.h" -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "java/File.h" #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/ByteArrayOutputStream.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" +#include "minecraft/locale/StringTable.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "strings.h" const char* GameRuleManager::wchTagNameA[] = { diff --git a/targets/app/common/GameRules/GameRuleManager.h b/targets/app/common/GameRules/GameRuleManager.h index dc660f6a7..7f3020851 100644 --- a/targets/app/common/GameRules/GameRuleManager.h +++ b/targets/app/common/GameRules/GameRuleManager.h @@ -8,9 +8,9 @@ #include #include "app/common/DLC/DLCGameRulesHeader.h" -#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelGeneration/LevelGenerators.h" #include "app/common/GameRules/LevelRules/LevelRules.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" class LevelGenerationOptions; class RootGameRulesDefinition; diff --git a/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp b/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp index 2de23bbf0..3ace1743e 100644 --- a/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp @@ -4,16 +4,16 @@ #include #include "ConsoleSchematicFile.h" -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" +#include "app/linux/LinuxGame.h" +#include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "minecraft/world/level/GameRules/GameRuleDefinition.h" -#include "app/linux/LinuxGame.h" -#include "util/StringHelpers.h" -#include "java/InputOutputStream/DataOutputStream.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/chunk/LevelChunk.h" #include "minecraft/world/level/dimension/Dimension.h" #include "minecraft/world/phys/AABB.h" +#include "util/StringHelpers.h" ApplySchematicRuleDefinition::ApplySchematicRuleDefinition( LevelGenerationOptions* levelGenOptions) { diff --git a/targets/app/common/GameRules/LevelGeneration/BiomeOverride.cpp b/targets/app/common/GameRules/LevelGeneration/BiomeOverride.cpp index f6984daf0..5886fb321 100644 --- a/targets/app/common/GameRules/LevelGeneration/BiomeOverride.cpp +++ b/targets/app/common/GameRules/LevelGeneration/BiomeOverride.cpp @@ -1,10 +1,10 @@ #include "BiomeOverride.h" +#include "app/linux/LinuxGame.h" +#include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "minecraft/world/level/GameRules/GameRuleDefinition.h" -#include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" -#include "java/InputOutputStream/DataOutputStream.h" BiomeOverride::BiomeOverride() { m_tile = 0; diff --git a/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.cpp b/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.cpp index 15bd9823a..2ceeb4e76 100644 --- a/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.cpp +++ b/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.cpp @@ -4,20 +4,20 @@ #include -#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h" #include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.h" #include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h" #include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.h" #include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.h" -#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "app/linux/LinuxGame.h" -#include "util/StringHelpers.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/Direction.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/dimension/Dimension.h" #include "minecraft/world/level/levelgen/structure/BoundingBox.h" +#include "util/StringHelpers.h" ConsoleGenerateStructure::ConsoleGenerateStructure() : StructurePiece(0) { m_x = m_y = m_z = 0; @@ -77,8 +77,8 @@ void ConsoleGenerateStructure::writeAttributes(DataOutputStream* dos, dos->writeUTF(toWString(m_dimension)); } -void ConsoleGenerateStructure::addAttribute( - const std::string& attributeName, const std::string& attributeValue) { +void ConsoleGenerateStructure::addAttribute(const std::string& attributeName, + const std::string& attributeValue) { if (attributeName.compare("x") == 0) { int value = fromWString(attributeValue); m_x = value; diff --git a/targets/app/common/GameRules/LevelGeneration/ConsoleSchematicFile.cpp b/targets/app/common/GameRules/LevelGeneration/ConsoleSchematicFile.cpp index df109f509..ccac746a8 100644 --- a/targets/app/common/GameRules/LevelGeneration/ConsoleSchematicFile.cpp +++ b/targets/app/common/GameRules/LevelGeneration/ConsoleSchematicFile.cpp @@ -9,7 +9,6 @@ #include #include "app/linux/LinuxGame.h" -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "java/Class.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" @@ -21,6 +20,7 @@ #include "minecraft/world/level/LightLayer.h" #include "minecraft/world/level/TilePos.h" #include "minecraft/world/level/chunk/LevelChunk.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/level/tile/entity/TileEntity.h" #include "minecraft/world/phys/AABB.h" @@ -749,9 +749,9 @@ void ConsoleSchematicFile::generateSchematicFile( bool mobCanBeSaved = false; if (bSaveMobs) { - if (e->instanceof(eTYPE_MONSTER) || - e->instanceof(eTYPE_WATERANIMAL) || - e->instanceof(eTYPE_ANIMAL) || (e->GetType() == eTYPE_VILLAGER)) + if (e->instanceof (eTYPE_MONSTER) || e->instanceof + (eTYPE_WATERANIMAL) || e->instanceof + (eTYPE_ANIMAL) || (e->GetType() == eTYPE_VILLAGER)) // 4J-JEV: All these are derived from eTYPE_ANIMAL and true // implicitly. @@ -765,8 +765,9 @@ void ConsoleSchematicFile::generateSchematicFile( // 4J-JEV: Changed to check for instances of minecarts and // hangingEntities instead of just eTYPE_PAINTING, eTYPE_ITEM_FRAME and // eTYPE_MINECART - if (mobCanBeSaved || e->instanceof(eTYPE_MINECART) || - e->GetType() == eTYPE_BOAT || e->instanceof(eTYPE_HANGING_ENTITY)) { + if (mobCanBeSaved || e->instanceof + (eTYPE_MINECART) || e->GetType() == eTYPE_BOAT || e->instanceof + (eTYPE_HANGING_ENTITY)) { CompoundTag* eTag = new CompoundTag(); if (e->save(eTag)) { ListTag* pos = @@ -776,7 +777,7 @@ void ConsoleSchematicFile::generateSchematicFile( pos->get(1)->data -= yStart; pos->get(2)->data -= zStart; - if (e->instanceof(eTYPE_HANGING_ENTITY)) { + if (e->instanceof (eTYPE_HANGING_ENTITY)) { ((IntTag*)eTag->get("TileX"))->data -= xStart; ((IntTag*)eTag->get("TileY"))->data -= yStart; ((IntTag*)eTag->get("TileZ"))->data -= zStart; diff --git a/targets/app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h b/targets/app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h index bfc5c0cae..e51e3d46e 100644 --- a/targets/app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h +++ b/targets/app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h @@ -14,7 +14,6 @@ #include #include "minecraft/XuiActionPayload.h" - #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "minecraft/world/phys/Vec3.h" diff --git a/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp b/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp index a68e1de49..d92c82e0f 100644 --- a/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp +++ b/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp @@ -6,7 +6,6 @@ #include #include -#include "minecraft/GameEnums.h" #include "app/common/DLC/DLCGameRulesHeader.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" @@ -16,14 +15,15 @@ #include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.h" #include "app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h" #include "app/common/GameRules/LevelGeneration/StartFeature.h" -#include "minecraft/world/level/GameRules/GameRuleDefinition.h" -#include "minecraft/locale/StringTable.h" #include "app/linux/LinuxGame.h" #include "java/File.h" #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" +#include "minecraft/GameEnums.h" #include "minecraft/Pos.h" +#include "minecraft/locale/StringTable.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/chunk/LevelChunk.h" #include "minecraft/world/level/dimension/Dimension.h" @@ -440,8 +440,7 @@ ConsoleSchematicFile* LevelGenerationOptions::loadSchematicFile( auto it = m_schematics.find(filename); if (it != m_schematics.end()) { #if !defined(_CONTENT_PACKAGE) - printf("We have already loaded schematic file %s\n", - filename.c_str()); + printf("We have already loaded schematic file %s\n", filename.c_str()); #endif it->second->incrementRefCount(); return it->second; @@ -470,8 +469,7 @@ ConsoleSchematicFile* LevelGenerationOptions::getSchematicFile( return schematic; } -void LevelGenerationOptions::releaseSchematicFile( - const std::string& filename) { +void LevelGenerationOptions::releaseSchematicFile(const std::string& filename) { // 4J Stu - We don't want to delete them when done, but probably want to // keep a set of active schematics for the current world // auto it = m_schematics.find(filename); @@ -627,7 +625,8 @@ int LevelGenerationOptions::onPackMounted(int iPad, uint32_t dwErr, uint8_t* pbData = (uint8_t*)new uint8_t[dwFileSize]; auto readResult = PlatformFilesystem.readFile( save.getPath(), pbData, dwFileSize); - if (readResult.status != IPlatformFilesystem::ReadStatus::Ok) { + if (readResult.status != + IPlatformFilesystem::ReadStatus::Ok) { app.FatalLoadError(); } diff --git a/targets/app/common/GameRules/LevelGeneration/StartFeature.cpp b/targets/app/common/GameRules/LevelGeneration/StartFeature.cpp index d18b6a1d0..76299849d 100644 --- a/targets/app/common/GameRules/LevelGeneration/StartFeature.cpp +++ b/targets/app/common/GameRules/LevelGeneration/StartFeature.cpp @@ -1,10 +1,10 @@ #include "StartFeature.h" +#include "app/linux/LinuxGame.h" +#include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "minecraft/world/level/GameRules/GameRuleDefinition.h" -#include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" -#include "java/InputOutputStream/DataOutputStream.h" StartFeature::StartFeature() { m_chunkX = 0; diff --git a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.cpp b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.cpp index f778e2098..5cf0fdeda 100644 --- a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.cpp +++ b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.cpp @@ -1,12 +1,12 @@ #include "XboxStructureActionGenerateBox.h" -#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h" -#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "app/linux/LinuxGame.h" -#include "util/StringHelpers.h" #include "java/InputOutputStream/DataOutputStream.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "minecraft/world/level/levelgen/structure/StructurePiece.h" +#include "util/StringHelpers.h" XboxStructureActionGenerateBox::XboxStructureActionGenerateBox() { m_x0 = m_y0 = m_z0 = m_x1 = m_y1 = m_z1 = m_edgeTile = m_fillTile = 0; diff --git a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.h b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.h index 751d87c21..e6da1f4f3 100644 --- a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.h +++ b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.h @@ -1,8 +1,8 @@ #pragma once #include -#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" class StructurePiece; class Level; diff --git a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.cpp b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.cpp index e564b421b..34299492b 100644 --- a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.cpp +++ b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.cpp @@ -1,12 +1,12 @@ #include "XboxStructureActionPlaceBlock.h" -#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h" -#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "app/linux/LinuxGame.h" -#include "util/StringHelpers.h" #include "java/InputOutputStream/DataOutputStream.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "minecraft/world/level/levelgen/structure/StructurePiece.h" +#include "util/StringHelpers.h" XboxStructureActionPlaceBlock::XboxStructureActionPlaceBlock() { m_x = m_y = m_z = m_tile = m_data = 0; diff --git a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h index 8ae640e6d..7745a3039 100644 --- a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h +++ b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h @@ -1,8 +1,8 @@ #pragma once #include -#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" class StructurePiece; class Level; diff --git a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.cpp b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.cpp index 04e5676bc..68d512003 100644 --- a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.cpp +++ b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.cpp @@ -4,17 +4,17 @@ #include -#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.h" #include "app/linux/LinuxGame.h" -#include "util/StringHelpers.h" #include "minecraft/world/Container.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/levelgen/structure/BoundingBox.h" #include "minecraft/world/level/levelgen/structure/StructurePiece.h" #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/level/tile/entity/TileEntity.h" +#include "util/StringHelpers.h" XboxStructureActionPlaceContainer::XboxStructureActionPlaceContainer() { m_tile = Tile::chest_Id; diff --git a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.h b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.h index 5f002ed9a..790311c51 100644 --- a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.h +++ b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.h @@ -3,8 +3,8 @@ #include #include -#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "XboxStructureActionPlaceBlock.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" class AddItemRuleDefinition; class StructurePiece; diff --git a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.cpp b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.cpp index c950aad2f..7d6770857 100644 --- a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.cpp +++ b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.cpp @@ -4,9 +4,9 @@ #include -#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h" #include "java/InputOutputStream/DataOutputStream.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/levelgen/structure/BoundingBox.h" #include "minecraft/world/level/levelgen/structure/StructurePiece.h" @@ -33,9 +33,8 @@ void XboxStructureActionPlaceSpawner::addAttribute( if (attributeName.compare("entity") == 0) { m_entityId = attributeValue; #ifndef _CONTENT_PACKAGE - printf( - "XboxStructureActionPlaceSpawner: Adding parameter entity=%s\n", - m_entityId.c_str()); + printf("XboxStructureActionPlaceSpawner: Adding parameter entity=%s\n", + m_entityId.c_str()); #endif } else { XboxStructureActionPlaceBlock::addAttribute(attributeName, diff --git a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.h b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.h index be54cdec1..8b5304a57 100644 --- a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.h +++ b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.h @@ -2,8 +2,8 @@ #include -#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "XboxStructureActionPlaceBlock.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" class StructurePiece; class Level; diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.cpp index 47f31dba2..4d089fc17 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.cpp @@ -3,10 +3,7 @@ #include #include -#include "minecraft/world/level/ConsoleGameRulesConstants.h" -#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "app/linux/LinuxGame.h" -#include "util/StringHelpers.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/world/item/EnchantedBookItem.h" #include "minecraft/world/item/Item.h" @@ -14,6 +11,9 @@ #include "minecraft/world/item/enchantment/Enchantment.h" #include "minecraft/world/item/enchantment/EnchantmentCategory.h" #include "minecraft/world/item/enchantment/EnchantmentInstance.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" +#include "util/StringHelpers.h" AddEnchantmentRuleDefinition::AddEnchantmentRuleDefinition() { m_enchantmentId = m_enchantmentLevel = 0; diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.h b/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.h index ff4e002b5..5ef3b0e89 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.h +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.h @@ -3,8 +3,8 @@ #include #include -#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" class ItemInstance; diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.cpp index 999de21a9..f6b77869f 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.cpp @@ -3,14 +3,14 @@ #include #include "AddEnchantmentRuleDefinition.h" -#include "minecraft/world/level/ConsoleGameRulesConstants.h" -#include "minecraft/world/level/GameRules/GameRuleDefinition.h" -#include "util/StringHelpers.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/world/Container.h" #include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/item/ItemInstance.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" +#include "util/StringHelpers.h" AddItemRuleDefinition::AddItemRuleDefinition() { m_itemId = m_quantity = m_auxValue = m_dataTag = 0; diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.h b/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.h index 5c412ffed..e3b214884 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.h +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.h @@ -4,8 +4,8 @@ #include #include -#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" class Container; class AddEnchantmentRuleDefinition; diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.cpp index 51df8ccc2..3fe6282c6 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.cpp @@ -1,15 +1,15 @@ #include "CollectItemRuleDefinition.h" -#include "minecraft/world/level/ConsoleGameRulesConstants.h" -#include "minecraft/world/level/GameRules/GameRuleDefinition.h" -#include "minecraft/world/level/GameRules/GameRule.h" -#include "minecraft/world/level/GameRules/GameRulesInstance.h" #include "app/linux/LinuxGame.h" -#include "util/StringHelpers.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/network/Connection.h" #include "minecraft/network/packet/UpdateGameRuleProgressPacket.h" #include "minecraft/world/item/ItemInstance.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/GameRules/GameRule.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" +#include "minecraft/world/level/GameRules/GameRulesInstance.h" +#include "util/StringHelpers.h" CollectItemRuleDefinition::CollectItemRuleDefinition() { m_itemId = 0; @@ -111,8 +111,7 @@ std::string CollectItemRuleDefinition::generateXml( "\" quantity=\"SET\" descriptionName=\"OPTIONAL\" " "promptName=\"OPTIONAL\""; if (item->getAuxValue() != 0) - xml += - " auxValue=\"" + toWString(item->getAuxValue()) + "\""; + xml += " auxValue=\"" + toWString(item->getAuxValue()) + "\""; if (item->get4JData() != 0) xml += " dataTag=\"" + toWString(item->get4JData()) + "\""; xml += "/>\n"; diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.h b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.h index 2e35806d6..ee8251192 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.h +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.h @@ -3,8 +3,8 @@ #include #include -#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "minecraft/world/level/GameRules/GameRulesInstance.h" class Pos; diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.cpp index eab1737a4..c8431003b 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.cpp @@ -5,12 +5,12 @@ #include #include "app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h" -#include "minecraft/world/level/GameRules/GameRuleDefinition.h" -#include "minecraft/world/level/GameRules/GameRule.h" #include "app/linux/LinuxGame.h" -#include "util/StringHelpers.h" #include "minecraft/network/Connection.h" #include "minecraft/network/packet/UpdateGameRuleProgressPacket.h" +#include "minecraft/world/level/GameRules/GameRule.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" +#include "util/StringHelpers.h" void CompleteAllRuleDefinition::getChildren( std::vector* children) { diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.h b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.h index 9905aa7d7..ee100f28a 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.h +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.h @@ -25,8 +25,8 @@ public: virtual bool onCollectItem(GameRule* rule, std::shared_ptr item); - static std::string generateDescriptionString( - const std::string& description, void* data, int dataLength); + static std::string generateDescriptionString(const std::string& description, + void* data, int dataLength); private: void updateStatus(GameRule* rule); diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.cpp index a65ca3217..9a64816da 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.cpp @@ -7,13 +7,13 @@ #include #include -#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.h" -#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "minecraft/world/level/GameRules/GameRule.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "minecraft/world/level/GameRules/GameRulesInstance.h" #include "util/StringHelpers.h" diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h index 9227ba184..8f73b67dd 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h @@ -2,8 +2,8 @@ #include -#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "minecraft/world/level/GameRules/GameRulesInstance.h" class CompoundGameRuleDefinition : public GameRuleDefinition { diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.cpp index b5e3b8489..ea42d5261 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.cpp @@ -8,14 +8,14 @@ #include #include -#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h" +#include "app/linux/LinuxGame.h" +#include "java/InputOutputStream/DataOutputStream.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "minecraft/world/level/GameRules/GameRule.h" #include "minecraft/world/level/GameRules/GameRulesInstance.h" -#include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" -#include "java/InputOutputStream/DataOutputStream.h" class Connection; @@ -66,7 +66,7 @@ GameRuleDefinition* GameRuleDefinition::addChild( ConsoleGameRules::EGameRuleType ruleType) { #ifndef _CONTENT_PACKAGE printf("GameRuleDefinition: Attempted to add invalid child rule - %d\n", - ruleType); + ruleType); #endif return nullptr; } @@ -77,13 +77,13 @@ void GameRuleDefinition::addAttribute(const std::string& attributeName, m_descriptionId = attributeValue; #ifndef _CONTENT_PACKAGE printf("GameRuleDefinition: Adding parameter descriptionId=%s\n", - m_descriptionId.c_str()); + m_descriptionId.c_str()); #endif } else if (attributeName.compare("promptName") == 0) { m_promptId = attributeValue; #ifndef _CONTENT_PACKAGE printf("GameRuleDefinition: Adding parameter m_promptId=%s\n", - m_promptId.c_str()); + m_promptId.c_str()); #endif } else if (attributeName.compare("dataTag") == 0) { m_4JDataValue = fromWString(attributeValue); @@ -92,9 +92,8 @@ void GameRuleDefinition::addAttribute(const std::string& attributeName, m_4JDataValue); } else { #ifndef _CONTENT_PACKAGE - printf( - "GameRuleDefinition: Attempted to add invalid attribute: %s\n", - attributeName.c_str()); + printf("GameRuleDefinition: Attempted to add invalid attribute: %s\n", + attributeName.c_str()); #endif } } diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.cpp index 9f9a2a2ec..67342dfe7 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.cpp @@ -1,9 +1,9 @@ #include "LevelRuleset.h" -#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.h" #include "minecraft/locale/StringTable.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" class AABB; diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.cpp index 80038ff79..456bc4e48 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.cpp @@ -2,11 +2,11 @@ #include +#include "app/linux/LinuxGame.h" +#include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "minecraft/world/level/GameRules/GameRuleDefinition.h" -#include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" -#include "java/InputOutputStream/DataOutputStream.h" NamedAreaRuleDefinition::NamedAreaRuleDefinition() { m_name = ""; @@ -41,7 +41,7 @@ void NamedAreaRuleDefinition::addAttribute(const std::string& attributeName, m_name = attributeValue; #ifndef _CONTENT_PACKAGE printf("NamedAreaRuleDefinition: Adding parameter name=%s\n", - m_name.c_str()); + m_name.c_str()); #endif } else if (attributeName.compare("x0") == 0) { m_area.x0 = fromWString(attributeValue); diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.h b/targets/app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.h index 2c90d7479..7bac12e77 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.h +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.h @@ -2,8 +2,8 @@ #include -#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "minecraft/world/phys/AABB.h" class NamedAreaRuleDefinition : public GameRuleDefinition { diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.cpp index f4a128cd0..b29b7911d 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.cpp @@ -4,16 +4,16 @@ #include -#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.h" -#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "app/linux/LinuxGame.h" -#include "util/StringHelpers.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/Pos.h" #include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/food/FoodData.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" +#include "util/StringHelpers.h" UpdatePlayerRuleDefinition::UpdatePlayerRuleDefinition() { m_bUpdateHealth = m_bUpdateFood = m_bUpdateYRot = false; diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.h b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.h index eb25a6256..5e4eb68cf 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.h +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.h @@ -4,8 +4,8 @@ #include #include -#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" class AddItemRuleDefinition; class Pos; diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.cpp index 3cfd9e224..b29ab5797 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.cpp @@ -1,10 +1,10 @@ #include "UseTileRuleDefinition.h" +#include "app/linux/LinuxGame.h" +#include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "minecraft/world/level/GameRules/GameRuleDefinition.h" -#include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" -#include "java/InputOutputStream/DataOutputStream.h" UseTileRuleDefinition::UseTileRuleDefinition() { m_tileId = -1; diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.h b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.h index 998786837..8e9f6872d 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.h +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.h @@ -3,9 +3,9 @@ #include -#include "minecraft/world/level/GameRules/GameRuleDefinition.h" -#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "minecraft/Pos.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" class UseTileRuleDefinition : public GameRuleDefinition { private: diff --git a/targets/app/common/GameRules/LevelRules/Rules/GameRule.cpp b/targets/app/common/GameRules/LevelRules/Rules/GameRule.cpp index fa035db9e..77e58f556 100644 --- a/targets/app/common/GameRules/LevelRules/Rules/GameRule.cpp +++ b/targets/app/common/GameRules/LevelRules/Rules/GameRule.cpp @@ -8,9 +8,9 @@ #include #include -#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" class Connection; class ItemInstance; @@ -32,15 +32,14 @@ GameRule::ValueType GameRule::getParameter(const std::string& parameterName) { if (m_parameters.find(parameterName) == m_parameters.end()) { #ifndef _CONTENT_PACKAGE printf("WARNING: Parameter %s was not set before being fetched\n", - parameterName.c_str()); + parameterName.c_str()); assert(0); #endif } return m_parameters[parameterName]; } -void GameRule::setParameter(const std::string& parameterName, - ValueType value) { +void GameRule::setParameter(const std::string& parameterName, ValueType value) { if (m_parameters.find(parameterName) == m_parameters.end()) { #ifndef _CONTENT_PACKAGE printf("Adding parameter %s to GameRule\n", parameterName.c_str()); diff --git a/targets/app/common/GameSettingsManager.h b/targets/app/common/GameSettingsManager.h index 293969b20..bad5dfbf9 100644 --- a/targets/app/common/GameSettingsManager.h +++ b/targets/app/common/GameSettingsManager.h @@ -3,8 +3,8 @@ #include #include "app/common/App_structs.h" -#include "platform/profile/profile.h" #include "platform/XboxStubs.h" +#include "platform/profile/profile.h" class GameSettingsManager { public: @@ -14,9 +14,9 @@ public: static int oldProfileVersionCallback(void* pParam, unsigned char* pucData, const unsigned short usVersion, const int iPad); - static int defaultOptionsCallback(void* pParam, - IPlatformProfile::PROFILESETTINGS* pSettings, - const int iPad); + static int defaultOptionsCallback( + void* pParam, IPlatformProfile::PROFILESETTINGS* pSettings, + const int iPad); int setDefaultOptions(IPlatformProfile::PROFILESETTINGS* pSettings, const int iPad); @@ -64,7 +64,8 @@ public: static void setActionConfirmed(void* param); // Saving message - int displaySavingMessage(const IPlatformStorage::ESavingMessage eMsg, int iPad); + int displaySavingMessage(const IPlatformStorage::ESavingMessage eMsg, + int iPad); // Game settings array - public, referenced by Game via alias GAME_SETTINGS* GameSettingsA[XUSER_MAX_COUNT]; diff --git a/targets/app/common/Game_XuiActions.cpp b/targets/app/common/Game_XuiActions.cpp index 9dba39495..673e52980 100644 --- a/targets/app/common/Game_XuiActions.cpp +++ b/targets/app/common/Game_XuiActions.cpp @@ -1,9 +1,8 @@ -#include "minecraft/GameTypes.h" +#include "app/common/Audio/SoundEngine.h" #include "app/common/DLC/DLCManager.h" #include "app/common/Game.h" #include "app/common/GameRules/GameRuleManager.h" #include "app/common/Network/GameNetworkManager.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" @@ -11,6 +10,7 @@ #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "minecraft/GameEnums.h" +#include "minecraft/GameTypes.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/Options.h" #include "minecraft/client/ProgressRenderer.h" @@ -25,13 +25,13 @@ #include "minecraft/client/skins/DLCTexturePack.h" #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/stats/StatsCounter.h" #include "platform/PlatformTypes.h" #include "platform/profile/profile.h" #include "platform/storage/storage.h" #include "util/StringHelpers.h" -#include "app/common/Audio/SoundEngine.h" void Game::HandleXuiActions(void) { eXuiAction eAction; @@ -215,8 +215,8 @@ void Game::HandleXuiActions(void) { // app.CloseAllPlayersXuiScenes(); // Hide the other players scenes - ui.ShowOtherPlayersBaseScene(PlatformProfile.GetPrimaryPad(), - false); + ui.ShowOtherPlayersBaseScene( + PlatformProfile.GetPrimaryPad(), false); // This just allows it to be shown if (pMinecraft @@ -1148,7 +1148,8 @@ void Game::HandleXuiActions(void) { } break; case eAppAction_SetDefaultOptions: SetAction(i, eAppAction_Idle); - SetDefaultOptions((IPlatformProfile::PROFILESETTINGS*)param, i); + SetDefaultOptions((IPlatformProfile::PROFILESETTINGS*)param, + i); // if the profile data has been changed, then force a // profile write It seems we're allowed to break the 5 @@ -1211,10 +1212,11 @@ void Game::HandleXuiActions(void) { case eAppAction_FailedToJoinNoPrivileges: { unsigned int uiIDA[1]; uiIDA[0] = IDS_CONFIRM_OK; - IPlatformStorage::EMessageResult result = ui.RequestErrorMessage( - IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, - IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA, 1, - PlatformProfile.GetPrimaryPad()); + IPlatformStorage::EMessageResult result = + ui.RequestErrorMessage( + IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, + IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA, 1, + PlatformProfile.GetPrimaryPad()); if (result != IPlatformStorage::EMessage_Busy) SetAction(i, eAppAction_Idle); } break; @@ -1282,9 +1284,7 @@ void Game::HandleXuiActions(void) { } break; case eAppAction_DebugText: // launch the xui for text entry - { - SetAction(i, eAppAction_Idle); - } + { SetAction(i, eAppAction_Idle); } break; case eAppAction_ReloadTexturePack: { diff --git a/targets/app/common/IPlatformGame.h b/targets/app/common/IPlatformGame.h index 033c3c26e..5ded22b07 100644 --- a/targets/app/common/IPlatformGame.h +++ b/targets/app/common/IPlatformGame.h @@ -21,8 +21,7 @@ public: bool bCallback = false) = 0; virtual int LoadLocalTMSFile(char* wchTMSFile) = 0; - virtual int LoadLocalTMSFile(char* wchTMSFile, - eFileExtensionType eExt) = 0; + virtual int LoadLocalTMSFile(char* wchTMSFile, eFileExtensionType eExt) = 0; virtual void FreeLocalTMSFiles(eTMSFileType eType) = 0; virtual int GetLocalTMSFileIndex(char* wchTMSFile, bool bFilenameIncludesExtension, diff --git a/targets/app/common/Leaderboards/IPlatformLeaderboard.h b/targets/app/common/Leaderboards/IPlatformLeaderboard.h index f0f164ba9..cc800f317 100644 --- a/targets/app/common/Leaderboards/IPlatformLeaderboard.h +++ b/targets/app/common/Leaderboards/IPlatformLeaderboard.h @@ -166,8 +166,7 @@ public: unsigned int readCount) = 0; virtual bool ReadStats_MyScore(LeaderboardReadListener* callback, int difficulty, EStatsType type, - PlayerUID myUID, - unsigned int readCount) = 0; + PlayerUID myUID, unsigned int readCount) = 0; virtual bool ReadStats_TopRank(LeaderboardReadListener* callback, int difficulty, EStatsType type, unsigned int startIndex, diff --git a/targets/app/common/Leaderboards/LeaderboardInterface.h b/targets/app/common/Leaderboards/LeaderboardInterface.h index 0b689ba0a..4931ed643 100644 --- a/targets/app/common/Leaderboards/LeaderboardInterface.h +++ b/targets/app/common/Leaderboards/LeaderboardInterface.h @@ -1,7 +1,7 @@ #pragma once -#include "platform/PlatformTypes.h" #include "LeaderboardManager.h" +#include "platform/PlatformTypes.h" // 4J-JEV: Simple interface for handling ReadStat failures. class LeaderboardInterface { @@ -23,11 +23,12 @@ public: ~LeaderboardInterface(); void ReadStats_Friends(LeaderboardReadListener* callback, int difficulty, - IPlatformLeaderboard::EStatsType type, PlayerUID myUID, - unsigned int startIndex, unsigned int readCount); - void ReadStats_MyScore(LeaderboardReadListener* callback, int difficulty, - IPlatformLeaderboard::EStatsType type, PlayerUID myUID, + IPlatformLeaderboard::EStatsType type, + PlayerUID myUID, unsigned int startIndex, unsigned int readCount); + void ReadStats_MyScore(LeaderboardReadListener* callback, int difficulty, + IPlatformLeaderboard::EStatsType type, + PlayerUID myUID, unsigned int readCount); void ReadStats_TopRank(LeaderboardReadListener* callback, int difficulty, IPlatformLeaderboard::EStatsType type, unsigned int startIndex, unsigned int readCount); diff --git a/targets/app/common/Leaderboards/LeaderboardManager.cpp b/targets/app/common/Leaderboards/LeaderboardManager.cpp index 894293a8f..49aa9825c 100644 --- a/targets/app/common/Leaderboards/LeaderboardManager.cpp +++ b/targets/app/common/Leaderboards/LeaderboardManager.cpp @@ -83,8 +83,7 @@ void LeaderboardManager::printStats(ReadView& view) { for (unsigned int i = 0; i < view.m_numQueries; i++) { ReadScore score = view.m_queries[i]; - app.DebugPrintf("\tname='%s'\n", - score.m_name.c_str()); + app.DebugPrintf("\tname='%s'\n", score.m_name.c_str()); app.DebugPrintf("\trank='%i'\n", score.m_rank); app.DebugPrintf("\tstatsData=["); diff --git a/targets/app/common/Localisation/StringTable.cpp b/targets/app/common/Localisation/StringTable.cpp index e0e1bcae7..90789035f 100644 --- a/targets/app/common/Localisation/StringTable.cpp +++ b/targets/app/common/Localisation/StringTable.cpp @@ -38,7 +38,7 @@ void StringTable::ProcessStringTableData(void) { langSizeMap.push_back( std::vector >::value_type(langId, - langSize)); + langSize)); } std::vector locales; diff --git a/targets/app/common/LocalizationManager.cpp b/targets/app/common/LocalizationManager.cpp index c4b975d5e..1e78ed248 100644 --- a/targets/app/common/LocalizationManager.cpp +++ b/targets/app/common/LocalizationManager.cpp @@ -6,24 +6,23 @@ #include -#include "minecraft/GameEnums.h" #include "app/common/App_structs.h" -#include "minecraft/locale/StringTable.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "app/common/UI/All Platforms/ArchiveFile.h" #include "app/linux/LinuxGame.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" +#include "minecraft/locale/StringTable.h" +#include "platform/XboxStubs.h" #include "platform/input/input.h" #include "platform/renderer/renderer.h" -#include "platform/XboxStubs.h" #include "strings.h" #include "util/StringHelpers.h" -int LocalizationManager::s_iHTMLFontSizesA[eHTMLSize_COUNT] = { - 20, 13, 20, 26}; +int LocalizationManager::s_iHTMLFontSizesA[eHTMLSize_COUNT] = {20, 13, 20, 26}; TIPSTRUCT LocalizationManager::m_GameTipA[MAX_TIPS_GAMETIP] = { {0, IDS_TIPS_GAMETIP_1}, {0, IDS_TIPS_GAMETIP_2}, @@ -77,8 +76,7 @@ void LocalizationManager::loadStringTable(ArchiveFile* mediaArchive) { } std::string localisationFile = "languages.loc"; if (mediaArchive->hasFile(localisationFile)) { - std::vector locFile = - mediaArchive->getFile(localisationFile); + std::vector locFile = mediaArchive->getFile(localisationFile); m_stringTable = new StringTable(locFile.data(), locFile.size()); } else { m_stringTable = nullptr; @@ -345,8 +343,8 @@ std::string LocalizationManager::formatHTMLString( return text; } -std::string LocalizationManager::getActionReplacement( - int iPad, unsigned char ucAction) { +std::string LocalizationManager::getActionReplacement(int iPad, + unsigned char ucAction) { unsigned int input = PlatformInput.GetGameJoypadMaps( PlatformInput.GetJoypadMapVal(iPad), ucAction); @@ -505,8 +503,7 @@ std::string LocalizationManager::getIconReplacement(unsigned int uiIcon) { return result; } -void LocalizationManager::getLocale( - std::vector& vecWstrLocales) { +void LocalizationManager::getLocale(std::vector& vecWstrLocales) { std::vector locales; const unsigned int systemLanguage = XGetLanguage(); diff --git a/targets/app/common/LocalizationManager.h b/targets/app/common/LocalizationManager.h index d84689f75..920ba4c11 100644 --- a/targets/app/common/LocalizationManager.h +++ b/targets/app/common/LocalizationManager.h @@ -5,8 +5,8 @@ #include #include -#include "minecraft/GameEnums.h" #include "app/common/App_structs.h" +#include "minecraft/GameEnums.h" #include "platform/XboxStubs.h" class ArchiveFile; @@ -22,7 +22,7 @@ public: const char* getString(int iID) const; std::string formatHTMLString(int iPad, const std::string& desc, - int shadowColour = 0xFFFFFFFF); + int shadowColour = 0xFFFFFFFF); std::string getActionReplacement(int iPad, unsigned char ucAction); std::string getVKReplacement(unsigned int uiVKey); std::string getIconReplacement(unsigned int uiIcon); diff --git a/targets/app/common/MenuController.cpp b/targets/app/common/MenuController.cpp index 0aafa2219..2c5f6c323 100644 --- a/targets/app/common/MenuController.cpp +++ b/targets/app/common/MenuController.cpp @@ -1,5 +1,10 @@ #include "app/common/MenuController.h" +#include +#include +#include +#include + #include "app/common/Game.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" @@ -8,24 +13,19 @@ #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/ProgressRenderer.h" -#include "minecraft/client/renderer/GameRenderer.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" +#include "minecraft/client/renderer/GameRenderer.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/world/Container.h" #include "minecraft/world/entity/item/MinecartHopper.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/item/crafting/Recipy.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/level/tile/entity/HopperTileEntity.h" -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "platform/profile/profile.h" #include "platform/storage/storage.h" -#include -#include -#include -#include - unsigned char MenuController::m_szPNG[8] = {137, 80, 78, 71, 13, 10, 26, 10}; MenuController::MenuController() { @@ -273,9 +273,9 @@ bool MenuController::loadContainerMenu(int iPad, return success; } -bool MenuController::loadTrapMenu( - int iPad, std::shared_ptr inventory, - std::shared_ptr trap) { +bool MenuController::loadTrapMenu(int iPad, + std::shared_ptr inventory, + std::shared_ptr trap) { bool success = true; TrapScreenInput* initData = new TrapScreenInput(); @@ -294,8 +294,8 @@ bool MenuController::loadTrapMenu( return success; } -bool MenuController::loadSignEntryMenu( - int iPad, std::shared_ptr sign) { +bool MenuController::loadSignEntryMenu(int iPad, + std::shared_ptr sign) { bool success = true; SignEntryScreenInput* initData = new SignEntryScreenInput(); @@ -352,9 +352,9 @@ bool MenuController::loadTradingMenu(int iPad, return success; } -bool MenuController::loadHopperMenu( - int iPad, std::shared_ptr inventory, - std::shared_ptr hopper) { +bool MenuController::loadHopperMenu(int iPad, + std::shared_ptr inventory, + std::shared_ptr hopper) { bool success = true; HopperScreenInput* initData = new HopperScreenInput(); @@ -371,9 +371,9 @@ bool MenuController::loadHopperMenu( return success; } -bool MenuController::loadHopperMenu( - int iPad, std::shared_ptr inventory, - std::shared_ptr hopper) { +bool MenuController::loadHopperMenu(int iPad, + std::shared_ptr inventory, + std::shared_ptr hopper) { bool success = true; HopperScreenInput* initData = new HopperScreenInput(); @@ -411,9 +411,9 @@ bool MenuController::loadHorseMenu(int iPad, return success; } -bool MenuController::loadBeaconMenu( - int iPad, std::shared_ptr inventory, - std::shared_ptr beacon) { +bool MenuController::loadBeaconMenu(int iPad, + std::shared_ptr inventory, + std::shared_ptr beacon) { bool success = true; BeaconScreenInput* initData = new BeaconScreenInput(); @@ -633,9 +633,10 @@ void MenuController::getImageTextData(std::uint8_t* imageData, return; } -unsigned int MenuController::createImageTextData( - std::uint8_t* textMetadata, int64_t seed, bool hasSeed, - unsigned int uiHostOptions, unsigned int uiTexturePackId) { +unsigned int MenuController::createImageTextData(std::uint8_t* textMetadata, + int64_t seed, bool hasSeed, + unsigned int uiHostOptions, + unsigned int uiTexturePackId) { int iTextMetadataBytes = 0; if (hasSeed) { strcpy((char*)textMetadata, "4J_SEED"); diff --git a/targets/app/common/MenuController.h b/targets/app/common/MenuController.h index 626824520..fbaaa0071 100644 --- a/targets/app/common/MenuController.h +++ b/targets/app/common/MenuController.h @@ -6,8 +6,8 @@ #include "app/common/App_structs.h" #include "minecraft/XuiActionPayload.h" -#include "platform/storage/storage.h" #include "platform/XboxStubs.h" +#include "platform/storage/storage.h" class Player; class Inventory; @@ -49,8 +49,8 @@ public: bool loadCrafting2x2Menu(int iPad, std::shared_ptr player); bool loadCrafting3x3Menu(int iPad, std::shared_ptr player, int x, int y, int z); - bool loadFireworksMenu(int iPad, std::shared_ptr player, - int x, int y, int z); + bool loadFireworksMenu(int iPad, std::shared_ptr player, int x, + int y, int z); bool loadSignEntryMenu(int iPad, std::shared_ptr sign); bool loadRepairingMenu(int iPad, std::shared_ptr inventory, Level* level, int x, int y, int z); @@ -97,18 +97,18 @@ public: eTMSAction getTMSAction(int iPad) { return m_eTMSAction[iPad]; } // Dialog callbacks - static int texturePackDialogReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); - static int fatalErrorDialogReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); + static int texturePackDialogReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); + static int fatalErrorDialogReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); static int trialOverReturned(void* pParam, int iPad, IPlatformStorage::EMessageResult result); static int unlockFullExitReturned(void* pParam, int iPad, IPlatformStorage::EMessageResult result); static int unlockFullSaveReturned(void* pParam, int iPad, IPlatformStorage::EMessageResult result); - static int unlockFullInviteReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); + static int unlockFullInviteReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); // Remote save static int remoteSaveThreadProc(void* lpParameter); diff --git a/targets/app/common/Network/GameNetworkManager.cpp b/targets/app/common/Network/GameNetworkManager.cpp index 9fe851b20..d1f308480 100644 --- a/targets/app/common/Network/GameNetworkManager.cpp +++ b/targets/app/common/Network/GameNetworkManager.cpp @@ -9,27 +9,17 @@ #include #include -#include "platform/input/input.h" -#include "platform/profile/profile.h" -#include "platform/renderer/renderer.h" -#include "platform/storage/storage.h" -#include "minecraft/GameEnums.h" +#include "Socket.h" #include "app/common/Game.h" #include "app/common/GameRules/GameRuleManager.h" -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "app/common/Network/PlatformNetworkManagerStub.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "Socket.h" -#include "platform/XboxStubs.h" -#include "util/StringHelpers.h" -#include "platform/fs/fs.h" -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "java/File.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/ProgressRenderer.h" #include "minecraft/client/User.h" @@ -42,16 +32,26 @@ #include "minecraft/network/Connection.h" #include "minecraft/network/packet/DisconnectPacket.h" #include "minecraft/network/packet/PreLoginPacket.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/PlayerList.h" #include "minecraft/server/level/ServerPlayer.h" #include "minecraft/server/network/PlayerConnection.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/item/crafting/FireworksRecipe.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/chunk/storage/OldChunkStorage.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/XboxStubs.h" +#include "platform/fs/fs.h" +#include "platform/input/input.h" +#include "platform/profile/profile.h" +#include "platform/renderer/renderer.h" +#include "platform/storage/storage.h" #include "strings.h" +#include "util/StringHelpers.h" class FriendSessionInfo; class INVITE_INFO; @@ -407,8 +407,8 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft, // Open the socket on the server end to accept incoming data Socket::addIncomingSocket(socket); - connection->send(std::shared_ptr(new PreLoginPacket( - PlatformProfile.GetGamertag(idx)))); + connection->send(std::shared_ptr( + new PreLoginPacket(PlatformProfile.GetGamertag(idx)))); createdConnections.push_back(connection); @@ -626,8 +626,8 @@ void CGameNetworkManager::SetSessionsUpdatedCallback( void CGameNetworkManager::GetFullFriendSessionInfo( FriendSessionInfo* foundSession, std::function callback) { - s_pPlatformNetworkManager->GetFullFriendSessionInfo( - foundSession, std::move(callback)); + s_pPlatformNetworkManager->GetFullFriendSessionInfo(foundSession, + std::move(callback)); } void CGameNetworkManager::ForceFriendsSessionRefresh() { @@ -723,8 +723,9 @@ int CGameNetworkManager::JoinFromInvite_SignInReturned(void* pParam, Minecraft::GetInstance()->clearConnectionFailed(); // change the minecraft player name - Minecraft::GetInstance()->user->name = - PlatformProfile.GetGamertag(PlatformProfile.GetPrimaryPad()); + Minecraft::GetInstance()->user->name = + PlatformProfile.GetGamertag( + PlatformProfile.GetPrimaryPad()); bool success = g_NetworkManager.JoinGameFromInviteInfo( iPad, // dwUserIndex @@ -824,7 +825,8 @@ int CGameNetworkManager::ServerThreadProc(void* lpParameter) { } } - C4JThread::setThreadName(static_cast(-1), "Minecraft Server thread"); + C4JThread::setThreadName(static_cast(-1), + "Minecraft Server thread"); Compression::UseDefaultThreadStorage(); OldChunkStorage::UseDefaultThreadStorage(); Entity::useSmallIds(); @@ -1247,7 +1249,7 @@ void CGameNetworkManager::PlayerJoining(INetworkPlayer* pNetworkPlayer) { void CGameNetworkManager::PlayerLeaving(INetworkPlayer* pNetworkPlayer) { if (pNetworkPlayer->IsLocal()) { PlatformProfile.SetCurrentGameActivity(pNetworkPlayer->GetUserIndex(), - CONTEXT_PRESENCE_IDLE, false); + CONTEXT_PRESENCE_IDLE, false); } } @@ -1290,8 +1292,9 @@ void CGameNetworkManager::GameInviteReceived(int userIndex, bool bContentRestricted = false; bool pccAllowed = true; bool pccFriendsAllowed = true; - PlatformProfile.AllowedPlayerCreatedContent( - PlatformProfile.GetPrimaryPad(), false, &pccAllowed, &pccFriendsAllowed); + PlatformProfile.AllowedPlayerCreatedContent(PlatformProfile.GetPrimaryPad(), + false, &pccAllowed, + &pccFriendsAllowed); if (!pccAllowed && !pccFriendsAllowed) noUGC = true; if (noUGC) { @@ -1307,7 +1310,8 @@ void CGameNetworkManager::GameInviteReceived(int userIndex, // 4J-PB - it's possible there is no primary pad here, when accepting an // invite from the dashboard - // PlatformStorage.RequestMessageBox( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, + // PlatformStorage.RequestMessageBox( + // IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, // IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, // uiIDA,1,PlatformProfile.GetPrimaryPad(),nullptr,nullptr, // app.GetStringTable()); @@ -1328,9 +1332,7 @@ void CGameNetworkManager::GameInviteReceived(int userIndex, // pInviteInfo; // tell the app to process this - { - app.ProcessInvite(userIndex, localUsersMask, pInviteInfo); - } + { app.ProcessInvite(userIndex, localUsersMask, pInviteInfo); } } } } @@ -1385,8 +1387,9 @@ void CGameNetworkManager::HandleInviteWhenInMenus( g_NetworkManager.SetLocalGame(false); // change the minecraft player name - Minecraft::GetInstance()->user->name = - PlatformProfile.GetGamertag(PlatformProfile.GetPrimaryPad()); + Minecraft::GetInstance()->user->name = + PlatformProfile.GetGamertag( + PlatformProfile.GetPrimaryPad()); bool success = g_NetworkManager.JoinGameFromInviteInfo( userIndex, localUsersMask, pInviteInfo); diff --git a/targets/app/common/Network/GameNetworkManager.h b/targets/app/common/Network/GameNetworkManager.h index 980867186..2af904c4b 100644 --- a/targets/app/common/Network/GameNetworkManager.h +++ b/targets/app/common/Network/GameNetworkManager.h @@ -7,14 +7,14 @@ #if !defined(__linux__) #include #endif -#include "platform/PlatformTypes.h" +#include "PlatformNetworkManagerStub.h" #include "app/common/Network/IPlatformNetwork.h" -#include "platform/NetTypes.h" #include "minecraft/network/INetworkService.h" #include "minecraft/network/platform/NetworkPlayerInterface.h" -#include "PlatformNetworkManagerStub.h" #include "minecraft/network/platform/SessionInfo.h" #include "platform/C4JThread.h" +#include "platform/NetTypes.h" +#include "platform/PlatformTypes.h" class ClientConnection; class Minecraft; @@ -97,9 +97,8 @@ public: bool GetGameSessionInfo(int iPad, SessionID sessionId, FriendSessionInfo* foundSession); void SetSessionsUpdatedCallback(std::function callback); - void GetFullFriendSessionInfo( - FriendSessionInfo* foundSession, - std::function callback); + void GetFullFriendSessionInfo(FriendSessionInfo* foundSession, + std::function callback); void ForceFriendsSessionRefresh(); // Session joining and leaving @@ -167,8 +166,7 @@ public: private: void StateChange_AnyToHosting(); void StateChange_AnyToJoining(); - void StateChange_JoiningToIdle( - IPlatformNetwork::eJoinFailedReason reason); + void StateChange_JoiningToIdle(IPlatformNetwork::eJoinFailedReason reason); void StateChange_AnyToStarting(); void StateChange_AnyToEnding(bool bStateWasPlaying); void StateChange_AnyToIdle(); diff --git a/targets/app/common/Network/IPlatformNetwork.h b/targets/app/common/Network/IPlatformNetwork.h index 742a8d383..b479863a6 100644 --- a/targets/app/common/Network/IPlatformNetwork.h +++ b/targets/app/common/Network/IPlatformNetwork.h @@ -51,8 +51,7 @@ public: virtual bool RemoveLocalPlayerByUserIndex(int userIndex) = 0; [[nodiscard]] virtual INetworkPlayer* GetLocalPlayerByUserIndex( int userIndex) = 0; - [[nodiscard]] virtual INetworkPlayer* GetPlayerByIndex( - int playerIndex) = 0; + [[nodiscard]] virtual INetworkPlayer* GetPlayerByIndex(int playerIndex) = 0; [[nodiscard]] virtual INetworkPlayer* GetPlayerByXuid(PlayerUID xuid) = 0; [[nodiscard]] virtual INetworkPlayer* GetPlayerBySmallId( unsigned char smallId) = 0; @@ -89,9 +88,8 @@ public: // Callbacks virtual void RegisterPlayerChangedCallback( - int iPad, - std::function - callback) = 0; + int iPad, std::function + callback) = 0; virtual void UnRegisterPlayerChangedCallback(int iPad) = 0; virtual void HandleSignInChange() = 0; @@ -112,7 +110,7 @@ public: // System flags virtual void SystemFlagSet(INetworkPlayer* pNetworkPlayer, int index) = 0; [[nodiscard]] virtual bool SystemFlagGet(INetworkPlayer* pNetworkPlayer, - int index) = 0; + int index) = 0; // Stats [[nodiscard]] virtual std::string GatherStats() = 0; @@ -128,8 +126,7 @@ public: int iPad, int localPlayers, bool partyOnly) = 0; [[nodiscard]] virtual bool GetGameSessionInfo( int iPad, SessionID sessionId, FriendSessionInfo* foundSession) = 0; - virtual void SetSessionsUpdatedCallback( - std::function callback) = 0; + virtual void SetSessionsUpdatedCallback(std::function callback) = 0; virtual void GetFullFriendSessionInfo( FriendSessionInfo* foundSession, std::function callback) = 0; diff --git a/targets/app/common/Network/NetworkPlayerQNet.cpp b/targets/app/common/Network/NetworkPlayerQNet.cpp index be89cbda0..4c77c4a57 100644 --- a/targets/app/common/Network/NetworkPlayerQNet.cpp +++ b/targets/app/common/Network/NetworkPlayerQNet.cpp @@ -2,8 +2,8 @@ #include -#include "platform/NetTypes.h" #include "java/System.h" +#include "platform/NetTypes.h" NetworkPlayerQNet::NetworkPlayerQNet(IQNetPlayer* qnetPlayer) { m_qnetPlayer = qnetPlayer; diff --git a/targets/app/common/Network/NetworkPlayerQNet.h b/targets/app/common/Network/NetworkPlayerQNet.h index 3de173cf1..9df94b161 100644 --- a/targets/app/common/Network/NetworkPlayerQNet.h +++ b/targets/app/common/Network/NetworkPlayerQNet.h @@ -4,8 +4,8 @@ #include -#include "platform/PlatformTypes.h" #include "minecraft/network/platform/NetworkPlayerInterface.h" +#include "platform/PlatformTypes.h" class IQNetPlayer; class Socket; diff --git a/targets/app/common/Network/PlatformNetworkManagerInterface.h b/targets/app/common/Network/PlatformNetworkManagerInterface.h index 297641349..bde23aac2 100644 --- a/targets/app/common/Network/PlatformNetworkManagerInterface.h +++ b/targets/app/common/Network/PlatformNetworkManagerInterface.h @@ -5,11 +5,11 @@ #if !defined(__linux__) #include #endif -#include "platform/NetTypes.h" #include "minecraft/client/model/SkinBox.h" #include "minecraft/network/platform/NetworkPlayerInterface.h" #include "minecraft/network/platform/SessionInfo.h" #include "platform/C4JThread.h" +#include "platform/NetTypes.h" class ClientConnection; class Minecraft; @@ -87,9 +87,8 @@ public: virtual void ResetLeavingGame() = 0; virtual void RegisterPlayerChangedCallback( - int iPad, - std::function - callback) = 0; + int iPad, std::function + callback) = 0; virtual void UnRegisterPlayerChangedCallback(int iPad) = 0; virtual void HandleSignInChange() = 0; @@ -128,8 +127,7 @@ public: bool partyOnly) = 0; virtual bool GetGameSessionInfo(int iPad, SessionID sessionId, FriendSessionInfo* foundSession) = 0; - virtual void SetSessionsUpdatedCallback( - std::function callback) = 0; + virtual void SetSessionsUpdatedCallback(std::function callback) = 0; virtual void GetFullFriendSessionInfo( FriendSessionInfo* foundSession, std::function callback) = 0; diff --git a/targets/app/common/Network/PlatformNetworkManagerStub.cpp b/targets/app/common/Network/PlatformNetworkManagerStub.cpp index 15108e8b9..f46e0853f 100644 --- a/targets/app/common/Network/PlatformNetworkManagerStub.cpp +++ b/targets/app/common/Network/PlatformNetworkManagerStub.cpp @@ -5,13 +5,13 @@ #include -#include "app/common/Network/GameNetworkManager.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" -#include "app/linux/LinuxGame.h" -#include "platform/NetTypes.h" #include "NetworkPlayerQNet.h" #include "Socket.h" +#include "app/common/Network/GameNetworkManager.h" +#include "app/linux/LinuxGame.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "platform/C4JThread.h" +#include "platform/NetTypes.h" IPlatformNetworkStub* g_pPlatformNetworkManager; @@ -107,8 +107,8 @@ void IPlatformNetworkStub::NotifyPlayerJoined(IQNetPlayer* pQNetPlayer) { } } -bool IPlatformNetworkStub::Initialise( - CGameNetworkManager* pGameNetworkManager, int flagIndexSize) { +bool IPlatformNetworkStub::Initialise(CGameNetworkManager* pGameNetworkManager, + int flagIndexSize) { m_pGameNetworkManager = pGameNetworkManager; m_flagIndexSize = flagIndexSize; g_pPlatformNetworkManager = this; @@ -152,8 +152,7 @@ int IPlatformNetworkStub::GetJoiningReadyPercentage() { return 100; } int IPlatformNetworkStub::CorrectErrorIDS(int IDS) { return IDS; } -bool IPlatformNetworkStub::isSystemPrimaryPlayer( - IQNetPlayer* pQNetPlayer) { +bool IPlatformNetworkStub::isSystemPrimaryPlayer(IQNetPlayer* pQNetPlayer) { return true; } @@ -165,9 +164,7 @@ int IPlatformNetworkStub::GetPlayerCount() { return m_pIQNet->GetPlayerCount(); } -bool IPlatformNetworkStub::ShouldMessageForFullSession() { - return false; -} +bool IPlatformNetworkStub::ShouldMessageForFullSession() { return false; } int IPlatformNetworkStub::GetOnlinePlayerCount() { return 1; } @@ -186,8 +183,7 @@ bool IPlatformNetworkStub::RemoveLocalPlayerByUserIndex(int userIndex) { bool IPlatformNetworkStub::IsInStatsEnabledSession() { return true; } -bool IPlatformNetworkStub::SessionHasSpace( - unsigned int spaceRequired /*= 1*/) { +bool IPlatformNetworkStub::SessionHasSpace(unsigned int spaceRequired /*= 1*/) { return true; } @@ -209,8 +205,7 @@ bool IPlatformNetworkStub::LeaveGame(bool bMigrateHost) { return true; } -bool IPlatformNetworkStub::_LeaveGame(bool bMigrateHost, - bool bLeaveRoom) { +bool IPlatformNetworkStub::_LeaveGame(bool bMigrateHost, bool bLeaveRoom) { return true; } @@ -242,8 +237,7 @@ void IPlatformNetworkStub::_HostGame( bool IPlatformNetworkStub::_StartGame() { return true; } int IPlatformNetworkStub::JoinGame(FriendSessionInfo* searchResult, - int localUsersMask, - int primaryUserIndex) { + int localUsersMask, int primaryUserIndex) { return CGameNetworkManager::JOINGAME_SUCCESS; } @@ -319,8 +313,7 @@ void IPlatformNetworkStub::UpdateAndSetGameSessionData( // app.GetGameHostOption(eGameHostOption_All); } -int IPlatformNetworkStub::RemovePlayerOnSocketClosedThreadProc( - void* lpParam) { +int IPlatformNetworkStub::RemovePlayerOnSocketClosedThreadProc(void* lpParam) { INetworkPlayer* pNetworkPlayer = (INetworkPlayer*)lpParam; Socket* socket = pNetworkPlayer->GetSocket(); @@ -338,13 +331,12 @@ int IPlatformNetworkStub::RemovePlayerOnSocketClosedThreadProc( return g_pPlatformNetworkManager->RemoveLocalPlayer(pNetworkPlayer); } -bool IPlatformNetworkStub::RemoveLocalPlayer( - INetworkPlayer* pNetworkPlayer) { +bool IPlatformNetworkStub::RemoveLocalPlayer(INetworkPlayer* pNetworkPlayer) { return true; } -IPlatformNetworkStub::PlayerFlags::PlayerFlags( - INetworkPlayer* pNetworkPlayer, unsigned int count) { +IPlatformNetworkStub::PlayerFlags::PlayerFlags(INetworkPlayer* pNetworkPlayer, + unsigned int count) { // 4J Stu - Don't assert, just make it a multiple of 8! This count is // calculated from a load of separate values, and makes tweaking // world/render sizes a pain if we hit an assert here @@ -359,8 +351,7 @@ IPlatformNetworkStub::PlayerFlags::~PlayerFlags() { delete[] flags; } // Add a player to the per system flag storage - if we've already got a player // from that system, copy its flags over -void IPlatformNetworkStub::SystemFlagAddPlayer( - INetworkPlayer* pNetworkPlayer) { +void IPlatformNetworkStub::SystemFlagAddPlayer(INetworkPlayer* pNetworkPlayer) { PlayerFlags* newPlayerFlags = new PlayerFlags(pNetworkPlayer, m_flagIndexSize); // If any of our existing players are on the same system, then copy over @@ -399,7 +390,7 @@ void IPlatformNetworkStub::SystemFlagReset() { // Set a per system flag - this is done by setting the flag on every player that // shares that system void IPlatformNetworkStub::SystemFlagSet(INetworkPlayer* pNetworkPlayer, - int index) { + int index) { if ((index < 0) || (index >= m_flagIndexSize)) return; if (pNetworkPlayer == nullptr) return; @@ -414,7 +405,7 @@ void IPlatformNetworkStub::SystemFlagSet(INetworkPlayer* pNetworkPlayer, // player as anything else sent to that system should also have been duplicated // here bool IPlatformNetworkStub::SystemFlagGet(INetworkPlayer* pNetworkPlayer, - int index) { + int index) { if ((index < 0) || (index >= m_flagIndexSize)) return false; if (pNetworkPlayer == nullptr) { return false; @@ -505,8 +496,7 @@ INetworkPlayer* IPlatformNetworkStub::addNetworkPlayer( return pNetworkPlayer; } -void IPlatformNetworkStub::removeNetworkPlayer( - IQNetPlayer* pQNetPlayer) { +void IPlatformNetworkStub::removeNetworkPlayer(IQNetPlayer* pQNetPlayer) { INetworkPlayer* pNetworkPlayer = getNetworkPlayer(pQNetPlayer); for (auto it = currentNetworkPlayers.begin(); it != currentNetworkPlayers.end(); it++) { @@ -523,8 +513,7 @@ INetworkPlayer* IPlatformNetworkStub::getNetworkPlayer( : nullptr; } -INetworkPlayer* IPlatformNetworkStub::GetLocalPlayerByUserIndex( - int userIndex) { +INetworkPlayer* IPlatformNetworkStub::GetLocalPlayerByUserIndex(int userIndex) { return getNetworkPlayer(m_pIQNet->GetLocalPlayerByUserIndex(userIndex)); } diff --git a/targets/app/common/Network/PlatformNetworkManagerStub.h b/targets/app/common/Network/PlatformNetworkManagerStub.h index aa50268cb..af9c3827b 100644 --- a/targets/app/common/Network/PlatformNetworkManagerStub.h +++ b/targets/app/common/Network/PlatformNetworkManagerStub.h @@ -4,14 +4,14 @@ #include #include -#include "platform/PlatformTypes.h" -#include "platform/NetTypes.h" -#include "minecraft/client/model/SkinBox.h" -#include "platform/XboxStubs.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "app/common/Network/IPlatformNetwork.h" +#include "minecraft/client/model/SkinBox.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "minecraft/network/platform/SessionInfo.h" #include "platform/C4JThread.h" +#include "platform/NetTypes.h" +#include "platform/PlatformTypes.h" +#include "platform/XboxStubs.h" class C4JThread; class CGameNetworkManager; @@ -67,8 +67,7 @@ public: virtual void RegisterPlayerChangedCallback( int iPad, - std::function - callback); + std::function callback); virtual void UnRegisterPlayerChangedCallback(int iPad); virtual void HandleSignInChange(); @@ -184,8 +183,7 @@ public: bool partyOnly); virtual bool GetGameSessionInfo(int iPad, SessionID sessionId, FriendSessionInfo* foundSession); - virtual void SetSessionsUpdatedCallback( - std::function callback); + virtual void SetSessionsUpdatedCallback(std::function callback); virtual void GetFullFriendSessionInfo( FriendSessionInfo* foundSession, std::function callback); diff --git a/targets/app/common/Network/Socket.cpp b/targets/app/common/Network/Socket.cpp index 6ae610c25..68c3e3c7a 100644 --- a/targets/app/common/Network/Socket.cpp +++ b/targets/app/common/Network/Socket.cpp @@ -7,11 +7,11 @@ #include // 4jcraft TODO -#include "platform/ShutdownManager.h" #include "app/common/Network/GameNetworkManager.h" #include "minecraft/network/platform/NetworkPlayerInterface.h" -#include "platform/NetTypes.h" #include "minecraft/server/network/ServerConnection.h" +#include "platform/NetTypes.h" +#include "platform/ShutdownManager.h" class SocketAddress {}; diff --git a/targets/app/common/Network/Socket.h b/targets/app/common/Network/Socket.h index ca45f8f34..25037db28 100644 --- a/targets/app/common/Network/Socket.h +++ b/targets/app/common/Network/Socket.h @@ -11,10 +11,10 @@ #include #include "app/common/Network/GameNetworkManager.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" -#include "platform/C4JThread.h" #include "java/InputOutputStream/InputStream.h" #include "java/InputOutputStream/OutputStream.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" +#include "platform/C4JThread.h" class INetworkPlayer; diff --git a/targets/app/common/NetworkController.h b/targets/app/common/NetworkController.h index 4d226d8dd..6557f4b0b 100644 --- a/targets/app/common/NetworkController.h +++ b/targets/app/common/NetworkController.h @@ -3,10 +3,10 @@ #include #include "app/common/App_structs.h" -#include "platform/NetTypes.h" -#include "platform/storage/storage.h" -#include "platform/XboxStubs.h" #include "minecraft/network/packet/DisconnectPacket.h" +#include "platform/NetTypes.h" +#include "platform/XboxStubs.h" +#include "platform/storage/storage.h" struct INVITE_INFO; @@ -32,10 +32,10 @@ public: unsigned int uiSignInData); static void clearSignInChangeUsersMask(); static int signoutExitWorldThreadProc(void* lpParameter); - static int primaryPlayerSignedOutReturned(void* pParam, int iPad, - const IPlatformStorage::EMessageResult); - static int ethernetDisconnectReturned(void* pParam, int iPad, - const IPlatformStorage::EMessageResult); + static int primaryPlayerSignedOutReturned( + void* pParam, int iPad, const IPlatformStorage::EMessageResult); + static int ethernetDisconnectReturned( + void* pParam, int iPad, const IPlatformStorage::EMessageResult); static void profileReadErrorCallback(void* pParam); // Notifications diff --git a/targets/app/common/SaveManager.cpp b/targets/app/common/SaveManager.cpp index fa846850b..d3db14610 100644 --- a/targets/app/common/SaveManager.cpp +++ b/targets/app/common/SaveManager.cpp @@ -1,17 +1,16 @@ -#include "app/linux/LinuxGame.h" #include "app/common/SaveManager.h" #include #include "app/common/Game.h" #include "app/common/Network/GameNetworkManager.h" +#include "app/linux/LinuxGame.h" #include "minecraft/server/MinecraftServer.h" #include "platform/profile/profile.h" void SaveManager::setAutosaveTimerTime(int settingValue) { m_uiAutosaveTimer = - time_util::clock::now() + - std::chrono::minutes(settingValue * 15); + time_util::clock::now() + std::chrono::minutes(settingValue * 15); } bool SaveManager::autosaveDue() const { diff --git a/targets/app/common/SkinManager.cpp b/targets/app/common/SkinManager.cpp index 851f2f70b..4cc7a743c 100644 --- a/targets/app/common/SkinManager.cpp +++ b/targets/app/common/SkinManager.cpp @@ -1,21 +1,22 @@ #include "app/common/SkinManager.h" +#include + #include #include #include -#include #include "app/common/App_structs.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" #include "app/common/DLC/DLCSkinFile.h" -#include "minecraft/Minecraft_Macros.h" #include "app/linux/LinuxGame.h" +#include "minecraft/Minecraft_Macros.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" -#include "minecraft/client/renderer/entity/EntityRenderer.h" #include "minecraft/client/renderer/entity/EntityRenderDispatcher.h" +#include "minecraft/client/renderer/entity/EntityRenderer.h" #include "minecraft/world/entity/player/Player.h" #include "platform/profile/profile.h" @@ -44,7 +45,7 @@ void SkinManager::setPlayerSkin(int iPad, std::uint32_t dwSkinId, } std::string SkinManager::getPlayerSkinName(int iPad, - GAME_SETTINGS** gameSettingsA) { + GAME_SETTINGS** gameSettingsA) { return getSkinPathFromId(gameSettingsA[iPad]->dwSelectedSkin); } @@ -104,7 +105,7 @@ void SkinManager::setPlayerCape(int iPad, std::uint32_t dwCapeId, } std::string SkinManager::getPlayerCapeName(int iPad, - GAME_SETTINGS** gameSettingsA) { + GAME_SETTINGS** gameSettingsA) { return Player::getCapePathFromId(gameSettingsA[iPad]->dwSelectedCape); } @@ -122,8 +123,8 @@ void SkinManager::setPlayerFavoriteSkin(int iPad, int iIndex, gameSettingsA[iPad]->bSettingsChanged = true; } -unsigned int SkinManager::getPlayerFavoriteSkin( - int iPad, int iIndex, GAME_SETTINGS** gameSettingsA) { +unsigned int SkinManager::getPlayerFavoriteSkin(int iPad, int iIndex, + GAME_SETTINGS** gameSettingsA) { return gameSettingsA[iPad]->uiFavoriteSkinA[iIndex]; } @@ -151,8 +152,7 @@ unsigned int SkinManager::getPlayerFavoriteSkinsCount( return uiCount; } -void SkinManager::validateFavoriteSkins(int iPad, - GAME_SETTINGS** gameSettingsA, +void SkinManager::validateFavoriteSkins(int iPad, GAME_SETTINGS** gameSettingsA, DLCManager& dlcManager) { unsigned int uiCount = getPlayerFavoriteSkinsCount(iPad, gameSettingsA); @@ -203,7 +203,7 @@ void SkinManager::addMemoryTextureFile(const std::string& wName, if (it != m_MEM_Files.end()) { #if !defined(_CONTENT_PACKAGE) printf("Incrementing the memory texture file count for %s\n", - wName.c_str()); + wName.c_str()); #endif pData = (*it).second; @@ -233,14 +233,14 @@ void SkinManager::removeMemoryTextureFile(const std::string& wName) { if (it != m_MEM_Files.end()) { #if !defined(_CONTENT_PACKAGE) printf("Decrementing the memory texture file count for %s\n", - wName.c_str()); + wName.c_str()); #endif PMEMDATA pData = (*it).second; --pData->ucRefCount; if (pData->ucRefCount <= 0) { #if !defined(_CONTENT_PACKAGE) printf("Erasing the memory texture file data for %s\n", - wName.c_str()); + wName.c_str()); #endif delete pData; m_MEM_Files.erase(wName); diff --git a/targets/app/common/SkinManager.h b/targets/app/common/SkinManager.h index 6336f0d87..a20a52e58 100644 --- a/targets/app/common/SkinManager.h +++ b/targets/app/common/SkinManager.h @@ -38,13 +38,13 @@ public: void setPlayerFavoriteSkin(int iPad, int iIndex, unsigned int uiSkinID, GAME_SETTINGS** gameSettingsA); unsigned int getPlayerFavoriteSkin(int iPad, int iIndex, - GAME_SETTINGS** gameSettingsA); + GAME_SETTINGS** gameSettingsA); unsigned char getPlayerFavoriteSkinsPos(int iPad, - GAME_SETTINGS** gameSettingsA); + GAME_SETTINGS** gameSettingsA); void setPlayerFavoriteSkinsPos(int iPad, int iPos, GAME_SETTINGS** gameSettingsA); unsigned int getPlayerFavoriteSkinsCount(int iPad, - GAME_SETTINGS** gameSettingsA); + GAME_SETTINGS** gameSettingsA); void validateFavoriteSkins(int iPad, GAME_SETTINGS** gameSettingsA, DLCManager& dlcManager); diff --git a/targets/app/common/TerrainFeatureManager.h b/targets/app/common/TerrainFeatureManager.h index 16cb46a1a..015bca8f7 100644 --- a/targets/app/common/TerrainFeatureManager.h +++ b/targets/app/common/TerrainFeatureManager.h @@ -2,8 +2,8 @@ #include -#include "minecraft/GameEnums.h" #include "app/common/App_structs.h" +#include "minecraft/GameEnums.h" class TerrainFeatureManager { public: diff --git a/targets/app/common/Tutorial/Constraints/ChangeStateConstraint.cpp b/targets/app/common/Tutorial/Constraints/ChangeStateConstraint.cpp index 6859cfa6f..3ed3abaf9 100644 --- a/targets/app/common/Tutorial/Constraints/ChangeStateConstraint.cpp +++ b/targets/app/common/Tutorial/Constraints/ChangeStateConstraint.cpp @@ -2,7 +2,6 @@ #include -#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "app/common/Tutorial/Constraints/TutorialConstraint.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialEnum.h" @@ -10,6 +9,7 @@ #include "minecraft/client/multiplayer/ClientConnection.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/network/packet/PlayerInfoPacket.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "minecraft/world/entity/player/Abilities.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/level/LevelSettings.h" diff --git a/targets/app/common/Tutorial/Constraints/ChangeStateConstraint.h b/targets/app/common/Tutorial/Constraints/ChangeStateConstraint.h index b87601123..1bcfdcf55 100644 --- a/targets/app/common/Tutorial/Constraints/ChangeStateConstraint.h +++ b/targets/app/common/Tutorial/Constraints/ChangeStateConstraint.h @@ -2,8 +2,8 @@ #include -#include "app/common/Tutorial/TutorialEnum.h" #include "TutorialConstraint.h" +#include "app/common/Tutorial/TutorialEnum.h" #include "minecraft/world/phys/AABB.h" class AABB; diff --git a/targets/app/common/Tutorial/FullTutorial.cpp b/targets/app/common/Tutorial/FullTutorial.cpp index b7ef2a036..ca1f78ba3 100644 --- a/targets/app/common/Tutorial/FullTutorial.cpp +++ b/targets/app/common/Tutorial/FullTutorial.cpp @@ -290,8 +290,7 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) IDS_TUTORIAL_TASK_CREATE_TORCH)); if (app.getGameRuleDefinitions() != nullptr) { - AABB* area = - app.getGameRuleDefinitions()->getNamedArea("tutorialArea"); + AABB* area = app.getGameRuleDefinitions()->getNamedArea("tutorialArea"); if (area != nullptr) { std::vector* areaConstraints = new std::vector(); @@ -506,8 +505,7 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * */ if (app.getGameRuleDefinitions() != nullptr) { - AABB* area = - app.getGameRuleDefinitions()->getNamedArea("minecartArea"); + AABB* area = app.getGameRuleDefinitions()->getNamedArea("minecartArea"); if (area != nullptr) { addHint(e_Tutorial_State_Gameplay, new AreaHint(e_Tutorial_Hint_Always_On, this, @@ -680,8 +678,7 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * */ if (app.getGameRuleDefinitions() != nullptr) { - AABB* area = - app.getGameRuleDefinitions()->getNamedArea("creativeArea"); + AABB* area = app.getGameRuleDefinitions()->getNamedArea("creativeArea"); if (area != nullptr) { eTutorial_State creativeStates[] = {e_Tutorial_State_Gameplay}; AddGlobalConstraint(new ChangeStateConstraint( @@ -1195,8 +1192,7 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * */ if (app.getGameRuleDefinitions() != nullptr) { - AABB* area = - app.getGameRuleDefinitions()->getNamedArea("breedingArea"); + AABB* area = app.getGameRuleDefinitions()->getNamedArea("breedingArea"); if (area != nullptr) { eTutorial_State breedingStates[] = {e_Tutorial_State_Gameplay}; AddGlobalConstraint(new ChangeStateConstraint( diff --git a/targets/app/common/Tutorial/FullTutorial.h b/targets/app/common/Tutorial/FullTutorial.h index ddf86922d..b8cad4486 100644 --- a/targets/app/common/Tutorial/FullTutorial.h +++ b/targets/app/common/Tutorial/FullTutorial.h @@ -1,6 +1,6 @@ #pragma once -#include "app/common/Tutorial/TutorialEnum.h" #include "Tutorial.h" +#include "app/common/Tutorial/TutorialEnum.h" #define FULL_TUTORIAL_PROGRESS_2_X_2_Crafting 1 #define FULL_TUTORIAL_PROGRESS_3_X_3_Crafting 2 diff --git a/targets/app/common/Tutorial/Hints/AreaHint.h b/targets/app/common/Tutorial/Hints/AreaHint.h index 375abfc99..919bc3fb8 100644 --- a/targets/app/common/Tutorial/Hints/AreaHint.h +++ b/targets/app/common/Tutorial/Hints/AreaHint.h @@ -1,7 +1,7 @@ #pragma once -#include "app/common/Tutorial/TutorialEnum.h" #include "TutorialHint.h" +#include "app/common/Tutorial/TutorialEnum.h" #include "minecraft/world/phys/AABB.h" class AABB; diff --git a/targets/app/common/Tutorial/Hints/DiggerItemHint.cpp b/targets/app/common/Tutorial/Hints/DiggerItemHint.cpp index dfea1d621..573f8bedb 100644 --- a/targets/app/common/Tutorial/Hints/DiggerItemHint.cpp +++ b/targets/app/common/Tutorial/Hints/DiggerItemHint.cpp @@ -57,7 +57,7 @@ int DiggerItemHint::attack(std::shared_ptr item, if (itemFound) { // It's also possible that we could hit TileEntities (eg falling // sand) so don't want to give this hint then - if (entity->instanceof(eTYPE_MOB)) { + if (entity->instanceof (eTYPE_MOB)) { return IDS_TUTORIAL_HINT_ATTACK_WITH_TOOL; } else { return -1; diff --git a/targets/app/common/Tutorial/Hints/DiggerItemHint.h b/targets/app/common/Tutorial/Hints/DiggerItemHint.h index 95ba875e2..8f86cd6f9 100644 --- a/targets/app/common/Tutorial/Hints/DiggerItemHint.h +++ b/targets/app/common/Tutorial/Hints/DiggerItemHint.h @@ -1,7 +1,7 @@ #pragma once -#include "app/common/Tutorial/TutorialEnum.h" #include "TutorialHint.h" +#include "app/common/Tutorial/TutorialEnum.h" class DiggerItem; class Level; diff --git a/targets/app/common/Tutorial/Hints/LookAtEntityHint.h b/targets/app/common/Tutorial/Hints/LookAtEntityHint.h index d74b98767..a0d2936a2 100644 --- a/targets/app/common/Tutorial/Hints/LookAtEntityHint.h +++ b/targets/app/common/Tutorial/Hints/LookAtEntityHint.h @@ -1,8 +1,8 @@ #pragma once // using namespace std; -#include "app/common/Tutorial/TutorialEnum.h" #include "TutorialHint.h" +#include "app/common/Tutorial/TutorialEnum.h" #include "java/Class.h" class ItemInstance; @@ -17,7 +17,7 @@ public: LookAtEntityHint(eTutorial_Hint id, Tutorial* tutorial, int descriptionId, int titleId, eINSTANCEOF type); // TODO: 4jcraft added, this was not implemented - ~LookAtEntityHint() {}; + ~LookAtEntityHint(){}; virtual bool onLookAtEntity(eINSTANCEOF type); }; diff --git a/targets/app/common/Tutorial/Hints/LookAtTileHint.h b/targets/app/common/Tutorial/Hints/LookAtTileHint.h index 514c4fc43..cb9e826be 100644 --- a/targets/app/common/Tutorial/Hints/LookAtTileHint.h +++ b/targets/app/common/Tutorial/Hints/LookAtTileHint.h @@ -1,8 +1,8 @@ #pragma once // using namespace std; -#include "app/common/Tutorial/TutorialEnum.h" #include "TutorialHint.h" +#include "app/common/Tutorial/TutorialEnum.h" class ItemInstance; class Tutorial; @@ -20,7 +20,7 @@ public: unsigned int tilesLength, int iconOverride = -1, int iData = -1, int iDataOverride = -1); // TODO: 4jcraft, added, destructor was never implemented - ~LookAtTileHint() {}; + ~LookAtTileHint(){}; virtual bool onLookAt(int id, int iData = 0); }; diff --git a/targets/app/common/Tutorial/Hints/TakeItemHint.h b/targets/app/common/Tutorial/Hints/TakeItemHint.h index 0cb9c6928..81225bac8 100644 --- a/targets/app/common/Tutorial/Hints/TakeItemHint.h +++ b/targets/app/common/Tutorial/Hints/TakeItemHint.h @@ -1,8 +1,8 @@ #pragma once // using namespace std; -#include "app/common/Tutorial/TutorialEnum.h" #include "TutorialHint.h" +#include "app/common/Tutorial/TutorialEnum.h" class ItemInstance; class Tutorial; @@ -16,7 +16,7 @@ public: TakeItemHint(eTutorial_Hint id, Tutorial* tutorial, int items[], unsigned int itemsLength); // TODO: 4jcraft, added, it was never implemented - virtual ~TakeItemHint() {}; + virtual ~TakeItemHint(){}; virtual bool onTake(std::shared_ptr item); }; diff --git a/targets/app/common/Tutorial/Tasks/AreaTask.h b/targets/app/common/Tutorial/Tasks/AreaTask.h index fbbd20bcc..6d69b0cc6 100644 --- a/targets/app/common/Tutorial/Tasks/AreaTask.h +++ b/targets/app/common/Tutorial/Tasks/AreaTask.h @@ -4,8 +4,8 @@ #include #include -#include "app/common/Tutorial/TutorialEnum.h" #include "TutorialTask.h" +#include "app/common/Tutorial/TutorialEnum.h" class Tutorial; class TutorialConstraint; diff --git a/targets/app/common/Tutorial/Tasks/ChoiceTask.cpp b/targets/app/common/Tutorial/Tasks/ChoiceTask.cpp index fbc14d81e..6d0ceba55 100644 --- a/targets/app/common/Tutorial/Tasks/ChoiceTask.cpp +++ b/targets/app/common/Tutorial/Tasks/ChoiceTask.cpp @@ -3,7 +3,6 @@ #include #include -#include "platform/input/input.h" #include "app/common/Tutorial/Constraints/InputConstraint.h" #include "app/common/Tutorial/Tasks/TutorialTask.h" #include "app/common/Tutorial/Tutorial.h" @@ -12,6 +11,7 @@ #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/world/level/material/Material.h" +#include "platform/input/input.h" ChoiceTask::ChoiceTask( Tutorial* tutorial, int descriptionId, int promptId /*= -1*/, @@ -55,12 +55,12 @@ bool ChoiceTask::isCompleted() { if (!m_bConfirmMappingComplete && PlatformInput.GetValue(pMinecraft->player->GetXboxPad(), - m_iConfirmMapping) > 0) { + m_iConfirmMapping) > 0) { m_bConfirmMappingComplete = true; } if (!m_bCancelMappingComplete && PlatformInput.GetValue(pMinecraft->player->GetXboxPad(), - m_iCancelMapping) > 0) { + m_iCancelMapping) > 0) { m_bCancelMappingComplete = true; } } diff --git a/targets/app/common/Tutorial/Tasks/ChoiceTask.h b/targets/app/common/Tutorial/Tasks/ChoiceTask.h index 7faf10682..8a9fa5dbe 100644 --- a/targets/app/common/Tutorial/Tasks/ChoiceTask.h +++ b/targets/app/common/Tutorial/Tasks/ChoiceTask.h @@ -1,8 +1,8 @@ #pragma once // using namespace std; -#include "app/common/Tutorial/TutorialEnum.h" #include "TutorialTask.h" +#include "app/common/Tutorial/TutorialEnum.h" class Tutorial; diff --git a/targets/app/common/Tutorial/Tasks/ControllerTask.cpp b/targets/app/common/Tutorial/Tasks/ControllerTask.cpp index 62b91e381..d58244009 100644 --- a/targets/app/common/Tutorial/Tasks/ControllerTask.cpp +++ b/targets/app/common/Tutorial/Tasks/ControllerTask.cpp @@ -6,13 +6,13 @@ #include #include -#include "platform/input/input.h" -#include "minecraft/GameEnums.h" #include "app/common/Tutorial/Constraints/InputConstraint.h" #include "app/common/Tutorial/Tasks/TutorialTask.h" #include "app/linux/LinuxGame.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" +#include "platform/input/input.h" class Tutorial; @@ -82,7 +82,7 @@ bool ControllerTask::isCompleted() { it != southpawCompletedMappings.end(); ++it) { if (!it->second) { if (PlatformInput.GetValue(pMinecraft->player->GetXboxPad(), - it->first) > 0) { + it->first) > 0) { it->second = true; m_uiCompletionMask |= 1 << iCurrent; } else { @@ -96,7 +96,7 @@ bool ControllerTask::isCompleted() { ++it) { if (!it->second) { if (PlatformInput.GetValue(pMinecraft->player->GetXboxPad(), - it->first) > 0) { + it->first) > 0) { it->second = true; m_uiCompletionMask |= 1 << iCurrent; } else { diff --git a/targets/app/common/Tutorial/Tasks/FullTutorialActiveTask.h b/targets/app/common/Tutorial/Tasks/FullTutorialActiveTask.h index bcee51649..b5b631caa 100644 --- a/targets/app/common/Tutorial/Tasks/FullTutorialActiveTask.h +++ b/targets/app/common/Tutorial/Tasks/FullTutorialActiveTask.h @@ -1,8 +1,8 @@ #pragma once // using namespace std; -#include "app/common/Tutorial/TutorialEnum.h" #include "TutorialTask.h" +#include "app/common/Tutorial/TutorialEnum.h" class Tutorial; diff --git a/targets/app/common/Tutorial/Tasks/HorseChoiceTask.cpp b/targets/app/common/Tutorial/Tasks/HorseChoiceTask.cpp index bbb131b5a..a2c7738ff 100644 --- a/targets/app/common/Tutorial/Tasks/HorseChoiceTask.cpp +++ b/targets/app/common/Tutorial/Tasks/HorseChoiceTask.cpp @@ -39,7 +39,7 @@ int HorseChoiceTask::getDescriptionId() { } void HorseChoiceTask::onLookAtEntity(std::shared_ptr entity) { - if ((m_eHorseType < 0) && entity->instanceof(eTYPE_HORSE)) { + if ((m_eHorseType < 0) && entity->instanceof (eTYPE_HORSE)) { std::shared_ptr horse = std::dynamic_pointer_cast(entity); if (horse->isAdult()) m_eHorseType = horse->getType(); diff --git a/targets/app/common/Tutorial/Tasks/InfoTask.cpp b/targets/app/common/Tutorial/Tasks/InfoTask.cpp index 65a41a07e..588ac0686 100644 --- a/targets/app/common/Tutorial/Tasks/InfoTask.cpp +++ b/targets/app/common/Tutorial/Tasks/InfoTask.cpp @@ -5,7 +5,6 @@ #include #include -#include "platform/input/input.h" #include "app/common/Tutorial/Constraints/InputConstraint.h" #include "app/common/Tutorial/Tasks/TutorialTask.h" #include "app/common/Tutorial/Tutorial.h" @@ -13,6 +12,7 @@ #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/world/level/material/Material.h" +#include "platform/input/input.h" InfoTask::InfoTask(Tutorial* tutorial, int descriptionId, int promptId /*= -1*/, bool requiresUserInput /*= false*/, int iMapping /*= 0*/) @@ -64,7 +64,7 @@ bool InfoTask::isCompleted() { bool current = (*it).second; if (!current) { if (PlatformInput.GetValue(pMinecraft->player->GetXboxPad(), - (*it).first) > 0) { + (*it).first) > 0) { (*it).second = true; bAllComplete = true; } else { diff --git a/targets/app/common/Tutorial/Tasks/ProcedureCompoundTask.h b/targets/app/common/Tutorial/Tasks/ProcedureCompoundTask.h index c78318b0d..c48dc7e3e 100644 --- a/targets/app/common/Tutorial/Tasks/ProcedureCompoundTask.h +++ b/targets/app/common/Tutorial/Tasks/ProcedureCompoundTask.h @@ -2,8 +2,8 @@ #include -#include "app/common/Tutorial/TutorialEnum.h" #include "TutorialTask.h" +#include "app/common/Tutorial/TutorialEnum.h" class Tutorial; diff --git a/targets/app/common/Tutorial/Tasks/ProgressFlagTask.h b/targets/app/common/Tutorial/Tasks/ProgressFlagTask.h index 03f0abb42..5d81d540b 100644 --- a/targets/app/common/Tutorial/Tasks/ProgressFlagTask.h +++ b/targets/app/common/Tutorial/Tasks/ProgressFlagTask.h @@ -1,8 +1,8 @@ #pragma once // using namespace std; +#include "TutorialTask.h" #include "app/common/Tutorial/Tasks/TutorialTask.h" #include "app/common/Tutorial/Tutorial.h" -#include "TutorialTask.h" class Tutorial; diff --git a/targets/app/common/Tutorial/Tasks/RideEntityTask.cpp b/targets/app/common/Tutorial/Tasks/RideEntityTask.cpp index af7a61733..b36f9de03 100644 --- a/targets/app/common/Tutorial/Tasks/RideEntityTask.cpp +++ b/targets/app/common/Tutorial/Tasks/RideEntityTask.cpp @@ -21,7 +21,7 @@ RideEntityTask::RideEntityTask(const int eType, Tutorial* tutorial, bool RideEntityTask::isCompleted() { return bIsCompleted; } void RideEntityTask::onRideEntity(std::shared_ptr entity) { - if (entity->instanceof((eINSTANCEOF)m_eType)) { + if (entity->instanceof ((eINSTANCEOF)m_eType)) { bIsCompleted = true; } } \ No newline at end of file diff --git a/targets/app/common/Tutorial/Tasks/StatTask.cpp b/targets/app/common/Tutorial/Tasks/StatTask.cpp index 1cba2d63a..bfaac9e16 100644 --- a/targets/app/common/Tutorial/Tasks/StatTask.cpp +++ b/targets/app/common/Tutorial/Tasks/StatTask.cpp @@ -1,9 +1,9 @@ #include "StatTask.h" -#include "platform/profile/profile.h" #include "app/common/Tutorial/Tasks/TutorialTask.h" #include "minecraft/client/Minecraft.h" #include "minecraft/stats/StatsCounter.h" +#include "platform/profile/profile.h" class Tutorial; @@ -23,7 +23,7 @@ bool StatTask::isCompleted() { Minecraft* minecraft = Minecraft::GetInstance(); bIsCompleted = - minecraft->stats[PlatformProfile.GetPrimaryPad()]->getTotalValue(stat) >= - (unsigned int)targetValue; + minecraft->stats[PlatformProfile.GetPrimaryPad()]->getTotalValue( + stat) >= (unsigned int)targetValue; return bIsCompleted; } \ No newline at end of file diff --git a/targets/app/common/Tutorial/Tasks/StateChangeTask.h b/targets/app/common/Tutorial/Tasks/StateChangeTask.h index af6e7cf20..e1235e388 100644 --- a/targets/app/common/Tutorial/Tasks/StateChangeTask.h +++ b/targets/app/common/Tutorial/Tasks/StateChangeTask.h @@ -1,7 +1,7 @@ #pragma once // using namespace std; -#include "app/common/Tutorial/Tutorial.h" #include "TutorialTask.h" +#include "app/common/Tutorial/Tutorial.h" class StateChangeTask : public TutorialTask { private: diff --git a/targets/app/common/Tutorial/Tutorial.cpp b/targets/app/common/Tutorial/Tutorial.cpp index 549bd5f6f..844085386 100644 --- a/targets/app/common/Tutorial/Tutorial.cpp +++ b/targets/app/common/Tutorial/Tutorial.cpp @@ -6,8 +6,7 @@ #include #include -#include "platform/profile/profile.h" -#include "minecraft/GameEnums.h" +#include "TutorialMessage.h" #include "app/common/App_structs.h" #include "app/common/Tutorial/Constraints/TutorialConstraint.h" #include "app/common/Tutorial/Hints/DiggerItemHint.h" @@ -23,10 +22,8 @@ #include "app/common/UI/All Platforms/UIStructs.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "TutorialMessage.h" -#include "util/Timer.h" -#include "util/StringHelpers.h" #include "java/Class.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLevel.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" @@ -45,7 +42,10 @@ #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/level/tile/TreeTile.h" #include "minecraft/world/level/tile/WallTile.h" +#include "platform/profile/profile.h" #include "strings.h" +#include "util/StringHelpers.h" +#include "util/Timer.h" class MobEffect; @@ -2131,7 +2131,8 @@ void Tutorial::tick() { if (!m_allowShow) { if (currentTask[m_CurrentState] != nullptr && (!currentTask[m_CurrentState]->AllowFade() || - (lastMessageTime + std::chrono::milliseconds(m_iTutorialDisplayMessageTime)) > + (lastMessageTime + + std::chrono::milliseconds(m_iTutorialDisplayMessageTime)) > time_util::clock::now())) { uiTempDisabled = true; } @@ -2152,7 +2153,8 @@ void Tutorial::tick() { if (ui.IsPauseMenuDisplayed(m_iPad)) { if (currentTask[m_CurrentState] != nullptr && (!currentTask[m_CurrentState]->AllowFade() || - (lastMessageTime + std::chrono::milliseconds(m_iTutorialDisplayMessageTime)) > + (lastMessageTime + + std::chrono::milliseconds(m_iTutorialDisplayMessageTime)) > time_util::clock::now())) { uiTempDisabled = true; } @@ -2232,7 +2234,9 @@ void Tutorial::tick() { isCurrentTask = false; if ((!task->ShowMinimumTime() || (task->hasBeenActivated() && - (lastMessageTime + std::chrono::milliseconds(m_iTutorialMinimumDisplayMessageTime)) < + (lastMessageTime + + std::chrono::milliseconds( + m_iTutorialMinimumDisplayMessageTime)) < time_util::clock::now())) && task->isCompleted()) { eTutorial_CompletionAction compAction = @@ -2323,7 +2327,9 @@ void Tutorial::tick() { } if (task != nullptr && task->ShowMinimumTime() && task->hasBeenActivated() && - (lastMessageTime + std::chrono::milliseconds(m_iTutorialMinimumDisplayMessageTime)) < + (lastMessageTime + + std::chrono::milliseconds( + m_iTutorialMinimumDisplayMessageTime)) < time_util::clock::now()) { task->setShownForMinimumTime(); @@ -2392,14 +2398,17 @@ void Tutorial::tick() { } } - if (m_hintDisplayed && (lastMessageTime + std::chrono::milliseconds(m_iTutorialDisplayMessageTime)) < - time_util::clock::now()) { + if (m_hintDisplayed && + (lastMessageTime + + std::chrono::milliseconds(m_iTutorialDisplayMessageTime)) < + time_util::clock::now()) { m_hintDisplayed = false; } if (currentFailedConstraint[m_CurrentState] == nullptr && currentTask[m_CurrentState] != nullptr && (m_iTaskReminders != 0) && - (lastMessageTime + std::chrono::milliseconds(m_iTaskReminders * m_iTutorialReminderTime)) < + (lastMessageTime + std::chrono::milliseconds(m_iTaskReminders * + m_iTutorialReminderTime)) < time_util::clock::now()) { // Reminder PopupMessageDetails* message = new PopupMessageDetails(); @@ -2428,7 +2437,8 @@ bool Tutorial::setMessage(PopupMessageDetails* message) { m_lastMessageState == m_CurrentState && message->isSameContent(m_lastMessage) && (!message->m_isReminder || - ((lastMessageTime + std::chrono::milliseconds(m_iTutorialReminderTime)) > + ((lastMessageTime + + std::chrono::milliseconds(m_iTutorialReminderTime)) > time_util::clock::now() && message->m_isReminder))) { delete message; @@ -2527,9 +2537,12 @@ bool Tutorial::setMessage(TutorialHint* hint, PopupMessageDetails* message) { if (message != nullptr && (message->m_forceDisplay || hintsOn) && (!message->m_delay || ((m_hintDisplayed && - (now - m_lastHintDisplayedTime) > std::chrono::milliseconds(m_iTutorialHintDelayTime)) || + (now - m_lastHintDisplayedTime) > + std::chrono::milliseconds(m_iTutorialHintDelayTime)) || (!m_hintDisplayed && - (now - lastMessageTime) > std::chrono::milliseconds(m_iTutorialMinimumDisplayMessageTime))))) { + (now - lastMessageTime) > + std::chrono::milliseconds( + m_iTutorialMinimumDisplayMessageTime))))) { messageShown = setMessage(message); if (messageShown) { @@ -2558,7 +2571,8 @@ void Tutorial::showTutorialPopup(bool show) { if (!show) { if (currentTask[m_CurrentState] != nullptr && (!currentTask[m_CurrentState]->AllowFade() || - (lastMessageTime + std::chrono::milliseconds(m_iTutorialDisplayMessageTime)) > + (lastMessageTime + + std::chrono::milliseconds(m_iTutorialDisplayMessageTime)) > time_util::clock::now())) { uiTempDisabled = true; } @@ -2786,8 +2800,8 @@ void Tutorial::onLookAtEntity(std::shared_ptr entity) { } } - if ((m_CurrentState == e_Tutorial_State_Gameplay) && - entity->instanceof(eTYPE_HORSE)) { + if ((m_CurrentState == e_Tutorial_State_Gameplay) && entity->instanceof + (eTYPE_HORSE)) { changeTutorialState(e_Tutorial_State_Horse); } diff --git a/targets/app/common/Tutorial/Tutorial.h b/targets/app/common/Tutorial/Tutorial.h index 5de42d941..c272aa5aa 100644 --- a/targets/app/common/Tutorial/Tutorial.h +++ b/targets/app/common/Tutorial/Tutorial.h @@ -9,14 +9,13 @@ #include #include -#include "util/Timer.h" - +#include "TutorialEnum.h" +#include "TutorialMessage.h" #include "app/common/Tutorial/Constraints/TutorialConstraint.h" #include "app/common/Tutorial/Hints/TutorialHint.h" #include "app/common/Tutorial/Tasks/TutorialTask.h" #include "app/common/Tutorial/TutorialEnum.h" -#include "TutorialEnum.h" -#include "TutorialMessage.h" +#include "util/Timer.h" class Entity; class ItemInstance; diff --git a/targets/app/common/UI/All Platforms/ArchiveFile.cpp b/targets/app/common/UI/All Platforms/ArchiveFile.cpp index af1034a2c..e5a07e58a 100644 --- a/targets/app/common/UI/All Platforms/ArchiveFile.cpp +++ b/targets/app/common/UI/All Platforms/ArchiveFile.cpp @@ -6,11 +6,11 @@ #include #include "app/linux/LinuxGame.h" -#include "platform/fs/fs.h" -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/FileInputStream.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" +#include "platform/fs/fs.h" void ArchiveFile::_readHeader(DataInputStream* dis) { int numberOfFiles = dis->readInt(); @@ -28,8 +28,7 @@ void ArchiveFile::_readHeader(DataInputStream* dis) { } else meta->isCompressed = false; - m_index.insert( - std::pair(meta->filename, meta)); + m_index.insert(std::pair(meta->filename, meta)); } } @@ -113,10 +112,9 @@ std::vector ArchiveFile::getFile(const std::string& filename) { const unsigned int fileSize = static_cast(data->filesize); std::uint8_t* pbData = new std::uint8_t[fileSize == 0 ? 1 : fileSize]; out = std::vector(pbData, pbData + fileSize); - auto readResult = - PlatformFilesystem.readFileSegment( - m_sourcefile.getPath(), static_cast(data->ptr), - out.data(), static_cast(data->filesize)); + auto readResult = PlatformFilesystem.readFileSegment( + m_sourcefile.getPath(), static_cast(data->ptr), + out.data(), static_cast(data->filesize)); if (readResult.status != IPlatformFilesystem::ReadStatus::Ok) { app.DebugPrintf("Failed to read archive file segment\n"); diff --git a/targets/app/common/UI/All Platforms/IUIController.h b/targets/app/common/UI/All Platforms/IUIController.h index 9bbd292b8..20a7c9fc6 100644 --- a/targets/app/common/UI/All Platforms/IUIController.h +++ b/targets/app/common/UI/All Platforms/IUIController.h @@ -1,9 +1,9 @@ #pragma once -#include "platform/storage/storage.h" #include "UIEnums.h" #include "UIStructs.h" #include "minecraft/sounds/SoundTypes.h" +#include "platform/storage/storage.h" // 4J Stu - An interface class that defines all the public functions that we use // within the game code. This allows us to build the Xbox 360 version without diff --git a/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp index a1b1c7c71..fc5da509f 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp @@ -7,14 +7,12 @@ #include #include -#include "platform/input/input.h" -#include "platform/renderer/renderer.h" -#include "minecraft/GameEnums.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" @@ -32,6 +30,8 @@ #include "minecraft/world/item/crafting/FurnaceRecipes.h" #include "minecraft/world/level/tile/entity/FurnaceTileEntity.h" #include "minecraft/world/phys/Vec3.h" +#include "platform/input/input.h" +#include "platform/renderer/renderer.h" #include "strings.h" IUIScene_AbstractContainerMenu::IUIScene_AbstractContainerMenu() { @@ -782,9 +782,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick() { buttonX = eToolTipPickUpHalf; } - { - buttonRT = eToolTipWhatIsThis; - } + { buttonRT = eToolTipWhatIsThis; } } else { // Nothing in slot and nothing in hand. } diff --git a/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h b/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h index dcf87e8ee..d558bf5e5 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h +++ b/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h @@ -3,9 +3,9 @@ #include #include +#include "UIStructs.h" #include "app/common/Tutorial/TutorialEnum.h" #include "app/common/UI/All Platforms/UIEnums.h" -#include "UIStructs.h" class HtmlString; class ItemInstance; diff --git a/targets/app/common/UI/All Platforms/IUIScene_CommandBlockMenu.h b/targets/app/common/UI/All Platforms/IUIScene_CommandBlockMenu.h index 2c106f76b..a7d052a0b 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_CommandBlockMenu.h +++ b/targets/app/common/UI/All Platforms/IUIScene_CommandBlockMenu.h @@ -1,8 +1,6 @@ #pragma once #include - - class CommandBlockEntity; class IUIScene_CommandBlockMenu { diff --git a/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp index 334afbb18..0539b5fb7 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp @@ -7,11 +7,11 @@ #include #include -#include "minecraft/Console_Debug_enum.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" +#include "minecraft/Console_Debug_enum.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" diff --git a/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.h b/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.h index f0d893e94..570249054 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.h +++ b/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.h @@ -110,8 +110,7 @@ protected: virtual void setIngredientDescriptionItem( int iPad, int index, std::shared_ptr item) = 0; virtual void setIngredientDescriptionRedBox(int index, bool show) = 0; - virtual void setIngredientDescriptionText(int index, - const char* text) = 0; + virtual void setIngredientDescriptionText(int index, const char* text) = 0; virtual void setShowCraftHSlot(int iIndex, bool show) = 0; virtual void showTabHighlight(int iIndex, bool show) = 0; virtual void setGroupText(const char* text) = 0; diff --git a/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.h b/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.h index 46522bac3..f3d86ae57 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.h +++ b/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.h @@ -1,8 +1,8 @@ #pragma once +#include "app/common/DLC/DLCPack.h" #include "platform/profile/profile.h" #include "platform/storage/storage.h" -#include "app/common/DLC/DLCPack.h" class DLCPack; @@ -13,20 +13,20 @@ protected: public: static int ExitGameDialogReturned(void* pParam, int iPad, IPlatformStorage::EMessageResult result); - static int ExitGameSaveDialogReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); + static int ExitGameSaveDialogReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); static int ExitGameAndSaveReturned(void* pParam, int iPad, IPlatformStorage::EMessageResult result); - static int ExitGameDeclineSaveReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); + static int ExitGameDeclineSaveReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); static int WarningTrialTexturePackReturned( void* pParam, int iPad, IPlatformStorage::EMessageResult result); static int SaveGameDialogReturned(void* pParam, int iPad, IPlatformStorage::EMessageResult result); - static int EnableAutosaveDialogReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); - static int DisableAutosaveDialogReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); + static int EnableAutosaveDialogReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); + static int DisableAutosaveDialogReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); static int SaveWorldThreadProc(void* lpParameter); static int ExitWorldThreadProc(void* lpParameter); diff --git a/targets/app/common/UI/All Platforms/UIStructs.h b/targets/app/common/UI/All Platforms/UIStructs.h index d8d695266..6ca6d7545 100644 --- a/targets/app/common/UI/All Platforms/UIStructs.h +++ b/targets/app/common/UI/All Platforms/UIStructs.h @@ -6,11 +6,11 @@ #include #include +#include "UIEnums.h" #include "minecraft/GameHostOptions.h" #include "minecraft/XuiActionPayload.h" #include "platform/C4JThread.h" #include "platform/storage/storage.h" -#include "UIEnums.h" class Container; class Inventory; @@ -385,7 +385,7 @@ typedef struct _SignInInfo { // Credits struct SCreditTextItemDef { const char* m_Text; // Should contain string, optionally with %s to add - // in translated string ... e.g. "Andy West - %s" + // in translated string ... e.g. "Andy West - %s" int m_iStringID[2]; // May be NO_TRANSLATED_STRING if we do not require to // add any translated string. ECreditTextTypes m_eType; diff --git a/targets/app/common/UI/Components/UIComponent_Chat.cpp b/targets/app/common/UI/Components/UIComponent_Chat.cpp index b72ea71e7..daed9d34d 100644 --- a/targets/app/common/UI/Components/UIComponent_Chat.cpp +++ b/targets/app/common/UI/Components/UIComponent_Chat.cpp @@ -2,12 +2,12 @@ #include -#include "platform/renderer/renderer.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" +#include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Components/UIComponent_Chat.h b/targets/app/common/UI/Components/UIComponent_Chat.h index 9e72a38b0..e99098640 100644 --- a/targets/app/common/UI/Components/UIComponent_Chat.h +++ b/targets/app/common/UI/Components/UIComponent_Chat.h @@ -2,12 +2,12 @@ #include -#include "platform/renderer/renderer.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" +#include "platform/renderer/renderer.h" class UILayer; diff --git a/targets/app/common/UI/Components/UIComponent_Logo.cpp b/targets/app/common/UI/Components/UIComponent_Logo.cpp index 57d5165e4..05517c41b 100644 --- a/targets/app/common/UI/Components/UIComponent_Logo.cpp +++ b/targets/app/common/UI/Components/UIComponent_Logo.cpp @@ -1,8 +1,8 @@ #include "UIComponent_Logo.h" -#include "platform/renderer/renderer.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" +#include "platform/renderer/renderer.h" UIComponent_Logo::UIComponent_Logo(int iPad, void* initData, UILayer* parentLayer) diff --git a/targets/app/common/UI/Components/UIComponent_MenuBackground.cpp b/targets/app/common/UI/Components/UIComponent_MenuBackground.cpp index 7ad96e0f3..badb6e95b 100644 --- a/targets/app/common/UI/Components/UIComponent_MenuBackground.cpp +++ b/targets/app/common/UI/Components/UIComponent_MenuBackground.cpp @@ -1,9 +1,9 @@ #include "UIComponent_MenuBackground.h" -#include "platform/renderer/renderer.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" +#include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif @@ -41,8 +41,8 @@ std::string UIComponent_MenuBackground::getMoviePath() { return "MenuBackground"; } -void UIComponent_MenuBackground::render(S32 width, S32 height, - IPlatformRenderer::eViewportType viewport) { +void UIComponent_MenuBackground::render( + S32 width, S32 height, IPlatformRenderer::eViewportType viewport) { if (m_bSplitscreen) { S32 xPos = 0; S32 yPos = 0; diff --git a/targets/app/common/UI/Components/UIComponent_MenuBackground.h b/targets/app/common/UI/Components/UIComponent_MenuBackground.h index 5daaff3a6..1a9f8a985 100644 --- a/targets/app/common/UI/Components/UIComponent_MenuBackground.h +++ b/targets/app/common/UI/Components/UIComponent_MenuBackground.h @@ -2,10 +2,10 @@ #include -#include "platform/renderer/renderer.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" +#include "platform/renderer/renderer.h" class UILayer; diff --git a/targets/app/common/UI/Components/UIComponent_Panorama.cpp b/targets/app/common/UI/Components/UIComponent_Panorama.cpp index 154e5c15f..06c93c0d5 100644 --- a/targets/app/common/UI/Components/UIComponent_Panorama.cpp +++ b/targets/app/common/UI/Components/UIComponent_Panorama.cpp @@ -4,10 +4,10 @@ #include -#include "platform/renderer/renderer.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" +#include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Components/UIComponent_Panorama.h b/targets/app/common/UI/Components/UIComponent_Panorama.h index fafc1c914..976f6c462 100644 --- a/targets/app/common/UI/Components/UIComponent_Panorama.h +++ b/targets/app/common/UI/Components/UIComponent_Panorama.h @@ -2,10 +2,10 @@ #include -#include "platform/renderer/renderer.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" +#include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Components/UIComponent_PressStartToPlay.h b/targets/app/common/UI/Components/UIComponent_PressStartToPlay.h index d59340d6c..364cc3845 100644 --- a/targets/app/common/UI/Components/UIComponent_PressStartToPlay.h +++ b/targets/app/common/UI/Components/UIComponent_PressStartToPlay.h @@ -2,12 +2,12 @@ #include -#include "platform/PlatformTypes.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" +#include "platform/PlatformTypes.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Components/UIComponent_Tooltips.cpp b/targets/app/common/UI/Components/UIComponent_Tooltips.cpp index 44c7c6f51..1e9eb4716 100644 --- a/targets/app/common/UI/Components/UIComponent_Tooltips.cpp +++ b/targets/app/common/UI/Components/UIComponent_Tooltips.cpp @@ -1,13 +1,13 @@ #include "UIComponent_Tooltips.h" -#include "platform/profile/profile.h" -#include "platform/renderer/renderer.h" -#include "minecraft/GameEnums.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" #include "app/linux/Iggy/include/iggy.h" +#include "minecraft/GameEnums.h" +#include "platform/profile/profile.h" +#include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Components/UIComponent_Tooltips.h b/targets/app/common/UI/Components/UIComponent_Tooltips.h index b0bc2ea15..1c0b0dd8b 100644 --- a/targets/app/common/UI/Components/UIComponent_Tooltips.h +++ b/targets/app/common/UI/Components/UIComponent_Tooltips.h @@ -2,13 +2,13 @@ #include -#include "platform/PlatformTypes.h" -#include "platform/renderer/renderer.h" -#include "minecraft/GameEnums.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" #include "app/linux/Iggy/include/iggy.h" +#include "minecraft/GameEnums.h" +#include "platform/PlatformTypes.h" +#include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Components/UIComponent_TutorialPopup.cpp b/targets/app/common/UI/Components/UIComponent_TutorialPopup.cpp index a20cc72a3..ea72371d1 100644 --- a/targets/app/common/UI/Components/UIComponent_TutorialPopup.cpp +++ b/targets/app/common/UI/Components/UIComponent_TutorialPopup.cpp @@ -4,8 +4,6 @@ #include -#include "platform/profile/profile.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" @@ -13,13 +11,15 @@ #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "util/StringHelpers.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/profile/profile.h" #include "strings.h" +#include "util/StringHelpers.h" UIComponent_TutorialPopup::UIComponent_TutorialPopup(int iPad, void* initData, UILayer* parentLayer) @@ -248,8 +248,7 @@ void UIComponent_TutorialPopup::_SetDescription(UIScene* interactScene, } std::string UIComponent_TutorialPopup::_SetIcon(int icon, int iAuxVal, - bool isFoil, - const char* desc) { + bool isFoil, const char* desc) { std::string temp(desc); bool isFixedIcon = false; @@ -362,7 +361,7 @@ std::string UIComponent_TutorialPopup::_SetImage(std::string& desc) { } std::string UIComponent_TutorialPopup::ParseDescription(int iPad, - std::string& text) { + std::string& text) { text = replaceAll(text, "{*CraftingTableIcon*}", ""); text = replaceAll(text, "{*SticksIcon*}", ""); text = replaceAll(text, "{*PlanksIcon*}", ""); @@ -442,8 +441,8 @@ void UIComponent_TutorialPopup::UpdateInteractScenePosition(bool visible) { } } -void UIComponent_TutorialPopup::render(S32 width, S32 height, - IPlatformRenderer::eViewportType viewport) { +void UIComponent_TutorialPopup::render( + S32 width, S32 height, IPlatformRenderer::eViewportType viewport) { if (viewport != IPlatformRenderer::VIEWPORT_TYPE_FULLSCREEN) { S32 xPos = 0; S32 yPos = 0; diff --git a/targets/app/common/UI/Components/UIComponent_TutorialPopup.h b/targets/app/common/UI/Components/UIComponent_TutorialPopup.h index eecb81729..36d2d2aca 100644 --- a/targets/app/common/UI/Components/UIComponent_TutorialPopup.h +++ b/targets/app/common/UI/Components/UIComponent_TutorialPopup.h @@ -3,13 +3,13 @@ #include #include -#include "platform/renderer/renderer.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" +#include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif @@ -115,8 +115,7 @@ private: void _SetDescription(UIScene* interactScene, const std::string& desc, const std::string& title, bool allowFade, bool isReminder); - std::string _SetIcon(int icon, int iAuxVal, bool isFoil, - const char* desc); + std::string _SetIcon(int icon, int iAuxVal, bool isFoil, const char* desc); std::string _SetImage(std::string& desc); std::string ParseDescription(int iPad, std::string& text); void UpdateInteractScenePosition(bool visible); diff --git a/targets/app/common/UI/Components/UIScene_HUD.cpp b/targets/app/common/UI/Components/UIScene_HUD.cpp index 9a3bd4044..4d6fb58c7 100644 --- a/targets/app/common/UI/Components/UIScene_HUD.cpp +++ b/targets/app/common/UI/Components/UIScene_HUD.cpp @@ -4,15 +4,13 @@ #include #include -#include "platform/profile/profile.h" -#include "minecraft/GameEnums.h" #include "app/common/UI/Components/UIComponent_Chat.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "util/StringHelpers.h" +#include "minecraft/GameEnums.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Gui.h" @@ -22,7 +20,9 @@ #include "minecraft/world/inventory/InventoryMenu.h" #include "minecraft/world/inventory/Slot.h" #include "minecraft/world/item/ItemInstance.h" +#include "platform/profile/profile.h" #include "strings.h" +#include "util/StringHelpers.h" UIScene_HUD::UIScene_HUD(int iPad, void* initData, UILayer* parentLayer) : UIScene(iPad, parentLayer) { @@ -261,9 +261,10 @@ void UIScene_HUD::handleReload() { repositionHud(); - SetTooltipsEnabled(((ui.GetMenuDisplayed(PlatformProfile.GetPrimaryPad())) || - (app.GetGameSettings(PlatformProfile.GetPrimaryPad(), - eGameSetting_Tooltips) != 0))); + SetTooltipsEnabled( + ((ui.GetMenuDisplayed(PlatformProfile.GetPrimaryPad())) || + (app.GetGameSettings(PlatformProfile.GetPrimaryPad(), + eGameSetting_Tooltips) != 0))); } int UIScene_HUD::getPad() { return m_iPad; } diff --git a/targets/app/common/UI/Components/UIScene_HUD.h b/targets/app/common/UI/Components/UIScene_HUD.h index 33e30f98a..adca8d77a 100644 --- a/targets/app/common/UI/Components/UIScene_HUD.h +++ b/targets/app/common/UI/Components/UIScene_HUD.h @@ -2,13 +2,13 @@ #include -#include "platform/renderer/renderer.h" #include "app/common/UI/All Platforms/IUIScene_HUD.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" +#include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Controls/UIControl_Base.cpp b/targets/app/common/UI/Controls/UIControl_Base.cpp index 0476a6ea5..2bea9da0b 100644 --- a/targets/app/common/UI/Controls/UIControl_Base.cpp +++ b/targets/app/common/UI/Controls/UIControl_Base.cpp @@ -91,8 +91,7 @@ const char* UIControl_Base::getLabel() { return m_label.c_str(); } -void UIControl_Base::setAllPossibleLabels(int labelCount, - char labels[][256]) { +void UIControl_Base::setAllPossibleLabels(int labelCount, char labels[][256]) { IggyDataValue result; IggyDataValue* value = new IggyDataValue[labelCount]; IggyStringUTF8* stringVal = new IggyStringUTF8[labelCount]; diff --git a/targets/app/common/UI/Controls/UIControl_DynamicLabel.cpp b/targets/app/common/UI/Controls/UIControl_DynamicLabel.cpp index 9e78ba8a1..27eee671d 100644 --- a/targets/app/common/UI/Controls/UIControl_DynamicLabel.cpp +++ b/targets/app/common/UI/Controls/UIControl_DynamicLabel.cpp @@ -26,8 +26,7 @@ bool UIControl_DynamicLabel::setupControl(UIScene* scene, IggyValuePath* parent, return success; } -void UIControl_DynamicLabel::addText(const std::string& text, - bool bLastEntry) { +void UIControl_DynamicLabel::addText(const std::string& text, bool bLastEntry) { IggyDataValue result; IggyDataValue value[2]; diff --git a/targets/app/common/UI/Controls/UIControl_DynamicLabel.h b/targets/app/common/UI/Controls/UIControl_DynamicLabel.h index eaa15c650..ab45fb6b3 100644 --- a/targets/app/common/UI/Controls/UIControl_DynamicLabel.h +++ b/targets/app/common/UI/Controls/UIControl_DynamicLabel.h @@ -9,8 +9,8 @@ #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" #include "UIControl_Base.h" +#include "app/linux/Iggy/include/rrCore.h" class UIControl_DynamicLabel : public UIControl_Label { private: diff --git a/targets/app/common/UI/Controls/UIControl_EnchantmentBook.cpp b/targets/app/common/UI/Controls/UIControl_EnchantmentBook.cpp index 072919ad4..d4a30af59 100644 --- a/targets/app/common/UI/Controls/UIControl_EnchantmentBook.cpp +++ b/targets/app/common/UI/Controls/UIControl_EnchantmentBook.cpp @@ -2,10 +2,10 @@ #include -#include "platform/renderer/renderer.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.h" #include "app/linux/Iggy/include/iggy.h" +#include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Controls/UIControl_EnchantmentButton.cpp b/targets/app/common/UI/Controls/UIControl_EnchantmentButton.cpp index ccd57d319..473029c07 100644 --- a/targets/app/common/UI/Controls/UIControl_EnchantmentButton.cpp +++ b/targets/app/common/UI/Controls/UIControl_EnchantmentButton.cpp @@ -5,24 +5,23 @@ #include #include -#include "platform/renderer/renderer.h" -#include "minecraft/GameEnums.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" +#include "minecraft/GameEnums.h" +#include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif #include "app/linux/LinuxGame.h" -#include "util/StringHelpers.h" - #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Font.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/world/entity/player/Abilities.h" #include "minecraft/world/inventory/EnchantmentMenu.h" +#include "util/StringHelpers.h" UIControl_EnchantmentButton::UIControl_EnchantmentButton() { m_index = 0; @@ -210,11 +209,10 @@ UIControl_EnchantmentButton::EnchantmentNames::EnchantmentNames() { "physical grow shrink demon elemental spirit animal creature beast " "humanoid undead fresh stale "; std::istringstream iss(allWords); - std::copy(std::istream_iterator >(iss), - std::istream_iterator >(), - std::back_inserter(words)); + std::copy( + std::istream_iterator >(iss), + std::istream_iterator >(), + std::back_inserter(words)); } std::string UIControl_EnchantmentButton::EnchantmentNames::getRandomName() { diff --git a/targets/app/common/UI/Controls/UIControl_HTMLLabel.h b/targets/app/common/UI/Controls/UIControl_HTMLLabel.h index 7a988f703..0fad90b1c 100644 --- a/targets/app/common/UI/Controls/UIControl_HTMLLabel.h +++ b/targets/app/common/UI/Controls/UIControl_HTMLLabel.h @@ -10,8 +10,8 @@ #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" #include "UIControl_Base.h" +#include "app/linux/Iggy/include/rrCore.h" class UIControl_HTMLLabel : public UIControl_Label { private: diff --git a/targets/app/common/UI/Controls/UIControl_LeaderboardList.cpp b/targets/app/common/UI/Controls/UIControl_LeaderboardList.cpp index 745d6eeb3..fbd71e762 100644 --- a/targets/app/common/UI/Controls/UIControl_LeaderboardList.cpp +++ b/targets/app/common/UI/Controls/UIControl_LeaderboardList.cpp @@ -108,9 +108,8 @@ void UIControl_LeaderboardList::setColumnIcon(int iColumn, int iType) { void UIControl_LeaderboardList::addDataSet( bool bLast, int iId, int iRank, const std::string& gamertag, bool bDisplayMessage, const std::string& col0, const std::string& col1, - const std::string& col2, const std::string& col3, - const std::string& col4, const std::string& col5, - const std::string& col6) { + const std::string& col2, const std::string& col3, const std::string& col4, + const std::string& col5, const std::string& col6) { IggyDataValue result; IggyDataValue value[12]; diff --git a/targets/app/common/UI/Controls/UIControl_LeaderboardList.h b/targets/app/common/UI/Controls/UIControl_LeaderboardList.h index dd6acf80f..9129443f7 100644 --- a/targets/app/common/UI/Controls/UIControl_LeaderboardList.h +++ b/targets/app/common/UI/Controls/UIControl_LeaderboardList.h @@ -47,10 +47,9 @@ public: void setupTitles(const std::string& rank, const std::string& gamertag); void initLeaderboard(int iFirstFocus, int iTotalEntries, int iNumColumns); void setColumnIcon(int iColumn, int iType); - void addDataSet(bool bLast, int iId, int iRank, - const std::string& gamertag, bool bDisplayMessage, - const std::string& col0, const std::string& col1, - const std::string& col2, const std::string& col3, - const std::string& col4, const std::string& col5, - const std::string& col6); + void addDataSet(bool bLast, int iId, int iRank, const std::string& gamertag, + bool bDisplayMessage, const std::string& col0, + const std::string& col1, const std::string& col2, + const std::string& col3, const std::string& col4, + const std::string& col5, const std::string& col6); }; \ No newline at end of file diff --git a/targets/app/common/UI/Controls/UIControl_MinecraftHorse.cpp b/targets/app/common/UI/Controls/UIControl_MinecraftHorse.cpp index 252e1e9f3..ac1faa19f 100644 --- a/targets/app/common/UI/Controls/UIControl_MinecraftHorse.cpp +++ b/targets/app/common/UI/Controls/UIControl_MinecraftHorse.cpp @@ -1,14 +1,12 @@ #include "app/common/UI/Controls/UIControl_MinecraftHorse.h" - - #include #include -#include "platform/renderer/renderer.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.h" #include "app/linux/Iggy/include/iggy.h" +#include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Controls/UIControl_MinecraftPlayer.cpp b/targets/app/common/UI/Controls/UIControl_MinecraftPlayer.cpp index ed5fee485..29d4bee4a 100644 --- a/targets/app/common/UI/Controls/UIControl_MinecraftPlayer.cpp +++ b/targets/app/common/UI/Controls/UIControl_MinecraftPlayer.cpp @@ -1,14 +1,12 @@ #include "UIControl_MinecraftPlayer.h" - - #include #include -#include "platform/renderer/renderer.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.h" #include "app/linux/Iggy/include/iggy.h" +#include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Controls/UIControl_PlayerSkinPreview.cpp b/targets/app/common/UI/Controls/UIControl_PlayerSkinPreview.cpp index 7c0714642..54b27ca61 100644 --- a/targets/app/common/UI/Controls/UIControl_PlayerSkinPreview.cpp +++ b/targets/app/common/UI/Controls/UIControl_PlayerSkinPreview.cpp @@ -6,15 +6,14 @@ #include #include -#include "platform/renderer/renderer.h" -#include "minecraft/GameEnums.h" #include "app/common/UI/Controls/UIControl.h" #include "app/linux/Iggy/include/iggy.h" +#include "minecraft/GameEnums.h" +#include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif #include "app/linux/LinuxGame.h" - #include "java/Class.h" #include "minecraft/client/Lighting.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/UI/Controls/UIControl_Slider.cpp b/targets/app/common/UI/Controls/UIControl_Slider.cpp index 1c54934c8..863dbc049 100644 --- a/targets/app/common/UI/Controls/UIControl_Slider.cpp +++ b/targets/app/common/UI/Controls/UIControl_Slider.cpp @@ -10,8 +10,8 @@ #endif #include "app/linux/Iggy/include/rrCore.h" #include "app/linux/Linux_UIController.h" -#include "util/StringHelpers.h" #include "minecraft/sounds/SoundTypes.h" +#include "util/StringHelpers.h" UIControl_Slider::UIControl_Slider() { m_id = 0; diff --git a/targets/app/common/UI/Controls/UIControl_Slider.h b/targets/app/common/UI/Controls/UIControl_Slider.h index 9481fa15c..823e55290 100644 --- a/targets/app/common/UI/Controls/UIControl_Slider.h +++ b/targets/app/common/UI/Controls/UIControl_Slider.h @@ -11,8 +11,8 @@ #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" #include "UIControl_Base.h" +#include "app/linux/Iggy/include/rrCore.h" class UIControl_Slider : public UIControl_Base { private: diff --git a/targets/app/common/UI/Controls/UIControl_TexturePackList.h b/targets/app/common/UI/Controls/UIControl_TexturePackList.h index de7dab64a..8972fd657 100644 --- a/targets/app/common/UI/Controls/UIControl_TexturePackList.h +++ b/targets/app/common/UI/Controls/UIControl_TexturePackList.h @@ -9,8 +9,8 @@ #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" #include "UIControl_Base.h" +#include "app/linux/Iggy/include/rrCore.h" class UIControl_TexturePackList : public UIControl_Base { private: diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp b/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp index 7a3575fa9..b44a29812 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp @@ -3,9 +3,6 @@ #include -#include "platform/input/input.h" -#include "platform/profile/profile.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" @@ -15,9 +12,12 @@ #include "app/linux/Iggy/include/rrCore.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" +#include "minecraft/GameEnums.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/chunk/ChunkSource.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" +#include "platform/input/input.h" +#include "platform/profile/profile.h" class UILayer; #ifdef _DEBUG_MENUS_ENABLED diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.cpp b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.cpp index 47b5fc4cb..34485f76d 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.cpp +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.cpp @@ -1,8 +1,8 @@ #include "UIScene_DebugOptions.h" -#include "minecraft/Console_Debug_enum.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" +#include "minecraft/Console_Debug_enum.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.h b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.h index f29aa978a..1f4a1f192 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.h +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.h @@ -2,10 +2,10 @@ #include -#include "minecraft/Console_Debug_enum.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/UIScene.h" +#include "minecraft/Console_Debug_enum.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp index 805a4c2c2..d07d22aac 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp @@ -5,8 +5,6 @@ #include -#include "platform/profile/profile.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" @@ -14,6 +12,8 @@ #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" +#include "minecraft/GameEnums.h" +#include "platform/profile/profile.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif @@ -33,13 +33,13 @@ class Player; class UILayer; #ifdef _DEBUG_MENUS_ENABLED -#include "util/StringHelpers.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/ClientConnection.h" #include "minecraft/client/multiplayer/MultiPlayerLevel.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/client/renderer/GameRenderer.h" #include "minecraft/server/MinecraftServer.h" +#include "util/StringHelpers.h" UIScene_DebugOverlay::UIScene_DebugOverlay(int iPad, void* initData, UILayer* parentLayer) diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp b/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp index 435bd2cd3..5037a116d 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp @@ -5,9 +5,6 @@ #include -#include "platform/input/input.h" -#include "platform/profile/profile.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" @@ -17,13 +14,16 @@ #include "app/linux/Iggy/include/rrCore.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" +#include "minecraft/GameEnums.h" #include "minecraft/world/phys/Vec3.h" +#include "platform/input/input.h" +#include "platform/profile/profile.h" class UILayer; #ifdef _DEBUG_MENUS_ENABLED -#include "util/StringHelpers.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" +#include "util/StringHelpers.h" UIScene_DebugSetCamera::UIScene_DebugSetCamera(int iPad, void* initData, UILayer* parentLayer) @@ -78,9 +78,7 @@ UIScene_DebugSetCamera::UIScene_DebugSetCamera(int iPad, void* initData, m_labelYRotElev.init("Y-Rot & Elevation (Degs)"); } -std::string UIScene_DebugSetCamera::getMoviePath() { - return "DebugSetCamera"; -} +std::string UIScene_DebugSetCamera::getMoviePath() { return "DebugSetCamera"; } void UIScene_DebugSetCamera::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.cpp index 9fc4d9e3e..b1d4ad79d 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.cpp @@ -4,7 +4,6 @@ #include -#include "platform/profile/profile.h" #include "app/common/App_structs.h" #include "app/common/DLC/DLCManager.h" #include "app/common/UI/Controls/UIControl_BitmapIcon.h" @@ -16,6 +15,7 @@ #include "minecraft/client/Minecraft.h" #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" +#include "platform/profile/profile.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.h b/targets/app/common/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.h index b38d136ee..8fbf9ff13 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.h @@ -2,7 +2,6 @@ #include -#include "platform/storage/storage.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_BitmapIcon.h" @@ -10,6 +9,7 @@ #include "app/common/UI/Controls/UIControl_TexturePackList.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" +#include "platform/storage/storage.h" class UILayer; @@ -54,8 +54,8 @@ protected: static int TrialTexturePackWarningReturned( void* pParam, int iPad, IPlatformStorage::EMessageResult result); - static int UnlockTexturePackReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); - static int TexturePackDialogReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); + static int UnlockTexturePackReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); + static int TexturePackDialogReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); }; \ No newline at end of file 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 f5fd6afc8..0dfc0d3a1 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 @@ -6,12 +6,6 @@ #include #include -#include "platform/PlatformTypes.h" -#include "platform/input/input.h" -#include "platform/profile/profile.h" -#include "minecraft/GameHostOptions.h" -#include "minecraft/GameTypes.h" -#include "minecraft/GameEnums.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" #include "app/common/Network/GameNetworkManager.h" @@ -25,8 +19,9 @@ #include "app/common/UI/UILayer.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "platform/NetTypes.h" -#include "util/StringHelpers.h" +#include "minecraft/GameEnums.h" +#include "minecraft/GameHostOptions.h" +#include "minecraft/GameTypes.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/Options.h" #include "minecraft/client/skins/DLCTexturePack.h" @@ -36,7 +31,12 @@ #include "minecraft/sounds/SoundTypes.h" #include "minecraft/world/level/LevelSettings.h" #include "minecraft/world/level/chunk/ChunkSource.h" +#include "platform/NetTypes.h" +#include "platform/PlatformTypes.h" +#include "platform/input/input.h" +#include "platform/profile/profile.h" #include "strings.h" +#include "util/StringHelpers.h" #if defined(_WINDOWS64) @@ -198,8 +198,7 @@ UIScene_CreateWorldMenu::UIScene_CreateWorldMenu(int iPad, void* initData, snprintf(imageName, 64, "tpack%08x", tp->getId()); registerSubstitutionTexture(imageName, imageData, imageBytes); m_texturePackList.addPack(i, imageName); - app.DebugPrintf("Adding texture pack %s at %d\n", imageName, - i); + app.DebugPrintf("Adding texture pack %s at %d\n", imageName, i); } } @@ -571,7 +570,6 @@ void UIScene_CreateWorldMenu::handleGainFocus(bool navBack) { } } - void UIScene_CreateWorldMenu::checkStateAndStartGame() { int primaryPad = PlatformProfile.GetPrimaryPad(); bool isSignedInLive = true; @@ -587,7 +585,8 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame() { iPadNotSignedInLive = i; } - isSignedInLive = isSignedInLive && PlatformProfile.IsSignedInLive(i); + isSignedInLive = + isSignedInLive && PlatformProfile.IsSignedInLive(i); } } @@ -622,7 +621,8 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame() { // the sign-in UI again int connectedControllers = 0; for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { - if (PlatformInput.IsPadConnected(i) || PlatformProfile.IsSignedIn(i)) + if (PlatformInput.IsPadConnected(i) || + PlatformProfile.IsSignedIn(i)) ++connectedControllers; } @@ -894,9 +894,9 @@ int UIScene_CreateWorldMenu::StartGame_SignInReturned(void* pParam, if (bContinue == true) { // It's possible that the player has not signed in - they can back out if (PlatformProfile.IsSignedIn(pClass->m_iPad)) { - bool isOnlineGame = - PlatformProfile.IsSignedInLive(PlatformProfile.GetPrimaryPad()) && - pClass->m_MoreOptionsParams.bOnlineGame; + bool isOnlineGame = PlatformProfile.IsSignedInLive( + PlatformProfile.GetPrimaryPad()) && + pClass->m_MoreOptionsParams.bOnlineGame; // bool isOnlineGame = pClass->m_MoreOptionsParams.bOnlineGame; int primaryPad = PlatformProfile.GetPrimaryPad(); bool noPrivileges = false; @@ -989,7 +989,8 @@ int UIScene_CreateWorldMenu::ConfirmCreateReturned( // the sign-in UI again int connectedControllers = 0; for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { - if (PlatformInput.IsPadConnected(i) || PlatformProfile.IsSignedIn(i)) + if (PlatformInput.IsPadConnected(i) || + PlatformProfile.IsSignedIn(i)) ++connectedControllers; } @@ -1007,9 +1008,9 @@ int UIScene_CreateWorldMenu::ConfirmCreateReturned( } else { // Check if user-created content is allowed, as we cannot play // multiplayer if it's not - bool isClientSide = - PlatformProfile.IsSignedInLive(PlatformProfile.GetPrimaryPad()) && - pClass->m_MoreOptionsParams.bOnlineGame; + bool isClientSide = PlatformProfile.IsSignedInLive( + PlatformProfile.GetPrimaryPad()) && + pClass->m_MoreOptionsParams.bOnlineGame; bool noUGC = false; bool pccAllowed = true; bool pccFriendsAllowed = true; diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.h index ee1237adb..efd4827b6 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.h @@ -4,7 +4,6 @@ #include -#include "platform/storage/storage.h" #include "IUIScene_StartGame.h" #include "app/common/DLC/DLCPack.h" #include "app/common/UI/All Platforms/UIEnums.h" @@ -18,6 +17,7 @@ #include "app/common/UI/Controls/UIControl_TexturePackList.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" +#include "platform/storage/storage.h" class DLCPack; class UILayer; 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 f028964d1..4cf330511 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 @@ -1,13 +1,13 @@ #include "UIScene_DLCMainMenu.h" -#include "minecraft/GameEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_ButtonList.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" +#include "minecraft/GameEnums.h" #include "strings.h" class UILayer; @@ -93,8 +93,8 @@ void UIScene_DLCMainMenu::handlePress(F64 controlId, F64 childId) { void UIScene_DLCMainMenu::handleTimerComplete(int id) {} -int UIScene_DLCMainMenu::ExitDLCMainMenu(void* pParam, int iPad, - IPlatformStorage::EMessageResult result) { +int UIScene_DLCMainMenu::ExitDLCMainMenu( + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { UIScene_DLCMainMenu* pClass = (UIScene_DLCMainMenu*)pParam; pClass->navigateBack(); diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.h index c216c32ff..ee8f07798 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.h @@ -2,13 +2,13 @@ #include -#include "platform/storage/storage.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_ButtonList.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" +#include "platform/storage/storage.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.cpp index c02b8a636..e09f759df 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.cpp @@ -3,8 +3,6 @@ #include -#include "platform/PlatformTypes.h" -#include "platform/renderer/renderer.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_DLCList.h" #include "app/common/UI/Controls/UIControl_HTMLLabel.h" @@ -12,6 +10,8 @@ #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" +#include "platform/PlatformTypes.h" +#include "platform/renderer/renderer.h" #include "strings.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.h index 584bb262f..cd8e03fc6 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.h @@ -2,7 +2,6 @@ #include -#include "platform/storage/storage.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_BitmapIcon.h" @@ -11,6 +10,7 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" +#include "platform/storage/storage.h" class UILayer; 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 3737ca710..a2580ec13 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 @@ -3,18 +3,18 @@ #include -#include "platform/PlatformTypes.h" -#include "platform/input/input.h" -#include "platform/profile/profile.h" -#include "minecraft/GameTypes.h" -#include "minecraft/GameEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_DynamicLabel.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" +#include "minecraft/GameEnums.h" +#include "minecraft/GameTypes.h" #include "minecraft/sounds/SoundTypes.h" +#include "platform/PlatformTypes.h" +#include "platform/input/input.h" +#include "platform/profile/profile.h" #include "strings.h" UIScene_EULA::UIScene_EULA(int iPad, void* initData, UILayer* parentLayer) @@ -32,8 +32,7 @@ UIScene_EULA::UIScene_EULA(int iPad, void* initData, UILayer* parentLayer) std::vector paragraphs; int lastIndex = 0; for (int index = EULA.find("\r\n", lastIndex, 2); - index != std::string::npos; - index = EULA.find("\r\n", lastIndex, 2)) { + index != std::string::npos; index = EULA.find("\r\n", lastIndex, 2)) { paragraphs.push_back(EULA.substr(lastIndex, index - lastIndex) + " "); lastIndex = index + 2; } @@ -45,7 +44,8 @@ UIScene_EULA::UIScene_EULA(int iPad, void* initData, UILayer* parentLayer) // 4J-PB - If we have a signed in user connected, let's get the DLC now for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { - if ((PlatformInput.IsPadConnected(i) || PlatformProfile.IsSignedIn(i))) { + if ((PlatformInput.IsPadConnected(i) || + PlatformProfile.IsSignedIn(i))) { if (!app.DLCInstallProcessCompleted() && !app.DLCInstallPending()) { app.StartInstallDLCProcess(i); break; 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 aa6abf132..929f44e16 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 @@ -4,9 +4,7 @@ #include #include -#include "minecraft/GameTypes.h" #include "app/common/Network/GameNetworkManager.h" -#include "minecraft/network/platform/SessionInfo.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_ButtonList.h" @@ -16,6 +14,8 @@ #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "minecraft/GameEnums.h" +#include "minecraft/GameTypes.h" +#include "minecraft/network/platform/SessionInfo.h" #include "minecraft/sounds/SoundTypes.h" #include "minecraft/world/Difficulty.h" #include "minecraft/world/level/LevelSettings.h" diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_JoinMenu.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_JoinMenu.h index 67f2121ed..9f65aceba 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_JoinMenu.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_JoinMenu.h @@ -2,13 +2,13 @@ #include -#include "platform/storage/storage.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_ButtonList.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" +#include "platform/storage/storage.h" class FriendSessionInfo; class UILayer; 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 076b50bb8..bdc50c4da 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 @@ -4,12 +4,6 @@ #include -#include "platform/input/input.h" -#include "platform/profile/profile.h" -#include "platform/renderer/renderer.h" -#include "minecraft/GameHostOptions.h" -#include "minecraft/GameTypes.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" @@ -19,9 +13,15 @@ #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "util/StringHelpers.h" +#include "minecraft/GameEnums.h" +#include "minecraft/GameHostOptions.h" +#include "minecraft/GameTypes.h" #include "minecraft/sounds/SoundTypes.h" +#include "platform/input/input.h" +#include "platform/profile/profile.h" +#include "platform/renderer/renderer.h" #include "strings.h" +#include "util/StringHelpers.h" #define GAME_CREATE_ONLINE_TIMER_ID 0 #define GAME_CREATE_ONLINE_TIMER_TIME 100 diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.cpp index 7fa6ef461..6708700e1 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.cpp @@ -8,8 +8,6 @@ #include -#include "platform/profile/profile.h" -#include "minecraft/Console_Debug_enum.h" #include "app/common/Leaderboards/LeaderboardInterface.h" #include "app/common/Leaderboards/LeaderboardManager.h" #include "app/common/UI/Controls/UIControl_Label.h" @@ -18,10 +16,12 @@ #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" +#include "minecraft/Console_Debug_enum.h" #include "minecraft/sounds/SoundTypes.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/profile/profile.h" #include "strings.h" #define PLAYER_ONLINE_TIMER_ID 0 @@ -126,8 +126,8 @@ UIScene_LeaderboardsMenu::UIScene_LeaderboardsMenu(int iPad, void* initData, m_labelFilter.init(filterBuffer); char entriesBuffer[40]; - snprintf(entriesBuffer, 40, "%s%i", - app.GetString(IDS_LEADERBOARD_ENTRIES), 0); + snprintf(entriesBuffer, 40, "%s%i", app.GetString(IDS_LEADERBOARD_ENTRIES), + 0); m_labelEntries.init(entriesBuffer); ReadStats(-1); @@ -373,7 +373,8 @@ void UIScene_LeaderboardsMenu::ReadStats(int startIndex) { } break; case IPlatformLeaderboard::eFM_MyScore: { PlayerUID uid; - PlatformProfile.GetXUID(PlatformProfile.GetPrimaryPad(), &uid, true); + PlatformProfile.GetXUID(PlatformProfile.GetPrimaryPad(), &uid, + true); m_interface.ReadStats_MyScore( this, m_currentDifficulty, (IPlatformLeaderboard::EStatsType)m_currentLeaderboard, @@ -381,7 +382,8 @@ void UIScene_LeaderboardsMenu::ReadStats(int startIndex) { } break; case IPlatformLeaderboard::eFM_Friends: { PlayerUID uid; - PlatformProfile.GetXUID(PlatformProfile.GetPrimaryPad(), &uid, true); + PlatformProfile.GetXUID(PlatformProfile.GetPrimaryPad(), &uid, + true); m_interface.ReadStats_Friends( this, m_currentDifficulty, (IPlatformLeaderboard::EStatsType)m_currentLeaderboard, @@ -733,8 +735,7 @@ void UIScene_LeaderboardsMenu::PopulateLeaderboard( true, // 4J-JEV: Has error message to display. - app.GetString(idsErrorMessage), "", "", "", "", "", - ""); + app.GetString(idsErrorMessage), "", "", "", "", "", ""); } else { m_listEntries.addDataSet( isLast, m_leaderboard.m_entries[i].m_row, diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.h index 396304e39..597c3efa4 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.h @@ -3,8 +3,6 @@ #include #include -#include "platform/PlatformTypes.h" -#include "platform/storage/storage.h" #include "app/common/Leaderboards/LeaderboardInterface.h" #include "app/common/Leaderboards/LeaderboardManager.h" #include "app/common/UI/All Platforms/UIEnums.h" @@ -12,6 +10,8 @@ #include "app/common/UI/Controls/UIControl_LeaderboardList.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" +#include "platform/PlatformTypes.h" +#include "platform/storage/storage.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif 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 f42d33b5d..bd6c17f84 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 @@ -4,15 +4,8 @@ #include #include -#include "platform/PlatformTypes.h" -#include "platform/profile/profile.h" -#include "platform/renderer/renderer.h" -#include "minecraft/GameHostOptions.h" -#include "minecraft/GameTypes.h" -#include "minecraft/GameEnums.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_BitmapIcon.h" @@ -24,7 +17,9 @@ #include "app/common/UI/UILayer.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "platform/NetTypes.h" +#include "minecraft/GameEnums.h" +#include "minecraft/GameHostOptions.h" +#include "minecraft/GameTypes.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/Options.h" #include "minecraft/client/skins/DLCTexturePack.h" @@ -32,7 +27,12 @@ #include "minecraft/client/skins/TexturePackRepository.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/sounds/SoundTypes.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/LevelSettings.h" +#include "platform/NetTypes.h" +#include "platform/PlatformTypes.h" +#include "platform/profile/profile.h" +#include "platform/renderer/renderer.h" #include "strings.h" #define GAME_CREATE_ONLINE_TIMER_ID 0 @@ -777,7 +777,8 @@ void UIScene_LoadMenu::LaunchGame(void) { &pSaveDetails ->SaveInfoA[(int)m_iSaveGameInfoIndex], [this](bool bCorrupt, bool bOwner) { - return loadSaveDataReturned(bCorrupt, bOwner); + return loadSaveDataReturned(bCorrupt, + bOwner); }); #if TO_BE_IMPLEMENTED @@ -785,7 +786,8 @@ void UIScene_LoadMenu::LaunchGame(void) { IPlatformStorage::ELoadGame_DeviceRemoved) { // disable saving PlatformStorage.SetSaveDisabled(true); - PlatformStorage.SetSaveDeviceSelected(m_iPad, false); + PlatformStorage.SetSaveDeviceSelected(m_iPad, + false); unsigned int uiIDA[1]; uiIDA[0] = IDS_OK; ui.RequestErrorMessage( @@ -868,8 +870,8 @@ int UIScene_LoadMenu::CheckResetNetherReturned( return 0; } -int UIScene_LoadMenu::ConfirmLoadReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result) { +int UIScene_LoadMenu::ConfirmLoadReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { UIScene_LoadMenu* pClass = (UIScene_LoadMenu*)pParam; if (result == IPlatformStorage::EMessage_ResultAccept) { @@ -1026,8 +1028,8 @@ int UIScene_LoadMenu::loadSaveDataReturned(bool bIsCorrupt, bool bIsOwner) { return 0; } -int UIScene_LoadMenu::TrophyDialogReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result) { +int UIScene_LoadMenu::TrophyDialogReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { UIScene_LoadMenu* pClass = (UIScene_LoadMenu*)pParam; return LoadDataComplete(pClass); } diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.h index 96a3ebff3..cb50cb64b 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.h @@ -3,7 +3,6 @@ #include #include -#include "platform/storage/storage.h" #include "IUIScene_StartGame.h" #include "app/common/DLC/DLCPack.h" #include "app/common/UI/All Platforms/UIEnums.h" @@ -16,6 +15,7 @@ #include "app/common/UI/Controls/UIControl_TexturePackList.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" +#include "platform/storage/storage.h" class DLCPack; class LevelGenerationOptions; @@ -126,16 +126,16 @@ private: static int TrophyDialogReturned(void* pParam, int iPad, IPlatformStorage::EMessageResult result); static int LoadDataComplete(void* pParam); - static int CheckResetNetherReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); - static int DeleteSaveDialogReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); + static int CheckResetNetherReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); + static int DeleteSaveDialogReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); int deleteSaveDataReturned(bool bSuccess); static int MustSignInReturnedPSN(void* pParam, int iPad, IPlatformStorage::EMessageResult result); public: int loadSaveDataThumbnailReturned(std::uint8_t* pbThumbnail, - unsigned int thumbnailBytes); + unsigned int thumbnailBytes); static int StartGame_SignInReturned(void* pParam, bool, int); }; \ No newline at end of file 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 98ff63caa..9edcad607 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 @@ -6,29 +6,29 @@ #include -#include "platform/input/input.h" -#include "platform/profile/profile.h" -#include "minecraft/GameTypes.h" -#include "minecraft/GameEnums.h" #include "app/common/DLC/DLCManager.h" -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "app/common/Network/GameNetworkManager.h" -#include "minecraft/network/platform/SessionInfo.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SaveList.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "platform/NetTypes.h" #include "java/File.h" #include "java/InputOutputStream/FileInputStream.h" +#include "minecraft/GameEnums.h" +#include "minecraft/GameTypes.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" +#include "minecraft/network/platform/SessionInfo.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/sounds/SoundTypes.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/LevelSettings.h" +#include "platform/NetTypes.h" +#include "platform/input/input.h" +#include "platform/profile/profile.h" #include "strings.h" #if defined(SONY_REMOTE_STORAGE_DOWNLOAD) @@ -295,8 +295,9 @@ void UIScene_LoadOrJoinMenu::handleGainFocus(bool navBack) { if (navBack) { app.SetLiveLinkRequired(true); - m_bMultiplayerAllowed = PlatformProfile.IsSignedInLive(m_iPad) && - PlatformProfile.AllowedToPlayMultiplayer(m_iPad); + m_bMultiplayerAllowed = + PlatformProfile.IsSignedInLive(m_iPad) && + PlatformProfile.AllowedToPlayMultiplayer(m_iPad); // re-enable button presses m_bIgnoreInput = false; @@ -350,9 +351,7 @@ void UIScene_LoadOrJoinMenu::handleLoseFocus() { killTimer(JOIN_LOAD_ONLINE_TIMER_ID); } -std::string UIScene_LoadOrJoinMenu::getMoviePath() { - return "LoadOrJoinMenu"; -} +std::string UIScene_LoadOrJoinMenu::getMoviePath() { return "LoadOrJoinMenu"; } void UIScene_LoadOrJoinMenu::tick() { UIScene::tick(); @@ -427,7 +426,8 @@ void UIScene_LoadOrJoinMenu::tick() { return loadSaveDataThumbnailReturned(data, bytes); }); - if (eLoadStatus != IPlatformStorage::ESaveGame_GetSaveThumbnail) { + if (eLoadStatus != + IPlatformStorage::ESaveGame_GetSaveThumbnail) { // something went wrong m_bRetrievingSaveThumbnails = false; m_bAllLoaded = true; @@ -449,7 +449,7 @@ void UIScene_LoadOrJoinMenu::tick() { MAX_SAVEFILENAME_LENGTH, // total length of source UTF-8 // string, // in char's (= bytes), including end-of-string \0 - (char*)u16Message, // destination buffer + (char*)u16Message, // destination buffer MAX_SAVEFILENAME_LENGTH // size of destination buffer, in // char's ); @@ -494,7 +494,8 @@ void UIScene_LoadOrJoinMenu::tick() { return loadSaveDataThumbnailReturned(data, bytes); }); - if (eLoadStatus != IPlatformStorage::ESaveGame_GetSaveThumbnail) { + if (eLoadStatus != + IPlatformStorage::ESaveGame_GetSaveThumbnail) { // something went wrong m_bRetrievingSaveThumbnails = false; m_bAllLoaded = true; @@ -599,8 +600,8 @@ void UIScene_LoadOrJoinMenu::GetSaveInfo() { m_pSaveDetails = PlatformStorage.ReturnSavesInfo(); if (m_pSaveDetails == nullptr) { - IPlatformStorage::ESaveGameState eSGIStatus = PlatformStorage.GetSavesInfo( - m_iPad, nullptr, (char*)"save"); + IPlatformStorage::ESaveGameState eSGIStatus = + PlatformStorage.GetSavesInfo(m_iPad, nullptr, (char*)"save"); } #if TO_BE_IMPLEMENTED @@ -1207,8 +1208,7 @@ void UIScene_LoadOrJoinMenu::UpdateGamesList() { std::uint8_t* imageData = tp->getPackIcon(imageBytes); if (imageBytes > 0 && imageData) { - snprintf(textureName, 64, "%s", - sessionInfo->displayLabel); + snprintf(textureName, 64, "%s", sessionInfo->displayLabel); registerSubstitutionTexture(textureName, imageData, imageBytes); } @@ -1429,8 +1429,9 @@ int UIScene_LoadOrJoinMenu::DeleteSaveDialogReturned( pClass->m_iDefaultButtonsC], [cbId](const bool bRes) { ui.lockCallbackScenes(); - auto* p = (UIScene_LoadOrJoinMenu*) - ui.GetSceneFromCallbackId(cbId); + auto* p = + (UIScene_LoadOrJoinMenu*)ui.GetSceneFromCallbackId( + cbId); if (p) { p->deleteSaveDataReturned(bRes); } @@ -1703,7 +1704,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) { const char* pNameUTF8 = app.getRemoteStorage()->getSaveNameUTF8(); strncpy(wSaveName, pNameUTF8, - strlen(pNameUTF8) + 1); // plus null + strlen(pNameUTF8) + 1); // plus null PlatformStorage.SetSaveTitle(wSaveName); std::uint8_t* pbThumbnailData = nullptr; unsigned int dwThumbnailDataSize = 0; @@ -1737,10 +1738,9 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) { app.getRemoteStorage()->waitForPlatformStorageIdle(); IPlatformStorage::ESaveGameState saveState = - PlatformStorage.SaveSaveData( - [pClass](const bool bRes) { - return pClass->createDummySaveDataCallback(bRes); - }); + PlatformStorage.SaveSaveData([pClass](const bool bRes) { + return pClass->createDummySaveDataCallback(bRes); + }); if (saveState == IPlatformStorage::ESaveGame_Save) { pClass->m_eSaveTransferState = eSaveTransfer_CreatingDummyFile; @@ -1955,9 +1955,9 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) { app.getRemoteStorage() ->waitForPlatformStorageIdle(); // we need to wait for the - // save system to be idle - // here, as Flush doesn't - // check for it. + // save system to be idle + // here, as Flush doesn't + // check for it. pSave->Flush(false, false); } break; case eSaveTransfer_Saving: { @@ -1982,12 +1982,13 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) { uiIDA[0] = IDS_CONFIRM_OK; app.getRemoteStorage() ->waitForPlatformStorageIdle(); // wait for everything to - // complete before we hand - // control back to the - // player + // complete before we hand + // control back to the + // player ui.RequestErrorMessage(IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD, IDS_SAVE_TRANSFER_DOWNLOADCOMPLETE, - uiIDA, 1, PlatformProfile.GetPrimaryPad(), + uiIDA, 1, + PlatformProfile.GetPrimaryPad(), CrossSaveFinishedCallback, pClass); pClass->m_eSaveTransferState = eSaveTransfer_Finished; } break; @@ -2041,7 +2042,8 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) { return pClass ->crossSaveDeleteOnErrorReturned(bRes); }); - if (eDeleteStatus == IPlatformStorage::ESaveGame_Delete) { + if (eDeleteStatus == + IPlatformStorage::ESaveGame_Delete) { pClass->m_eSaveTransferState = eSaveTransfer_ErrorDeletingSave; } else { @@ -2061,9 +2063,9 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) { case eSaveTransfer_ErrorMesssage: { app.getRemoteStorage() ->waitForPlatformStorageIdle(); // wait for everything to - // complete before we hand - // control back to the - // player + // complete before we hand + // control back to the + // player if (pClass->m_saveTransferDownloadCancelled) { pClass->m_eSaveTransferState = eSaveTransfer_Idle; } else { diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.h index d03c6b834..41618e4aa 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.h @@ -5,7 +5,6 @@ #include #include -#include "platform/storage/storage.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl.h" @@ -16,6 +15,7 @@ #include "java/File.h" #include "minecraft/client/Minecraft.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h" +#include "platform/storage/storage.h" class LevelGenerationOptions; class File; @@ -137,14 +137,14 @@ protected: public: int loadSaveDataThumbnailReturned(std::uint8_t* pbThumbnail, - unsigned int thumbnailBytes); + unsigned int thumbnailBytes); static int LoadSaveCallback(void* lpParam, bool bRes); - static int DeleteSaveDialogReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); - static int SaveOptionsDialogReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); - static int TexturePackDialogReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); + static int DeleteSaveDialogReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); + static int SaveOptionsDialogReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); + static int TexturePackDialogReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); int deleteSaveDataReturned(bool bRes); int renameSaveDataReturned(bool bRes); int handleKeyboardCompleteWorldName(bool bRes); @@ -201,11 +201,11 @@ private: int createDummySaveDataCallback(bool bRes); int crossSaveGetSavesInfoCallback(SAVE_DETAILS* pSaveDetails, bool bRes); int loadCrossSaveDataCallback(bool bIsCorrupt, bool bIsOwner); - static int CrossSaveFinishedCallback(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); + static int CrossSaveFinishedCallback( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); int crossSaveDeleteOnErrorReturned(bool bRes); - static int RemoteSaveNotFoundCallback(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); + static int RemoteSaveNotFoundCallback( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); static int DownloadSonyCrossSaveThreadProc(void* lpParameter); static void SaveTransferReturned(void* lpParam, SonyRemoteStorage::Status s, int error_code); @@ -237,8 +237,8 @@ private: static void SaveUploadReturned(void* lpParam, SonyRemoteStorage::Status s, int error_code); static void CancelSaveUploadCallback(void* lpParam); - static int SaveTransferDialogReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); + static int SaveTransferDialogReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); static int CrossSaveUploadFinishedCallback( void* pParam, int iPad, IPlatformStorage::EMessageResult result); #endif 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 861dabcbf..984bb95f3 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 @@ -8,12 +8,6 @@ #include #include -#include "platform/PlatformTypes.h" -#include "platform/profile/profile.h" -#include "platform/renderer/renderer.h" -#include "minecraft/GameTypes.h" -#include "platform/PlatformTypes.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" @@ -22,21 +16,25 @@ #include "app/common/UI/UIString.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "platform/NetTypes.h" -#include "util/StringHelpers.h" - #include "java/InputOutputStream/BufferedReader.h" #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/InputStreamReader.h" #include "java/Random.h" #include "java/System.h" +#include "minecraft/GameEnums.h" +#include "minecraft/GameTypes.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/User.h" #include "minecraft/client/gui/Font.h" #include "minecraft/client/gui/ScreenSizeCalculator.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/sounds/SoundTypes.h" +#include "platform/NetTypes.h" +#include "platform/PlatformTypes.h" +#include "platform/profile/profile.h" +#include "platform/renderer/renderer.h" #include "strings.h" +#include "util/StringHelpers.h" class LevelGenerationOptions; @@ -177,8 +175,8 @@ void UIScene_MainMenu::handleGainFocus(bool navBack) { random->nextInt((int)m_splashes.size() - (eSplashRandomStart + 1)); // Override splash text on certain dates - const std::time_t now = std::chrono::system_clock::to_time_t( - std::chrono::system_clock::now()); + const std::time_t now = + std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); std::tm localTime; localtime_r(&now, &localTime); const int month = localTime.tm_mon + 1; // tm_mon is 0-based @@ -301,8 +299,7 @@ void UIScene_MainMenu::handlePress(F64 controlId, F64 childId) { if (PlatformProfile.IsSignedIn(primaryPad)) { if (confirmUser) { PlatformProfile.RequestSignInUI(false, false, true, false, true, - signInReturnedFunc, - primaryPad); + signInReturnedFunc, primaryPad); } else { RunAction(primaryPad); } @@ -398,8 +395,8 @@ void UIScene_MainMenu::customDrawSplash(IggyCustomDrawCallbackRegion* region) { ui.endCustomDraw(region); } -int UIScene_MainMenu::MustSignInReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result) { +int UIScene_MainMenu::MustSignInReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { UIScene_MainMenu* pClass = (UIScene_MainMenu*)pParam; if (result == IPlatformStorage::EMessage_ResultAccept) { @@ -456,8 +453,8 @@ int UIScene_MainMenu::MustSignInReturned(void* pParam, int iPad, for (int i = 0; i < XUSER_MAX_COUNT; i++) { // if the user is valid, we should set the presence if (PlatformProfile.IsSignedIn(i)) { - PlatformProfile.SetCurrentGameActivity(i, CONTEXT_PRESENCE_MENUS, - false); + PlatformProfile.SetCurrentGameActivity( + i, CONTEXT_PRESENCE_MENUS, false); } } } @@ -473,7 +470,7 @@ int UIScene_MainMenu::HelpAndOptions_SignInReturned(void* pParam, // 4J-JEV: Don't we only need to update rich-presence if the sign-in // status changes. PlatformProfile.SetCurrentGameActivity(iPad, CONTEXT_PRESENCE_MENUS, - false); + false); #if TO_BE_IMPLEMENTED if (app.GetTMSDLCInfoRead()) @@ -508,8 +505,8 @@ int UIScene_MainMenu::HelpAndOptions_SignInReturned(void* pParam, for (int i = 0; i < XUSER_MAX_COUNT; i++) { // if the user is valid, we should set the presence if (PlatformProfile.IsSignedIn(i)) { - PlatformProfile.SetCurrentGameActivity(i, CONTEXT_PRESENCE_MENUS, - false); + PlatformProfile.SetCurrentGameActivity( + i, CONTEXT_PRESENCE_MENUS, false); } } } @@ -525,7 +522,7 @@ int UIScene_MainMenu::CreateLoad_SignInReturned(void* pParam, bool bContinue, // 4J-JEV: We only need to update rich-presence if the sign-in status // changes. PlatformProfile.SetCurrentGameActivity(iPad, CONTEXT_PRESENCE_MENUS, - false); + false); unsigned int uiIDA[1] = {IDS_OK}; @@ -537,7 +534,7 @@ int UIScene_MainMenu::CreateLoad_SignInReturned(void* pParam, bool bContinue, PlatformProfile.SetLockedProfile(PlatformProfile.GetPrimaryPad()); // change the minecraft player name - Minecraft::GetInstance()->user->name = + Minecraft::GetInstance()->user->name = PlatformProfile.GetGamertag(PlatformProfile.GetPrimaryPad()); { @@ -598,9 +595,8 @@ int UIScene_MainMenu::CreateLoad_SignInReturned(void* pParam, bool bContinue, } #else Minecraft* pMinecraft = Minecraft::GetInstance(); - pMinecraft->user->name = - PlatformProfile.GetGamertag( - PlatformProfile.GetPrimaryPad()); + pMinecraft->user->name = PlatformProfile.GetGamertag( + PlatformProfile.GetPrimaryPad()); // ensure we've applied this player's settings app.ApplyGameSettingsChanged(iPad); @@ -614,8 +610,8 @@ int UIScene_MainMenu::CreateLoad_SignInReturned(void* pParam, bool bContinue, // offline PlatformProfile.DisplayOfflineProfile( [pClass](bool b, int p) { - return CScene_Main::CreateLoad_OfflineProfileReturned( - pClass, b, p); + return CScene_Main:: + CreateLoad_OfflineProfileReturned(pClass, b, p); }, PlatformProfile.GetPrimaryPad()); #else @@ -635,8 +631,8 @@ int UIScene_MainMenu::CreateLoad_SignInReturned(void* pParam, bool bContinue, for (int i = 0; i < XUSER_MAX_COUNT; i++) { // if the user is valid, we should set the presence if (PlatformProfile.IsSignedIn(i)) { - PlatformProfile.SetCurrentGameActivity(i, CONTEXT_PRESENCE_MENUS, - false); + PlatformProfile.SetCurrentGameActivity( + i, CONTEXT_PRESENCE_MENUS, false); } } } @@ -651,7 +647,7 @@ int UIScene_MainMenu::Leaderboards_SignInReturned(void* pParam, bool bContinue, // 4J-JEV: We only need to update rich-presence if the sign-in status // changes. PlatformProfile.SetCurrentGameActivity(iPad, CONTEXT_PRESENCE_MENUS, - false); + false); unsigned int uiIDA[1] = {IDS_OK}; @@ -679,7 +675,8 @@ int UIScene_MainMenu::Leaderboards_SignInReturned(void* pParam, bool bContinue, PlatformProfile.GetPrimaryPad()); #endif } else { - PlatformProfile.SetLockedProfile(PlatformProfile.GetPrimaryPad()); + PlatformProfile.SetLockedProfile( + PlatformProfile.GetPrimaryPad()); proceedToScene(PlatformProfile.GetPrimaryPad(), eUIScene_LeaderboardsMenu); } @@ -691,8 +688,8 @@ int UIScene_MainMenu::Leaderboards_SignInReturned(void* pParam, bool bContinue, for (int i = 0; i < XUSER_MAX_COUNT; i++) { // if the user is valid, we should set the presence if (PlatformProfile.IsSignedIn(i)) { - PlatformProfile.SetCurrentGameActivity(i, CONTEXT_PRESENCE_MENUS, - false); + PlatformProfile.SetCurrentGameActivity( + i, CONTEXT_PRESENCE_MENUS, false); } } } @@ -708,7 +705,7 @@ int UIScene_MainMenu::Achievements_SignInReturned(void* pParam, bool bContinue, // 4J-JEV: We only need to update rich-presence if the sign-in status // changes. PlatformProfile.SetCurrentGameActivity(iPad, CONTEXT_PRESENCE_MENUS, - false); + false); // XShowAchievementsUI(PlatformProfile.GetPrimaryPad()); } else { @@ -718,8 +715,8 @@ int UIScene_MainMenu::Achievements_SignInReturned(void* pParam, bool bContinue, for (int i = 0; i < XUSER_MAX_COUNT; i++) { // if the user is valid, we should set the presence if (PlatformProfile.IsSignedIn(i)) { - PlatformProfile.SetCurrentGameActivity(i, CONTEXT_PRESENCE_MENUS, - false); + PlatformProfile.SetCurrentGameActivity( + i, CONTEXT_PRESENCE_MENUS, false); } } } @@ -734,7 +731,7 @@ int UIScene_MainMenu::UnlockFullGame_SignInReturned(void* pParam, // 4J-JEV: We only need to update rich-presence if the sign-in status // changes. PlatformProfile.SetCurrentGameActivity(iPad, CONTEXT_PRESENCE_MENUS, - false); + false); pClass->RunUnlockOrDLC(iPad); } else { @@ -744,8 +741,8 @@ int UIScene_MainMenu::UnlockFullGame_SignInReturned(void* pParam, for (int i = 0; i < XUSER_MAX_COUNT; i++) { // if the user is valid, we should set the presence if (PlatformProfile.IsSignedIn(i)) { - PlatformProfile.SetCurrentGameActivity(i, CONTEXT_PRESENCE_MENUS, - false); + PlatformProfile.SetCurrentGameActivity( + i, CONTEXT_PRESENCE_MENUS, false); } } } @@ -753,8 +750,8 @@ int UIScene_MainMenu::UnlockFullGame_SignInReturned(void* pParam, return 0; } -int UIScene_MainMenu::ExitGameReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result) { +int UIScene_MainMenu::ExitGameReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { // UIScene_MainMenu* pClass = (UIScene_MainMenu*)pParam; // buttons reversed on this @@ -812,9 +809,8 @@ void UIScene_MainMenu::RunPlayGame(int iPad) { if (PlatformStorage.SetSaveDevice( &CScene_Main::DeviceSelectReturned, this) == true) { // change the minecraft player name - pMinecraft->user->name = - PlatformProfile.GetGamertag( - PlatformProfile.GetPrimaryPad()); + pMinecraft->user->name = PlatformProfile.GetGamertag( + PlatformProfile.GetPrimaryPad()); // save device already selected // ensure we've applied this player's settings @@ -844,8 +840,8 @@ void UIScene_MainMenu::RunPlayGame(int iPad) { m_Timer.SetShow(true); } #else - pMinecraft->user->name = - PlatformProfile.GetGamertag(PlatformProfile.GetPrimaryPad()); + pMinecraft->user->name = PlatformProfile.GetGamertag( + PlatformProfile.GetPrimaryPad()); // ensure we've applied this player's settings app.ApplyGameSettingsChanged(iPad); diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.h index da092417b..990f35ae8 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.h @@ -5,12 +5,12 @@ #include #include -#include "platform/storage/storage.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" +#include "platform/storage/storage.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif 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 8c28db506..7c24a8329 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 @@ -3,14 +3,14 @@ #include -#include "minecraft/GameTypes.h" -#include "minecraft/GameEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_DynamicLabel.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" +#include "minecraft/GameEnums.h" +#include "minecraft/GameTypes.h" #include "minecraft/sounds/SoundTypes.h" #include "strings.h" diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_SaveMessage.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_SaveMessage.cpp index e078d407f..89efb30e6 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_SaveMessage.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_SaveMessage.cpp @@ -1,18 +1,18 @@ #include "UIScene_SaveMessage.h" -#include "platform/PlatformTypes.h" -#include "platform/input/input.h" -#include "platform/profile/profile.h" -#include "minecraft/GameTypes.h" -#include "platform/profile/ProfileConstants.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" +#include "minecraft/GameTypes.h" #include "minecraft/sounds/SoundTypes.h" +#include "platform/PlatformTypes.h" +#include "platform/input/input.h" +#include "platform/profile/ProfileConstants.h" +#include "platform/profile/profile.h" #include "strings.h" #define PROFILE_LOADED_TIMER_ID 0 @@ -39,7 +39,8 @@ UIScene_SaveMessage::UIScene_SaveMessage(int iPad, void* initData, // 4J-PB - If we have a signed in user connected, let's get the DLC now for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { - if ((PlatformInput.IsPadConnected(i) || PlatformProfile.IsSignedIn(i))) { + if ((PlatformInput.IsPadConnected(i) || + PlatformProfile.IsSignedIn(i))) { if (!app.DLCInstallProcessCompleted() && !app.DLCInstallPending()) { app.StartInstallDLCProcess(i); break; diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_TrialExitUpsell.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_TrialExitUpsell.cpp index 959d93e4a..df684fab8 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_TrialExitUpsell.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_TrialExitUpsell.cpp @@ -1,12 +1,12 @@ #include "UIScene_TrialExitUpsell.h" -#include "platform/profile/profile.h" -#include "minecraft/GameTypes.h" #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" +#include "minecraft/GameTypes.h" #include "minecraft/sounds/SoundTypes.h" +#include "platform/profile/profile.h" #include "strings.h" class UILayer; 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 4e2a7385e..4101422c5 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_ControlsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_ControlsMenu.cpp @@ -4,19 +4,19 @@ #include -#include "platform/input/input.h" -#include "minecraft/GameEnums.h" -#include "minecraft/BuildVer.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" +#include "minecraft/BuildVer.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/sounds/SoundTypes.h" #include "minecraft/world/entity/player/Abilities.h" +#include "platform/input/input.h" #include "strings.h" class UILayer; @@ -75,9 +75,7 @@ UIScene_ControlsMenu::UIScene_ControlsMenu(int iPad, void* initData, char* layoutString = new char[128]; snprintf(layoutString, 128, "%s : %s", app.GetString(IDS_CURRENT_LAYOUT), app.GetString(m_iSchemeTextA[iSelected])); - { - m_labelCurrentLayout.init(layoutString); - } + { m_labelCurrentLayout.init(layoutString); } m_iCurrentNavigatedControlsLayout = iSelected; @@ -174,9 +172,7 @@ void UIScene_ControlsMenu::handlePress(F64 controlId, F64 childId) { snprintf(layoutString, 128, "%s : %s", app.GetString(IDS_CURRENT_LAYOUT), app.GetString(m_iSchemeTextA[control])); - { - m_labelCurrentLayout.setLabel(layoutString); - } + { m_labelCurrentLayout.setLabel(layoutString); } break; }; diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_Credits.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_Credits.cpp index a8cc86b8b..d889687f3 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_Credits.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_Credits.cpp @@ -8,8 +8,8 @@ #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "util/StringHelpers.h" #include "strings.h" +#include "util/StringHelpers.h" #define CREDIT_ICON -2 @@ -27,8 +27,7 @@ SCreditTextItemDef UIScene_Credits::gs_aCreditDefs[MAX_CREDIT_STRINGS] = { eSmallText}, // extra blank line {"%s", IDS_CREDITS_RESTOFMOJANG, NO_TRANSLATED_STRING, eMediumText}, {"%s", IDS_CREDITS_LEADPC, NO_TRANSLATED_STRING, eLargeText}, - {"Jens Bergensten", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, - eSmallText}, + {"Jens Bergensten", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, {"%s", IDS_CREDITS_JON_KAGSTROM, NO_TRANSLATED_STRING, eSmallText}, {"%s", IDS_CREDITS_CEO, NO_TRANSLATED_STRING, eLargeText}, {"Carl Manneh", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, @@ -73,8 +72,8 @@ SCreditTextItemDef UIScene_Credits::gs_aCreditDefs[MAX_CREDIT_STRINGS] = { eSmallText}, // extra blank line // Added credit for horses - {"Developers of Mo' Creatures:", NO_TRANSLATED_STRING, - NO_TRANSLATED_STRING, eExtraLargeText}, + {"Developers of Mo' Creatures:", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, + eExtraLargeText}, {"John Olarte (DrZhark)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, {"Kent Christian Jensen", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, @@ -83,8 +82,7 @@ SCreditTextItemDef UIScene_Credits::gs_aCreditDefs[MAX_CREDIT_STRINGS] = { {"", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, // extra blank line - {"4J Studios", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, - eExtraLargeText}, + {"4J Studios", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eExtraLargeText}, {"%s", IDS_CREDITS_PROGRAMMING, NO_TRANSLATED_STRING, eLargeText}, {"Paddy Burns", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, {"Richard Reavy", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, @@ -92,12 +90,10 @@ SCreditTextItemDef UIScene_Credits::gs_aCreditDefs[MAX_CREDIT_STRINGS] = { {"James Vaughan", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, {"Mark Hughes", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, {"Harry Gordon", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, - {"Thomas Kronberg", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, - eSmallText}, + {"Thomas Kronberg", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, {"%s", IDS_CREDITS_ART, NO_TRANSLATED_STRING, eLargeText}, - {"David Keningale", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, - eSmallText}, + {"David Keningale", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, {"Alan Redmond", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, {"Chris Reeves", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, {"Kate Wright", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, @@ -125,14 +121,14 @@ SCreditTextItemDef UIScene_Credits::gs_aCreditDefs[MAX_CREDIT_STRINGS] = { // Miles & Iggy credits {"", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, - eSmallText}, // extra blank line + eSmallText}, // extra blank line {"", CREDIT_ICON, eCreditIcon_Iggy, eSmallText}, // extra blank line {"Uses Iggy.", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, // extra blank line {"Copyright (C) 2009-2014 by RAD Game Tools, Inc.", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, // extra blank line {"", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, - eSmallText}, // extra blank line + eSmallText}, // extra blank line {"", CREDIT_ICON, eCreditIcon_Miles, eSmallText}, // extra blank line {"Uses Miles Sound System.", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, // extra blank line diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.cpp index 38f341d24..6d6db0610 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.cpp @@ -1,7 +1,6 @@ #include "UIScene_HelpAndOptionsMenu.h" -#include "platform/profile/profile.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" @@ -9,6 +8,7 @@ #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/sounds/SoundTypes.h" +#include "platform/profile/profile.h" #include "strings.h" UIScene_HelpAndOptionsMenu::UIScene_HelpAndOptionsMenu(int iPad, void* initData, 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 6846170a4..d5f59efc8 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlay.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlay.cpp @@ -6,14 +6,14 @@ #include -#include "minecraft/GameEnums.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "util/StringHelpers.h" +#include "minecraft/GameEnums.h" #include "minecraft/sounds/SoundTypes.h" #include "strings.h" +#include "util/StringHelpers.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.cpp index c84ab18d5..2d4552d2f 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.cpp @@ -110,9 +110,7 @@ void UIScene_HowToPlayMenu::updateComponents() { void UIScene_HowToPlayMenu::handleReload() { for (unsigned int i = 0; i < eHTPButton_Max; ++i) { // 4J Stu - Re-add for future platforms - { - m_buttonListHowTo.addItem(app.GetString(m_uiHTPButtonNameA[i]), i); - } + { m_buttonListHowTo.addItem(app.GetString(m_uiHTPButtonNameA[i]), i); } } doHorizontalResizeCheck(); 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 0101fe73c..1dae880f3 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.h @@ -2,15 +2,15 @@ #include -#include "platform/profile/ProfileConstants.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_ButtonList.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" -#include "platform/NetTypes.h" #include "minecraft/client/model/SkinBox.h" +#include "platform/NetTypes.h" #include "platform/XboxStubs.h" +#include "platform/profile/ProfileConstants.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 aeef22f6f..39804afc9 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.cpp @@ -3,12 +3,12 @@ #include -#include "minecraft/GameEnums.h" #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "strings.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 a3e65f9e0..33bc48fa2 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.cpp @@ -2,12 +2,12 @@ #include -#include "minecraft/GameEnums.h" #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "strings.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 23ac8299b..ede1945ad 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.cpp @@ -2,8 +2,6 @@ #include -#include "platform/profile/profile.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" @@ -11,7 +9,9 @@ #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" +#include "platform/profile/profile.h" #include "strings.h" UIScene_SettingsGraphicsMenu::UIScene_SettingsGraphicsMenu(int iPad, diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.cpp index e5719b4c2..370ac6e81 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.cpp @@ -1,7 +1,6 @@ #include "UIScene_SettingsMenu.h" -#include "platform/profile/profile.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" @@ -9,6 +8,7 @@ #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/sounds/SoundTypes.h" +#include "platform/profile/profile.h" #include "strings.h" UIScene_SettingsMenu::UIScene_SettingsMenu(int iPad, void* initData, diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.h index b8e886f58..bd5e1eae5 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.h @@ -2,11 +2,11 @@ #include -#include "platform/storage/storage.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" +#include "platform/storage/storage.h" class UILayer; @@ -51,6 +51,6 @@ public: protected: void handlePress(F64 controlId, F64 childId); - static int ResetDefaultsDialogReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); + static int ResetDefaultsDialogReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); }; \ No newline at end of file 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 2c7f0a946..d310b4356 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.cpp @@ -3,9 +3,6 @@ #include -#include "platform/profile/profile.h" -#include "platform/renderer/renderer.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" @@ -15,8 +12,11 @@ #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/sounds/SoundTypes.h" +#include "platform/profile/profile.h" +#include "platform/renderer/renderer.h" #include "strings.h" int UIScene_SettingsOptionsMenu::m_iDifficultySettingA[4] = { @@ -380,7 +380,8 @@ void UIScene_SettingsOptionsMenu::handleSliderMove(F64 sliderId, std::string wsText = app.GetString(m_iDifficultySettingA[value]); EHTMLFontSize size = eHTMLSize_Normal; - if (!PlatformRenderer.IsHiDef() && !PlatformRenderer.IsWidescreen()) { + if (!PlatformRenderer.IsHiDef() && + !PlatformRenderer.IsWidescreen()) { size = eHTMLSize_Splitscreen; } char startTags[64]; 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 125bf5abc..8e5bb788a 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.cpp @@ -3,15 +3,15 @@ #include -#include "platform/profile/profile.h" -#include "minecraft/GameEnums.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" +#include "platform/profile/profile.h" #include "strings.h" UIScene_SettingsUIMenu::UIScene_SettingsUIMenu(int iPad, void* initData, 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 ffebcc195..c95234fd8 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp @@ -5,10 +5,6 @@ #include -#include "platform/profile/profile.h" -#include "platform/renderer/renderer.h" -#include "platform/profile/ProfileConstants.h" -#include "minecraft/Minecraft_Macros.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" #include "app/common/DLC/DLCSkinFile.h" @@ -19,12 +15,15 @@ #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "minecraft/client/model/SkinBox.h" -#include "util/StringHelpers.h" - +#include "minecraft/Minecraft_Macros.h" #include "minecraft/client/Minecraft.h" +#include "minecraft/client/model/SkinBox.h" #include "minecraft/sounds/SoundTypes.h" +#include "platform/profile/ProfileConstants.h" +#include "platform/profile/profile.h" +#include "platform/renderer/renderer.h" #include "strings.h" +#include "util/StringHelpers.h" class ModelPart; @@ -528,8 +527,8 @@ void UIScene_SkinSelectMenu::customDraw(IggyCustomDrawCallbackRegion* region) { // region->stencil_func_ref, region->stencil_write_mask); if (region->stencil_func_ref != 0) PlatformRenderer.StateSetStencil(GL_EQUAL, region->stencil_func_ref, - region->stencil_func_mask, - region->stencil_write_mask); + region->stencil_func_mask, + region->stencil_write_mask); m_characters[characterId].render(region); // Finish GDraw and anything else that needs to be finalised @@ -589,7 +588,8 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged() { case SKIN_SELECT_PACK_DEFAULT: backupTexture = getTextureId(m_skinIndex); - if (m_skinIndex == std::to_underlying(EDefaultSkins::ServerSelected)) { + if (m_skinIndex == + std::to_underlying(EDefaultSkins::ServerSelected)) { skinName = app.GetString(IDS_DEFAULT_SKINS); } else { skinName = wchDefaultNamesA[m_skinIndex]; 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 be4090428..6da39709a 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.h @@ -3,7 +3,6 @@ #include #include -#include "platform/storage/storage.h" #include "app/common/DLC/DLCPack.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl.h" @@ -11,20 +10,22 @@ #include "app/common/UI/Controls/UIControl_PlayerSkinPreview.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" +#include "platform/storage/storage.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif #include "app/linux/Iggy/include/rrCore.h" #include "minecraft/client/model/SkinBox.h" -#include "minecraft/world/entity/player/SkinTypes.h" #include "minecraft/client/renderer/Textures.h" +#include "minecraft/world/entity/player/SkinTypes.h" class DLCPack; class UILayer; class UIScene_SkinSelectMenu : public UIScene { private: - static const char* wchDefaultNamesA[std::to_underlying(EDefaultSkins::Count)]; + static const char* + wchDefaultNamesA[std::to_underlying(EDefaultSkins::Count)]; // 4J Stu - How many to show on each side of the main control static const int sidePreviewControls = 4; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.cpp index 6147b1661..53bc88642 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.cpp @@ -193,8 +193,8 @@ void UIScene_AbstractContainerMenu::tick() { IggyPlayerDispatchEventRS(getMovie(), &mouseEvent, &result); } -void UIScene_AbstractContainerMenu::render(S32 width, S32 height, - IPlatformRenderer::eViewportType viewpBort) { +void UIScene_AbstractContainerMenu::render( + S32 width, S32 height, IPlatformRenderer::eViewportType viewpBort) { m_cacheSlotRenders = true; m_needsCacheRendered = m_needsCacheRendered || m_menu->needsRendered(); diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h index 84b037e5d..5e5187797 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h @@ -2,7 +2,6 @@ #include -#include "platform/renderer/renderer.h" #include "app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Cursor.h" @@ -10,6 +9,7 @@ #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" +#include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AnvilMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AnvilMenu.cpp index 6bf9d5a95..5bcbfa26d 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AnvilMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AnvilMenu.cpp @@ -7,8 +7,6 @@ #include #include -#include "platform/input/input.h" -#include "platform/profile/profile.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" @@ -17,7 +15,6 @@ #include "app/common/UI/Controls/UIControl_TextInput.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" #include "app/linux/LinuxGame.h" -#include "util/StringHelpers.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/world/entity/player/Abilities.h" @@ -25,7 +22,10 @@ #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/inventory/AnvilMenu.h" #include "minecraft/world/inventory/Slot.h" +#include "platform/input/input.h" +#include "platform/profile/profile.h" #include "strings.h" +#include "util/StringHelpers.h" class UILayer; @@ -317,7 +317,8 @@ UIControl* UIScene_AnvilMenu::getSection(ESceneSection eSection) { void UIScene_AnvilMenu::handleEditNamePressed() { setIgnoreInput(true); PlatformInput.RequestKeyboard( - app.GetString(IDS_TITLE_RENAME), m_textInputAnvil.getLabel(), m_iPad, 30, + app.GetString(IDS_TITLE_RENAME), m_textInputAnvil.getLabel(), m_iPad, + 30, [this](bool bRes) -> int { // 4J HEG - No reason to set value if keyboard was cancelled setIgnoreInput(false); @@ -338,8 +339,7 @@ void UIScene_AnvilMenu::setEditNameValue(const std::string& name) { void UIScene_AnvilMenu::setEditNameEditable(bool enabled) {} -void UIScene_AnvilMenu::setCostLabel(const std::string& label, - bool canAfford) { +void UIScene_AnvilMenu::setCostLabel(const std::string& label, bool canAfford) { IggyDataValue result; IggyDataValue value[2]; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AnvilMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AnvilMenu.h index 6a4262c7c..48f0425e6 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AnvilMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AnvilMenu.h @@ -2,7 +2,6 @@ #include -#include "platform/input/input.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/All Platforms/IUIScene_AnvilMenu.h" #include "app/common/UI/All Platforms/UIEnums.h" @@ -13,6 +12,7 @@ #include "app/common/UI/Controls/UIControl_TextInput.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" +#include "platform/input/input.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BrewingStandMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BrewingStandMenu.cpp index fb29b70e0..e210f2abc 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BrewingStandMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BrewingStandMenu.cpp @@ -2,7 +2,6 @@ #include -#include "platform/profile/profile.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" @@ -17,6 +16,7 @@ #include "minecraft/world/inventory/BrewingStandMenu.h" #include "minecraft/world/item/alchemy/PotionBrewing.h" #include "minecraft/world/level/tile/entity/BrewingStandTileEntity.h" +#include "platform/profile/profile.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BrewingStandMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BrewingStandMenu.h index ffa31b5c2..83cc46c8f 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BrewingStandMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BrewingStandMenu.h @@ -3,6 +3,7 @@ #include #include +#include "UIScene_AbstractContainerMenu.h" #include "app/common/UI/All Platforms/IUIScene_BrewingMenu.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" @@ -11,7 +12,6 @@ #include "app/common/UI/Controls/UIControl_Progress.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" -#include "UIScene_AbstractContainerMenu.h" class InventoryMenu; class BrewingStandTileEntity; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_ContainerMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_ContainerMenu.h index becd3b9a4..54081c8f4 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_ContainerMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_ContainerMenu.h @@ -2,6 +2,7 @@ #include +#include "UIScene_AbstractContainerMenu.h" #include "app/common/UI/All Platforms/IUIScene_ContainerMenu.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" @@ -9,7 +10,6 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" -#include "UIScene_AbstractContainerMenu.h" class InventoryMenu; class UILayer; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.cpp index cf611ba13..ca6a4f48c 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.cpp @@ -19,11 +19,11 @@ #include "app/linux/Iggy/include/rrCore.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "platform/XboxStubs.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/player/LocalPlayer.h" #include "minecraft/sounds/SoundTypes.h" #include "minecraft/world/SimpleContainer.h" +#include "platform/XboxStubs.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_DispenserMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_DispenserMenu.h index 47402ff55..e22da5241 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_DispenserMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_DispenserMenu.h @@ -2,6 +2,7 @@ #include +#include "UIScene_AbstractContainerMenu.h" #include "app/common/UI/All Platforms/IUIScene_DispenserMenu.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" @@ -9,7 +10,6 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" -#include "UIScene_AbstractContainerMenu.h" class InventoryMenu; class UILayer; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.cpp index 9be761c88..1643bd549 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.cpp @@ -5,7 +5,6 @@ #include -#include "platform/profile/profile.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" @@ -18,6 +17,7 @@ #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/world/inventory/EnchantmentMenu.h" +#include "platform/profile/profile.h" #include "strings.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.h index 4cce00e0b..34c28fe3b 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.h @@ -2,6 +2,7 @@ #include +#include "UIScene_AbstractContainerMenu.h" #include "app/common/UI/All Platforms/IUIScene_EnchantingMenu.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" @@ -12,7 +13,6 @@ #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" -#include "UIScene_AbstractContainerMenu.h" class InventoryMenu; class UILayer; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FurnaceMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FurnaceMenu.cpp index bf465d457..205049a6a 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FurnaceMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FurnaceMenu.cpp @@ -3,7 +3,6 @@ #include -#include "platform/profile/profile.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" @@ -15,6 +14,7 @@ #include "minecraft/client/Minecraft.h" #include "minecraft/world/inventory/FurnaceMenu.h" #include "minecraft/world/level/tile/entity/FurnaceTileEntity.h" +#include "platform/profile/profile.h" #include "strings.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FurnaceMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FurnaceMenu.h index 4f43bc00b..df8f0fcf9 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FurnaceMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FurnaceMenu.h @@ -3,6 +3,7 @@ #include #include +#include "UIScene_AbstractContainerMenu.h" #include "app/common/UI/All Platforms/IUIScene_FurnaceMenu.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" @@ -11,7 +12,6 @@ #include "app/common/UI/Controls/UIControl_Progress.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" -#include "UIScene_AbstractContainerMenu.h" class InventoryMenu; class FurnaceTileEntity; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HopperMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HopperMenu.h index 63b54e8df..7d2a7bdac 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HopperMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HopperMenu.h @@ -2,6 +2,7 @@ #include +#include "UIScene_AbstractContainerMenu.h" #include "app/common/UI/All Platforms/IUIScene_HopperMenu.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" @@ -9,7 +10,6 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" -#include "UIScene_AbstractContainerMenu.h" class InventoryMenu; class UILayer; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.cpp index f0aafc9f5..58f9f6465 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.cpp @@ -15,7 +15,6 @@ #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "util/StringHelpers.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" @@ -24,6 +23,7 @@ #include "minecraft/world/effect/MobEffectInstance.h" #include "minecraft/world/inventory/InventoryMenu.h" #include "strings.h" +#include "util/StringHelpers.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.cpp index 3829bf771..d596257ea 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.cpp @@ -5,7 +5,6 @@ #include #include -#include "platform/profile/profile.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" @@ -15,7 +14,6 @@ #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "util/StringHelpers.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/util/HtmlString.h" @@ -23,7 +21,9 @@ #include "minecraft/world/inventory/Slot.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/item/trading/MerchantRecipe.h" +#include "platform/profile/profile.h" #include "strings.h" +#include "util/StringHelpers.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_CraftingMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_CraftingMenu.cpp index dbb9361dc..00cc12cb6 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_CraftingMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_CraftingMenu.cpp @@ -1,7 +1,6 @@ #include "UIScene_CraftingMenu.h" -#include "platform/profile/profile.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" @@ -22,6 +21,7 @@ #include "minecraft/world/item/Item.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/item/crafting/Recipy.h" +#include "platform/profile/profile.h" #include "strings.h" class UILayer; 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 04ef15858..4efb6e88b 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 @@ -3,9 +3,6 @@ #include -#include "platform/profile/profile.h" -#include "platform/storage/storage.h" -#include "minecraft/GameEnums.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialMode.h" @@ -15,8 +12,11 @@ #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" +#include "platform/profile/profile.h" +#include "platform/storage/storage.h" #include "strings.h" class UILayer; 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 9185eb526..448650f9c 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 @@ -6,21 +6,21 @@ #include -#include "platform/PlatformTypes.h" -#include "platform/profile/profile.h" -#include "minecraft/GameEnums.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "util/StringHelpers.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Font.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" +#include "platform/PlatformTypes.h" +#include "platform/profile/profile.h" #include "strings.h" +#include "util/StringHelpers.h" class UILayer; 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 a207a9a2f..e1f56c6e6 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 @@ -3,19 +3,19 @@ #include -#include "minecraft/GameEnums.h" #include "app/common/Network/GameNetworkManager.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/ClientConnection.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/network/packet/ServerSettingsChangedPacket.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "minecraft/world/entity/player/Player.h" #include "strings.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 05bbaa567..0da94aab4 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 @@ -2,12 +2,7 @@ #include -#include "platform/PlatformTypes.h" -#include "platform/profile/profile.h" -#include "minecraft/GameEnums.h" -#include "minecraft/Console_Debug_enum.h" #include "app/common/Network/GameNetworkManager.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Label.h" @@ -16,11 +11,16 @@ #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" +#include "minecraft/Console_Debug_enum.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/ClientConnection.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/network/packet/KickPlayerPacket.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "minecraft/sounds/SoundTypes.h" +#include "platform/PlatformTypes.h" +#include "platform/profile/profile.h" #include "strings.h" UIScene_InGameInfoMenu::UIScene_InGameInfoMenu(int iPad, void* initData, diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.h index 995c07e3f..aa3dce319 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.h @@ -4,7 +4,6 @@ #include #include -#include "platform/storage/storage.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" @@ -12,6 +11,7 @@ #include "app/common/UI/Controls/UIControl_PlayerList.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" +#include "platform/storage/storage.h" class INetworkPlayer; class UILayer; 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 d5106a9f0..5e6dac856 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 @@ -3,9 +3,7 @@ #include -#include "minecraft/GameEnums.h" #include "app/common/Network/GameNetworkManager.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" @@ -14,11 +12,13 @@ #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/ClientConnection.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/network/packet/KickPlayerPacket.h" #include "minecraft/network/packet/PlayerInfoPacket.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "minecraft/world/entity/player/Player.h" #include "strings.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.h index 0b7f4a3a3..1ce577898 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.h @@ -3,7 +3,6 @@ #include #include -#include "platform/storage/storage.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" @@ -11,6 +10,7 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" +#include "platform/storage/storage.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameSaveManagementMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameSaveManagementMenu.cpp index 469b58061..8c40bd7e5 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameSaveManagementMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameSaveManagementMenu.cpp @@ -202,7 +202,8 @@ void UIScene_InGameSaveManagementMenu::tick() { return loadSaveDataThumbnailReturned(data, bytes); }); - if (eLoadStatus != IPlatformStorage::ESaveGame_GetSaveThumbnail) { + if (eLoadStatus != + IPlatformStorage::ESaveGame_GetSaveThumbnail) { // something went wrong m_bRetrievingSaveThumbnails = false; m_bAllLoaded = true; @@ -224,7 +225,7 @@ void UIScene_InGameSaveManagementMenu::tick() { MAX_SAVEFILENAME_LENGTH, // total length of source UTF-8 // string, // in char's (= bytes), including end-of-string \0 - (char*)u16Message, // destination buffer + (char*)u16Message, // destination buffer MAX_SAVEFILENAME_LENGTH // size of destination buffer, in // char's ); @@ -268,7 +269,8 @@ void UIScene_InGameSaveManagementMenu::tick() { return loadSaveDataThumbnailReturned(data, bytes); }); - if (eLoadStatus != IPlatformStorage::ESaveGame_GetSaveThumbnail) { + if (eLoadStatus != + IPlatformStorage::ESaveGame_GetSaveThumbnail) { // something went wrong m_bRetrievingSaveThumbnails = false; m_bAllLoaded = true; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameSaveManagementMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameSaveManagementMenu.h index 737d8d5ef..639fe48d8 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameSaveManagementMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameSaveManagementMenu.h @@ -91,9 +91,9 @@ protected: public: int loadSaveDataThumbnailReturned(std::uint8_t* pbThumbnail, - unsigned int thumbnailBytes); - static int DeleteSaveDialogReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); + unsigned int thumbnailBytes); + static int DeleteSaveDialogReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); int deleteSaveDataReturned(bool bRes); protected: 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 dbac8c9f1..fdf4dba56 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 @@ -5,8 +5,6 @@ #include -#include "platform/profile/profile.h" -#include "minecraft/GameEnums.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" #include "app/common/Network/GameNetworkManager.h" @@ -18,11 +16,13 @@ #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/client/skins/DLCTexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" #include "minecraft/sounds/SoundTypes.h" +#include "platform/profile/profile.h" #include "strings.h" class TexturePack; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.h index 23c305cf8..7ec51ef6c 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.h @@ -2,12 +2,12 @@ #include -#include "platform/storage/storage.h" #include "app/common/UI/All Platforms/IUIScene_PauseMenu.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" +#include "platform/storage/storage.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_SignEntryMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_SignEntryMenu.cpp index 7a637adfb..1da16ab73 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_SignEntryMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_SignEntryMenu.cpp @@ -1,7 +1,6 @@ #include "UIScene_SignEntryMenu.h" -#include "platform/input/input.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Label.h" @@ -10,7 +9,6 @@ #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "util/StringHelpers.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/ClientConnection.h" #include "minecraft/client/multiplayer/MultiPlayerLevel.h" @@ -18,7 +16,9 @@ #include "minecraft/network/packet/SignUpdatePacket.h" #include "minecraft/sounds/SoundTypes.h" #include "minecraft/world/level/tile/entity/SignTileEntity.h" +#include "platform/input/input.h" #include "strings.h" +#include "util/StringHelpers.h" UIScene_SignEntryMenu::UIScene_SignEntryMenu(int iPad, void* _initData, UILayer* parentLayer) @@ -52,7 +52,8 @@ UIScene_SignEntryMenu::UIScene_SignEntryMenu(int iPad, void* _initData, IPlatformInput::EKeyboardMode_Alphabet); break; default: - m_signRows[i].SetKeyboardType(IPlatformInput::EKeyboardMode_Full); + m_signRows[i].SetKeyboardType( + IPlatformInput::EKeyboardMode_Full); break; } @@ -164,8 +165,7 @@ void UIScene_SignEntryMenu::handlePress(F64 controlId, F64 childId) { // 4J HEG - No reason to set value if keyboard was cancelled m_bIgnoreInput = false; if (bRes && m_iEditingLine >= 0 && m_iEditingLine < 4) { - std::string str = - PlatformInput.GetText(); + std::string str = PlatformInput.GetText(); if (str.size() > 15) str.resize(15); m_textInputLines[m_iEditingLine].setLabel(str); } diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_TeleportMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_TeleportMenu.cpp index 3ebc242d5..cd03823cd 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_TeleportMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_TeleportMenu.cpp @@ -3,9 +3,7 @@ #include -#include "minecraft/Console_Debug_enum.h" #include "app/common/Network/GameNetworkManager.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_PlayerList.h" @@ -13,9 +11,11 @@ #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" +#include "minecraft/Console_Debug_enum.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/ClientConnection.h" #include "minecraft/network/packet/GameCommandPacket.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "minecraft/server/commands/TeleportCommand.h" #include "minecraft/sounds/SoundTypes.h" #include "strings.h" diff --git a/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.cpp b/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.cpp index fcc99ac9e..76e61d5bf 100644 --- a/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.cpp +++ b/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.cpp @@ -1,8 +1,6 @@ #include "UIScene_ConnectingProgress.h" -#include "platform/profile/profile.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" @@ -13,8 +11,10 @@ #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "java/System.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/network/packet/DisconnectPacket.h" +#include "platform/profile/profile.h" #include "strings.h" UIScene_ConnectingProgress::UIScene_ConnectingProgress(int iPad, diff --git a/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.cpp b/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.cpp index 803a001eb..1183838ac 100644 --- a/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.cpp +++ b/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.cpp @@ -4,9 +4,6 @@ #include #include -#include "platform/PlatformTypes.h" -#include "platform/profile/profile.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" @@ -16,10 +13,13 @@ #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "platform/C4JThread.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/ProgressRenderer.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" +#include "platform/C4JThread.h" +#include "platform/PlatformTypes.h" +#include "platform/profile/profile.h" #include "strings.h" UIScene_FullscreenProgress::UIScene_FullscreenProgress(int iPad, void* initData, @@ -231,7 +231,8 @@ void UIScene_FullscreenProgress::tick() { // This just allows it to be shown Minecraft* pMinecraft = Minecraft::GetInstance(); if (pMinecraft->localgameModes - [PlatformProfile.GetPrimaryPad()] != nullptr) + [PlatformProfile.GetPrimaryPad()] != + nullptr) pMinecraft ->localgameModes[PlatformProfile .GetPrimaryPad()] diff --git a/targets/app/common/UI/Scenes/UIScene_Keyboard.cpp b/targets/app/common/UI/Scenes/UIScene_Keyboard.cpp index 23bdd0aec..5959ed9e2 100644 --- a/targets/app/common/UI/Scenes/UIScene_Keyboard.cpp +++ b/targets/app/common/UI/Scenes/UIScene_Keyboard.cpp @@ -1,6 +1,5 @@ #include "UIScene_Keyboard.h" -#include "minecraft/GameTypes.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_TextInput.h" @@ -8,8 +7,9 @@ #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "util/StringHelpers.h" +#include "minecraft/GameTypes.h" #include "strings.h" +#include "util/StringHelpers.h" #define KEYBOARD_DONE_TIMER_ID 0 #define KEYBOARD_DONE_TIMER_TIME 100 @@ -30,7 +30,7 @@ UIScene_Keyboard::UIScene_Keyboard(int iPad, void* initData, m_ButtonCursorRight.init("Cursor Right", -1); m_ButtonCaps.init("Caps", -1); m_ButtonDone.init("Done", 0); // only the done button needs an id, the - // others will never call back! + // others will never call back! m_ButtonSymbols.init("Symbols", -1); m_ButtonBackspace.init("Backspace", -1); diff --git a/targets/app/common/UI/Scenes/UIScene_MessageBox.cpp b/targets/app/common/UI/Scenes/UIScene_MessageBox.cpp index 1c5e369aa..855e05dd3 100644 --- a/targets/app/common/UI/Scenes/UIScene_MessageBox.cpp +++ b/targets/app/common/UI/Scenes/UIScene_MessageBox.cpp @@ -1,8 +1,6 @@ #include "UIScene_MessageBox.h" -#include "platform/PlatformTypes.h" -#include "platform/profile/profile.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Label.h" @@ -10,6 +8,8 @@ #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" +#include "platform/PlatformTypes.h" +#include "platform/profile/profile.h" #include "strings.h" UIScene_MessageBox::UIScene_MessageBox(int iPad, void* initData, @@ -114,7 +114,8 @@ void UIScene_MessageBox::handleInput(int iPad, int key, bool repeat, if (pressed) { navigateBack(); if (m_Func) - m_Func(m_lpParam, iPad, IPlatformStorage::EMessage_Cancelled); + m_Func(m_lpParam, iPad, + IPlatformStorage::EMessage_Cancelled); } break; case ACTION_MENU_OK: @@ -129,7 +130,8 @@ void UIScene_MessageBox::handleInput(int iPad, int key, bool repeat, } void UIScene_MessageBox::handlePress(F64 controlId, F64 childId) { - IPlatformStorage::EMessageResult result = IPlatformStorage::EMessage_Cancelled; + IPlatformStorage::EMessageResult result = + IPlatformStorage::EMessage_Cancelled; switch ((int)controlId) { case 0: result = IPlatformStorage::EMessage_ResultAccept; diff --git a/targets/app/common/UI/Scenes/UIScene_MessageBox.h b/targets/app/common/UI/Scenes/UIScene_MessageBox.h index d417692e5..aaf07e0bd 100644 --- a/targets/app/common/UI/Scenes/UIScene_MessageBox.h +++ b/targets/app/common/UI/Scenes/UIScene_MessageBox.h @@ -2,12 +2,12 @@ #include -#include "platform/storage/storage.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" +#include "platform/storage/storage.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Scenes/UIScene_QuadrantSignin.cpp b/targets/app/common/UI/Scenes/UIScene_QuadrantSignin.cpp index 3dea50cd3..d7d002d32 100644 --- a/targets/app/common/UI/Scenes/UIScene_QuadrantSignin.cpp +++ b/targets/app/common/UI/Scenes/UIScene_QuadrantSignin.cpp @@ -3,15 +3,15 @@ #include -#include "platform/PlatformTypes.h" -#include "platform/input/input.h" -#include "platform/profile/profile.h" #include "app/common/UI/Controls/UIControl_BitmapIcon.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" +#include "platform/PlatformTypes.h" +#include "platform/input/input.h" +#include "platform/profile/profile.h" #include "strings.h" UIScene_QuadrantSignin::UIScene_QuadrantSignin(int iPad, void* _initData, @@ -35,9 +35,7 @@ UIScene_QuadrantSignin::~UIScene_QuadrantSignin() { m_parentLayer->removeComponent(eUIComponent_MenuBackground); } -std::string UIScene_QuadrantSignin::getMoviePath() { - return "QuadrantSignin"; -} +std::string UIScene_QuadrantSignin::getMoviePath() { return "QuadrantSignin"; } void UIScene_QuadrantSignin::updateTooltips() { ui.SetTooltips(m_iPad, IDS_TOOLTIPS_CONTINUE, IDS_TOOLTIPS_CANCEL); @@ -140,9 +138,7 @@ void UIScene_QuadrantSignin::updateState() { // app.DebugPrintf("Index %d is signed in, display name - '%s'\n", // i, PlatformProfile.GetDisplayName(i).data()); - { - setControllerState(i, eControllerStatus_PlayerDetails); - } + { setControllerState(i, eControllerStatus_PlayerDetails); } m_labelDisplayName[i].setLabel(PlatformProfile.GetDisplayName(i)); // m_buttonControllers[i].setLabel(app.GetString(IDS_TOOLTIPS_CONTINUE),i); @@ -150,8 +146,7 @@ void UIScene_QuadrantSignin::updateState() { if (!m_iconRequested[i]) { app.DebugPrintf(app.USER_SR, "Requesting avatar for %d\n", i); if (PlatformProfile.GetProfileAvatar( - i, - [this](std::uint8_t* data, unsigned int bytes) { + i, [this](std::uint8_t* data, unsigned int bytes) { return AvatarReturned(this, data, bytes); })) { m_iconRequested[i] = true; @@ -228,9 +223,7 @@ void UIScene_QuadrantSignin::_initQuadrants() { if (PlatformProfile.IsSignedIn(i)) { app.DebugPrintf("Index %d is signed in\n", i); - { - setControllerState(i, eControllerStatus_PlayerDetails); - } + { setControllerState(i, eControllerStatus_PlayerDetails); } m_labelDisplayName[i].init(PlatformProfile.GetDisplayName(i)); } else if (PlatformInput.IsPadConnected(i)) { diff --git a/targets/app/common/UI/UIBitmapFont.cpp b/targets/app/common/UI/UIBitmapFont.cpp index 1ed7820e5..c6fe24590 100644 --- a/targets/app/common/UI/UIBitmapFont.cpp +++ b/targets/app/common/UI/UIBitmapFont.cpp @@ -4,9 +4,9 @@ #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif +#include "UIFontData.h" #include "app/linux/Iggy/include/rrCore.h" #include "minecraft/client/BufferedImage.h" -#include "UIFontData.h" ///////////////////////////// // UI Abstract Bitmap Font // @@ -282,7 +282,7 @@ rrbool UIBitmapFont::GetGlyphBitmap(S32 glyph, F32 pixel_scale, while ((0.5f + glyphScale) * truePixelScale < targetPixelScale) glyphScale++; - // 4J-JEV: Debug code to check which font sizes are being used. + // 4J-JEV: Debug code to check which font sizes are being used. #if (!defined _CONTENT_PACKAGE) && (VERBOSE_FONT_OUTPUT > 0) struct DebugData { diff --git a/targets/app/common/UI/UIController.cpp b/targets/app/common/UI/UIController.cpp index 12c385a29..8655de601 100644 --- a/targets/app/common/UI/UIController.cpp +++ b/targets/app/common/UI/UIController.cpp @@ -10,9 +10,6 @@ #include #include -#include "platform/input/input.h" -#include "platform/profile/profile.h" -#include "minecraft/GameEnums.h" #include "app/common/Audio/SoundEngine.h" #include "app/common/DLC/DLCManager.h" #include "app/common/Network/GameNetworkManager.h" @@ -30,20 +27,17 @@ #include "app/common/UI/UIString.h" #include "app/common/UI/UITTFFont.h" #include "app/linux/Iggy/include/iggy.h" +#include "minecraft/GameEnums.h" +#include "platform/input/input.h" +#include "platform/profile/profile.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif +#include "UIFontData.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "minecraft/client/BufferedImage.h" -#include "UIFontData.h" -#include "platform/XboxStubs.h" -#include "platform/C4JThread.h" -#include "util/Timer.h" - -#include "util/StringHelpers.h" - #include "java/System.h" +#include "minecraft/client/BufferedImage.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/client/renderer/Textures.h" @@ -51,7 +45,11 @@ #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" #include "minecraft/client/title/TitleScreen.h" +#include "platform/C4JThread.h" +#include "platform/XboxStubs.h" #include "strings.h" +#include "util/StringHelpers.h" +#include "util/Timer.h" class Tutorial; @@ -355,15 +353,13 @@ UITTFFont* UIController::createFont(EFont fontLanguage) { "app/common/Media/font/JPN/DFGMaruGothic-Md.ttf", 0x2022); // JPN case eFont_TradChinese: - return new UITTFFont( - "Mojangles_TTF_cnTD", - "app/common/Media/font/CHT/DFHeiMedium-B5.ttf", - 0x2022); // CHT + return new UITTFFont("Mojangles_TTF_cnTD", + "app/common/Media/font/CHT/DFHeiMedium-B5.ttf", + 0x2022); // CHT case eFont_Korean: - return new UITTFFont( - "Mojangles_TTF_koKR", - "app/common/Media/font/KOR/BOKMSD.ttf", - 0x2022); // KOR + return new UITTFFont("Mojangles_TTF_koKR", + "app/common/Media/font/KOR/BOKMSD.ttf", + 0x2022); // KOR // 4J-JEV, Cyrillic characters have been added to this font now, // (4/July/14) XC_LANGUAGE_RUSSIAN and XC_LANGUAGE_GREEK: default: @@ -561,8 +557,7 @@ void UIController::loadSkins() { loadSkin("skinHDLabels.swf", "skinHDLabels.swf"); m_iggyLibraries[eLibrary_InGame] = loadSkin("skinHDInGame.swf", "skinHDInGame.swf"); - m_iggyLibraries[eLibrary_HUD] = - loadSkin("skinHDHud.swf", "skinHDHud.swf"); + m_iggyLibraries[eLibrary_HUD] = loadSkin("skinHDHud.swf", "skinHDHud.swf"); m_iggyLibraries[eLibrary_Tooltips] = loadSkin("skinHDTooltips.swf", "skinHDTooltips.swf"); m_iggyLibraries[eLibrary_Default] = loadSkin("skinHD.swf", "skinHD.swf"); @@ -740,7 +735,7 @@ void UIController::tickInput() { #if defined(ENABLE_IGGY_PERFMON) if (m_iggyPerfmonEnabled) { if (PlatformInput.ButtonPressed(PlatformProfile.GetPrimaryPad(), - ACTION_MENU_STICK_PRESS)) + ACTION_MENU_STICK_PRESS)) m_iggyPerfmonEnabled = !m_iggyPerfmonEnabled; } else #endif @@ -777,7 +772,8 @@ void UIController::handleKeyPress(unsigned int iPad, unsigned int key) { if (pressed) { // Start repeat timer m_actionRepeatTimer[iPad][key] = - time_util::clock::now() + std::chrono::milliseconds(UI_REPEAT_KEY_DELAY_MS); + time_util::clock::now() + + std::chrono::milliseconds(UI_REPEAT_KEY_DELAY_MS); } else if (released) { // Stop repeat timer m_actionRepeatTimer[iPad][key] = {}; @@ -887,8 +883,8 @@ void UIController::renderScenes() { #endif } -void UIController::getRenderDimensions(IPlatformRenderer::eViewportType viewport, - S32& width, S32& height) { +void UIController::getRenderDimensions( + IPlatformRenderer::eViewportType viewport, S32& width, S32& height) { switch (viewport) { case IPlatformRenderer::VIEWPORT_TYPE_FULLSCREEN: width = (S32)(getScreenWidth()); @@ -916,7 +912,8 @@ void UIController::getRenderDimensions(IPlatformRenderer::eViewportType viewport } } -void UIController::setupRenderPosition(IPlatformRenderer::eViewportType viewport) { +void UIController::setupRenderPosition( + IPlatformRenderer::eViewportType viewport) { if (m_bCustomRenderPosition || m_currentRenderViewport != viewport) { m_currentRenderViewport = viewport; m_bCustomRenderPosition = false; @@ -1128,8 +1125,8 @@ GDrawTexture* RADLINK UIController::TextureSubstitutionCreateCallback( if (image.getData() != nullptr) { image.preMultiplyAlpha(); Textures* t = Minecraft::GetInstance()->textures; - int id = t->getTexture(&image, IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw, - false); + int id = t->getTexture( + &image, IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw, false); // 4J Stu - All our flash controls that allow replacing textures use // a special 64x64 symbol Force this size here so that our images @@ -1179,8 +1176,8 @@ void UIController::registerSubstitutionTexture(const std::string& textureName, std::vector(pbData, pbData + dwLength); } -void UIController::unregisterSubstitutionTexture( - const std::string& textureName, bool deleteData) { +void UIController::unregisterSubstitutionTexture(const std::string& textureName, + bool deleteData) { auto it = m_substitutionTextures.find(textureName); if (it != m_substitutionTextures.end()) { @@ -1370,7 +1367,8 @@ void UIController::NavigateToHomeMenu() { // { // pDLCTexPack->m_pSoundBank->Destroy(); // } - const unsigned int result = PlatformStorage.UnmountInstalledDLC("TPACK"); + const unsigned int result = + PlatformStorage.UnmountInstalledDLC("TPACK"); app.DebugPrintf("Unmount result is %d\n", result); } @@ -1796,8 +1794,7 @@ void UIController::DisplayGamertag(unsigned int iPad, bool show) { } } -void UIController::SetSelectedItem(unsigned int iPad, - const std::string& name) { +void UIController::SetSelectedItem(unsigned int iPad, const std::string& name) { EUIGroup group; if (app.GetGameStarted()) { @@ -2159,8 +2156,8 @@ void UIController::ClearPressStart() { m_iPressStartQuadrantsMask = 0; } IPlatformStorage::EMessageResult UIController::RequestAlertMessage( unsigned int uiTitle, unsigned int uiText, unsigned int* uiOptionA, unsigned int uiOptionC, unsigned int dwPad, - int (*Func)(void*, int, const IPlatformStorage::EMessageResult), void* lpParam, - char* pwchFormatString) { + int (*Func)(void*, int, const IPlatformStorage::EMessageResult), + void* lpParam, char* pwchFormatString) { return RequestMessageBox(uiTitle, uiText, uiOptionA, uiOptionC, dwPad, Func, lpParam, pwchFormatString, 0, false); } @@ -2168,8 +2165,8 @@ IPlatformStorage::EMessageResult UIController::RequestAlertMessage( IPlatformStorage::EMessageResult UIController::RequestErrorMessage( unsigned int uiTitle, unsigned int uiText, unsigned int* uiOptionA, unsigned int uiOptionC, unsigned int dwPad, - int (*Func)(void*, int, const IPlatformStorage::EMessageResult), void* lpParam, - char* pwchFormatString) { + int (*Func)(void*, int, const IPlatformStorage::EMessageResult), + void* lpParam, char* pwchFormatString) { return RequestMessageBox(uiTitle, uiText, uiOptionA, uiOptionC, dwPad, Func, lpParam, pwchFormatString, 0, true); } @@ -2177,8 +2174,9 @@ IPlatformStorage::EMessageResult UIController::RequestErrorMessage( IPlatformStorage::EMessageResult UIController::RequestMessageBox( unsigned int uiTitle, unsigned int uiText, unsigned int* uiOptionA, unsigned int uiOptionC, unsigned int dwPad, - int (*Func)(void*, int, const IPlatformStorage::EMessageResult), void* lpParam, - char* pwchFormatString, unsigned int dwFocusButton, bool bIsError) + int (*Func)(void*, int, const IPlatformStorage::EMessageResult), + void* lpParam, char* pwchFormatString, unsigned int dwFocusButton, + bool bIsError) { MessageBoxInfo param; @@ -2224,7 +2222,8 @@ IPlatformStorage::EMessageResult UIController::RequestMessageBox( IPlatformStorage::EMessageResult UIController::RequestUGCMessageBox( int title /* = -1 */, int message /* = -1 */, int iPad /* = -1*/, - int (*Func)(void*, int, const IPlatformStorage::EMessageResult) /* = nullptr*/, + int (*Func)(void*, int, + const IPlatformStorage::EMessageResult) /* = nullptr*/, void* lpParam /* = nullptr*/) { // Default title / messages if (title == -1) { @@ -2244,9 +2243,11 @@ IPlatformStorage::EMessageResult UIController::RequestUGCMessageBox( lpParam); } -IPlatformStorage::EMessageResult UIController::RequestContentRestrictedMessageBox( +IPlatformStorage::EMessageResult +UIController::RequestContentRestrictedMessageBox( int title /* = -1 */, int message /* = -1 */, int iPad /* = -1*/, - int (*Func)(void*, int, const IPlatformStorage::EMessageResult) /* = nullptr*/, + int (*Func)(void*, int, + const IPlatformStorage::EMessageResult) /* = nullptr*/, void* lpParam /* = nullptr*/) { // Default title / messages if (title == -1) { diff --git a/targets/app/common/UI/UIController.h b/targets/app/common/UI/UIController.h index 561513dbe..d8906c7da 100644 --- a/targets/app/common/UI/UIController.h +++ b/targets/app/common/UI/UIController.h @@ -21,17 +21,17 @@ #include "app/windows/Iggy/include/iggy.h" #endif -#include "platform/PlatformTypes.h" -#include "platform/input/input.h" -#include "platform/renderer/renderer.h" -#include "platform/storage/storage.h" +#include "UIGroup.h" #include "app/common/UI/All Platforms/IUIController.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl.h" #include "app/linux/Iggy/include/rrCore.h" -#include "UIGroup.h" #include "minecraft/sounds/SoundTypes.h" +#include "platform/PlatformTypes.h" +#include "platform/input/input.h" +#include "platform/renderer/renderer.h" +#include "platform/storage/storage.h" class UIAbstractBitmapFont; class UIBitmapFont; @@ -43,7 +43,7 @@ class Tutorial; class UIScene; // 4jcraft, used to be D3D11_RECT. -// This was the only class that used it, so it's here now. +// This was the only class that used it, so it's here now. struct RECT { long left; long top; @@ -72,7 +72,8 @@ private: 300; // How long from press until the first repeat static constexpr int UI_REPEAT_KEY_REPEAT_RATE_MS = 100; // How long in between repeats - time_util::time_point m_actionRepeatTimer[XUSER_MAX_COUNT][ACTION_MAX_MENU + 1]; + time_util::time_point m_actionRepeatTimer[XUSER_MAX_COUNT] + [ACTION_MAX_MENU + 1]; float m_fScreenWidth; float m_fScreenHeight; @@ -277,8 +278,8 @@ public: } virtual void render() = 0; - void getRenderDimensions(IPlatformRenderer::eViewportType viewport, S32& width, - S32& height); + void getRenderDimensions(IPlatformRenderer::eViewportType viewport, + S32& width, S32& height); void setupRenderPosition(IPlatformRenderer::eViewportType viewport); void setupRenderPosition(S32 xOrigin, S32 yOrigin); @@ -431,12 +432,14 @@ public: virtual IPlatformStorage::EMessageResult RequestAlertMessage( uint32_t uiTitle, uint32_t uiText, uint32_t* uiOptionA, uint32_t uiOptionC, uint32_t dwPad = XUSER_INDEX_ANY, - int (*Func)(void*, int, const IPlatformStorage::EMessageResult) = nullptr, + int (*Func)(void*, int, + const IPlatformStorage::EMessageResult) = nullptr, void* lpParam = nullptr, char* pwchFormatString = nullptr); virtual IPlatformStorage::EMessageResult RequestErrorMessage( uint32_t uiTitle, uint32_t uiText, uint32_t* uiOptionA, uint32_t uiOptionC, uint32_t dwPad = XUSER_INDEX_ANY, - int (*Func)(void*, int, const IPlatformStorage::EMessageResult) = nullptr, + int (*Func)(void*, int, + const IPlatformStorage::EMessageResult) = nullptr, void* lpParam = nullptr, char* pwchFormatString = nullptr); private: @@ -450,11 +453,13 @@ private: public: IPlatformStorage::EMessageResult RequestUGCMessageBox( int title = -1, int message = -1, int iPad = -1, - int (*Func)(void*, int, const IPlatformStorage::EMessageResult) = nullptr, + int (*Func)(void*, int, + const IPlatformStorage::EMessageResult) = nullptr, void* lpParam = nullptr); IPlatformStorage::EMessageResult RequestContentRestrictedMessageBox( int title = -1, int message = -1, int iPad = -1, - int (*Func)(void*, int, const IPlatformStorage::EMessageResult) = nullptr, + int (*Func)(void*, int, + const IPlatformStorage::EMessageResult) = nullptr, void* lpParam = nullptr); virtual void SetWinUserIndex(unsigned int iPad); diff --git a/targets/app/common/UI/UIGroup.cpp b/targets/app/common/UI/UIGroup.cpp index b949956d4..58ad0bc69 100644 --- a/targets/app/common/UI/UIGroup.cpp +++ b/targets/app/common/UI/UIGroup.cpp @@ -1,7 +1,5 @@ #include "UIGroup.h" -#include "platform/profile/profile.h" -#include "platform/renderer/renderer.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/All Platforms/UIEnums.h" @@ -11,6 +9,8 @@ #include "app/linux/Linux_UIController.h" #include "minecraft/client/MemoryTracker.h" #include "minecraft/client/Minecraft.h" +#include "platform/profile/profile.h" +#include "platform/renderer/renderer.h" class UIScene; @@ -251,7 +251,9 @@ void UIGroup::SetViewportType(IPlatformRenderer::eViewportType type) { } } -IPlatformRenderer::eViewportType UIGroup::GetViewportType() { return m_viewportType; } +IPlatformRenderer::eViewportType UIGroup::GetViewportType() { + return m_viewportType; +} void UIGroup::HandleDLCMountingComplete() { // Ignore this group if the player isn't signed in diff --git a/targets/app/common/UI/UIGroup.h b/targets/app/common/UI/UIGroup.h index 806c269c4..162369f53 100644 --- a/targets/app/common/UI/UIGroup.h +++ b/targets/app/common/UI/UIGroup.h @@ -1,10 +1,10 @@ #pragma once #include -#include "platform/renderer/renderer.h" +#include "UILayer.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/linux/Iggy/include/rrCore.h" -#include "UILayer.h" +#include "platform/renderer/renderer.h" class UIComponent_Tooltips; class UIComponent_TutorialPopup; diff --git a/targets/app/common/UI/UILayer.cpp b/targets/app/common/UI/UILayer.cpp index ba67117b4..a348916ba 100644 --- a/targets/app/common/UI/UILayer.cpp +++ b/targets/app/common/UI/UILayer.cpp @@ -2,7 +2,6 @@ #include -#include "platform/renderer/renderer.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Components/UIComponent_Chat.h" #include "app/common/UI/Components/UIComponent_DebugUIConsole.h" @@ -79,6 +78,7 @@ #include "app/linux/Iggy/include/rrCore.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" +#include "platform/renderer/renderer.h" UILayer::UILayer(UIGroup* parent) { m_parentGroup = parent; @@ -138,7 +138,8 @@ void UILayer::tick() { } } -void UILayer::render(S32 width, S32 height, IPlatformRenderer::eViewportType viewport) { +void UILayer::render(S32 width, S32 height, + IPlatformRenderer::eViewportType viewport) { if (!ui.IsExpectingOrReloadingSkin()) { for (auto it = m_components.begin(); it != m_components.end(); ++it) { auto itRef = m_componentRefCount.find((*it)->getSceneType()); diff --git a/targets/app/common/UI/UILayer.h b/targets/app/common/UI/UILayer.h index 540c3bd24..8e6d7fe5b 100644 --- a/targets/app/common/UI/UILayer.h +++ b/targets/app/common/UI/UILayer.h @@ -6,9 +6,9 @@ #include #include -#include "platform/renderer/renderer.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/linux/Iggy/include/rrCore.h" +#include "platform/renderer/renderer.h" // using namespace std; class UIScene; @@ -44,7 +44,8 @@ public: UILayer(UIGroup* parent); void tick(); - void render(S32 width, S32 height, IPlatformRenderer::eViewportType viewport); + void render(S32 width, S32 height, + IPlatformRenderer::eViewportType viewport); void getRenderDimensions(S32& width, S32& height); void DestroyAll(); diff --git a/targets/app/common/UI/UIScene.h b/targets/app/common/UI/UIScene.h index ebb660d42..a597b5735 100644 --- a/targets/app/common/UI/UIScene.h +++ b/targets/app/common/UI/UIScene.h @@ -13,11 +13,11 @@ #include #include -#include "platform/renderer/renderer.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/linux/Iggy/include/iggy.h" +#include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif @@ -55,10 +55,8 @@ class UIControl; currentRoot = lastRoot; \ } -#define UI_MAP_NAME(var, name) \ - { \ - var = registerFastName(name); \ - } +#define UI_MAP_NAME(var, name) \ + { var = registerFastName(name); } class UIScene { friend class UILayer; diff --git a/targets/app/common/UI/UITTFFont.cpp b/targets/app/common/UI/UITTFFont.cpp index fe5065a90..2d09b2ad3 100644 --- a/targets/app/common/UI/UITTFFont.cpp +++ b/targets/app/common/UI/UITTFFont.cpp @@ -8,8 +8,8 @@ #endif #include "app/linux/Iggy/include/rrCore.h" #include "app/linux/LinuxGame.h" -#include "util/StringHelpers.h" #include "platform/fs/fs.h" +#include "util/StringHelpers.h" UITTFFont::UITTFFont(const std::string& name, const std::string& path, S32 fallbackCharacter) diff --git a/targets/app/common/XboxStubs.cpp b/targets/app/common/XboxStubs.cpp index d0b57de3d..913f61e07 100644 --- a/targets/app/common/XboxStubs.cpp +++ b/targets/app/common/XboxStubs.cpp @@ -1,6 +1,7 @@ -#include "platform/PlatformTypes.h" #include "platform/XboxStubs.h" +#include "platform/PlatformTypes.h" + bool IsEqualXUID(PlayerUID a, PlayerUID b) { return a == b; } uint32_t XUserGetSigninInfo(uint32_t dwUserIndex, uint32_t dwFlags, diff --git a/targets/app/linux/Iggy/include/iggy.h b/targets/app/linux/Iggy/include/iggy.h index 23c441c61..188064dac 100644 --- a/targets/app/linux/Iggy/include/iggy.h +++ b/targets/app/linux/Iggy/include/iggy.h @@ -488,15 +488,16 @@ IDOCN typedef struct { rrbool(RADLINK* connection_valid)( Iggy* swf, HIGGYEXP iggyexp); // Iggy queries this to check if Iggy // Explorer is still connected - S32(RADLINK* poll_command)( - Iggy* swf, HIGGYEXP iggyexp, - U8** buffer); // stores command in *buffer, returns number of bytes + S32(RADLINK* poll_command) + (Iggy* swf, HIGGYEXP iggyexp, + U8** buffer); // stores command in *buffer, returns number of bytes void(RADLINK* send_command)( Iggy* swf, HIGGYEXP iggyexp, U8 command, void* buffer, S32 len); // writes a command with a payload of buffer:len - S32(RADLINK* get_storage)(Iggy* swf, HIGGYEXP iggyexp, - U8** buffer); // returns temporary storage Iggy - // can use for assembling commands + S32(RADLINK* get_storage) + (Iggy* swf, HIGGYEXP iggyexp, + U8** buffer); // returns temporary storage Iggy + // can use for assembling commands rrbool(RADLINK* attach)( Iggy* swf, HIGGYEXP iggyexp, iggyexp_detach_callback* cb, void* cbdata, IggyForPerfmonFunctions* diff --git a/targets/app/linux/Leaderboards/LinuxLeaderboardManager.h b/targets/app/linux/Leaderboards/LinuxLeaderboardManager.h index 72fe03e0e..cdca7a091 100644 --- a/targets/app/linux/Leaderboards/LinuxLeaderboardManager.h +++ b/targets/app/linux/Leaderboards/LinuxLeaderboardManager.h @@ -1,7 +1,7 @@ #pragma once -#include "platform/PlatformTypes.h" #include "app/common/Leaderboards/LeaderboardManager.h" +#include "platform/PlatformTypes.h" class LinuxLeaderboardManager : public LeaderboardManager { public: diff --git a/targets/app/linux/LinuxGame.cpp b/targets/app/linux/LinuxGame.cpp index 0e6d59c73..54fc0830b 100644 --- a/targets/app/linux/LinuxGame.cpp +++ b/targets/app/linux/LinuxGame.cpp @@ -4,18 +4,18 @@ #include -#include "platform/profile/profile.h" -#include "platform/renderer/renderer.h" -#include "platform/storage/storage.h" -#include "minecraft/GameEnums.h" #include "app/common/Game.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/UI/All Platforms/UIStructs.h" -#include "platform/C4JThread.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/User.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/world/level/LevelSettings.h" +#include "platform/C4JThread.h" +#include "platform/profile/profile.h" +#include "platform/renderer/renderer.h" +#include "platform/storage/storage.h" LinuxGame app; @@ -31,19 +31,17 @@ void LinuxGame::ExitGame() { PlatformRenderer.Close(); } void LinuxGame::FatalLoadError() { - app.DebugPrintf( - "LinuxGame::FatalLoadError - asserting 0 and dying...\n"); + app.DebugPrintf("LinuxGame::FatalLoadError - asserting 0 and dying...\n"); assert(0); } void LinuxGame::CaptureSaveThumbnail() {} void LinuxGame::GetSaveThumbnail(std::uint8_t** thumbnailData, - unsigned int* thumbnailSize) {} + unsigned int* thumbnailSize) {} void LinuxGame::ReleaseSaveThumbnail() {} -void LinuxGame::GetScreenshot(int iPad, - std::uint8_t** screenshotData, - unsigned int* screenshotSize) {} +void LinuxGame::GetScreenshot(int iPad, std::uint8_t** screenshotData, + unsigned int* screenshotSize) {} void LinuxGame::TemporaryCreateGameStart() { ////////////////////////////////////////////////////////////////////////////////////////////// @@ -122,15 +120,14 @@ void LinuxGame::TemporaryCreateGameStart() { } int LinuxGame::GetLocalTMSFileIndex(char* wchTMSFile, - bool bFilenameIncludesExtension, - eFileExtensionType eEXT) { + bool bFilenameIncludesExtension, + eFileExtensionType eEXT) { return -1; } int LinuxGame::LoadLocalTMSFile(char* wchTMSFile) { return -1; } -int LinuxGame::LoadLocalTMSFile(char* wchTMSFile, - eFileExtensionType eExt) { +int LinuxGame::LoadLocalTMSFile(char* wchTMSFile, eFileExtensionType eExt) { return -1; } diff --git a/targets/app/linux/Stubs/iggy_stubs.h b/targets/app/linux/Stubs/iggy_stubs.h index dc9d7a0d8..16ac44909 100644 --- a/targets/app/linux/Stubs/iggy_stubs.h +++ b/targets/app/linux/Stubs/iggy_stubs.h @@ -3,14 +3,13 @@ #pragma once +#include +#include + #include "app/linux/Iggy/include/iggy.h" -#include -#include - #define STUBBED \ - { \ - } + {} RADEXPFUNC inline IggyValuePath* RADEXPLINK IggyPlayerRootPath(Iggy* f) { STUBBED; diff --git a/targets/app/windows/Iggy/gdraw/gdraw_d3d11.cpp b/targets/app/windows/Iggy/gdraw/gdraw_d3d11.cpp index eae540d50..d70bb5d3d 100644 --- a/targets/app/windows/Iggy/gdraw/gdraw_d3d11.cpp +++ b/targets/app/windows/Iggy/gdraw/gdraw_d3d11.cpp @@ -38,8 +38,8 @@ // We temporarily disable this warning for the shared interface portions #pragma warning(push) -#pragma warning(disable \ - : 4201) // nonstandard extension used : nameless struct/union +#pragma warning( \ + disable : 4201) // nonstandard extension used : nameless struct/union #include #include diff --git a/targets/app/windows/Iggy/include/gdraw.h b/targets/app/windows/Iggy/include/gdraw.h index d1c58dfe8..c6a171970 100644 --- a/targets/app/windows/Iggy/include/gdraw.h +++ b/targets/app/windows/Iggy/include/gdraw.h @@ -243,8 +243,8 @@ typedef struct GDrawRenderState { S32 id; // Object "identifier" used for high-quality AA mode U32 test_id : 1; // Whether to test zbuffer == id U32 set_id : 1; // Whether to set zbuffer == id - U32 use_world_space - : 1; // Whether primitive is defined in object space or world space + U32 use_world_space : 1; // Whether primitive is defined in object space or + // world space U32 scissor : 1; // Whether rendering will be clipped to // $(GDrawRenderState::scissor_rect) U32 identical_state : 1; // Whether state is identical to the one used for diff --git a/targets/app/windows/Iggy/include/iggy.h b/targets/app/windows/Iggy/include/iggy.h index c1d89e639..bb84c5014 100644 --- a/targets/app/windows/Iggy/include/iggy.h +++ b/targets/app/windows/Iggy/include/iggy.h @@ -488,15 +488,16 @@ IDOCN typedef struct { rrbool(RADLINK* connection_valid)( Iggy* swf, HIGGYEXP iggyexp); // Iggy queries this to check if Iggy // Explorer is still connected - S32(RADLINK* poll_command)( - Iggy* swf, HIGGYEXP iggyexp, - U8** buffer); // stores command in *buffer, returns number of bytes + S32(RADLINK* poll_command) + (Iggy* swf, HIGGYEXP iggyexp, + U8** buffer); // stores command in *buffer, returns number of bytes void(RADLINK* send_command)( Iggy* swf, HIGGYEXP iggyexp, U8 command, void* buffer, S32 len); // writes a command with a payload of buffer:len - S32(RADLINK* get_storage)(Iggy* swf, HIGGYEXP iggyexp, - U8** buffer); // returns temporary storage Iggy - // can use for assembling commands + S32(RADLINK* get_storage) + (Iggy* swf, HIGGYEXP iggyexp, + U8** buffer); // returns temporary storage Iggy + // can use for assembling commands rrbool(RADLINK* attach)( Iggy* swf, HIGGYEXP iggyexp, iggyexp_detach_callback* cb, void* cbdata, IggyForPerfmonFunctions* diff --git a/targets/app/windows/Iggy/include/rrCore.h b/targets/app/windows/Iggy/include/rrCore.h index 83110cabc..54cc183f0 100644 --- a/targets/app/windows/Iggy/include/rrCore.h +++ b/targets/app/windows/Iggy/include/rrCore.h @@ -58,1315 +58,1340 @@ // __RADNOVARARGMACROS__ means #defines can't use ... - #ifdef WINAPI_FAMILY - // If this is #defined, we might be in a Windows Store App. But - // VC++ by default #defines this to a symbolic name, not an integer - // value, and those names are defined in "winapifamily.h". So if - // WINAPI_FAMILY is #defined, #include the header so we can parse it. - #include - #define RAD_WINAPI_IS_APP (!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)) - #else - #define RAD_WINAPI_IS_APP 0 - #endif +#ifdef WINAPI_FAMILY +// If this is #defined, we might be in a Windows Store App. But +// VC++ by default #defines this to a symbolic name, not an integer +// value, and those names are defined in "winapifamily.h". So if +// WINAPI_FAMILY is #defined, #include the header so we can parse it. +#include +#define RAD_WINAPI_IS_APP (!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)) +#else +#define RAD_WINAPI_IS_APP 0 +#endif - #ifndef __RADRES__ - // Theoretically, this is to pad structs on platforms that don't support pragma pack or do it poorly. (PS3, PS2) - // In general it is assumed that your padding is set via pragma, so this is just a struct. - #define RADSTRUCT struct +#ifndef __RADRES__ +// Theoretically, this is to pad structs on platforms that don't support pragma +// pack or do it poorly. (PS3, PS2) In general it is assumed that your padding +// is set via pragma, so this is just a struct. +#define RADSTRUCT struct - #ifdef __GNUC_MINOR__ - // make a combined GCC version for testing : +#ifdef __GNUC_MINOR__ +// make a combined GCC version for testing : - #define __RAD_GCC_VERSION__ (__GNUC__ * 10000 \ - + __GNUC_MINOR__ * 100 \ - + __GNUC_PATCHLEVEL__) +#define __RAD_GCC_VERSION__ \ + (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) - /* Test for GCC > 3.2.0 */ - // #if GCC_VERSION > 30200 - #endif +/* Test for GCC > 3.2.0 */ +// #if GCC_VERSION > 30200 +#endif - #if defined(__RADX32__) +#if defined(__RADX32__) - #define __RADX86__ - #define __RADMMX__ - #define __RAD32__ - #define __RADLITTLEENDIAN__ - #define RADINLINE inline - #define RADRESTRICT __restrict +#define __RADX86__ +#define __RADMMX__ +#define __RAD32__ +#define __RADLITTLEENDIAN__ +#define RADINLINE inline +#define RADRESTRICT __restrict - // known platforms under the RAD generic build type - #if defined(_WIN32) || defined(_Windows) || defined(WIN32) || defined(__WINDOWS__) || defined(_WINDOWS) - #define __RADNT__ - #define __RADWIN__ - #elif (defined(__MWERKS__) && !defined(__INTEL__)) || defined(__MRC__) || defined(THINK_C) || defined(powerc) || defined(macintosh) || defined(__powerc) || defined(__APPLE__) || defined(__MACH__) - #define __RADMAC__ - #undef RADSTRUCT - #define RADSTRUCT struct __attribute__((__packed__)) - #elif defined(__linux__) - #define __RADLINUX__ - #undef RADSTRUCT - #define RADSTRUCT struct __attribute__((__packed__)) - #endif +// known platforms under the RAD generic build type +#if defined(_WIN32) || defined(_Windows) || defined(WIN32) || \ + defined(__WINDOWS__) || defined(_WINDOWS) +#define __RADNT__ +#define __RADWIN__ +#elif (defined(__MWERKS__) && !defined(__INTEL__)) || defined(__MRC__) || \ + defined(THINK_C) || defined(powerc) || defined(macintosh) || \ + defined(__powerc) || defined(__APPLE__) || defined(__MACH__) +#define __RADMAC__ +#undef RADSTRUCT +#define RADSTRUCT struct __attribute__((__packed__)) +#elif defined(__linux__) +#define __RADLINUX__ +#undef RADSTRUCT +#define RADSTRUCT struct __attribute__((__packed__)) +#endif #elif defined(ANDROID) - #define __RADANDROID__ - #define __RAD32__ - #define __RADLITTLEENDIAN__ - #ifdef __i386__ - #define __RADX86__ - #else - #define __RADARM__ - #endif - #define RADINLINE inline - #define RADRESTRICT __restrict - #undef RADSTRUCT - #define RADSTRUCT struct __attribute__((__packed__)) +#define __RADANDROID__ +#define __RAD32__ +#define __RADLITTLEENDIAN__ +#ifdef __i386__ +#define __RADX86__ +#else +#define __RADARM__ +#endif +#define RADINLINE inline +#define RADRESTRICT __restrict +#undef RADSTRUCT +#define RADSTRUCT struct __attribute__((__packed__)) #elif defined(__QNX__) - #define __RAD32__ - #define __RADQNX__ +#define __RAD32__ +#define __RADQNX__ #ifdef __arm__ - #define __RADARM__ +#define __RADARM__ #elif defined __i386__ - #define __RADX86__ +#define __RADX86__ #else - #error Unknown processor -#endif - #define __RADLITTLEENDIAN__ - #define RADINLINE inline - #define RADRESTRICT __restrict +#error Unknown processor +#endif +#define __RADLITTLEENDIAN__ +#define RADINLINE inline +#define RADRESTRICT __restrict - #undef RADSTRUCT - #define RADSTRUCT struct __attribute__((__packed__)) -#elif defined(__linux__) && defined(__arm__) //This should pull in Raspberry Pi as well +#undef RADSTRUCT +#define RADSTRUCT struct __attribute__((__packed__)) +#elif defined(__linux__) && \ + defined(__arm__) // This should pull in Raspberry Pi as well - #define __RAD32__ - #define __RADLINUX__ - #define __RADARM__ - #define __RADLITTLEENDIAN__ - #define RADINLINE inline - #define RADRESTRICT __restrict +#define __RAD32__ +#define __RADLINUX__ +#define __RADARM__ +#define __RADLITTLEENDIAN__ +#define RADINLINE inline +#define RADRESTRICT __restrict - #undef RADSTRUCT - #define RADSTRUCT struct __attribute__((__packed__)) +#undef RADSTRUCT +#define RADSTRUCT struct __attribute__((__packed__)) #elif defined(__native_client__) - #define __RADNACL__ - #define __RAD32__ - #define __RADLITTLEENDIAN__ - #define __RADX86__ - #define RADINLINE inline - #define RADRESTRICT __restrict - - #undef RADSTRUCT - #define RADSTRUCT struct __attribute__((__packed__)) - - #elif defined(_DURANGO) || defined(_SEKRIT) || defined(_SEKRIT1) || defined(_XBOX_ONE) - - #define __RADDURANGO__ 1 - #define __RADXBOXONE__ 1 - #if !defined(__RADSEKRIT__) // keep sekrit around for a bit for compat - #define __RADSEKRIT__ 1 - #endif - - #define __RADWIN__ - #define __RAD32__ - #define __RAD64__ - #define __RADX64__ - #define __RADMMX__ - #define __RADX86__ - #define __RAD64REGS__ - #define __RADLITTLEENDIAN__ - #define RADINLINE __inline - #define RADRESTRICT __restrict - #define __RADWINRTAPI__ - - #elif defined(__ORBIS__) - - #define __RADPS4__ - #if !defined(__RADSEKRIT2__) // keep sekrit2 around for a bit for compat - #define __RADSEKRIT2__ 1 - #endif - #define __RAD32__ - #define __RAD64__ - #define __RADX64__ - #define __RADMMX__ - #define __RADX86__ - #define __RAD64REGS__ - #define __RADLITTLEENDIAN__ - #define RADINLINE inline - #define RADRESTRICT __restrict - - #undef RADSTRUCT - #define RADSTRUCT struct __attribute__((__packed__)) - - #elif defined(WINAPI_FAMILY) && RAD_WINAPI_IS_APP - - #define __RADWINRTAPI__ - #define __RADWIN__ - #define RADINLINE __inline - #define RADRESTRICT __restrict - - #if defined(_M_IX86) // WinRT on x86 - - #define __RAD32__ - #define __RADX86__ - #define __RADMMX__ - #define __RADLITTLEENDIAN__ - - #elif defined(_M_X64) // WinRT on x64 - #define __RAD32__ - #define __RAD64__ - #define __RADX86__ - #define __RADX64__ - #define __RADMMX__ - #define __RAD64REGS__ - #define __RADLITTLEENDIAN__ - - #elif defined(_M_ARM) // WinRT on ARM - - #define __RAD32__ - #define __RADARM__ - #define __RADLITTLEENDIAN__ - - #else - - #error Unrecognized WinRT platform! - - #endif - - #elif defined(_WIN64) - - #define __RADWIN__ - #define __RADNT__ - // See note at top for why both __RAD32__ and __RAD64__ are defined. - #define __RAD32__ - #define __RAD64__ - #define __RADX64__ - #define __RADMMX__ - #define __RADX86__ - #define __RAD64REGS__ - #define __RADLITTLEENDIAN__ - #define RADINLINE __inline - #define RADRESTRICT __restrict - - #elif defined(GENERIC_ARM) - - #define __RAD32__ - #define __RADARM__ - #define __RADLITTLEENDIAN__ - #define __RADFIXEDPOINT__ - #define RADINLINE inline - #if (defined(__GCC__) || defined(__GNUC__)) - #define RADRESTRICT __restrict - #else - #define RADRESTRICT // __restrict not supported on cw - #endif - #undef RADSTRUCT - #define RADSTRUCT struct __attribute__((__packed__)) - - #elif defined(CAFE) // has to be before HOLLYWOOD_REV since it also defines it - - #define __RADWIIU__ - #define __RAD32__ - #define __RADPPC__ - #define __RADBIGENDIAN__ - #define RADINLINE inline - #define RADRESTRICT __restrict - #undef RADSTRUCT - #define RADSTRUCT struct __attribute__((__packed__)) - - - #elif defined(HOLLYWOOD_REV) || defined(REVOLUTION) - - #define __RADWII__ - #define __RAD32__ - #define __RADPPC__ - #define __RADBIGENDIAN__ - #define RADINLINE inline - #define RADRESTRICT __restrict - - #elif defined(NN_PLATFORM_CTR) - - #define __RAD3DS__ - #define __RAD32__ - #define __RADARM__ - #define __RADLITTLEENDIAN__ - #define RADINLINE inline - #define RADRESTRICT - #undef RADSTRUCT - #define RADSTRUCT struct __attribute__((__packed__)) - - #elif defined(GEKKO) - - #define __RADNGC__ - #define __RAD32__ - #define __RADPPC__ - #define __RADBIGENDIAN__ - #define RADINLINE inline - #define RADRESTRICT // __restrict not supported on cw - - #elif defined(SDK_ARM9) || defined(SDK_TWL) || (defined(__arm) && defined(__MWERKS__)) - - #define __RADNDS__ - #define __RAD32__ - #define __RADARM__ - #define __RADLITTLEENDIAN__ - #define __RADFIXEDPOINT__ - #define RADINLINE inline - #if (defined(__GCC__) || defined(__GNUC__)) - #define RADRESTRICT __restrict - #else - #define RADRESTRICT // __restrict not supported on cw - #endif - - #if defined(SDK_TWL) - #define __RADTWL__ - #endif - - #elif defined(R5900) - - #define __RADPS2__ - #define __RAD32__ - #define __RADMIPS__ - #define __RADLITTLEENDIAN__ - #define RADINLINE inline - #define RADRESTRICT __restrict - #define __RAD64REGS__ - #define U128 u_long128 - - #if !defined(__MWERKS__) - #undef RADSTRUCT - #define RADSTRUCT struct __attribute__((__packed__)) - #endif - - #elif defined(__psp__) - - #define __RADPSP__ - #define __RAD32__ - #define __RADMIPS__ - #define __RADLITTLEENDIAN__ - #define RADINLINE inline - #define RADRESTRICT __restrict - - #undef RADSTRUCT - #define RADSTRUCT struct __attribute__((__packed__)) - - #elif defined(__psp2__) - - #undef RADSTRUCT - #define RADSTRUCT struct __attribute__((__packed__)) - - #define __RADPSP2__ - #define __RAD32__ - #define __RADARM__ - #define __RADLITTLEENDIAN__ - #define RADINLINE inline - #define RADRESTRICT __restrict - - // need packed attribute for struct with snc? - #elif defined(__CELLOS_LV2__) - - // CB change : 10-29-10 : RAD64REGS on PPU but NOT SPU - - #ifdef __SPU__ - #define __RADSPU__ - #define __RAD32__ - #define __RADCELL__ - #define __RADBIGENDIAN__ - #define RADINLINE inline - #define RADRESTRICT __restrict - #else - #define __RAD64REGS__ - #define __RADPS3__ - #define __RADPPC__ - #define __RAD32__ - #define __RADCELL__ - #define __RADBIGENDIAN__ - #define RADINLINE inline - #define RADRESTRICT __restrict - #define __RADALTIVEC__ - #endif - - #undef RADSTRUCT - #define RADSTRUCT struct __attribute__((__packed__)) - - #ifndef __LP32__ - #error "PS3 32bit ABI support only" - #endif - #elif (defined(__MWERKS__) && !defined(__INTEL__)) || defined(__MRC__) || defined(THINK_C) || defined(powerc) || defined(macintosh) || defined(__powerc) || defined(__APPLE__) || defined(__MACH__) - #ifdef __APPLE__ - #include "TargetConditionals.h" - #endif - - #if ((defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) || (defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR)) - - // iPhone/iPad/iOS - #define __RADIPHONE__ - #define __RADMACAPI__ - - #define __RAD32__ - #if defined(__x86_64__) - #define __RAD64__ - #endif - - #define __RADLITTLEENDIAN__ - #define RADINLINE inline - #define RADRESTRICT __restrict - #define __RADMACH__ - - #undef RADSTRUCT - #define RADSTRUCT struct __attribute__((__packed__)) - - #if defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR - #if defined( __x86_64__) - #define __RADX64__ - #else - #define __RADX86__ - #endif - #define __RADIPHONESIM__ - #elif defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE - #define __RADARM__ - #endif - #else - - // An actual MacOSX machine - #define __RADMAC__ - #define __RADMACAPI__ - - #if defined(powerc) || defined(__powerc) || defined(__ppc__) - #define __RADPPC__ - #define __RADBIGENDIAN__ - #define __RADALTIVEC__ - #define RADRESTRICT - #elif defined(__i386__) - #define __RADX86__ - #define __RADMMX__ - #define __RADLITTLEENDIAN__ - #define RADRESTRICT __restrict - #elif defined(__x86_64__) - #define __RAD32__ - #define __RAD64__ - #define __RADX86__ - #define __RADX64__ - #define __RAD64REGS__ - #define __RADMMX__ - #define __RADLITTLEENDIAN__ - #define RADRESTRICT __restrict - #else - #define __RAD68K__ - #define __RADBIGENDIAN__ - #define __RADALTIVEC__ - #define RADRESTRICT - #endif - - #define __RAD32__ - - #if defined(__MWERKS__) - #if (defined(__cplusplus) || ! __option(only_std_keywords)) - #define RADINLINE inline - #endif - #ifdef __MACH__ - #define __RADMACH__ - #endif - #elif defined(__MRC__) - #if defined(__cplusplus) - #define RADINLINE inline - #endif - #elif defined(__GNUC__) || defined(__GNUG__) || defined(__MACH__) - #define RADINLINE inline - #define __RADMACH__ - - #undef RADRESTRICT /* could have been defined above... */ - #define RADRESTRICT __restrict - - #undef RADSTRUCT - #define RADSTRUCT struct __attribute__((__packed__)) - #endif - - #ifdef __RADX86__ - #ifndef __RADCARBON__ - #define __RADCARBON__ - #endif - #endif - - #ifdef TARGET_API_MAC_CARBON - #if TARGET_API_MAC_CARBON - #ifndef __RADCARBON__ - #define __RADCARBON__ - #endif - #endif - #endif - #endif - #elif defined(__linux__) - - #define __RADLINUX__ - #define __RADMMX__ - #define __RADLITTLEENDIAN__ - #define __RADX86__ - #ifdef __x86_64 - #define __RAD32__ - #define __RAD64__ - #define __RADX64__ - #define __RAD64REGS__ - #else - #define __RAD32__ - #endif - #define RADINLINE inline - #define RADRESTRICT __restrict - - #undef RADSTRUCT - #define RADSTRUCT struct __attribute__((__packed__)) - - #else - - #if _MSC_VER >= 1400 - #undef RADRESTRICT - #define RADRESTRICT __restrict - #else - #define RADRESTRICT - #define __RADNOVARARGMACROS__ - #endif - - #if defined(_XENON) || ( defined(_XBOX_VER) && (_XBOX_VER == 200) ) - // Remember that Xenon also defines _XBOX - #define __RADPPC__ - #define __RADBIGENDIAN__ - #define __RADALTIVEC__ - #else - #define __RADX86__ - #define __RADMMX__ - #define __RADLITTLEENDIAN__ - #endif - - #ifdef __MWERKS__ - #define _WIN32 - #endif - - #ifdef __DOS__ - #define __RADDOS__ - #define S64_DEFINED // turn off these types - #define U64_DEFINED - #define S64 double //should error - #define U64 double //should error - #define __RADNOVARARGMACROS__ - #endif - - #ifdef __386__ - #define __RAD32__ - #endif - - #ifdef _Windows //For Borland - #ifdef __WIN32__ - #define WIN32 - #else - #define __WINDOWS__ - #endif - #endif - - #ifdef _WINDOWS //For MS - #ifndef _WIN32 - #define __WINDOWS__ - #endif - #endif - - #ifdef _WIN32 - #if defined(_XENON) || ( defined(_XBOX_VER) && (_XBOX_VER == 200) ) - // Remember that Xenon also defines _XBOX - #define __RADXENON__ - #define __RAD64REGS__ - #elif defined(_XBOX) - #define __RADXBOX__ - #elif !defined(__RADWINRTAPI__) - #define __RADNT__ - #endif - #define __RADWIN__ - #define __RAD32__ - #else - #ifdef __NT__ - #if defined(_XENON) || (_XBOX_VER == 200) - // Remember that Xenon also defines _XBOX - #define __RADXENON__ - #define __RAD64REGS__ - #elif defined(_XBOX) - #define __RADXBOX__ - #else - #define __RADNT__ - #endif - #define __RADWIN__ - #define __RAD32__ - #else - #ifdef __WINDOWS_386__ - #define __RADWIN__ - #define __RADWINEXT__ - #define __RAD32__ - #define S64_DEFINED // turn off these types - #define U64_DEFINED - #define S64 double //should error - #define U64 double //should error - #else - #ifdef __WINDOWS__ - #define __RADWIN__ - #define __RAD16__ - #else - #ifdef WIN32 - #if defined(_XENON) || (_XBOX_VER == 200) - // Remember that Xenon also defines _XBOX - #define __RADXENON__ - #elif defined(_XBOX) - #define __RADXBOX__ - #else - #define __RADNT__ - #endif - #define __RADWIN__ - #define __RAD32__ - #endif - #endif - #endif - #endif - #endif - - #ifdef __WATCOMC__ - #define RADINLINE - #else - #define RADINLINE __inline - #endif - #endif - - #if defined __RADMAC__ || defined __RADIPHONE__ - #define __RADBSD__ - #endif - - #if defined __RADBSD__ || defined __RADLINUX__ - #define __RADPOSIX__ - #endif - - #if (!defined(__RADDOS__) && !defined(__RADWIN__) && !defined(__RADMAC__) && \ - !defined(__RADNGC__) && !defined(__RADNDS__) && !defined(__RADXBOX__) && \ - !defined(__RADXENON__) && !defined(__RADDURANGO__) && !defined(__RADPS4__) && !defined(__RADLINUX__) && !defined(__RADPS2__) && \ - !defined(__RADPSP__) && !defined(__RADPSP2__) && !defined(__RADPS3__) && !defined(__RADSPU__) && \ - !defined(__RADWII__) && !defined(__RADIPHONE__) && !defined(__RADX32__) && !defined(__RADARM__) && \ - !defined(__RADWIIU__) && !defined(__RADANDROID__) && !defined(__RADNACL__) && !defined (__RADQNX__) ) - #error "RAD.H did not detect your platform. Define DOS, WINDOWS, WIN32, macintosh, powerpc, or appropriate console." - #endif - - - #ifdef __RADFINAL__ - #define RADTODO(str) { char __str[0]=str; } - #else - #define RADTODO(str) - #endif - - #ifdef __RADX32__ - #if defined(_MSC_VER) - #define RADLINK __stdcall - #define RADEXPLINK __stdcall - #else - #define RADLINK __attribute__((stdcall)) - #define RADEXPLINK __attribute__((stdcall)) - #endif - #define RADEXPFUNC RADDEFFUNC - - #elif (defined(__RADNGC__) || defined(__RADWII__) || defined( __RADPS2__) || \ - defined(__RADPSP__) || defined(__RADPSP2__) || defined(__RADPS3__) || \ - defined(__RADSPU__) || defined(__RADNDS__) || defined(__RADIPHONE__) || \ - (defined(__RADARM__) && !defined(__RADWINRTAPI__)) || defined(__RADWIIU__) || defined(__RADPS4__) ) - - #define RADLINK - #define RADEXPLINK - #define RADEXPFUNC RADDEFFUNC - #define RADASMLINK - - #elif defined(__RADANDROID__) - #define RADLINK - #define RADEXPLINK - #define RADEXPFUNC RADDEFFUNC - #define RADASMLINK - #elif defined(__RADNACL__) - #define RADLINK - #define RADEXPLINK - #define RADEXPFUNC RADDEFFUNC - #define RADASMLINK - #elif defined(__RADLINUX__) || defined (__RADQNX__) - - #ifdef __RAD64__ - #define RADLINK - #define RADEXPLINK - #else - #define RADLINK __attribute__((cdecl)) - #define RADEXPLINK __attribute__((cdecl)) - #endif - - #define RADEXPFUNC RADDEFFUNC - #define RADASMLINK - - #elif defined(__RADMAC__) - - // this define is for CodeWarrior 11's stupid new libs (even though - // we don't use longlong's). - - #define __MSL_LONGLONG_SUPPORT__ - - #define RADLINK - #define RADEXPLINK - - #if defined(__CFM68K__) || defined(__MWERKS__) - #ifdef __RADINDLL__ - #define RADEXPFUNC RADDEFFUNC __declspec(export) - #else - #define RADEXPFUNC RADDEFFUNC __declspec(import) - #endif - #else - #if defined(__RADMACH__) && !defined(__MWERKS__) - #ifdef __RADINDLL__ - #define RADEXPFUNC RADDEFFUNC __attribute__((visibility("default"))) - #else - #define RADEXPFUNC RADDEFFUNC - #endif - #else - #define RADEXPFUNC RADDEFFUNC - #endif - #endif - #define RADASMLINK - - #else - - #ifdef __RADNT__ - #ifndef _WIN32 - #define _WIN32 - #endif - #ifndef WIN32 - #define WIN32 - #endif - #endif - - #ifdef __RADWIN__ - #ifdef __RAD32__ - - #ifdef __RADXBOX__ - - #define RADLINK __stdcall - #define RADEXPLINK __stdcall - #define RADEXPFUNC RADDEFFUNC - - #elif defined(__RADXENON__) || defined(__RADDURANGO__) - - #define RADLINK __stdcall - #define RADEXPLINK __stdcall - - #define RADEXPFUNC RADDEFFUNC - - #elif defined(__RADWINRTAPI__) - - #define RADLINK __stdcall - #define RADEXPLINK __stdcall - - #if ( defined(__RADINSTATICLIB__) || defined(__RADNOEXPORTS__ ) || ( defined(__RADNOEXEEXPORTS__) && ( !defined(__RADINDLL__) ) && ( !defined(__RADINSTATICLIB__) ) ) ) - #define RADEXPFUNC RADDEFFUNC - #else - #ifndef __RADINDLL__ - #define RADEXPFUNC RADDEFFUNC __declspec(dllimport) - #else - #define RADEXPFUNC RADDEFFUNC __declspec(dllexport) - #endif - #endif - - #elif defined(__RADNTBUILDLINUX__) - - #define RADLINK __cdecl - #define RADEXPLINK __cdecl - #define RADEXPFUNC RADDEFFUNC - - #else - #ifdef __RADNT__ - - #define RADLINK __stdcall - #define RADEXPLINK __stdcall - - #if ( defined(__RADINSTATICLIB__) || defined(__RADNOEXPORTS__ ) || ( defined(__RADNOEXEEXPORTS__) && ( !defined(__RADINDLL__) ) && ( !defined(__RADINSTATICLIB__) ) ) ) - #define RADEXPFUNC RADDEFFUNC - #else - #ifndef __RADINDLL__ - #define RADEXPFUNC RADDEFFUNC __declspec(dllimport) - #ifdef __BORLANDC__ - #if __BORLANDC__<=0x460 - #undef RADEXPFUNC - #define RADEXPFUNC RADDEFFUNC - #endif - #endif - #else - #define RADEXPFUNC RADDEFFUNC __declspec(dllexport) - #endif - #endif - #else - #define RADLINK __pascal - #define RADEXPLINK __far __pascal - #define RADEXPFUNC RADDEFFUNC - #endif - #endif - #else - #define RADLINK __pascal - #define RADEXPLINK __far __pascal __export - #define RADEXPFUNC RADDEFFUNC - #endif - #else - #define RADLINK __pascal - #define RADEXPLINK __pascal - #define RADEXPFUNC RADDEFFUNC - #endif - - #define RADASMLINK __cdecl - - #endif - - #if !defined(__RADXBOX__) && !defined(__RADXENON__) && !defined(__RADDURANGO__) && !defined(__RADXBOXONE__) - #ifdef __RADWIN__ - #ifndef _WINDOWS - #define _WINDOWS - #endif - #endif - #endif - - #ifdef __RADLITTLEENDIAN__ - #ifdef __RADBIGENDIAN__ - #error both endians !? - #endif - #endif - - #if !defined(__RADLITTLEENDIAN__) && !defined(__RADBIGENDIAN__) - #error neither endian! - #endif - - - //----------------------------------------------------------------- - - #ifndef RADDEFFUNC - - #ifdef __cplusplus - #define RADDEFFUNC extern "C" - #define RADDEFSTART extern "C" { - #define RADDEFEND } - #define RADDEFINEDATA extern "C" - #define RADDECLAREDATA extern "C" - #define RADDEFAULT( val ) =val - - #define RR_NAMESPACE rr - #define RR_NAMESPACE_START namespace RR_NAMESPACE { - #define RR_NAMESPACE_END }; - #define RR_NAMESPACE_USE using namespace RR_NAMESPACE; - - #else - #define RADDEFFUNC - #define RADDEFSTART - #define RADDEFEND - #define RADDEFINEDATA - #define RADDECLAREDATA extern - #define RADDEFAULT( val ) - - #define RR_NAMESPACE - #define RR_NAMESPACE_START - #define RR_NAMESPACE_END - #define RR_NAMESPACE_USE - - #endif - - #endif - - // probably s.b: RAD_DECLARE_ALIGNED(type, name, alignment) - #if (defined(__RADWII__) || defined(__RADWIIU__) || defined(__RADPSP__) || defined(__RADPSP2__) || \ - defined(__RADPS3__) || defined(__RADSPU__) || defined(__RADPS4__) || \ - defined(__RADLINUX__) || defined(__RADMAC__)) || defined(__RADNDS__) || defined(__RAD3DS__) || \ - defined(__RADIPHONE__) || defined(__RADANDROID__) || defined (__RADQNX__) - #define RAD_ALIGN(type,var,num) type __attribute__ ((aligned (num))) var - #elif (defined(__RADNGC__) || defined(__RADPS2__)) - #define RAD_ALIGN(type,var,num) __attribute__ ((aligned (num))) type var - #elif (defined(_MSC_VER) && (_MSC_VER >= 1300)) || defined(__RADWINRTAPI__) - #define RAD_ALIGN(type,var,num) type __declspec(align(num)) var - #else - // NOTE: / / is a guaranteed parse error in C/C++. - #define RAD_ALIGN(type,var,num) RAD_ALIGN_USED_BUT_NOT_DEFINED / / - #endif - - // WARNING : RAD_TLS should really only be used for debug/tools stuff - // it's not reliable because even if we are built as a lib, our lib can - // be put into a DLL and then it doesn't work - #if defined(__RADNT__) || defined(__RADXENON__) - #ifndef __RADINDLL__ - // note that you can't use this in windows DLLs - #define RAD_TLS(type,var) __declspec(thread) type var - #endif - #elif defined(__RADPS3__) || defined(__RADLINUX__) || defined(__RADMAC__) - // works on PS3/gcc I believe : - #define RAD_TLS(type,var) __thread type var - #else - // RAD_TLS not defined - #endif - - // Note that __RAD16__/__RAD32__/__RAD64__ refers to the size of a pointer. - // The size of integers is specified explicitly in the code, i.e. u32 or whatever. - - #define RAD_S8 signed char - #define RAD_U8 unsigned char - - #if defined(__RAD64__) - // Remember that __RAD32__ will also be defined! - #if defined(__RADX64__) - // x64 still has 32-bit ints! - #define RAD_U32 unsigned int - #define RAD_S32 signed int - // But pointers are 64 bits. - #if (_MSC_VER >= 1300 && defined(_Wp64) && _Wp64 ) - #define RAD_SINTa __w64 signed int64_t - #define RAD_UINTa __w64 unsigned int64_t - #else // non-vc.net compiler or /Wp64 turned off - #define RAD_UINTa unsigned long long - #define RAD_SINTa signed long long - #endif - #else - #error Unknown 64-bit processor (see radbase.h) - #endif - #elif defined(__RAD32__) - #define RAD_U32 unsigned int - #define RAD_S32 signed int - // Pointers are 32 bits. - - #if ( ( defined(_MSC_VER) && (_MSC_VER >= 1300 ) ) && ( defined(_Wp64) && ( _Wp64 ) ) ) - #define RAD_SINTa __w64 signed long - #define RAD_UINTa __w64 unsigned long - #else // non-vc.net compiler or /Wp64 turned off - #ifdef _Wp64 - #define RAD_SINTa signed long - #define RAD_UINTa unsigned long - #else - #define RAD_SINTa signed int - #define RAD_UINTa unsigned int - #endif - #endif - #else - #define RAD_U32 unsigned long - #define RAD_S32 signed long - // Pointers in 16-bit land are still 32 bits. - #define RAD_UINTa unsigned long - #define RAD_SINTa signed long - #endif - - #define RAD_F32 float - #if defined(__RADPS2__) || defined(__RADPSP__) - typedef RADSTRUCT RAD_F64 // do this so that we don't accidentally use doubles - { // while using the same space - RAD_U32 vals[ 2 ]; - } RAD_F64; - #define RAD_F64_OR_32 float // type is F64 if available, otherwise F32 - #else - #define RAD_F64 double - #define RAD_F64_OR_32 double // type is F64 if available, otherwise F32 - #endif - - #if (defined(__RADMAC__) || defined(__MRC__) || defined( __RADNGC__ ) || \ - defined(__RADLINUX__) || defined( __RADWII__ ) || defined(__RADWIIU__) || \ - defined(__RADNDS__) || defined(__RADPSP__) || defined(__RADPS3__) || defined(__RADPS4__) || \ - defined(__RADSPU__) || defined(__RADIPHONE__) || defined(__RADNACL__) || defined( __RADANDROID__) || defined( __RADQNX__ ) ) - #define RAD_U64 unsigned long long - #define RAD_S64 signed long long - #elif defined(__RADPS2__) - #define RAD_U64 unsigned long - #define RAD_S64 signed long - #elif defined(__RADARM__) - #define RAD_U64 unsigned long long - #define RAD_S64 signed long long - #elif defined(__RADX64__) || defined(__RAD32__) - #define RAD_U64 unsigned int64_t - #define RAD_S64 signed int64_t - #else - // 16-bit - typedef RADSTRUCT RAD_U64 // do this so that we don't accidentally use U64s - { // while using the same space - RAD_U32 vals[ 2 ]; - } RAD_U64; - typedef RADSTRUCT RAD_S64 // do this so that we don't accidentally use S64s - { // while using the same space - RAD_S32 vals[ 2 ]; - } RAD_S64; - #endif - - #if defined(__RAD32__) - #define PTR4 - #define RAD_U16 unsigned short - #define RAD_S16 signed short - #else - #define PTR4 __far - #define RAD_U16 unsigned int - #define RAD_S16 signed int - #endif - - //------------------------------------------------- - // RAD_PTRBITS and such defined here without using sizeof() - // so that they can be used in align() and other macros - - #ifdef __RAD64__ - - #define RAD_PTRBITS 64 - #define RAD_PTRBYTES 8 - #define RAD_TWOPTRBYTES 16 - - #else - - #define RAD_PTRBITS 32 - #define RAD_PTRBYTES 4 - #define RAD_TWOPTRBYTES 8 - - #endif - - - //------------------------------------------------- - // UINTr = int the size of a register - - #ifdef __RAD64REGS__ - - #define RAD_UINTr RAD_U64 - #define RAD_SINTr RAD_S64 - - #else - - #define RAD_UINTr RAD_U32 - #define RAD_SINTr RAD_S32 - - #endif - - //=========================================================================== - - /* - // CB : meh this is enough of a mess that it's probably best to just let each - #if defined(__RADX86__) && defined(_MSC_VER) && _MSC_VER >= 1300 - #define __RADX86INTRIN2003__ - #endif - */ - - // RADASSUME(expr) tells the compiler that expr is always true - // RADUNREACHABLE must never be reachable - even in event of error - // eg. it's okay for compiler to generate completely invalid code after RADUNREACHABLE - - #ifdef _MSC_VER - #define RADFORCEINLINE __forceinline - #if _MSC_VER >= 1300 - #define RADNOINLINE __declspec(noinline) - #else - #define RADNOINLINE - #endif - #define RADUNREACHABLE __assume(0) - #define RADASSUME(exp) __assume(exp) - #elif defined(__clang__) - #ifdef _DEBUG - #define RADFORCEINLINE inline - #else - #define RADFORCEINLINE inline __attribute((always_inline)) - #endif - #define RADNOINLINE __attribute__((noinline)) - - #define RADUNREACHABLE __builtin_unreachable() - - #if __has_builtin(__builtin_assume) - #define RADASSUME(exp) __builtin_assume(exp) - #else - #define RADASSUME(exp) RAD_STATEMENT_WRAPPER( if ( ! (exp) ) __builtin_unreachable(); ) - #endif - #elif (defined(__GCC__) || defined(__GNUC__)) || defined(ANDROID) - #ifdef _DEBUG - #define RADFORCEINLINE inline - #else - #define RADFORCEINLINE inline __attribute((always_inline)) - #endif - #define RADNOINLINE __attribute__((noinline)) - - #if __RAD_GCC_VERSION__ >= 40500 - #define RADUNREACHABLE __builtin_unreachable() - #define RADASSUME(exp) RAD_STATEMENT_WRAPPER( if ( ! (exp) ) __builtin_unreachable(); ) - #else - #define RADUNREACHABLE RAD_INFINITE_LOOP( RR_BREAK(); ) - #define RADASSUME(exp) - #endif - #elif defined(__CWCC__) - #define RADFORCEINLINE inline - #define RADNOINLINE __attribute__((never_inline)) - #define RADUNREACHABLE - #define RADASSUME(x) (void)0 - #else - // ? #define RADFORCEINLINE ? - #define RADFORCEINLINE inline - #define RADNOINLINE - #define RADASSUME(x) (void)0 - #endif - - //=========================================================================== - - // RAD_ALIGN_HINT tells the compiler how a given pointer is aligned - // it *must* be true, but the compiler may or may not use that information - // it is not for cases where the pointer is to an inherently aligned data type, - // it's when the compiler cannot tell the alignment but you have extra information. - // eg : - // U8 * ptr = rrMallocAligned(256,16); - // RAD_ALIGN_HINT(ptr,16,0); - - #ifdef __RADSPU__ - #define RAD_ALIGN_HINT(ptr,alignment,offset) __align_hint(ptr,alignment,offset); RR_ASSERT( ((UINTa)(ptr) & ((alignment)-1)) == (UINTa)(offset) ) - #else - #define RAD_ALIGN_HINT(ptr,alignment,offset) RADASSUME( ((UINTa)(ptr) & ((alignment)-1)) == (UINTa)(offset) ) - #endif - - //=========================================================================== - - // RAD_EXPECT is to tell the compiler the *likely* value of an expression - // different than RADASSUME in that expr might not have that value - // it's use for branch code layout and static branch prediction - // condition can technically be a variable but should usually be 0 or 1 - - #if (defined(__GCC__) || defined(__GNUC__)) || defined(__clang__) - - // __builtin_expect returns value of expr - #define RAD_EXPECT(expr,cond) __builtin_expect(expr,cond) - - #else - - #define RAD_EXPECT(expr,cond) (expr) - - #endif - - // helpers for doing an if ( ) with expect : - // if ( RAD_LIKELY(expr) ) { ... } - - #define RAD_LIKELY(expr) RAD_EXPECT(expr,1) - #define RAD_UNLIKELY(expr) RAD_EXPECT(expr,0) - - //=========================================================================== - - // __RADX86ASM__ means you can use __asm {} style inline assembly - #if defined(__RADX86__) && !defined(__RADX64__) && defined(_MSC_VER) - #define __RADX86ASM__ - #endif - - //------------------------------------------------- - // typedefs : - - #ifndef RADNOTYPEDEFS - - #ifndef S8_DEFINED - #define S8_DEFINED - typedef RAD_S8 S8; - #endif - - #ifndef U8_DEFINED - #define U8_DEFINED - typedef RAD_U8 U8; - #endif - - #ifndef S16_DEFINED - #define S16_DEFINED - typedef RAD_S16 S16; - #endif - - #ifndef U16_DEFINED - #define U16_DEFINED - typedef RAD_U16 U16; - #endif - - #ifndef S32_DEFINED - #define S32_DEFINED - typedef RAD_S32 S32; - #endif - - #ifndef U32_DEFINED - #define U32_DEFINED - typedef RAD_U32 U32; - #endif - - #ifndef S64_DEFINED - #define S64_DEFINED - typedef RAD_S64 S64; - #endif - - #ifndef U64_DEFINED - #define U64_DEFINED - typedef RAD_U64 U64; - #endif - - #ifndef F32_DEFINED - #define F32_DEFINED - typedef RAD_F32 F32; - #endif - - #ifndef F64_DEFINED - #define F64_DEFINED - typedef RAD_F64 F64; - #endif - - #ifndef F64_OR_32_DEFINED - #define F64_OR_32_DEFINED - typedef RAD_F64_OR_32 F64_OR_32; - #endif - - // UINTa and SINTa are the ints big enough for an address - - #ifndef SINTa_DEFINED - #define SINTa_DEFINED - typedef RAD_SINTa SINTa; - #endif - - #ifndef UINTa_DEFINED - #define UINTa_DEFINED - typedef RAD_UINTa UINTa; - #endif - - #ifndef UINTr_DEFINED - #define UINTr_DEFINED - typedef RAD_UINTr UINTr; - #endif - - #ifndef SINTr_DEFINED - #define SINTr_DEFINED - typedef RAD_SINTr SINTr; - #endif - - #elif !defined(RADNOTYPEDEFINES) - - #ifndef S8_DEFINED - #define S8_DEFINED - #define S8 RAD_S8 - #endif - - #ifndef U8_DEFINED - #define U8_DEFINED - #define U8 RAD_U8 - #endif - - #ifndef S16_DEFINED - #define S16_DEFINED - #define S16 RAD_S16 - #endif - - #ifndef U16_DEFINED - #define U16_DEFINED - #define U16 RAD_U16 - #endif - - #ifndef S32_DEFINED - #define S32_DEFINED - #define S32 RAD_S32 - #endif - - #ifndef U32_DEFINED - #define U32_DEFINED - #define U32 RAD_U32 - #endif - - #ifndef S64_DEFINED - #define S64_DEFINED - #define S64 RAD_S64 - #endif - - #ifndef U64_DEFINED - #define U64_DEFINED - #define U64 RAD_U64 - #endif - - #ifndef F32_DEFINED - #define F32_DEFINED - #define F32 RAD_F32 - #endif - - #ifndef F64_DEFINED - #define F64_DEFINED - #define F64 RAD_F64 - #endif - - #ifndef F64_OR_32_DEFINED - #define F64_OR_32_DEFINED - #define F64_OR_32 RAD_F64_OR_32 - #endif - - // UINTa and SINTa are the ints big enough for an address (pointer) - #ifndef SINTa_DEFINED - #define SINTa_DEFINED - #define SINTa RAD_SINTa - #endif - - #ifndef UINTa_DEFINED - #define UINTa_DEFINED - #define UINTa RAD_UINTa - #endif - - #ifndef UINTr_DEFINED - #define UINTr_DEFINED - #define UINTr RAD_UINTr - #endif - - #ifndef SINTr_DEFINED - #define SINTr_DEFINED - #define SINTr RAD_SINTr - #endif - - #endif - - /// Some error-checking. - #if defined(__RAD64__) && !defined(__RAD32__) - // See top of file for why this is. - #error __RAD64__ must not be defined without __RAD32__ (see radbase.h) - #endif +#define __RADNACL__ +#define __RAD32__ +#define __RADLITTLEENDIAN__ +#define __RADX86__ +#define RADINLINE inline +#define RADRESTRICT __restrict + +#undef RADSTRUCT +#define RADSTRUCT struct __attribute__((__packed__)) + +#elif defined(_DURANGO) || defined(_SEKRIT) || defined(_SEKRIT1) || \ + defined(_XBOX_ONE) + +#define __RADDURANGO__ 1 +#define __RADXBOXONE__ 1 +#if !defined(__RADSEKRIT__) // keep sekrit around for a bit for compat +#define __RADSEKRIT__ 1 +#endif + +#define __RADWIN__ +#define __RAD32__ +#define __RAD64__ +#define __RADX64__ +#define __RADMMX__ +#define __RADX86__ +#define __RAD64REGS__ +#define __RADLITTLEENDIAN__ +#define RADINLINE __inline +#define RADRESTRICT __restrict +#define __RADWINRTAPI__ + +#elif defined(__ORBIS__) + +#define __RADPS4__ +#if !defined(__RADSEKRIT2__) // keep sekrit2 around for a bit for compat +#define __RADSEKRIT2__ 1 +#endif +#define __RAD32__ +#define __RAD64__ +#define __RADX64__ +#define __RADMMX__ +#define __RADX86__ +#define __RAD64REGS__ +#define __RADLITTLEENDIAN__ +#define RADINLINE inline +#define RADRESTRICT __restrict + +#undef RADSTRUCT +#define RADSTRUCT struct __attribute__((__packed__)) + +#elif defined(WINAPI_FAMILY) && RAD_WINAPI_IS_APP + +#define __RADWINRTAPI__ +#define __RADWIN__ +#define RADINLINE __inline +#define RADRESTRICT __restrict + +#if defined(_M_IX86) // WinRT on x86 + +#define __RAD32__ +#define __RADX86__ +#define __RADMMX__ +#define __RADLITTLEENDIAN__ + +#elif defined(_M_X64) // WinRT on x64 +#define __RAD32__ +#define __RAD64__ +#define __RADX86__ +#define __RADX64__ +#define __RADMMX__ +#define __RAD64REGS__ +#define __RADLITTLEENDIAN__ + +#elif defined(_M_ARM) // WinRT on ARM + +#define __RAD32__ +#define __RADARM__ +#define __RADLITTLEENDIAN__ + +#else + +#error Unrecognized WinRT platform! + +#endif + +#elif defined(_WIN64) + +#define __RADWIN__ +#define __RADNT__ +// See note at top for why both __RAD32__ and __RAD64__ are defined. +#define __RAD32__ +#define __RAD64__ +#define __RADX64__ +#define __RADMMX__ +#define __RADX86__ +#define __RAD64REGS__ +#define __RADLITTLEENDIAN__ +#define RADINLINE __inline +#define RADRESTRICT __restrict + +#elif defined(GENERIC_ARM) + +#define __RAD32__ +#define __RADARM__ +#define __RADLITTLEENDIAN__ +#define __RADFIXEDPOINT__ +#define RADINLINE inline +#if (defined(__GCC__) || defined(__GNUC__)) +#define RADRESTRICT __restrict +#else +#define RADRESTRICT // __restrict not supported on cw +#endif +#undef RADSTRUCT +#define RADSTRUCT struct __attribute__((__packed__)) + +#elif defined(CAFE) // has to be before HOLLYWOOD_REV since it also defines it + +#define __RADWIIU__ +#define __RAD32__ +#define __RADPPC__ +#define __RADBIGENDIAN__ +#define RADINLINE inline +#define RADRESTRICT __restrict +#undef RADSTRUCT +#define RADSTRUCT struct __attribute__((__packed__)) + +#elif defined(HOLLYWOOD_REV) || defined(REVOLUTION) + +#define __RADWII__ +#define __RAD32__ +#define __RADPPC__ +#define __RADBIGENDIAN__ +#define RADINLINE inline +#define RADRESTRICT __restrict + +#elif defined(NN_PLATFORM_CTR) + +#define __RAD3DS__ +#define __RAD32__ +#define __RADARM__ +#define __RADLITTLEENDIAN__ +#define RADINLINE inline +#define RADRESTRICT +#undef RADSTRUCT +#define RADSTRUCT struct __attribute__((__packed__)) + +#elif defined(GEKKO) + +#define __RADNGC__ +#define __RAD32__ +#define __RADPPC__ +#define __RADBIGENDIAN__ +#define RADINLINE inline +#define RADRESTRICT // __restrict not supported on cw + +#elif defined(SDK_ARM9) || defined(SDK_TWL) || \ + (defined(__arm) && defined(__MWERKS__)) + +#define __RADNDS__ +#define __RAD32__ +#define __RADARM__ +#define __RADLITTLEENDIAN__ +#define __RADFIXEDPOINT__ +#define RADINLINE inline +#if (defined(__GCC__) || defined(__GNUC__)) +#define RADRESTRICT __restrict +#else +#define RADRESTRICT // __restrict not supported on cw +#endif + +#if defined(SDK_TWL) +#define __RADTWL__ +#endif + +#elif defined(R5900) + +#define __RADPS2__ +#define __RAD32__ +#define __RADMIPS__ +#define __RADLITTLEENDIAN__ +#define RADINLINE inline +#define RADRESTRICT __restrict +#define __RAD64REGS__ +#define U128 u_long128 + +#if !defined(__MWERKS__) +#undef RADSTRUCT +#define RADSTRUCT struct __attribute__((__packed__)) +#endif + +#elif defined(__psp__) + +#define __RADPSP__ +#define __RAD32__ +#define __RADMIPS__ +#define __RADLITTLEENDIAN__ +#define RADINLINE inline +#define RADRESTRICT __restrict + +#undef RADSTRUCT +#define RADSTRUCT struct __attribute__((__packed__)) + +#elif defined(__psp2__) + +#undef RADSTRUCT +#define RADSTRUCT struct __attribute__((__packed__)) + +#define __RADPSP2__ +#define __RAD32__ +#define __RADARM__ +#define __RADLITTLEENDIAN__ +#define RADINLINE inline +#define RADRESTRICT __restrict + +// need packed attribute for struct with snc? +#elif defined(__CELLOS_LV2__) + +// CB change : 10-29-10 : RAD64REGS on PPU but NOT SPU + +#ifdef __SPU__ +#define __RADSPU__ +#define __RAD32__ +#define __RADCELL__ +#define __RADBIGENDIAN__ +#define RADINLINE inline +#define RADRESTRICT __restrict +#else +#define __RAD64REGS__ +#define __RADPS3__ +#define __RADPPC__ +#define __RAD32__ +#define __RADCELL__ +#define __RADBIGENDIAN__ +#define RADINLINE inline +#define RADRESTRICT __restrict +#define __RADALTIVEC__ +#endif + +#undef RADSTRUCT +#define RADSTRUCT struct __attribute__((__packed__)) + +#ifndef __LP32__ +#error "PS3 32bit ABI support only" +#endif +#elif (defined(__MWERKS__) && !defined(__INTEL__)) || defined(__MRC__) || \ + defined(THINK_C) || defined(powerc) || defined(macintosh) || \ + defined(__powerc) || defined(__APPLE__) || defined(__MACH__) +#ifdef __APPLE__ +#include "TargetConditionals.h" +#endif + +#if ((defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) || \ + (defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR)) + +// iPhone/iPad/iOS +#define __RADIPHONE__ +#define __RADMACAPI__ + +#define __RAD32__ +#if defined(__x86_64__) +#define __RAD64__ +#endif + +#define __RADLITTLEENDIAN__ +#define RADINLINE inline +#define RADRESTRICT __restrict +#define __RADMACH__ + +#undef RADSTRUCT +#define RADSTRUCT struct __attribute__((__packed__)) + +#if defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR +#if defined(__x86_64__) +#define __RADX64__ +#else +#define __RADX86__ +#endif +#define __RADIPHONESIM__ +#elif defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE +#define __RADARM__ +#endif +#else + +// An actual MacOSX machine +#define __RADMAC__ +#define __RADMACAPI__ + +#if defined(powerc) || defined(__powerc) || defined(__ppc__) +#define __RADPPC__ +#define __RADBIGENDIAN__ +#define __RADALTIVEC__ +#define RADRESTRICT +#elif defined(__i386__) +#define __RADX86__ +#define __RADMMX__ +#define __RADLITTLEENDIAN__ +#define RADRESTRICT __restrict +#elif defined(__x86_64__) +#define __RAD32__ +#define __RAD64__ +#define __RADX86__ +#define __RADX64__ +#define __RAD64REGS__ +#define __RADMMX__ +#define __RADLITTLEENDIAN__ +#define RADRESTRICT __restrict +#else +#define __RAD68K__ +#define __RADBIGENDIAN__ +#define __RADALTIVEC__ +#define RADRESTRICT +#endif + +#define __RAD32__ + +#if defined(__MWERKS__) +#if (defined(__cplusplus) || !__option(only_std_keywords)) +#define RADINLINE inline +#endif +#ifdef __MACH__ +#define __RADMACH__ +#endif +#elif defined(__MRC__) +#if defined(__cplusplus) +#define RADINLINE inline +#endif +#elif defined(__GNUC__) || defined(__GNUG__) || defined(__MACH__) +#define RADINLINE inline +#define __RADMACH__ + +#undef RADRESTRICT /* could have been defined above... */ +#define RADRESTRICT __restrict + +#undef RADSTRUCT +#define RADSTRUCT struct __attribute__((__packed__)) +#endif + +#ifdef __RADX86__ +#ifndef __RADCARBON__ +#define __RADCARBON__ +#endif +#endif + +#ifdef TARGET_API_MAC_CARBON +#if TARGET_API_MAC_CARBON +#ifndef __RADCARBON__ +#define __RADCARBON__ +#endif +#endif +#endif +#endif +#elif defined(__linux__) + +#define __RADLINUX__ +#define __RADMMX__ +#define __RADLITTLEENDIAN__ +#define __RADX86__ +#ifdef __x86_64 +#define __RAD32__ +#define __RAD64__ +#define __RADX64__ +#define __RAD64REGS__ +#else +#define __RAD32__ +#endif +#define RADINLINE inline +#define RADRESTRICT __restrict + +#undef RADSTRUCT +#define RADSTRUCT struct __attribute__((__packed__)) + +#else + +#if _MSC_VER >= 1400 +#undef RADRESTRICT +#define RADRESTRICT __restrict +#else +#define RADRESTRICT +#define __RADNOVARARGMACROS__ +#endif + +#if defined(_XENON) || (defined(_XBOX_VER) && (_XBOX_VER == 200)) +// Remember that Xenon also defines _XBOX +#define __RADPPC__ +#define __RADBIGENDIAN__ +#define __RADALTIVEC__ +#else +#define __RADX86__ +#define __RADMMX__ +#define __RADLITTLEENDIAN__ +#endif + +#ifdef __MWERKS__ +#define _WIN32 +#endif + +#ifdef __DOS__ +#define __RADDOS__ +#define S64_DEFINED // turn off these types +#define U64_DEFINED +#define S64 double // should error +#define U64 double // should error +#define __RADNOVARARGMACROS__ +#endif + +#ifdef __386__ +#define __RAD32__ +#endif + +#ifdef _Windows // For Borland +#ifdef __WIN32__ +#define WIN32 +#else +#define __WINDOWS__ +#endif +#endif + +#ifdef _WINDOWS // For MS +#ifndef _WIN32 +#define __WINDOWS__ +#endif +#endif + +#ifdef _WIN32 +#if defined(_XENON) || (defined(_XBOX_VER) && (_XBOX_VER == 200)) +// Remember that Xenon also defines _XBOX +#define __RADXENON__ +#define __RAD64REGS__ +#elif defined(_XBOX) +#define __RADXBOX__ +#elif !defined(__RADWINRTAPI__) +#define __RADNT__ +#endif +#define __RADWIN__ +#define __RAD32__ +#else +#ifdef __NT__ +#if defined(_XENON) || (_XBOX_VER == 200) +// Remember that Xenon also defines _XBOX +#define __RADXENON__ +#define __RAD64REGS__ +#elif defined(_XBOX) +#define __RADXBOX__ +#else +#define __RADNT__ +#endif +#define __RADWIN__ +#define __RAD32__ +#else +#ifdef __WINDOWS_386__ +#define __RADWIN__ +#define __RADWINEXT__ +#define __RAD32__ +#define S64_DEFINED // turn off these types +#define U64_DEFINED +#define S64 double // should error +#define U64 double // should error +#else +#ifdef __WINDOWS__ +#define __RADWIN__ +#define __RAD16__ +#else +#ifdef WIN32 +#if defined(_XENON) || (_XBOX_VER == 200) +// Remember that Xenon also defines _XBOX +#define __RADXENON__ +#elif defined(_XBOX) +#define __RADXBOX__ +#else +#define __RADNT__ +#endif +#define __RADWIN__ +#define __RAD32__ +#endif +#endif +#endif +#endif +#endif + +#ifdef __WATCOMC__ +#define RADINLINE +#else +#define RADINLINE __inline +#endif +#endif + +#if defined __RADMAC__ || defined __RADIPHONE__ +#define __RADBSD__ +#endif + +#if defined __RADBSD__ || defined __RADLINUX__ +#define __RADPOSIX__ +#endif + +#if (!defined(__RADDOS__) && !defined(__RADWIN__) && !defined(__RADMAC__) && \ + !defined(__RADNGC__) && !defined(__RADNDS__) && !defined(__RADXBOX__) && \ + !defined(__RADXENON__) && !defined(__RADDURANGO__) && \ + !defined(__RADPS4__) && !defined(__RADLINUX__) && !defined(__RADPS2__) && \ + !defined(__RADPSP__) && !defined(__RADPSP2__) && !defined(__RADPS3__) && \ + !defined(__RADSPU__) && !defined(__RADWII__) && \ + !defined(__RADIPHONE__) && !defined(__RADX32__) && \ + !defined(__RADARM__) && !defined(__RADWIIU__) && \ + !defined(__RADANDROID__) && !defined(__RADNACL__) && \ + !defined(__RADQNX__)) +#error \ + "RAD.H did not detect your platform. Define DOS, WINDOWS, WIN32, macintosh, powerpc, or appropriate console." +#endif + +#ifdef __RADFINAL__ +#define RADTODO(str) \ + { char __str[0] = str; } +#else +#define RADTODO(str) +#endif + +#ifdef __RADX32__ +#if defined(_MSC_VER) +#define RADLINK __stdcall +#define RADEXPLINK __stdcall +#else +#define RADLINK __attribute__((stdcall)) +#define RADEXPLINK __attribute__((stdcall)) +#endif +#define RADEXPFUNC RADDEFFUNC + +#elif (defined(__RADNGC__) || defined(__RADWII__) || defined(__RADPS2__) || \ + defined(__RADPSP__) || defined(__RADPSP2__) || defined(__RADPS3__) || \ + defined(__RADSPU__) || defined(__RADNDS__) || defined(__RADIPHONE__) || \ + (defined(__RADARM__) && !defined(__RADWINRTAPI__)) || \ + defined(__RADWIIU__) || defined(__RADPS4__)) + +#define RADLINK +#define RADEXPLINK +#define RADEXPFUNC RADDEFFUNC +#define RADASMLINK + +#elif defined(__RADANDROID__) +#define RADLINK +#define RADEXPLINK +#define RADEXPFUNC RADDEFFUNC +#define RADASMLINK +#elif defined(__RADNACL__) +#define RADLINK +#define RADEXPLINK +#define RADEXPFUNC RADDEFFUNC +#define RADASMLINK +#elif defined(__RADLINUX__) || defined(__RADQNX__) + +#ifdef __RAD64__ +#define RADLINK +#define RADEXPLINK +#else +#define RADLINK __attribute__((cdecl)) +#define RADEXPLINK __attribute__((cdecl)) +#endif + +#define RADEXPFUNC RADDEFFUNC +#define RADASMLINK + +#elif defined(__RADMAC__) + +// this define is for CodeWarrior 11's stupid new libs (even though +// we don't use longlong's). + +#define __MSL_LONGLONG_SUPPORT__ + +#define RADLINK +#define RADEXPLINK + +#if defined(__CFM68K__) || defined(__MWERKS__) +#ifdef __RADINDLL__ +#define RADEXPFUNC RADDEFFUNC __declspec(export) +#else +#define RADEXPFUNC RADDEFFUNC __declspec(import) +#endif +#else +#if defined(__RADMACH__) && !defined(__MWERKS__) +#ifdef __RADINDLL__ +#define RADEXPFUNC RADDEFFUNC __attribute__((visibility("default"))) +#else +#define RADEXPFUNC RADDEFFUNC +#endif +#else +#define RADEXPFUNC RADDEFFUNC +#endif +#endif +#define RADASMLINK + +#else + +#ifdef __RADNT__ +#ifndef _WIN32 +#define _WIN32 +#endif +#ifndef WIN32 +#define WIN32 +#endif +#endif + +#ifdef __RADWIN__ +#ifdef __RAD32__ + +#ifdef __RADXBOX__ + +#define RADLINK __stdcall +#define RADEXPLINK __stdcall +#define RADEXPFUNC RADDEFFUNC + +#elif defined(__RADXENON__) || defined(__RADDURANGO__) + +#define RADLINK __stdcall +#define RADEXPLINK __stdcall + +#define RADEXPFUNC RADDEFFUNC + +#elif defined(__RADWINRTAPI__) + +#define RADLINK __stdcall +#define RADEXPLINK __stdcall + +#if (defined(__RADINSTATICLIB__) || defined(__RADNOEXPORTS__) || \ + (defined(__RADNOEXEEXPORTS__) && (!defined(__RADINDLL__)) && \ + (!defined(__RADINSTATICLIB__)))) +#define RADEXPFUNC RADDEFFUNC +#else +#ifndef __RADINDLL__ +#define RADEXPFUNC RADDEFFUNC __declspec(dllimport) +#else +#define RADEXPFUNC RADDEFFUNC __declspec(dllexport) +#endif +#endif + +#elif defined(__RADNTBUILDLINUX__) + +#define RADLINK __cdecl +#define RADEXPLINK __cdecl +#define RADEXPFUNC RADDEFFUNC + +#else +#ifdef __RADNT__ + +#define RADLINK __stdcall +#define RADEXPLINK __stdcall + +#if (defined(__RADINSTATICLIB__) || defined(__RADNOEXPORTS__) || \ + (defined(__RADNOEXEEXPORTS__) && (!defined(__RADINDLL__)) && \ + (!defined(__RADINSTATICLIB__)))) +#define RADEXPFUNC RADDEFFUNC +#else +#ifndef __RADINDLL__ +#define RADEXPFUNC RADDEFFUNC __declspec(dllimport) +#ifdef __BORLANDC__ +#if __BORLANDC__ <= 0x460 +#undef RADEXPFUNC +#define RADEXPFUNC RADDEFFUNC +#endif +#endif +#else +#define RADEXPFUNC RADDEFFUNC __declspec(dllexport) +#endif +#endif +#else +#define RADLINK __pascal +#define RADEXPLINK __far __pascal +#define RADEXPFUNC RADDEFFUNC +#endif +#endif +#else +#define RADLINK __pascal +#define RADEXPLINK __far __pascal __export +#define RADEXPFUNC RADDEFFUNC +#endif +#else +#define RADLINK __pascal +#define RADEXPLINK __pascal +#define RADEXPFUNC RADDEFFUNC +#endif + +#define RADASMLINK __cdecl + +#endif + +#if !defined(__RADXBOX__) && !defined(__RADXENON__) && \ + !defined(__RADDURANGO__) && !defined(__RADXBOXONE__) +#ifdef __RADWIN__ +#ifndef _WINDOWS +#define _WINDOWS +#endif +#endif +#endif + +#ifdef __RADLITTLEENDIAN__ +#ifdef __RADBIGENDIAN__ +#error both endians !? +#endif +#endif + +#if !defined(__RADLITTLEENDIAN__) && !defined(__RADBIGENDIAN__) +#error neither endian! +#endif + +//----------------------------------------------------------------- + +#ifndef RADDEFFUNC + +#ifdef __cplusplus +#define RADDEFFUNC extern "C" +#define RADDEFSTART extern "C" { +#define RADDEFEND } +#define RADDEFINEDATA extern "C" +#define RADDECLAREDATA extern "C" +#define RADDEFAULT(val) = val + +#define RR_NAMESPACE rr +#define RR_NAMESPACE_START namespace RR_NAMESPACE { +#define RR_NAMESPACE_END \ + } \ + ; +#define RR_NAMESPACE_USE using namespace RR_NAMESPACE; + +#else +#define RADDEFFUNC +#define RADDEFSTART +#define RADDEFEND +#define RADDEFINEDATA +#define RADDECLAREDATA extern +#define RADDEFAULT(val) + +#define RR_NAMESPACE +#define RR_NAMESPACE_START +#define RR_NAMESPACE_END +#define RR_NAMESPACE_USE + +#endif + +#endif + +// probably s.b: RAD_DECLARE_ALIGNED(type, name, alignment) +#if (defined(__RADWII__) || defined(__RADWIIU__) || defined(__RADPSP__) || \ + defined(__RADPSP2__) || defined(__RADPS3__) || defined(__RADSPU__) || \ + defined(__RADPS4__) || defined(__RADLINUX__) || defined(__RADMAC__)) || \ + defined(__RADNDS__) || defined(__RAD3DS__) || defined(__RADIPHONE__) || \ + defined(__RADANDROID__) || defined(__RADQNX__) +#define RAD_ALIGN(type, var, num) type __attribute__((aligned(num))) var +#elif (defined(__RADNGC__) || defined(__RADPS2__)) +#define RAD_ALIGN(type, var, num) __attribute__((aligned(num))) type var +#elif (defined(_MSC_VER) && (_MSC_VER >= 1300)) || defined(__RADWINRTAPI__) +#define RAD_ALIGN(type, var, num) type __declspec(align(num)) var +#else +// NOTE: / / is a guaranteed parse error in C/C++. +#define RAD_ALIGN(type, var, num) RAD_ALIGN_USED_BUT_NOT_DEFINED / / +#endif + +// WARNING : RAD_TLS should really only be used for debug/tools stuff +// it's not reliable because even if we are built as a lib, our lib can +// be put into a DLL and then it doesn't work +#if defined(__RADNT__) || defined(__RADXENON__) +#ifndef __RADINDLL__ +// note that you can't use this in windows DLLs +#define RAD_TLS(type, var) __declspec(thread) type var +#endif +#elif defined(__RADPS3__) || defined(__RADLINUX__) || defined(__RADMAC__) +// works on PS3/gcc I believe : +#define RAD_TLS(type, var) __thread type var +#else +// RAD_TLS not defined +#endif + +// Note that __RAD16__/__RAD32__/__RAD64__ refers to the size of a pointer. +// The size of integers is specified explicitly in the code, i.e. u32 or +// whatever. + +#define RAD_S8 signed char +#define RAD_U8 unsigned char + +#if defined(__RAD64__) +// Remember that __RAD32__ will also be defined! +#if defined(__RADX64__) +// x64 still has 32-bit ints! +#define RAD_U32 unsigned int +#define RAD_S32 signed int +// But pointers are 64 bits. +#if (_MSC_VER >= 1300 && defined(_Wp64) && _Wp64) +#define RAD_SINTa __w64 signed int64_t +#define RAD_UINTa __w64 unsigned int64_t +#else // non-vc.net compiler or /Wp64 turned off +#define RAD_UINTa unsigned long long +#define RAD_SINTa signed long long +#endif +#else +#error Unknown 64-bit processor (see radbase.h) +#endif +#elif defined(__RAD32__) +#define RAD_U32 unsigned int +#define RAD_S32 signed int +// Pointers are 32 bits. + +#if ((defined(_MSC_VER) && (_MSC_VER >= 1300)) && (defined(_Wp64) && (_Wp64))) +#define RAD_SINTa __w64 signed long +#define RAD_UINTa __w64 unsigned long +#else // non-vc.net compiler or /Wp64 turned off +#ifdef _Wp64 +#define RAD_SINTa signed long +#define RAD_UINTa unsigned long +#else +#define RAD_SINTa signed int +#define RAD_UINTa unsigned int +#endif +#endif +#else +#define RAD_U32 unsigned long +#define RAD_S32 signed long +// Pointers in 16-bit land are still 32 bits. +#define RAD_UINTa unsigned long +#define RAD_SINTa signed long +#endif + +#define RAD_F32 float +#if defined(__RADPS2__) || defined(__RADPSP__) +typedef RADSTRUCT RAD_F64 // do this so that we don't accidentally use doubles +{ // while using the same space + RAD_U32 vals[2]; +} +RAD_F64; +#define RAD_F64_OR_32 float // type is F64 if available, otherwise F32 +#else +#define RAD_F64 double +#define RAD_F64_OR_32 double // type is F64 if available, otherwise F32 +#endif + +#if (defined(__RADMAC__) || defined(__MRC__) || defined(__RADNGC__) || \ + defined(__RADLINUX__) || defined(__RADWII__) || defined(__RADWIIU__) || \ + defined(__RADNDS__) || defined(__RADPSP__) || defined(__RADPS3__) || \ + defined(__RADPS4__) || defined(__RADSPU__) || defined(__RADIPHONE__) || \ + defined(__RADNACL__) || defined(__RADANDROID__) || defined(__RADQNX__)) +#define RAD_U64 unsigned long long +#define RAD_S64 signed long long +#elif defined(__RADPS2__) +#define RAD_U64 unsigned long +#define RAD_S64 signed long +#elif defined(__RADARM__) +#define RAD_U64 unsigned long long +#define RAD_S64 signed long long +#elif defined(__RADX64__) || defined(__RAD32__) +#define RAD_U64 unsigned int64_t +#define RAD_S64 signed int64_t +#else +// 16-bit +typedef RADSTRUCT RAD_U64 // do this so that we don't accidentally use U64s +{ // while using the same space + RAD_U32 vals[2]; +} +RAD_U64; +typedef RADSTRUCT RAD_S64 // do this so that we don't accidentally use S64s +{ // while using the same space + RAD_S32 vals[2]; +} +RAD_S64; +#endif + +#if defined(__RAD32__) +#define PTR4 +#define RAD_U16 unsigned short +#define RAD_S16 signed short +#else +#define PTR4 __far +#define RAD_U16 unsigned int +#define RAD_S16 signed int +#endif + +//------------------------------------------------- +// RAD_PTRBITS and such defined here without using sizeof() +// so that they can be used in align() and other macros + +#ifdef __RAD64__ + +#define RAD_PTRBITS 64 +#define RAD_PTRBYTES 8 +#define RAD_TWOPTRBYTES 16 + +#else + +#define RAD_PTRBITS 32 +#define RAD_PTRBYTES 4 +#define RAD_TWOPTRBYTES 8 + +#endif + +//------------------------------------------------- +// UINTr = int the size of a register + +#ifdef __RAD64REGS__ + +#define RAD_UINTr RAD_U64 +#define RAD_SINTr RAD_S64 + +#else + +#define RAD_UINTr RAD_U32 +#define RAD_SINTr RAD_S32 + +#endif + +//=========================================================================== + +/* +// CB : meh this is enough of a mess that it's probably best to just let each +#if defined(__RADX86__) && defined(_MSC_VER) && _MSC_VER >= 1300 + #define __RADX86INTRIN2003__ +#endif +*/ + +// RADASSUME(expr) tells the compiler that expr is always true +// RADUNREACHABLE must never be reachable - even in event of error +// eg. it's okay for compiler to generate completely invalid code after +// RADUNREACHABLE #ifdef _MSC_VER - // microsoft compilers - - #if _MSC_VER >= 1400 - #define RAD_STATEMENT_START \ - do { - - #define RAD_STATEMENT_END_FALSE \ - __pragma(warning(push)) \ - __pragma(warning(disable:4127)) \ - } while(0) \ - __pragma(warning(pop)) - - #define RAD_STATEMENT_END_TRUE \ - __pragma(warning(push)) \ - __pragma(warning(disable:4127)) \ - } while(1) \ - __pragma(warning(pop)) - - #else - #define RAD_USE_STANDARD_LOOP_CONSTRUCT - #endif +#define RADFORCEINLINE __forceinline +#if _MSC_VER >= 1300 +#define RADNOINLINE __declspec(noinline) #else - #define RAD_USE_STANDARD_LOOP_CONSTRUCT +#define RADNOINLINE +#endif +#define RADUNREACHABLE __assume(0) +#define RADASSUME(exp) __assume(exp) +#elif defined(__clang__) +#ifdef _DEBUG +#define RADFORCEINLINE inline +#else +#define RADFORCEINLINE inline __attribute((always_inline)) +#endif +#define RADNOINLINE __attribute__((noinline)) + +#define RADUNREACHABLE __builtin_unreachable() + +#if __has_builtin(__builtin_assume) +#define RADASSUME(exp) __builtin_assume(exp) +#else +#define RADASSUME(exp) \ + RAD_STATEMENT_WRAPPER(if (!(exp)) __builtin_unreachable();) +#endif +#elif (defined(__GCC__) || defined(__GNUC__)) || defined(ANDROID) +#ifdef _DEBUG +#define RADFORCEINLINE inline +#else +#define RADFORCEINLINE inline __attribute((always_inline)) +#endif +#define RADNOINLINE __attribute__((noinline)) + +#if __RAD_GCC_VERSION__ >= 40500 +#define RADUNREACHABLE __builtin_unreachable() +#define RADASSUME(exp) \ + RAD_STATEMENT_WRAPPER(if (!(exp)) __builtin_unreachable();) +#else +#define RADUNREACHABLE RAD_INFINITE_LOOP(RR_BREAK();) +#define RADASSUME(exp) +#endif +#elif defined(__CWCC__) +#define RADFORCEINLINE inline +#define RADNOINLINE __attribute__((never_inline)) +#define RADUNREACHABLE +#define RADASSUME(x) (void)0 +#else +// ? #define RADFORCEINLINE ? +#define RADFORCEINLINE inline +#define RADNOINLINE +#define RADASSUME(x) (void)0 +#endif + +//=========================================================================== + +// RAD_ALIGN_HINT tells the compiler how a given pointer is aligned +// it *must* be true, but the compiler may or may not use that information +// it is not for cases where the pointer is to an inherently aligned data type, +// it's when the compiler cannot tell the alignment but you have extra +// information. +// eg : +// U8 * ptr = rrMallocAligned(256,16); +// RAD_ALIGN_HINT(ptr,16,0); + +#ifdef __RADSPU__ +#define RAD_ALIGN_HINT(ptr, alignment, offset) \ + __align_hint(ptr, alignment, offset); \ + RR_ASSERT(((UINTa)(ptr) & ((alignment) - 1)) == (UINTa)(offset)) +#else +#define RAD_ALIGN_HINT(ptr, alignment, offset) \ + RADASSUME(((UINTa)(ptr) & ((alignment) - 1)) == (UINTa)(offset)) +#endif + +//=========================================================================== + +// RAD_EXPECT is to tell the compiler the *likely* value of an expression +// different than RADASSUME in that expr might not have that value +// it's use for branch code layout and static branch prediction +// condition can technically be a variable but should usually be 0 or 1 + +#if (defined(__GCC__) || defined(__GNUC__)) || defined(__clang__) + +// __builtin_expect returns value of expr +#define RAD_EXPECT(expr, cond) __builtin_expect(expr, cond) + +#else + +#define RAD_EXPECT(expr, cond) (expr) + +#endif + +// helpers for doing an if ( ) with expect : +// if ( RAD_LIKELY(expr) ) { ... } + +#define RAD_LIKELY(expr) RAD_EXPECT(expr, 1) +#define RAD_UNLIKELY(expr) RAD_EXPECT(expr, 0) + +//=========================================================================== + +// __RADX86ASM__ means you can use __asm {} style inline assembly +#if defined(__RADX86__) && !defined(__RADX64__) && defined(_MSC_VER) +#define __RADX86ASM__ +#endif + +//------------------------------------------------- +// typedefs : + +#ifndef RADNOTYPEDEFS + +#ifndef S8_DEFINED +#define S8_DEFINED +typedef RAD_S8 S8; +#endif + +#ifndef U8_DEFINED +#define U8_DEFINED +typedef RAD_U8 U8; +#endif + +#ifndef S16_DEFINED +#define S16_DEFINED +typedef RAD_S16 S16; +#endif + +#ifndef U16_DEFINED +#define U16_DEFINED +typedef RAD_U16 U16; +#endif + +#ifndef S32_DEFINED +#define S32_DEFINED +typedef RAD_S32 S32; +#endif + +#ifndef U32_DEFINED +#define U32_DEFINED +typedef RAD_U32 U32; +#endif + +#ifndef S64_DEFINED +#define S64_DEFINED +typedef RAD_S64 S64; +#endif + +#ifndef U64_DEFINED +#define U64_DEFINED +typedef RAD_U64 U64; +#endif + +#ifndef F32_DEFINED +#define F32_DEFINED +typedef RAD_F32 F32; +#endif + +#ifndef F64_DEFINED +#define F64_DEFINED +typedef RAD_F64 F64; +#endif + +#ifndef F64_OR_32_DEFINED +#define F64_OR_32_DEFINED +typedef RAD_F64_OR_32 F64_OR_32; +#endif + +// UINTa and SINTa are the ints big enough for an address + +#ifndef SINTa_DEFINED +#define SINTa_DEFINED +typedef RAD_SINTa SINTa; +#endif + +#ifndef UINTa_DEFINED +#define UINTa_DEFINED +typedef RAD_UINTa UINTa; +#endif + +#ifndef UINTr_DEFINED +#define UINTr_DEFINED +typedef RAD_UINTr UINTr; +#endif + +#ifndef SINTr_DEFINED +#define SINTr_DEFINED +typedef RAD_SINTr SINTr; +#endif + +#elif !defined(RADNOTYPEDEFINES) + +#ifndef S8_DEFINED +#define S8_DEFINED +#define S8 RAD_S8 +#endif + +#ifndef U8_DEFINED +#define U8_DEFINED +#define U8 RAD_U8 +#endif + +#ifndef S16_DEFINED +#define S16_DEFINED +#define S16 RAD_S16 +#endif + +#ifndef U16_DEFINED +#define U16_DEFINED +#define U16 RAD_U16 +#endif + +#ifndef S32_DEFINED +#define S32_DEFINED +#define S32 RAD_S32 +#endif + +#ifndef U32_DEFINED +#define U32_DEFINED +#define U32 RAD_U32 +#endif + +#ifndef S64_DEFINED +#define S64_DEFINED +#define S64 RAD_S64 +#endif + +#ifndef U64_DEFINED +#define U64_DEFINED +#define U64 RAD_U64 +#endif + +#ifndef F32_DEFINED +#define F32_DEFINED +#define F32 RAD_F32 +#endif + +#ifndef F64_DEFINED +#define F64_DEFINED +#define F64 RAD_F64 +#endif + +#ifndef F64_OR_32_DEFINED +#define F64_OR_32_DEFINED +#define F64_OR_32 RAD_F64_OR_32 +#endif + +// UINTa and SINTa are the ints big enough for an address (pointer) +#ifndef SINTa_DEFINED +#define SINTa_DEFINED +#define SINTa RAD_SINTa +#endif + +#ifndef UINTa_DEFINED +#define UINTa_DEFINED +#define UINTa RAD_UINTa +#endif + +#ifndef UINTr_DEFINED +#define UINTr_DEFINED +#define UINTr RAD_UINTr +#endif + +#ifndef SINTr_DEFINED +#define SINTr_DEFINED +#define SINTr RAD_SINTr +#endif + +#endif + +/// Some error-checking. +#if defined(__RAD64__) && !defined(__RAD32__) +// See top of file for why this is. +#error __RAD64__ must not be defined without __RAD32__ (see radbase.h) +#endif + +#ifdef _MSC_VER +// microsoft compilers + +#if _MSC_VER >= 1400 +#define RAD_STATEMENT_START do { +#define RAD_STATEMENT_END_FALSE \ + __pragma(warning(push)) __pragma(warning(disable : 4127)) \ + } \ + while (0) __pragma(warning(pop)) + +#define RAD_STATEMENT_END_TRUE \ + __pragma(warning(push)) __pragma(warning(disable : 4127)) \ + } \ + while (1) __pragma(warning(pop)) + +#else +#define RAD_USE_STANDARD_LOOP_CONSTRUCT +#endif +#else +#define RAD_USE_STANDARD_LOOP_CONSTRUCT #endif #ifdef RAD_USE_STANDARD_LOOP_CONSTRUCT - #define RAD_STATEMENT_START \ - do { +#define RAD_STATEMENT_START do { +#define RAD_STATEMENT_END_FALSE \ + } \ + while ((void)0, 0) - #define RAD_STATEMENT_END_FALSE \ - } while ( (void)0,0 ) - - #define RAD_STATEMENT_END_TRUE \ - } while ( (void)1,1 ) +#define RAD_STATEMENT_END_TRUE \ + } \ + while ((void)1, 1) #endif -#define RAD_STATEMENT_WRAPPER( code ) \ - RAD_STATEMENT_START \ - code \ - RAD_STATEMENT_END_FALSE - -#define RAD_INFINITE_LOOP( code ) \ - RAD_STATEMENT_START \ - code \ - RAD_STATEMENT_END_TRUE +#define RAD_STATEMENT_WRAPPER(code) \ + RAD_STATEMENT_START \ + code RAD_STATEMENT_END_FALSE +#define RAD_INFINITE_LOOP(code) \ + RAD_STATEMENT_START \ + code RAD_STATEMENT_END_TRUE // Must be placed after variable declarations for code compiled as .c -#if defined(_MSC_VER) && _MSC_VER >= 1700 // in 2012 aka 11.0 and later -# define RR_UNUSED_VARIABLE(x) (void) x +#if defined(_MSC_VER) && _MSC_VER >= 1700 // in 2012 aka 11.0 and later +#define RR_UNUSED_VARIABLE(x) (void)x #else -# define RR_UNUSED_VARIABLE(x) (void)(sizeof(x)) +#define RR_UNUSED_VARIABLE(x) (void)(sizeof(x)) #endif //----------------------------------------------- @@ -1384,31 +1409,33 @@ #define RR_UINT3264 U32 #endif -//RR_COMPILER_ASSERT( sizeof(RR_UINT3264) == sizeof(UINTa) ); +// RR_COMPILER_ASSERT( sizeof(RR_UINT3264) == sizeof(UINTa) ); //-------------------------------------------------- // RR_LINESTRING is the current line number as a string -#define RR_STRINGIZE( L ) #L -#define RR_DO_MACRO( M, X ) M(X) -#define RR_STRINGIZE_DELAY( X ) RR_DO_MACRO( RR_STRINGIZE, X ) -#define RR_LINESTRING RR_STRINGIZE_DELAY( __LINE__ ) +#define RR_STRINGIZE(L) #L +#define RR_DO_MACRO(M, X) M(X) +#define RR_STRINGIZE_DELAY(X) RR_DO_MACRO(RR_STRINGIZE, X) +#define RR_LINESTRING RR_STRINGIZE_DELAY(__LINE__) -#define RR_CAT(X,Y) X ## Y +#define RR_CAT(X, Y) X##Y // RR_STRING_JOIN joins strings in the preprocessor and works with LINESTRING -#define RR_STRING_JOIN(arg1, arg2) RR_STRING_JOIN_DELAY(arg1, arg2) -#define RR_STRING_JOIN_DELAY(arg1, arg2) RR_STRING_JOIN_IMMEDIATE(arg1, arg2) -#define RR_STRING_JOIN_IMMEDIATE(arg1, arg2) arg1 ## arg2 +#define RR_STRING_JOIN(arg1, arg2) RR_STRING_JOIN_DELAY(arg1, arg2) +#define RR_STRING_JOIN_DELAY(arg1, arg2) RR_STRING_JOIN_IMMEDIATE(arg1, arg2) +#define RR_STRING_JOIN_IMMEDIATE(arg1, arg2) arg1##arg2 -// RR_NUMBERNAME is a macro to make a name unique, so that you can use it to declare +// RR_NUMBERNAME is a macro to make a name unique, so that you can use it to +// declare // variable names and they won't conflict with each other -// using __LINE__ is broken in MSVC with /ZI , but __COUNTER__ is an MSVC extension that works +// using __LINE__ is broken in MSVC with /ZI , but __COUNTER__ is an MSVC +// extension that works #ifdef _MSC_VER - #define RR_NUMBERNAME(name) RR_STRING_JOIN(name,__COUNTER__) +#define RR_NUMBERNAME(name) RR_STRING_JOIN(name, __COUNTER__) #else - #define RR_NUMBERNAME(name) RR_STRING_JOIN(name,__LINE__) +#define RR_NUMBERNAME(name) RR_STRING_JOIN(name, __LINE__) #endif //-------------------------------------------------- @@ -1418,112 +1445,125 @@ // then the rrbool must be set to exactly "1" not just "not zero" !! #ifndef RADNOTYPEDEFS - #ifndef RRBOOL_DEFINED - #define RRBOOL_DEFINED - typedef S32 rrbool; - typedef S32 RRBOOL; - #endif +#ifndef RRBOOL_DEFINED +#define RRBOOL_DEFINED +typedef S32 rrbool; +typedef S32 RRBOOL; +#endif #elif !defined(RADNOTYPEDEFINES) - #ifndef RRBOOL_DEFINED - #define RRBOOL_DEFINED - #define rrbool S32 - #define RRBOOL S32 - #endif +#ifndef RRBOOL_DEFINED +#define RRBOOL_DEFINED +#define rrbool S32 +#define RRBOOL S32 +#endif #endif //-------------------------------------------------- // Range macros - #ifndef RR_MIN - #define RR_MIN(a,b) ( (a) < (b) ? (a) : (b) ) - #endif +#ifndef RR_MIN +#define RR_MIN(a, b) ((a) < (b) ? (a) : (b)) +#endif - #ifndef RR_MAX - #define RR_MAX(a,b) ( (a) > (b) ? (a) : (b) ) - #endif +#ifndef RR_MAX +#define RR_MAX(a, b) ((a) > (b) ? (a) : (b)) +#endif - #ifndef RR_ABS - #define RR_ABS(a) ( ((a) < 0) ? -(a) : (a) ) - #endif +#ifndef RR_ABS +#define RR_ABS(a) (((a) < 0) ? -(a) : (a)) +#endif - #ifndef RR_CLAMP - #define RR_CLAMP(val,lo,hi) RR_MAX( RR_MIN(val,hi), lo ) - #endif +#ifndef RR_CLAMP +#define RR_CLAMP(val, lo, hi) RR_MAX(RR_MIN(val, hi), lo) +#endif //-------------------------------------------------- // Data layout macros - #define RR_ARRAY_SIZE(array) ( sizeof(array)/sizeof(array[0]) ) +#define RR_ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0])) - // MEMBER_OFFSET tells you the offset of a member in a type - #ifdef __RAD3DS__ - #define RR_MEMBER_OFFSET(type,member) (unsigned int)(( (char *) &(((type *)0)->member) - (char *) 0 )) - #elif defined(__RADANDROID__) || defined(__RADPSP__) || defined(__RADPS3__) || defined(__RADSPU__) - // offsetof() gets mucked with by system headers on android, making things dependent on #include order. - #define RR_MEMBER_OFFSET(type,member) __builtin_offsetof(type, member) - #elif defined(__RADLINUX__) - #define RR_MEMBER_OFFSET(type,member) (offsetof(type, member)) - #else - #define RR_MEMBER_OFFSET(type,member) ( (size_t) (UINTa) &(((type *)0)->member) ) - #endif +// MEMBER_OFFSET tells you the offset of a member in a type +#ifdef __RAD3DS__ +#define RR_MEMBER_OFFSET(type, member) \ + (unsigned int)(((char *)&(((type *)0)->member) - (char *)0)) +#elif defined(__RADANDROID__) || defined(__RADPSP__) || defined(__RADPS3__) || \ + defined(__RADSPU__) +// offsetof() gets mucked with by system headers on android, making things +// dependent on #include order. +#define RR_MEMBER_OFFSET(type, member) __builtin_offsetof(type, member) +#elif defined(__RADLINUX__) +#define RR_MEMBER_OFFSET(type, member) (offsetof(type, member)) +#else +#define RR_MEMBER_OFFSET(type, member) ((size_t)(UINTa) & (((type *)0)->member)) +#endif - // MEMBER_SIZE tells you the size of a member in a type - #define RR_MEMBER_SIZE(type,member) ( sizeof( ((type *) 0)->member) ) +// MEMBER_SIZE tells you the size of a member in a type +#define RR_MEMBER_SIZE(type, member) (sizeof(((type *)0)->member)) - // just to make gcc shut up about derefing null : - #define RR_MEMBER_OFFSET_PTR(type,member,ptr) ( (SINTa) &(((type *)(ptr))->member) - (SINTa)(ptr) ) - #define RR_MEMBER_SIZE_PTR(type,member,ptr) ( sizeof( ((type *) (ptr))->member) ) - - // MEMBER_TO_OWNER takes a pointer to a member and gives you back the base of the object - // you should then RR_ASSERT( &(ret->member) == ptr ); - #define RR_MEMBER_TO_OWNER(type,member,ptr) (type *)( ((char *)(ptr)) - RR_MEMBER_OFFSET_PTR(type,member,ptr) ) +// just to make gcc shut up about derefing null : +#define RR_MEMBER_OFFSET_PTR(type, member, ptr) \ + ((SINTa) & (((type *)(ptr))->member) - (SINTa)(ptr)) +#define RR_MEMBER_SIZE_PTR(type, member, ptr) (sizeof(((type *)(ptr))->member)) + +// MEMBER_TO_OWNER takes a pointer to a member and gives you back the base of +// the object +// you should then RR_ASSERT( &(ret->member) == ptr ); +#define RR_MEMBER_TO_OWNER(type, member, ptr) \ + (type *)(((char *)(ptr)) - RR_MEMBER_OFFSET_PTR(type, member, ptr)) //-------------------------------------------------- // Cache / prefetch macros : // RR_PREFETCH for various platforms : -// +// // RR_PREFETCH_SEQUENTIAL : prefetch memory for reading in a sequential scan -// platforms that automatically prefetch sequential (eg. PC) should be a no-op here -// RR_PREFETCH_WRITE_INVALIDATE : prefetch memory for writing - contents of memory are undefined +// platforms that automatically prefetch sequential (eg. PC) should +//be a no-op here +// RR_PREFETCH_WRITE_INVALIDATE : prefetch memory for writing - contents of +// memory are undefined // (may be a no-op, may be a normal prefetch, may zero memory) -// warning : RR_PREFETCH_WRITE_INVALIDATE may write memory so don't do it past the end of buffers +// warning : RR_PREFETCH_WRITE_INVALIDATE may write memory so don't +//do it past the end of buffers #ifdef __RADX86__ -#define RR_PREFETCH_SEQUENTIAL(ptr,offset) // nop -#define RR_PREFETCH_WRITE_INVALIDATE(ptr,offset) // nop +#define RR_PREFETCH_SEQUENTIAL(ptr, offset) // nop +#define RR_PREFETCH_WRITE_INVALIDATE(ptr, offset) // nop #elif defined(__RADXENON__) -#define RR_PREFETCH_SEQUENTIAL(ptr,offset) __dcbt((int)(offset),(void *)(ptr)) -#define RR_PREFETCH_WRITE_INVALIDATE(ptr,offset) __dcbz128((int)(offset),(void *)(ptr)) +#define RR_PREFETCH_SEQUENTIAL(ptr, offset) __dcbt((int)(offset), (void *)(ptr)) +#define RR_PREFETCH_WRITE_INVALIDATE(ptr, offset) \ + __dcbz128((int)(offset), (void *)(ptr)) #elif defined(__RADPS3__) -#define RR_PREFETCH_SEQUENTIAL(ptr,offset) __dcbt((char *)(ptr) + (int)(offset)) -#define RR_PREFETCH_WRITE_INVALIDATE(ptr,offset) __dcbz((char *)(ptr) + (int)(offset)) +#define RR_PREFETCH_SEQUENTIAL(ptr, offset) \ + __dcbt((char *)(ptr) + (int)(offset)) +#define RR_PREFETCH_WRITE_INVALIDATE(ptr, offset) \ + __dcbz((char *)(ptr) + (int)(offset)) #elif defined(__RADSPU__) -#define RR_PREFETCH_SEQUENTIAL(ptr,offset) // intentional NOP -#define RR_PREFETCH_WRITE_INVALIDATE(ptr,offset) // nop +#define RR_PREFETCH_SEQUENTIAL(ptr, offset) // intentional NOP +#define RR_PREFETCH_WRITE_INVALIDATE(ptr, offset) // nop #elif defined(__RADWII__) || defined(__RADWIIU__) -#define RR_PREFETCH_SEQUENTIAL(ptr,offset) // intentional NOP for now -#define RR_PREFETCH_WRITE_INVALIDATE(ptr,offset) // nop +#define RR_PREFETCH_SEQUENTIAL(ptr, offset) // intentional NOP for now +#define RR_PREFETCH_WRITE_INVALIDATE(ptr, offset) // nop #elif defined(__RAD3DS__) -#define RR_PREFETCH_SEQUENTIAL(ptr,offset) __pld((char *)(ptr) + (int)(offset)) -#define RR_PREFETCH_WRITE_INVALIDATE(ptr,offset) __pldw((char *)(ptr) + (int)(offset)) +#define RR_PREFETCH_SEQUENTIAL(ptr, offset) __pld((char *)(ptr) + (int)(offset)) +#define RR_PREFETCH_WRITE_INVALIDATE(ptr, offset) \ + __pldw((char *)(ptr) + (int)(offset)) #else // other platform -#define RR_PREFETCH_SEQUENTIAL(ptr,offset) // need_prefetch // compile error -#define RR_PREFETCH_WRITE_INVALIDATE(ptr,offset) // need_writezero // error +#define RR_PREFETCH_SEQUENTIAL(ptr, offset) // need_prefetch // compile error +#define RR_PREFETCH_WRITE_INVALIDATE(ptr, offset) // need_writezero // error #endif @@ -1534,130 +1574,131 @@ RADDEFSTART // set up RR_BREAK : - #ifdef __RADNGC__ +#ifdef __RADNGC__ - #define RR_BREAK() asm(" .long 0x00000001") - #define RR_CACHE_LINE_SIZE xxx +#define RR_BREAK() asm(" .long 0x00000001") +#define RR_CACHE_LINE_SIZE xxx - #elif defined(__RADWII__) +#elif defined(__RADWII__) - #define RR_BREAK() __asm__ volatile("trap") - #define RR_CACHE_LINE_SIZE 32 +#define RR_BREAK() __asm__ volatile("trap") +#define RR_CACHE_LINE_SIZE 32 - #elif defined(__RADWIIU__) +#elif defined(__RADWIIU__) - #define RR_BREAK() asm("trap") - #define RR_CACHE_LINE_SIZE 32 +#define RR_BREAK() asm("trap") +#define RR_CACHE_LINE_SIZE 32 - #elif defined(__RAD3DS__) +#elif defined(__RAD3DS__) - #define RR_BREAK() *((int volatile*)0)=0 - #define RR_CACHE_LINE_SIZE 32 +#define RR_BREAK() *((int volatile *)0) = 0 +#define RR_CACHE_LINE_SIZE 32 - #elif defined(__RADNDS__) +#elif defined(__RADNDS__) - #define RR_BREAK() asm("BKPT 0") - #define RR_CACHE_LINE_SIZE xxx +#define RR_BREAK() asm("BKPT 0") +#define RR_CACHE_LINE_SIZE xxx - #elif defined(__RADPS2__) +#elif defined(__RADPS2__) - #define RR_BREAK() __asm__ volatile("break") - #define RR_CACHE_LINE_SIZE 64 +#define RR_BREAK() __asm__ volatile("break") +#define RR_CACHE_LINE_SIZE 64 - #elif defined(__RADPSP__) +#elif defined(__RADPSP__) - #define RR_BREAK() __asm__("break 0") - #define RR_CACHE_LINE_SIZE 64 +#define RR_BREAK() __asm__("break 0") +#define RR_CACHE_LINE_SIZE 64 - #elif defined(__RADPSP2__) +#elif defined(__RADPSP2__) - #define RR_BREAK() { __asm__ volatile("bkpt 0x0000"); } - #define RR_CACHE_LINE_SIZE 32 +#define RR_BREAK() \ + { __asm__ volatile("bkpt 0x0000"); } +#define RR_CACHE_LINE_SIZE 32 - #elif defined (__RADQNX__) - #define RR_BREAK() __builtin_trap() - #define RR_CACHE_LINE_SIZE 32 - #elif defined (__RADARM__) && defined (__RADLINUX__) - #define RR_BREAK() __builtin_trap() - #define RR_CACHE_LINE_SIZE 32 - #elif defined(__RADSPU__) +#elif defined(__RADQNX__) +#define RR_BREAK() __builtin_trap() +#define RR_CACHE_LINE_SIZE 32 +#elif defined(__RADARM__) && defined(__RADLINUX__) +#define RR_BREAK() __builtin_trap() +#define RR_CACHE_LINE_SIZE 32 +#elif defined(__RADSPU__) - #define RR_BREAK() __asm volatile ("stopd 0,1,1") - #define RR_CACHE_LINE_SIZE 128 +#define RR_BREAK() __asm volatile("stopd 0,1,1") +#define RR_CACHE_LINE_SIZE 128 - #elif defined(__RADPS3__) +#elif defined(__RADPS3__) - // #ifdef snPause // in LibSN.h - // snPause - // __asm__ volatile ( "tw 31,1,1" ) +// #ifdef snPause // in LibSN.h +// snPause +// __asm__ volatile ( "tw 31,1,1" ) - #define RR_BREAK() __asm__ volatile ( "tw 31,1,1" ) - //#define RR_BREAK() __asm__ volatile("trap"); +#define RR_BREAK() __asm__ volatile("tw 31,1,1") +// #define RR_BREAK() __asm__ volatile("trap"); - #define RR_CACHE_LINE_SIZE 128 +#define RR_CACHE_LINE_SIZE 128 - #elif defined(__RADMAC__) +#elif defined(__RADMAC__) - #if defined(__GNUG__) || defined(__GNUC__) - #ifdef __RADX86__ - #define RR_BREAK() __asm__ volatile ( "int $3" ) - #else - #define RR_BREAK() __builtin_trap() - #endif - #else - #ifdef __RADMACH__ - void DebugStr(unsigned char const *); - #else - void pascal DebugStr(unsigned char const *); - #endif - #define RR_BREAK() DebugStr("\pRR_BREAK() was called") - #endif +#if defined(__GNUG__) || defined(__GNUC__) +#ifdef __RADX86__ +#define RR_BREAK() __asm__ volatile("int $3") +#else +#define RR_BREAK() __builtin_trap() +#endif +#else +#ifdef __RADMACH__ +void DebugStr(unsigned char const *); +#else +void pascal DebugStr(unsigned char const *); +#endif +#define RR_BREAK() DebugStr("\pRR_BREAK() was called") +#endif - #define RR_CACHE_LINE_SIZE 64 +#define RR_CACHE_LINE_SIZE 64 - #elif defined(__RADIPHONE__) - #define RR_BREAK() __builtin_trap() - #define RR_CACHE_LINE_SIZE 32 - #elif defined(__RADXENON__) - #define RR_BREAK() assert(0) - #define RR_CACHE_LINE_SIZE 128 - #elif defined(__RADANDROID__) - #define RR_BREAK() __builtin_trap() - #define RR_CACHE_LINE_SIZE 32 - #elif defined(__RADPS4__) - #define RR_BREAK() __builtin_trap() - #define RR_CACHE_LINE_SIZE 64 - #elif defined(__RADNACL__) - #define RR_BREAK() __builtin_trap() - #define RR_CACHE_LINE_SIZE 64 - #else - // x86 : - #define RR_CACHE_LINE_SIZE 64 +#elif defined(__RADIPHONE__) +#define RR_BREAK() __builtin_trap() +#define RR_CACHE_LINE_SIZE 32 +#elif defined(__RADXENON__) +#define RR_BREAK() assert(0) +#define RR_CACHE_LINE_SIZE 128 +#elif defined(__RADANDROID__) +#define RR_BREAK() __builtin_trap() +#define RR_CACHE_LINE_SIZE 32 +#elif defined(__RADPS4__) +#define RR_BREAK() __builtin_trap() +#define RR_CACHE_LINE_SIZE 64 +#elif defined(__RADNACL__) +#define RR_BREAK() __builtin_trap() +#define RR_CACHE_LINE_SIZE 64 +#else +// x86 : +#define RR_CACHE_LINE_SIZE 64 - #ifdef __RADLINUX__ - #define RR_BREAK() __asm__ volatile ( "int $3" ) - #elif defined(__WATCOMC__) +#ifdef __RADLINUX__ +#define RR_BREAK() __asm__ volatile("int $3") +#elif defined(__WATCOMC__) - void RR_BREAK( void ); - #pragma aux RR_BREAK = "int 0x3"; +void RR_BREAK(void); +#pragma aux RR_BREAK = "int 0x3"; - #elif defined(__RADWIN__) && defined(_MSC_VER) && _MSC_VER >= 1300 +#elif defined(__RADWIN__) && defined(_MSC_VER) && _MSC_VER >= 1300 - #define RR_BREAK __debugbreak +#define RR_BREAK __debugbreak - #else +#else - #define RR_BREAK() RAD_STATEMENT_WRAPPER( __asm {int 3} ) +#define RR_BREAK() RAD_STATEMENT_WRAPPER(__asm {int 3}) - #endif +#endif - #endif +#endif // simple RR_ASSERT : // CB 5-27-10 : use RR_DO_ASSERTS to toggle asserts on and off : #if (defined(_DEBUG) && !defined(NDEBUG)) || defined(ASSERT_IN_RELEASE) - #define RR_DO_ASSERTS +#define RR_DO_ASSERTS #endif /********* @@ -1665,18 +1706,19 @@ RADDEFSTART rrAsserts : RR_ASSERT(exp) - the normal assert thing, toggled with RR_DO_ASSERTS -RR_ASSERT_ALWAYS(exp) - assert that you want to test even in ALL builds (including final!) -RR_ASSERT_RELEASE(exp) - assert that you want to test even in release builds (not for final!) -RR_ASSERT_LITE(exp) - normal assert is not safe from threads or inside malloc; use this instead -RR_DURING_ASSERT(exp) - wrap operations that compute stuff for assert in here -RR_DO_ASSERTS - toggle tells you if asserts are enabled or not +RR_ASSERT_ALWAYS(exp) - assert that you want to test even in ALL builds +(including final!) RR_ASSERT_RELEASE(exp) - assert that you want to test even in +release builds (not for final!) RR_ASSERT_LITE(exp) - normal assert is not safe +from threads or inside malloc; use this instead RR_DURING_ASSERT(exp) - wrap +operations that compute stuff for assert in here RR_DO_ASSERTS - toggle tells +you if asserts are enabled or not RR_BREAK() - generate a debug break - always ! RR_ASSERT_BREAK() - RR_BREAK for asserts ; disable with RAD_NO_BREAK -RR_ASSERT_FAILURE(str) - just break with a messsage; like assert with no condition -RR_ASSERT_FAILURE_ALWAYS(str) - RR_ASSERT_FAILURE in release builds too -RR_CANT_GET_HERE() - put in spots execution should never go +RR_ASSERT_FAILURE(str) - just break with a messsage; like assert with no +condition RR_ASSERT_FAILURE_ALWAYS(str) - RR_ASSERT_FAILURE in release builds +too RR_CANT_GET_HERE() - put in spots execution should never go RR_COMPILER_ASSERT(exp) - checks constant conditions at compile time RADTODO - note to search for nonfinal stuff @@ -1686,72 +1728,90 @@ RR_PRAGMA_MESSAGE - message dealy, use with #pragma in MSVC //----------------------------------------------------------- - -#if defined(__GNUG__) || defined(__GNUC__) || (defined(_MSC_VER) && _MSC_VER > 1200) - #define RR_FUNCTION_NAME __FUNCTION__ +#if defined(__GNUG__) || defined(__GNUC__) || \ + (defined(_MSC_VER) && _MSC_VER > 1200) +#define RR_FUNCTION_NAME __FUNCTION__ #else - #define RR_FUNCTION_NAME 0 +#define RR_FUNCTION_NAME 0 - // __func__ is in the C99 standard +// __func__ is in the C99 standard #endif //----------------------------------------------------------- -// rrDisplayAssertion might just log, or it might pop a message box, depending on settings +// rrDisplayAssertion might just log, or it might pop a message box, depending +// on settings // rrDisplayAssertion returns whether you should break or not -typedef rrbool (RADLINK fp_rrDisplayAssertion)(int * Ignored, const char * fileName,const int line,const char * function,const char * message); +typedef rrbool(RADLINK fp_rrDisplayAssertion)(int *Ignored, + const char *fileName, + const int line, + const char *function, + const char *message); -extern fp_rrDisplayAssertion * g_fp_rrDisplayAssertion; +extern fp_rrDisplayAssertion *g_fp_rrDisplayAssertion; // if I have func pointer, call it, else true ; true = do int 3 -#define rrDisplayAssertion(i,n,l,f,m) ( ( g_fp_rrDisplayAssertion ) ? (*g_fp_rrDisplayAssertion)(i,n,l,f,m) : 1 ) +#define rrDisplayAssertion(i, n, l, f, m) \ + ((g_fp_rrDisplayAssertion) ? (*g_fp_rrDisplayAssertion)(i, n, l, f, m) : 1) //----------------------------------------------------------- - + // RAD_NO_BREAK : option if you don't like your assert to break // CB : RR_BREAK is *always* a break ; RR_ASSERT_BREAK is optional #ifdef RAD_NO_BREAK #define RR_ASSERT_BREAK() 0 #else -#define RR_ASSERT_BREAK() RR_BREAK() +#define RR_ASSERT_BREAK() RR_BREAK() #endif // assert_always is on FINAL ! -#define RR_ASSERT_ALWAYS(exp) RAD_STATEMENT_WRAPPER( static int Ignored=0; if ( ! (exp) ) { if ( rrDisplayAssertion(&Ignored,__FILE__,__LINE__,RR_FUNCTION_NAME,#exp) ) RR_ASSERT_BREAK(); } ) +#define RR_ASSERT_ALWAYS(exp) \ + RAD_STATEMENT_WRAPPER(static int Ignored = 0; if (!(exp)) { \ + if (rrDisplayAssertion(&Ignored, __FILE__, __LINE__, RR_FUNCTION_NAME, \ + #exp)) \ + RR_ASSERT_BREAK(); \ + }) -// RR_ASSERT_FAILURE is like an assert without a condition - if you hit it, you're bad -#define RR_ASSERT_FAILURE_ALWAYS(str) RAD_STATEMENT_WRAPPER( static int Ignored=0; if ( rrDisplayAssertion(&Ignored,__FILE__,__LINE__,RR_FUNCTION_NAME,str) ) RR_ASSERT_BREAK(); ) +// RR_ASSERT_FAILURE is like an assert without a condition - if you hit it, +// you're bad +#define RR_ASSERT_FAILURE_ALWAYS(str) \ + RAD_STATEMENT_WRAPPER(static int Ignored = 0; \ + if (rrDisplayAssertion(&Ignored, __FILE__, __LINE__, \ + RR_FUNCTION_NAME, str)) \ + RR_ASSERT_BREAK();) -#define RR_ASSERT_LITE_ALWAYS(exp) RAD_STATEMENT_WRAPPER( if ( ! (exp) ) { RR_ASSERT_BREAK(); } ) +#define RR_ASSERT_LITE_ALWAYS(exp) \ + RAD_STATEMENT_WRAPPER(if (!(exp)) { RR_ASSERT_BREAK(); }) //----------------------------------- -#ifdef RR_DO_ASSERTS +#ifdef RR_DO_ASSERTS -#define RR_ASSERT(exp) RR_ASSERT_ALWAYS(exp) -#define RR_ASSERT_LITE(exp) RR_ASSERT_LITE_ALWAYS(exp) +#define RR_ASSERT(exp) RR_ASSERT_ALWAYS(exp) +#define RR_ASSERT_LITE(exp) RR_ASSERT_LITE_ALWAYS(exp) #define RR_ASSERT_NO_ASSUME(exp) RR_ASSERT_ALWAYS(exp) -// RR_DURING_ASSERT is to set up expressions or declare variables that are only used in asserts -#define RR_DURING_ASSERT(exp) exp +// RR_DURING_ASSERT is to set up expressions or declare variables that are only +// used in asserts +#define RR_DURING_ASSERT(exp) exp -#define RR_ASSERT_FAILURE(str) RR_ASSERT_FAILURE_ALWAYS(str) +#define RR_ASSERT_FAILURE(str) RR_ASSERT_FAILURE_ALWAYS(str) // RR_CANT_GET_HERE is for like defaults in switches that should never be hit -#define RR_CANT_GET_HERE() RAD_STATEMENT_WRAPPER( RR_ASSERT_FAILURE("can't get here"); RADUNREACHABLE; ) +#define RR_CANT_GET_HERE() \ + RAD_STATEMENT_WRAPPER(RR_ASSERT_FAILURE("can't get here"); RADUNREACHABLE;) +#else // RR_DO_ASSERTS //----------------------------------- -#else // RR_DO_ASSERTS //----------------------------------- - -#define RR_ASSERT(exp) (void)0 -#define RR_ASSERT_LITE(exp) (void)0 +#define RR_ASSERT(exp) (void)0 +#define RR_ASSERT_LITE(exp) (void)0 #define RR_ASSERT_NO_ASSUME(exp) (void)0 -#define RR_DURING_ASSERT(exp) (void)0 +#define RR_DURING_ASSERT(exp) (void)0 -#define RR_ASSERT_FAILURE(str) (void)0 +#define RR_ASSERT_FAILURE(str) (void)0 #define RR_CANT_GET_HERE() RADUNREACHABLE -#endif // RR_DO_ASSERTS //----------------------------------- +#endif // RR_DO_ASSERTS //----------------------------------- //================================================================= @@ -1759,27 +1819,27 @@ extern fp_rrDisplayAssertion * g_fp_rrDisplayAssertion; #ifndef __RADFINAL__ -#define RR_ASSERT_RELEASE(exp) RR_ASSERT_ALWAYS(exp) -#define RR_ASSERT_LITE_RELEASE(exp) RR_ASSERT_LITE_ALWAYS(exp) +#define RR_ASSERT_RELEASE(exp) RR_ASSERT_ALWAYS(exp) +#define RR_ASSERT_LITE_RELEASE(exp) RR_ASSERT_LITE_ALWAYS(exp) #else -#define RR_ASSERT_RELEASE(exp) (void)0 -#define RR_ASSERT_LITE_RELEASE(exp) (void)0 +#define RR_ASSERT_RELEASE(exp) (void)0 +#define RR_ASSERT_LITE_RELEASE(exp) (void)0 #endif // BH: This never gets compiled away except for __RADFINAL__ -#define RR_ASSERT_ALWAYS_NO_SHIP RR_ASSERT_RELEASE +#define RR_ASSERT_ALWAYS_NO_SHIP RR_ASSERT_RELEASE -#define rrAssert RR_ASSERT -#define rrassert RR_ASSERT +#define rrAssert RR_ASSERT +#define rrassert RR_ASSERT #ifdef _MSC_VER - // without this, our assert errors... - #if _MSC_VER >= 1300 - #pragma warning( disable : 4127) // conditional expression is constant - #endif +// without this, our assert errors... +#if _MSC_VER >= 1300 +#pragma warning(disable : 4127) // conditional expression is constant +#endif #endif //--------------------------------------- @@ -1791,8 +1851,8 @@ extern fp_rrDisplayAssertion * g_fp_rrDisplayAssertion; // available here : // RR_[GET/PUT][16/32]_[BE/LE][_UNALIGNED][_OFFSET] // -// if you don't specify _UNALIGNED , then ptr & offset shoud both be aligned to type size -// _OFFSET is in *bytes* ! +// if you don't specify _UNALIGNED , then ptr & offset shoud both be +//aligned to type size _OFFSET is in *bytes* ! // you can #define RR_GET_RESTRICT to make all RR_GETs be RESTRICT // if you set nothing they are not @@ -1806,65 +1866,71 @@ extern fp_rrDisplayAssertion * g_fp_rrDisplayAssertion; // native version of get/put is always trivial : -#define RR_GET16_NATIVE(ptr) *((const U16 * RR_GET_PTR_POST)(ptr)) -#define RR_PUT16_NATIVE(ptr,val) *((U16 * RR_GET_PTR_POST)(ptr)) = (val) +#define RR_GET16_NATIVE(ptr) *((const U16 *RR_GET_PTR_POST)(ptr)) +#define RR_PUT16_NATIVE(ptr, val) *((U16 * RR_GET_PTR_POST)(ptr)) = (val) // offset is in bytes -#define RR_U16_PTR_OFFSET(ptr,offset) ((U16 * RR_GET_PTR_POST)((char *)(ptr) + (offset))) -#define RR_GET16_NATIVE_OFFSET(ptr,offset) *( RR_U16_PTR_OFFSET((ptr),offset) ) -#define RR_PUT16_NATIVE_OFFSET(ptr,val,offset) *( RR_U16_PTR_OFFSET((ptr),offset)) = (val) +#define RR_U16_PTR_OFFSET(ptr, offset) \ + ((U16 * RR_GET_PTR_POST)((char *)(ptr) + (offset))) +#define RR_GET16_NATIVE_OFFSET(ptr, offset) *(RR_U16_PTR_OFFSET((ptr), offset)) +#define RR_PUT16_NATIVE_OFFSET(ptr, val, offset) \ + *(RR_U16_PTR_OFFSET((ptr), offset)) = (val) -#define RR_GET32_NATIVE(ptr) *((const U32 * RR_GET_PTR_POST)(ptr)) -#define RR_PUT32_NATIVE(ptr,val) *((U32 * RR_GET_PTR_POST)(ptr)) = (val) +#define RR_GET32_NATIVE(ptr) *((const U32 *RR_GET_PTR_POST)(ptr)) +#define RR_PUT32_NATIVE(ptr, val) *((U32 * RR_GET_PTR_POST)(ptr)) = (val) // offset is in bytes -#define RR_U32_PTR_OFFSET(ptr,offset) ((U32 * RR_GET_PTR_POST)((char *)(ptr) + (offset))) -#define RR_GET32_NATIVE_OFFSET(ptr,offset) *( RR_U32_PTR_OFFSET((ptr),offset) ) -#define RR_PUT32_NATIVE_OFFSET(ptr,val,offset) *( RR_U32_PTR_OFFSET((ptr),offset)) = (val) +#define RR_U32_PTR_OFFSET(ptr, offset) \ + ((U32 * RR_GET_PTR_POST)((char *)(ptr) + (offset))) +#define RR_GET32_NATIVE_OFFSET(ptr, offset) *(RR_U32_PTR_OFFSET((ptr), offset)) +#define RR_PUT32_NATIVE_OFFSET(ptr, val, offset) \ + *(RR_U32_PTR_OFFSET((ptr), offset)) = (val) -#define RR_GET64_NATIVE(ptr) *((const U64 * RR_GET_PTR_POST)(ptr)) -#define RR_PUT64_NATIVE(ptr,val) *((U64 * RR_GET_PTR_POST)(ptr)) = (val) +#define RR_GET64_NATIVE(ptr) *((const U64 *RR_GET_PTR_POST)(ptr)) +#define RR_PUT64_NATIVE(ptr, val) *((U64 * RR_GET_PTR_POST)(ptr)) = (val) // offset is in bytes -#define RR_U64_PTR_OFFSET(ptr,offset) ((U64 * RR_GET_PTR_POST)((char *)(ptr) + (offset))) -#define RR_GET64_NATIVE_OFFSET(ptr,offset) *( RR_U64_PTR_OFFSET((ptr),offset) ) -#define RR_PUT64_NATIVE_OFFSET(ptr,val,offset) *( RR_U64_PTR_OFFSET((ptr),offset)) = (val) +#define RR_U64_PTR_OFFSET(ptr, offset) \ + ((U64 * RR_GET_PTR_POST)((char *)(ptr) + (offset))) +#define RR_GET64_NATIVE_OFFSET(ptr, offset) *(RR_U64_PTR_OFFSET((ptr), offset)) +#define RR_PUT64_NATIVE_OFFSET(ptr, val, offset) \ + *(RR_U64_PTR_OFFSET((ptr), offset)) = (val) //--------------------------------------------------- #ifdef __RADLITTLEENDIAN__ -#define RR_GET16_LE RR_GET16_NATIVE -#define RR_PUT16_LE RR_PUT16_NATIVE -#define RR_GET16_LE_OFFSET RR_GET16_NATIVE_OFFSET -#define RR_PUT16_LE_OFFSET RR_PUT16_NATIVE_OFFSET +#define RR_GET16_LE RR_GET16_NATIVE +#define RR_PUT16_LE RR_PUT16_NATIVE +#define RR_GET16_LE_OFFSET RR_GET16_NATIVE_OFFSET +#define RR_PUT16_LE_OFFSET RR_PUT16_NATIVE_OFFSET -#define RR_GET32_LE RR_GET32_NATIVE -#define RR_PUT32_LE RR_PUT32_NATIVE -#define RR_GET32_LE_OFFSET RR_GET32_NATIVE_OFFSET -#define RR_PUT32_LE_OFFSET RR_PUT32_NATIVE_OFFSET +#define RR_GET32_LE RR_GET32_NATIVE +#define RR_PUT32_LE RR_PUT32_NATIVE +#define RR_GET32_LE_OFFSET RR_GET32_NATIVE_OFFSET +#define RR_PUT32_LE_OFFSET RR_PUT32_NATIVE_OFFSET -#define RR_GET64_LE RR_GET64_NATIVE -#define RR_PUT64_LE RR_PUT64_NATIVE -#define RR_GET64_LE_OFFSET RR_GET64_NATIVE_OFFSET -#define RR_PUT64_LE_OFFSET RR_PUT64_NATIVE_OFFSET +#define RR_GET64_LE RR_GET64_NATIVE +#define RR_PUT64_LE RR_PUT64_NATIVE +#define RR_GET64_LE_OFFSET RR_GET64_NATIVE_OFFSET +#define RR_PUT64_LE_OFFSET RR_PUT64_NATIVE_OFFSET #else -#define RR_GET16_BE RR_GET16_NATIVE -#define RR_PUT16_BE RR_PUT16_NATIVE -#define RR_GET16_BE_OFFSET RR_GET16_NATIVE_OFFSET -#define RR_PUT16_BE_OFFSET RR_PUT16_NATIVE_OFFSET +#define RR_GET16_BE RR_GET16_NATIVE +#define RR_PUT16_BE RR_PUT16_NATIVE +#define RR_GET16_BE_OFFSET RR_GET16_NATIVE_OFFSET +#define RR_PUT16_BE_OFFSET RR_PUT16_NATIVE_OFFSET -#define RR_GET32_BE RR_GET32_NATIVE -#define RR_PUT32_BE RR_PUT32_NATIVE -#define RR_GET32_BE_OFFSET RR_GET32_NATIVE_OFFSET -#define RR_PUT32_BE_OFFSET RR_PUT32_NATIVE_OFFSET +#define RR_GET32_BE RR_GET32_NATIVE +#define RR_PUT32_BE RR_PUT32_NATIVE +#define RR_GET32_BE_OFFSET RR_GET32_NATIVE_OFFSET +#define RR_PUT32_BE_OFFSET RR_PUT32_NATIVE_OFFSET -#define RR_GET64_BE RR_GET64_NATIVE -#define RR_PUT64_BE RR_PUT64_NATIVE -#define RR_GET64_BE_OFFSET RR_GET64_NATIVE_OFFSET -#define RR_PUT64_BE_OFFSET RR_PUT64_NATIVE_OFFSET +#define RR_GET64_BE RR_GET64_NATIVE +#define RR_PUT64_BE RR_PUT64_NATIVE +#define RR_GET64_BE_OFFSET RR_GET64_NATIVE_OFFSET +#define RR_PUT64_BE_OFFSET RR_PUT64_NATIVE_OFFSET #endif @@ -1876,50 +1942,47 @@ extern fp_rrDisplayAssertion * g_fp_rrDisplayAssertion; #if (_MSC_VER >= 1300) -unsigned short __cdecl _byteswap_ushort (unsigned short _Short); -unsigned long __cdecl _byteswap_ulong (unsigned long _Long); +unsigned short __cdecl _byteswap_ushort(unsigned short _Short); +unsigned long __cdecl _byteswap_ulong(unsigned long _Long); #pragma intrinsic(_byteswap_ushort, _byteswap_ulong) -#define RR_BSWAP16 _byteswap_ushort -#define RR_BSWAP32 _byteswap_ulong +#define RR_BSWAP16 _byteswap_ushort +#define RR_BSWAP32 _byteswap_ulong -unsigned int64_t __cdecl _byteswap_uint64 (unsigned int64_t val); +unsigned int64_t __cdecl _byteswap_uint64(unsigned int64_t val); #pragma intrinsic(_byteswap_uint64) -#define RR_BSWAP64 _byteswap_uint64 +#define RR_BSWAP64 _byteswap_uint64 -#elif defined(_MSC_VER) // VC6 +#elif defined(_MSC_VER) // VC6 -RADFORCEINLINE unsigned long RR_BSWAP16 (unsigned long _Long) -{ - __asm { +RADFORCEINLINE unsigned long RR_BSWAP16(unsigned long _Long) { + __asm { mov eax, [_Long] rol ax, 8 mov [_Long], eax; - } - return _Long; + } + return _Long; } -RADFORCEINLINE unsigned long RR_BSWAP32 (unsigned long _Long) -{ - __asm { +RADFORCEINLINE unsigned long RR_BSWAP32(unsigned long _Long) { + __asm { mov eax, [_Long] bswap eax mov [_Long], eax - } - return _Long; + } + return _Long; } -RADFORCEINLINE unsigned int64_t RR_BSWAP64 (unsigned int64_t _Long) -{ - __asm { +RADFORCEINLINE unsigned int64_t RR_BSWAP64(unsigned int64_t _Long) { + __asm { mov eax, DWORD PTR _Long mov edx, DWORD PTR _Long+4 bswap eax bswap edx mov DWORD PTR _Long, edx mov DWORD PTR _Long+4, eax - } - return _Long; + } + return _Long; } #elif defined(__GNUC__) || defined(__clang__) @@ -1927,98 +1990,112 @@ RADFORCEINLINE unsigned int64_t RR_BSWAP64 (unsigned int64_t _Long) // GCC has __builtin_bswap16, but Clang only seems to have added it recently. // We use __builtin_bswap32/64 but 16 just uses the macro version. (No big // deal if that turns into shifts anyway) -#define RR_BSWAP16(u16) ( (U16) ( ((u16) >> 8) | ((u16) << 8) ) ) -#define RR_BSWAP32 __builtin_bswap32 -#define RR_BSWAP64 __builtin_bswap64 +#define RR_BSWAP16(u16) ((U16)(((u16) >> 8) | ((u16) << 8))) +#define RR_BSWAP32 __builtin_bswap32 +#define RR_BSWAP64 __builtin_bswap64 #endif -#define RR_GET16_BE(ptr) RR_BSWAP16(*((U16 *)(ptr))) -#define RR_PUT16_BE(ptr,val) *((U16 *)(ptr)) = (U16) RR_BSWAP16(val) -#define RR_GET16_BE_OFFSET(ptr,offset) RR_BSWAP16(*RR_U16_PTR_OFFSET(ptr,offset)) -#define RR_PUT16_BE_OFFSET(ptr,val,offset) *RR_U16_PTR_OFFSET(ptr,offset) = RR_BSWAP16(val) +#define RR_GET16_BE(ptr) RR_BSWAP16(*((U16 *)(ptr))) +#define RR_PUT16_BE(ptr, val) *((U16 *)(ptr)) = (U16)RR_BSWAP16(val) +#define RR_GET16_BE_OFFSET(ptr, offset) \ + RR_BSWAP16(*RR_U16_PTR_OFFSET(ptr, offset)) +#define RR_PUT16_BE_OFFSET(ptr, val, offset) \ + *RR_U16_PTR_OFFSET(ptr, offset) = RR_BSWAP16(val) -#define RR_GET32_BE(ptr) RR_BSWAP32(*((U32 *)(ptr))) -#define RR_PUT32_BE(ptr,val) *((U32 *)(ptr)) = RR_BSWAP32(val) -#define RR_GET32_BE_OFFSET(ptr,offset) RR_BSWAP32(*RR_U32_PTR_OFFSET(ptr,offset)) -#define RR_PUT32_BE_OFFSET(ptr,val,offset) *RR_U32_PTR_OFFSET(ptr,offset) = RR_BSWAP32(val) +#define RR_GET32_BE(ptr) RR_BSWAP32(*((U32 *)(ptr))) +#define RR_PUT32_BE(ptr, val) *((U32 *)(ptr)) = RR_BSWAP32(val) +#define RR_GET32_BE_OFFSET(ptr, offset) \ + RR_BSWAP32(*RR_U32_PTR_OFFSET(ptr, offset)) +#define RR_PUT32_BE_OFFSET(ptr, val, offset) \ + *RR_U32_PTR_OFFSET(ptr, offset) = RR_BSWAP32(val) -#define RR_GET64_BE(ptr) RR_BSWAP64(*((U64 *)(ptr))) -#define RR_PUT64_BE(ptr,val) *((U64 *)(ptr)) = RR_BSWAP64(val) -#define RR_GET64_BE_OFFSET(ptr,offset) RR_BSWAP64(*RR_U64_PTR_OFFSET(ptr,offset)) -#define RR_PUT64_BE_OFFSET(ptr,val,offset) *RR_U64_PTR_OFFSET(ptr,offset) = RR_BSWAP64(val) +#define RR_GET64_BE(ptr) RR_BSWAP64(*((U64 *)(ptr))) +#define RR_PUT64_BE(ptr, val) *((U64 *)(ptr)) = RR_BSWAP64(val) +#define RR_GET64_BE_OFFSET(ptr, offset) \ + RR_BSWAP64(*RR_U64_PTR_OFFSET(ptr, offset)) +#define RR_PUT64_BE_OFFSET(ptr, val, offset) \ + *RR_U64_PTR_OFFSET(ptr, offset) = RR_BSWAP64(val) // end _MSC_VER -#elif defined(__RADXENON__) // Xenon has built-in funcs for this +#elif defined(__RADXENON__) // Xenon has built-in funcs for this unsigned short __loadshortbytereverse(int offset, const void *base); -unsigned long __loadwordbytereverse (int offset, const void *base); +unsigned long __loadwordbytereverse(int offset, const void *base); -void __storeshortbytereverse(unsigned short val, int offset, void *base); -void __storewordbytereverse (unsigned int val, int offset, void *base); +void __storeshortbytereverse(unsigned short val, int offset, void *base); +void __storewordbytereverse(unsigned int val, int offset, void *base); -#define RR_GET16_LE(ptr) __loadshortbytereverse(0, ptr) -#define RR_PUT16_LE(ptr,val) __storeshortbytereverse((U16) (val), 0, ptr) +#define RR_GET16_LE(ptr) __loadshortbytereverse(0, ptr) +#define RR_PUT16_LE(ptr, val) __storeshortbytereverse((U16)(val), 0, ptr) -#define RR_GET16_LE_OFFSET(ptr,offset) __loadshortbytereverse(offset, ptr) -#define RR_PUT16_LE_OFFSET(ptr,val,offset) __storeshortbytereverse((U16) (val), offset, ptr) +#define RR_GET16_LE_OFFSET(ptr, offset) __loadshortbytereverse(offset, ptr) +#define RR_PUT16_LE_OFFSET(ptr, val, offset) \ + __storeshortbytereverse((U16)(val), offset, ptr) -#define RR_GET32_LE(ptr) __loadwordbytereverse(0, ptr) -#define RR_PUT32_LE(ptr,val) __storewordbytereverse((U32) (val), 0, ptr) +#define RR_GET32_LE(ptr) __loadwordbytereverse(0, ptr) +#define RR_PUT32_LE(ptr, val) __storewordbytereverse((U32)(val), 0, ptr) -#define RR_GET32_LE_OFFSET(ptr,offset) __loadwordbytereverse(offset, ptr) -#define RR_PUT32_LE_OFFSET(ptr,val,offset) __storewordbytereverse((U32) (val), offset, ptr) +#define RR_GET32_LE_OFFSET(ptr, offset) __loadwordbytereverse(offset, ptr) +#define RR_PUT32_LE_OFFSET(ptr, val, offset) \ + __storewordbytereverse((U32)(val), offset, ptr) -#define RR_GET64_LE(ptr) ( ((U64)RR_GET32_OFFSET_LE(ptr,4)<<32) | RR_GET32_LE(ptr) ) -#define RR_PUT64_LE(ptr,val) RR_PUT32_LE(ptr, (U32) (val)), RR_PUT32_OFFSET_LE(ptr, (U32) ((val)>>32),4) +#define RR_GET64_LE(ptr) \ + (((U64)RR_GET32_OFFSET_LE(ptr, 4) << 32) | RR_GET32_LE(ptr)) +#define RR_PUT64_LE(ptr, val) \ + RR_PUT32_LE(ptr, (U32)(val)), RR_PUT32_OFFSET_LE(ptr, (U32)((val) >> 32), 4) #elif defined(__RADPS3__) #include -#define RR_GET16_LE(ptr) __lhbrx(ptr) -#define RR_PUT16_LE(ptr,val) __sthbrx(ptr, (U16) (val)) +#define RR_GET16_LE(ptr) __lhbrx(ptr) +#define RR_PUT16_LE(ptr, val) __sthbrx(ptr, (U16)(val)) -#define RR_GET16_LE_OFFSET(ptr,offset) __lhbrx(RR_U16_PTR_OFFSET(ptr, offset)) -#define RR_PUT16_LE_OFFSET(ptr,val,offset) __sthbrx(RR_U16_PTR_OFFSET(ptr, offset), (U16) (val)) +#define RR_GET16_LE_OFFSET(ptr, offset) __lhbrx(RR_U16_PTR_OFFSET(ptr, offset)) +#define RR_PUT16_LE_OFFSET(ptr, val, offset) \ + __sthbrx(RR_U16_PTR_OFFSET(ptr, offset), (U16)(val)) -#define RR_GET32_LE(ptr) __lwbrx(ptr) -#define RR_PUT32_LE(ptr,val) __stwbrx(ptr, (U32) (val)) +#define RR_GET32_LE(ptr) __lwbrx(ptr) +#define RR_PUT32_LE(ptr, val) __stwbrx(ptr, (U32)(val)) -#define RR_GET64_LE(ptr) __ldbrx(ptr) -#define RR_PUT64_LE(ptr,val) __stdbrx(ptr, (U32) (val)) +#define RR_GET64_LE(ptr) __ldbrx(ptr) +#define RR_PUT64_LE(ptr, val) __stdbrx(ptr, (U32)(val)) -#define RR_GET32_LE_OFFSET(ptr,offset) __lwbrx(RR_U32_PTR_OFFSET(ptr, offset)) -#define RR_PUT32_LE_OFFSET(ptr,val,offset) __stwbrx(RR_U32_PTR_OFFSET(ptr, offset), (U32) (val)) +#define RR_GET32_LE_OFFSET(ptr, offset) __lwbrx(RR_U32_PTR_OFFSET(ptr, offset)) +#define RR_PUT32_LE_OFFSET(ptr, val, offset) \ + __stwbrx(RR_U32_PTR_OFFSET(ptr, offset), (U32)(val)) #elif defined(__RADWII__) -#define RR_GET16_LE(ptr) __lhbrx(ptr, 0) -#define RR_PUT16_LE(ptr,val) __sthbrx((U16) (val), ptr, 0) +#define RR_GET16_LE(ptr) __lhbrx(ptr, 0) +#define RR_PUT16_LE(ptr, val) __sthbrx((U16)(val), ptr, 0) -#define RR_GET16_LE_OFFSET(ptr,offset) __lhbrx(ptr, offset) -#define RR_PUT16_LE_OFFSET(ptr,val,offset) __sthbrx((U16) (val), ptr, offset) +#define RR_GET16_LE_OFFSET(ptr, offset) __lhbrx(ptr, offset) +#define RR_PUT16_LE_OFFSET(ptr, val, offset) __sthbrx((U16)(val), ptr, offset) -#define RR_GET32_LE(ptr) __lwbrx(ptr, 0) -#define RR_PUT32_LE(ptr,val) __stwbrx((U32) (val), ptr, 0) +#define RR_GET32_LE(ptr) __lwbrx(ptr, 0) +#define RR_PUT32_LE(ptr, val) __stwbrx((U32)(val), ptr, 0) -#define RR_GET32_LE_OFFSET(ptr,offset) __lwbrx(ptr, offset) -#define RR_PUT32_LE_OFFSET(ptr,val,offset) __stwbrx((U32) (val), ptr, offset) +#define RR_GET32_LE_OFFSET(ptr, offset) __lwbrx(ptr, offset) +#define RR_PUT32_LE_OFFSET(ptr, val, offset) __stwbrx((U32)(val), ptr, offset) #elif defined(__RAD3DS__) -#define RR_GET16_BE(ptr) __rev16(*(U16 *) (ptr)) -#define RR_PUT16_BE(ptr,val) *(U16 *) (ptr) = __rev16(val) +#define RR_GET16_BE(ptr) __rev16(*(U16 *)(ptr)) +#define RR_PUT16_BE(ptr, val) *(U16 *)(ptr) = __rev16(val) -#define RR_GET16_BE_OFFSET(ptr,offset) __rev16(*RR_U16_PTR_OFFSET(ptr,offset)) -#define RR_PUT16_BE_OFFSET(ptr,offset,val) *RR_U16_PTR_OFFSET(ptr,offset) = __rev16(val) +#define RR_GET16_BE_OFFSET(ptr, offset) __rev16(*RR_U16_PTR_OFFSET(ptr, offset)) +#define RR_PUT16_BE_OFFSET(ptr, offset, val) \ + *RR_U16_PTR_OFFSET(ptr, offset) = __rev16(val) -#define RR_GET32_BE(ptr) __rev(*(U32 *) (ptr)) -#define RR_PUT32_BE(ptr,val) *(U32 *) (ptr) = __rev(val) +#define RR_GET32_BE(ptr) __rev(*(U32 *)(ptr)) +#define RR_PUT32_BE(ptr, val) *(U32 *)(ptr) = __rev(val) -#define RR_GET32_BE_OFFSET(ptr,offset) __rev(*RR_U32_PTR_OFFSET(ptr,offset)) -#define RR_PUT32_BE_OFFSET(ptr,offset,val) *RR_U32_PTR_OFFSET(ptr,offset) = __rev(val) +#define RR_GET32_BE_OFFSET(ptr, offset) __rev(*RR_U32_PTR_OFFSET(ptr, offset)) +#define RR_PUT32_BE_OFFSET(ptr, offset, val) \ + *RR_U32_PTR_OFFSET(ptr, offset) = __rev(val) #elif defined(__RADIPHONE__) @@ -2026,87 +2103,98 @@ void __storewordbytereverse (unsigned int val, int offset, void *bas // Bswap is just here for use of implementing get/put // caller should use Get/Put , not bswap -#define RR_BSWAP16(u16) ( (U16) ( ((u16) >> 8) | ((u16) << 8) ) ) -#define RR_BSWAP32(u32) ( (U32) ( ((u32) >> 24) | (((u32)<<8) & 0x00FF0000) | (((u32)>>8) & 0x0000FF00) | ((u32) << 24) ) ) +#define RR_BSWAP16(u16) ((U16)(((u16) >> 8) | ((u16) << 8))) +#define RR_BSWAP32(u32) \ + ((U32)(((u32) >> 24) | (((u32) << 8) & 0x00FF0000) | \ + (((u32) >> 8) & 0x0000FF00) | ((u32) << 24))) -#define RR_GET16_BE(ptr) RR_BSWAP16(*((U16 *)(ptr))) -#define RR_PUT16_BE(ptr,val) *((U16 *)(ptr)) = RR_BSWAP16(val) +#define RR_GET16_BE(ptr) RR_BSWAP16(*((U16 *)(ptr))) +#define RR_PUT16_BE(ptr, val) *((U16 *)(ptr)) = RR_BSWAP16(val) -#define RR_GET32_BE(ptr) RR_BSWAP32(*((U32 *)(ptr))) -#define RR_PUT32_BE(ptr,val) *((U32 *)(ptr)) = RR_BSWAP32(val) +#define RR_GET32_BE(ptr) RR_BSWAP32(*((U32 *)(ptr))) +#define RR_PUT32_BE(ptr, val) *((U32 *)(ptr)) = RR_BSWAP32(val) #elif defined(__RADWIIU__) #include -#define RR_GET16_LE(ptr) (*(__bytereversed U16 *) (ptr)) -#define RR_PUT16_LE(ptr,val) *(__bytereversed U16 *) (ptr) = val +#define RR_GET16_LE(ptr) (*(__bytereversed U16 *)(ptr)) +#define RR_PUT16_LE(ptr, val) *(__bytereversed U16 *)(ptr) = val -#define RR_GET16_LE_OFFSET(ptr,offset) (*(__bytereversed U16 *)RR_U16_PTR_OFFSET(ptr,offset)) -#define RR_PUT16_LE_OFFSET(ptr,val,offset) *(__bytereversed U16 *)RR_U16_PTR_OFFSET(ptr,offset) = val +#define RR_GET16_LE_OFFSET(ptr, offset) \ + (*(__bytereversed U16 *)RR_U16_PTR_OFFSET(ptr, offset)) +#define RR_PUT16_LE_OFFSET(ptr, val, offset) \ + *(__bytereversed U16 *)RR_U16_PTR_OFFSET(ptr, offset) = val -#define RR_GET32_LE(ptr) (*(__bytereversed U32 *) (ptr)) -#define RR_PUT32_LE(ptr,val) *(__bytereversed U32 *) (ptr) = val +#define RR_GET32_LE(ptr) (*(__bytereversed U32 *)(ptr)) +#define RR_PUT32_LE(ptr, val) *(__bytereversed U32 *)(ptr) = val -#define RR_GET32_LE_OFFSET(ptr,offset) (*(__bytereversed U32 *)RR_U32_PTR_OFFSET(ptr,offset)) -#define RR_PUT32_LE_OFFSET(ptr,val,offset) *(__bytereversed U32 *)RR_U32_PTR_OFFSET(ptr,offset) = val +#define RR_GET32_LE_OFFSET(ptr, offset) \ + (*(__bytereversed U32 *)RR_U32_PTR_OFFSET(ptr, offset)) +#define RR_PUT32_LE_OFFSET(ptr, val, offset) \ + *(__bytereversed U32 *)RR_U32_PTR_OFFSET(ptr, offset) = val -#define RR_GET64_LE(ptr) (*(__bytereversed U64 *) (ptr)) -#define RR_PUT64_LE(ptr,val) *(__bytereversed U64 *) (ptr) = val +#define RR_GET64_LE(ptr) (*(__bytereversed U64 *)(ptr)) +#define RR_PUT64_LE(ptr, val) *(__bytereversed U64 *)(ptr) = val -#define RR_GET64_LE_OFFSET(ptr,offset) (*(__bytereversed U64 *)RR_U32_PTR_OFFSET(ptr,offset)) -#define RR_PUT64_LE_OFFSET(ptr,val,offset) *(__bytereversed U64 *)RR_U32_PTR_OFFSET(ptr,offset) = val +#define RR_GET64_LE_OFFSET(ptr, offset) \ + (*(__bytereversed U64 *)RR_U32_PTR_OFFSET(ptr, offset)) +#define RR_PUT64_LE_OFFSET(ptr, val, offset) \ + *(__bytereversed U64 *)RR_U32_PTR_OFFSET(ptr, offset) = val #elif defined(__RADWINRTAPI__) && defined(__RADARM__) #include -#define RR_BSWAP16(u16) _arm_rev16(u16) -#define RR_BSWAP32(u32) _arm_rev(u32) +#define RR_BSWAP16(u16) _arm_rev16(u16) +#define RR_BSWAP32(u32) _arm_rev(u32) -#define RR_GET16_BE(ptr) RR_BSWAP16(*((U16 *)(ptr))) -#define RR_PUT16_BE(ptr,val) *((U16 *)(ptr)) = RR_BSWAP16(val) +#define RR_GET16_BE(ptr) RR_BSWAP16(*((U16 *)(ptr))) +#define RR_PUT16_BE(ptr, val) *((U16 *)(ptr)) = RR_BSWAP16(val) -#define RR_GET32_BE(ptr) RR_BSWAP32(*((U32 *)(ptr))) -#define RR_PUT32_BE(ptr,val) *((U32 *)(ptr)) = RR_BSWAP32(val) +#define RR_GET32_BE(ptr) RR_BSWAP32(*((U32 *)(ptr))) +#define RR_PUT32_BE(ptr, val) *((U32 *)(ptr)) = RR_BSWAP32(val) #elif defined(__RADPSP2__) // no rev16 exposed -#define RR_BSWAP16(u16) ( (U16) ( ((u16) >> 8) | ((u16) << 8) ) ) -#define RR_BSWAP32(u32) __builtin_rev(u32) +#define RR_BSWAP16(u16) ((U16)(((u16) >> 8) | ((u16) << 8))) +#define RR_BSWAP32(u32) __builtin_rev(u32) -#define RR_GET16_BE(ptr) RR_BSWAP16(*((U16 *)(ptr))) -#define RR_PUT16_BE(ptr,val) *((U16 *)(ptr)) = RR_BSWAP16(val) +#define RR_GET16_BE(ptr) RR_BSWAP16(*((U16 *)(ptr))) +#define RR_PUT16_BE(ptr, val) *((U16 *)(ptr)) = RR_BSWAP16(val) -#define RR_GET32_BE(ptr) RR_BSWAP32(*((U32 *)(ptr))) -#define RR_PUT32_BE(ptr,val) *((U32 *)(ptr)) = RR_BSWAP32(val) +#define RR_GET32_BE(ptr) RR_BSWAP32(*((U32 *)(ptr))) +#define RR_PUT32_BE(ptr, val) *((U32 *)(ptr)) = RR_BSWAP32(val) -#else // other platforms ? +#else // other platforms ? // fall back : // Bswap is just here for use of implementing get/put // caller should use Get/Put , not bswap -#define RR_BSWAP16(u16) ( (U16) ( ((u16) >> 8) | ((u16) << 8) ) ) -#define RR_BSWAP32(u32) ( (U32) ( ((u32) >> 24) | (((u32)<<8) & 0x00FF0000) | (((u32)>>8) & 0x0000FF00) | ((u32) << 24) ) ) -#define RR_BSWAP64(u64) ( ((U64) RR_BSWAP32((U32) (u64)) << 32) | (U64) RR_BSWAP32((U32) ((u64) >> 32)) ) +#define RR_BSWAP16(u16) ((U16)(((u16) >> 8) | ((u16) << 8))) +#define RR_BSWAP32(u32) \ + ((U32)(((u32) >> 24) | (((u32) << 8) & 0x00FF0000) | \ + (((u32) >> 8) & 0x0000FF00) | ((u32) << 24))) +#define RR_BSWAP64(u64) \ + (((U64)RR_BSWAP32((U32)(u64)) << 32) | (U64)RR_BSWAP32((U32)((u64) >> 32))) #ifdef __RADLITTLEENDIAN__ // comment out fallbacks so users will get errors -//#define RR_GET16_BE(ptr) RR_BSWAP16(*((U16 *)(ptr))) -//#define RR_PUT16_BE(ptr,val) *((U16 *)(ptr)) = RR_BSWAP16(val) -//#define RR_GET32_BE(ptr) RR_BSWAP32(*((U32 *)(ptr))) -//#define RR_PUT32_BE(ptr,val) *((U32 *)(ptr)) = RR_BSWAP32(val) +// #define RR_GET16_BE(ptr) RR_BSWAP16(*((U16 *)(ptr))) +// #define RR_PUT16_BE(ptr,val) *((U16 *)(ptr)) = RR_BSWAP16(val) +// #define RR_GET32_BE(ptr) RR_BSWAP32(*((U32 *)(ptr))) +// #define RR_PUT32_BE(ptr,val) *((U32 *)(ptr)) = RR_BSWAP32(val) #else // comment out fallbacks so users will get errors -//#define RR_GET16_LE(ptr) RR_BSWAP16(*((U16 *)(ptr))) -//#define RR_PUT16_LE(ptr,val) *((U16 *)(ptr)) = RR_BSWAP16(val) -//#define RR_GET32_LE(ptr) RR_BSWAP32(*((U32 *)(ptr))) -//#define RR_PUT32_LE(ptr,val) *((U32 *)(ptr)) = RR_BSWAP32(val) +// #define RR_GET16_LE(ptr) RR_BSWAP16(*((U16 *)(ptr))) +// #define RR_PUT16_LE(ptr,val) *((U16 *)(ptr)) = RR_BSWAP16(val) +// #define RR_GET32_LE(ptr) RR_BSWAP32(*((U32 *)(ptr))) +// #define RR_PUT32_LE(ptr,val) *((U32 *)(ptr)) = RR_BSWAP32(val) #endif @@ -2115,104 +2203,122 @@ void __storewordbytereverse (unsigned int val, int offset, void *bas //=================================================================== // @@ TEMP : Aliases for old names : remove me when possible : -#define RR_GET32_OFFSET_LE RR_GET32_LE_OFFSET -#define RR_GET32_OFFSET_BE RR_GET32_BE_OFFSET -#define RR_PUT32_OFFSET_LE RR_PUT32_LE_OFFSET -#define RR_PUT32_OFFSET_BE RR_PUT32_BE_OFFSET -#define RR_GET16_OFFSET_LE RR_GET16_LE_OFFSET -#define RR_GET16_OFFSET_BE RR_GET16_BE_OFFSET -#define RR_PUT16_OFFSET_LE RR_PUT16_LE_OFFSET -#define RR_PUT16_OFFSET_BE RR_PUT16_BE_OFFSET - +#define RR_GET32_OFFSET_LE RR_GET32_LE_OFFSET +#define RR_GET32_OFFSET_BE RR_GET32_BE_OFFSET +#define RR_PUT32_OFFSET_LE RR_PUT32_LE_OFFSET +#define RR_PUT32_OFFSET_BE RR_PUT32_BE_OFFSET +#define RR_GET16_OFFSET_LE RR_GET16_LE_OFFSET +#define RR_GET16_OFFSET_BE RR_GET16_BE_OFFSET +#define RR_PUT16_OFFSET_LE RR_PUT16_LE_OFFSET +#define RR_PUT16_OFFSET_BE RR_PUT16_BE_OFFSET //=================================================================== // UNALIGNED VERSIONS : -#if defined(__RADX86__) || defined(__RADPPC__) // platforms where unaligned is fast : +#if defined(__RADX86__) || \ + defined(__RADPPC__) // platforms where unaligned is fast : -#define RR_GET32_BE_UNALIGNED(ptr) RR_GET32_BE(ptr) -#define RR_GET32_BE_UNALIGNED_OFFSET(ptr,offset) RR_GET32_BE_OFFSET(ptr,offset) -#define RR_GET16_BE_UNALIGNED(ptr) RR_GET16_BE(ptr) -#define RR_GET16_BE_UNALIGNED_OFFSET(ptr,offset) RR_GET16_BE_OFFSET(ptr,offset) +#define RR_GET32_BE_UNALIGNED(ptr) RR_GET32_BE(ptr) +#define RR_GET32_BE_UNALIGNED_OFFSET(ptr, offset) \ + RR_GET32_BE_OFFSET(ptr, offset) +#define RR_GET16_BE_UNALIGNED(ptr) RR_GET16_BE(ptr) +#define RR_GET16_BE_UNALIGNED_OFFSET(ptr, offset) \ + RR_GET16_BE_OFFSET(ptr, offset) -#define RR_GET32_LE_UNALIGNED(ptr) RR_GET32_LE(ptr) -#define RR_GET32_LE_UNALIGNED_OFFSET(ptr,offset) RR_GET32_LE_OFFSET(ptr,offset) -#define RR_GET16_LE_UNALIGNED(ptr) RR_GET16_LE(ptr) -#define RR_GET16_LE_UNALIGNED_OFFSET(ptr,offset) RR_GET16_LE_OFFSET(ptr,offset) +#define RR_GET32_LE_UNALIGNED(ptr) RR_GET32_LE(ptr) +#define RR_GET32_LE_UNALIGNED_OFFSET(ptr, offset) \ + RR_GET32_LE_OFFSET(ptr, offset) +#define RR_GET16_LE_UNALIGNED(ptr) RR_GET16_LE(ptr) +#define RR_GET16_LE_UNALIGNED_OFFSET(ptr, offset) \ + RR_GET16_LE_OFFSET(ptr, offset) #elif defined(__RAD3DS__) // arm has a "__packed" qualifier to tell the compiler to do unaligned accesses -#define RR_U16_PTR_OFFSET_UNALIGNED(ptr,offset) ((__packed U16 * RR_GET_PTR_POST)((char *)(ptr) + (offset))) -#define RR_U32_PTR_OFFSET_UNALIGNED(ptr,offset) ((__packed U32 * RR_GET_PTR_POST)((char *)(ptr) + (offset))) +#define RR_U16_PTR_OFFSET_UNALIGNED(ptr, offset) \ + ((__packed U16 * RR_GET_PTR_POST)((char *)(ptr) + (offset))) +#define RR_U32_PTR_OFFSET_UNALIGNED(ptr, offset) \ + ((__packed U32 * RR_GET_PTR_POST)((char *)(ptr) + (offset))) -#define RR_GET32_BE_UNALIGNED(ptr) __rev(*RR_U32_PTR_OFFSET_UNALIGNED(ptr,0)) -#define RR_GET32_BE_UNALIGNED_OFFSET(ptr,offset) __rev(*RR_U32_PTR_OFFSET_UNALIGNED(ptr,offset)) -#define RR_GET16_BE_UNALIGNED(ptr) __rev16(*RR_U16_PTR_OFFSET_UNALIGNED(ptr,0)) -#define RR_GET16_BE_UNALIGNED_OFFSET(ptr,offset) __rev16(*RR_U16_PTR_OFFSET_UNALIGNED(ptr,offset)) +#define RR_GET32_BE_UNALIGNED(ptr) __rev(*RR_U32_PTR_OFFSET_UNALIGNED(ptr, 0)) +#define RR_GET32_BE_UNALIGNED_OFFSET(ptr, offset) \ + __rev(*RR_U32_PTR_OFFSET_UNALIGNED(ptr, offset)) +#define RR_GET16_BE_UNALIGNED(ptr) __rev16(*RR_U16_PTR_OFFSET_UNALIGNED(ptr, 0)) +#define RR_GET16_BE_UNALIGNED_OFFSET(ptr, offset) \ + __rev16(*RR_U16_PTR_OFFSET_UNALIGNED(ptr, offset)) -#define RR_GET32_LE_UNALIGNED(ptr) *RR_U32_PTR_OFFSET_UNALIGNED(ptr,0) -#define RR_GET32_LE_UNALIGNED_OFFSET(ptr,offset) *RR_U32_PTR_OFFSET_UNALIGNED(ptr,offset) -#define RR_GET16_LE_UNALIGNED(ptr) *RR_U16_PTR_OFFSET_UNALIGNED(ptr,0) -#define RR_GET16_LE_UNALIGNED_OFFSET(ptr,offset) *RR_U16_PTR_OFFSET_UNALIGNED(ptr,offset) +#define RR_GET32_LE_UNALIGNED(ptr) *RR_U32_PTR_OFFSET_UNALIGNED(ptr, 0) +#define RR_GET32_LE_UNALIGNED_OFFSET(ptr, offset) \ + *RR_U32_PTR_OFFSET_UNALIGNED(ptr, offset) +#define RR_GET16_LE_UNALIGNED(ptr) *RR_U16_PTR_OFFSET_UNALIGNED(ptr, 0) +#define RR_GET16_LE_UNALIGNED_OFFSET(ptr, offset) \ + *RR_U16_PTR_OFFSET_UNALIGNED(ptr, offset) #elif defined(__RADPSP2__) -#define RR_U16_PTR_OFFSET_UNALIGNED(ptr,offset) ((U16 __unaligned * RR_GET_PTR_POST)((char *)(ptr) + (offset))) -#define RR_U32_PTR_OFFSET_UNALIGNED(ptr,offset) ((U32 __unaligned * RR_GET_PTR_POST)((char *)(ptr) + (offset))) +#define RR_U16_PTR_OFFSET_UNALIGNED(ptr, offset) \ + ((U16 __unaligned * RR_GET_PTR_POST)((char *)(ptr) + (offset))) +#define RR_U32_PTR_OFFSET_UNALIGNED(ptr, offset) \ + ((U32 __unaligned * RR_GET_PTR_POST)((char *)(ptr) + (offset))) -#define RR_GET32_BE_UNALIGNED(ptr) RR_BSWAP32(*RR_U32_PTR_OFFSET_UNALIGNED(ptr,0)) -#define RR_GET32_BE_UNALIGNED_OFFSET(ptr,offset) RR_BSWAP32(*RR_U32_PTR_OFFSET_UNALIGNED(ptr,offset)) -#define RR_GET16_BE_UNALIGNED(ptr) RR_BSWAP16(*RR_U16_PTR_OFFSET_UNALIGNED(ptr,0)) -#define RR_GET16_BE_UNALIGNED_OFFSET(ptr,offset) RR_BSWAP16(*RR_U16_PTR_OFFSET_UNALIGNED(ptr,offset)) +#define RR_GET32_BE_UNALIGNED(ptr) \ + RR_BSWAP32(*RR_U32_PTR_OFFSET_UNALIGNED(ptr, 0)) +#define RR_GET32_BE_UNALIGNED_OFFSET(ptr, offset) \ + RR_BSWAP32(*RR_U32_PTR_OFFSET_UNALIGNED(ptr, offset)) +#define RR_GET16_BE_UNALIGNED(ptr) \ + RR_BSWAP16(*RR_U16_PTR_OFFSET_UNALIGNED(ptr, 0)) +#define RR_GET16_BE_UNALIGNED_OFFSET(ptr, offset) \ + RR_BSWAP16(*RR_U16_PTR_OFFSET_UNALIGNED(ptr, offset)) -#define RR_GET32_LE_UNALIGNED(ptr) *RR_U32_PTR_OFFSET_UNALIGNED(ptr,0) -#define RR_GET32_LE_UNALIGNED_OFFSET(ptr,offset) *RR_U32_PTR_OFFSET_UNALIGNED(ptr,offset) -#define RR_GET16_LE_UNALIGNED(ptr) *RR_U16_PTR_OFFSET_UNALIGNED(ptr,0) -#define RR_GET16_LE_UNALIGNED_OFFSET(ptr,offset) *RR_U16_PTR_OFFSET_UNALIGNED(ptr,offset) +#define RR_GET32_LE_UNALIGNED(ptr) *RR_U32_PTR_OFFSET_UNALIGNED(ptr, 0) +#define RR_GET32_LE_UNALIGNED_OFFSET(ptr, offset) \ + *RR_U32_PTR_OFFSET_UNALIGNED(ptr, offset) +#define RR_GET16_LE_UNALIGNED(ptr) *RR_U16_PTR_OFFSET_UNALIGNED(ptr, 0) +#define RR_GET16_LE_UNALIGNED_OFFSET(ptr, offset) \ + *RR_U16_PTR_OFFSET_UNALIGNED(ptr, offset) #else // Unaligned via bytes : -#define RR_GET32_BE_UNALIGNED(ptr) ( \ - ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr)))[0] << 24 ) | \ - ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr)))[1] << 16 ) | \ - ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr)))[2] << 8 ) | \ - ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr)))[3] << 0 ) ) +#define RR_GET32_BE_UNALIGNED(ptr) \ + (((U32)(((const U8 *RR_GET_PTR_POST)(ptr)))[0] << 24) | \ + ((U32)(((const U8 *RR_GET_PTR_POST)(ptr)))[1] << 16) | \ + ((U32)(((const U8 *RR_GET_PTR_POST)(ptr)))[2] << 8) | \ + ((U32)(((const U8 *RR_GET_PTR_POST)(ptr)))[3] << 0)) -#define RR_GET32_BE_UNALIGNED_OFFSET(ptr,offset) ( \ - ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr))+(offset))[0] << 24 ) | \ - ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr))+(offset))[1] << 16 ) | \ - ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr))+(offset))[2] << 8 ) | \ - ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr))+(offset))[3] << 0 ) ) +#define RR_GET32_BE_UNALIGNED_OFFSET(ptr, offset) \ + (((U32)(((const U8 *RR_GET_PTR_POST)(ptr)) + (offset))[0] << 24) | \ + ((U32)(((const U8 *RR_GET_PTR_POST)(ptr)) + (offset))[1] << 16) | \ + ((U32)(((const U8 *RR_GET_PTR_POST)(ptr)) + (offset))[2] << 8) | \ + ((U32)(((const U8 *RR_GET_PTR_POST)(ptr)) + (offset))[3] << 0)) -#define RR_GET16_BE_UNALIGNED(ptr) ( \ - ( (U16)(((const U8 * RR_GET_PTR_POST)(ptr)))[0] << 8 ) | \ - ( (U16)(((const U8 * RR_GET_PTR_POST)(ptr)))[1] << 0 ) ) +#define RR_GET16_BE_UNALIGNED(ptr) \ + (((U16)(((const U8 *RR_GET_PTR_POST)(ptr)))[0] << 8) | \ + ((U16)(((const U8 *RR_GET_PTR_POST)(ptr)))[1] << 0)) -#define RR_GET16_BE_UNALIGNED_OFFSET(ptr,offset) ( \ - ( (U16)(((const U8 * RR_GET_PTR_POST)(ptr))+(offset))[0] << 8 ) | \ - ( (U16)(((const U8 * RR_GET_PTR_POST)(ptr))+(offset))[1] << 0 ) ) +#define RR_GET16_BE_UNALIGNED_OFFSET(ptr, offset) \ + (((U16)(((const U8 *RR_GET_PTR_POST)(ptr)) + (offset))[0] << 8) | \ + ((U16)(((const U8 *RR_GET_PTR_POST)(ptr)) + (offset))[1] << 0)) -#define RR_GET32_LE_UNALIGNED(ptr) ( \ - ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr)))[3] << 24 ) | \ - ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr)))[2] << 16 ) | \ - ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr)))[1] << 8 ) | \ - ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr)))[0] << 0 ) ) +#define RR_GET32_LE_UNALIGNED(ptr) \ + (((U32)(((const U8 *RR_GET_PTR_POST)(ptr)))[3] << 24) | \ + ((U32)(((const U8 *RR_GET_PTR_POST)(ptr)))[2] << 16) | \ + ((U32)(((const U8 *RR_GET_PTR_POST)(ptr)))[1] << 8) | \ + ((U32)(((const U8 *RR_GET_PTR_POST)(ptr)))[0] << 0)) -#define RR_GET32_LE_UNALIGNED_OFFSET(ptr,offset) ( \ - ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr))+(offset))[3] << 24 ) | \ - ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr))+(offset))[2] << 16 ) | \ - ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr))+(offset))[1] << 8 ) | \ - ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr))+(offset))[0] << 0 ) ) +#define RR_GET32_LE_UNALIGNED_OFFSET(ptr, offset) \ + (((U32)(((const U8 *RR_GET_PTR_POST)(ptr)) + (offset))[3] << 24) | \ + ((U32)(((const U8 *RR_GET_PTR_POST)(ptr)) + (offset))[2] << 16) | \ + ((U32)(((const U8 *RR_GET_PTR_POST)(ptr)) + (offset))[1] << 8) | \ + ((U32)(((const U8 *RR_GET_PTR_POST)(ptr)) + (offset))[0] << 0)) -#define RR_GET16_LE_UNALIGNED(ptr) ( \ - ( (U16)(((const U8 * RR_GET_PTR_POST)(ptr)))[1] << 8 ) | \ - ( (U16)(((const U8 * RR_GET_PTR_POST)(ptr)))[0] << 0 ) ) +#define RR_GET16_LE_UNALIGNED(ptr) \ + (((U16)(((const U8 *RR_GET_PTR_POST)(ptr)))[1] << 8) | \ + ((U16)(((const U8 *RR_GET_PTR_POST)(ptr)))[0] << 0)) -#define RR_GET16_LE_UNALIGNED_OFFSET(ptr,offset) ( \ - ( (U16)(((const U8 * RR_GET_PTR_POST)(ptr))+(offset))[1] << 8 ) | \ - ( (U16)(((const U8 * RR_GET_PTR_POST)(ptr))+(offset))[0] << 0 ) ) +#define RR_GET16_LE_UNALIGNED_OFFSET(ptr, offset) \ + (((U16)(((const U8 *RR_GET_PTR_POST)(ptr)) + (offset))[1] << 8) | \ + ((U16)(((const U8 *RR_GET_PTR_POST)(ptr)) + (offset))[0] << 0)) #endif @@ -2222,54 +2328,56 @@ void __storewordbytereverse (unsigned int val, int offset, void *bas #ifdef _MSC_VER - unsigned long __cdecl _lrotl(unsigned long, int); - #pragma intrinsic(_lrotl) +unsigned long __cdecl _lrotl(unsigned long, int); +#pragma intrinsic(_lrotl) - #define RR_ROTL32(x,k) _lrotl((unsigned long)(x),(int)(k)) +#define RR_ROTL32(x, k) _lrotl((unsigned long)(x), (int)(k)) -#elif defined(__RADCELL__) || defined(__RADLINUX__) || defined(__RADWII__) || defined(__RADMACAPI__) || defined(__RADWIIU__) || defined(__RADPS4__) || defined(__RADPSP2__) +#elif defined(__RADCELL__) || defined(__RADLINUX__) || defined(__RADWII__) || \ + defined(__RADMACAPI__) || defined(__RADWIIU__) || defined(__RADPS4__) || \ + defined(__RADPSP2__) - // Compiler turns this into rotate correctly : - #define RR_ROTL32(u32,num) ( ( (u32) << (num) ) | ( (u32) >> (32 - (num))) ) +// Compiler turns this into rotate correctly : +#define RR_ROTL32(u32, num) (((u32) << (num)) | ((u32) >> (32 - (num)))) #elif defined(__RAD3DS__) - #define RR_ROTL32(u32,num) __ror(u32, (-(num))&31) +#define RR_ROTL32(u32, num) __ror(u32, (-(num)) & 31) #else // comment out fallbacks so users will get errors // fallback implementation using shift and or : -//#define RR_ROTL32(u32,num) ( ( (u32) << (num) ) | ( (u32) >> (32 - (num))) ) +// #define RR_ROTL32(u32,num) ( ( (u32) << (num) ) | ( (u32) >> (32 - (num))) ) #endif - //=================================================================== // RR_ROTL64 : 64-bit rotate -#if ( defined(_MSC_VER) && _MSC_VER >= 1300) +#if (defined(_MSC_VER) && _MSC_VER >= 1300) unsigned int64_t __cdecl _rotl64(unsigned int64_t _Val, int _Shift); #pragma intrinsic(_rotl64) -#define RR_ROTL64(x,k) _rotl64((unsigned int64_t)(x),(int)(k)) +#define RR_ROTL64(x, k) _rotl64((unsigned int64_t)(x), (int)(k)) #elif defined(__RADCELL__) // PS3 GCC turns this into rotate correctly : -#define RR_ROTL64(u64,num) ( ( (u64) << (num) ) | ( (u64) >> (64 - (num))) ) +#define RR_ROTL64(u64, num) (((u64) << (num)) | ((u64) >> (64 - (num)))) #elif defined(__RADLINUX__) || defined(__RADMACAPI__) -//APTODO: Just to compile linux. Should we be doing better than this? If not, combine with above. -#define RR_ROTL64(u64,num) ( ( (u64) << (num) ) | ( (u64) >> (64 - (num))) ) +// APTODO: Just to compile linux. Should we be doing better than this? If not, +// combine with above. +#define RR_ROTL64(u64, num) (((u64) << (num)) | ((u64) >> (64 - (num)))) #else // comment out fallbacks so users will get errors // fallback implementation using shift and or : -//#define RR_ROTL64(u64,num) ( ( (u64) << (num) ) | ( (u64) >> (64 - (num))) ) +// #define RR_ROTL64(u64,num) ( ( (u64) << (num) ) | ( (u64) >> (64 - (num))) ) #endif @@ -2281,42 +2389,49 @@ RADDEFEND // RR_COMPILER_ASSERT #if defined(__cplusplus) && !defined(RR_COMPILER_ASSERT) - #if defined(_MSC_VER) && (_MSC_VER >=1400) +#if defined(_MSC_VER) && (_MSC_VER >= 1400) - // better version of COMPILER_ASSERT using boost technique - template struct RR_COMPILER_ASSERT_FAILURE; +// better version of COMPILER_ASSERT using boost technique +template +struct RR_COMPILER_ASSERT_FAILURE; - template <> struct RR_COMPILER_ASSERT_FAILURE<1> { enum { value = 1 }; }; +template <> +struct RR_COMPILER_ASSERT_FAILURE<1> { + enum { value = 1 }; +}; - template struct rr_compiler_assert_test{}; +template +struct rr_compiler_assert_test {}; - // __LINE__ macro broken when -ZI is used see Q199057 - #define RR_COMPILER_ASSERT( B ) \ - typedef rr_compiler_assert_test<\ - sizeof(RR_COMPILER_ASSERT_FAILURE< (B) ? 1 : 0 >)\ - > rr_compiler_assert_typedef_ +// __LINE__ macro broken when -ZI is used see Q199057 +#define RR_COMPILER_ASSERT(B) \ + typedef rr_compiler_assert_test)> \ + rr_compiler_assert_typedef_ - #endif +#endif #endif #ifndef RR_COMPILER_ASSERT - // this happens at declaration time, so if it's inside a function in a C file, drop {} around it - #define RR_COMPILER_ASSERT(exp) typedef char RR_STRING_JOIN(_dummy_array, __LINE__) [ (exp) ? 1 : -1 ] +// this happens at declaration time, so if it's inside a function in a C file, +// drop {} around it +#define RR_COMPILER_ASSERT(exp) \ + typedef char RR_STRING_JOIN(_dummy_array, __LINE__)[(exp) ? 1 : -1] #endif //=================================================================== // some error checks : - RR_COMPILER_ASSERT( sizeof(RAD_UINTa) == sizeof( RR_STRING_JOIN(RAD_U,RAD_PTRBITS) ) ); - RR_COMPILER_ASSERT( sizeof(RAD_UINTa) == RAD_PTRBYTES ); - RR_COMPILER_ASSERT( RAD_TWOPTRBYTES == 2* RAD_PTRBYTES ); +RR_COMPILER_ASSERT(sizeof(RAD_UINTa) == + sizeof(RR_STRING_JOIN(RAD_U, RAD_PTRBITS))); +RR_COMPILER_ASSERT(sizeof(RAD_UINTa) == RAD_PTRBYTES); +RR_COMPILER_ASSERT(RAD_TWOPTRBYTES == 2 * RAD_PTRBYTES); //=================================================================== - #endif // __RADRES__ - -//include "testconstant.inl" // uncomment and include to test statement constants - -#endif // __RADRR_COREH__ +#endif // __RADRES__ +// include "testconstant.inl" // uncomment and include to test statement +// constants +#endif // __RADRR_COREH__ diff --git a/targets/app/windows/Windows64_App.cpp b/targets/app/windows/Windows64_App.cpp index 8a1ef2297..bf7a50f45 100644 --- a/targets/app/windows/Windows64_App.cpp +++ b/targets/app/windows/Windows64_App.cpp @@ -1,6 +1,5 @@  #include "WindowsGame.h" - #include "app/common/Game.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/User.h" @@ -20,7 +19,7 @@ WindowsGame::WindowsGame() : Game() {} void WindowsGame::SetRichPresenceContext(int iPad, int contextId) { PlatformProfile.SetRichPresenceContextValue(iPad, CONTEXT_GAME_STATE, - contextId); + contextId); } void WindowsGame::StoreLaunchData() {} @@ -29,12 +28,11 @@ void WindowsGame::FatalLoadError() {} void WindowsGame::CaptureSaveThumbnail() {} void WindowsGame::GetSaveThumbnail(std::uint8_t** thumbnailData, - unsigned int* thumbnailSize) {} + unsigned int* thumbnailSize) {} void WindowsGame::ReleaseSaveThumbnail() {} -void WindowsGame::GetScreenshot(int iPad, - std::uint8_t** screenshotData, - unsigned int* screenshotSize) {} +void WindowsGame::GetScreenshot(int iPad, std::uint8_t** screenshotData, + unsigned int* screenshotSize) {} void WindowsGame::TemporaryCreateGameStart() { ////////////////////////////////////////////////////////////////////////////////////////////// @@ -113,15 +111,14 @@ void WindowsGame::TemporaryCreateGameStart() { } int WindowsGame::GetLocalTMSFileIndex(char* wchTMSFile, - bool bFilenameIncludesExtension, - eFileExtensionType eEXT) { + bool bFilenameIncludesExtension, + eFileExtensionType eEXT) { return -1; } int WindowsGame::LoadLocalTMSFile(char* wchTMSFile) { return -1; } -int WindowsGame::LoadLocalTMSFile(char* wchTMSFile, - eFileExtensionType eExt) { +int WindowsGame::LoadLocalTMSFile(char* wchTMSFile, eFileExtensionType eExt) { return -1; } diff --git a/targets/app/windows/Windows64_UIController.cpp b/targets/app/windows/Windows64_UIController.cpp index 5b1a825ad..a1056d9e8 100644 --- a/targets/app/windows/Windows64_UIController.cpp +++ b/targets/app/windows/Windows64_UIController.cpp @@ -150,7 +150,8 @@ GDrawTexture* ConsoleUIController::getSubstitutionTexture(int textureId) { this texture, or stream video into it. Wrapped textures take up a handle. They will never be freed or otherwise modified by GDraw; nor will GDraw change any reference counts. All this is up to the application. */ - ID3D11ShaderResourceView* tex = PlatformRenderer.TextureGetTexture(textureId); + ID3D11ShaderResourceView* tex = + PlatformRenderer.TextureGetTexture(textureId); ID3D11Resource* resource; tex->GetResource(&resource); ID3D11Texture2D* tex2d = (ID3D11Texture2D*)resource; diff --git a/targets/app/windows/WindowsGame.h b/targets/app/windows/WindowsGame.h index f04abc674..d7a31afc6 100644 --- a/targets/app/windows/WindowsGame.h +++ b/targets/app/windows/WindowsGame.h @@ -36,4 +36,3 @@ public: }; extern WindowsGame app; - diff --git a/targets/app/windows/XML/ATGXmlParser.h b/targets/app/windows/XML/ATGXmlParser.h index 2b8dabbe0..45ebfaee1 100644 --- a/targets/app/windows/XML/ATGXmlParser.h +++ b/targets/app/windows/XML/ATGXmlParser.h @@ -50,8 +50,8 @@ class ISAXCallback { friend class XMLParser; public: - ISAXCallback() {}; - virtual ~ISAXCallback() {}; + ISAXCallback(){}; + virtual ~ISAXCallback(){}; virtual int32_t StartDocument() = 0; virtual int32_t EndDocument() = 0; diff --git a/targets/app/windows/XML/xmlFilesCallback.h b/targets/app/windows/XML/xmlFilesCallback.h index f3d940f73..06d5fd3bc 100644 --- a/targets/app/windows/XML/xmlFilesCallback.h +++ b/targets/app/windows/XML/xmlFilesCallback.h @@ -58,8 +58,8 @@ public: // if the xuid hasn't been defined, then we can't use the data if (xuid != 0LL) { - return Game::RegisterMojangData( - wNameXUID, xuid, wNameSkin, wNameCloak); + return Game::RegisterMojangData(wNameXUID, xuid, wNameSkin, + wNameCloak); } else return 1; } else { @@ -136,8 +136,7 @@ public: printf("Type - %s, Value - %d, ", wType, iValue); #endif - return Game::RegisterConfigValues(wType, - iValue); + return Game::RegisterConfigValues(wType, iValue); } else { return 1; } @@ -267,9 +266,9 @@ public: #endif app.DebugPrintf("Full = %lld, Trial %lld\n", ullFull, ullTrial); - return Game::RegisterDLCData( - wType, wNameBanner, iGender, ullFull, ullTrial, wFirstSkin, - uiSortIndex, iConfig, wDataFile); + return Game::RegisterDLCData(wType, wNameBanner, iGender, + ullFull, ullTrial, wFirstSkin, + uiSortIndex, iConfig, wDataFile); } else { return 1; } diff --git a/targets/app/windows/src/Windows64_Minecraft.cpp b/targets/app/windows/src/Windows64_Minecraft.cpp index c71f2e217..7563ecbfc 100644 --- a/targets/app/windows/src/Windows64_Minecraft.cpp +++ b/targets/app/windows/src/Windows64_Minecraft.cpp @@ -6,7 +6,6 @@ #include #include "app/common/Network/Socket.h" -#include "util/StringHelpers.h" #include "minecraft/client/User.h" #include "minecraft/client/multiplayer/ClientConnection.h" #include "minecraft/client/multiplayer/ConnectScreen.h" @@ -19,20 +18,20 @@ #include "minecraft/world/item/crafting/Recipes.h" #include "minecraft/world/item/crafting/Recipy.h" #include "minecraft/world/level/Level.h" - #include "minecraft/world/phys/AABB.h" #include "minecraft/world/phys/Vec3.h" +#include "util/StringHelpers.h" // #include "Social/SocialManager.h" // #include "app/common/Leaderboards/LeaderboardManager.h" // #include "../Common/XUI/XUI_Scene_Container.h" // #include "NetworkManager.h" #include "../Resource.h" #include "Sentient/SentientManager.h" -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "minecraft/client/Options.h" #include "minecraft/client/renderer/Tesselator.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/world/level/chunk/storage/OldChunkStorage.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" HINSTANCE hMyInst; LRESULT CALLBACK DlgProc(HWND hWndDlg, uint32_t Msg, WPARAM wParam, @@ -75,17 +74,17 @@ void DefineActions(void) { // Split into Menu actions, and in-game actions PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_A, - _360_JOY_BUTTON_A); + _360_JOY_BUTTON_A); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_B, - _360_JOY_BUTTON_B); + _360_JOY_BUTTON_B); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_X, - _360_JOY_BUTTON_X); + _360_JOY_BUTTON_X); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_Y, - _360_JOY_BUTTON_Y); + _360_JOY_BUTTON_Y); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OK, - _360_JOY_BUTTON_A); + _360_JOY_BUTTON_A); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_CANCEL, - _360_JOY_BUTTON_B); + _360_JOY_BUTTON_B); PlatformInput.SetGameJoypadMaps( MAP_STYLE_0, ACTION_MENU_UP, _360_JOY_BUTTON_DPAD_UP | _360_JOY_BUTTON_LSTICK_UP); @@ -99,92 +98,92 @@ void DefineActions(void) { MAP_STYLE_0, ACTION_MENU_RIGHT, _360_JOY_BUTTON_DPAD_RIGHT | _360_JOY_BUTTON_LSTICK_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_PAGEUP, - _360_JOY_BUTTON_LT); + _360_JOY_BUTTON_LT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_PAGEDOWN, - _360_JOY_BUTTON_RT); + _360_JOY_BUTTON_RT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_RIGHT_SCROLL, - _360_JOY_BUTTON_RB); + _360_JOY_BUTTON_RB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_LEFT_SCROLL, - _360_JOY_BUTTON_LB); + _360_JOY_BUTTON_LB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_PAUSEMENU, - _360_JOY_BUTTON_START); + _360_JOY_BUTTON_START); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_STICK_PRESS, - _360_JOY_BUTTON_LTHUMB); + _360_JOY_BUTTON_LTHUMB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OTHER_STICK_PRESS, - _360_JOY_BUTTON_RTHUMB); + _360_JOY_BUTTON_RTHUMB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OTHER_STICK_UP, - _360_JOY_BUTTON_RSTICK_UP); + _360_JOY_BUTTON_RSTICK_UP); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OTHER_STICK_DOWN, - _360_JOY_BUTTON_RSTICK_DOWN); + _360_JOY_BUTTON_RSTICK_DOWN); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OTHER_STICK_LEFT, - _360_JOY_BUTTON_RSTICK_LEFT); + _360_JOY_BUTTON_RSTICK_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OTHER_STICK_RIGHT, - _360_JOY_BUTTON_RSTICK_RIGHT); + _360_JOY_BUTTON_RSTICK_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_JUMP, - _360_JOY_BUTTON_A); + _360_JOY_BUTTON_A); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_FORWARD, - _360_JOY_BUTTON_LSTICK_UP); + _360_JOY_BUTTON_LSTICK_UP); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_BACKWARD, - _360_JOY_BUTTON_LSTICK_DOWN); + _360_JOY_BUTTON_LSTICK_DOWN); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LEFT, - _360_JOY_BUTTON_LSTICK_LEFT); + _360_JOY_BUTTON_LSTICK_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_RIGHT, - _360_JOY_BUTTON_LSTICK_RIGHT); + _360_JOY_BUTTON_LSTICK_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LOOK_LEFT, - _360_JOY_BUTTON_RSTICK_LEFT); + _360_JOY_BUTTON_RSTICK_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LOOK_RIGHT, - _360_JOY_BUTTON_RSTICK_RIGHT); + _360_JOY_BUTTON_RSTICK_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LOOK_UP, - _360_JOY_BUTTON_RSTICK_UP); + _360_JOY_BUTTON_RSTICK_UP); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LOOK_DOWN, - _360_JOY_BUTTON_RSTICK_DOWN); + _360_JOY_BUTTON_RSTICK_DOWN); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_USE, - _360_JOY_BUTTON_LT); + _360_JOY_BUTTON_LT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_ACTION, - _360_JOY_BUTTON_RT); + _360_JOY_BUTTON_RT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_RIGHT_SCROLL, - _360_JOY_BUTTON_RB); + _360_JOY_BUTTON_RB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LEFT_SCROLL, - _360_JOY_BUTTON_LB); + _360_JOY_BUTTON_LB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_INVENTORY, - _360_JOY_BUTTON_Y); + _360_JOY_BUTTON_Y); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_PAUSEMENU, - _360_JOY_BUTTON_START); + _360_JOY_BUTTON_START); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_DROP, - _360_JOY_BUTTON_B); + _360_JOY_BUTTON_B); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_SNEAK_TOGGLE, - _360_JOY_BUTTON_RTHUMB); + _360_JOY_BUTTON_RTHUMB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_CRAFTING, - _360_JOY_BUTTON_X); + _360_JOY_BUTTON_X); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, - MINECRAFT_ACTION_RENDER_THIRD_PERSON, - _360_JOY_BUTTON_LTHUMB); + MINECRAFT_ACTION_RENDER_THIRD_PERSON, + _360_JOY_BUTTON_LTHUMB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_GAME_INFO, - _360_JOY_BUTTON_BACK); + _360_JOY_BUTTON_BACK); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_DPAD_LEFT, - _360_JOY_BUTTON_DPAD_LEFT); + _360_JOY_BUTTON_DPAD_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_DPAD_RIGHT, - _360_JOY_BUTTON_DPAD_RIGHT); + _360_JOY_BUTTON_DPAD_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_DPAD_UP, - _360_JOY_BUTTON_DPAD_UP); + _360_JOY_BUTTON_DPAD_UP); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_DPAD_DOWN, - _360_JOY_BUTTON_DPAD_DOWN); + _360_JOY_BUTTON_DPAD_DOWN); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_A, - _360_JOY_BUTTON_A); + _360_JOY_BUTTON_A); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_B, - _360_JOY_BUTTON_B); + _360_JOY_BUTTON_B); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_X, - _360_JOY_BUTTON_X); + _360_JOY_BUTTON_X); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_Y, - _360_JOY_BUTTON_Y); + _360_JOY_BUTTON_Y); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OK, - _360_JOY_BUTTON_A); + _360_JOY_BUTTON_A); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_CANCEL, - _360_JOY_BUTTON_B); + _360_JOY_BUTTON_B); PlatformInput.SetGameJoypadMaps( MAP_STYLE_1, ACTION_MENU_UP, _360_JOY_BUTTON_DPAD_UP | _360_JOY_BUTTON_LSTICK_UP); @@ -198,92 +197,92 @@ void DefineActions(void) { MAP_STYLE_1, ACTION_MENU_RIGHT, _360_JOY_BUTTON_DPAD_RIGHT | _360_JOY_BUTTON_LSTICK_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_PAGEUP, - _360_JOY_BUTTON_LB); + _360_JOY_BUTTON_LB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_PAGEDOWN, - _360_JOY_BUTTON_RT); + _360_JOY_BUTTON_RT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_RIGHT_SCROLL, - _360_JOY_BUTTON_RB); + _360_JOY_BUTTON_RB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_LEFT_SCROLL, - _360_JOY_BUTTON_LB); + _360_JOY_BUTTON_LB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_PAUSEMENU, - _360_JOY_BUTTON_START); + _360_JOY_BUTTON_START); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_STICK_PRESS, - _360_JOY_BUTTON_LTHUMB); + _360_JOY_BUTTON_LTHUMB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OTHER_STICK_PRESS, - _360_JOY_BUTTON_RTHUMB); + _360_JOY_BUTTON_RTHUMB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OTHER_STICK_UP, - _360_JOY_BUTTON_RSTICK_UP); + _360_JOY_BUTTON_RSTICK_UP); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OTHER_STICK_DOWN, - _360_JOY_BUTTON_RSTICK_DOWN); + _360_JOY_BUTTON_RSTICK_DOWN); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OTHER_STICK_LEFT, - _360_JOY_BUTTON_RSTICK_LEFT); + _360_JOY_BUTTON_RSTICK_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OTHER_STICK_RIGHT, - _360_JOY_BUTTON_RSTICK_RIGHT); + _360_JOY_BUTTON_RSTICK_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_JUMP, - _360_JOY_BUTTON_RB); + _360_JOY_BUTTON_RB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_FORWARD, - _360_JOY_BUTTON_LSTICK_UP); + _360_JOY_BUTTON_LSTICK_UP); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_BACKWARD, - _360_JOY_BUTTON_LSTICK_DOWN); + _360_JOY_BUTTON_LSTICK_DOWN); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LEFT, - _360_JOY_BUTTON_LSTICK_LEFT); + _360_JOY_BUTTON_LSTICK_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_RIGHT, - _360_JOY_BUTTON_LSTICK_RIGHT); + _360_JOY_BUTTON_LSTICK_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LOOK_LEFT, - _360_JOY_BUTTON_RSTICK_LEFT); + _360_JOY_BUTTON_RSTICK_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LOOK_RIGHT, - _360_JOY_BUTTON_RSTICK_RIGHT); + _360_JOY_BUTTON_RSTICK_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LOOK_UP, - _360_JOY_BUTTON_RSTICK_UP); + _360_JOY_BUTTON_RSTICK_UP); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LOOK_DOWN, - _360_JOY_BUTTON_RSTICK_DOWN); + _360_JOY_BUTTON_RSTICK_DOWN); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_USE, - _360_JOY_BUTTON_RT); + _360_JOY_BUTTON_RT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_ACTION, - _360_JOY_BUTTON_LT); + _360_JOY_BUTTON_LT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_RIGHT_SCROLL, - _360_JOY_BUTTON_DPAD_RIGHT); + _360_JOY_BUTTON_DPAD_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LEFT_SCROLL, - _360_JOY_BUTTON_DPAD_LEFT); + _360_JOY_BUTTON_DPAD_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_INVENTORY, - _360_JOY_BUTTON_Y); + _360_JOY_BUTTON_Y); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_PAUSEMENU, - _360_JOY_BUTTON_START); + _360_JOY_BUTTON_START); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_DROP, - _360_JOY_BUTTON_B); + _360_JOY_BUTTON_B); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_SNEAK_TOGGLE, - _360_JOY_BUTTON_LTHUMB); + _360_JOY_BUTTON_LTHUMB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_CRAFTING, - _360_JOY_BUTTON_X); + _360_JOY_BUTTON_X); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, - MINECRAFT_ACTION_RENDER_THIRD_PERSON, - _360_JOY_BUTTON_RTHUMB); + MINECRAFT_ACTION_RENDER_THIRD_PERSON, + _360_JOY_BUTTON_RTHUMB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_GAME_INFO, - _360_JOY_BUTTON_BACK); + _360_JOY_BUTTON_BACK); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_DPAD_LEFT, - _360_JOY_BUTTON_DPAD_LEFT); + _360_JOY_BUTTON_DPAD_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_DPAD_RIGHT, - _360_JOY_BUTTON_DPAD_RIGHT); + _360_JOY_BUTTON_DPAD_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_DPAD_UP, - _360_JOY_BUTTON_DPAD_UP); + _360_JOY_BUTTON_DPAD_UP); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_DPAD_DOWN, - _360_JOY_BUTTON_DPAD_DOWN); + _360_JOY_BUTTON_DPAD_DOWN); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_A, - _360_JOY_BUTTON_A); + _360_JOY_BUTTON_A); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_B, - _360_JOY_BUTTON_B); + _360_JOY_BUTTON_B); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_X, - _360_JOY_BUTTON_X); + _360_JOY_BUTTON_X); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_Y, - _360_JOY_BUTTON_Y); + _360_JOY_BUTTON_Y); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OK, - _360_JOY_BUTTON_A); + _360_JOY_BUTTON_A); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_CANCEL, - _360_JOY_BUTTON_B); + _360_JOY_BUTTON_B); PlatformInput.SetGameJoypadMaps( MAP_STYLE_2, ACTION_MENU_UP, _360_JOY_BUTTON_DPAD_UP | _360_JOY_BUTTON_LSTICK_UP); @@ -300,77 +299,77 @@ void DefineActions(void) { MAP_STYLE_2, ACTION_MENU_PAGEUP, _360_JOY_BUTTON_DPAD_UP | _360_JOY_BUTTON_LB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_PAGEDOWN, - _360_JOY_BUTTON_RT); + _360_JOY_BUTTON_RT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_RIGHT_SCROLL, - _360_JOY_BUTTON_RB); + _360_JOY_BUTTON_RB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_LEFT_SCROLL, - _360_JOY_BUTTON_LB); + _360_JOY_BUTTON_LB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_JUMP, - _360_JOY_BUTTON_LT); + _360_JOY_BUTTON_LT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_FORWARD, - _360_JOY_BUTTON_LSTICK_UP); + _360_JOY_BUTTON_LSTICK_UP); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_BACKWARD, - _360_JOY_BUTTON_LSTICK_DOWN); + _360_JOY_BUTTON_LSTICK_DOWN); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LEFT, - _360_JOY_BUTTON_LSTICK_LEFT); + _360_JOY_BUTTON_LSTICK_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_RIGHT, - _360_JOY_BUTTON_LSTICK_RIGHT); + _360_JOY_BUTTON_LSTICK_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LOOK_LEFT, - _360_JOY_BUTTON_RSTICK_LEFT); + _360_JOY_BUTTON_RSTICK_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LOOK_RIGHT, - _360_JOY_BUTTON_RSTICK_RIGHT); + _360_JOY_BUTTON_RSTICK_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LOOK_UP, - _360_JOY_BUTTON_RSTICK_UP); + _360_JOY_BUTTON_RSTICK_UP); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LOOK_DOWN, - _360_JOY_BUTTON_RSTICK_DOWN); + _360_JOY_BUTTON_RSTICK_DOWN); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_USE, - _360_JOY_BUTTON_RT); + _360_JOY_BUTTON_RT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_ACTION, - _360_JOY_BUTTON_A); + _360_JOY_BUTTON_A); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_RIGHT_SCROLL, - _360_JOY_BUTTON_DPAD_RIGHT); + _360_JOY_BUTTON_DPAD_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LEFT_SCROLL, - _360_JOY_BUTTON_DPAD_LEFT); + _360_JOY_BUTTON_DPAD_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_INVENTORY, - _360_JOY_BUTTON_Y); + _360_JOY_BUTTON_Y); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_PAUSEMENU, - _360_JOY_BUTTON_START); + _360_JOY_BUTTON_START); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_DROP, - _360_JOY_BUTTON_B); + _360_JOY_BUTTON_B); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_SNEAK_TOGGLE, - _360_JOY_BUTTON_LB); + _360_JOY_BUTTON_LB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_CRAFTING, - _360_JOY_BUTTON_X); + _360_JOY_BUTTON_X); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, - MINECRAFT_ACTION_RENDER_THIRD_PERSON, - _360_JOY_BUTTON_LTHUMB); + MINECRAFT_ACTION_RENDER_THIRD_PERSON, + _360_JOY_BUTTON_LTHUMB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_GAME_INFO, - _360_JOY_BUTTON_BACK); + _360_JOY_BUTTON_BACK); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_PAUSEMENU, - _360_JOY_BUTTON_START); + _360_JOY_BUTTON_START); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_STICK_PRESS, - _360_JOY_BUTTON_LTHUMB); + _360_JOY_BUTTON_LTHUMB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OTHER_STICK_PRESS, - _360_JOY_BUTTON_RTHUMB); + _360_JOY_BUTTON_RTHUMB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OTHER_STICK_UP, - _360_JOY_BUTTON_RSTICK_UP); + _360_JOY_BUTTON_RSTICK_UP); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OTHER_STICK_DOWN, - _360_JOY_BUTTON_RSTICK_DOWN); + _360_JOY_BUTTON_RSTICK_DOWN); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OTHER_STICK_LEFT, - _360_JOY_BUTTON_RSTICK_LEFT); + _360_JOY_BUTTON_RSTICK_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OTHER_STICK_RIGHT, - _360_JOY_BUTTON_RSTICK_RIGHT); + _360_JOY_BUTTON_RSTICK_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_DPAD_LEFT, - _360_JOY_BUTTON_DPAD_LEFT); + _360_JOY_BUTTON_DPAD_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_DPAD_RIGHT, - _360_JOY_BUTTON_DPAD_RIGHT); + _360_JOY_BUTTON_DPAD_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_DPAD_UP, - _360_JOY_BUTTON_DPAD_UP); + _360_JOY_BUTTON_DPAD_UP); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_DPAD_DOWN, - _360_JOY_BUTTON_DPAD_DOWN); + _360_JOY_BUTTON_DPAD_DOWN); } HINSTANCE g_hInst = nullptr; @@ -736,8 +735,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, // no profile data for the player PlatformProfile.SetDefaultOptionsCallback( [](IPlatformProfile::PROFILESETTINGS* pSettings, int iPad) { - return Game::DefaultOptionsCallback(&app, pSettings, - iPad); + return Game::DefaultOptionsCallback(&app, pSettings, iPad); }); // QNet needs to be setup after profile manager, as we do not want its // Notify listener to handle XN_SYS_SIGNINCHANGED notifications. This does diff --git a/targets/java/include/java/ByteBuffer.h b/targets/java/include/java/ByteBuffer.h index 4213b3de1..f088ac0ef 100644 --- a/targets/java/include/java/ByteBuffer.h +++ b/targets/java/include/java/ByteBuffer.h @@ -1,10 +1,10 @@ #pragma once +#include #include #include #include "Buffer.h" -#include class IntBuffer; class FloatBuffer; diff --git a/targets/java/include/java/InputOutputStream/GZIPInputStream.h b/targets/java/include/java/InputOutputStream/GZIPInputStream.h index 6fa590f70..3aa36bcb7 100644 --- a/targets/java/include/java/InputOutputStream/GZIPInputStream.h +++ b/targets/java/include/java/InputOutputStream/GZIPInputStream.h @@ -11,7 +11,7 @@ private: InputStream* stream; public: - GZIPInputStream(InputStream* out) : stream(out) {}; + GZIPInputStream(InputStream* out) : stream(out){}; virtual int read() { return stream->read(); }; virtual int read(std::vector& b) { return stream->read(b); }; virtual int read(std::vector& b, unsigned int offset, diff --git a/targets/java/include/java/InputOutputStream/GZIPOutputStream.h b/targets/java/include/java/InputOutputStream/GZIPOutputStream.h index b7015ee4f..d14e47821 100644 --- a/targets/java/include/java/InputOutputStream/GZIPOutputStream.h +++ b/targets/java/include/java/InputOutputStream/GZIPOutputStream.h @@ -9,7 +9,7 @@ private: OutputStream* stream; public: - GZIPOutputStream(OutputStream* out) : stream(out) {}; + GZIPOutputStream(OutputStream* out) : stream(out){}; virtual void write(unsigned int b) { stream->write(b); }; virtual void write(const std::vector& b) { stream->write(b); }; virtual void write(const std::vector& b, unsigned int offset, diff --git a/targets/java/src/File.cpp b/targets/java/src/File.cpp index ccc96a374..6a05e3caf 100644 --- a/targets/java/src/File.cpp +++ b/targets/java/src/File.cpp @@ -8,9 +8,9 @@ #include #include -#include "util/StringHelpers.h" // 4jcraft TODO -#include "platform/fs/fs.h" #include "java/FileFilter.h" +#include "platform/fs/fs.h" +#include "util/StringHelpers.h" // 4jcraft TODO const char File::pathSeparator = '/'; @@ -20,9 +20,7 @@ const std::string File::pathRoot = namespace { namespace fs = std::filesystem; -fs::path ToFilesystemPath(const std::string& path) { - return fs::path(path); -} +fs::path ToFilesystemPath(const std::string& path) { return fs::path(path); } std::string ToFilename(const fs::path& path) { const std::string filename = path.filename().string(); diff --git a/targets/java/src/InputOutputStream/ByteArrayInputStream.cpp b/targets/java/src/InputOutputStream/ByteArrayInputStream.cpp index c2bf9123f..39f8b1e0d 100644 --- a/targets/java/src/InputOutputStream/ByteArrayInputStream.cpp +++ b/targets/java/src/InputOutputStream/ByteArrayInputStream.cpp @@ -28,10 +28,10 @@ ByteArrayInputStream::ByteArrayInputStream(std::vector& buf) this->buf = buf; } -// 4jcraft: helper function to create a ByteArrayInputStream from a vector of bytes to avoid one copy +// 4jcraft: helper function to create a ByteArrayInputStream from a vector of +// bytes to avoid one copy ByteArrayInputStream::ByteArrayInputStream(std::vector&& buf) - : buf(std::move(buf)), pos(0), count(this->buf.size()), mark(0) { -} + : buf(std::move(buf)), pos(0), count(this->buf.size()), mark(0) {} // Reads the next byte of data from this input stream. The value byte is // returned as an int in the range 0 to 255. If no byte is available because the diff --git a/targets/java/src/InputOutputStream/FileInputStream.cpp b/targets/java/src/InputOutputStream/FileInputStream.cpp index c59f25e81..1522fdb58 100644 --- a/targets/java/src/InputOutputStream/FileInputStream.cpp +++ b/targets/java/src/InputOutputStream/FileInputStream.cpp @@ -7,11 +7,10 @@ #include #include #include +#include #include #include -#include - #include "java/File.h" namespace { @@ -53,7 +52,8 @@ FileInputStream::FileInputStream(const File& file) : m_fileHandle(nullptr) { #if defined(_WIN32) m_fileHandle = _wfopen(file.getPath().c_str(), "rb"); #else - const std::string nativePath = std::filesystem::path(file.getPath()).string(); + const std::string nativePath = + std::filesystem::path(file.getPath()).string(); m_fileHandle = std::fopen(nativePath.c_str(), "rb"); #endif diff --git a/targets/java/src/InputOutputStream/FileOutputStream.cpp b/targets/java/src/InputOutputStream/FileOutputStream.cpp index 59f64750f..82db3bbac 100644 --- a/targets/java/src/InputOutputStream/FileOutputStream.cpp +++ b/targets/java/src/InputOutputStream/FileOutputStream.cpp @@ -2,11 +2,10 @@ #include #include +#include #include #include -#include - #include "java/File.h" // Creates a file output stream to write to the file represented by the @@ -30,7 +29,8 @@ FileOutputStream::FileOutputStream(const File& file) : m_fileHandle(nullptr) { #if defined(_WIN32) m_fileHandle = _wfopen(file.getPath().c_str(), "wb"); #else - const std::string nativePath = std::filesystem::path(file.getPath()).string(); + const std::string nativePath = + std::filesystem::path(file.getPath()).string(); m_fileHandle = std::fopen(nativePath.c_str(), "wb"); #endif diff --git a/targets/minecraft/BuildVer.h b/targets/minecraft/BuildVer.h index 130825af8..fcf6eb240 100644 --- a/targets/minecraft/BuildVer.h +++ b/targets/minecraft/BuildVer.h @@ -48,9 +48,9 @@ #define VER_FILEVERSION_STR2(x, y) \ VER_FILEVERSION_STRING "." VER_FILEBPAD #x "." #y -#define VER_FILEVERSION_STR2_W(x, y) \ - VER_FILEVERSION_STRING_W "." VER_FILEBPAD_W VER_WIDE_PREFIX( \ - #x) "." VER_WIDE_PREFIX(#y) +#define VER_FILEVERSION_STR2_W(x, y) \ + VER_FILEVERSION_STRING_W \ + "." VER_FILEBPAD_W VER_WIDE_PREFIX(#x) "." VER_WIDE_PREFIX(#y) #define VER_FILEVERSION_STR1(x, y) VER_FILEVERSION_STR2(x, y) #define VER_FILEVERSION_STR1_W(x, y) VER_FILEVERSION_STR2_W(x, y) diff --git a/targets/minecraft/Facing.cpp b/targets/minecraft/Facing.cpp index 49e1ccb14..11a5592b0 100644 --- a/targets/minecraft/Facing.cpp +++ b/targets/minecraft/Facing.cpp @@ -9,4 +9,4 @@ const int Facing::STEP_Y[6] = {-1, 1, 0, 0, 0, 0}; const int Facing::STEP_Z[6] = {0, 0, -1, 1, 0, 0}; const std::string Facing::NAMES[] = {"DOWN", "UP", "NORTH", - "SOUTH", "WEST", "EAST"}; \ No newline at end of file + "SOUTH", "WEST", "EAST"}; \ No newline at end of file diff --git a/targets/minecraft/GameHostOptions.cpp b/targets/minecraft/GameHostOptions.cpp index 33bd30311..69569a5bd 100644 --- a/targets/minecraft/GameHostOptions.cpp +++ b/targets/minecraft/GameHostOptions.cpp @@ -91,31 +91,43 @@ void set(unsigned int& settings, eGameHostOption option, unsigned int value) { switch (option) { case eGameHostOption_FriendsOfFriends: - setBit(GAME_HOST_OPTION_BITMASK_FRIENDSOFFRIENDS); break; + setBit(GAME_HOST_OPTION_BITMASK_FRIENDSOFFRIENDS); + break; case eGameHostOption_Difficulty: settings &= ~GAME_HOST_OPTION_BITMASK_DIFFICULTY; - settings |= (GAME_HOST_OPTION_BITMASK_DIFFICULTY & value); break; + settings |= (GAME_HOST_OPTION_BITMASK_DIFFICULTY & value); + break; case eGameHostOption_Gamertags: - setBit(GAME_HOST_OPTION_BITMASK_GAMERTAGS); break; + setBit(GAME_HOST_OPTION_BITMASK_GAMERTAGS); + break; case eGameHostOption_GameType: settings &= ~GAME_HOST_OPTION_BITMASK_GAMETYPE; - settings |= (GAME_HOST_OPTION_BITMASK_GAMETYPE & (value << 4)); break; + settings |= (GAME_HOST_OPTION_BITMASK_GAMETYPE & (value << 4)); + break; case eGameHostOption_LevelType: - setBit(GAME_HOST_OPTION_BITMASK_LEVELTYPE); break; + setBit(GAME_HOST_OPTION_BITMASK_LEVELTYPE); + break; case eGameHostOption_Structures: - setBit(GAME_HOST_OPTION_BITMASK_STRUCTURES); break; + setBit(GAME_HOST_OPTION_BITMASK_STRUCTURES); + break; case eGameHostOption_BonusChest: - setBit(GAME_HOST_OPTION_BITMASK_BONUSCHEST); break; + setBit(GAME_HOST_OPTION_BITMASK_BONUSCHEST); + break; case eGameHostOption_HasBeenInCreative: - setBit(GAME_HOST_OPTION_BITMASK_BEENINCREATIVE); break; + setBit(GAME_HOST_OPTION_BITMASK_BEENINCREATIVE); + break; case eGameHostOption_PvP: - setBit(GAME_HOST_OPTION_BITMASK_PVP); break; + setBit(GAME_HOST_OPTION_BITMASK_PVP); + break; case eGameHostOption_TrustPlayers: - setBit(GAME_HOST_OPTION_BITMASK_TRUSTPLAYERS); break; + setBit(GAME_HOST_OPTION_BITMASK_TRUSTPLAYERS); + break; case eGameHostOption_TNT: - setBit(GAME_HOST_OPTION_BITMASK_TNT); break; + setBit(GAME_HOST_OPTION_BITMASK_TNT); + break; case eGameHostOption_FireSpreads: - setBit(GAME_HOST_OPTION_BITMASK_FIRESPREADS); break; + setBit(GAME_HOST_OPTION_BITMASK_FIRESPREADS); + break; case eGameHostOption_CheatsEnabled: if (value != 0) { settings |= GAME_HOST_OPTION_BITMASK_HOSTFLY; @@ -125,40 +137,56 @@ void set(unsigned int& settings, eGameHostOption option, unsigned int value) { settings &= ~GAME_HOST_OPTION_BITMASK_HOSTFLY; settings &= ~GAME_HOST_OPTION_BITMASK_HOSTHUNGER; settings &= ~GAME_HOST_OPTION_BITMASK_HOSTINVISIBLE; - } break; + } + break; case eGameHostOption_HostCanFly: - setBit(GAME_HOST_OPTION_BITMASK_HOSTFLY); break; + setBit(GAME_HOST_OPTION_BITMASK_HOSTFLY); + break; case eGameHostOption_HostCanChangeHunger: - setBit(GAME_HOST_OPTION_BITMASK_HOSTHUNGER); break; + setBit(GAME_HOST_OPTION_BITMASK_HOSTHUNGER); + break; case eGameHostOption_HostCanBeInvisible: - setBit(GAME_HOST_OPTION_BITMASK_HOSTINVISIBLE); break; + setBit(GAME_HOST_OPTION_BITMASK_HOSTINVISIBLE); + break; case eGameHostOption_BedrockFog: - setBit(GAME_HOST_OPTION_BITMASK_BEDROCKFOG); break; + setBit(GAME_HOST_OPTION_BITMASK_BEDROCKFOG); + break; case eGameHostOption_DisableSaving: - setBit(GAME_HOST_OPTION_BITMASK_DISABLESAVE); break; + setBit(GAME_HOST_OPTION_BITMASK_DISABLESAVE); + break; case eGameHostOption_WasntSaveOwner: - setBit(GAME_HOST_OPTION_BITMASK_NOTOWNER); break; + setBit(GAME_HOST_OPTION_BITMASK_NOTOWNER); + break; case eGameHostOption_MobGriefing: - setInvertedBit(GAME_HOST_OPTION_BITMASK_MOBGRIEFING); break; + setInvertedBit(GAME_HOST_OPTION_BITMASK_MOBGRIEFING); + break; case eGameHostOption_KeepInventory: - setBit(GAME_HOST_OPTION_BITMASK_KEEPINVENTORY); break; + setBit(GAME_HOST_OPTION_BITMASK_KEEPINVENTORY); + break; case eGameHostOption_DoMobSpawning: - setInvertedBit(GAME_HOST_OPTION_BITMASK_DOMOBSPAWNING); break; + setInvertedBit(GAME_HOST_OPTION_BITMASK_DOMOBSPAWNING); + break; case eGameHostOption_DoMobLoot: - setInvertedBit(GAME_HOST_OPTION_BITMASK_DOMOBLOOT); break; + setInvertedBit(GAME_HOST_OPTION_BITMASK_DOMOBLOOT); + break; case eGameHostOption_DoTileDrops: - setInvertedBit(GAME_HOST_OPTION_BITMASK_DOTILEDROPS); break; + setInvertedBit(GAME_HOST_OPTION_BITMASK_DOTILEDROPS); + break; case eGameHostOption_NaturalRegeneration: - setInvertedBit(GAME_HOST_OPTION_BITMASK_NATURALREGEN); break; + setInvertedBit(GAME_HOST_OPTION_BITMASK_NATURALREGEN); + break; case eGameHostOption_DoDaylightCycle: - setInvertedBit(GAME_HOST_OPTION_BITMASK_DODAYLIGHTCYCLE); break; + setInvertedBit(GAME_HOST_OPTION_BITMASK_DODAYLIGHTCYCLE); + break; case eGameHostOption_WorldSize: settings &= ~GAME_HOST_OPTION_BITMASK_WORLDSIZE; - settings |= (GAME_HOST_OPTION_BITMASK_WORLDSIZE & - (value << GAME_HOST_OPTION_BITMASK_WORLDSIZE_BITSHIFT)); + settings |= + (GAME_HOST_OPTION_BITMASK_WORLDSIZE & + (value << GAME_HOST_OPTION_BITMASK_WORLDSIZE_BITSHIFT)); break; case eGameHostOption_All: - settings = value; break; + settings = value; + break; default: break; } diff --git a/targets/minecraft/IGameServices.cpp b/targets/minecraft/IGameServices.cpp index a854ef3ef..3d801d9b6 100644 --- a/targets/minecraft/IGameServices.cpp +++ b/targets/minecraft/IGameServices.cpp @@ -4,9 +4,7 @@ static IGameServices* s_services = nullptr; -void initGameServices(IGameServices* services) { - s_services = services; -} +void initGameServices(IGameServices* services) { s_services = services; } IGameServices& gameServices() { assert(s_services && diff --git a/targets/minecraft/IGameServices.h b/targets/minecraft/IGameServices.h index da3193b8e..47a23f155 100644 --- a/targets/minecraft/IGameServices.h +++ b/targets/minecraft/IGameServices.h @@ -14,13 +14,13 @@ class ModelPart; class DLCSkinFile; class DLCPack; -#include "minecraft/client/model/SkinBox.h" -#include "minecraft/GameTypes.h" #include "minecraft/GameEnums.h" +#include "minecraft/GameTypes.h" #include "minecraft/XuiActionPayload.h" -#include "platform/PlatformTypes.h" -#include "minecraft/network/packet/DisconnectPacket.h" #include "minecraft/client/IMenuService.h" +#include "minecraft/client/model/SkinBox.h" +#include "minecraft/network/packet/DisconnectPacket.h" +#include "platform/PlatformTypes.h" // eINSTANCEOF lives in java/Class.h which is heavyweight. using EntityTypeId = int; @@ -37,21 +37,23 @@ public: [[nodiscard]] virtual bool debugSettingsOn() = 0; [[nodiscard]] virtual bool debugArtToolsOn() = 0; - [[nodiscard]] virtual unsigned int debugGetMask(int iPad = -1, - bool overridePlayer = false) = 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; + [[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 LevelGenerationOptions* + getLevelGenerationOptions() = 0; [[nodiscard]] virtual LevelRuleset* getGameRuleDefinitions() = 0; // -- Texture cache -- @@ -60,14 +62,15 @@ public: std::uint8_t* data, unsigned int size) = 0; virtual void removeMemoryTextureFile(const std::string& name) = 0; - virtual void getMemFileDetails(const std::string& name, - std::uint8_t** data, + virtual void getMemFileDetails(const std::string& name, std::uint8_t** data, unsigned int* size) = 0; - [[nodiscard]] virtual bool isFileInMemoryTextures(const std::string& name) = 0; + [[nodiscard]] virtual bool isFileInMemoryTextures( + const std::string& name) = 0; // -- Player settings -- - [[nodiscard]] virtual unsigned char getGameSettings(int iPad, int setting) = 0; + [[nodiscard]] virtual unsigned char getGameSettings(int iPad, + int setting) = 0; [[nodiscard]] virtual unsigned char getGameSettings(int setting) = 0; // -- App time -- @@ -125,9 +128,9 @@ public: [[nodiscard]] virtual std::uint32_t getPlayerSkinId(int iPad) = 0; [[nodiscard]] virtual std::string 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, + [[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; @@ -139,8 +142,10 @@ public: unsigned int bitmask) = 0; [[nodiscard]] virtual unsigned int getAnimOverrideBitmask( std::uint32_t dwSkinID) = 0; - [[nodiscard]] virtual std::uint32_t getSkinIdFromPath(const std::string& skin) = 0; - [[nodiscard]] virtual std::string getSkinPathFromId(std::uint32_t skinId) = 0; + [[nodiscard]] virtual std::uint32_t getSkinIdFromPath( + const std::string& skin) = 0; + [[nodiscard]] virtual std::string 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; @@ -150,8 +155,7 @@ public: 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 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, @@ -159,17 +163,16 @@ public: unsigned int playerPrivileges) = 0; [[nodiscard]] virtual unsigned int getPlayerPrivileges( std::uint8_t networkSmallId) = 0; - virtual void setGameSettingsDebugMask(int iPad, - unsigned int uiVal) = 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 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 -- @@ -187,17 +190,16 @@ public: [[nodiscard]] virtual unsigned int createImageTextData( std::uint8_t* textMetadata, int64_t seed, bool hasSeed, unsigned int uiHostOptions, unsigned int uiTexturePackId) = 0; - [[nodiscard]] virtual std::string getFilePath(std::uint32_t packId, - std::string filename, - bool bAddDataFolder, - std::string mountPoint = "TPACK:") = 0; + [[nodiscard]] virtual std::string getFilePath( + std::uint32_t packId, std::string filename, bool bAddDataFolder, + std::string mountPoint = "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; + char* levelName) = 0; [[nodiscard]] virtual MOJANG_DATA* getMojangDataForXuid(PlayerUID xuid) = 0; virtual void debugPrintf(const char* msg) = 0; @@ -208,16 +210,16 @@ public: [[nodiscard]] virtual bool dlcNeedsCorruptCheck() = 0; virtual unsigned int dlcCheckForCorrupt(bool showMessage = true) = 0; [[nodiscard]] virtual bool dlcReadDataFile(unsigned int& filesProcessed, - const std::string& path, DLCPack* pack, - bool fromArchive = false) = 0; + const std::string& 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; + 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; diff --git a/targets/minecraft/SharedConstants.h b/targets/minecraft/SharedConstants.h index 6699867d6..dc4cc1726 100644 --- a/targets/minecraft/SharedConstants.h +++ b/targets/minecraft/SharedConstants.h @@ -25,8 +25,7 @@ public: static std::string acceptableLetters; static inline constexpr int ILLEGAL_FILE_CHARACTERS_LENGTH = 15; - static const char - ILLEGAL_FILE_CHARACTERS[ILLEGAL_FILE_CHARACTERS_LENGTH]; + static const char ILLEGAL_FILE_CHARACTERS[ILLEGAL_FILE_CHARACTERS_LENGTH]; static const bool TEXTURE_LIGHTING; // 4J - change brought forward from 1.8.2 diff --git a/targets/minecraft/XuiActionPayload.h b/targets/minecraft/XuiActionPayload.h index 34e6989e4..aeb49dadc 100644 --- a/targets/minecraft/XuiActionPayload.h +++ b/targets/minecraft/XuiActionPayload.h @@ -20,8 +20,6 @@ struct XuiActionOwnedPayload { } // namespace minecraft -using XuiActionPayload = std::variant< - std::monostate, - bool, - std::int64_t, - std::unique_ptr>; +using XuiActionPayload = + std::variant>; diff --git a/targets/minecraft/client/BufferedImage.cpp b/targets/minecraft/client/BufferedImage.cpp index 07a8d5b7b..dff8e52f9 100644 --- a/targets/minecraft/client/BufferedImage.cpp +++ b/targets/minecraft/client/BufferedImage.cpp @@ -6,14 +6,14 @@ #include #include -#include "platform/renderer/renderer.h" +#include "PlatformTypes.h" #include "app/common/DLC/DLCFile.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" #include "minecraft/IGameServices.h" -#include "PlatformTypes.h" -#include "util/StringHelpers.h" #include "platform/fs/fs.h" +#include "platform/renderer/renderer.h" +#include "util/StringHelpers.h" BufferedImage::BufferedImage(int width, int height, int type) { data[0] = new int[width * height]; @@ -36,8 +36,7 @@ void BufferedImage::ByteFlip4(unsigned int& data) { // with a valid alpha channel. // 4jcraft: mostly rewrote this function -BufferedImage::BufferedImage(const std::string& File, - bool filenameHasExtension, +BufferedImage::BufferedImage(const std::string& File, bool filenameHasExtension, bool bTitleUpdateTexture, const std::string& drive) { int32_t hr = -1; @@ -94,13 +93,14 @@ BufferedImage::BufferedImage(const std::string& File, if (foundOnDisk) { std::string nativePath = std::filesystem::path(finalPath).string(); hr = PlatformRenderer.LoadTextureData(nativePath.c_str(), - &ImageInfo, &data[l]); + &ImageInfo, &data[l]); } else { std::string archiveKey = "res/" + fileName; if (gameServices().hasArchiveFile(archiveKey)) { - std::vector ba = gameServices().getArchiveFile(archiveKey); + std::vector ba = + gameServices().getArchiveFile(archiveKey); hr = PlatformRenderer.LoadTextureData(ba.data(), ba.size(), - &ImageInfo, &data[l]); + &ImageInfo, &data[l]); } } @@ -134,9 +134,9 @@ BufferedImage::BufferedImage(DLCPack* dlcPack, const std::string& File, std::string mipMapPath = (l != 0) ? "MipMapLevel" + toWString(l + 1) : ""; name = "res" + (filenameHasExtension - ? filePath - : filePath.substr(0, filePath.length() - 4) + - mipMapPath + ".png"); + ? filePath + : filePath.substr(0, filePath.length() - 4) + + mipMapPath + ".png"); if (!dlcPack->doesPackContainFile(DLCManager::e_DLCType_All, name)) { if (l == 0) gameServices().fatalLoadError(); @@ -152,7 +152,7 @@ BufferedImage::BufferedImage(DLCPack* dlcPack, const std::string& File, D3DXIMAGE_INFO ImageInfo; hr = PlatformRenderer.LoadTextureData(pbData, dataBytes, &ImageInfo, - &data[l]); + &data[l]); if (hr == 0 && l == 0) { width = ImageInfo.Width; height = ImageInfo.Height; @@ -167,8 +167,8 @@ BufferedImage::BufferedImage(std::uint8_t* pbData, std::uint32_t dataBytes) { D3DXIMAGE_INFO ImageInfo; memset(&ImageInfo, 0, sizeof(D3DXIMAGE_INFO)); - int32_t hr = - PlatformRenderer.LoadTextureData(pbData, dataBytes, &ImageInfo, &data[0]); + int32_t hr = PlatformRenderer.LoadTextureData(pbData, dataBytes, &ImageInfo, + &data[0]); if (hr == 0) { width = ImageInfo.Width; diff --git a/targets/minecraft/client/Camera.cpp b/targets/minecraft/client/Camera.cpp index b5b31e63f..1e8f2d924 100644 --- a/targets/minecraft/client/Camera.cpp +++ b/targets/minecraft/client/Camera.cpp @@ -1,14 +1,12 @@ #include "Camera.h" - -#include #include #include +#include #include #include "MemoryTracker.h" -#include "platform/stubs.h" #include "java/FloatBuffer.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/player/Player.h" @@ -18,6 +16,7 @@ #include "minecraft/world/level/tile/LiquidTile.h" #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/phys/Vec3.h" +#include "platform/stubs.h" float Camera::xPlayerOffs = 0.0f; float Camera::yPlayerOffs = 0.0f; diff --git a/targets/minecraft/client/IMenuService.h b/targets/minecraft/client/IMenuService.h index deac5a411..2a782bccc 100644 --- a/targets/minecraft/client/IMenuService.h +++ b/targets/minecraft/client/IMenuService.h @@ -44,8 +44,7 @@ public: std::shared_ptr trap) = 0; virtual bool openFireworks(int iPad, std::shared_ptr player, int x, int y, int z) = 0; - virtual bool openSign(int iPad, - std::shared_ptr sign) = 0; + virtual bool openSign(int iPad, std::shared_ptr sign) = 0; virtual bool openRepairing(int iPad, std::shared_ptr inventory, Level* level, int x, int y, int z) = 0; virtual bool openTrading(int iPad, std::shared_ptr inventory, @@ -55,9 +54,9 @@ public: int iPad, std::shared_ptr commandBlock) = 0; virtual bool openHopper(int iPad, std::shared_ptr inventory, std::shared_ptr hopper) = 0; - virtual bool openHopperMinecart( - int iPad, std::shared_ptr inventory, - std::shared_ptr hopper) = 0; + virtual bool openHopperMinecart(int iPad, + std::shared_ptr inventory, + std::shared_ptr hopper) = 0; virtual bool openHorse(int iPad, std::shared_ptr inventory, std::shared_ptr container, std::shared_ptr horse) = 0; diff --git a/targets/minecraft/client/Lighting.cpp b/targets/minecraft/client/Lighting.cpp index ef9e1087a..4811b786e 100644 --- a/targets/minecraft/client/Lighting.cpp +++ b/targets/minecraft/client/Lighting.cpp @@ -1,11 +1,9 @@ #include "Lighting.h" -#include "platform/stubs.h" - - -#include "platform/renderer/renderer.h" #include "java/FloatBuffer.h" #include "minecraft/world/phys/Vec3.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" FloatBuffer* Lighting::lb = new FloatBuffer(16); diff --git a/targets/minecraft/client/MemoryTracker.cpp b/targets/minecraft/client/MemoryTracker.cpp index 7e60bbbe9..41a7a60a2 100644 --- a/targets/minecraft/client/MemoryTracker.cpp +++ b/targets/minecraft/client/MemoryTracker.cpp @@ -1,12 +1,11 @@ #include "MemoryTracker.h" -#include "platform/stubs.h" #include #include - -#include "platform/renderer/renderer.h" #include "java/ByteBuffer.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" std::unordered_map MemoryTracker::GL_LIST_IDS; std::vector MemoryTracker::TEXTURE_IDS; diff --git a/targets/minecraft/client/Minecraft.cpp b/targets/minecraft/client/Minecraft.cpp index e16d15b87..93ea4d4fc 100644 --- a/targets/minecraft/client/Minecraft.cpp +++ b/targets/minecraft/client/Minecraft.cpp @@ -1,5 +1,4 @@ #include "Minecraft.h" -#include "platform/stubs.h" #include #include @@ -18,9 +17,6 @@ #include "Timer.h" #include "User.h" #include "app/common/Audio/SoundEngine.h" -#include "minecraft/world/level/dlc/DLCConstants.h" -#include "minecraft/network/INetworkService.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" @@ -54,8 +50,10 @@ #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" #include "minecraft/client/title/TitleScreen.h" +#include "minecraft/network/INetworkService.h" #include "minecraft/network/packet/DisconnectPacket.h" #include "minecraft/network/packet/Packet.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "minecraft/sounds/SoundTypes.h" #include "minecraft/stats/Stats.h" #include "minecraft/stats/StatsCounter.h" @@ -85,6 +83,7 @@ #include "minecraft/world/level/Level.h" #include "minecraft/world/level/chunk/CompressedTileStorage.h" #include "minecraft/world/level/dimension/Dimension.h" +#include "minecraft/world/level/dlc/DLCConstants.h" #include "minecraft/world/level/material/Material.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "minecraft/world/level/storage/LevelData.h" @@ -99,19 +98,19 @@ #include "platform/profile/profile.h" #include "platform/renderer/renderer.h" #include "platform/storage/storage.h" +#include "platform/stubs.h" #include "strings.h" #if defined(ENABLE_JAVA_GUIS) #include "minecraft/client/gui/inventory/CreativeInventoryScreen.h" #endif -#include "minecraft/client/resources/Colours/ColourTable.h" #include "app/common/ConsoleGameMode.h" #include "app/common/DLC/DLCPack.h" -#include "minecraft/Minecraft_Macros.h" #include "app/common/Tutorial/FullTutorialMode.h" #include "app/common/UI/All Platforms/IUIScene_CreativeMenu.h" #include "app/common/UI/UIFontData.h" #include "java/File.h" #include "java/System.h" +#include "minecraft/Minecraft_Macros.h" #include "minecraft/StaticConstructors.h" #include "minecraft/client/MemoryTracker.h" #include "minecraft/client/gui/Font.h" @@ -123,6 +122,7 @@ #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" #include "minecraft/client/player/Input.h" #include "minecraft/client/renderer/texture/TextureManager.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/client/skins/DLCTexturePack.h" #include "minecraft/world/entity/npc/Villager.h" #include "minecraft/world/item/alchemy/PotionMacros.h" @@ -1443,7 +1443,8 @@ void Minecraft::run_middle() { player = createExtraLocalPlayer( i, - PlatformProfile.GetGamertag(i), + PlatformProfile + .GetGamertag(i), i, level->dimension ->id); @@ -1512,8 +1513,7 @@ void Minecraft::run_middle() { Log::info( "Bringing up the sign in ui\n"); PlatformProfile.RequestSignInUI( - false, - NetworkService.IsLocalGame(), + false, NetworkService.IsLocalGame(), true, false, true, [this](bool b, int p) { return InGame_SignInReturned( @@ -1695,10 +1695,9 @@ void Minecraft::run_middle() { if (unoccupiedQuadrant > -1) { // render a logo PlatformRenderer.StateSetViewport(( - IPlatformRenderer:: - eViewportType)(IPlatformRenderer:: - VIEWPORT_TYPE_QUADRANT_TOP_LEFT + - unoccupiedQuadrant)); + IPlatformRenderer::eViewportType)( + IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_TOP_LEFT + + unoccupiedQuadrant)); glClearColor(0, 0, 0, 0); glClear(GL_COLOR_BUFFER_BIT); @@ -2176,8 +2175,8 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { if (player->isRiding()) { std::shared_ptr mount = player->riding; - if (mount->instanceof(eTYPE_MINECART) || - mount->instanceof(eTYPE_BOAT)) { + if (mount->instanceof (eTYPE_MINECART) || mount->instanceof + (eTYPE_BOAT)) { *piAlt = IDS_TOOLTIPS_EXIT; } else { *piAlt = IDS_TOOLTIPS_DISMOUNT; @@ -3203,7 +3202,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { break; default: - if (hitResult->entity->instanceof(eTYPE_MOB)) { + if (hitResult->entity->instanceof (eTYPE_MOB)) { std::shared_ptr mob = std::dynamic_pointer_cast( hitResult->entity); @@ -4500,8 +4499,8 @@ int Minecraft::InGame_SignInReturned(void* pParam, bool bContinue, int iPad) { pMinecraftClass->localplayers[iPad]; if (player == nullptr) { player = pMinecraftClass->createExtraLocalPlayer( - iPad, PlatformProfile.GetGamertag(iPad), - iPad, pMinecraftClass->level->dimension->id); + iPad, PlatformProfile.GetGamertag(iPad), iPad, + pMinecraftClass->level->dimension->id); } } } else if (PlatformProfile.IsSignedInLive( diff --git a/targets/minecraft/client/Minecraft.h b/targets/minecraft/client/Minecraft.h index 44ca6988a..192239382 100644 --- a/targets/minecraft/client/Minecraft.h +++ b/targets/minecraft/client/Minecraft.h @@ -6,11 +6,11 @@ #include #include -#include "platform/PlatformTypes.h" -#include "platform/C4JThread.h" #include "java/File.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/network/packet/DisconnectPacket.h" +#include "platform/C4JThread.h" +#include "platform/PlatformTypes.h" #include "platform/stubs.h" class Timer; diff --git a/targets/minecraft/client/Options.cpp b/targets/minecraft/client/Options.cpp index 8b4a83a75..c0fd1f95a 100644 --- a/targets/minecraft/client/Options.cpp +++ b/targets/minecraft/client/Options.cpp @@ -1,9 +1,7 @@ -#include "minecraft/util/Log.h" #include "Options.h" #include "KeyMapping.h" #include "app/common/Audio/SoundEngine.h" -#include "util/StringHelpers.h" #include "java/File.h" #include "java/InputOutputStream/BufferedReader.h" #include "java/InputOutputStream/DataOutputStream.h" @@ -15,7 +13,9 @@ #include "minecraft/client/renderer/Textures.h" #include "minecraft/locale/I18n.h" #include "minecraft/locale/Language.h" +#include "minecraft/util/Log.h" #include "platform/stubs.h" +#include "util/StringHelpers.h" // 4J - the Option sub-class used to be an java enumerated type, trying to // emulate that functionality here @@ -103,8 +103,8 @@ const std::string Options::FRAMERATE_LIMITS[] = { #endif const std::string Options::PARTICLES[] = {"options.particles.all", - "options.particles.decreased", - "options.particles.minimal"}; + "options.particles.decreased", + "options.particles.minimal"}; // 4J added void Options::init() { @@ -374,7 +374,7 @@ void Options::load() { std::string line = ""; while ((line = br->readLine()) != "") // 4J - was check against nullptr - do we need to distinguish - // between empty lines and a fail here? + // between empty lines and a fail here? { // 4J - removed try/catch // try { @@ -394,8 +394,7 @@ void Options::load() { if (cmds[0] == "fov") fov = readFloat(cmds[1]); if (cmds[0] == "gamma") gamma = readFloat(cmds[1]); if (cmds[0] == "invertYMouse") invertYMouse = cmds[1] == "true"; - if (cmds[0] == "viewDistance") - viewDistance = fromWString(cmds[1]); + if (cmds[0] == "viewDistance") viewDistance = fromWString(cmds[1]); if (cmds[0] == "guiScale") guiScale = fromWString(cmds[1]); if (cmds[0] == "particles") particles = fromWString(cmds[1]); if (cmds[0] == "bobView") bobView = cmds[1] == "true"; @@ -444,8 +443,8 @@ void Options::save() { dos.writeChars("music:" + toWString(music) + "\n"); dos.writeChars("sound:" + toWString(sound) + "\n"); - dos.writeChars("invertYMouse:" + - std::string(invertYMouse ? "true" : "false") + "\n"); + dos.writeChars( + "invertYMouse:" + std::string(invertYMouse ? "true" : "false") + "\n"); dos.writeChars("mouseSensitivity:" + toWString(sensitivity)); dos.writeChars("fov:" + toWString(fov)); dos.writeChars("gamma:" + toWString(gamma)); @@ -453,16 +452,14 @@ void Options::save() { dos.writeChars("guiScale:" + toWString(guiScale)); dos.writeChars("particles:" + toWString(particles)); dos.writeChars("bobView:" + std::string(bobView ? "true" : "false")); - dos.writeChars("anaglyph3d:" + - std::string(anaglyph3d ? "true" : "false")); + dos.writeChars("anaglyph3d:" + std::string(anaglyph3d ? "true" : "false")); dos.writeChars("advancedOpengl:" + std::string(advancedOpengl ? "true" : "false")); dos.writeChars("fpsLimit:" + toWString(framerateLimit)); dos.writeChars("difficulty:" + toWString(difficulty)); dos.writeChars("fancyGraphics:" + std::string(fancyGraphics ? "true" : "false")); - dos.writeChars("ao:" + - std::string(ambientOcclusion ? "true" : "false")); + dos.writeChars("ao:" + std::string(ambientOcclusion ? "true" : "false")); dos.writeChars("clouds:" + toWString(renderClouds)); dos.writeChars("skin:" + skin); dos.writeChars("lastServer:" + lastMpIp); diff --git a/targets/minecraft/client/gui/Button.cpp b/targets/minecraft/client/gui/Button.cpp index 1d0cc9458..d4b48ad3c 100644 --- a/targets/minecraft/client/gui/Button.cpp +++ b/targets/minecraft/client/gui/Button.cpp @@ -1,10 +1,10 @@ #include "Button.h" -#include "platform/stubs.h" -#include "platform/renderer/renderer.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/resources/ResourceLocation.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" class Minecraft; #ifdef ENABLE_JAVA_GUIS diff --git a/targets/minecraft/client/gui/ChatScreen.cpp b/targets/minecraft/client/gui/ChatScreen.cpp index 69eb819e7..224962a8d 100644 --- a/targets/minecraft/client/gui/ChatScreen.cpp +++ b/targets/minecraft/client/gui/ChatScreen.cpp @@ -2,16 +2,15 @@ #include -#include "platform/stubs.h" -#include "util/StringHelpers.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Gui.h" #include "minecraft/client/gui/Screen.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" +#include "platform/stubs.h" +#include "util/StringHelpers.h" -const std::string ChatScreen::allowedChars = - SharedConstants::acceptableLetters; +const std::string ChatScreen::allowedChars = SharedConstants::acceptableLetters; ChatScreen::ChatScreen() { frame = 0; } diff --git a/targets/minecraft/client/gui/CreateWorldScreen.cpp b/targets/minecraft/client/gui/CreateWorldScreen.cpp index ca6167c84..0b66a378e 100644 --- a/targets/minecraft/client/gui/CreateWorldScreen.cpp +++ b/targets/minecraft/client/gui/CreateWorldScreen.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "CreateWorldScreen.h" #include @@ -8,12 +6,14 @@ #include #include -#include "platform/storage/storage.h" #include "Button.h" #include "EditBox.h" #include "MessageScreen.h" #include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/network/INetworkService.h" +#include "minecraft/util/Log.h" +#include "platform/storage/storage.h" // Needed for the &CGameNetworkManager::RunNetworkGameThreadProc address-of // below. Static thread procs can't be virtual; this one consumer keeps the // concrete type include. @@ -21,9 +21,6 @@ #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/linux/Linux_UIController.h" -#include "platform/NetTypes.h" -#include "platform/stubs.h" -#include "util/StringHelpers.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/Options.h" @@ -32,6 +29,9 @@ #include "minecraft/server/MinecraftServer.h" #include "minecraft/world/level/LevelSettings.h" #include "minecraft/world/level/chunk/ChunkSource.h" +#include "platform/NetTypes.h" +#include "platform/stubs.h" +#include "util/StringHelpers.h" CreateWorldScreen::CreateWorldScreen(Screen* lastScreen) { done = false; // 4J added @@ -256,42 +256,44 @@ void CreateWorldScreen::buttonClicked(Button* button) { param->settings = 0; gameServices().setGameHostOption(eGameHostOption_Difficulty, - minecraft->options->difficulty); - gameServices().setGameHostOption(eGameHostOption_FriendsOfFriends, - moreOptionsParams->bAllowFriendsOfFriends); + minecraft->options->difficulty); + gameServices().setGameHostOption( + eGameHostOption_FriendsOfFriends, + moreOptionsParams->bAllowFriendsOfFriends); gameServices().setGameHostOption(eGameHostOption_Gamertags, 1); gameServices().setGameHostOption(eGameHostOption_BedrockFog, 0); gameServices().setGameHostOption(eGameHostOption_GameType, - (gameMode == "survival") - ? GameType::SURVIVAL->getId() - : GameType::CREATIVE->getId()); + (gameMode == "survival") + ? GameType::SURVIVAL->getId() + : GameType::CREATIVE->getId()); gameServices().setGameHostOption(eGameHostOption_LevelType, - moreOptionsParams->bFlatWorld); + moreOptionsParams->bFlatWorld); gameServices().setGameHostOption(eGameHostOption_Structures, - moreOptionsParams->bStructures); + moreOptionsParams->bStructures); gameServices().setGameHostOption(eGameHostOption_BonusChest, - moreOptionsParams->bBonusChest); - gameServices().setGameHostOption(eGameHostOption_PvP, moreOptionsParams->bPVP); + moreOptionsParams->bBonusChest); + gameServices().setGameHostOption(eGameHostOption_PvP, + moreOptionsParams->bPVP); gameServices().setGameHostOption(eGameHostOption_TrustPlayers, - moreOptionsParams->bTrust); + moreOptionsParams->bTrust); gameServices().setGameHostOption(eGameHostOption_FireSpreads, - moreOptionsParams->bFireSpreads); - gameServices().setGameHostOption(eGameHostOption_TNT, moreOptionsParams->bTNT); + moreOptionsParams->bFireSpreads); + gameServices().setGameHostOption(eGameHostOption_TNT, + moreOptionsParams->bTNT); gameServices().setGameHostOption(eGameHostOption_HostCanFly, - moreOptionsParams->bHostPrivileges); + moreOptionsParams->bHostPrivileges); gameServices().setGameHostOption(eGameHostOption_HostCanChangeHunger, - moreOptionsParams->bHostPrivileges); + moreOptionsParams->bHostPrivileges); gameServices().setGameHostOption(eGameHostOption_HostCanBeInvisible, - moreOptionsParams->bHostPrivileges); + moreOptionsParams->bHostPrivileges); gameServices().setGameHostOption(eGameHostOption_CheatsEnabled, - moreOptionsParams->bHostPrivileges); + moreOptionsParams->bHostPrivileges); param->settings = gameServices().getGameHostOption(eGameHostOption_All); param->xzSize = LEVEL_MAX_WIDTH; param->hellScale = HELL_LEVEL_MAX_SCALE; - NetworkService.HostGame(0, false, false, MINECRAFT_NET_MAX_PLAYERS, - 0); + NetworkService.HostGame(0, false, false, MINECRAFT_NET_MAX_PLAYERS, 0); NetworkService.FakeLocalPlayerJoined(); @@ -408,8 +410,7 @@ void CreateWorldScreen::render(int xm, int ym, float a) { width / 2 - 100, 85, 0xa0a0a0); drawString(font, language->getElement("selectWorld.mapFeatures.info"), width / 2 - 150, 122, 0xa0a0a0); - drawString(font, - language->getElement("selectWorld.allowCommands.info"), + drawString(font, language->getElement("selectWorld.allowCommands.info"), width / 2 - 150, 157, 0xa0a0a0); seedEdit->render(); diff --git a/targets/minecraft/client/gui/CreateWorldScreen.h b/targets/minecraft/client/gui/CreateWorldScreen.h index 550a650d5..4aee42a54 100644 --- a/targets/minecraft/client/gui/CreateWorldScreen.h +++ b/targets/minecraft/client/gui/CreateWorldScreen.h @@ -44,7 +44,7 @@ private: public: static std::string findAvailableFolderName(LevelStorageSource* levelSource, - const std::string& folder); + const std::string& folder); virtual void removed() override; protected: diff --git a/targets/minecraft/client/gui/DeathScreen.cpp b/targets/minecraft/client/gui/DeathScreen.cpp index 04df42ce8..a59bfcf92 100644 --- a/targets/minecraft/client/gui/DeathScreen.cpp +++ b/targets/minecraft/client/gui/DeathScreen.cpp @@ -1,17 +1,17 @@ #include "DeathScreen.h" -#include "platform/stubs.h" #include #include #include -#include "platform/renderer/renderer.h" #include "Button.h" #include "PauseScreen.h" -#include "util/StringHelpers.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Screen.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" +#include "util/StringHelpers.h" void DeathScreen::init() { buttons.clear(); diff --git a/targets/minecraft/client/gui/EditBox.cpp b/targets/minecraft/client/gui/EditBox.cpp index 9af8859d3..af4085859 100644 --- a/targets/minecraft/client/gui/EditBox.cpp +++ b/targets/minecraft/client/gui/EditBox.cpp @@ -1,8 +1,8 @@ #include "EditBox.h" -#include "platform/stubs.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/gui/Screen.h" +#include "platform/stubs.h" EditBox::EditBox(Screen* screen, Font* font, int x, int y, int width, int height, const std::string& value) { diff --git a/targets/minecraft/client/gui/ErrorScreen.cpp b/targets/minecraft/client/gui/ErrorScreen.cpp index 73cbb843d..05c60e996 100644 --- a/targets/minecraft/client/gui/ErrorScreen.cpp +++ b/targets/minecraft/client/gui/ErrorScreen.cpp @@ -2,8 +2,7 @@ #include "minecraft/client/gui/Screen.h" -ErrorScreen::ErrorScreen(const std::string& title, - const std::string& message) { +ErrorScreen::ErrorScreen(const std::string& title, const std::string& message) { this->title = title; this->message = message; } diff --git a/targets/minecraft/client/gui/Font.cpp b/targets/minecraft/client/gui/Font.cpp index 904afa844..2120533d0 100644 --- a/targets/minecraft/client/gui/Font.cpp +++ b/targets/minecraft/client/gui/Font.cpp @@ -1,5 +1,4 @@ #include "Font.h" -#include "platform/stubs.h" #include @@ -14,6 +13,7 @@ #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/resources/ResourceLocation.h" #include "platform/renderer/renderer.h" +#include "platform/stubs.h" #include "util/StringHelpers.h" Font::Font(Options* options, const std::string& name, Textures* textures, diff --git a/targets/minecraft/client/gui/Font.h b/targets/minecraft/client/gui/Font.h index 83b0a4ce1..03a84f04c 100644 --- a/targets/minecraft/client/gui/Font.h +++ b/targets/minecraft/client/gui/Font.h @@ -64,8 +64,7 @@ private: std::string reorderBidi(const std::string& str); void draw(const std::string& str, bool dropShadow); - void draw(const std::string& str, int x, int y, int color, - bool dropShadow); + void draw(const std::string& str, int x, int y, int color, bool dropShadow); int MapCharacter(char c); // 4J added bool CharacterExists(char c); // 4J added diff --git a/targets/minecraft/client/gui/Gui.cpp b/targets/minecraft/client/gui/Gui.cpp index 2ae6d830e..cf6315f69 100644 --- a/targets/minecraft/client/gui/Gui.cpp +++ b/targets/minecraft/client/gui/Gui.cpp @@ -1,23 +1,17 @@ -#include "minecraft/IGameServices.h" -#include "platform/stubs.h" #include "Gui.h" -#include #include +#include -#include "platform/PlatformTypes.h" -#include "platform/input/input.h" -#include "platform/renderer/renderer.h" #include "Facing.h" -#include "minecraft/GameEnums.h" #include "app/common/App_structs.h" #include "app/linux/Linux_UIController.h" -#include "platform/XboxStubs.h" -#include "util/StringHelpers.h" +#include "java/Color.h" #include "java/JavaMath.h" #include "java/Random.h" #include "java/System.h" -#include "java/Color.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/ClientConstants.h" #include "minecraft/client/GuiMessage.h" #include "minecraft/client/Lighting.h" @@ -37,28 +31,30 @@ #include "minecraft/client/renderer/entity/EntityRenderDispatcher.h" #include "minecraft/client/renderer/texture/TextureAtlas.h" #include "minecraft/client/resources/ResourceLocation.h" - #include "minecraft/util/Mth.h" #include "minecraft/world/Icon.h" #include "minecraft/world/effect/MobEffect.h" #include "minecraft/world/entity/Entity.h" +#include "minecraft/world/entity/ai/attributes/AttributeInstance.h" +#include "minecraft/world/entity/monster/SharedMonsterAttributes.h" #include "minecraft/world/entity/player/Abilities.h" #include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/entity/player/Player.h" -#include "minecraft/world/entity/ai/attributes/AttributeInstance.h" -#include "minecraft/world/entity/monster/SharedMonsterAttributes.h" #include "minecraft/world/food/FoodConstants.h" - #include "minecraft/world/item/ItemInstance.h" - #include "minecraft/world/level/biome/Biome.h" #include "minecraft/world/level/chunk/LevelChunk.h" #include "minecraft/world/level/dimension/Dimension.h" #include "minecraft/world/level/storage/LevelData.h" #include "minecraft/world/level/tile/PortalTile.h" #include "minecraft/world/level/tile/Tile.h" - +#include "platform/PlatformTypes.h" +#include "platform/XboxStubs.h" +#include "platform/input/input.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" #include "strings.h" +#include "util/StringHelpers.h" ResourceLocation Gui::PUMPKIN_BLUR_LOCATION = ResourceLocation(TN__BLUR__MISC_PUMPKINBLUR); @@ -113,10 +109,12 @@ 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 == IPlatformRenderer::VIEWPORT_TYPE_FULLSCREEN) { - guiScale = gameServices().getGameSettings(iPad, eGameSetting_UISize) + 2; - } else { guiScale = - gameServices().getGameSettings(iPad, eGameSetting_UISizeSplitscreen) + 2; + gameServices().getGameSettings(iPad, eGameSetting_UISize) + 2; + } else { + guiScale = gameServices().getGameSettings( + iPad, eGameSetting_UISizeSplitscreen) + + 2; } ScreenSizeCalculator ssc(minecraft->options, minecraft->width, @@ -251,7 +249,8 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) { 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 IPlatformRenderer::VIEWPORT_TYPE_FULLSCREEN: iTooltipsYOffset = screenHeight / 10; @@ -359,7 +358,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) { } PlatformRenderer.StateSetBlendFactor(0xffffff | - (((unsigned int)fVal) << 24)); + (((unsigned int)fVal) << 24)); currentGuiBlendFactor = fVal / 255.0f; // PlatformRenderer.StateSetBlendFactor(0x40ffffff); glBlendFunc(GL_CONSTANT_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA); @@ -411,7 +410,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) { &GUI_ICONS_LOCATION); // "/gui/icons.png")); glEnable(GL_BLEND); PlatformRenderer.StateSetBlendFactor(0xffffff | - (((unsigned int)fVal) << 24)); + (((unsigned int)fVal) << 24)); glBlendFunc(GL_CONSTANT_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA); // glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ONE_MINUS_SRC_COLOR); // 4J Stu - We don't want to adjust the cursor by the safezone, we @@ -729,7 +728,8 @@ 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}; @@ -951,9 +951,9 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) { if (minecraft->options->renderDebug) { glPushMatrix(); if (Minecraft::warezTime > 0) glTranslatef(0, 32, 0); - font->drawShadow(ClientConstants::VERSION_STRING + " (" + - minecraft->fpsString + ")", - iSafezoneXHalf + 2, 20, 0xffffff); + font->drawShadow( + ClientConstants::VERSION_STRING + " (" + minecraft->fpsString + ")", + iSafezoneXHalf + 2, 20, 0xffffff); font->drawShadow( "Seed: " + toWString(minecraft->level->getLevelData()->getSeed()), @@ -978,8 +978,10 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) { wfeature[eTerrainFeature_Village] = "Village: "; wfeature[eTerrainFeature_Ravine] = "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::string itemInfo = "[" + toWString(pFeatureData->x * 16) + ", " + @@ -1016,8 +1018,7 @@ max) + "% (" + (total / 1024 / 1024) + "MB)"; drawString(font, msg, screenWidth double zBlockPos = floor(minecraft->player->z); drawString(font, "x: " + toWString(minecraft->player->x) + - "/ Head: " + toWString(xBlockPos) + - "/ Chunk: " + + "/ Head: " + toWString(xBlockPos) + "/ Chunk: " + toWString(minecraft->player->xChunk), iSafezoneXHalf + 2, iYPos + 8 * 0, 0xe0e0e0); drawString(font, @@ -1026,8 +1027,7 @@ max) + "% (" + (total / 1024 / 1024) + "MB)"; drawString(font, msg, screenWidth iSafezoneXHalf + 2, iYPos + 8 * 1, 0xe0e0e0); drawString(font, "z: " + toWString(minecraft->player->z) + - "/ Head: " + toWString(zBlockPos) + - "/ Chunk: " + + "/ Head: " + toWString(zBlockPos) + "/ Chunk: " + toWString(minecraft->player->zChunk), iSafezoneXHalf + 2, iYPos + 8 * 2, 0xe0e0e0); drawString( @@ -1048,10 +1048,10 @@ max) + "% (" + (total / 1024 / 1024) + "MB)"; drawString(font, msg, screenWidth LevelChunk* chunkAt = minecraft->level->getChunkAt(px, pz); Biome* biome = chunkAt->getBiome( px & 15, pz & 15, minecraft->level->getBiomeSource()); - drawString(font, - "b: " + biome->m_name + " (" + - toWString(biome->id) + ")", - iSafezoneXHalf + 2, iYPos, 0xe0e0e0); + drawString( + font, + "b: " + biome->m_name + " (" + toWString(biome->id) + ")", + iSafezoneXHalf + 2, iYPos, 0xe0e0e0); } glPopMatrix(); @@ -1085,7 +1085,8 @@ max) + "% (" + (total / 1024 / 1024) + "MB)"; drawString(font, msg, screenWidth int col = 0xffffff; if (animateOverlayMessageColor) { - col = Color::getHSBColor(t / 50.0f, 0.7f, 0.6f).getRGB() & 0xffffff; + col = Color::getHSBColor(t / 50.0f, 0.7f, 0.6f).getRGB() & + 0xffffff; } // 4J-PB - this is the string displayed when cds are placed in a // jukebox @@ -1465,8 +1466,8 @@ void Gui::addMessage(const std::string& _string, int iPad, // add to all for (int i = 0; i < XUSER_MAX_COUNT; i++) { if (minecraft->localplayers[i] && - !(bIsDeathMessage && - gameServices().getGameSettings(i, eGameSetting_DeathMessages) == 0)) { + !(bIsDeathMessage && gameServices().getGameSettings( + i, eGameSetting_DeathMessages) == 0)) { guiMessages[i].insert(guiMessages[i].begin(), GuiMessage(string)); while (guiMessages[i].size() > 50) { @@ -1475,7 +1476,8 @@ void Gui::addMessage(const std::string& _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(); @@ -1517,8 +1519,8 @@ void Gui::setNowPlaying(const std::string& string) { void Gui::displayClientMessage(int messageId, int iPad) { // Language *language = Language::getInstance(); - std::string languageString = - gameServices().getString(messageId); // language->getElement(messageId); + std::string languageString = gameServices().getString( + messageId); // language->getElement(messageId); addMessage(languageString, iPad); } diff --git a/targets/minecraft/client/gui/Gui.h b/targets/minecraft/client/gui/Gui.h index 7cee85007..b60408898 100644 --- a/targets/minecraft/client/gui/Gui.h +++ b/targets/minecraft/client/gui/Gui.h @@ -6,10 +6,10 @@ #include #include -#include "platform/PlatformTypes.h" #include "GuiComponent.h" #include "minecraft/client/GuiMessage.h" #include "minecraft/client/renderer/entity/ItemRenderer.h" +#include "platform/PlatformTypes.h" class Random; class Minecraft; diff --git a/targets/minecraft/client/gui/GuiComponent.cpp b/targets/minecraft/client/gui/GuiComponent.cpp index 839fbb660..c6918b199 100644 --- a/targets/minecraft/client/gui/GuiComponent.cpp +++ b/targets/minecraft/client/gui/GuiComponent.cpp @@ -1,14 +1,13 @@ #include "GuiComponent.h" -#include "platform/stubs.h" - #include -#include "platform/renderer/renderer.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Font.h" #include "minecraft/client/gui/Gui.h" #include "minecraft/client/renderer/Tesselator.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" void GuiComponent::hLine(int x0, int x1, int y, int col) { if (x1 < x0) { @@ -93,8 +92,8 @@ void GuiComponent::fillGradient(int x0, int y0, int x1, int y1, int col1, GuiComponent::GuiComponent() { blitOffset = 0; } -void GuiComponent::drawCenteredString(Font* font, const std::string& str, - int x, int y, int color) { +void GuiComponent::drawCenteredString(Font* font, const std::string& str, int x, + int y, int color) { font->drawShadow(str, x - (font->width(str)) / 2, y, color); } diff --git a/targets/minecraft/client/gui/InBedChatScreen.cpp b/targets/minecraft/client/gui/InBedChatScreen.cpp index 65cac4711..ec0ab8e10 100644 --- a/targets/minecraft/client/gui/InBedChatScreen.cpp +++ b/targets/minecraft/client/gui/InBedChatScreen.cpp @@ -5,12 +5,12 @@ #include #include "Button.h" -#include "platform/stubs.h" -#include "util/StringHelpers.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/ChatScreen.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/locale/Language.h" +#include "platform/stubs.h" +#include "util/StringHelpers.h" void InBedChatScreen::init() { Keyboard::enableRepeatEvents(true); diff --git a/targets/minecraft/client/gui/JoinMultiplayerScreen.cpp b/targets/minecraft/client/gui/JoinMultiplayerScreen.cpp index 14555085d..c15972f95 100644 --- a/targets/minecraft/client/gui/JoinMultiplayerScreen.cpp +++ b/targets/minecraft/client/gui/JoinMultiplayerScreen.cpp @@ -4,12 +4,12 @@ #include "Button.h" #include "EditBox.h" -#include "platform/stubs.h" -#include "util/StringHelpers.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/Options.h" #include "minecraft/client/gui/Screen.h" #include "minecraft/locale/Language.h" +#include "platform/stubs.h" +#include "util/StringHelpers.h" JoinMultiplayerScreen::JoinMultiplayerScreen(Screen* lastScreen) { ipEdit = nullptr; @@ -103,10 +103,10 @@ void JoinMultiplayerScreen::render(int xm, int ym, float a) { drawCenteredString(font, language->getElement("multiplayer.title"), width / 2, height / 4 - 60 + 20, 0xffffff); - drawString(font, language->getElement("multiplayer.info1"), - width / 2 - 140, height / 4 - 60 + 60 + 9 * 0, 0xa0a0a0); - drawString(font, language->getElement("multiplayer.info2"), - width / 2 - 140, height / 4 - 60 + 60 + 9 * 1, 0xa0a0a0); + drawString(font, language->getElement("multiplayer.info1"), width / 2 - 140, + height / 4 - 60 + 60 + 9 * 0, 0xa0a0a0); + drawString(font, language->getElement("multiplayer.info2"), width / 2 - 140, + height / 4 - 60 + 60 + 9 * 1, 0xa0a0a0); drawString(font, language->getElement("multiplayer.ipinfo"), width / 2 - 140, height / 4 - 60 + 60 + 9 * 4, 0xa0a0a0); diff --git a/targets/minecraft/client/gui/Minimap.cpp b/targets/minecraft/client/gui/Minimap.cpp index d649343f8..ca4374ca5 100644 --- a/targets/minecraft/client/gui/Minimap.cpp +++ b/targets/minecraft/client/gui/Minimap.cpp @@ -1,6 +1,4 @@ #include "Minimap.h" -#include "platform/stubs.h" - #include #include @@ -8,17 +6,18 @@ #include -#include "platform/renderer/renderer.h" #include "Font.h" #include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/client/BufferedImage.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/renderer/Tesselator.h" #include "minecraft/client/renderer/Textures.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/level/material/MaterialColor.h" #include "minecraft/world/level/saveddata/MapItemSavedData.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" int Minimap::LUT[256]; // 4J added bool Minimap::genLUT = true; // 4J added diff --git a/targets/minecraft/client/gui/NameEntryScreen.cpp b/targets/minecraft/client/gui/NameEntryScreen.cpp index 3eb92a8ed..f66185978 100644 --- a/targets/minecraft/client/gui/NameEntryScreen.cpp +++ b/targets/minecraft/client/gui/NameEntryScreen.cpp @@ -3,17 +3,17 @@ #include #include "Button.h" -#include "platform/stubs.h" -#include "util/StringHelpers.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Screen.h" +#include "platform/stubs.h" +#include "util/StringHelpers.h" const std::string NameEntryScreen::allowedChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 " ",.:-_'*!\"#%/()=+?[]{}<>"; -NameEntryScreen::NameEntryScreen(Screen* lastScreen, - const std::string& oldName, int slot) { +NameEntryScreen::NameEntryScreen(Screen* lastScreen, const std::string& oldName, + int slot) { frame = 0; // 4J added this->lastScreen = lastScreen; diff --git a/targets/minecraft/client/gui/PauseScreen.cpp b/targets/minecraft/client/gui/PauseScreen.cpp index 4966f2877..d97aef333 100644 --- a/targets/minecraft/client/gui/PauseScreen.cpp +++ b/targets/minecraft/client/gui/PauseScreen.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "PauseScreen.h" #include @@ -8,17 +7,18 @@ #include #include -#include "platform/input/input.h" #include "Button.h" #include "MessageScreen.h" -#include "minecraft/GameEnums.h" -#include "minecraft/network/INetworkService.h" #include "OptionsScreen.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Screen.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/locale/I18n.h" +#include "minecraft/network/INetworkService.h" #include "minecraft/server/MinecraftServer.h" +#include "platform/input/input.h" PauseScreen::PauseScreen() { saveStep = 0; @@ -30,10 +30,9 @@ void PauseScreen::init() { buttons.clear(); int yo = -16; // 4jcraft: solves the issue of client-side only pausing in the java gui - if (NetworkService.IsLocalGame() && - NetworkService.GetPlayerCount() == 1) + if (NetworkService.IsLocalGame() && NetworkService.GetPlayerCount() == 1) gameServices().setXuiServerAction(PlatformInput.GetPrimaryPad(), - eXuiServerAction_PauseServer, true); + eXuiServerAction_PauseServer, true); buttons.push_back(new Button(1, width / 2 - 100, height / 4 + 24 * 5 + yo, I18n::get("menu.returnToMenu"))); if (!NetworkService.IsHost()) { @@ -70,7 +69,8 @@ void PauseScreen::exitWorld(Minecraft* minecraft, bool save) { if (NetworkService.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) { } if (button->id == 4) { gameServices().setXuiServerAction(PlatformInput.GetPrimaryPad(), - eXuiServerAction_PauseServer, false); + eXuiServerAction_PauseServer, false); minecraft->setScreen(nullptr); // minecraft->grabMouse(); // 4J - removed } diff --git a/targets/minecraft/client/gui/RenameWorldScreen.cpp b/targets/minecraft/client/gui/RenameWorldScreen.cpp index fb060ff2b..da2decafc 100644 --- a/targets/minecraft/client/gui/RenameWorldScreen.cpp +++ b/targets/minecraft/client/gui/RenameWorldScreen.cpp @@ -4,12 +4,12 @@ #include "Button.h" #include "EditBox.h" -#include "platform/stubs.h" -#include "util/StringHelpers.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Screen.h" #include "minecraft/locale/Language.h" #include "minecraft/world/level/storage/LevelStorageSource.h" +#include "platform/stubs.h" +#include "util/StringHelpers.h" RenameWorldScreen::RenameWorldScreen(Screen* lastScreen, const std::string& levelId) { diff --git a/targets/minecraft/client/gui/Screen.cpp b/targets/minecraft/client/gui/Screen.cpp index 42194c7fb..adfa8080c 100644 --- a/targets/minecraft/client/gui/Screen.cpp +++ b/targets/minecraft/client/gui/Screen.cpp @@ -1,19 +1,19 @@ -#include "minecraft/IGameServices.h" #include "Screen.h" -#include "platform/input/input.h" -#include "platform/profile/profile.h" #include "Button.h" -#include "minecraft/GameEnums.h" #include "app/common/Audio/SoundEngine.h" -#include "minecraft/network/INetworkService.h" -#include "platform/stubs.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Screen.h" -#include "minecraft/client/gui/particle/GuiParticles.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/client/gui/ScreenSizeCalculator.h" +#include "minecraft/client/gui/particle/GuiParticles.h" #include "minecraft/client/renderer/Tesselator.h" +#include "minecraft/network/INetworkService.h" +#include "minecraft/sounds/SoundTypes.h" +#include "platform/input/input.h" +#include "platform/profile/profile.h" +#include "platform/stubs.h" Screen::Screen() // 4J added { @@ -43,7 +43,8 @@ void Screen::keyPressed(char eventCharacter, int eventKey) { if (NetworkService.IsLocalGame() && NetworkService.GetPlayerCount() == 1) gameServices().setXuiServerAction(PlatformInput.GetPrimaryPad(), - eXuiServerAction_PauseServer, false); + eXuiServerAction_PauseServer, + false); } } diff --git a/targets/minecraft/client/gui/SelectWorldScreen.cpp b/targets/minecraft/client/gui/SelectWorldScreen.cpp index 813247347..cc78b1386 100644 --- a/targets/minecraft/client/gui/SelectWorldScreen.cpp +++ b/targets/minecraft/client/gui/SelectWorldScreen.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "SelectWorldScreen.h" #include @@ -13,13 +12,14 @@ #include "ConfirmScreen.h" #include "CreateWorldScreen.h" #include "RenameWorldScreen.h" -#include "util/StringHelpers.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Screen.h" #include "minecraft/client/gui/ScrolledSelectionList.h" #include "minecraft/locale/Language.h" +#include "minecraft/util/Log.h" #include "minecraft/world/level/storage/LevelStorageSource.h" #include "minecraft/world/level/storage/LevelSummary.h" +#include "util/StringHelpers.h" SelectWorldScreen::SelectWorldScreen(Screen* lastScreen) { // 4J - added initialisers @@ -110,8 +110,7 @@ void SelectWorldScreen::buttonClicked(Button* button) { std::string warning = "'" + worldName + "' " + language->getElement("selectWorld.deleteWarning"); - std::string yes = - language->getElement("selectWorld.deleteButton"); + std::string yes = language->getElement("selectWorld.deleteButton"); std::string no = language->getElement("gui.cancel"); ConfirmScreen* confirmScreen = diff --git a/targets/minecraft/client/gui/SlideButton.cpp b/targets/minecraft/client/gui/SlideButton.cpp index 4b908415c..95bd9b608 100644 --- a/targets/minecraft/client/gui/SlideButton.cpp +++ b/targets/minecraft/client/gui/SlideButton.cpp @@ -1,10 +1,10 @@ #include "SlideButton.h" -#include "platform/stubs.h" -#include "platform/renderer/renderer.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/Options.h" #include "minecraft/client/gui/Button.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" SlideButton::SlideButton(int id, int x, int y, const Options::Option* option, const std::string& msg, float value) diff --git a/targets/minecraft/client/gui/TradeSwitchButton.cpp b/targets/minecraft/client/gui/TradeSwitchButton.cpp index dc0ecd691..844be43b1 100644 --- a/targets/minecraft/client/gui/TradeSwitchButton.cpp +++ b/targets/minecraft/client/gui/TradeSwitchButton.cpp @@ -1,13 +1,12 @@ #include "TradeSwitchButton.h" -#include "platform/stubs.h" #include - #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Button.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/resources/ResourceLocation.h" +#include "platform/stubs.h" // 4jcraft: referenced from MCP 8.11 (JE 1.6.4) #ifdef ENABLE_JAVA_GUIS diff --git a/targets/minecraft/client/gui/achievement/AchievementPopup.cpp b/targets/minecraft/client/gui/achievement/AchievementPopup.cpp index cb77e9436..789c06100 100644 --- a/targets/minecraft/client/gui/achievement/AchievementPopup.cpp +++ b/targets/minecraft/client/gui/achievement/AchievementPopup.cpp @@ -1,17 +1,15 @@ #include "AchievementPopup.h" -#include "platform/stubs.h" - - -#include "platform/renderer/renderer.h" #include "java/System.h" +#include "minecraft/client/Lighting.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Font.h" #include "minecraft/client/gui/ScreenSizeCalculator.h" #include "minecraft/client/renderer/entity/ItemRenderer.h" #include "minecraft/locale/I18n.h" #include "minecraft/stats/Achievement.h" -#include "minecraft/client/Lighting.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" AchievementPopup::AchievementPopup(Minecraft* mc) { // 4J - added initialisers @@ -78,7 +76,7 @@ void AchievementPopup::render() { prepareWindow(); std::string title = "Minecraft " + SharedConstants::VERSION_STRING + - " Unlicensed Copy :("; + " Unlicensed Copy :("; std::string msg1 = "(Or logged in from another location)"; std::string msg2 = "Purchase at minecraft.net"; diff --git a/targets/minecraft/client/gui/achievement/AchievementScreen.cpp b/targets/minecraft/client/gui/achievement/AchievementScreen.cpp index 1789ce69e..6b34dc186 100644 --- a/targets/minecraft/client/gui/achievement/AchievementScreen.cpp +++ b/targets/minecraft/client/gui/achievement/AchievementScreen.cpp @@ -1,12 +1,8 @@ #include "AchievementScreen.h" - - #include #include -#include "platform/renderer/renderer.h" -#include "platform/stubs.h" #include "minecraft/client/KeyMapping.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/Options.h" @@ -17,6 +13,8 @@ #include "minecraft/locale/I18n.h" #include "minecraft/stats/Achievement.h" #include "minecraft/stats/Achievements.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" AchievementScreen::AchievementScreen(StatsCounter* statsCounter) { // 4J - added initialisers diff --git a/targets/minecraft/client/gui/achievement/AchievementScreen.h b/targets/minecraft/client/gui/achievement/AchievementScreen.h index d2ba38f56..5e780812e 100644 --- a/targets/minecraft/client/gui/achievement/AchievementScreen.h +++ b/targets/minecraft/client/gui/achievement/AchievementScreen.h @@ -2,7 +2,6 @@ #include "minecraft/client/gui/Screen.h" #include "minecraft/stats/Achievements.h" - class StatsCounter; class AchievementScreen : public Screen { diff --git a/targets/minecraft/client/gui/achievement/StatsScreen.cpp b/targets/minecraft/client/gui/achievement/StatsScreen.cpp index d9dbee6b6..cca45430e 100644 --- a/targets/minecraft/client/gui/achievement/StatsScreen.cpp +++ b/targets/minecraft/client/gui/achievement/StatsScreen.cpp @@ -1,8 +1,6 @@ #include "StatsScreen.h" #include "app/common/Audio/SoundEngine.h" -#include "platform/stubs.h" -#include "util/StringHelpers.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Button.h" #include "minecraft/client/gui/Font.h" @@ -16,6 +14,8 @@ #include "minecraft/stats/Stat.h" #include "minecraft/stats/Stats.h" #include "minecraft/stats/StatsCounter.h" +#include "platform/stubs.h" +#include "util/StringHelpers.h" class Tesselator; diff --git a/targets/minecraft/client/gui/inventory/AbstractBeaconButton.cpp b/targets/minecraft/client/gui/inventory/AbstractBeaconButton.cpp index 74e622032..c64f49710 100644 --- a/targets/minecraft/client/gui/inventory/AbstractBeaconButton.cpp +++ b/targets/minecraft/client/gui/inventory/AbstractBeaconButton.cpp @@ -1,13 +1,13 @@ #include "AbstractBeaconButton.h" -#include "platform/stubs.h" #include -#include "platform/renderer/renderer.h" +#include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Button.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/resources/ResourceLocation.h" -#include "minecraft/client/Minecraft.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" // 4jcraft: referenced from MCP 8.11 (JE 1.6.4) #ifdef ENABLE_JAVA_GUIS diff --git a/targets/minecraft/client/gui/inventory/AbstractContainerScreen.cpp b/targets/minecraft/client/gui/inventory/AbstractContainerScreen.cpp index 0618c0a9d..5c552d809 100644 --- a/targets/minecraft/client/gui/inventory/AbstractContainerScreen.cpp +++ b/targets/minecraft/client/gui/inventory/AbstractContainerScreen.cpp @@ -1,11 +1,10 @@ -#include "minecraft/IGameServices.h" #include "AbstractContainerScreen.h" #include #include -#include "platform/stubs.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/KeyMapping.h" #include "minecraft/client/Lighting.h" #include "minecraft/client/Minecraft.h" @@ -15,11 +14,12 @@ #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/client/renderer/entity/ItemRenderer.h" +#include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/inventory/AbstractContainerMenu.h" #include "minecraft/world/inventory/Slot.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/item/Rarity.h" -#include "minecraft/world/entity/player/Inventory.h" +#include "platform/stubs.h" ItemRenderer* AbstractContainerScreen::itemRenderer = new ItemRenderer(); @@ -248,7 +248,8 @@ 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/BeaconCancelButton.cpp b/targets/minecraft/client/gui/inventory/BeaconCancelButton.cpp index 4226697e6..34a6b3137 100644 --- a/targets/minecraft/client/gui/inventory/BeaconCancelButton.cpp +++ b/targets/minecraft/client/gui/inventory/BeaconCancelButton.cpp @@ -23,6 +23,6 @@ BeaconCancelButton::BeaconCancelButton(BeaconScreen* screen, int id, int x, } void BeaconCancelButton::renderTooltip(int xm, int ym) { - screen->renderTooltip(Language::getInstance()->getElement("gui.cancel"), - xm, ym); + screen->renderTooltip(Language::getInstance()->getElement("gui.cancel"), xm, + ym); } \ No newline at end of file diff --git a/targets/minecraft/client/gui/inventory/BeaconPowerButton.cpp b/targets/minecraft/client/gui/inventory/BeaconPowerButton.cpp index 597eb7e18..b4a2acdbb 100644 --- a/targets/minecraft/client/gui/inventory/BeaconPowerButton.cpp +++ b/targets/minecraft/client/gui/inventory/BeaconPowerButton.cpp @@ -1,13 +1,13 @@ -#include "minecraft/IGameServices.h" #include "BeaconPowerButton.h" #include #include "BeaconScreen.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/gui/inventory/AbstractBeaconButton.h" -#include "minecraft/world/effect/MobEffect.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/resources/ResourceLocation.h" +#include "minecraft/world/effect/MobEffect.h" // 4jcraft: referenced from MCP 8.11 (JE 1.6.4) #ifdef ENABLE_JAVA_GUIS diff --git a/targets/minecraft/client/gui/inventory/BeaconPowerButton.h b/targets/minecraft/client/gui/inventory/BeaconPowerButton.h index 9a6750239..f29a10cb7 100644 --- a/targets/minecraft/client/gui/inventory/BeaconPowerButton.h +++ b/targets/minecraft/client/gui/inventory/BeaconPowerButton.h @@ -1,7 +1,6 @@ #pragma once #include "AbstractBeaconButton.h" - class BeaconScreen; class BeaconPowerButton : public AbstractBeaconButton { diff --git a/targets/minecraft/client/gui/inventory/BeaconScreen.cpp b/targets/minecraft/client/gui/inventory/BeaconScreen.cpp index 1b487a04b..012514558 100644 --- a/targets/minecraft/client/gui/inventory/BeaconScreen.cpp +++ b/targets/minecraft/client/gui/inventory/BeaconScreen.cpp @@ -1,13 +1,9 @@ #include "BeaconScreen.h" -#include "platform/stubs.h" - - #include #include #include -#include "platform/renderer/renderer.h" #include "BeaconCancelButton.h" #include "BeaconConfirmButton.h" #include "BeaconPowerButton.h" @@ -28,6 +24,8 @@ #include "minecraft/world/inventory/BeaconMenu.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/level/tile/entity/BeaconTileEntity.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" // 4jcraft: referenced from MCP 8.11 (JE 1.6.4) and the existing // container classes (and iggy too) diff --git a/targets/minecraft/client/gui/inventory/BeaconScreen.h b/targets/minecraft/client/gui/inventory/BeaconScreen.h index 4a977ac58..531b7c551 100644 --- a/targets/minecraft/client/gui/inventory/BeaconScreen.h +++ b/targets/minecraft/client/gui/inventory/BeaconScreen.h @@ -5,7 +5,6 @@ #include "AbstractContainerScreen.h" #include "minecraft/world/inventory/BeaconMenu.h" - class BeaconConfirmButton; class BeaconCancelButton; class BeaconMenu; diff --git a/targets/minecraft/client/gui/inventory/BrewingStandScreen.cpp b/targets/minecraft/client/gui/inventory/BrewingStandScreen.cpp index 0c7cf7a0a..20533c5b8 100644 --- a/targets/minecraft/client/gui/inventory/BrewingStandScreen.cpp +++ b/targets/minecraft/client/gui/inventory/BrewingStandScreen.cpp @@ -1,17 +1,16 @@ #include "BrewingStandScreen.h" -#include "platform/stubs.h" #include - +#include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Font.h" #include "minecraft/client/gui/inventory/AbstractContainerScreen.h" +#include "minecraft/client/renderer/Textures.h" +#include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/inventory/BrewingStandMenu.h" #include "minecraft/world/level/tile/entity/BrewingStandTileEntity.h" -#include "minecraft/client/renderer/Textures.h" -#include "minecraft/client/resources/ResourceLocation.h" -#include "minecraft/client/Minecraft.h" +#include "platform/stubs.h" // 4jcraft: referenced from MCP 8.11 (JE 1.6.4) and the existing // container classes diff --git a/targets/minecraft/client/gui/inventory/BrewingStandScreen.h b/targets/minecraft/client/gui/inventory/BrewingStandScreen.h index 45f4a16bc..51d2a1bd3 100644 --- a/targets/minecraft/client/gui/inventory/BrewingStandScreen.h +++ b/targets/minecraft/client/gui/inventory/BrewingStandScreen.h @@ -5,7 +5,6 @@ #include "AbstractContainerScreen.h" #include "minecraft/world/inventory/BrewingStandMenu.h" - class BrewingStandMenu; class BrewingStandTileEntity; class Inventory; diff --git a/targets/minecraft/client/gui/inventory/ContainerScreen.cpp b/targets/minecraft/client/gui/inventory/ContainerScreen.cpp index ae91c2dcd..5a8dc4c16 100644 --- a/targets/minecraft/client/gui/inventory/ContainerScreen.cpp +++ b/targets/minecraft/client/gui/inventory/ContainerScreen.cpp @@ -1,11 +1,11 @@ #include "ContainerScreen.h" -#include "platform/stubs.h" -#include "minecraft/client/gui/inventory/AbstractContainerScreen.h" #include "minecraft/client/Minecraft.h" -#include "minecraft/world/Container.h" +#include "minecraft/client/gui/inventory/AbstractContainerScreen.h" #include "minecraft/client/renderer/Textures.h" +#include "minecraft/world/Container.h" #include "minecraft/world/inventory/ContainerMenu.h" +#include "platform/stubs.h" ContainerScreen::ContainerScreen(std::shared_ptr inventory, std::shared_ptr container) diff --git a/targets/minecraft/client/gui/inventory/CraftingScreen.cpp b/targets/minecraft/client/gui/inventory/CraftingScreen.cpp index a6bcbf21e..f842e5277 100644 --- a/targets/minecraft/client/gui/inventory/CraftingScreen.cpp +++ b/targets/minecraft/client/gui/inventory/CraftingScreen.cpp @@ -1,5 +1,4 @@ #include "CraftingScreen.h" -#include "platform/stubs.h" #include @@ -11,6 +10,7 @@ #include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/inventory/AbstractContainerMenu.h" #include "minecraft/world/inventory/CraftingMenu.h" +#include "platform/stubs.h" class Player; diff --git a/targets/minecraft/client/gui/inventory/CreativeInventoryScreen.cpp b/targets/minecraft/client/gui/inventory/CreativeInventoryScreen.cpp index cff4ed82d..435c4333b 100644 --- a/targets/minecraft/client/gui/inventory/CreativeInventoryScreen.cpp +++ b/targets/minecraft/client/gui/inventory/CreativeInventoryScreen.cpp @@ -1,24 +1,19 @@ -#include "minecraft/IGameServices.h" #include "CreativeInventoryScreen.h" - - #include #include -#include "platform/input/input.h" -#include "platform/renderer/renderer.h" #include "AbstractContainerScreen.h" #include "app/common/UI/All Platforms/IUIScene_CreativeMenu.h" -#include "platform/stubs.h" -#include "minecraft/client/Minecraft.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Lighting.h" +#include "minecraft/client/Minecraft.h" +#include "minecraft/client/gui/Font.h" #include "minecraft/client/gui/Screen.h" #include "minecraft/client/gui/inventory/AbstractContainerScreen.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/client/renderer/entity/ItemRenderer.h" -#include "minecraft/client/gui/Font.h" #include "minecraft/world/SimpleContainer.h" #include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/entity/player/Player.h" @@ -28,6 +23,9 @@ #include "minecraft/world/item/Item.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/input/input.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" // Static member initialization int CreativeInventoryScreen::selectedTabIndex = @@ -257,8 +255,8 @@ void CreativeInventoryScreen::updateEvents() { currentScroll -= step; currentScroll = std::max(0.0f, std::min(1.0f, currentScroll)); container->scrollTo(currentScroll); - } else if (PlatformInput.ButtonDown(0, - MINECRAFT_ACTION_RIGHT_SCROLL)) { + } else if (PlatformInput.ButtonDown( + 0, MINECRAFT_ACTION_RIGHT_SCROLL)) { currentScroll += step; currentScroll = std::max(0.0f, std::min(1.0f, currentScroll)); container->scrollTo(currentScroll); @@ -410,7 +408,8 @@ void CreativeInventoryScreen::renderLabels() { IUIScene_CreativeMenu::TabSpec* spec = IUIScene_CreativeMenu::specs[selectedTabIndex]; if (spec) { - std::string tabName = gameServices().getString(spec->m_descriptionId); + std::string tabName = + gameServices().getString(spec->m_descriptionId); font->draw(tabName, 8, 6, 0x404040); } } @@ -587,9 +586,9 @@ bool CreativeInventoryScreen::renderIconTooltip(int tab, int mouseX, if (isMouseOverIcon(tab, x, y)) { glDisable(GL_LIGHTING); glDisable(GL_DEPTH_TEST); - renderTooltip( - gameServices().getString(IUIScene_CreativeMenu::specs[tab]->m_descriptionId), - mouseX, mouseY); + renderTooltip(gameServices().getString( + IUIScene_CreativeMenu::specs[tab]->m_descriptionId), + mouseX, mouseY); glEnable(GL_LIGHTING); glEnable(GL_DEPTH_TEST); return true; diff --git a/targets/minecraft/client/gui/inventory/EnchantmentScreen.cpp b/targets/minecraft/client/gui/inventory/EnchantmentScreen.cpp index 24b817438..bd1703ed2 100644 --- a/targets/minecraft/client/gui/inventory/EnchantmentScreen.cpp +++ b/targets/minecraft/client/gui/inventory/EnchantmentScreen.cpp @@ -1,5 +1,4 @@ #include "EnchantmentScreen.h" -#include "platform/stubs.h" #include #include @@ -8,7 +7,6 @@ #include #include - #include "AbstractContainerScreen.h" #include "minecraft/client/Lighting.h" #include "minecraft/client/Minecraft.h" @@ -23,6 +21,7 @@ #include "minecraft/world/inventory/EnchantmentMenu.h" #include "minecraft/world/inventory/Slot.h" #include "minecraft/world/item/ItemInstance.h" +#include "platform/stubs.h" class Level; @@ -317,11 +316,10 @@ EnchantmentScreen::EnchantmentNames::EnchantmentNames() { "physical grow shrink demon elemental spirit animal creature beast " "humanoid undead fresh stale "; std::istringstream iss(allWords); - std::copy(std::istream_iterator >(iss), - std::istream_iterator >(), - std::back_inserter(words)); + std::copy( + std::istream_iterator >(iss), + std::istream_iterator >(), + std::back_inserter(words)); } std::string EnchantmentScreen::EnchantmentNames::getRandomName() { diff --git a/targets/minecraft/client/gui/inventory/FurnaceScreen.cpp b/targets/minecraft/client/gui/inventory/FurnaceScreen.cpp index 06cbfe66f..054d1371e 100644 --- a/targets/minecraft/client/gui/inventory/FurnaceScreen.cpp +++ b/targets/minecraft/client/gui/inventory/FurnaceScreen.cpp @@ -1,16 +1,16 @@ #include "FurnaceScreen.h" -#include "platform/stubs.h" #include +#include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Font.h" #include "minecraft/client/gui/inventory/AbstractContainerScreen.h" +#include "minecraft/client/renderer/Textures.h" +#include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/inventory/FurnaceMenu.h" #include "minecraft/world/level/tile/entity/FurnaceTileEntity.h" -#include "minecraft/client/renderer/Textures.h" -#include "minecraft/client/resources/ResourceLocation.h" -#include "minecraft/client/Minecraft.h" +#include "platform/stubs.h" #ifdef ENABLE_JAVA_GUIS ResourceLocation GUI_FURNACE_LOCATION = ResourceLocation(TN_GUI_FURNACE); diff --git a/targets/minecraft/client/gui/inventory/HopperScreen.cpp b/targets/minecraft/client/gui/inventory/HopperScreen.cpp index cb5708a3a..8d88dda59 100644 --- a/targets/minecraft/client/gui/inventory/HopperScreen.cpp +++ b/targets/minecraft/client/gui/inventory/HopperScreen.cpp @@ -1,13 +1,13 @@ #include "HopperScreen.h" -#include "platform/stubs.h" +#include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Font.h" #include "minecraft/client/gui/inventory/AbstractContainerScreen.h" +#include "minecraft/client/renderer/Textures.h" #include "minecraft/world/Container.h" #include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/inventory/HopperMenu.h" -#include "minecraft/client/Minecraft.h" -#include "minecraft/client/renderer/Textures.h" +#include "platform/stubs.h" // 4jcraft: referenced from MCP 8.11 (JE 1.6.4) and the existing // container classes diff --git a/targets/minecraft/client/gui/inventory/HorseInventoryScreen.cpp b/targets/minecraft/client/gui/inventory/HorseInventoryScreen.cpp index 7ebd3f8d9..1568b13ea 100644 --- a/targets/minecraft/client/gui/inventory/HorseInventoryScreen.cpp +++ b/targets/minecraft/client/gui/inventory/HorseInventoryScreen.cpp @@ -1,10 +1,8 @@ #include "HorseInventoryScreen.h" -#include "platform/stubs.h" #include #include - #include "minecraft/client/Lighting.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Font.h" @@ -16,6 +14,7 @@ #include "minecraft/world/entity/animal/EntityHorse.h" #include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/inventory/HorseInventoryMenu.h" +#include "platform/stubs.h" class EntityHorse; diff --git a/targets/minecraft/client/gui/inventory/HorseInventoryScreen.h b/targets/minecraft/client/gui/inventory/HorseInventoryScreen.h index c543c563b..4a08c9be5 100644 --- a/targets/minecraft/client/gui/inventory/HorseInventoryScreen.h +++ b/targets/minecraft/client/gui/inventory/HorseInventoryScreen.h @@ -3,7 +3,6 @@ #include "AbstractContainerScreen.h" - class Container; class EntityHorse; class Inventory; diff --git a/targets/minecraft/client/gui/inventory/InventoryScreen.cpp b/targets/minecraft/client/gui/inventory/InventoryScreen.cpp index db178dc35..8e6f17b80 100644 --- a/targets/minecraft/client/gui/inventory/InventoryScreen.cpp +++ b/targets/minecraft/client/gui/inventory/InventoryScreen.cpp @@ -1,11 +1,9 @@ #include "InventoryScreen.h" -#include "platform/stubs.h" #include #include #include -#include "platform/renderer/renderer.h" #include "minecraft/client/Lighting.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Button.h" @@ -19,6 +17,8 @@ #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/world/entity/player/Player.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" InventoryScreen::InventoryScreen(std::shared_ptr player) : AbstractContainerScreen(player->inventoryMenu) { diff --git a/targets/minecraft/client/gui/inventory/MerchantScreen.cpp b/targets/minecraft/client/gui/inventory/MerchantScreen.cpp index 7a832e609..9f6a995dc 100644 --- a/targets/minecraft/client/gui/inventory/MerchantScreen.cpp +++ b/targets/minecraft/client/gui/inventory/MerchantScreen.cpp @@ -1,11 +1,9 @@ #include "MerchantScreen.h" -#include "platform/stubs.h" #include #include #include - #include "AbstractContainerScreen.h" #include "java/InputOutputStream/ByteArrayOutputStream.h" #include "java/InputOutputStream/DataOutputStream.h" @@ -23,8 +21,9 @@ #include "minecraft/world/inventory/MerchantContainer.h" #include "minecraft/world/inventory/MerchantMenu.h" #include "minecraft/world/item/trading/Merchant.h" -#include "minecraft/world/item/trading/MerchantRecipeList.h" #include "minecraft/world/item/trading/MerchantRecipe.h" +#include "minecraft/world/item/trading/MerchantRecipeList.h" +#include "platform/stubs.h" class Level; diff --git a/targets/minecraft/client/gui/inventory/MerchantScreen.h b/targets/minecraft/client/gui/inventory/MerchantScreen.h index 698fc394c..d48ab2028 100644 --- a/targets/minecraft/client/gui/inventory/MerchantScreen.h +++ b/targets/minecraft/client/gui/inventory/MerchantScreen.h @@ -5,7 +5,6 @@ #include "AbstractContainerScreen.h" #include "minecraft/world/inventory/MerchantMenu.h" - class TradeSwitchButton; class Inventory; class Level; diff --git a/targets/minecraft/client/gui/inventory/RepairScreen.cpp b/targets/minecraft/client/gui/inventory/RepairScreen.cpp index ae6122887..4f9cad4a8 100644 --- a/targets/minecraft/client/gui/inventory/RepairScreen.cpp +++ b/targets/minecraft/client/gui/inventory/RepairScreen.cpp @@ -1,12 +1,8 @@ #include "RepairScreen.h" -#include "platform/stubs.h" - - #include #include -#include "platform/renderer/renderer.h" #include "java/InputOutputStream/ByteArrayOutputStream.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/client/Minecraft.h" @@ -22,6 +18,8 @@ #include "minecraft/world/inventory/AnvilMenu.h" #include "minecraft/world/inventory/Slot.h" #include "minecraft/world/item/ItemInstance.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" class Inventory; class Level; @@ -73,8 +71,7 @@ void RepairScreen::render(int xm, int ym, float a) { } void RepairScreen::renderLabels() { - std::string title = - Language::getInstance()->getElement("container.repair"); + std::string title = Language::getInstance()->getElement("container.repair"); font->draw(title, 60, 6, 0x404040); if (repairMenu->cost > 0) { diff --git a/targets/minecraft/client/gui/inventory/TextEditScreen.cpp b/targets/minecraft/client/gui/inventory/TextEditScreen.cpp index c3ddf2b66..d52f28bc8 100644 --- a/targets/minecraft/client/gui/inventory/TextEditScreen.cpp +++ b/targets/minecraft/client/gui/inventory/TextEditScreen.cpp @@ -2,8 +2,6 @@ #include -#include "platform/renderer/renderer.h" -#include "platform/stubs.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Button.h" @@ -14,6 +12,8 @@ #include "minecraft/network/packet/SignUpdatePacket.h" #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/level/tile/entity/SignTileEntity.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" const std::string TextEditScreen::allowedChars = SharedConstants::acceptableLetters; diff --git a/targets/minecraft/client/gui/inventory/TrapScreen.cpp b/targets/minecraft/client/gui/inventory/TrapScreen.cpp index 98fdcaab4..8b68a5b12 100644 --- a/targets/minecraft/client/gui/inventory/TrapScreen.cpp +++ b/targets/minecraft/client/gui/inventory/TrapScreen.cpp @@ -4,11 +4,11 @@ #include "minecraft/client/gui/Font.h" #include "minecraft/client/gui/inventory/AbstractContainerScreen.h" +#include "minecraft/client/renderer/Textures.h" +#include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/inventory/TrapMenu.h" #include "minecraft/world/level/tile/entity/DispenserTileEntity.h" -#include "minecraft/client/renderer/Textures.h" -#include "minecraft/client/resources/ResourceLocation.h" #ifdef ENABLE_JAVA_GUIS ResourceLocation GUI_TRAP_LOCATION = ResourceLocation(TN_GUI_TRAP); diff --git a/targets/minecraft/client/gui/particle/GuiParticle.cpp b/targets/minecraft/client/gui/particle/GuiParticle.cpp index 9d46a83b7..8fed392ce 100644 --- a/targets/minecraft/client/gui/particle/GuiParticle.cpp +++ b/targets/minecraft/client/gui/particle/GuiParticle.cpp @@ -1,8 +1,8 @@ #include "GuiParticle.h" -#include "platform/stubs.h" -#include "java/Random.h" #include "java/Color.h" +#include "java/Random.h" +#include "platform/stubs.h" Random* GuiParticle::random = new Random(); diff --git a/targets/minecraft/client/level/DemoLevel.h b/targets/minecraft/client/level/DemoLevel.h index b9ab5932d..7f161c714 100644 --- a/targets/minecraft/client/level/DemoLevel.h +++ b/targets/minecraft/client/level/DemoLevel.h @@ -6,7 +6,6 @@ #include "minecraft/world/level/Level.h" - class Dimension; class LevelSettings; class LevelStorage; diff --git a/targets/minecraft/client/model/BookModel.h b/targets/minecraft/client/model/BookModel.h index 4efb7d06e..940ba85b1 100644 --- a/targets/minecraft/client/model/BookModel.h +++ b/targets/minecraft/client/model/BookModel.h @@ -9,7 +9,7 @@ public: ModelPart *leftLid, *rightLid; ModelPart *leftPages, *rightPages; ModelPart *flipPage1, *flipPage2; - ModelPart* seam; + ModelPart *seam; BookModel(); virtual void render(std::shared_ptr entity, float time, float r, diff --git a/targets/minecraft/client/model/ChestModel.cpp b/targets/minecraft/client/model/ChestModel.cpp index baf79cd93..830f20cdd 100644 --- a/targets/minecraft/client/model/ChestModel.cpp +++ b/targets/minecraft/client/model/ChestModel.cpp @@ -1,8 +1,8 @@ #include "ChestModel.h" -#include "platform/stubs.h" -#include "platform/renderer/renderer.h" #include "minecraft/client/model/geom/ModelPart.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ChestModel::ChestModel() { lid = ((new ModelPart(this, 0, 0)))->setTexSize(64, 64); diff --git a/targets/minecraft/client/model/ChickenModel.cpp b/targets/minecraft/client/model/ChickenModel.cpp index 9f55a298c..509b05feb 100644 --- a/targets/minecraft/client/model/ChickenModel.cpp +++ b/targets/minecraft/client/model/ChickenModel.cpp @@ -1,14 +1,14 @@ #include "ChickenModel.h" -#include "platform/stubs.h" #include #include #include -#include "platform/renderer/renderer.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/client/model/geom/ModelPart.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ChickenModel::ChickenModel() : Model() { int yo = 16; diff --git a/targets/minecraft/client/model/GhastModel.cpp b/targets/minecraft/client/model/GhastModel.cpp index 49c79f342..269345fdb 100644 --- a/targets/minecraft/client/model/GhastModel.cpp +++ b/targets/minecraft/client/model/GhastModel.cpp @@ -1,14 +1,14 @@ #include "GhastModel.h" -#include "platform/stubs.h" #include #include -#include "platform/renderer/renderer.h" #include "java/Random.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/client/model/geom/ModelPart.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" GhastModel::GhastModel() : Model() { int yoffs = -16; diff --git a/targets/minecraft/client/model/HumanoidModel.cpp b/targets/minecraft/client/model/HumanoidModel.cpp index aa232c760..355e0a9b0 100644 --- a/targets/minecraft/client/model/HumanoidModel.cpp +++ b/targets/minecraft/client/model/HumanoidModel.cpp @@ -1,15 +1,15 @@ -#include "minecraft/util/Log.h" -#include "platform/stubs.h" #include "HumanoidModel.h" #include #include #include -#include "platform/renderer/renderer.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/client/model/geom/ModelPart.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/Entity.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" // 4J added diff --git a/targets/minecraft/client/model/ModelHorse.cpp b/targets/minecraft/client/model/ModelHorse.cpp index 0f1ade837..8404face9 100644 --- a/targets/minecraft/client/model/ModelHorse.cpp +++ b/targets/minecraft/client/model/ModelHorse.cpp @@ -1,18 +1,18 @@ #include "ModelHorse.h" -#include "platform/stubs.h" #include #include #include #include -#include "platform/renderer/renderer.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/client/model/geom/ModelPart.h" #include "minecraft/util/Mth.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/animal/EntityHorse.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ModelHorse::ModelHorse() { texWidth = 128; diff --git a/targets/minecraft/client/model/OcelotModel.cpp b/targets/minecraft/client/model/OcelotModel.cpp index 1b0d29a06..b92b62dc4 100644 --- a/targets/minecraft/client/model/OcelotModel.cpp +++ b/targets/minecraft/client/model/OcelotModel.cpp @@ -1,5 +1,4 @@ #include "OcelotModel.h" -#include "platform/stubs.h" #include @@ -7,10 +6,11 @@ #include #include -#include "platform/renderer/renderer.h" #include "minecraft/client/model/geom/ModelPart.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/animal/Ocelot.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" const float OcelotModel::xo = 0; const float OcelotModel::yo = 16; diff --git a/targets/minecraft/client/model/OcelotModel.h b/targets/minecraft/client/model/OcelotModel.h index ee5a4d96e..c54154d3e 100644 --- a/targets/minecraft/client/model/OcelotModel.h +++ b/targets/minecraft/client/model/OcelotModel.h @@ -39,7 +39,7 @@ public: void render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); - void render(OcelotModel* model, float scale, bool usecompiled); + void render(OcelotModel *model, float scale, bool usecompiled); void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, std::shared_ptr entity, unsigned int uiBitmaskOverrideAnim = 0); diff --git a/targets/minecraft/client/model/QuadrupedModel.cpp b/targets/minecraft/client/model/QuadrupedModel.cpp index 1c98b7f2e..e85d7cd47 100644 --- a/targets/minecraft/client/model/QuadrupedModel.cpp +++ b/targets/minecraft/client/model/QuadrupedModel.cpp @@ -1,15 +1,14 @@ #include "QuadrupedModel.h" -#include "platform/stubs.h" #include #include #include -#include "platform/renderer/renderer.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/client/model/geom/ModelPart.h" - +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" QuadrupedModel::QuadrupedModel(int legSize, float g) : Model() { yHeadOffs = 8; diff --git a/targets/minecraft/client/model/WolfModel.cpp b/targets/minecraft/client/model/WolfModel.cpp index b1f345c0b..4847bc56e 100644 --- a/targets/minecraft/client/model/WolfModel.cpp +++ b/targets/minecraft/client/model/WolfModel.cpp @@ -1,16 +1,16 @@ #include "WolfModel.h" -#include "platform/stubs.h" #include #include #include -#include "platform/renderer/renderer.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/client/model/geom/ModelPart.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/animal/Wolf.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" WolfModel::WolfModel() { float g = 0; diff --git a/targets/minecraft/client/model/dragon/DragonModel.cpp b/targets/minecraft/client/model/dragon/DragonModel.cpp index 9f64413fd..1c2919e77 100644 --- a/targets/minecraft/client/model/dragon/DragonModel.cpp +++ b/targets/minecraft/client/model/dragon/DragonModel.cpp @@ -1,5 +1,4 @@ #include "DragonModel.h" -#include "platform/stubs.h" #include @@ -8,12 +7,12 @@ #include #include - -#include "platform/renderer/renderer.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/client/model/geom/ModelPart.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/boss/enderdragon/EnderDragon.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" DragonModel::DragonModel(float g) : Model() { // 4J-PB diff --git a/targets/minecraft/client/model/dragon/EnderCrystalModel.cpp b/targets/minecraft/client/model/dragon/EnderCrystalModel.cpp index 590cd0f8a..c92b278bd 100644 --- a/targets/minecraft/client/model/dragon/EnderCrystalModel.cpp +++ b/targets/minecraft/client/model/dragon/EnderCrystalModel.cpp @@ -1,12 +1,11 @@ #include "EnderCrystalModel.h" -#include "platform/stubs.h" #include #include - -#include "platform/renderer/renderer.h" #include "minecraft/client/model/geom/ModelPart.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" EnderCrystalModel::EnderCrystalModel(float g) { glass = new ModelPart(this, "glass"); diff --git a/targets/minecraft/client/model/geom/Model.h b/targets/minecraft/client/model/geom/Model.h index 3951fd120..7becdc889 100644 --- a/targets/minecraft/client/model/geom/Model.h +++ b/targets/minecraft/client/model/geom/Model.h @@ -5,8 +5,8 @@ #include #include -#include "minecraft/client/model/SkinBox.h" #include "java/Random.h" +#include "minecraft/client/model/SkinBox.h" class Mob; class ModelPart; diff --git a/targets/minecraft/client/model/geom/ModelPart.cpp b/targets/minecraft/client/model/geom/ModelPart.cpp index f49fa93cc..e9766fa44 100644 --- a/targets/minecraft/client/model/geom/ModelPart.cpp +++ b/targets/minecraft/client/model/geom/ModelPart.cpp @@ -1,16 +1,14 @@ #include "ModelPart.h" -#include "platform/stubs.h" - - #include -#include "platform/renderer/renderer.h" #include "Cube.h" #include "TexOffs.h" #include "minecraft/client/MemoryTracker.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/client/renderer/Tesselator.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" const float ModelPart::RAD = (180.0f / std::numbers::pi); diff --git a/targets/minecraft/client/model/geom/ModelPart.h b/targets/minecraft/client/model/geom/ModelPart.h index fb1eace16..0dbba593a 100644 --- a/targets/minecraft/client/model/geom/ModelPart.h +++ b/targets/minecraft/client/model/geom/ModelPart.h @@ -2,9 +2,9 @@ #include #include -#include "minecraft/client/model/SkinBox.h" #include "Model.h" #include "minecraft/client/model/Polygon.h" +#include "minecraft/client/model/SkinBox.h" #include "minecraft/client/model/Vertex.h" class Cube; diff --git a/targets/minecraft/client/multiplayer/ClientConnection.cpp b/targets/minecraft/client/multiplayer/ClientConnection.cpp index b98a62d4a..7b47701f3 100644 --- a/targets/minecraft/client/multiplayer/ClientConnection.cpp +++ b/targets/minecraft/client/multiplayer/ClientConnection.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "ClientConnection.h" #include @@ -12,18 +10,13 @@ #include #include -#include "platform/PlatformTypes.h" -#include "platform/input/input.h" -#include "platform/profile/profile.h" -#include "minecraft/GameEnums.h" +#include "MultiPlayerLevel.h" +#include "ReceivingLevelScreen.h" #include "app/common/App_structs.h" #include "app/common/ConsoleGameMode.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" #include "app/common/DLC/DLCSkinFile.h" -#include "minecraft/world/level/GameRules/GameRuleDefinition.h" -#include "minecraft/network/INetworkService.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "app/common/Network/Socket.h" #include "app/common/Tutorial/FullTutorialMode.h" #include "app/common/Tutorial/Tutorial.h" @@ -33,20 +26,19 @@ #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.h" #include "app/linux/Linux_UIController.h" -#include "MultiPlayerLevel.h" -#include "ReceivingLevelScreen.h" -#include "util/Timer.h" -#include "util/StringHelpers.h" #include "java/Class.h" #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/Pos.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/ProgressRenderer.h" #include "minecraft/client/User.h" #include "minecraft/client/gui/Gui.h" +#include "minecraft/client/gui/inventory/MerchantScreen.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/client/particle/CritParticle.h" @@ -57,8 +49,8 @@ #include "minecraft/client/renderer/LevelRenderer.h" #include "minecraft/client/skins/DLCTexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" -#include "minecraft/client/gui/inventory/MerchantScreen.h" #include "minecraft/core/particles/ParticleTypes.h" +#include "minecraft/network/INetworkService.h" #include "minecraft/network/packet/AddEntityPacket.h" #include "minecraft/network/packet/AddExperienceOrbPacket.h" #include "minecraft/network/packet/AddGlobalEntityPacket.h" @@ -126,9 +118,11 @@ #include "minecraft/network/packet/UpdateMobEffectPacket.h" #include "minecraft/network/packet/UpdateProgressPacket.h" #include "minecraft/network/packet/XZPacket.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/sounds/SoundTypes.h" #include "minecraft/stats/GenericStats.h" +#include "minecraft/util/Log.h" #include "minecraft/world/SimpleContainer.h" #include "minecraft/world/effect/MobEffectInstance.h" #include "minecraft/world/entity/EntityIO.h" @@ -180,6 +174,7 @@ #include "minecraft/world/item/trading/Merchant.h" #include "minecraft/world/item/trading/MerchantRecipeList.h" #include "minecraft/world/level/Explosion.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelSettings.h" #include "minecraft/world/level/chunk/LevelChunk.h" @@ -201,7 +196,12 @@ #include "minecraft/world/level/tile/entity/SkullTileEntity.h" #include "minecraft/world/level/tile/entity/TileEntity.h" #include "minecraft/world/phys/AABB.h" +#include "platform/PlatformTypes.h" +#include "platform/input/input.h" +#include "platform/profile/profile.h" #include "strings.h" +#include "util/StringHelpers.h" +#include "util/Timer.h" class Packet; class TexturePack; @@ -375,15 +375,17 @@ void ClientConnection::handleLogin(std::shared_ptr packet) { } Log::info("ClientConnection - DIFFICULTY --- %d\n", - packet->difficulty); + packet->difficulty); level->difficulty = packet->difficulty; // 4J Added level->isClientSide = true; minecraft->setLevel(level); } 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(PlatformInput.GetPrimaryPad()); @@ -393,7 +395,7 @@ void ClientConnection::handleLogin(std::shared_ptr packet) { std::uint8_t networkSmallId = getSocket()->getSmallId(); gameServices().updatePlayerInfo(networkSmallId, packet->m_playerIndex, - packet->m_uiGamePrivileges); + packet->m_uiGamePrivileges); minecraft->player->setPlayerGamePrivilege( Player::ePlayerGamePrivilege_All, packet->m_uiGamePrivileges); @@ -410,8 +412,9 @@ void ClientConnection::handleLogin(std::shared_ptr packet) { displayPrivilegeChanges(minecraft->player, startingPrivileges); // update the debugoptions - gameServices().setGameSettingsDebugMask(PlatformInput.GetPrimaryPad(), - gameServices().debugGetMask(-1, true)); + gameServices().setGameSettingsDebugMask( + PlatformInput.GetPrimaryPad(), + gameServices().debugGetMask(-1, true)); } else { // 4J-PB - this isn't the level we want // level = (MultiPlayerLevel *)minecraft->level; @@ -443,10 +446,10 @@ void ClientConnection::handleLogin(std::shared_ptr packet) { dimensionLevel->difficulty = packet->difficulty; // 4J Added dimensionLevel->isClientSide = true; level = dimensionLevel; - // 4J Stu - At time of writing PlatformProfile.GetGamertag() does not - // always return the correct name, if sign-ins are turned off while - // the player signed in. Using the qnetPlayer instead. need to have - // a level before create extra local player + // 4J Stu - At time of writing PlatformProfile.GetGamertag() does + // not always return the correct name, if sign-ins are turned off + // while the player signed in. Using the qnetPlayer instead. need to + // have a level before create extra local player MultiPlayerLevel* levelpassedin = (MultiPlayerLevel*)level; player = minecraft->createExtraLocalPlayer( m_userIndex, networkPlayer->GetOnlineName(), m_userIndex, @@ -474,7 +477,7 @@ void ClientConnection::handleLogin(std::shared_ptr packet) { std::uint8_t networkSmallId = getSocket()->getSmallId(); gameServices().updatePlayerInfo(networkSmallId, packet->m_playerIndex, - packet->m_uiGamePrivileges); + packet->m_uiGamePrivileges); player->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_All, packet->m_uiGamePrivileges); @@ -533,7 +536,7 @@ void ClientConnection::handleAddEntity( } } - if (owner->instanceof(eTYPE_PLAYER)) { + if (owner->instanceof (eTYPE_PLAYER)) { std::shared_ptr player = std::dynamic_pointer_cast(owner); std::shared_ptr hook = @@ -556,8 +559,7 @@ void ClientConnection::handleAddEntity( int ix = (int)x; int iy = (int)y; int iz = (int)z; - Log::info("ClientConnection ITEM_FRAME xyz %d,%d,%d\n", ix, - iy, iz); + Log::info("ClientConnection ITEM_FRAME xyz %d,%d,%d\n", ix, iy, iz); } e = std::shared_ptr( new ItemFrame(level, (int)x, (int)y, (int)z, packet->data)); @@ -788,7 +790,8 @@ void ClientConnection::handleAddEntity( } } - if (owner != nullptr && owner->instanceof(eTYPE_LIVINGENTITY)) { + if (owner != nullptr && owner->instanceof + (eTYPE_LIVINGENTITY)) { std::dynamic_pointer_cast(e)->owner = std::dynamic_pointer_cast(owner); } @@ -873,8 +876,7 @@ void ClientConnection::handleAddPlayer( PlatformProfile.AreXUIDSEqual(playerXUIDOnline, packet->xuid)) || (playerXUIDOffline != INVALID_XUID && PlatformProfile.AreXUIDSEqual(playerXUIDOffline, packet->xuid))) { - Log::info( - "AddPlayerPacket received with XUID of local player\n"); + Log::info("AddPlayerPacket received with XUID of local player\n"); return; } } @@ -931,13 +933,15 @@ 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 %s is %s\n", player->name.c_str(), - player->customTextureUrl.c_str()); + player->customTextureUrl.c_str()); if (!player->customTextureUrl2.empty() && player->customTextureUrl2.substr(0, 3).compare("def") != 0 && @@ -952,13 +956,15 @@ 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 %s is %s\n", player->name.c_str(), - player->customTextureUrl2.c_str()); + player->customTextureUrl2.c_str()); level->putEntity(packet->id, player); @@ -1369,7 +1375,8 @@ 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); @@ -1761,7 +1768,8 @@ void ClientConnection::handleChat(std::shared_ptr packet) { message = gameServices().getString(IDS_MAX_VILLAGERS_SPAWNED); break; case ChatPacket::e_ChatPlayerMaxPigsSheepCows: - message = gameServices().getString(IDS_MAX_PIGS_SHEEP_COWS_CATS_SPAWNED); + message = + gameServices().getString(IDS_MAX_PIGS_SHEEP_COWS_CATS_SPAWNED); break; case ChatPacket::e_ChatPlayerMaxChickens: message = gameServices().getString(IDS_MAX_CHICKENS_SPAWNED); @@ -1781,7 +1789,8 @@ void ClientConnection::handleChat(std::shared_ptr packet) { // Breeding case ChatPacket::e_ChatPlayerMaxBredPigsSheepCows: - message = gameServices().getString(IDS_MAX_PIGS_SHEEP_COWS_CATS_BRED); + message = + gameServices().getString(IDS_MAX_PIGS_SHEEP_COWS_CATS_BRED); break; case ChatPacket::e_ChatPlayerMaxBredChickens: message = gameServices().getString(IDS_MAX_CHICKENS_BRED); @@ -1820,9 +1829,9 @@ void ClientConnection::handleChat(std::shared_ptr packet) { message = replaceAll(message, "{*DESTINATION*}", sourceDisplayName); } else { - message = replaceAll( - message, "{*DESTINATION*}", - gameServices().getEntityName((EntityTypeId)packet->m_intArgs[0])); + message = replaceAll(message, "{*DESTINATION*}", + gameServices().getEntityName( + (EntityTypeId)packet->m_intArgs[0])); } break; case ChatPacket::e_ChatCommandTeleportMe: @@ -1854,8 +1863,8 @@ void ClientConnection::handleChat(std::shared_ptr packet) { !packet->m_stringArgs[1].empty()) { entityName = packet->m_stringArgs[1]; } else { - entityName = - gameServices().getEntityName((EntityTypeId)packet->m_intArgs[0]); + entityName = gameServices().getEntityName( + (EntityTypeId)packet->m_intArgs[0]); } message = replaceAll(message, "{*SOURCE*}", entityName); @@ -1879,12 +1888,12 @@ void ClientConnection::handleAnimate(std::shared_ptr packet) { std::shared_ptr e = getEntity(packet->id); if (e == nullptr) return; if (packet->action == AnimatePacket::SWING) { - if (e->instanceof(eTYPE_LIVINGENTITY)) + if (e->instanceof (eTYPE_LIVINGENTITY)) std::dynamic_pointer_cast(e)->swing(); } else if (packet->action == AnimatePacket::HURT) { e->animateHurt(); } else if (packet->action == AnimatePacket::WAKE_UP) { - if (e->instanceof(eTYPE_PLAYER)) + if (e->instanceof (eTYPE_PLAYER)) std::dynamic_pointer_cast(e)->stopSleepInBed(false, false, false); } else if (packet->action == AnimatePacket::RESPAWN) { @@ -1900,8 +1909,8 @@ void ClientConnection::handleAnimate(std::shared_ptr packet) { new CritParticle(minecraft->level, e, eParticleType_magicCrit)); critParticle->CritParticlePostConstructor(); minecraft->particleEngine->add(critParticle); - } else if ((packet->action == AnimatePacket::EAT) && - e->instanceof(eTYPE_REMOTEPLAYER)) { + } else if ((packet->action == AnimatePacket::EAT) && e->instanceof + (eTYPE_REMOTEPLAYER)) { } } @@ -1929,13 +1938,15 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) { if (!NetworkService.IsHost()) { // set the game host settings - gameServices().setGameHostOption(eGameHostOption_All, packet->m_serverSettings); + gameServices().setGameHostOption(eGameHostOption_All, + packet->m_serverSettings); // 4J-PB - if we go straight in from the menus via an invite, we won't // have the DLC info if (gameServices().getTMSGlobalFileListRead() == false) { - gameServices().setTMSAction(PlatformInput.GetPrimaryPad(), - eTMSAction_TMSPP_RetrieveFiles_RunPlayGame); + gameServices().setTMSAction( + PlatformInput.GetPrimaryPad(), + eTMSAction_TMSPP_RetrieveFiles_RunPlayGame); } } @@ -1965,8 +1976,8 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) { "privileges: %d\n", reason); gameServices().setDisconnectReason(reason); - gameServices().setAction(PlatformInput.GetPrimaryPad(), eAppAction_ExitWorld, - (void*)true); + gameServices().setAction(PlatformInput.GetPrimaryPad(), + eAppAction_ExitWorld, (void*)true); } else { if (!isFriendsWithHost) reason = DisconnectPacket::eDisconnect_NotFriendsWithHost; @@ -2003,7 +2014,8 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) { // 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 @@ -2016,9 +2028,8 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) { Minecraft* pMinecraft = Minecraft::GetInstance(); if (pMinecraft->skins->selectTexturePackById( packet->m_texturePackId)) { - Log::info( - "Selected texture pack %d from Pre-Login packet\n", - packet->m_texturePackId); + Log::info("Selected texture pack %d from Pre-Login packet\n", + packet->m_texturePackId); } else { Log::info( "Could not select texture pack %d from Pre-Login packet, " @@ -2064,7 +2075,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), + packet->m_ugcPlayersVersion, + gameServices().getPlayerSkinId(m_userIndex), gameServices().getPlayerCapeId(m_userIndex), PlatformProfile.IsGuest(m_userIndex))); fprintf(stderr, "[LOGIN] LoginPacket sent successfully\n"); @@ -2174,13 +2186,13 @@ void ClientConnection::handleEntityLinkPacket( ->entityId) { sourceEntity = Minecraft::GetInstance()->localplayers[m_userIndex]; - if (destEntity != nullptr && destEntity->instanceof(eTYPE_BOAT)) + if (destEntity != nullptr && destEntity->instanceof (eTYPE_BOAT)) (std::dynamic_pointer_cast(destEntity))->setDoLerp(false); displayMountMessage = (sourceEntity->riding == nullptr && destEntity != nullptr); - } else if (destEntity != nullptr && - destEntity->instanceof(eTYPE_BOAT)) { + } else if (destEntity != nullptr && destEntity->instanceof + (eTYPE_BOAT)) { (std::dynamic_pointer_cast(destEntity))->setDoLerp(true); } @@ -2197,7 +2209,7 @@ void ClientConnection::handleEntityLinkPacket( } */ } else if (packet->type == SetEntityLinkPacket::LEASH) { - if ((sourceEntity != nullptr) && sourceEntity->instanceof(eTYPE_MOB)) { + if ((sourceEntity != nullptr) && sourceEntity->instanceof (eTYPE_MOB)) { if (destEntity != nullptr) { (std::dynamic_pointer_cast(sourceEntity)) ->setLeashedTo(destEntity, false); @@ -2262,11 +2274,12 @@ void ClientConnection::handleTexture(std::shared_ptr packet) { // Request for texture #if !defined(_CONTENT_PACKAGE) printf("Client received request for custom texture %s\n", - packet->textureName.c_str()); + packet->textureName.c_str()); #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( @@ -2276,10 +2289,10 @@ void ClientConnection::handleTexture(std::shared_ptr packet) { // Response with texture data #if !defined(_CONTENT_PACKAGE) printf("Client received custom texture %s\n", - packet->textureName.c_str()); + packet->textureName.c_str()); #endif gameServices().addMemoryTextureFile(packet->textureName, packet->pbData, - packet->dataBytes); + packet->dataBytes); Minecraft::GetInstance()->handleClientTextureReceived( packet->textureName); } @@ -2295,13 +2308,13 @@ void ClientConnection::handleTextureAndGeometry( if (packet->dwTextureBytes == 0) { // Request for texture #if !defined(_CONTENT_PACKAGE) - printf( - "Client received request for custom texture and geometry %s\n", - packet->textureName.c_str()); + printf("Client received request for custom texture and geometry %s\n", + packet->textureName.c_str()); #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().getDLCSkinFile(packet->textureName); @@ -2332,19 +2345,19 @@ void ClientConnection::handleTextureAndGeometry( // Response with texture data #if !defined(_CONTENT_PACKAGE) printf("Client received custom TextureAndGeometry %s\n", - packet->textureName.c_str()); + packet->textureName.c_str()); #endif // Add the texture data gameServices().addMemoryTextureFile(packet->textureName, packet->pbData, - packet->dwTextureBytes); + packet->dwTextureBytes); // Add the geometry data if (packet->dwBoxC != 0) { - gameServices().setAdditionalSkinBoxes(packet->dwSkinID, packet->BoxDataA, - packet->dwBoxC); + gameServices().setAdditionalSkinBoxes( + packet->dwSkinID, packet->BoxDataA, packet->dwBoxC); } // Add the anim override gameServices().setAnimOverrideBitmask(packet->dwSkinID, - packet->uiAnimOverrideBitmask); + packet->uiAnimOverrideBitmask); // clear out the pending texture request Minecraft::GetInstance()->handleClientTextureReceived( @@ -2355,7 +2368,7 @@ void ClientConnection::handleTextureAndGeometry( void ClientConnection::handleTextureChange( std::shared_ptr packet) { std::shared_ptr e = getEntity(packet->id); - if ((e == nullptr) || !e->instanceof(eTYPE_PLAYER)) return; + if ((e == nullptr) || !e->instanceof (eTYPE_PLAYER)) return; std::shared_ptr player = std::dynamic_pointer_cast(e); bool isLocalPlayer = false; @@ -2371,11 +2384,12 @@ 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) printf("Skin for remote player %s has changed to %s (%d)\n", - player->name.c_str(), player->customTextureUrl.c_str(), - static_cast(player->getPlayerDefaultSkin())); + player->name.c_str(), player->customTextureUrl.c_str(), + static_cast(player->getPlayerDefaultSkin())); #endif break; case TextureChangePacket::e_TextureChange_Cape: @@ -2383,7 +2397,7 @@ void ClientConnection::handleTextureChange( // player->customTextureUrl2 = packet->path; #if !defined(_CONTENT_PACKAGE) printf("Cape for remote player %s has changed to %s\n", - player->name.c_str(), player->customTextureUrl2.c_str()); + player->name.c_str(), player->customTextureUrl2.c_str()); #endif break; } @@ -2430,8 +2444,8 @@ void ClientConnection::handleTextureAndGeometryChange( #if !defined(_CONTENT_PACKAGE) printf("Skin for remote player %s has changed to %s (%d)\n", - player->name.c_str(), player->customTextureUrl.c_str(), - static_cast(player->getPlayerDefaultSkin())); + player->name.c_str(), player->customTextureUrl.c_str(), + static_cast(player->getPlayerDefaultSkin())); #endif if (!packet->path.empty() && @@ -2490,7 +2504,7 @@ void ClientConnection::handleRespawn(std::shared_ptr packet) { dimensionLevel->difficulty = packet->difficulty; // 4J Added Log::info("dimensionLevel->difficulty - Difficulty = %d\n", - packet->difficulty); + packet->difficulty); dimensionLevel->isClientSide = true; } else { @@ -2549,7 +2563,8 @@ void ClientConnection::handleRespawn(std::shared_ptr packet) { 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, @@ -2888,8 +2903,8 @@ void ClientConnection::handleSignUpdate( ste->SetMessage(i, packet->lines[i]); } - Log::info("verified = %d\tCensored = %d\n", - packet->m_bVerified, packet->m_bCensored); + Log::info("verified = %d\tCensored = %d\n", packet->m_bVerified, + packet->m_bCensored); ste->SetVerified(packet->m_bVerified); ste->SetCensored(packet->m_bCensored); @@ -3004,8 +3019,7 @@ void ClientConnection::handleGameEvent( } else if (event == GameEventPacket::WIN_GAME) { ui.SetWinUserIndex(static_cast(gameEventPacket->param)); - Log::info("handleGameEvent packet for WIN_GAME - %d\n", - m_userIndex); + Log::info("handleGameEvent packet for WIN_GAME - %d\n", m_userIndex); // This just allows it to be shown if (minecraft->localgameModes[PlatformInput.GetPrimaryPad()] != nullptr) minecraft->localgameModes[PlatformInput.GetPrimaryPad()] @@ -3020,7 +3034,7 @@ void ClientConnection::handleGameEvent( // loading screen gameServices().setGameStarted(false); gameServices().setAction(PlatformInput.GetPrimaryPad(), - eAppAction_RemoteServerSave); + eAppAction_RemoteServerSave); } } else if (event == GameEventPacket::STOP_SAVING) { if (!NetworkService.IsHost()) gameServices().setGameStarted(true); @@ -3080,7 +3094,7 @@ void ClientConnection::handleAwardStat( void ClientConnection::handleUpdateMobEffect( std::shared_ptr packet) { std::shared_ptr e = getEntity(packet->entityId); - if ((e == nullptr) || !e->instanceof(eTYPE_LIVINGENTITY)) return; + if ((e == nullptr) || !e->instanceof (eTYPE_LIVINGENTITY)) return; //( std::dynamic_pointer_cast(e) )->addEffect(new // MobEffectInstance(packet->effectId, packet->effectDurationTicks, @@ -3095,7 +3109,7 @@ void ClientConnection::handleUpdateMobEffect( void ClientConnection::handleRemoveMobEffect( std::shared_ptr packet) { std::shared_ptr e = getEntity(packet->entityId); - if ((e == nullptr) || !e->instanceof(eTYPE_LIVINGENTITY)) return; + if ((e == nullptr) || !e->instanceof (eTYPE_LIVINGENTITY)) return; (std::dynamic_pointer_cast(e)) ->removeEffectNoUpdate(packet->effectId); @@ -3119,11 +3133,12 @@ void ClientConnection::handlePlayerInfo( } // 4J Stu - Repurposed this packet for player info that we want - gameServices().updatePlayerInfo(packet->m_networkSmallId, packet->m_playerColourIndex, - packet->m_playerPrivileges); + gameServices().updatePlayerInfo(packet->m_networkSmallId, + packet->m_playerColourIndex, + packet->m_playerPrivileges); std::shared_ptr entity = getEntity(packet->m_entityId); - if (entity != nullptr && entity->instanceof(eTYPE_PLAYER)) { + if (entity != nullptr && entity->instanceof (eTYPE_PLAYER)) { std::shared_ptr player = std::dynamic_pointer_cast(entity); player->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_All, @@ -3161,27 +3176,32 @@ void ClientConnection::displayPrivilegeChanges( Player::getPlayerGamePrivilege(oldPrivileges, priv)) { privOn = Player::getPlayerGamePrivilege(newPrivileges, priv); std::string message = ""; - if (gameServices().getGameHostOption(eGameHostOption_TrustPlayers) == 0) { + if (gameServices().getGameHostOption( + eGameHostOption_TrustPlayers) == 0) { switch (priv) { case Player::ePlayerGamePrivilege_CannotMine: if (privOn) - message = gameServices().getString(IDS_PRIV_MINE_TOGGLE_ON); + message = gameServices().getString( + IDS_PRIV_MINE_TOGGLE_ON); else - message = gameServices().getString(IDS_PRIV_MINE_TOGGLE_OFF); + message = gameServices().getString( + IDS_PRIV_MINE_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_CannotBuild: if (privOn) - message = gameServices().getString(IDS_PRIV_BUILD_TOGGLE_ON); + message = gameServices().getString( + IDS_PRIV_BUILD_TOGGLE_ON); else - message = gameServices().getString(IDS_PRIV_BUILD_TOGGLE_OFF); + message = gameServices().getString( + IDS_PRIV_BUILD_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_CanUseDoorsAndSwitches: if (privOn) - message = - gameServices().getString(IDS_PRIV_USE_DOORS_TOGGLE_ON); + message = gameServices().getString( + IDS_PRIV_USE_DOORS_TOGGLE_ON); else - message = - gameServices().getString(IDS_PRIV_USE_DOORS_TOGGLE_OFF); + message = gameServices().getString( + IDS_PRIV_USE_DOORS_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_CanUseContainers: if (privOn) @@ -3193,24 +3213,24 @@ void ClientConnection::displayPrivilegeChanges( break; case Player::ePlayerGamePrivilege_CannotAttackAnimals: if (privOn) - message = - gameServices().getString(IDS_PRIV_ATTACK_ANIMAL_TOGGLE_ON); + message = gameServices().getString( + IDS_PRIV_ATTACK_ANIMAL_TOGGLE_ON); else message = gameServices().getString( IDS_PRIV_ATTACK_ANIMAL_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_CannotAttackMobs: if (privOn) - message = - gameServices().getString(IDS_PRIV_ATTACK_MOB_TOGGLE_ON); + message = gameServices().getString( + IDS_PRIV_ATTACK_MOB_TOGGLE_ON); else - message = - gameServices().getString(IDS_PRIV_ATTACK_MOB_TOGGLE_OFF); + message = gameServices().getString( + IDS_PRIV_ATTACK_MOB_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_CannotAttackPlayers: if (privOn) - message = - gameServices().getString(IDS_PRIV_ATTACK_PLAYER_TOGGLE_ON); + message = gameServices().getString( + IDS_PRIV_ATTACK_PLAYER_TOGGLE_ON); else message = gameServices().getString( IDS_PRIV_ATTACK_PLAYER_TOGGLE_OFF); @@ -3222,59 +3242,65 @@ void ClientConnection::displayPrivilegeChanges( switch (priv) { case Player::ePlayerGamePrivilege_Op: if (privOn) - message = gameServices().getString(IDS_PRIV_MODERATOR_TOGGLE_ON); + message = gameServices().getString( + IDS_PRIV_MODERATOR_TOGGLE_ON); else - message = gameServices().getString(IDS_PRIV_MODERATOR_TOGGLE_OFF); + message = gameServices().getString( + IDS_PRIV_MODERATOR_TOGGLE_OFF); break; default: break; }; - if (gameServices().getGameHostOption(eGameHostOption_CheatsEnabled) != 0) { + if (gameServices().getGameHostOption( + eGameHostOption_CheatsEnabled) != 0) { switch (priv) { case Player::ePlayerGamePrivilege_CanFly: if (privOn) - message = gameServices().getString(IDS_PRIV_FLY_TOGGLE_ON); + message = gameServices().getString( + IDS_PRIV_FLY_TOGGLE_ON); else - message = gameServices().getString(IDS_PRIV_FLY_TOGGLE_OFF); + message = gameServices().getString( + IDS_PRIV_FLY_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_ClassicHunger: if (privOn) - message = - gameServices().getString(IDS_PRIV_EXHAUSTION_TOGGLE_ON); + message = gameServices().getString( + IDS_PRIV_EXHAUSTION_TOGGLE_ON); else - message = - gameServices().getString(IDS_PRIV_EXHAUSTION_TOGGLE_OFF); + message = gameServices().getString( + IDS_PRIV_EXHAUSTION_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_Invisible: if (privOn) - message = - gameServices().getString(IDS_PRIV_INVISIBLE_TOGGLE_ON); + message = gameServices().getString( + IDS_PRIV_INVISIBLE_TOGGLE_ON); else - message = - gameServices().getString(IDS_PRIV_INVISIBLE_TOGGLE_OFF); + message = gameServices().getString( + IDS_PRIV_INVISIBLE_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_Invulnerable: if (privOn) - message = - gameServices().getString(IDS_PRIV_INVULNERABLE_TOGGLE_ON); + message = gameServices().getString( + IDS_PRIV_INVULNERABLE_TOGGLE_ON); else - message = - gameServices().getString(IDS_PRIV_INVULNERABLE_TOGGLE_OFF); + message = gameServices().getString( + IDS_PRIV_INVULNERABLE_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_CanToggleInvisible: if (privOn) - message = - gameServices().getString(IDS_PRIV_CAN_INVISIBLE_TOGGLE_ON); + message = gameServices().getString( + IDS_PRIV_CAN_INVISIBLE_TOGGLE_ON); else message = gameServices().getString( IDS_PRIV_CAN_INVISIBLE_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_CanToggleFly: if (privOn) - message = gameServices().getString(IDS_PRIV_CAN_FLY_TOGGLE_ON); + message = gameServices().getString( + IDS_PRIV_CAN_FLY_TOGGLE_ON); else - message = - gameServices().getString(IDS_PRIV_CAN_FLY_TOGGLE_OFF); + message = gameServices().getString( + IDS_PRIV_CAN_FLY_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_CanToggleClassicHunger: if (privOn) @@ -3286,11 +3312,11 @@ void ClientConnection::displayPrivilegeChanges( break; case Player::ePlayerGamePrivilege_CanTeleport: if (privOn) - message = - gameServices().getString(IDS_PRIV_CAN_TELEPORT_TOGGLE_ON); + message = gameServices().getString( + IDS_PRIV_CAN_TELEPORT_TOGGLE_ON); else - message = - gameServices().getString(IDS_PRIV_CAN_TELEPORT_TOGGLE_OFF); + message = gameServices().getString( + IDS_PRIV_CAN_TELEPORT_TOGGLE_OFF); break; default: break; @@ -3379,7 +3405,8 @@ void ClientConnection::handleServerSettingsChanged( } else { // options // minecraft->options->SetGamertagSetting((packet->data==0)?false:true); - gameServices().setGameHostOption(eGameHostOption_Gamertags, packet->data); + gameServices().setGameHostOption(eGameHostOption_Gamertags, + packet->data); } } @@ -3418,7 +3445,7 @@ void ClientConnection::handleUpdateGameRuleProgressPacket( "handleUpdateGameRuleProgressPacket: Data tag is in range, so " "updating profile data\n"); gameServices().setSpecialTutorialCompletionFlag(m_userIndex, - packet->m_dataTag - 1); + packet->m_dataTag - 1); } } @@ -3525,7 +3552,7 @@ void ClientConnection::handleUpdateAttributes( std::shared_ptr entity = getEntity(packet->getEntityId()); if (entity == nullptr) return; - if (!entity->instanceof(eTYPE_LIVINGENTITY)) { + if (!entity->instanceof (eTYPE_LIVINGENTITY)) { // Entity is not a living entity! assert(0); } @@ -3576,7 +3603,9 @@ void ClientConnection::checkDeferredEntityLinkPackets(int newEntityId) { // Only consider recently deferred packets auto tickInterval = - std::chrono::duration_cast(time_util::clock::now() - deferred->m_recievedTick).count(); + std::chrono::duration_cast( + time_util::clock::now() - deferred->m_recievedTick) + .count(); if (tickInterval < MAX_ENTITY_LINK_DEFERRAL_INTERVAL) { // Note: we assume it's the destination entity if (deferred->m_packet->destId == newEntityId) { diff --git a/targets/minecraft/client/multiplayer/ClientConnection.h b/targets/minecraft/client/multiplayer/ClientConnection.h index 5764e310f..1c08a7d75 100644 --- a/targets/minecraft/client/multiplayer/ClientConnection.h +++ b/targets/minecraft/client/multiplayer/ClientConnection.h @@ -5,13 +5,12 @@ #include #include -#include "util/Timer.h" -#include "platform/storage/storage.h" #include "minecraft/network/Connection.h" - #include "minecraft/network/packet/DisconnectPacket.h" #include "minecraft/network/packet/PacketListener.h" #include "minecraft/world/entity/Entity.h" +#include "platform/storage/storage.h" +#include "util/Timer.h" class Minecraft; class MultiPlayerLevel; diff --git a/targets/minecraft/client/multiplayer/MultiPlayerChunkCache.cpp b/targets/minecraft/client/multiplayer/MultiPlayerChunkCache.cpp index 1d6baff82..7fa6694c6 100644 --- a/targets/minecraft/client/multiplayer/MultiPlayerChunkCache.cpp +++ b/targets/minecraft/client/multiplayer/MultiPlayerChunkCache.cpp @@ -1,11 +1,11 @@ #include "MultiPlayerChunkCache.h" -#include #include #include +#include + #include "minecraft/network/INetworkService.h" -#include "util/StringHelpers.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/level/ServerChunkCache.h" #include "minecraft/server/level/ServerLevel.h" @@ -19,6 +19,7 @@ #include "minecraft/world/level/dimension/Dimension.h" #include "minecraft/world/level/storage/LevelData.h" #include "minecraft/world/level/tile/Tile.h" +#include "util/StringHelpers.h" MultiPlayerChunkCache::MultiPlayerChunkCache(Level* level) { XZSIZE = level->dimension->getXZSize(); // 4J Added @@ -175,8 +176,8 @@ LevelChunk* MultiPlayerChunkCache::create(int x, int z) { if (MinecraftServer::getInstance()->serverHalted()) return nullptr; - // If we're the host, then don't create the chunk, share data - // from the server's copy + // If we're the host, then don't create the chunk, share + // data from the server's copy #ifdef _LARGE_WORLDS LevelChunk* serverChunk = MinecraftServer::getInstance() diff --git a/targets/minecraft/client/multiplayer/MultiPlayerChunkCache.h b/targets/minecraft/client/multiplayer/MultiPlayerChunkCache.h index 82a068da7..dad40c3b1 100644 --- a/targets/minecraft/client/multiplayer/MultiPlayerChunkCache.h +++ b/targets/minecraft/client/multiplayer/MultiPlayerChunkCache.h @@ -5,10 +5,8 @@ #include "minecraft/world/level/biome/Biome.h" #include "minecraft/world/level/chunk/ChunkSource.h" - #include "minecraft/world/level/levelgen/RandomLevelSource.h" - class ServerChunkCache; class Level; class LevelChunk; diff --git a/targets/minecraft/client/multiplayer/MultiPlayerGameMode.cpp b/targets/minecraft/client/multiplayer/MultiPlayerGameMode.cpp index 274eed236..054300597 100644 --- a/targets/minecraft/client/multiplayer/MultiPlayerGameMode.cpp +++ b/targets/minecraft/client/multiplayer/MultiPlayerGameMode.cpp @@ -1,12 +1,12 @@ -#include "minecraft/IGameServices.h" #include "MultiPlayerGameMode.h" #include #include "ClientConnection.h" -#include "app/common/Audio/SoundEngine.h" #include "MultiPlayerLevel.h" +#include "app/common/Audio/SoundEngine.h" #include "java/Class.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/network/packet/ContainerButtonClickPacket.h" @@ -513,7 +513,8 @@ bool MultiPlayerGameMode::hasFarPickRange() { // only happens when the player is riding a horse. bool MultiPlayerGameMode::isServerControlledInventory() { return minecraft->player->isRiding() && - minecraft->player->riding->instanceof(eTYPE_HORSE); + minecraft->player->riding->instanceof + (eTYPE_HORSE); } bool MultiPlayerGameMode::handleCraftItem(int recipe, diff --git a/targets/minecraft/client/multiplayer/MultiPlayerLevel.cpp b/targets/minecraft/client/multiplayer/MultiPlayerLevel.cpp index 09b208298..b5c9c5e38 100644 --- a/targets/minecraft/client/multiplayer/MultiPlayerLevel.cpp +++ b/targets/minecraft/client/multiplayer/MultiPlayerLevel.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "MultiPlayerLevel.h" #include @@ -10,21 +9,20 @@ #include #include -#include "platform/PlatformTypes.h" -#include "platform/input/input.h" #include "ClientConnection.h" -#include "app/common/Audio/SoundEngine.h" -#include "minecraft/Console_Debug_enum.h" -#include "minecraft/network/INetworkService.h" #include "MultiPlayerChunkCache.h" #include "MultiPlayerLocalPlayer.h" +#include "app/common/Audio/SoundEngine.h" #include "java/JavaMath.h" #include "java/Random.h" +#include "minecraft/Console_Debug_enum.h" +#include "minecraft/IGameServices.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/particle/FireworksParticles.h" #include "minecraft/client/particle/ParticleEngine.h" #include "minecraft/core/particles/ParticleTypes.h" +#include "minecraft/network/INetworkService.h" #include "minecraft/network/packet/DisconnectPacket.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/level/ChunkPos.h" @@ -38,6 +36,8 @@ #include "minecraft/world/level/storage/SavedDataStorage.h" #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/level/tile/entity/TileEntity.h" +#include "platform/PlatformTypes.h" +#include "platform/input/input.h" class LevelSettings; class Scoreboard; diff --git a/targets/minecraft/client/multiplayer/MultiPlayerLevel.h b/targets/minecraft/client/multiplayer/MultiPlayerLevel.h index c0773c45e..dee97d45d 100644 --- a/targets/minecraft/client/multiplayer/MultiPlayerLevel.h +++ b/targets/minecraft/client/multiplayer/MultiPlayerLevel.h @@ -9,10 +9,8 @@ #include "java/JavaIntHash.h" #include "minecraft/world/entity/Entity.h" - #include "minecraft/world/level/Level.h" - class ClientConnection; class MultiPlayerChunkCache; class LevelSettings; diff --git a/targets/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp b/targets/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp index d1efdaf5b..81a8256e3 100644 --- a/targets/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp +++ b/targets/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "MultiPlayerLocalPlayer.h" #include @@ -10,6 +8,7 @@ #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" #include "minecraft/client/player/Input.h" @@ -26,6 +25,7 @@ #include "minecraft/network/packet/TextureAndGeometryChangePacket.h" #include "minecraft/network/packet/TextureChangePacket.h" #include "minecraft/stats/Stat.h" +#include "minecraft/util/Log.h" #include "minecraft/world/effect/MobEffect.h" #include "minecraft/world/effect/MobEffectInstance.h" #include "minecraft/world/entity/player/Abilities.h" @@ -73,13 +73,14 @@ void MultiplayerLocalPlayer::tick() { // bool bIsisPrimaryHost=NetworkService.IsHost() && // (PlatformInput.GetPrimaryPad()==m_iPad); - /*if((gameServices().getGameSettings(m_iPad,eGameSetting_PlayerVisibleInMap)!=0) != - m_bShownOnMaps) + /*if((gameServices().getGameSettings(m_iPad,eGameSetting_PlayerVisibleInMap)!=0) + != m_bShownOnMaps) { m_bShownOnMaps = - (gameServices().getGameSettings(m_iPad,eGameSetting_PlayerVisibleInMap)!=0); if - (m_bShownOnMaps) connection->send( std::shared_ptr( new - PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::SHOW_ON_MAPS) ) + (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 PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::HIDE_ON_MAPS) ) ); @@ -372,14 +373,14 @@ void MultiplayerLocalPlayer::setAndBroadcastCustomSkin(std::uint32_t skinId) { std::uint32_t oldSkinIndex = getCustomSkin(); LocalPlayer::setCustomSkin(skinId); #if !defined(_CONTENT_PACKAGE) - printf("Skin for local player %s has changed to %s (%d)\n", - name.c_str(), customTextureUrl.c_str(), - static_cast(getPlayerDefaultSkin())); + printf("Skin for local player %s has changed to %s (%d)\n", name.c_str(), + customTextureUrl.c_str(), static_cast(getPlayerDefaultSkin())); #endif 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) { @@ -387,7 +388,7 @@ void MultiplayerLocalPlayer::setAndBroadcastCustomCape(std::uint32_t capeId) { LocalPlayer::setCustomCape(capeId); #if !defined(_CONTENT_PACKAGE) printf("Cape for local player %s has changed to %s\n", name.c_str(), - customTextureUrl2.c_str()); + customTextureUrl2.c_str()); #endif if (getCustomCape() != oldCapeIndex) connection->send(std::make_shared( diff --git a/targets/minecraft/client/particle/DragonBreathParticle.cpp b/targets/minecraft/client/particle/DragonBreathParticle.cpp index 9c8b011cd..2712591fa 100644 --- a/targets/minecraft/client/particle/DragonBreathParticle.cpp +++ b/targets/minecraft/client/particle/DragonBreathParticle.cpp @@ -1,11 +1,11 @@ #include "DragonBreathParticle.h" -#include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/JavaMath.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/particle/Particle.h" #include "minecraft/client/particle/ParticleEngine.h" +#include "minecraft/client/resources/Colours/ColourTable.h" class Level; diff --git a/targets/minecraft/client/particle/DripParticle.cpp b/targets/minecraft/client/particle/DripParticle.cpp index c95ff1979..9cf893b7a 100644 --- a/targets/minecraft/client/particle/DripParticle.cpp +++ b/targets/minecraft/client/particle/DripParticle.cpp @@ -2,11 +2,11 @@ #include -#include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/JavaMath.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/particle/Particle.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/material/Material.h" diff --git a/targets/minecraft/client/particle/EnchantmentTableParticle.cpp b/targets/minecraft/client/particle/EnchantmentTableParticle.cpp index 6b3de3eeb..ef5d8ec21 100644 --- a/targets/minecraft/client/particle/EnchantmentTableParticle.cpp +++ b/targets/minecraft/client/particle/EnchantmentTableParticle.cpp @@ -1,11 +1,11 @@ #include "EnchantmentTableParticle.h" -#include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/JavaMath.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/particle/Particle.h" +#include "minecraft/client/resources/Colours/ColourTable.h" EchantmentTableParticle::EchantmentTableParticle(Level* level, double x, double y, double z, double xd, diff --git a/targets/minecraft/client/particle/EnderParticle.cpp b/targets/minecraft/client/particle/EnderParticle.cpp index b9fa842e6..c8eac5285 100644 --- a/targets/minecraft/client/particle/EnderParticle.cpp +++ b/targets/minecraft/client/particle/EnderParticle.cpp @@ -1,11 +1,11 @@ #include "EnderParticle.h" -#include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/JavaMath.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/particle/Particle.h" +#include "minecraft/client/resources/Colours/ColourTable.h" class Level; diff --git a/targets/minecraft/client/particle/ExplodeParticle.cpp b/targets/minecraft/client/particle/ExplodeParticle.cpp index cb2858ea5..dbfeb9c35 100644 --- a/targets/minecraft/client/particle/ExplodeParticle.cpp +++ b/targets/minecraft/client/particle/ExplodeParticle.cpp @@ -1,11 +1,11 @@ #include "ExplodeParticle.h" -#include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/JavaMath.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/particle/Particle.h" +#include "minecraft/client/resources/Colours/ColourTable.h" class Level; diff --git a/targets/minecraft/client/particle/FootstepParticle.cpp b/targets/minecraft/client/particle/FootstepParticle.cpp index 96dbee555..8b2070194 100644 --- a/targets/minecraft/client/particle/FootstepParticle.cpp +++ b/targets/minecraft/client/particle/FootstepParticle.cpp @@ -1,17 +1,15 @@ #include "FootstepParticle.h" -#include "platform/stubs.h" - - #include -#include "platform/renderer/renderer.h" #include "minecraft/client/particle/Particle.h" #include "minecraft/client/particle/ParticleEngine.h" #include "minecraft/client/renderer/Tesselator.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/level/Level.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation FootstepParticle::FOOTPRINT_LOCATION = ResourceLocation(TN_MISC_FOOTSTEP); diff --git a/targets/minecraft/client/particle/HugeExplosionParticle.cpp b/targets/minecraft/client/particle/HugeExplosionParticle.cpp index 6cf2e188f..d43cc32d6 100644 --- a/targets/minecraft/client/particle/HugeExplosionParticle.cpp +++ b/targets/minecraft/client/particle/HugeExplosionParticle.cpp @@ -1,19 +1,17 @@ #include "HugeExplosionParticle.h" -#include "platform/stubs.h" - - -#include "platform/renderer/renderer.h" -#include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Lighting.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/particle/Particle.h" #include "minecraft/client/particle/ParticleEngine.h" #include "minecraft/client/renderer/Tesselator.h" #include "minecraft/client/renderer/Textures.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/client/resources/ResourceLocation.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" class Level; diff --git a/targets/minecraft/client/particle/NetherPortalParticle.cpp b/targets/minecraft/client/particle/NetherPortalParticle.cpp index d01344b51..9cce8a408 100644 --- a/targets/minecraft/client/particle/NetherPortalParticle.cpp +++ b/targets/minecraft/client/particle/NetherPortalParticle.cpp @@ -1,11 +1,11 @@ #include "NetherPortalParticle.h" -#include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/JavaMath.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/particle/Particle.h" +#include "minecraft/client/resources/Colours/ColourTable.h" class Level; diff --git a/targets/minecraft/client/particle/NoteParticle.cpp b/targets/minecraft/client/particle/NoteParticle.cpp index 6e8b26354..781e17c08 100644 --- a/targets/minecraft/client/particle/NoteParticle.cpp +++ b/targets/minecraft/client/particle/NoteParticle.cpp @@ -3,9 +3,9 @@ #include #include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/particle/Particle.h" +#include "minecraft/client/resources/Colours/ColourTable.h" class Level; diff --git a/targets/minecraft/client/particle/Particle.cpp b/targets/minecraft/client/particle/Particle.cpp index 28a23095c..e44bd6a71 100644 --- a/targets/minecraft/client/particle/Particle.cpp +++ b/targets/minecraft/client/particle/Particle.cpp @@ -211,6 +211,6 @@ bool Particle::isAttackable() { return false; } //@Override std::string Particle::toString() { return "A particle"; // getClass()->getSimpleName() + ", Pos (" + x + "," - // + y + "," + z + "), RGBA (" + rCol + "," + gCol + - // "," + bCol + "," + alpha + "), Age " + age; + // + y + "," + z + "), RGBA (" + rCol + "," + gCol + + // "," + bCol + "," + alpha + "), Age " + age; } \ No newline at end of file diff --git a/targets/minecraft/client/particle/ParticleEngine.cpp b/targets/minecraft/client/particle/ParticleEngine.cpp index 9e38bdf6c..f10fb25c0 100644 --- a/targets/minecraft/client/particle/ParticleEngine.cpp +++ b/targets/minecraft/client/particle/ParticleEngine.cpp @@ -1,16 +1,12 @@ #include "ParticleEngine.h" -#include "platform/stubs.h" - #include #include #include -#include "platform/renderer/renderer.h" #include "Particle.h" #include "TerrainParticle.h" -#include "util/StringHelpers.h" #include "java/Class.h" #include "java/Random.h" #include "minecraft/SharedConstants.h" @@ -23,6 +19,9 @@ #include "minecraft/world/level/Level.h" #include "minecraft/world/level/dimension/Dimension.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" +#include "util/StringHelpers.h" ResourceLocation ParticleEngine::PARTICLES_LOCATION = ResourceLocation(TN_PARTICLES); @@ -30,9 +29,7 @@ ResourceLocation ParticleEngine::PARTICLES_LOCATION = ParticleEngine::ParticleEngine(Level* level, Textures* textures) { // if (level != nullptr) // 4J - removed - we want level to be // initialised to *something* - { - this->level = level; - } + { this->level = level; } this->textures = textures; this->random = new Random(); diff --git a/targets/minecraft/client/particle/SmokeParticle.cpp b/targets/minecraft/client/particle/SmokeParticle.cpp index b91241b83..e80824432 100644 --- a/targets/minecraft/client/particle/SmokeParticle.cpp +++ b/targets/minecraft/client/particle/SmokeParticle.cpp @@ -1,10 +1,10 @@ #include "SmokeParticle.h" -#include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/JavaMath.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/particle/Particle.h" +#include "minecraft/client/resources/Colours/ColourTable.h" class Level; diff --git a/targets/minecraft/client/particle/SuspendedParticle.cpp b/targets/minecraft/client/particle/SuspendedParticle.cpp index 7b86453be..a23a9bee8 100644 --- a/targets/minecraft/client/particle/SuspendedParticle.cpp +++ b/targets/minecraft/client/particle/SuspendedParticle.cpp @@ -2,12 +2,12 @@ #include -#include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/JavaMath.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/particle/Particle.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/material/Material.h" diff --git a/targets/minecraft/client/particle/TakeAnimationParticle.cpp b/targets/minecraft/client/particle/TakeAnimationParticle.cpp index 5994d3da7..8f9265dd0 100644 --- a/targets/minecraft/client/particle/TakeAnimationParticle.cpp +++ b/targets/minecraft/client/particle/TakeAnimationParticle.cpp @@ -1,17 +1,15 @@ #include "TakeAnimationParticle.h" -#include "platform/stubs.h" - - #include -#include "platform/renderer/renderer.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/particle/Particle.h" #include "minecraft/client/particle/ParticleEngine.h" #include "minecraft/client/renderer/entity/EntityRenderDispatcher.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/level/Level.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" TakeAnimationParticle::TakeAnimationParticle(Level* level, std::shared_ptr item, diff --git a/targets/minecraft/client/player/Input.cpp b/targets/minecraft/client/player/Input.cpp index ef03d38ed..00ad1e807 100644 --- a/targets/minecraft/client/player/Input.cpp +++ b/targets/minecraft/client/player/Input.cpp @@ -1,14 +1,14 @@ -#include "minecraft/IGameServices.h" #include "Input.h" #include -#include "platform/input/input.h" #include "LocalPlayer.h" #include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" #include "minecraft/world/entity/player/Abilities.h" +#include "platform/input/input.h" Input::Input() { xa = 0; @@ -86,16 +86,18 @@ void Input::tick(LocalPlayer* player) { pMinecraft->localgameModes[iPad]->isInputAllowed( MINECRAFT_ACTION_LOOK_RIGHT)) tx = PlatformInput.GetJoypadStick_RX(iPad) * - (((float)gameServices().getGameSettings(iPad, - eGameSetting_Sensitivity_InGame)) / + (((float)gameServices().getGameSettings( + iPad, + eGameSetting_Sensitivity_InGame)) / 100.0f); // apply sensitivity to look if (pMinecraft->localgameModes[iPad]->isInputAllowed( MINECRAFT_ACTION_LOOK_UP) || pMinecraft->localgameModes[iPad]->isInputAllowed( MINECRAFT_ACTION_LOOK_DOWN)) ty = PlatformInput.GetJoypadStick_RY(iPad) * - (((float)gameServices().getGameSettings(iPad, - eGameSetting_Sensitivity_InGame)) / + (((float)gameServices().getGameSettings( + iPad, + eGameSetting_Sensitivity_InGame)) / 100.0f); // apply sensitivity to look #ifndef _CONTENT_PACKAGE diff --git a/targets/minecraft/client/player/LocalPlayer.cpp b/targets/minecraft/client/player/LocalPlayer.cpp index bbb55f5ee..cd27e3bf6 100644 --- a/targets/minecraft/client/player/LocalPlayer.cpp +++ b/targets/minecraft/client/player/LocalPlayer.cpp @@ -1,6 +1,3 @@ -#include "minecraft/client/IMenuService.h" -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "LocalPlayer.h" #include @@ -12,6 +9,8 @@ #include "Input.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" +#include "minecraft/client/IMenuService.h" #include "minecraft/client/Options.h" #include "minecraft/client/User.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" @@ -21,6 +20,7 @@ #include "minecraft/client/renderer/GameRenderer.h" #include "minecraft/client/renderer/ItemInHandRenderer.h" #include "minecraft/stats/StatsCounter.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/ai/attributes/AttributeInstance.h" #include "minecraft/world/level/storage/LevelData.h" #include "minecraft/world/level/tile/entity/TileEntity.h" @@ -28,18 +28,14 @@ #include "minecraft/world/item/Item.h" #include "minecraft/world/level/tile/Tile.h" // 4J Stu - Added for tutorial callbacks -#include "platform/input/input.h" -#include "platform/profile/profile.h" -#include "platform/renderer/renderer.h" +#include "PlatformTypes.h" +#include "Pos.h" #include "app/common/App_structs.h" #include "app/common/Audio/SoundEngine.h" -#include "minecraft/network/INetworkService.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/linux/Linux_UIController.h" -#include "PlatformTypes.h" -#include "Pos.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Gui.h" @@ -59,6 +55,7 @@ #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" #include "minecraft/commands/CommandsEnum.h" #include "minecraft/core/particles/ParticleTypes.h" +#include "minecraft/network/INetworkService.h" #include "minecraft/sounds/SoundTypes.h" #include "minecraft/stats/Achievement.h" #include "minecraft/stats/CommonStats.h" @@ -80,11 +77,14 @@ #include "minecraft/world/level/Level.h" #include "minecraft/world/level/dimension/Dimension.h" #include "minecraft/world/level/tile/entity/CommandBlockEntity.h" -#include "minecraft/world/level/tile/entity/SignTileEntity.h" #include "minecraft/world/level/tile/entity/HopperTileEntity.h" +#include "minecraft/world/level/tile/entity/SignTileEntity.h" #include "minecraft/world/phys/AABB.h" #include "minecraft/world/phys/HitResult.h" #include "minecraft/world/phys/Vec3.h" +#include "platform/input/input.h" +#include "platform/profile/profile.h" +#include "platform/renderer/renderer.h" LocalPlayer::LocalPlayer(Minecraft* minecraft, Level* level, User* user, int dimension) @@ -115,7 +115,8 @@ LocalPlayer::LocalPlayer(Minecraft* minecraft, Level* level, User* user, this->name = user->name; // printf("Created LocalPlayer with name %s\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; } @@ -123,7 +124,8 @@ LocalPlayer::LocalPlayer(Minecraft* minecraft, Level* level, User* user, input = nullptr; m_iPad = -1; m_iScreenSection = - IPlatformRenderer::VIEWPORT_TYPE_FULLSCREEN; // assume singleplayer default + IPlatformRenderer::VIEWPORT_TYPE_FULLSCREEN; // assume singleplayer + // default m_bPlayerRespawned = false; ullButtonsPressed = 0LL; ullDpad_last = ullDpad_this = ullDpad_filtered = 0; @@ -485,7 +487,7 @@ void LocalPlayer::aiStep() { // Check if the player is idle and the rich presence needs updated if (!m_bIsIdle && PlatformInput.GetIdleSeconds(m_iPad) > PLAYER_IDLE_TIME) { PlatformProfile.SetCurrentGameActivity(m_iPad, CONTEXT_PRESENCE_IDLE, - false); + false); m_bIsIdle = true; } else if (m_bIsIdle && PlatformInput.GetIdleSeconds(m_iPad) < PLAYER_IDLE_TIME) { @@ -608,7 +610,8 @@ 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)); @@ -620,7 +623,8 @@ 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; @@ -631,7 +635,8 @@ 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; @@ -643,7 +648,8 @@ 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; @@ -678,8 +684,8 @@ bool LocalPlayer::startEnchanting(int x, int y, int z, minecraft->setScreen(new EnchantmentScreen(inventory, level, x, y, z)); bool success = true; #else - bool success = - gameServices().menus().openEnchanting(GetXboxPad(), inventory, x, y, z, level, name); + bool success = gameServices().menus().openEnchanting( + GetXboxPad(), inventory, x, y, z, level, name); if (success) ui.PlayUISFX(eSFX_Press); #endif return success; @@ -690,8 +696,8 @@ bool LocalPlayer::startRepairing(int x, int y, int z) { minecraft->setScreen(new RepairScreen(inventory, level, x, y, z)); bool success = true; #else - bool success = - gameServices().menus().openRepairing(GetXboxPad(), inventory, level, x, y, z); + bool success = gameServices().menus().openRepairing(GetXboxPad(), inventory, + level, x, y, z); if (success) ui.PlayUISFX(eSFX_Press); #endif return success; @@ -702,7 +708,8 @@ 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; @@ -714,8 +721,8 @@ bool LocalPlayer::openBrewingStand( minecraft->setScreen(new BrewingStandScreen(inventory, brewingStand)); bool success = true; #else - bool success = - gameServices().menus().openBrewingStand(GetXboxPad(), inventory, brewingStand); + bool success = gameServices().menus().openBrewingStand( + GetXboxPad(), inventory, brewingStand); if (success) ui.PlayUISFX(eSFX_Press); #endif return success; @@ -726,7 +733,8 @@ 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; @@ -737,7 +745,8 @@ 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; @@ -749,8 +758,8 @@ bool LocalPlayer::openTrading(std::shared_ptr traderTarget, minecraft->setScreen(new MerchantScreen(inventory, traderTarget, level)); bool success = true; #else - bool success = - gameServices().menus().openTrading(GetXboxPad(), inventory, traderTarget, level, name); + bool success = gameServices().menus().openTrading( + GetXboxPad(), inventory, traderTarget, level, name); if (success) ui.PlayUISFX(eSFX_Press); #endif return success; @@ -1574,23 +1583,30 @@ 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); - } else if ((riding != nullptr) && riding->instanceof(eTYPE_MINECART)) { 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); - } else if ((riding != nullptr) && riding->instanceof(eTYPE_PIG)) { - gameServices().setRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_RIDING_PIG); + CONTEXT_GAME_STATE_MAP); + } else if ((riding != nullptr) && riding->instanceof (eTYPE_MINECART)) { + 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); + } else if ((riding != nullptr) && riding->instanceof (eTYPE_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); } } } diff --git a/targets/minecraft/client/player/LocalPlayer.h b/targets/minecraft/client/player/LocalPlayer.h index 5b73c8679..9b3dbf959 100644 --- a/targets/minecraft/client/player/LocalPlayer.h +++ b/targets/minecraft/client/player/LocalPlayer.h @@ -10,7 +10,6 @@ #include "minecraft/util/SmoothFloat.h" #include "minecraft/world/entity/player/Player.h" - class Level; class User; class CompoundTag; diff --git a/targets/minecraft/client/player/RemotePlayer.cpp b/targets/minecraft/client/player/RemotePlayer.cpp index 4d5a51c5f..1370532e5 100644 --- a/targets/minecraft/client/player/RemotePlayer.cpp +++ b/targets/minecraft/client/player/RemotePlayer.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "RemotePlayer.h" #include @@ -6,6 +5,7 @@ #include #include "Pos.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/item/Item.h" diff --git a/targets/minecraft/client/player/RemotePlayer.h b/targets/minecraft/client/player/RemotePlayer.h index 1492e4653..64ad6a08e 100644 --- a/targets/minecraft/client/player/RemotePlayer.h +++ b/targets/minecraft/client/player/RemotePlayer.h @@ -7,7 +7,6 @@ #include "minecraft/util/SmoothFloat.h" #include "minecraft/world/entity/player/Player.h" - class Input; class Level; diff --git a/targets/minecraft/client/renderer/Chunk.cpp b/targets/minecraft/client/renderer/Chunk.cpp index 0c42015ce..ec1716642 100644 --- a/targets/minecraft/client/renderer/Chunk.cpp +++ b/targets/minecraft/client/renderer/Chunk.cpp @@ -1,6 +1,4 @@ #include "Chunk.h" -#include "platform/stubs.h" - #include @@ -10,9 +8,7 @@ #include #include -#include "platform/renderer/renderer.h" #include "LevelRenderer.h" -#include "util/FrameProfiler.h" #include "TileRenderer.h" #include "minecraft/client/renderer/Tesselator.h" #include "minecraft/client/renderer/culling/Culler.h" @@ -25,6 +21,9 @@ #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/level/tile/entity/TileEntity.h" #include "minecraft/world/phys/AABB.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" +#include "util/FrameProfiler.h" int Chunk::updates = 0; diff --git a/targets/minecraft/client/renderer/GameRenderer.cpp b/targets/minecraft/client/renderer/GameRenderer.cpp index d96ca4295..a8d97bc13 100644 --- a/targets/minecraft/client/renderer/GameRenderer.cpp +++ b/targets/minecraft/client/renderer/GameRenderer.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "GameRenderer.h" #include @@ -8,29 +6,21 @@ #include #include -#include "platform/PlatformTypes.h" -#include "platform/input/input.h" -#include "platform/renderer/renderer.h" #include "BossMobGuiInfo.h" #include "Chunk.h" #include "ItemInHandRenderer.h" #include "LevelRenderer.h" -#include "minecraft/GameEnums.h" -#include "platform/ShutdownManager.h" -#include "minecraft/client/resources/Colours/ColourTable.h" -#include "minecraft/client/BufferedImage.h" -#include "util/FrameProfiler.h" -#include "platform/stubs.h" #include "Tesselator.h" -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" - #include "java/Class.h" #include "java/FloatBuffer.h" #include "java/JavaMath.h" #include "java/Random.h" #include "java/System.h" #include "minecraft/Facing.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/SharedConstants.h" +#include "minecraft/client/BufferedImage.h" #include "minecraft/client/Camera.h" #include "minecraft/client/Lighting.h" #include "minecraft/client/MemoryTracker.h" @@ -53,10 +43,12 @@ #include "minecraft/client/renderer/culling/Frustum.h" #include "minecraft/client/renderer/culling/FrustumCuller.h" #include "minecraft/client/renderer/texture/TextureAtlas.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" #include "minecraft/sounds/SoundTypes.h" +#include "minecraft/util/Log.h" #include "minecraft/util/SmoothFloat.h" #include "minecraft/world/effect/MobEffect.h" #include "minecraft/world/effect/MobEffectInstance.h" @@ -78,10 +70,17 @@ #include "minecraft/world/level/chunk/SparseLightStorage.h" #include "minecraft/world/level/dimension/Dimension.h" #include "minecraft/world/level/material/Material.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/phys/AABB.h" #include "minecraft/world/phys/HitResult.h" #include "minecraft/world/phys/Vec3.h" +#include "platform/PlatformTypes.h" +#include "platform/ShutdownManager.h" +#include "platform/input/input.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" +#include "util/FrameProfiler.h" bool GameRenderer::anaglyph3d = false; int GameRenderer::anaglyphPass = 0; @@ -376,7 +375,7 @@ void GameRenderer::pick(float a) { if (nearest < dist || (mc->hitResult == nullptr)) { if (mc->hitResult != nullptr) delete mc->hitResult; mc->hitResult = new HitResult(hovered); - if (hovered->instanceof(eTYPE_LIVINGENTITY)) { + if (hovered->instanceof (eTYPE_LIVINGENTITY)) { mc->crosshairPickMob = std::dynamic_pointer_cast(hovered); } @@ -449,7 +448,7 @@ void GameRenderer::bobHurt(float a) { } void GameRenderer::bobView(float a) { - if (!mc->cameraTargetPlayer->instanceof(eTYPE_LIVINGENTITY)) return; + if (!mc->cameraTargetPlayer->instanceof (eTYPE_LIVINGENTITY)) return; std::shared_ptr player = std::dynamic_pointer_cast(mc->cameraTargetPlayer); @@ -608,7 +607,8 @@ void GameRenderer::getFovAndAspect(float& fov, float& aspect, float a, aspect = mc->width / (float)mc->height; fov = getFov(a, applyEffects); - if ((mc->player->m_iScreenSection == IPlatformRenderer::VIEWPORT_TYPE_SPLIT_TOP) || + if ((mc->player->m_iScreenSection == + IPlatformRenderer::VIEWPORT_TYPE_SPLIT_TOP) || (mc->player->m_iScreenSection == IPlatformRenderer::VIEWPORT_TYPE_SPLIT_BOTTOM)) { aspect *= 2.0f; @@ -663,7 +663,8 @@ 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); @@ -705,7 +706,8 @@ void GameRenderer::renderItemInHand(float a, int eye) { // 4J-JEV: I'm fairly confident this method would crash if the cameratarget // isnt a local player anyway, but oh well. std::shared_ptr localplayer = - mc->cameraTargetPlayer->instanceof(eTYPE_LOCALPLAYER) + mc->cameraTargetPlayer->instanceof + (eTYPE_LOCALPLAYER) ? std::dynamic_pointer_cast(mc->cameraTargetPlayer) : nullptr; @@ -718,7 +720,7 @@ void GameRenderer::renderItemInHand(float a, int eye) { localplayer->inventory->getSelected(); if (!(item && item->getItem()->id == Item::map_Id) && gameServices().getGameSettings(localplayer->GetXboxPad(), - eGameSetting_DisplayHand) == 0) + eGameSetting_DisplayHand) == 0) renderHand = false; } @@ -758,7 +760,8 @@ 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); @@ -790,7 +793,8 @@ 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); } @@ -833,7 +837,7 @@ void GameRenderer::turnOnLightLayer( if (logCount < 16) { ++logCount; Log::info("[linux-lightmap] turnOnLightLayer tex=%d scale=%d\n", - textureId, scaleLight ? 1 : 0); + textureId, scaleLight ? 1 : 0); } PlatformRenderer.TextureBindVertex(textureId, scaleLight); @@ -1197,8 +1201,7 @@ void GameRenderer::EnableUpdateThread() { // #endif #if defined(MULTITHREAD_ENABLE) if (updateRunning) return; - Log::info( - "------------------EnableUpdateThread--------------------\n"); + Log::info("------------------EnableUpdateThread--------------------\n"); updateRunning = true; m_updateEvents->set(eUpdateCanRun); m_updateEvents->set(eUpdateEventIsFinished); @@ -1211,8 +1214,7 @@ void GameRenderer::DisableUpdateThread() { // #endif #if defined(MULTITHREAD_ENABLE) if (!updateRunning) return; - Log::info( - "------------------DisableUpdateThread--------------------\n"); + Log::info("------------------DisableUpdateThread--------------------\n"); updateRunning = false; m_updateEvents->clear(eUpdateCanRun); m_updateEvents->waitForSingle(eUpdateEventIsFinished, @@ -1240,9 +1242,7 @@ void GameRenderer::renderLevel(float a, int64_t until) { // if (mc->cameraTargetPlayer == nullptr) // 4J - removed condition as we // want to update this is mc->player changes for different local players - { - mc->cameraTargetPlayer = mc->player; - } + { mc->cameraTargetPlayer = mc->player; } pick(a); std::shared_ptr cameraEntity = mc->cameraTargetPlayer; @@ -1380,9 +1380,9 @@ void GameRenderer::renderLevel(float a, int64_t until) { turnOffLightLayer(a); // 4J - brought forward from 1.8.2 if ((mc->hitResult != nullptr) && - cameraEntity->isUnderLiquid(Material::water) && - cameraEntity->instanceof( - eTYPE_PLAYER)) //&& !mc->options.hideGui) + cameraEntity->isUnderLiquid(Material::water) && + cameraEntity->instanceof + (eTYPE_PLAYER)) //&& !mc->options.hideGui) { std::shared_ptr player = std::dynamic_pointer_cast(cameraEntity); @@ -1395,7 +1395,8 @@ void GameRenderer::renderLevel(float a, int64_t until) { glDisable(GL_BLEND); glEnable(GL_CULL_FACE); - PlatformRenderer.StateSetBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + PlatformRenderer.StateSetBlendFunc(GL_SRC_ALPHA, + GL_ONE_MINUS_SRC_ALPHA); PlatformRenderer.StateSetDepthMask(true); setupFog(0, a); glEnable(GL_BLEND); @@ -1417,7 +1418,8 @@ void GameRenderer::renderLevel(float a, int64_t until) { int visibleWaterChunks = levelRenderer->render(cameraEntity, 1, a, updateChunks); - PlatformRenderer.StateSetBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + PlatformRenderer.StateSetBlendFunc(GL_SRC_ALPHA, + GL_ONE_MINUS_SRC_ALPHA); if (visibleWaterChunks > 0) { levelRenderer->render( @@ -1456,8 +1458,8 @@ void GameRenderer::renderLevel(float a, int64_t until) { glEnable(GL_CULL_FACE); glDisable(GL_BLEND); - if ((zoom == 1) && - cameraEntity->instanceof(eTYPE_PLAYER)) //&& !mc->options.hideGui) + if ((zoom == 1) && cameraEntity->instanceof + (eTYPE_PLAYER)) //&& !mc->options.hideGui) { if (mc->hitResult != nullptr && !cameraEntity->isUnderLiquid(Material::water)) { @@ -2016,7 +2018,7 @@ void GameRenderer::setupFog(int i, float alpha) { // 4J - check for creative mode brought forward from 1.2.3 bool creative = false; - if (player->instanceof(eTYPE_PLAYER)) { + if (player->instanceof (eTYPE_PLAYER)) { creative = (std::dynamic_pointer_cast(player))->abilities.instabuild; } diff --git a/targets/minecraft/client/renderer/GameRenderer.h b/targets/minecraft/client/renderer/GameRenderer.h index cc4302a0c..11a1dfa10 100644 --- a/targets/minecraft/client/renderer/GameRenderer.h +++ b/targets/minecraft/client/renderer/GameRenderer.h @@ -6,10 +6,10 @@ #include #include -#include "platform/C4JThread.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/util/SmoothFloat.h" #include "minecraft/world/phys/Vec3.h" +#include "platform/C4JThread.h" class Minecraft; class Entity; diff --git a/targets/minecraft/client/renderer/ItemInHandRenderer.cpp b/targets/minecraft/client/renderer/ItemInHandRenderer.cpp index 6ed11dc66..3bdeecbc1 100644 --- a/targets/minecraft/client/renderer/ItemInHandRenderer.cpp +++ b/targets/minecraft/client/renderer/ItemInHandRenderer.cpp @@ -1,21 +1,15 @@ -#include "minecraft/IGameServices.h" -#include "platform/stubs.h" -#include "minecraft/util/Log.h" #include "ItemInHandRenderer.h" - - #include #include #include -#include "platform/renderer/renderer.h" -#include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "Tesselator.h" #include "Textures.h" #include "TileRenderer.h" #include "java/System.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Lighting.h" #include "minecraft/client/MemoryTracker.h" @@ -27,7 +21,9 @@ #include "minecraft/client/renderer/entity/EntityRenderDispatcher.h" #include "minecraft/client/renderer/entity/PlayerRenderer.h" #include "minecraft/client/renderer/texture/TextureAtlas.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/client/resources/ResourceLocation.h" +#include "minecraft/util/Log.h" #include "minecraft/world/Icon.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/player/Inventory.h" @@ -40,6 +36,8 @@ #include "minecraft/world/level/material/Material.h" #include "minecraft/world/level/tile/FireTile.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" class EntityRenderer; class MapItemSavedData; @@ -466,9 +464,8 @@ void ItemInHandRenderer::render(float a) { static int lightmapLogCount = 0; if (lightmapLogCount < 8) { ++lightmapLogCount; - Log::info( - "[linux-lightmap] item-hand raw=0x%08x uv=(%d,%d)\n", col, u, - v); + Log::info("[linux-lightmap] item-hand raw=0x%08x uv=(%d,%d)\n", col, + u, v); } #endif glMultiTexCoord2f(GL_TEXTURE1, u / 1.0f, v / 1.0f); @@ -550,7 +547,8 @@ void ItemInHandRenderer::render(float a) { if ((itemInstance && (itemInstance->getItem()->id == Item::map_Id)) || gameServices().getGameSettings(localPlayer->GetXboxPad(), - eGameSetting_DisplayHand) != 0) { + eGameSetting_DisplayHand) != + 0) { playerRenderer->renderHand(); } glPopMatrix(); @@ -767,7 +765,7 @@ void ItemInHandRenderer::render(float a) { if ((itemInstance && (itemInstance->getItem()->id == Item::map_Id)) || gameServices().getGameSettings(localPlayer->GetXboxPad(), - eGameSetting_DisplayHand) != 0) { + eGameSetting_DisplayHand) != 0) { playerRenderer->renderHand(); } glPopMatrix(); diff --git a/targets/minecraft/client/renderer/LevelRenderer.cpp b/targets/minecraft/client/renderer/LevelRenderer.cpp index 1ae7c5c87..4d80b0502 100644 --- a/targets/minecraft/client/renderer/LevelRenderer.cpp +++ b/targets/minecraft/client/renderer/LevelRenderer.cpp @@ -1,9 +1,5 @@ -#include "minecraft/IGameServices.h" -#include "platform/stubs.h" -#include "minecraft/util/Log.h" #include "LevelRenderer.h" - #include #include #include @@ -16,23 +12,17 @@ #include #include -#include "platform/PlatformTypes.h" -#include "platform/input/input.h" -#include "platform/renderer/renderer.h" #include "Chunk.h" #include "GameRenderer.h" -#include "minecraft/GameEnums.h" -#include "app/common/Audio/SoundEngine.h" -#include "minecraft/client/resources/Colours/ColourTable.h" -#include "minecraft/Console_Debug_enum.h" -#include "util/FrameProfiler.h" -#include "minecraft/client/renderer/MobSkinMemTextureProcessor.h" #include "Tesselator.h" -#include "util/StringHelpers.h" +#include "app/common/Audio/SoundEngine.h" #include "java/Class.h" #include "java/JavaMath.h" #include "java/Random.h" #include "java/System.h" +#include "minecraft/Console_Debug_enum.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Lighting.h" #include "minecraft/client/MemoryTracker.h" @@ -69,6 +59,7 @@ #include "minecraft/client/particle/SuspendedTownParticle.h" #include "minecraft/client/particle/TerrainParticle.h" #include "minecraft/client/player/LocalPlayer.h" +#include "minecraft/client/renderer/MobSkinMemTextureProcessor.h" #include "minecraft/client/renderer/OffsettedRenderList.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/renderer/TileRenderer.h" @@ -79,9 +70,11 @@ #include "minecraft/client/renderer/entity/EntityRenderDispatcher.h" #include "minecraft/client/renderer/texture/TextureAtlas.h" #include "minecraft/client/renderer/tileentity/TileEntityRenderDispatcher.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/sounds/SoundTypes.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/entity/Entity.h" @@ -108,6 +101,12 @@ #include "minecraft/world/phys/AABB.h" #include "minecraft/world/phys/HitResult.h" #include "minecraft/world/phys/Vec3.h" +#include "platform/PlatformTypes.h" +#include "platform/input/input.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" +#include "util/FrameProfiler.h" +#include "util/StringHelpers.h" class Icon; class ItemInstance; @@ -623,7 +622,7 @@ void LevelRenderer::renderEntities(Vec3* cam, Culler* culler, float a) { (entity->noCulling || culler->isVisible(&entity->bb))); // Render the mob if the mob's leash holder is within the culler - if (!shouldRender && entity->instanceof(eTYPE_MOB)) { + if (!shouldRender && entity->instanceof (eTYPE_MOB)) { std::shared_ptr mob = std::dynamic_pointer_cast(entity); if (mob->isLeashed() && (mob->getLeashHolder() != nullptr)) { std::shared_ptr leashHolder = mob->getLeashHolder(); @@ -637,10 +636,10 @@ void LevelRenderer::renderEntities(Vec3* cam, Culler* culler, float a) { // !mc->options->thirdPersonView && // !mc->cameraTargetPlayer->isSleeping()) continue; std::shared_ptr localplayer = - mc->cameraTargetPlayer->instanceof(eTYPE_LOCALPLAYER) - ? std::dynamic_pointer_cast( - mc->cameraTargetPlayer) - : nullptr; + mc->cameraTargetPlayer->instanceof + (eTYPE_LOCALPLAYER) ? std::dynamic_pointer_cast( + mc->cameraTargetPlayer) + : nullptr; if (localplayer && entity == mc->cameraTargetPlayer && !localplayer->ThirdPersonView() && @@ -681,16 +680,16 @@ void LevelRenderer::renderEntities(Vec3* cam, Culler* culler, float a) { std::string LevelRenderer::gatherStats1() { return "C: " + toWString(renderedChunks) + "/" + - toWString(totalChunks) + ". F: " + - toWString(offscreenChunks) + ", O: " + - toWString(occludedChunks) + ", E: " + - toWString(emptyChunks); + toWString(totalChunks) + + ". F: " + toWString(offscreenChunks) + + ", O: " + toWString(occludedChunks) + + ", E: " + toWString(emptyChunks); } std::string LevelRenderer::gatherStats2() { return "E: " + toWString(renderedEntities) + "/" + - toWString(totalEntities) + ". B: " + - toWString(culledEntities) + ", I: " + + toWString(totalEntities) + + ". B: " + toWString(culledEntities) + ", I: " + toWString((totalEntities - culledEntities) - renderedEntities); } @@ -862,8 +861,8 @@ int LevelRenderer::renderChunks(int from, int to, int layer, double alpha) { // 4jcraft: replaced glPushMatrix/glTranslatef/glPopMatrix per chunk // no more full MVP upload per chunk, can also be bkwards compat PlatformRenderer.SetChunkOffset((float)chunk->chunk->x, - (float)chunk->chunk->y, - (float)chunk->chunk->z); + (float)chunk->chunk->y, + (float)chunk->chunk->z); if (PlatformRenderer.CBuffCall(list, first)) { first = false; @@ -1168,7 +1167,7 @@ void LevelRenderer::renderClouds(float alpha) { // if the primary player has clouds off, so do all players on this machine if (gameServices().getGameSettings(PlatformInput.GetPrimaryPad(), - eGameSetting_Clouds) == 0) { + eGameSetting_Clouds) == 0) { return; } @@ -2223,7 +2222,8 @@ 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; PlatformRenderer.StateSetLightingEnable(false); glDisable(GL_TEXTURE_2D); @@ -3204,7 +3204,7 @@ std::shared_ptr LevelRenderer::addParticleInternal( } void LevelRenderer::entityAdded(std::shared_ptr entity) { - if (entity->instanceof(eTYPE_PLAYER)) { + if (entity->instanceof (eTYPE_PLAYER)) { std::shared_ptr player = std::dynamic_pointer_cast(entity); player->prepareCustomTextures(); @@ -3222,7 +3222,7 @@ void LevelRenderer::entityAdded(std::shared_ptr entity) { } void LevelRenderer::entityRemoved(std::shared_ptr entity) { - if (entity->instanceof(eTYPE_PLAYER)) { + if (entity->instanceof (eTYPE_PLAYER)) { std::shared_ptr player = std::dynamic_pointer_cast(entity); if (player->customTextureUrl != "") { @@ -3518,7 +3518,7 @@ void LevelRenderer::levelEvent(std::shared_ptr source, int type, int x, if (!mc->soundEngine->GetIsPlayingStreamingGameMusic()) { level[playerIndex]->playStreamingMusic( "", x, y, z); // 4J - used to pass nullptr, but using - // empty string here now instead + // empty string here now instead } } mc->localplayers[playerIndex]->updateRichPresence(); diff --git a/targets/minecraft/client/renderer/LevelRenderer.h b/targets/minecraft/client/renderer/LevelRenderer.h index 9adda8ec3..fa319735a 100644 --- a/targets/minecraft/client/renderer/LevelRenderer.h +++ b/targets/minecraft/client/renderer/LevelRenderer.h @@ -1,14 +1,14 @@ #pragma once -#include "platform/NetTypes.h" -#include "minecraft/client/model/SkinBox.h" #include "OffsettedRenderList.h" -#include "platform/C4JThread.h" -#include "util/Definitions.h" #include "java/JavaIntHash.h" +#include "minecraft/client/model/SkinBox.h" #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelListener.h" #include "minecraft/world/phys/AABB.h" +#include "platform/C4JThread.h" +#include "platform/NetTypes.h" +#include "util/Definitions.h" class ClipChunk; class HitResult; diff --git a/targets/minecraft/client/renderer/OffsettedRenderList.cpp b/targets/minecraft/client/renderer/OffsettedRenderList.cpp index 34d1d1123..9c9c18426 100644 --- a/targets/minecraft/client/renderer/OffsettedRenderList.cpp +++ b/targets/minecraft/client/renderer/OffsettedRenderList.cpp @@ -1,9 +1,9 @@ #include "OffsettedRenderList.h" -#include "platform/stubs.h" -#include "platform/renderer/renderer.h" #include "java/IntBuffer.h" #include "minecraft/client/MemoryTracker.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" // 4J added OffsettedRenderList::OffsettedRenderList() { diff --git a/targets/minecraft/client/renderer/Tesselator.cpp b/targets/minecraft/client/renderer/Tesselator.cpp index 6abdf4b28..0d1e7bff0 100644 --- a/targets/minecraft/client/renderer/Tesselator.cpp +++ b/targets/minecraft/client/renderer/Tesselator.cpp @@ -1,13 +1,11 @@ -#include "minecraft/util/Log.h" #include "Tesselator.h" - - #include +#include "minecraft/client/MemoryTracker.h" +#include "minecraft/util/Log.h" #include "platform/renderer/renderer.h" #include "platform/stubs.h" -#include "minecraft/client/MemoryTracker.h" bool Tesselator::TRIANGLE_MODE = false; bool Tesselator::USE_VBO = false; @@ -132,7 +130,8 @@ void Tesselator::end() { PlatformRenderer.DrawVertices( (IPlatformRenderer::ePrimitiveType)mode, vertexCount, _array->data(), - IPlatformRenderer::VERTEX_TYPE_PF3_TF2_CB4_NB4_XW1_TEXGEN, + IPlatformRenderer:: + VERTEX_TYPE_PF3_TF2_CB4_NB4_XW1_TEXGEN, IPlatformRenderer::PIXEL_SHADER_TYPE_PROJECTION); } else { PlatformRenderer.DrawVertices( @@ -538,8 +537,8 @@ void Tesselator::vertex(float x, float y, float z) { #endif } else { // -512 each for u/v will mean that the renderer will use global - // settings (set via PlatformRenderer.StateSetVertexTextureUV) rather - // than these local ones + // settings (set via PlatformRenderer.StateSetVertexTextureUV) + // rather than these local ones *(unsigned int*)(&_array->data()[p + 7]) = 0xfe00fe00; } diff --git a/targets/minecraft/client/renderer/Textures.cpp b/targets/minecraft/client/renderer/Textures.cpp index eae1272b5..c4ef4d783 100644 --- a/targets/minecraft/client/renderer/Textures.cpp +++ b/targets/minecraft/client/renderer/Textures.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "platform/stubs.h" #include "Textures.h" #include @@ -9,19 +7,16 @@ #include #include - -#include "platform/renderer/renderer.h" #include "HttpTexture.h" +#include "java/Buffer.h" +#include "java/ByteBuffer.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/BufferedImage.h" +#include "minecraft/client/MemoryTracker.h" +#include "minecraft/client/Options.h" #include "minecraft/client/renderer/MemTexture.h" #include "minecraft/client/renderer/MemTextureProcessor.h" #include "minecraft/client/renderer/MobSkinMemTextureProcessor.h" -#include "util/StringHelpers.h" - -#include "java/Buffer.h" -#include "java/ByteBuffer.h" -#include "minecraft/client/MemoryTracker.h" -#include "minecraft/client/Options.h" #include "minecraft/client/renderer/texture/PreStitchedTextureMap.h" #include "minecraft/client/renderer/texture/Texture.h" #include "minecraft/client/renderer/texture/TextureAtlas.h" @@ -32,6 +27,9 @@ #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/item/ItemEntity.h" #include "minecraft/world/item/ItemInstance.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" +#include "util/StringHelpers.h" // Linux/PC port: disable mipmapping globally so textures are always sampled // from the full-resolution level 0 with GL_NEAREST, giving pixel-crisp @@ -416,9 +414,7 @@ int Textures::loadTexture(int idx) { // renderer that map the single 8-bit channel to RGBA differently. void Textures::setTextureFormat(const std::string& resourceName) { // 4J Stu - These texture formats are not currently in the render header - { - TEXTURE_FORMAT = IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw; - } + { TEXTURE_FORMAT = IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw; } } void Textures::bindTexture(const std::string& resourceName) { @@ -526,8 +522,8 @@ void Textures::bindTextureLayers(ResourceLocation* resource) { mergedWidth, mergedHeight, BufferedImage::TYPE_INT_ARGB); memcpy(mergedImage->getData(), mergedPixels.data(), mergedWidth * mergedHeight * sizeof(int)); - id = getTexture(mergedImage, IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw, - false); + id = getTexture(mergedImage, + IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw, false); } else { id = 0; } @@ -573,8 +569,7 @@ ResourceLocation* Textures::getTextureLocation(int iconType) { void Textures::clearLastBoundId() { lastBoundId = -1; } -int Textures::loadTexture(TEXTURE_NAME texId, - const std::string& resourceName) { +int Textures::loadTexture(TEXTURE_NAME texId, const std::string& resourceName) { // char buf[256]; // strncpy(buf, resourceName.c_str(), 256); // printf("Textures::loadTexture name - %s\n",buf); @@ -606,8 +601,7 @@ int Textures::loadTexture(TEXTURE_NAME texId, (resourceName == "%clamp%misc/shadow.png") || (resourceName == "%blur%misc/pumpkinblur.png") || (resourceName == "%clamp%misc/shadow.png") || - (resourceName == "gui/icons.png") || - (resourceName == "gui/gui.png") || + (resourceName == "gui/icons.png") || (resourceName == "gui/gui.png") || (resourceName == "misc/footprint.png")) { MIPMAP = false; } @@ -654,7 +648,8 @@ return id; */ } -int Textures::getTexture(BufferedImage* img, IPlatformRenderer::eTextureFormat format, +int Textures::getTexture(BufferedImage* img, + IPlatformRenderer::eTextureFormat format, bool mipmap) { int id = MemoryTracker::genTextures(); TEXTURE_FORMAT = format; @@ -805,7 +800,7 @@ void Textures::loadTexture(BufferedImage* img, int id, bool blur, bool clamp) { } delete[] tempData; PlatformRenderer.TextureData(ww, hh, pixels->getBuffer(), level, - TEXTURE_FORMAT); + TEXTURE_FORMAT); } } @@ -905,7 +900,7 @@ void Textures::replaceTextureDirect(const std::vector& rawPixels, int w, glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); PlatformRenderer.TextureDataUpdate(0, 0, w, h, - const_cast(rawPixels.data()), 0); + const_cast(rawPixels.data()), 0); } // 4J - added. This is a more minimal version of replaceTexture that assumes the @@ -925,7 +920,7 @@ void Textures::replaceTextureDirect(const std::vector& rawPixels, int w, glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); PlatformRenderer.TextureDataUpdate(0, 0, w, h, - const_cast(rawPixels.data()), 0); + const_cast(rawPixels.data()), 0); } void Textures::releaseTexture(int id) { @@ -1019,9 +1014,9 @@ int Textures::loadMemTexture(const std::string& url, } if (texture->id < 0) { - texture->id = - getTexture(texture->loadedImage, - IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw, MIPMAP); + texture->id = getTexture( + texture->loadedImage, + IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw, MIPMAP); } else { loadTexture(texture->loadedImage, texture->id); } @@ -1056,9 +1051,9 @@ int Textures::loadMemTexture(const std::string& url, int backup) { MIPMAP = false; } if (texture->id < 0) { - texture->id = - getTexture(texture->loadedImage, - IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw, MIPMAP); + texture->id = getTexture( + texture->loadedImage, + IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw, MIPMAP); } else { loadTexture(texture->loadedImage, texture->id); } @@ -1230,9 +1225,7 @@ BufferedImage* Textures::readImage( name, false, isTu, drive); // new BufferedImage(name,false,isTu,drive); } else { - { - drive = skins->getDefault()->getPath(isTu); - } + { drive = skins->getDefault()->getPath(isTu); } if (IsOriginalImage(texId, name) || isTu) { img = skins->getDefault()->getImageResource( @@ -1303,16 +1296,16 @@ TEXTURE_NAME TUImages[] = { }; // This is for any TU textures that aren't part of our enum indexed preload set -const char* const TUImagePaths[] = { - "font/Default", "font/Mojangles_7", "font/Mojangles_11", +const char* const TUImagePaths[] = {"font/Default", "font/Mojangles_7", + "font/Mojangles_11", - // TU12 - "armor/cloth_1.png", "armor/cloth_1_b.png", "armor/cloth_2.png", - "armor/cloth_2_b.png", + // TU12 + "armor/cloth_1.png", "armor/cloth_1_b.png", + "armor/cloth_2.png", "armor/cloth_2_b.png", - // + // - nullptr}; + nullptr}; bool Textures::IsTUImage(TEXTURE_NAME texId, const std::string& name) { int i = 0; @@ -1344,7 +1337,7 @@ TEXTURE_NAME OriginalImages[] = {TN_MOB_CHAR, TN_MOB_CHAR1, TN_MOB_CHAR2, const char* const OriginalImagesPaths[] = {"misc/watercolor.png", - nullptr}; + nullptr}; bool Textures::IsOriginalImage(TEXTURE_NAME texId, const std::string& name) { int i = 0; diff --git a/targets/minecraft/client/renderer/Textures.h b/targets/minecraft/client/renderer/Textures.h index 8d067f247..d8855ecbd 100644 --- a/targets/minecraft/client/renderer/Textures.h +++ b/targets/minecraft/client/renderer/Textures.h @@ -5,7 +5,6 @@ #include #include -#include "platform/renderer/renderer.h" #include "platform/renderer/renderer.h" class Icon; diff --git a/targets/minecraft/client/renderer/TileRenderer.cpp b/targets/minecraft/client/renderer/TileRenderer.cpp index 79beb927d..acf089344 100644 --- a/targets/minecraft/client/renderer/TileRenderer.cpp +++ b/targets/minecraft/client/renderer/TileRenderer.cpp @@ -1,6 +1,4 @@ #include "TileRenderer.h" -#include "platform/stubs.h" - #include #include @@ -10,18 +8,16 @@ #include #include -#include "platform/renderer/renderer.h" #include "EntityTileRenderer.h" #include "GameRenderer.h" -#include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" -#include "util/FrameProfiler.h" #include "Tesselator.h" #include "minecraft/Direction.h" #include "minecraft/Facing.h" +#include "minecraft/GameEnums.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/renderer/Textures.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/world/Icon.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelSource.h" @@ -66,6 +62,9 @@ #include "minecraft/world/level/tile/piston/PistonBaseTile.h" #include "minecraft/world/level/tile/piston/PistonExtensionTile.h" #include "minecraft/world/phys/Vec3.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" +#include "util/FrameProfiler.h" bool TileRenderer::fancy = true; diff --git a/targets/minecraft/client/renderer/culling/Frustum.cpp b/targets/minecraft/client/renderer/culling/Frustum.cpp index a11bee30e..9d4191092 100644 --- a/targets/minecraft/client/renderer/culling/Frustum.cpp +++ b/targets/minecraft/client/renderer/culling/Frustum.cpp @@ -1,15 +1,14 @@ #include "Frustum.h" - #include #include #include -#include "platform/renderer/renderer.h" -#include "platform/stubs.h" #include "java/FloatBuffer.h" #include "minecraft/client/MemoryTracker.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" class FrustumData; diff --git a/targets/minecraft/client/renderer/entity/ArrowRenderer.cpp b/targets/minecraft/client/renderer/entity/ArrowRenderer.cpp index 077a08160..f9acc2b37 100644 --- a/targets/minecraft/client/renderer/entity/ArrowRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/ArrowRenderer.cpp @@ -1,18 +1,16 @@ #include "ArrowRenderer.h" -#include "platform/stubs.h" #include #include -#include "platform/renderer/renderer.h" - #include "minecraft/client/renderer/Tesselator.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/projectile/Arrow.h" - +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation ArrowRenderer::ARROW_LOCATION = ResourceLocation(TN_ITEM_ARROWS); diff --git a/targets/minecraft/client/renderer/entity/BatRenderer.cpp b/targets/minecraft/client/renderer/entity/BatRenderer.cpp index dc8239f17..e24504373 100644 --- a/targets/minecraft/client/renderer/entity/BatRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/BatRenderer.cpp @@ -1,11 +1,8 @@ #include "BatRenderer.h" -#include "platform/stubs.h" #include #include - -#include "platform/renderer/renderer.h" #include "minecraft/client/model/BatModel.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/client/renderer/Textures.h" @@ -13,6 +10,8 @@ #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/ambient/Bat.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation BatRenderer::BAT_LOCATION = ResourceLocation(TN_MOB_BAT); diff --git a/targets/minecraft/client/renderer/entity/BoatRenderer.cpp b/targets/minecraft/client/renderer/entity/BoatRenderer.cpp index 9b349bbbc..a0a0fe9b8 100644 --- a/targets/minecraft/client/renderer/entity/BoatRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/BoatRenderer.cpp @@ -1,11 +1,9 @@ #include "BoatRenderer.h" -#include "platform/stubs.h" #include #include -#include "platform/renderer/renderer.h" #include "minecraft/client/model/BoatModel.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/client/renderer/Textures.h" @@ -13,6 +11,8 @@ #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/item/Boat.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation BoatRenderer::BOAT_LOCATION = ResourceLocation(TN_ITEM_BOAT); diff --git a/targets/minecraft/client/renderer/entity/CaveSpiderRenderer.cpp b/targets/minecraft/client/renderer/entity/CaveSpiderRenderer.cpp index ed36551be..f865cccac 100644 --- a/targets/minecraft/client/renderer/entity/CaveSpiderRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/CaveSpiderRenderer.cpp @@ -1,12 +1,12 @@ #include "CaveSpiderRenderer.h" -#include "platform/stubs.h" #include -#include "platform/renderer/renderer.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/renderer/entity/SpiderRenderer.h" #include "minecraft/client/resources/ResourceLocation.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation CaveSpiderRenderer::CAVE_SPIDER_LOCATION = ResourceLocation(TN_MOB_CAVE_SPIDER); diff --git a/targets/minecraft/client/renderer/entity/CreeperRenderer.cpp b/targets/minecraft/client/renderer/entity/CreeperRenderer.cpp index e400f5ed5..44d1f3838 100644 --- a/targets/minecraft/client/renderer/entity/CreeperRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/CreeperRenderer.cpp @@ -1,18 +1,17 @@ #include "CreeperRenderer.h" -#include "platform/stubs.h" #include #include -#include "platform/renderer/renderer.h" - #include "minecraft/client/model/CreeperModel.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/renderer/entity/MobRenderer.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/monster/Creeper.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation CreeperRenderer::POWER_LOCATION = ResourceLocation(TN_POWERED_CREEPER); diff --git a/targets/minecraft/client/renderer/entity/DefaultRenderer.cpp b/targets/minecraft/client/renderer/entity/DefaultRenderer.cpp index b3288523e..d6f4feeed 100644 --- a/targets/minecraft/client/renderer/entity/DefaultRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/DefaultRenderer.cpp @@ -1,7 +1,7 @@ #include "DefaultRenderer.h" -#include "platform/stubs.h" #include "platform/renderer/renderer.h" +#include "platform/stubs.h" void DefaultRenderer::render(std::shared_ptr entity, double x, double y, double z, float rot, float a) { diff --git a/targets/minecraft/client/renderer/entity/EnderCrystalRenderer.cpp b/targets/minecraft/client/renderer/entity/EnderCrystalRenderer.cpp index 505f567fe..fc6397d8a 100644 --- a/targets/minecraft/client/renderer/entity/EnderCrystalRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/EnderCrystalRenderer.cpp @@ -1,16 +1,16 @@ #include "EnderCrystalRenderer.h" -#include "platform/stubs.h" #include #include -#include "platform/renderer/renderer.h" #include "minecraft/client/model/dragon/EnderCrystalModel.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/boss/enderdragon/EnderCrystal.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation EnderCrystalRenderer::ENDER_CRYSTAL_LOCATION = ResourceLocation(TN_MOB_ENDERDRAGON_ENDERCRYSTAL); diff --git a/targets/minecraft/client/renderer/entity/EnderDragonRenderer.cpp b/targets/minecraft/client/renderer/entity/EnderDragonRenderer.cpp index f6e9fac21..b43e7e58e 100644 --- a/targets/minecraft/client/renderer/entity/EnderDragonRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/EnderDragonRenderer.cpp @@ -1,14 +1,11 @@ #include "EnderDragonRenderer.h" -#include "platform/stubs.h" #include #include #include #include -#include "platform/renderer/renderer.h" #include "SharedConstants.h" - #include "java/Random.h" #include "minecraft/client/Lighting.h" #include "minecraft/client/model/dragon/DragonModel.h" @@ -22,6 +19,8 @@ #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/boss/enderdragon/EnderCrystal.h" #include "minecraft/world/entity/boss/enderdragon/EnderDragon.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation EnderDragonRenderer::DRAGON_EXPLODING_LOCATION = ResourceLocation(TN_MOB_ENDERDRAGON_SHUFFLE); diff --git a/targets/minecraft/client/renderer/entity/EndermanRenderer.cpp b/targets/minecraft/client/renderer/entity/EndermanRenderer.cpp index 2edc80ee5..082703e7a 100644 --- a/targets/minecraft/client/renderer/entity/EndermanRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/EndermanRenderer.cpp @@ -1,11 +1,7 @@ #include "EndermanRenderer.h" -#include "platform/stubs.h" #include - -#include "platform/renderer/renderer.h" - #include "minecraft/SharedConstants.h" #include "minecraft/client/model/EndermanModel.h" #include "minecraft/client/renderer/Textures.h" @@ -17,6 +13,8 @@ #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/monster/EnderMan.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation EndermanRenderer::ENDERMAN_EYES_LOCATION = ResourceLocation(TN_MOB_ENDERMAN_EYES); diff --git a/targets/minecraft/client/renderer/entity/EntityRenderDispatcher.cpp b/targets/minecraft/client/renderer/entity/EntityRenderDispatcher.cpp index bcd40fb6c..9981db874 100644 --- a/targets/minecraft/client/renderer/entity/EntityRenderDispatcher.cpp +++ b/targets/minecraft/client/renderer/entity/EntityRenderDispatcher.cpp @@ -1,5 +1,3 @@ -#include "minecraft/util/Log.h" -#include "platform/stubs.h" #include "EntityRenderDispatcher.h" #include @@ -7,7 +5,6 @@ #include #include -#include "platform/renderer/renderer.h" #include "ArrowRenderer.h" #include "BatRenderer.h" #include "BlazeRenderer.h" @@ -59,7 +56,6 @@ #include "WitherSkullRenderer.h" #include "WolfRenderer.h" #include "ZombieRenderer.h" - #include "minecraft/client/model/ChickenModel.h" #include "minecraft/client/model/CowModel.h" #include "minecraft/client/model/HumanoidModel.h" @@ -73,6 +69,7 @@ #include "minecraft/client/model/WolfModel.h" #include "minecraft/client/model/ZombieModel.h" #include "minecraft/client/renderer/Tesselator.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/player/Player.h" @@ -81,6 +78,8 @@ #include "minecraft/world/item/alchemy/PotionBrewing.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" class Font; class IconRegister; diff --git a/targets/minecraft/client/renderer/entity/EntityRenderer.cpp b/targets/minecraft/client/renderer/entity/EntityRenderer.cpp index 33ea6f2e3..9dcb82ba5 100644 --- a/targets/minecraft/client/renderer/entity/EntityRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/EntityRenderer.cpp @@ -1,11 +1,8 @@ #include "EntityRenderer.h" -#include "platform/stubs.h" #include -#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" - #include "java/Class.h" #include "minecraft/client/Options.h" #include "minecraft/client/renderer/Tesselator.h" @@ -21,6 +18,8 @@ #include "minecraft/world/level/tile/FireTile.h" #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/phys/AABB.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation EntityRenderer::SHADOW_LOCATION = ResourceLocation(TN__CLAMP__MISC_SHADOW); @@ -157,11 +156,11 @@ void EntityRenderer::renderShadow(std::shared_ptr e, double x, double y, float r = shadowRadius; float fYLocalPlayerShadowOffset = 0.0f; - if (e->instanceof(eTYPE_MOB)) { + if (e->instanceof (eTYPE_MOB)) { std::shared_ptr mob = std::dynamic_pointer_cast(e); r *= mob->getSizeScale(); - if (mob->instanceof(eTYPE_ANIMAL)) { + if (mob->instanceof (eTYPE_ANIMAL)) { if (std::dynamic_pointer_cast(mob)->isBaby()) { r *= 0.5f; } @@ -174,7 +173,7 @@ void EntityRenderer::renderShadow(std::shared_ptr e, double x, double y, // 4J-PB - local players seem to have a position at their head, and remote // players have a foot position. get the shadow to render by changing the // check here depending on the player type - if (e->instanceof(eTYPE_LOCALPLAYER)) { + if (e->instanceof (eTYPE_LOCALPLAYER)) { ey -= 1.62; fYLocalPlayerShadowOffset = -1.62f; } diff --git a/targets/minecraft/client/renderer/entity/ExperienceOrbRenderer.cpp b/targets/minecraft/client/renderer/entity/ExperienceOrbRenderer.cpp index 541c10325..0e375fd88 100644 --- a/targets/minecraft/client/renderer/entity/ExperienceOrbRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/ExperienceOrbRenderer.cpp @@ -1,20 +1,19 @@ #include "ExperienceOrbRenderer.h" -#include "platform/stubs.h" #include #include #include -#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" - #include "minecraft/SharedConstants.h" #include "minecraft/client/renderer/Tesselator.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/ExperienceOrb.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation ExperienceOrbRenderer::XP_ORB_LOCATION = ResourceLocation(TN_ITEM_EXPERIENCE_ORB); diff --git a/targets/minecraft/client/renderer/entity/FallingTileRenderer.cpp b/targets/minecraft/client/renderer/entity/FallingTileRenderer.cpp index e80338b5a..6d2551dbe 100644 --- a/targets/minecraft/client/renderer/entity/FallingTileRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/FallingTileRenderer.cpp @@ -1,11 +1,8 @@ #include "FallingTileRenderer.h" -#include "platform/stubs.h" #include #include -#include "platform/renderer/renderer.h" - #include "minecraft/client/renderer/Tesselator.h" #include "minecraft/client/renderer/TileRenderer.h" #include "minecraft/client/renderer/entity/EntityRenderer.h" @@ -15,6 +12,8 @@ #include "minecraft/world/level/Level.h" #include "minecraft/world/level/tile/AnvilTile.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" FallingTileRenderer::FallingTileRenderer() : EntityRenderer() { tileRenderer = new TileRenderer(); diff --git a/targets/minecraft/client/renderer/entity/FireballRenderer.cpp b/targets/minecraft/client/renderer/entity/FireballRenderer.cpp index 93276d3aa..5634860eb 100644 --- a/targets/minecraft/client/renderer/entity/FireballRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/FireballRenderer.cpp @@ -1,11 +1,8 @@ #include "FireballRenderer.h" -#include "platform/stubs.h" #include -#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" - #include "java/Class.h" #include "minecraft/client/renderer/Tesselator.h" #include "minecraft/client/renderer/texture/TextureAtlas.h" @@ -16,6 +13,8 @@ #include "minecraft/world/level/tile/FireTile.h" #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/phys/AABB.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" FireballRenderer::FireballRenderer(float scale) { this->scale = scale; } diff --git a/targets/minecraft/client/renderer/entity/FishingHookRenderer.cpp b/targets/minecraft/client/renderer/entity/FishingHookRenderer.cpp index 0ca326512..39a1710e9 100644 --- a/targets/minecraft/client/renderer/entity/FishingHookRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/FishingHookRenderer.cpp @@ -1,13 +1,10 @@ #include "FishingHookRenderer.h" -#include "platform/stubs.h" #include #include #include -#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" - #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/client/renderer/Tesselator.h" @@ -17,6 +14,8 @@ #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/entity/projectile/FishingHook.h" #include "minecraft/world/phys/Vec3.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation FishingHookRenderer::PARTICLE_LOCATION = ResourceLocation(TN_PARTICLES); diff --git a/targets/minecraft/client/renderer/entity/GhastRenderer.cpp b/targets/minecraft/client/renderer/entity/GhastRenderer.cpp index 862f3e409..cdf0f5351 100644 --- a/targets/minecraft/client/renderer/entity/GhastRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/GhastRenderer.cpp @@ -1,9 +1,7 @@ #include "GhastRenderer.h" -#include "platform/stubs.h" #include -#include "platform/renderer/renderer.h" #include "minecraft/client/model/GhastModel.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/renderer/entity/MobRenderer.h" @@ -11,6 +9,8 @@ #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/monster/Ghast.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation GhastRenderer::GHAST_LOCATION = ResourceLocation(TN_MOB_GHAST); ResourceLocation GhastRenderer::GHAST_SHOOTING_LOCATION = diff --git a/targets/minecraft/client/renderer/entity/GiantMobRenderer.cpp b/targets/minecraft/client/renderer/entity/GiantMobRenderer.cpp index e03bd8256..55c91e273 100644 --- a/targets/minecraft/client/renderer/entity/GiantMobRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/GiantMobRenderer.cpp @@ -1,12 +1,12 @@ #include "GiantMobRenderer.h" -#include "platform/stubs.h" #include -#include "platform/renderer/renderer.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/renderer/entity/MobRenderer.h" #include "minecraft/client/resources/ResourceLocation.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" class Model; diff --git a/targets/minecraft/client/renderer/entity/HorseRenderer.cpp b/targets/minecraft/client/renderer/entity/HorseRenderer.cpp index bc7f42901..82e3ac25f 100644 --- a/targets/minecraft/client/renderer/entity/HorseRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/HorseRenderer.cpp @@ -1,10 +1,7 @@ #include "HorseRenderer.h" -#include "platform/stubs.h" #include - -#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" #include "MobRenderer.h" #include "minecraft/client/model/geom/Model.h" @@ -14,6 +11,8 @@ #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/animal/EntityHorse.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation HorseRenderer::HORSE_LOCATION = ResourceLocation(TN_MOB_HORSE_WHITE); diff --git a/targets/minecraft/client/renderer/entity/HumanoidMobRenderer.cpp b/targets/minecraft/client/renderer/entity/HumanoidMobRenderer.cpp index abfebd434..6e1b6f8be 100644 --- a/targets/minecraft/client/renderer/entity/HumanoidMobRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/HumanoidMobRenderer.cpp @@ -1,13 +1,9 @@ #include "HumanoidMobRenderer.h" -#include "platform/stubs.h" #include #include - -#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" -#include "util/StringHelpers.h" #include "minecraft/Facing.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/model/HumanoidModel.h" @@ -25,6 +21,9 @@ #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/level/tile/Tile.h" #include "nbt/CompoundTag.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" +#include "util/StringHelpers.h" const std::string HumanoidMobRenderer::MATERIAL_NAMES[5] = { "cloth", "chain", "iron", "diamond", "gold"}; diff --git a/targets/minecraft/client/renderer/entity/ItemFrameRenderer.cpp b/targets/minecraft/client/renderer/entity/ItemFrameRenderer.cpp index 314b90bff..9b742a276 100644 --- a/targets/minecraft/client/renderer/entity/ItemFrameRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/ItemFrameRenderer.cpp @@ -1,12 +1,11 @@ #include -#include "platform/stubs.h" #include "EntityRenderDispatcher.h" #include "minecraft/client/renderer/TileRenderer.h" +#include "platform/stubs.h" // #include "ItemFrame" -#include "platform/renderer/renderer.h" #include "ItemFrameRenderer.h" #include "minecraft/Direction.h" #include "minecraft/Facing.h" @@ -28,6 +27,7 @@ #include "minecraft/world/item/MapItem.h" #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/level/tile/TreeTile.h" +#include "platform/renderer/renderer.h" class MapItemSavedData; diff --git a/targets/minecraft/client/renderer/entity/ItemRenderer.cpp b/targets/minecraft/client/renderer/entity/ItemRenderer.cpp index d8023e62f..8190e98bb 100644 --- a/targets/minecraft/client/renderer/entity/ItemRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/ItemRenderer.cpp @@ -1,14 +1,10 @@ #include "ItemRenderer.h" -#include "platform/stubs.h" #include #include -#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" -#include "util/StringHelpers.h" - #include "java/JavaMath.h" #include "java/Random.h" #include "minecraft/SharedConstants.h" @@ -29,6 +25,9 @@ #include "minecraft/world/item/Item.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" +#include "util/StringHelpers.h" class ResourceLocation; diff --git a/targets/minecraft/client/renderer/entity/ItemSpriteRenderer.cpp b/targets/minecraft/client/renderer/entity/ItemSpriteRenderer.cpp index 6266e3d42..71fde94d0 100644 --- a/targets/minecraft/client/renderer/entity/ItemSpriteRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/ItemSpriteRenderer.cpp @@ -1,11 +1,8 @@ #include "ItemSpriteRenderer.h" -#include "platform/stubs.h" #include -#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" - #include "minecraft/client/renderer/Tesselator.h" #include "minecraft/client/renderer/entity/EntityRenderer.h" #include "minecraft/client/renderer/texture/TextureAtlas.h" @@ -15,6 +12,8 @@ #include "minecraft/world/item/Item.h" #include "minecraft/world/item/PotionItem.h" #include "minecraft/world/item/alchemy/PotionBrewing.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ItemSpriteRenderer::ItemSpriteRenderer(Item* sourceItem, int sourceItemAuxValue /*= 0*/) diff --git a/targets/minecraft/client/renderer/entity/LavaSlimeRenderer.cpp b/targets/minecraft/client/renderer/entity/LavaSlimeRenderer.cpp index 2aeee8c4c..ab946b958 100644 --- a/targets/minecraft/client/renderer/entity/LavaSlimeRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/LavaSlimeRenderer.cpp @@ -1,15 +1,15 @@ #include "LavaSlimeRenderer.h" -#include "platform/stubs.h" #include -#include "platform/renderer/renderer.h" #include "minecraft/client/model/LavaSlimeModel.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/renderer/entity/MobRenderer.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/monster/LavaSlime.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation LavaSlimeRenderer::MAGMACUBE_LOCATION = ResourceLocation(TN_MOB_LAVA); diff --git a/targets/minecraft/client/renderer/entity/LeashKnotRenderer.cpp b/targets/minecraft/client/renderer/entity/LeashKnotRenderer.cpp index 553b365b7..e9b24215e 100644 --- a/targets/minecraft/client/renderer/entity/LeashKnotRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/LeashKnotRenderer.cpp @@ -1,14 +1,13 @@ #include "LeashKnotRenderer.h" -#include "platform/stubs.h" #include -#include "platform/renderer/renderer.h" - #include "minecraft/client/model/LeashKnotModel.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/renderer/entity/EntityRenderer.h" #include "minecraft/client/resources/ResourceLocation.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation LeashKnotRenderer::KNOT_LOCATION = ResourceLocation(TN_ITEM_LEASHKNOT); diff --git a/targets/minecraft/client/renderer/entity/LightningBoltRenderer.cpp b/targets/minecraft/client/renderer/entity/LightningBoltRenderer.cpp index 25ceecfab..752008826 100644 --- a/targets/minecraft/client/renderer/entity/LightningBoltRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/LightningBoltRenderer.cpp @@ -1,14 +1,13 @@ #include "LightningBoltRenderer.h" -#include "platform/stubs.h" #include -#include "platform/renderer/renderer.h" - #include "java/Random.h" #include "minecraft/client/renderer/Tesselator.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/global/LightningBolt.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" void LightningBoltRenderer::render(std::shared_ptr _bolt, double x, double y, double z, float rot, float a) { diff --git a/targets/minecraft/client/renderer/entity/LivingEntityRenderer.cpp b/targets/minecraft/client/renderer/entity/LivingEntityRenderer.cpp index e1eb72b02..e6fd1a2ff 100644 --- a/targets/minecraft/client/renderer/entity/LivingEntityRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/LivingEntityRenderer.cpp @@ -1,17 +1,14 @@ -#include "minecraft/IGameServices.h" -#include "platform/stubs.h" #include "LivingEntityRenderer.h" #include #include #include -#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" -#include "minecraft/GameEnums.h" - #include "java/Class.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Lighting.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Font.h" @@ -27,6 +24,8 @@ #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/entity/projectile/Arrow.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation LivingEntityRenderer::ENCHANT_GLINT_LOCATION = ResourceLocation(TN__BLUR__MISC_GLINT); @@ -67,7 +66,7 @@ void LivingEntityRenderer::render(std::shared_ptr _mob, double x, float bodyRot = rotlerp(mob->yBodyRotO, mob->yBodyRot, a); float headRot = rotlerp(mob->yHeadRotO, mob->yHeadRot, a); - if (mob->isRiding() && mob->riding->instanceof(eTYPE_LIVINGENTITY)) { + if (mob->isRiding() && mob->riding->instanceof (eTYPE_LIVINGENTITY)) { std::shared_ptr riding = std::dynamic_pointer_cast(mob->riding); bodyRot = rotlerp(riding->yBodyRotO, riding->yBodyRot, a); @@ -285,8 +284,9 @@ void LivingEntityRenderer::setupRotations(std::shared_ptr mob, } else { std::string name = mob->getAName(); if (name == "Dinnerbone" || name == "Grumm") { - if (!mob->instanceof(eTYPE_PLAYER) || - !std::dynamic_pointer_cast(mob)->isCapeHidden()) { + if (!mob->instanceof + (eTYPE_PLAYER) || + !std::dynamic_pointer_cast(mob)->isCapeHidden()) { glTranslatef(0, mob->bbHeight + 0.1f, 0); glRotatef(180, 0, 0, 1); } @@ -389,12 +389,14 @@ 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 (gameServices().getGameHostOption(eGameHostOption_Gamertags) == 0) { + if (gameServices().getGameHostOption( + eGameHostOption_Gamertags) == 0) { // turn off gamertags if the host has set them off return; } @@ -525,7 +527,7 @@ void LivingEntityRenderer::renderNameTag(std::shared_ptr mob, std::string playerName; char wchName[2]; - if (mob->instanceof(eTYPE_PLAYER)) { + if (mob->instanceof (eTYPE_PLAYER)) { std::shared_ptr player = std::dynamic_pointer_cast(mob); if (gameServices().isXuidDeadmau5(player->getXuid())) offs = -10; diff --git a/targets/minecraft/client/renderer/entity/MinecartRenderer.cpp b/targets/minecraft/client/renderer/entity/MinecartRenderer.cpp index 9951566b7..68fbb638f 100644 --- a/targets/minecraft/client/renderer/entity/MinecartRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/MinecartRenderer.cpp @@ -1,5 +1,4 @@ #include "MinecartRenderer.h" -#include "platform/stubs.h" #include #include @@ -7,7 +6,6 @@ #include #include -#include "platform/renderer/renderer.h" #include "minecraft/client/model/MinecartModel.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/client/renderer/Textures.h" @@ -17,6 +15,8 @@ #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/item/Minecart.h" #include "minecraft/world/phys/Vec3.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" class Tile; diff --git a/targets/minecraft/client/renderer/entity/MobRenderer.cpp b/targets/minecraft/client/renderer/entity/MobRenderer.cpp index 55fddd7c9..aabf17f07 100644 --- a/targets/minecraft/client/renderer/entity/MobRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/MobRenderer.cpp @@ -1,23 +1,22 @@ #include "MobRenderer.h" -#include "platform/stubs.h" #include #include -#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" #include "LivingEntityRenderer.h" -#include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" - #include "java/Class.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/renderer/Tesselator.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/util/Mth.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/Mob.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" class Model; @@ -55,7 +54,7 @@ void MobRenderer::renderLeash(std::shared_ptr entity, double x, double y, double rotOffCos = cos(roperYRot); double rotOffSin = sin(roperYRot); double yOff = sin(roperXRot); - if (roper->instanceof(eTYPE_HANGING_ENTITY)) { + if (roper->instanceof (eTYPE_HANGING_ENTITY)) { rotOffCos = 0; rotOffSin = 0; yOff = -1; diff --git a/targets/minecraft/client/renderer/entity/MushroomCowRenderer.cpp b/targets/minecraft/client/renderer/entity/MushroomCowRenderer.cpp index ea6674b29..90aed102e 100644 --- a/targets/minecraft/client/renderer/entity/MushroomCowRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/MushroomCowRenderer.cpp @@ -1,11 +1,7 @@ #include "MushroomCowRenderer.h" -#include "platform/stubs.h" #include - -#include "platform/renderer/renderer.h" - #include "minecraft/client/model/QuadrupedModel.h" #include "minecraft/client/model/geom/ModelPart.h" #include "minecraft/client/renderer/Textures.h" @@ -17,6 +13,8 @@ #include "minecraft/world/entity/animal/MushroomCow.h" #include "minecraft/world/level/tile/PlantTile.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" class Model; diff --git a/targets/minecraft/client/renderer/entity/OcelotRenderer.cpp b/targets/minecraft/client/renderer/entity/OcelotRenderer.cpp index 01f52f756..0043aba52 100644 --- a/targets/minecraft/client/renderer/entity/OcelotRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/OcelotRenderer.cpp @@ -1,15 +1,15 @@ #include "OcelotRenderer.h" -#include "platform/stubs.h" #include -#include "platform/renderer/renderer.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/renderer/entity/MobRenderer.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/animal/Ocelot.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" class Model; diff --git a/targets/minecraft/client/renderer/entity/PaintingRenderer.cpp b/targets/minecraft/client/renderer/entity/PaintingRenderer.cpp index 97f3da859..22a737c41 100644 --- a/targets/minecraft/client/renderer/entity/PaintingRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/PaintingRenderer.cpp @@ -1,12 +1,8 @@ #include "PaintingRenderer.h" -#include "platform/stubs.h" #include - -#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" - #include "java/Random.h" #include "minecraft/client/renderer/Tesselator.h" #include "minecraft/client/renderer/Textures.h" @@ -14,6 +10,8 @@ #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/Painting.h" #include "minecraft/world/level/Level.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation PaintingRenderer::PAINTING_LOCATION(TN_ART_KZ); diff --git a/targets/minecraft/client/renderer/entity/PlayerRenderer.cpp b/targets/minecraft/client/renderer/entity/PlayerRenderer.cpp index c2511c1f6..1d2ab8331 100644 --- a/targets/minecraft/client/renderer/entity/PlayerRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/PlayerRenderer.cpp @@ -1,18 +1,15 @@ -#include "minecraft/IGameServices.h" -#include "platform/stubs.h" #include "PlayerRenderer.h" #include #include #include - -#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" #include "HumanoidMobRenderer.h" -#include "minecraft/GameEnums.h" #include "java/Class.h" #include "minecraft/Facing.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/model/HumanoidModel.h" @@ -36,6 +33,8 @@ #include "minecraft/world/item/UseAnim.h" #include "minecraft/world/level/tile/Tile.h" #include "nbt/CompoundTag.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" const unsigned int PlayerRenderer::s_nametagColors[MINECRAFT_NET_MAX_PLAYERS] = { @@ -196,7 +195,7 @@ void PlayerRenderer::render(std::shared_ptr _mob, double x, double y, mob->isSneaking(); double yp = y - mob->heightOffset; - if (mob->isSneaking() && !mob->instanceof(eTYPE_LOCALPLAYER)) { + if (mob->isSneaking() && !mob->instanceof (eTYPE_LOCALPLAYER)) { yp -= 2 / 16.0f; } @@ -459,8 +458,7 @@ bool b2 = !mob->isCapeHidden();*/ void PlayerRenderer::renderNameTags(std::shared_ptr player, double x, double y, double z, - std::string msg, float scale, - double dist) { + std::string msg, float scale, double dist) { LivingEntityRenderer::renderNameTags(player, x, y, z, msg, scale, dist); } @@ -524,7 +522,8 @@ 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 (gameServices().getGameHostOption(eGameHostOption_HostCanBeInvisible) > 0) { + if (gameServices().getGameHostOption(eGameHostOption_HostCanBeInvisible) > + 0) { std::shared_ptr player = std::dynamic_pointer_cast(e); if (player != nullptr && player->hasInvisiblePrivilege()) return; } diff --git a/targets/minecraft/client/renderer/entity/PlayerRenderer.h b/targets/minecraft/client/renderer/entity/PlayerRenderer.h index 5feabe813..e2440f8cf 100644 --- a/targets/minecraft/client/renderer/entity/PlayerRenderer.h +++ b/targets/minecraft/client/renderer/entity/PlayerRenderer.h @@ -2,11 +2,11 @@ #include #include -#include "platform/NetTypes.h" -#include "minecraft/client/model/SkinBox.h" #include "MobRenderer.h" +#include "minecraft/client/model/SkinBox.h" #include "minecraft/client/renderer/entity/LivingEntityRenderer.h" #include "minecraft/world/entity/player/Player.h" +#include "platform/NetTypes.h" class HumanoidModel; class LivingEntity; diff --git a/targets/minecraft/client/renderer/entity/SheepRenderer.cpp b/targets/minecraft/client/renderer/entity/SheepRenderer.cpp index e9fdfff43..cab34494a 100644 --- a/targets/minecraft/client/renderer/entity/SheepRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/SheepRenderer.cpp @@ -1,10 +1,8 @@ #include "SheepRenderer.h" -#include "platform/stubs.h" #include #include -#include "platform/renderer/renderer.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" @@ -13,6 +11,8 @@ #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/animal/Sheep.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" class Model; diff --git a/targets/minecraft/client/renderer/entity/SkeletonRenderer.cpp b/targets/minecraft/client/renderer/entity/SkeletonRenderer.cpp index baf896c8a..b97c00e5e 100644 --- a/targets/minecraft/client/renderer/entity/SkeletonRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/SkeletonRenderer.cpp @@ -1,9 +1,7 @@ #include "SkeletonRenderer.h" -#include "platform/stubs.h" #include -#include "platform/renderer/renderer.h" #include "minecraft/client/model/SkeletonModel.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/renderer/entity/HumanoidMobRenderer.h" @@ -11,6 +9,8 @@ #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/monster/Skeleton.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation SkeletonRenderer::SKELETON_LOCATION = ResourceLocation(TN_MOB_SKELETON); diff --git a/targets/minecraft/client/renderer/entity/SlimeRenderer.cpp b/targets/minecraft/client/renderer/entity/SlimeRenderer.cpp index c4200ee7c..fcc79f1a7 100644 --- a/targets/minecraft/client/renderer/entity/SlimeRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/SlimeRenderer.cpp @@ -1,15 +1,14 @@ #include "SlimeRenderer.h" -#include "platform/stubs.h" #include -#include "platform/renderer/renderer.h" - #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/renderer/entity/MobRenderer.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/monster/Slime.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" class Model; diff --git a/targets/minecraft/client/renderer/entity/SnowManRenderer.cpp b/targets/minecraft/client/renderer/entity/SnowManRenderer.cpp index c0b6f7b8b..592633f8b 100644 --- a/targets/minecraft/client/renderer/entity/SnowManRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/SnowManRenderer.cpp @@ -1,9 +1,7 @@ #include "SnowManRenderer.h" -#include "platform/stubs.h" #include -#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" #include "minecraft/client/model/SnowManModel.h" #include "minecraft/client/model/geom/ModelPart.h" @@ -17,6 +15,8 @@ #include "minecraft/world/item/Item.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation SnowManRenderer::SNOWMAN_LOCATION = ResourceLocation(TN_MOB_SNOWMAN); diff --git a/targets/minecraft/client/renderer/entity/SpiderRenderer.cpp b/targets/minecraft/client/renderer/entity/SpiderRenderer.cpp index 711eb9541..08b3ad8db 100644 --- a/targets/minecraft/client/renderer/entity/SpiderRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/SpiderRenderer.cpp @@ -1,10 +1,7 @@ #include "SpiderRenderer.h" -#include "platform/stubs.h" #include -#include "platform/renderer/renderer.h" - #include "minecraft/SharedConstants.h" #include "minecraft/client/model/SpiderModel.h" #include "minecraft/client/renderer/Textures.h" @@ -12,6 +9,8 @@ #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/monster/Spider.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation SpiderRenderer::SPIDER_LOCATION = ResourceLocation(TN_MOB_SPIDER); diff --git a/targets/minecraft/client/renderer/entity/SquidRenderer.cpp b/targets/minecraft/client/renderer/entity/SquidRenderer.cpp index 538b29fd7..a7a671baf 100644 --- a/targets/minecraft/client/renderer/entity/SquidRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/SquidRenderer.cpp @@ -1,14 +1,14 @@ #include "SquidRenderer.h" -#include "platform/stubs.h" #include -#include "platform/renderer/renderer.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/renderer/entity/MobRenderer.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/animal/Squid.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" class Model; diff --git a/targets/minecraft/client/renderer/entity/TntMinecartRenderer.cpp b/targets/minecraft/client/renderer/entity/TntMinecartRenderer.cpp index 9f8a00b10..74fd6eecb 100644 --- a/targets/minecraft/client/renderer/entity/TntMinecartRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/TntMinecartRenderer.cpp @@ -1,15 +1,14 @@ #include "TntMinecartRenderer.h" -#include "platform/stubs.h" #include -#include "platform/renderer/renderer.h" - #include "minecraft/client/renderer/TileRenderer.h" #include "minecraft/client/renderer/entity/MinecartRenderer.h" #include "minecraft/world/entity/item/Minecart.h" #include "minecraft/world/entity/item/MinecartTNT.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" void TntMinecartRenderer::renderMinecartContents( std::shared_ptr _cart, float a, Tile* tile, int tileData) { diff --git a/targets/minecraft/client/renderer/entity/TntRenderer.cpp b/targets/minecraft/client/renderer/entity/TntRenderer.cpp index eb2670b64..8f031b27a 100644 --- a/targets/minecraft/client/renderer/entity/TntRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/TntRenderer.cpp @@ -1,16 +1,15 @@ #include "TntRenderer.h" -#include "platform/stubs.h" #include -#include "platform/renderer/renderer.h" - #include "minecraft/SharedConstants.h" #include "minecraft/client/renderer/TileRenderer.h" #include "minecraft/client/renderer/texture/TextureAtlas.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/item/PrimedTnt.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" TntRenderer::TntRenderer() { renderer = new TileRenderer(); diff --git a/targets/minecraft/client/renderer/entity/VillagerGolemRenderer.cpp b/targets/minecraft/client/renderer/entity/VillagerGolemRenderer.cpp index 586edb485..f5e88b431 100644 --- a/targets/minecraft/client/renderer/entity/VillagerGolemRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/VillagerGolemRenderer.cpp @@ -1,12 +1,9 @@ #include "VillagerGolemRenderer.h" -#include "platform/stubs.h" #include #include #include -#include "platform/renderer/renderer.h" - #include "minecraft/SharedConstants.h" #include "minecraft/client/model/VillagerGolemModel.h" #include "minecraft/client/model/geom/ModelPart.h" @@ -19,6 +16,8 @@ #include "minecraft/world/entity/animal/VillagerGolem.h" #include "minecraft/world/level/tile/PlantTile.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation VillagerGolemRenderer::GOLEM_LOCATION = ResourceLocation(TN_MOB_VILLAGER_GOLEM); diff --git a/targets/minecraft/client/renderer/entity/VillagerRenderer.cpp b/targets/minecraft/client/renderer/entity/VillagerRenderer.cpp index ac3d61965..84a0e4740 100644 --- a/targets/minecraft/client/renderer/entity/VillagerRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/VillagerRenderer.cpp @@ -1,9 +1,7 @@ #include "VillagerRenderer.h" -#include "platform/stubs.h" #include -#include "platform/renderer/renderer.h" #include "minecraft/client/model/VillagerModel.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/renderer/entity/MobRenderer.h" @@ -11,6 +9,8 @@ #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/npc/Villager.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation VillagerRenderer::VILLAGER_LOCATION = ResourceLocation(TN_MOB_VILLAGER_VILLAGER); diff --git a/targets/minecraft/client/renderer/entity/WitchRenderer.cpp b/targets/minecraft/client/renderer/entity/WitchRenderer.cpp index 7ad9705b7..f135b4785 100644 --- a/targets/minecraft/client/renderer/entity/WitchRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/WitchRenderer.cpp @@ -1,10 +1,8 @@ #include "WitchRenderer.h" -#include "platform/stubs.h" #include #include -#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/model/WitchModel.h" @@ -22,6 +20,8 @@ #include "minecraft/world/item/Item.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation WitchRenderer::WITCH_LOCATION = ResourceLocation(TN_MOB_WITCH); diff --git a/targets/minecraft/client/renderer/entity/WitherBossRenderer.cpp b/targets/minecraft/client/renderer/entity/WitherBossRenderer.cpp index eb5e3f172..89a98df5d 100644 --- a/targets/minecraft/client/renderer/entity/WitherBossRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/WitherBossRenderer.cpp @@ -1,13 +1,10 @@ #include "WitherBossRenderer.h" -#include "platform/stubs.h" #include #include -#include "platform/renderer/renderer.h" #include "MobRenderer.h" #include "SharedConstants.h" - #include "minecraft/client/model/WitherBossModel.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/client/renderer/BossMobGuiInfo.h" @@ -16,6 +13,8 @@ #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/boss/wither/WitherBoss.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation WitherBossRenderer::WITHER_ARMOR_LOCATION = ResourceLocation(TN_MOB_WITHER_ARMOR); diff --git a/targets/minecraft/client/renderer/entity/WitherSkullRenderer.cpp b/targets/minecraft/client/renderer/entity/WitherSkullRenderer.cpp index ba4c19fd0..f784f9a37 100644 --- a/targets/minecraft/client/renderer/entity/WitherSkullRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/WitherSkullRenderer.cpp @@ -1,15 +1,14 @@ #include "WitherSkullRenderer.h" -#include "platform/stubs.h" #include -#include "platform/renderer/renderer.h" - #include "minecraft/client/model/SkeletonHeadModel.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/projectile/WitherSkull.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation WitherSkullRenderer::WITHER_ARMOR_LOCATION( TN_MOB_WITHER_INVULNERABLE); diff --git a/targets/minecraft/client/renderer/entity/WolfRenderer.cpp b/targets/minecraft/client/renderer/entity/WolfRenderer.cpp index 7674d8a77..526958b3e 100644 --- a/targets/minecraft/client/renderer/entity/WolfRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/WolfRenderer.cpp @@ -1,9 +1,7 @@ #include "WolfRenderer.h" -#include "platform/stubs.h" #include -#include "platform/renderer/renderer.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" @@ -14,6 +12,8 @@ #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/animal/Sheep.h" #include "minecraft/world/entity/animal/Wolf.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" class Model; diff --git a/targets/minecraft/client/renderer/entity/ZombieRenderer.cpp b/targets/minecraft/client/renderer/entity/ZombieRenderer.cpp index b1bb89c51..25815c572 100644 --- a/targets/minecraft/client/renderer/entity/ZombieRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/ZombieRenderer.cpp @@ -68,7 +68,7 @@ ResourceLocation* ZombieRenderer::getTextureLocation( std::shared_ptr mob = std::dynamic_pointer_cast(entity); // TODO Extract this clusterfck into 3 renderers - if (entity->instanceof(eTYPE_PIGZOMBIE)) { + if (entity->instanceof (eTYPE_PIGZOMBIE)) { return &ZOMBIE_PIGMAN_LOCATION; } diff --git a/targets/minecraft/client/renderer/texture/PreStitchedTextureMap.cpp b/targets/minecraft/client/renderer/texture/PreStitchedTextureMap.cpp index e8706b262..fe8684843 100644 --- a/targets/minecraft/client/renderer/texture/PreStitchedTextureMap.cpp +++ b/targets/minecraft/client/renderer/texture/PreStitchedTextureMap.cpp @@ -1,14 +1,13 @@ -#include "minecraft/util/Log.h" #include "PreStitchedTextureMap.h" #include #include -#include "minecraft/client/BufferedImage.h" #include "SimpleIcon.h" #include "StitchedTexture.h" #include "Texture.h" #include "TextureManager.h" +#include "minecraft/client/BufferedImage.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/renderer/LevelRenderer.h" #include "minecraft/client/renderer/entity/EntityRenderDispatcher.h" @@ -16,6 +15,7 @@ #include "minecraft/client/renderer/texture/custom/CompassTexture.h" #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" +#include "minecraft/util/Log.h" #include "minecraft/world/Icon.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/level/tile/Tile.h" @@ -173,9 +173,8 @@ void PreStitchedTextureMap::makeTextureAnimated(TexturePack* texturePack, if (first->getWidth() != tex->getWidth() || first->getHeight() != tex->getHeight()) { Log::info("%s - first w - %d, h - %d, tex w - %d, h - %d\n", - textureFileName.c_str(), first->getWidth(), - tex->getWidth(), first->getHeight(), - tex->getHeight()); + textureFileName.c_str(), first->getWidth(), + tex->getWidth(), first->getHeight(), tex->getHeight()); assert(0); } #endif diff --git a/targets/minecraft/client/renderer/texture/StitchSlot.cpp b/targets/minecraft/client/renderer/texture/StitchSlot.cpp index da44be1fe..385bf4405 100644 --- a/targets/minecraft/client/renderer/texture/StitchSlot.cpp +++ b/targets/minecraft/client/renderer/texture/StitchSlot.cpp @@ -137,8 +137,9 @@ void StitchSlot::collectAssignments(std::vector* result) { //@Override std::string StitchSlot::toString() { - return "Slot{originX=" + toWString(originX) + ", originY=" + - toWString(originY) + ", width=" + toWString(width) + ", height=" + - toWString(height) + ", texture=" + toWString(textureHolder) + + return "Slot{originX=" + toWString(originX) + + ", originY=" + toWString(originY) + ", width=" + toWString(width) + + ", height=" + toWString(height) + + ", texture=" + toWString(textureHolder) + ", subSlots=" + toWString(subSlots) + '}'; } \ No newline at end of file diff --git a/targets/minecraft/client/renderer/texture/StitchedTexture.cpp b/targets/minecraft/client/renderer/texture/StitchedTexture.cpp index 5bd407020..c6858f3ed 100644 --- a/targets/minecraft/client/renderer/texture/StitchedTexture.cpp +++ b/targets/minecraft/client/renderer/texture/StitchedTexture.cpp @@ -4,11 +4,11 @@ #include "Texture.h" #include "TextureManager.h" -#include "util/StringHelpers.h" #include "java/InputOutputStream/BufferedReader.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/renderer/texture/custom/ClockTexture.h" #include "minecraft/client/renderer/texture/custom/CompassTexture.h" +#include "util/StringHelpers.h" StitchedTexture* StitchedTexture::create(const std::string& name) { // TODO: Generalize? diff --git a/targets/minecraft/client/renderer/texture/Stitcher.cpp b/targets/minecraft/client/renderer/texture/Stitcher.cpp index 514c2273b..8a309b338 100644 --- a/targets/minecraft/client/renderer/texture/Stitcher.cpp +++ b/targets/minecraft/client/renderer/texture/Stitcher.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "Stitcher.h" #include @@ -7,6 +6,7 @@ #include "Texture.h" #include "TextureHolder.h" #include "TextureManager.h" +#include "minecraft/util/Log.h" void Stitcher::_init(const std::string& name, int maxWidth, int maxHeight, bool forcePowerOfTwo, int forcedScale) { diff --git a/targets/minecraft/client/renderer/texture/Texture.cpp b/targets/minecraft/client/renderer/texture/Texture.cpp index a737fc71d..b1501ee40 100644 --- a/targets/minecraft/client/renderer/texture/Texture.cpp +++ b/targets/minecraft/client/renderer/texture/Texture.cpp @@ -1,5 +1,3 @@ -#include "minecraft/util/Log.h" -#include "platform/stubs.h" #include "Texture.h" #include @@ -7,12 +5,14 @@ #include #include -#include "platform/renderer/renderer.h" -#include "minecraft/client/BufferedImage.h" #include "TextureManager.h" #include "java/Buffer.h" #include "java/ByteBuffer.h" +#include "minecraft/client/BufferedImage.h" #include "minecraft/client/renderer/Rect2i.h" +#include "minecraft/util/Log.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" #define MAX_MIP_LEVELS 5 @@ -575,24 +575,25 @@ void Texture::updateOnGPU() { if (!m_bInitialised) { PlatformRenderer.TextureSetTextureLevels(m_iMipLevels); // 4J added - PlatformRenderer.TextureData(width, height, data[0]->getBuffer(), 0, - IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw); + PlatformRenderer.TextureData( + width, height, data[0]->getBuffer(), 0, + IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw); if (mipmapped) { for (int level = 1; level < m_iMipLevels; level++) { int levelWidth = width >> level; int levelHeight = height >> level; - PlatformRenderer.TextureData(levelWidth, levelHeight, - data[level]->getBuffer(), level, - IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw); + PlatformRenderer.TextureData( + levelWidth, levelHeight, data[level]->getBuffer(), level, + IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw); } } m_bInitialised = true; } else { PlatformRenderer.TextureDataUpdate(0, 0, width, height, - data[0]->getBuffer(), 0); + data[0]->getBuffer(), 0); if (mipmapped) { if (PlatformRenderer.TextureGetTextureLevels() > 1) { diff --git a/targets/minecraft/client/renderer/texture/Texture.h b/targets/minecraft/client/renderer/texture/Texture.h index 805b8213e..06bf6ad1c 100644 --- a/targets/minecraft/client/renderer/texture/Texture.h +++ b/targets/minecraft/client/renderer/texture/Texture.h @@ -1,12 +1,12 @@ #pragma once -#include "platform/renderer/renderer.h" -#include "platform/stubs.h" - #include #include #include +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" + class Rect2i; class ByteBuffer; class BufferedImage; @@ -69,8 +69,8 @@ public: ~Texture(); private: - Texture(const std::string& name, int mode, int width, int height, - int depth, int wrapMode, int format, int minFilter, int magFilter, + Texture(const std::string& name, int mode, int width, int height, int depth, + int wrapMode, int format, int minFilter, int magFilter, bool mipMap = true); void _init(const std::string& name, int mode, int width, int height, @@ -84,8 +84,8 @@ public: Texture(const std::string& name, int mode, int width, int height, int wrapMode, int format, int minFilter, int magFilter, BufferedImage* image, bool mipMap = true); - Texture(const std::string& name, int mode, int width, int height, - int depth, int wrapMode, int format, int minFilter, int magFilter, + Texture(const std::string& name, int mode, int width, int height, int depth, + int wrapMode, int format, int minFilter, int magFilter, BufferedImage* image, bool mipMap = true); const Rect2i* getRect(); diff --git a/targets/minecraft/client/renderer/texture/TextureHolder.cpp b/targets/minecraft/client/renderer/texture/TextureHolder.cpp index 413beb484..e90be0e37 100644 --- a/targets/minecraft/client/renderer/texture/TextureHolder.cpp +++ b/targets/minecraft/client/renderer/texture/TextureHolder.cpp @@ -49,8 +49,8 @@ void TextureHolder::setForcedScale(int targetSize) { //@Override std::string TextureHolder::toString() { - return "TextureHolder{width=" + toWString(width) + ", height=" + - toWString(height) + '}'; + return "TextureHolder{width=" + toWString(width) + + ", height=" + toWString(height) + '}'; } int TextureHolder::compareTo(const TextureHolder* other) const { diff --git a/targets/minecraft/client/renderer/texture/TextureManager.cpp b/targets/minecraft/client/renderer/texture/TextureManager.cpp index 8f12f48db..6db5a2c32 100644 --- a/targets/minecraft/client/renderer/texture/TextureManager.cpp +++ b/targets/minecraft/client/renderer/texture/TextureManager.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "TextureManager.h" #include @@ -6,13 +5,14 @@ #include #include -#include "minecraft/client/BufferedImage.h" #include "Stitcher.h" #include "Texture.h" #include "java/File.h" +#include "minecraft/client/BufferedImage.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" +#include "minecraft/util/Log.h" TextureManager* TextureManager::instance = nullptr; diff --git a/targets/minecraft/client/renderer/texture/TextureMap.cpp b/targets/minecraft/client/renderer/texture/TextureMap.cpp index 2856ca086..2aaec1b96 100644 --- a/targets/minecraft/client/renderer/texture/TextureMap.cpp +++ b/targets/minecraft/client/renderer/texture/TextureMap.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "TextureMap.h" #include @@ -6,7 +5,6 @@ #include #include -#include "minecraft/client/BufferedImage.h" #include "StitchSlot.h" #include "StitchedTexture.h" #include "Stitcher.h" @@ -16,11 +14,13 @@ #include "java/InputOutputStream/BufferedReader.h" #include "java/InputOutputStream/InputStream.h" #include "java/InputOutputStream/InputStreamReader.h" +#include "minecraft/client/BufferedImage.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/renderer/LevelRenderer.h" #include "minecraft/client/renderer/entity/EntityRenderDispatcher.h" #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" +#include "minecraft/util/Log.h" #include "minecraft/world/Icon.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/level/tile/Tile.h" @@ -157,7 +157,7 @@ void TextureMap::stitch() { // premade icon for " + textureName + " doing " + name); #ifndef _CONTENT_PACKAGE printf("Couldn't find premade icon for %s doing %s\n", - textureName.c_str(), name.c_str()); + textureName.c_str(), name.c_str()); #endif } } @@ -188,7 +188,7 @@ void TextureMap::stitch() { // for: " + animationDefinitionFile); #ifndef _CONTENT_PACKAGE printf("Found animation info for: %s\n", - animationDefinitionFile.c_str()); + animationDefinitionFile.c_str()); #endif InputStreamReader isr(fileStream); BufferedReader br(&isr); diff --git a/targets/minecraft/client/renderer/texture/custom/ClockTexture.cpp b/targets/minecraft/client/renderer/texture/custom/ClockTexture.cpp index dab61cdc0..6c4b0c872 100644 --- a/targets/minecraft/client/renderer/texture/custom/ClockTexture.cpp +++ b/targets/minecraft/client/renderer/texture/custom/ClockTexture.cpp @@ -4,7 +4,6 @@ #include #include -#include "platform/PlatformTypes.h" #include "java/JavaMath.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" @@ -12,6 +11,7 @@ #include "minecraft/client/renderer/texture/Texture.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/dimension/Dimension.h" +#include "platform/PlatformTypes.h" ClockTexture::ClockTexture() : StitchedTexture("clock", "clock") { rot = rota = 0.0; diff --git a/targets/minecraft/client/renderer/texture/custom/CompassTexture.cpp b/targets/minecraft/client/renderer/texture/custom/CompassTexture.cpp index 5abc49cab..29b3e1f41 100644 --- a/targets/minecraft/client/renderer/texture/custom/CompassTexture.cpp +++ b/targets/minecraft/client/renderer/texture/custom/CompassTexture.cpp @@ -7,7 +7,6 @@ #include #include -#include "platform/PlatformTypes.h" #include "java/JavaMath.h" #include "minecraft/Pos.h" #include "minecraft/client/Minecraft.h" @@ -16,6 +15,7 @@ #include "minecraft/client/renderer/texture/Texture.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/dimension/Dimension.h" +#include "platform/PlatformTypes.h" CompassTexture* CompassTexture::instance = nullptr; diff --git a/targets/minecraft/client/renderer/tileentity/BeaconRenderer.cpp b/targets/minecraft/client/renderer/tileentity/BeaconRenderer.cpp index ea4768447..bd8c0c78d 100644 --- a/targets/minecraft/client/renderer/tileentity/BeaconRenderer.cpp +++ b/targets/minecraft/client/renderer/tileentity/BeaconRenderer.cpp @@ -1,18 +1,17 @@ #include "BeaconRenderer.h" -#include "platform/stubs.h" #include #include #include -#include "platform/renderer/renderer.h" - #include "minecraft/client/renderer/Tesselator.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/tile/entity/BeaconTileEntity.h" #include "minecraft/world/level/tile/entity/TileEntity.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation BeaconRenderer::BEAM_LOCATION = ResourceLocation(TN_MISC_BEACON_BEAM); diff --git a/targets/minecraft/client/renderer/tileentity/ChestRenderer.cpp b/targets/minecraft/client/renderer/tileentity/ChestRenderer.cpp index 6c41fdb7f..3d433ecd3 100644 --- a/targets/minecraft/client/renderer/tileentity/ChestRenderer.cpp +++ b/targets/minecraft/client/renderer/tileentity/ChestRenderer.cpp @@ -1,11 +1,8 @@ #include "ChestRenderer.h" -#include "platform/stubs.h" #include #include -#include "platform/renderer/renderer.h" - #include "minecraft/client/model/ChestModel.h" #include "minecraft/client/model/LargeChestModel.h" #include "minecraft/client/model/geom/ModelPart.h" @@ -16,6 +13,8 @@ #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/level/tile/entity/ChestTileEntity.h" #include "minecraft/world/level/tile/entity/TileEntity.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation ChestRenderer::CHEST_LARGE_TRAP_LOCATION = ResourceLocation(TN_TILE_LARGE_TRAP_CHEST); diff --git a/targets/minecraft/client/renderer/tileentity/EnchantTableRenderer.cpp b/targets/minecraft/client/renderer/tileentity/EnchantTableRenderer.cpp index a71f327f2..687bb2d7e 100644 --- a/targets/minecraft/client/renderer/tileentity/EnchantTableRenderer.cpp +++ b/targets/minecraft/client/renderer/tileentity/EnchantTableRenderer.cpp @@ -1,18 +1,17 @@ #include "EnchantTableRenderer.h" -#include "platform/stubs.h" #include #include #include -#include "platform/renderer/renderer.h" - #include "minecraft/client/model/BookModel.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/util/Mth.h" #include "minecraft/world/level/tile/entity/EnchantmentTableTileEntity.h" #include "minecraft/world/level/tile/entity/TileEntity.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation EnchantTableRenderer::BOOK_LOCATION = ResourceLocation(TN_ITEM_BOOK); diff --git a/targets/minecraft/client/renderer/tileentity/EnderChestRenderer.cpp b/targets/minecraft/client/renderer/tileentity/EnderChestRenderer.cpp index 50d181e73..da1b16561 100644 --- a/targets/minecraft/client/renderer/tileentity/EnderChestRenderer.cpp +++ b/targets/minecraft/client/renderer/tileentity/EnderChestRenderer.cpp @@ -1,17 +1,16 @@ #include "EnderChestRenderer.h" -#include "platform/stubs.h" #include #include -#include "platform/renderer/renderer.h" - #include "minecraft/client/model/ChestModel.h" #include "minecraft/client/model/geom/ModelPart.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/level/tile/entity/EnderChestTileEntity.h" #include "minecraft/world/level/tile/entity/TileEntity.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation EnderChestRenderer::ENDER_CHEST_LOCATION = ResourceLocation(TN_TILE_ENDER_CHEST); diff --git a/targets/minecraft/client/renderer/tileentity/MobSpawnerRenderer.cpp b/targets/minecraft/client/renderer/tileentity/MobSpawnerRenderer.cpp index 012395f3c..bd12348c9 100644 --- a/targets/minecraft/client/renderer/tileentity/MobSpawnerRenderer.cpp +++ b/targets/minecraft/client/renderer/tileentity/MobSpawnerRenderer.cpp @@ -1,12 +1,12 @@ #include "MobSpawnerRenderer.h" -#include "platform/stubs.h" -#include "platform/renderer/renderer.h" #include "minecraft/client/renderer/entity/EntityRenderDispatcher.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/level/BaseMobSpawner.h" #include "minecraft/world/level/tile/entity/MobSpawnerTileEntity.h" #include "minecraft/world/level/tile/entity/TileEntity.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" void MobSpawnerRenderer::render(std::shared_ptr _spawner, double x, double y, double z, float a, bool setColor, diff --git a/targets/minecraft/client/renderer/tileentity/PistonPieceRenderer.cpp b/targets/minecraft/client/renderer/tileentity/PistonPieceRenderer.cpp index e71ba0cc5..f1f6b2cfb 100644 --- a/targets/minecraft/client/renderer/tileentity/PistonPieceRenderer.cpp +++ b/targets/minecraft/client/renderer/tileentity/PistonPieceRenderer.cpp @@ -1,10 +1,7 @@ #include "PistonPieceRenderer.h" -#include "platform/stubs.h" #include -#include "platform/renderer/renderer.h" - #include "minecraft/client/Lighting.h" #include "minecraft/client/renderer/Tesselator.h" #include "minecraft/client/renderer/Textures.h" @@ -17,6 +14,8 @@ #include "minecraft/world/level/tile/entity/TileEntity.h" #include "minecraft/world/level/tile/piston/PistonBaseTile.h" #include "minecraft/world/level/tile/piston/PistonExtensionTile.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation PistonPieceRenderer::SIGN_LOCATION = ResourceLocation(TN_ITEM_SIGN); diff --git a/targets/minecraft/client/renderer/tileentity/SignRenderer.cpp b/targets/minecraft/client/renderer/tileentity/SignRenderer.cpp index 8ca473de2..1748209c4 100644 --- a/targets/minecraft/client/renderer/tileentity/SignRenderer.cpp +++ b/targets/minecraft/client/renderer/tileentity/SignRenderer.cpp @@ -1,25 +1,24 @@ -#include "minecraft/IGameServices.h" -#include "platform/stubs.h" #include "SignRenderer.h" #include #include #include -#include "platform/renderer/renderer.h" #include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" -#include "platform/XboxStubs.h" - +#include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Font.h" #include "minecraft/client/model/SignModel.h" #include "minecraft/client/model/geom/ModelPart.h" #include "minecraft/client/renderer/Textures.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/level/tile/entity/SignTileEntity.h" #include "minecraft/world/level/tile/entity/TileEntity.h" +#include "platform/XboxStubs.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" #include "strings.h" ResourceLocation SignRenderer::SIGN_LOCATION = ResourceLocation(TN_ITEM_SIGN); @@ -90,7 +89,8 @@ void SignRenderer::render(std::shared_ptr _sign, double x, double y, msg = "Censored"; // In-game font, so English only break; default: - msg = gameServices().getString(IDS_STRINGVERIFY_CENSORED); + msg = + gameServices().getString(IDS_STRINGVERIFY_CENSORED); break; } } else { @@ -101,11 +101,11 @@ void SignRenderer::render(std::shared_ptr _sign, double x, double y, case XC_LANGUAGE_KOREAN: case XC_LANGUAGE_JAPANESE: case XC_LANGUAGE_TCHINESE: - msg = - "Awaiting Approval"; // In-game font, so English only + msg = "Awaiting Approval"; // In-game font, so English only break; default: - msg = gameServices().getString(IDS_STRINGVERIFY_AWAITING_APPROVAL); + msg = gameServices().getString( + IDS_STRINGVERIFY_AWAITING_APPROVAL); break; } } diff --git a/targets/minecraft/client/renderer/tileentity/SkullTileRenderer.cpp b/targets/minecraft/client/renderer/tileentity/SkullTileRenderer.cpp index a392ce06b..f04a12f4c 100644 --- a/targets/minecraft/client/renderer/tileentity/SkullTileRenderer.cpp +++ b/targets/minecraft/client/renderer/tileentity/SkullTileRenderer.cpp @@ -1,10 +1,7 @@ #include "SkullTileRenderer.h" -#include "platform/stubs.h" #include -#include "platform/renderer/renderer.h" - #include "minecraft/Facing.h" #include "minecraft/client/model/SkeletonHeadModel.h" #include "minecraft/client/model/geom/Model.h" @@ -15,6 +12,8 @@ #include "minecraft/world/level/tile/SkullTile.h" #include "minecraft/world/level/tile/entity/SkullTileEntity.h" #include "minecraft/world/level/tile/entity/TileEntity.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" SkullTileRenderer* SkullTileRenderer::instance = nullptr; @@ -83,9 +82,7 @@ void SkullTileRenderer::renderSkull(float x, float y, float z, int face, // bindTexture(url, "/mob/char.png"); //} // else - { - bindTexture(&PlayerRenderer::DEFAULT_LOCATION); - } + { bindTexture(&PlayerRenderer::DEFAULT_LOCATION); } break; case SkullTileEntity::TYPE_CREEPER: bindTexture(&CREEPER_LOCATION); diff --git a/targets/minecraft/client/renderer/tileentity/TheEndPortalRenderer.cpp b/targets/minecraft/client/renderer/tileentity/TheEndPortalRenderer.cpp index d921be722..dbbb5dcf8 100644 --- a/targets/minecraft/client/renderer/tileentity/TheEndPortalRenderer.cpp +++ b/targets/minecraft/client/renderer/tileentity/TheEndPortalRenderer.cpp @@ -1,11 +1,8 @@ #include "TheEndPortalRenderer.h" -#include "platform/stubs.h" #include -#include "platform/renderer/renderer.h" #include "TileEntityRenderDispatcher.h" - #include "java/FloatBuffer.h" #include "java/Random.h" #include "java/System.h" @@ -16,6 +13,8 @@ #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/level/tile/entity/TheEndPortalTileEntity.h" #include "minecraft/world/level/tile/entity/TileEntity.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation TheEndPortalRenderer::END_SKY_LOCATION = ResourceLocation(TN_MISC_TUNNEL); diff --git a/targets/minecraft/client/renderer/tileentity/TileEntityRenderDispatcher.cpp b/targets/minecraft/client/renderer/tileentity/TileEntityRenderDispatcher.cpp index 76d00ae63..2d91599cc 100644 --- a/targets/minecraft/client/renderer/tileentity/TileEntityRenderDispatcher.cpp +++ b/targets/minecraft/client/renderer/tileentity/TileEntityRenderDispatcher.cpp @@ -1,9 +1,7 @@ #include "TileEntityRenderDispatcher.h" -#include "platform/stubs.h" #include -#include "platform/renderer/renderer.h" #include "BeaconRenderer.h" #include "ChestRenderer.h" #include "EnchantTableRenderer.h" @@ -14,11 +12,12 @@ #include "SkullTileRenderer.h" #include "TheEndPortalRenderer.h" #include "TileEntityRenderer.h" - #include "minecraft/SharedConstants.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/tile/entity/TileEntity.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" class Font; class Textures; diff --git a/targets/minecraft/client/resources/Colours/ColourTable.cpp b/targets/minecraft/client/resources/Colours/ColourTable.cpp index 0db6b345f..e01b360d9 100644 --- a/targets/minecraft/client/resources/Colours/ColourTable.cpp +++ b/targets/minecraft/client/resources/Colours/ColourTable.cpp @@ -4,13 +4,12 @@ #include #include -#include "minecraft/GameEnums.h" -#include "util/StringHelpers.h" #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/DataInputStream.h" +#include "minecraft/GameEnums.h" +#include "util/StringHelpers.h" -std::unordered_map - ColourTable::s_colourNamesMap; +std::unordered_map ColourTable::s_colourNamesMap; const char* ColourTable::ColourTableElements[eMinecraftColour_COUNT] = { "NOTSET", diff --git a/targets/minecraft/client/skins/AbstractTexturePack.cpp b/targets/minecraft/client/skins/AbstractTexturePack.cpp index b95dee1f0..cf5e77f24 100644 --- a/targets/minecraft/client/skins/AbstractTexturePack.cpp +++ b/targets/minecraft/client/skins/AbstractTexturePack.cpp @@ -1,25 +1,24 @@ -#include "minecraft/util/Log.h" -#include "platform/stubs.h" #include "AbstractTexturePack.h" - -#include #include +#include #include -#include "minecraft/client/resources/Colours/ColourTable.h" -#include "minecraft/IGameServices.h" #include "app/linux/Linux_UIController.h" -#include "minecraft/client/BufferedImage.h" -#include "util/StringHelpers.h" #include "java/File.h" #include "java/InputOutputStream/BufferedReader.h" #include "java/InputOutputStream/FileInputStream.h" #include "java/InputOutputStream/InputStream.h" #include "java/InputOutputStream/InputStreamReader.h" +#include "minecraft/IGameServices.h" +#include "minecraft/client/BufferedImage.h" #include "minecraft/client/renderer/Textures.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/client/skins/TexturePack.h" +#include "minecraft/util/Log.h" +#include "platform/stubs.h" +#include "util/StringHelpers.h" AbstractTexturePack::AbstractTexturePack(std::uint32_t id, File* file, const std::string& name, @@ -98,8 +97,7 @@ void AbstractTexturePack::load(Textures* textures) { } } -bool AbstractTexturePack::hasFile(const std::string& name, - bool allowFallback) { +bool AbstractTexturePack::hasFile(const std::string& name, bool allowFallback) { bool hasFile = this->hasFile(name); return !hasFile && (allowFallback && fallback != nullptr) @@ -139,7 +137,7 @@ std::string AbstractTexturePack::getAnimationString( // " + animationDefinitionFile); #if !defined(_CONTENT_PACKAGE) Log::info("Found animation info for: %s\n", - animationDefinitionFile.c_str()); + animationDefinitionFile.c_str()); #endif InputStreamReader isr(fileStream); BufferedReader br(&isr); @@ -165,7 +163,7 @@ BufferedImage* AbstractTexturePack::getImageResource( std::string pchTexture = File; std::string pchDrive = drive; Log::info("AbstractTexturePack::getImageResource - %s, drive is %s\n", - pchTexture.c_str(), pchDrive.c_str()); + pchTexture.c_str(), pchDrive.c_str()); return new BufferedImage(TexturePack::getResource("/" + File), filenameHasExtension, bTitleUpdateTexture, drive); @@ -216,7 +214,7 @@ void AbstractTexturePack::unloadUI() { std::string AbstractTexturePack::getXuiRootPath() { // const uintptr_t c_ModuleHandle = (uintptr_t)GetModuleHandle(nullptr); - const uintptr_t c_ModuleHandle = 0; // 4jcraft changed + const uintptr_t c_ModuleHandle = 0; // 4jcraft changed // Load new skin constexpr int LOCATOR_SIZE = diff --git a/targets/minecraft/client/skins/AbstractTexturePack.h b/targets/minecraft/client/skins/AbstractTexturePack.h index 33bf00a3f..9982b62e4 100644 --- a/targets/minecraft/client/skins/AbstractTexturePack.h +++ b/targets/minecraft/client/skins/AbstractTexturePack.h @@ -75,12 +75,12 @@ public: virtual std::string getWorldName(); virtual std::string getAnimationString(const std::string& textureName, - const std::string& path, - bool allowFallback); + const std::string& path, + bool allowFallback); protected: virtual std::string getAnimationString(const std::string& textureName, - const std::string& path); + const std::string& path); void loadDefaultUI(); void loadDefaultColourTable(); void loadDefaultHTMLColourTable(); diff --git a/targets/minecraft/client/skins/DLCTexturePack.cpp b/targets/minecraft/client/skins/DLCTexturePack.cpp index cee737ec6..bf187631a 100644 --- a/targets/minecraft/client/skins/DLCTexturePack.cpp +++ b/targets/minecraft/client/skins/DLCTexturePack.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "DLCTexturePack.h" #include @@ -8,11 +6,7 @@ #include #include -#include "platform/input/input.h" -#include "platform/storage/storage.h" -#include "minecraft/GameEnums.h" #include "app/common/Audio/SoundEngine.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "app/common/DLC/DLCAudioFile.h" #include "app/common/DLC/DLCColourTableFile.h" #include "app/common/DLC/DLCFile.h" @@ -23,16 +17,22 @@ #include "app/common/DLC/DLCTextureFile.h" #include "app/common/DLC/DLCUIDataFile.h" #include "app/common/GameRules/GameRuleManager.h" -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" -#include "minecraft/locale/StringTable.h" #include "app/common/UI/All Platforms/ArchiveFile.h" #include "app/linux/Linux_UIController.h" -#include "minecraft/client/BufferedImage.h" -#include "platform/fs/fs.h" #include "java/File.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" +#include "minecraft/client/BufferedImage.h" #include "minecraft/client/Minecraft.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/client/skins/AbstractTexturePack.h" #include "minecraft/client/skins/TexturePack.h" +#include "minecraft/locale/StringTable.h" +#include "minecraft/util/Log.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" +#include "platform/fs/fs.h" +#include "platform/input/input.h" +#include "platform/storage/storage.h" #if defined(_WINDOWS64) #include "app/windows/XML/ATGXmlParser.h" @@ -176,12 +176,12 @@ bool DLCTexturePack::hasFile(const std::string& name) { bool DLCTexturePack::isTerrainUpdateCompatible() { return true; } std::string DLCTexturePack::getPath(bool bTitleUpdateTexture /*= false*/, - const char* pchBDPatchFilename) { + const char* pchBDPatchFilename) { return ""; } std::string DLCTexturePack::getAnimationString(const std::string& textureName, - const std::string& path) { + const std::string& path) { std::string result = ""; std::string fullpath = "res/" + path + textureName + ".png"; @@ -248,24 +248,24 @@ void DLCTexturePack::loadData() { if (gameServices().getLevelGenerationOptions()) gameServices().getLevelGenerationOptions()->setLoadedData(); Log::info("Failed to mount texture pack DLC %d for pad %d\n", - mountIndex, PlatformInput.GetPrimaryPad()); + mountIndex, PlatformInput.GetPrimaryPad()); } else { m_bLoadingData = true; Log::info("Attempted to mount DLC data for texture pack %d\n", - mountIndex); + mountIndex); } } else { m_bHasLoadedData = true; if (gameServices().getLevelGenerationOptions()) gameServices().getLevelGenerationOptions()->setLoadedData(); gameServices().setAction(PlatformInput.GetPrimaryPad(), - eAppAction_ReloadTexturePack); + eAppAction_ReloadTexturePack); } } std::string DLCTexturePack::getFilePath(std::uint32_t packId, - std::string filename, - bool bAddDataFolder) { + std::string filename, + bool bAddDataFolder) { return gameServices().getFilePath(packId, filename, bAddDataFolder); } @@ -277,8 +277,7 @@ int DLCTexturePack::onPackMounted(int iPad, std::uint32_t dwErr, // corrupt DLC Log::info("Failed to mount DLC for pad %d: %u\n", iPad, dwErr); } else { - Log::info( - "Mounted DLC for texture pack, attempting to load data\n"); + Log::info("Mounted DLC for texture pack, attempting to load data\n"); texturePack->m_dlcDataPack = new DLCPack(texturePack->m_dlcInfoPack->getName(), dwLicenceMask); texturePack->setHasAudio(false); @@ -403,7 +402,8 @@ int DLCTexturePack::onPackMounted(int iPad, std::uint32_t dwErr, texturePack->m_bHasLoadedData = true; if (gameServices().getLevelGenerationOptions()) gameServices().getLevelGenerationOptions()->setLoadedData(); - gameServices().setAction(PlatformInput.GetPrimaryPad(), eAppAction_ReloadTexturePack); + gameServices().setAction(PlatformInput.GetPrimaryPad(), + eAppAction_ReloadTexturePack); return 0; } diff --git a/targets/minecraft/client/skins/DLCTexturePack.h b/targets/minecraft/client/skins/DLCTexturePack.h index a7d8c067b..4c2d860d9 100644 --- a/targets/minecraft/client/skins/DLCTexturePack.h +++ b/targets/minecraft/client/skins/DLCTexturePack.h @@ -3,9 +3,9 @@ #include #include -#include "platform/PlatformTypes.h" #include "AbstractTexturePack.h" #include "minecraft/locale/StringTable.h" +#include "platform/PlatformTypes.h" class DLCPack; class StringTable; @@ -27,7 +27,7 @@ public: using AbstractTexturePack::getResource; DLCTexturePack(std::uint32_t id, DLCPack* pack, TexturePack* fallback); - ~DLCTexturePack() {}; + ~DLCTexturePack(){}; virtual std::string getResource(const std::string& name); virtual DLCPack* getDLCPack(); @@ -58,9 +58,9 @@ public: // 4J Added virtual std::string getPath(bool bTitleUpdateTexture = false, - const char* pchBDPatchFilename = nullptr); + const char* pchBDPatchFilename = nullptr); virtual std::string getAnimationString(const std::string& textureName, - const std::string& path); + const std::string& path); virtual BufferedImage* getImageResource(const std::string& File, bool filenameHasExtension = false, bool bTitleUpdateTexture = false, @@ -71,9 +71,9 @@ public: private: static std::string getRootPath(std::uint32_t packId, bool allowOverride, - bool bAddDataFolder); + bool bAddDataFolder); static std::string getFilePath(std::uint32_t packId, std::string filename, - bool bAddDataFolder = true); + bool bAddDataFolder = true); public: int onPackMounted(int iPad, std::uint32_t dwErr, diff --git a/targets/minecraft/client/skins/DefaultTexturePack.cpp b/targets/minecraft/client/skins/DefaultTexturePack.cpp index 7a344dcae..908018170 100644 --- a/targets/minecraft/client/skins/DefaultTexturePack.cpp +++ b/targets/minecraft/client/skins/DefaultTexturePack.cpp @@ -1,11 +1,10 @@ -#include "minecraft/IGameServices.h" - #include "DefaultTexturePack.h" #include #include #include "java/InputOutputStream/InputStream.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/skins/AbstractTexturePack.h" DefaultTexturePack::DefaultTexturePack() diff --git a/targets/minecraft/client/skins/DefaultTexturePack.h b/targets/minecraft/client/skins/DefaultTexturePack.h index 085b1d4ed..600b4fd34 100644 --- a/targets/minecraft/client/skins/DefaultTexturePack.h +++ b/targets/minecraft/client/skins/DefaultTexturePack.h @@ -22,7 +22,9 @@ public: bool hasFile(const std::string& name); bool isTerrainUpdateCompatible(); - std::string getDesc1() { return gameServices().getString(IDS_DEFAULT_TEXTUREPACK); } + std::string getDesc1() { + return gameServices().getString(IDS_DEFAULT_TEXTUREPACK); + } protected: //@Override diff --git a/targets/minecraft/client/skins/FolderTexturePack.cpp b/targets/minecraft/client/skins/FolderTexturePack.cpp index aa62fd4bc..06718f5a5 100644 --- a/targets/minecraft/client/skins/FolderTexturePack.cpp +++ b/targets/minecraft/client/skins/FolderTexturePack.cpp @@ -44,7 +44,7 @@ bool FolderTexturePack::hasFile(const std::string& name) { bool FolderTexturePack::isTerrainUpdateCompatible() { return true; } std::string FolderTexturePack::getPath(bool bTitleUpdateTexture /*= false*/, - const char* pchBDPatchFilename) { + const char* pchBDPatchFilename) { std::string wDrive; wDrive = "Common\\" + file->getPath() + "\\"; return wDrive; diff --git a/targets/minecraft/client/skins/FolderTexturePack.h b/targets/minecraft/client/skins/FolderTexturePack.h index 637ef54d8..c6e1715b8 100644 --- a/targets/minecraft/client/skins/FolderTexturePack.h +++ b/targets/minecraft/client/skins/FolderTexturePack.h @@ -28,7 +28,7 @@ public: // 4J Added virtual std::string getPath(bool bTitleUpdateTexture = false, - const char* pchBDPatchFilename = nullptr); + const char* pchBDPatchFilename = nullptr); virtual void loadUI(); virtual void unloadUI(); }; \ No newline at end of file diff --git a/targets/minecraft/client/skins/TexturePack.cpp b/targets/minecraft/client/skins/TexturePack.cpp index c323e5fb2..2c0f38a2f 100644 --- a/targets/minecraft/client/skins/TexturePack.cpp +++ b/targets/minecraft/client/skins/TexturePack.cpp @@ -1,8 +1,7 @@ #include "TexturePack.h" -std::string TexturePack::getPath( - bool bTitleUpdateTexture /*= false*/, - const char* pchBDPatchFileName /*= nullptr*/) { +std::string TexturePack::getPath(bool bTitleUpdateTexture /*= false*/, + const char* pchBDPatchFileName /*= nullptr*/) { std::string wDrive; if (bTitleUpdateTexture) { diff --git a/targets/minecraft/client/skins/TexturePack.h b/targets/minecraft/client/skins/TexturePack.h index 53727ff40..a959b0558 100644 --- a/targets/minecraft/client/skins/TexturePack.h +++ b/targets/minecraft/client/skins/TexturePack.h @@ -38,7 +38,7 @@ public: virtual std::string getResource( const std::string& name) // 4J - changed to just return a name rather - // than an input stream + // than an input stream { /* 4J - TODO return TexturePack.class.getResourceAsStream(name); @@ -49,13 +49,14 @@ return TexturePack.class.getResourceAsStream(name); // 4J Added virtual std::string getPath(bool bTitleUpdateTexture = false, - const char* pchBDPatchFilename = nullptr); + const char* pchBDPatchFilename = nullptr); virtual std::string getAnimationString(const std::string& textureName, - const std::string& path, - bool allowFallback) = 0; - virtual BufferedImage* getImageResource( - const std::string& File, bool filenameHasExtension = false, - bool bTitleUpdateTexture = false, const std::string& drive = "") = 0; + const std::string& path, + bool allowFallback) = 0; + virtual BufferedImage* getImageResource(const std::string& File, + bool filenameHasExtension = false, + bool bTitleUpdateTexture = false, + const std::string& drive = "") = 0; virtual void loadColourTable() = 0; virtual void loadUI() = 0; virtual void unloadUI() = 0; diff --git a/targets/minecraft/client/skins/TexturePackRepository.cpp b/targets/minecraft/client/skins/TexturePackRepository.cpp index 37ad9b795..bfb56647e 100644 --- a/targets/minecraft/client/skins/TexturePackRepository.cpp +++ b/targets/minecraft/client/skins/TexturePackRepository.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "TexturePackRepository.h" #include @@ -7,17 +5,19 @@ #include #include -#include "platform/input/input.h" #include "DLCTexturePack.h" #include "DefaultTexturePack.h" -#include "minecraft/GameEnums.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" #include "app/linux/Linux_UIController.h" #include "java/File.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Minimap.h" #include "minecraft/client/skins/TexturePack.h" +#include "minecraft/util/Log.h" +#include "platform/input/input.h" TexturePack* TexturePackRepository::DEFAULT_TEXTURE_PACK = nullptr; @@ -63,14 +63,11 @@ bool TexturePackRepository::selectSkin(TexturePack* skin) { } void TexturePackRepository::selectWebSkin(const std::string& url) { - Log::info( - "TexturePackRepository::selectWebSkin is not implemented\n"); + Log::info("TexturePackRepository::selectWebSkin is not implemented\n"); } -void TexturePackRepository::downloadWebSkin(const std::string& url, - File file) { - Log::info( - "TexturePackRepository::selectWebSkin is not implemented\n"); +void TexturePackRepository::downloadWebSkin(const std::string& url, File file) { + Log::info("TexturePackRepository::selectWebSkin is not implemented\n"); } bool TexturePackRepository::isUsingWebSkin() { return usingWeb; } @@ -92,8 +89,7 @@ std::string TexturePackRepository::getIdOrNull(File file) { } std::vector TexturePackRepository::getWorkDirContents() { - Log::info( - "TexturePackRepository::getWorkDirContents is not implemented\n"); + Log::info("TexturePackRepository::getWorkDirContents is not implemented\n"); return std::vector(); } @@ -116,8 +112,7 @@ bool TexturePackRepository::shouldPromptForWebSkin() { } bool TexturePackRepository::canUseWebSkin() { - Log::info( - "TexturePackRepository::canUseWebSkin is not implemented\n"); + Log::info("TexturePackRepository::canUseWebSkin is not implemented\n"); return false; } @@ -151,7 +146,7 @@ bool TexturePackRepository::selectTexturePackById(std::uint32_t id) { if (newPack->hasData()) { gameServices().setAction(PlatformInput.GetPrimaryPad(), - eAppAction_ReloadTexturePack); + eAppAction_ReloadTexturePack); } else { newPack->loadData(); } @@ -162,12 +157,12 @@ bool TexturePackRepository::selectTexturePackById(std::uint32_t id) { } bDidSelect = true; } else { - Log::info( - "Failed to select texture pack %d as it is not in the list\n", id); + Log::info("Failed to select texture pack %d as it is not in the list\n", + id); // Fail safely if (selectSkin(DEFAULT_TEXTURE_PACK)) { gameServices().setAction(PlatformInput.GetPrimaryPad(), - eAppAction_ReloadTexturePack); + eAppAction_ReloadTexturePack); } } return bDidSelect; @@ -199,10 +194,10 @@ TexturePack* TexturePackRepository::addTexturePackFromDLC(DLCPack* dlcPack, #if !defined(_CONTENT_PACKAGE) if (dlcPack->hasPurchasedFile(DLCManager::e_DLCType_TexturePack, "")) { printf("Added new FULL DLCTexturePack: %s - id=%u\n", - dlcPack->getName().c_str(), parentId); + dlcPack->getName().c_str(), parentId); } else { printf("Added new TRIAL DLCTexturePack: %s - id=%u\n", - dlcPack->getName().c_str(), parentId); + dlcPack->getName().c_str(), parentId); } #endif } diff --git a/targets/minecraft/client/title/TitleScreen.cpp b/targets/minecraft/client/title/TitleScreen.cpp index a7d547b22..43ca00fb9 100644 --- a/targets/minecraft/client/title/TitleScreen.cpp +++ b/targets/minecraft/client/title/TitleScreen.cpp @@ -1,6 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "platform/stubs.h" -#include "minecraft/util/Log.h" #include "TitleScreen.h" #include @@ -11,13 +8,12 @@ #include #include -#include "platform/renderer/renderer.h" -#include "minecraft/client/BufferedImage.h" -#include "util/StringHelpers.h" #include "java/InputOutputStream/BufferedReader.h" #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/InputStreamReader.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" +#include "minecraft/client/BufferedImage.h" #include "minecraft/client/ClientConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Button.h" @@ -29,6 +25,10 @@ #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/locale/Language.h" +#include "minecraft/util/Log.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" +#include "util/StringHelpers.h" Random* TitleScreen::random = new Random(); @@ -46,7 +46,8 @@ TitleScreen::TitleScreen() { std::string filename = "splashes.txt"; if (gameServices().hasArchiveFile(filename)) { - std::vector splashesArray = gameServices().getArchiveFile(filename); + std::vector splashesArray = + gameServices().getArchiveFile(filename); ByteArrayInputStream bais(splashesArray); InputStreamReader isr(&bais); BufferedReader br(&isr); @@ -122,9 +123,9 @@ if (c.get(Calendar.MONTH) + 1 == 11 && c.get(Calendar.DAY_OF_MONTH) == 9) { buttons.push_back(new Button(1, width / 2 - 100, topPos, language->getElement("menu.singleplayer"))); - buttons.push_back(multiplayerButton = new Button( - 2, width / 2 - 100, topPos + spacing * 1, - language->getElement("menu.multiplayer"))); + buttons.push_back(multiplayerButton = + new Button(2, width / 2 - 100, topPos + spacing * 1, + language->getElement("menu.multiplayer"))); buttons.push_back(new Button(3, width / 2 - 100, topPos + spacing * 2, language->getElement("menu.mods"))); diff --git a/targets/minecraft/commands/AdminLogCommand.h b/targets/minecraft/commands/AdminLogCommand.h index a20713570..3a36b2e75 100644 --- a/targets/minecraft/commands/AdminLogCommand.h +++ b/targets/minecraft/commands/AdminLogCommand.h @@ -8,9 +8,10 @@ class AdminLogCommand { public: static const int LOGTYPE_DONT_SHOW_TO_SELF = 1; - virtual void logAdminCommand( - std::shared_ptr source, int type, - ChatPacket::EChatPacketMessage messageType, - const std::string& message = "", int customData = -1, - const std::string& additionalMessage = "") = 0; + virtual void logAdminCommand(std::shared_ptr source, + int type, + ChatPacket::EChatPacketMessage messageType, + const std::string& message = "", + int customData = -1, + const std::string& additionalMessage = "") = 0; }; \ No newline at end of file diff --git a/targets/minecraft/commands/Command.h b/targets/minecraft/commands/Command.h index ae308e167..b82fb83f4 100644 --- a/targets/minecraft/commands/Command.h +++ b/targets/minecraft/commands/Command.h @@ -9,9 +9,9 @@ #include #include -#include "platform/PlatformTypes.h" #include "CommandsEnum.h" #include "minecraft/network/packet/ChatPacket.h" +#include "platform/PlatformTypes.h" class AdminLogCommand; class CommandSender; diff --git a/targets/minecraft/commands/CommandDispatcher.cpp b/targets/minecraft/commands/CommandDispatcher.cpp index 3fd03819e..cd6bd826e 100644 --- a/targets/minecraft/commands/CommandDispatcher.cpp +++ b/targets/minecraft/commands/CommandDispatcher.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "CommandDispatcher.h" #include @@ -7,6 +6,7 @@ #include "minecraft/commands/Command.h" #include "minecraft/commands/CommandSender.h" #include "minecraft/commands/CommandsEnum.h" +#include "minecraft/util/Log.h" int CommandDispatcher::performCommand(std::shared_ptr sender, EGameCommand command, diff --git a/targets/minecraft/commands/common/EnchantItemCommand.cpp b/targets/minecraft/commands/common/EnchantItemCommand.cpp index dee0c25d3..09b7f19e3 100644 --- a/targets/minecraft/commands/common/EnchantItemCommand.cpp +++ b/targets/minecraft/commands/common/EnchantItemCommand.cpp @@ -3,7 +3,6 @@ #include #include -#include "platform/PlatformTypes.h" #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/ByteArrayOutputStream.h" #include "java/InputOutputStream/DataInputStream.h" @@ -17,6 +16,7 @@ #include "minecraft/world/item/enchantment/Enchantment.h" #include "nbt/CompoundTag.h" #include "nbt/ListTag.h" +#include "platform/PlatformTypes.h" EGameCommand EnchantItemCommand::getId() { return eGameCommand_EnchantItem; } diff --git a/targets/minecraft/commands/common/GiveItemCommand.cpp b/targets/minecraft/commands/common/GiveItemCommand.cpp index bf3165ff2..b62f300d4 100644 --- a/targets/minecraft/commands/common/GiveItemCommand.cpp +++ b/targets/minecraft/commands/common/GiveItemCommand.cpp @@ -2,7 +2,6 @@ #include -#include "platform/PlatformTypes.h" #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/ByteArrayOutputStream.h" #include "java/InputOutputStream/DataInputStream.h" @@ -15,6 +14,7 @@ #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/item/ItemInstance.h" +#include "platform/PlatformTypes.h" EGameCommand GiveItemCommand::getId() { return eGameCommand_Give; } diff --git a/targets/minecraft/core/DefaultDispenseItemBehavior.h b/targets/minecraft/core/DefaultDispenseItemBehavior.h index 65e221dda..76296aba2 100644 --- a/targets/minecraft/core/DefaultDispenseItemBehavior.h +++ b/targets/minecraft/core/DefaultDispenseItemBehavior.h @@ -23,8 +23,8 @@ protected: }; public: - DefaultDispenseItemBehavior() {}; - virtual ~DefaultDispenseItemBehavior() {}; + DefaultDispenseItemBehavior(){}; + virtual ~DefaultDispenseItemBehavior(){}; virtual std::shared_ptr dispense( BlockSource* source, std::shared_ptr dispensed); diff --git a/targets/minecraft/core/ItemDispenseBehaviors.cpp b/targets/minecraft/core/ItemDispenseBehaviors.cpp index 8939f5437..ef22049e6 100644 --- a/targets/minecraft/core/ItemDispenseBehaviors.cpp +++ b/targets/minecraft/core/ItemDispenseBehaviors.cpp @@ -1,12 +1,12 @@ -#include "minecraft/IGameServices.h" #include "ItemDispenseBehaviors.h" #include #include -#include "minecraft/GameEnums.h" #include "java/Class.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/core/AbstractProjectileDispenseBehavior.h" #include "minecraft/core/BlockSource.h" #include "minecraft/core/DefaultDispenseItemBehavior.h" @@ -135,7 +135,7 @@ std::shared_ptr SpawnEggDispenseBehavior::execute( return dispensed; } - if (entity->instanceof(eTYPE_MOB) && dispensed->hasCustomHoverName()) { + if (entity->instanceof (eTYPE_MOB) && dispensed->hasCustomHoverName()) { std::dynamic_pointer_cast(entity)->setCustomName( dispensed->getHoverName()); } diff --git a/targets/minecraft/network/Connection.cpp b/targets/minecraft/network/Connection.cpp index beffdcb91..6912b88cc 100644 --- a/targets/minecraft/network/Connection.cpp +++ b/targets/minecraft/network/Connection.cpp @@ -6,21 +6,21 @@ #include #include -#include "platform/ShutdownManager.h" -#include "minecraft/network/INetworkService.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "app/common/Network/Socket.h" -#include "util/StringHelpers.h" -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "java/InputOutputStream/BufferedOutputStream.h" #include "java/InputOutputStream/ByteArrayOutputStream.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" #include "java/System.h" +#include "minecraft/network/INetworkService.h" #include "minecraft/network/packet/DisconnectPacket.h" #include "minecraft/network/packet/KeepAlivePacket.h" #include "minecraft/network/packet/Packet.h" #include "minecraft/network/packet/PacketListener.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" +#include "platform/ShutdownManager.h" +#include "util/StringHelpers.h" class SocketAddress; diff --git a/targets/minecraft/network/Connection.h b/targets/minecraft/network/Connection.h index 8fc94a926..918039003 100644 --- a/targets/minecraft/network/Connection.h +++ b/targets/minecraft/network/Connection.h @@ -8,12 +8,11 @@ #include #include "app/common/Network/Socket.h" -#include "platform/C4JThread.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" #include "java/System.h" #include "minecraft/network/packet/DisconnectPacket.h" - +#include "platform/C4JThread.h" class DataInputStream; class DataOutputStream; diff --git a/targets/minecraft/network/INetworkService.h b/targets/minecraft/network/INetworkService.h index 916f31172..a0fb2b782 100644 --- a/targets/minecraft/network/INetworkService.h +++ b/targets/minecraft/network/INetworkService.h @@ -68,6 +68,5 @@ INetworkService& NetworkService_get(); } // namespace minecraft::network -#define NetworkService \ - (::minecraft::network::platform_internal:: \ - NetworkService_get()) +#define NetworkService \ + (::minecraft::network::platform_internal::NetworkService_get()) diff --git a/targets/minecraft/network/packet/AddGlobalEntityPacket.cpp b/targets/minecraft/network/packet/AddGlobalEntityPacket.cpp index 7a2258570..bd885912b 100644 --- a/targets/minecraft/network/packet/AddGlobalEntityPacket.cpp +++ b/targets/minecraft/network/packet/AddGlobalEntityPacket.cpp @@ -24,7 +24,7 @@ AddGlobalEntityPacket::AddGlobalEntityPacket(std::shared_ptr e) { x = Mth::floor(e->x * 32); y = Mth::floor(e->y * 32); z = Mth::floor(e->z * 32); - if (e->instanceof(eTYPE_LIGHTNINGBOLT)) { + if (e->instanceof (eTYPE_LIGHTNINGBOLT)) { type = LIGHTNING; } else { type = 0; diff --git a/targets/minecraft/network/packet/AddPlayerPacket.h b/targets/minecraft/network/packet/AddPlayerPacket.h index 240ee5737..90cbd7c85 100644 --- a/targets/minecraft/network/packet/AddPlayerPacket.h +++ b/targets/minecraft/network/packet/AddPlayerPacket.h @@ -6,10 +6,10 @@ #include #include -#include "platform/PlatformTypes.h" #include "Packet.h" #include "minecraft/network/packet/Packet.h" #include "minecraft/world/entity/SyncedEntityData.h" +#include "platform/PlatformTypes.h" class Player; diff --git a/targets/minecraft/network/packet/BlockRegionUpdatePacket.cpp b/targets/minecraft/network/packet/BlockRegionUpdatePacket.cpp index 77f05c36c..52c625178 100644 --- a/targets/minecraft/network/packet/BlockRegionUpdatePacket.cpp +++ b/targets/minecraft/network/packet/BlockRegionUpdatePacket.cpp @@ -1,16 +1,16 @@ -#include "minecraft/util/Log.h" #include "BlockRegionUpdatePacket.h" #include #include #include "PacketListener.h" -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" +#include "minecraft/util/Log.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/chunk/LevelChunk.h" #include "minecraft/world/level/dimension/Dimension.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #define BLOCK_REGION_UPDATE_FULLCHUNK 0x01 #define BLOCK_REGION_UPDATE_ZEROHEIGHT \ @@ -118,8 +118,7 @@ void BlockRegionUpdatePacket::read(DataInputStream* dis) // throws IOException Compression::getCompression()->DecompressLZXRLE( buffer.data(), &outputSize, compressedBuffer.data(), size); } else { - Log::info( - "Not decompressing packet that wasn't fully read\n"); + Log::info("Not decompressing packet that wasn't fully read\n"); } // printf("Block (%d %d %d), (%d %d %d) coming in decomp from %d to diff --git a/targets/minecraft/network/packet/CustomPayloadPacket.cpp b/targets/minecraft/network/packet/CustomPayloadPacket.cpp index 78ff7c704..563677e9e 100644 --- a/targets/minecraft/network/packet/CustomPayloadPacket.cpp +++ b/targets/minecraft/network/packet/CustomPayloadPacket.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "CustomPayloadPacket.h" #include @@ -6,6 +5,7 @@ #include "PacketListener.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" +#include "minecraft/util/Log.h" // Mojang-defined custom packets const std::string CustomPayloadPacket::CUSTOM_BOOK_PACKET = "MC|BEdit"; diff --git a/targets/minecraft/network/packet/GameCommandPacket.cpp b/targets/minecraft/network/packet/GameCommandPacket.cpp index 0f05da553..bbb5a52e8 100644 --- a/targets/minecraft/network/packet/GameCommandPacket.cpp +++ b/targets/minecraft/network/packet/GameCommandPacket.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "GameCommandPacket.h" #include @@ -7,6 +6,7 @@ #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/commands/CommandsEnum.h" +#include "minecraft/util/Log.h" GameCommandPacket::GameCommandPacket() { length = 0; } diff --git a/targets/minecraft/network/packet/LoginPacket.cpp b/targets/minecraft/network/packet/LoginPacket.cpp index 957240210..a4063e984 100644 --- a/targets/minecraft/network/packet/LoginPacket.cpp +++ b/targets/minecraft/network/packet/LoginPacket.cpp @@ -1,9 +1,9 @@ -#include "minecraft/util/Log.h" #include "LoginPacket.h" #include "PacketListener.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/level/LevelType.h" #include "minecraft/world/level/chunk/ChunkSource.h" diff --git a/targets/minecraft/network/packet/LoginPacket.h b/targets/minecraft/network/packet/LoginPacket.h index facc61ae7..a8938a4b3 100644 --- a/targets/minecraft/network/packet/LoginPacket.h +++ b/targets/minecraft/network/packet/LoginPacket.h @@ -4,9 +4,9 @@ #include #include -#include "platform/PlatformTypes.h" #include "Packet.h" #include "minecraft/network/packet/Packet.h" +#include "platform/PlatformTypes.h" class LevelType; diff --git a/targets/minecraft/network/packet/Packet.cpp b/targets/minecraft/network/packet/Packet.cpp index 5c9acb854..21256b114 100644 --- a/targets/minecraft/network/packet/Packet.cpp +++ b/targets/minecraft/network/packet/Packet.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "Packet.h" #include @@ -104,6 +103,7 @@ #include "minecraft/network/packet/UpdateProgressPacket.h" #include "minecraft/network/packet/UseItemPacket.h" #include "minecraft/network/packet/XZPacket.h" +#include "minecraft/util/Log.h" #include "minecraft/world/item/ItemInstance.h" #include "nbt/NbtIo.h" @@ -576,8 +576,8 @@ void Packet::writeUtf(const std::string& value, } std::string Packet::readUtf(DataInputStream* dis, - int maxLength) // throws IOException TODO 4J JEV, - // should this declare a throws? + int maxLength) // throws IOException TODO 4J JEV, + // should this declare a throws? { short stringLength = dis->readShort(); if (stringLength > maxLength) { @@ -674,9 +674,7 @@ std::shared_ptr Packet::readItem(DataInputStream* dis) { // 4J Stu - Always read/write the tag // if (Item.items[id].canBeDepleted() || // Item.items[id].shouldOverrideMultiplayerNBT()) - { - item->tag = readNbt(dis); - } + { item->tag = readNbt(dis); } } return item; @@ -693,9 +691,7 @@ void Packet::writeItem(std::shared_ptr item, // 4J Stu - Always read/write the tag // if (item.getItem().canBeDepleted() || // item.getItem().shouldOverrideMultiplayerNBT()) - { - writeNbt(item->tag, dos); - } + { writeNbt(item->tag, dos); } } } diff --git a/targets/minecraft/network/packet/PlayerInfoPacket.cpp b/targets/minecraft/network/packet/PlayerInfoPacket.cpp index 95e226d30..9a90c1c8c 100644 --- a/targets/minecraft/network/packet/PlayerInfoPacket.cpp +++ b/targets/minecraft/network/packet/PlayerInfoPacket.cpp @@ -1,7 +1,7 @@ -#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/network/packet/PacketListener.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "minecraft/server/level/ServerPlayer.h" #include "minecraft/server/network/PlayerConnection.h" #ifndef __linux__ diff --git a/targets/minecraft/network/packet/PreLoginPacket.cpp b/targets/minecraft/network/packet/PreLoginPacket.cpp index 7b6334e5b..83a4d44d6 100644 --- a/targets/minecraft/network/packet/PreLoginPacket.cpp +++ b/targets/minecraft/network/packet/PreLoginPacket.cpp @@ -1,14 +1,14 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "PreLoginPacket.h" #include #include -#include "minecraft/BuildVer.h" #include "PacketListener.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" +#include "minecraft/BuildVer.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" PreLoginPacket::PreLoginPacket() { loginKey = ""; diff --git a/targets/minecraft/network/packet/PreLoginPacket.h b/targets/minecraft/network/packet/PreLoginPacket.h index 14d47bb5e..35f5161a4 100644 --- a/targets/minecraft/network/packet/PreLoginPacket.h +++ b/targets/minecraft/network/packet/PreLoginPacket.h @@ -4,9 +4,9 @@ #include #include -#include "platform/PlatformTypes.h" #include "Packet.h" #include "minecraft/network/packet/Packet.h" +#include "platform/PlatformTypes.h" class PreLoginPacket : public Packet, public std::enable_shared_from_this { diff --git a/targets/minecraft/network/packet/RespawnPacket.cpp b/targets/minecraft/network/packet/RespawnPacket.cpp index 5302dc749..54e1e731d 100644 --- a/targets/minecraft/network/packet/RespawnPacket.cpp +++ b/targets/minecraft/network/packet/RespawnPacket.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "RespawnPacket.h" #include @@ -6,6 +5,7 @@ #include "PacketListener.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" +#include "minecraft/util/Log.h" #include "minecraft/world/level/LevelSettings.h" #include "minecraft/world/level/LevelType.h" #include "minecraft/world/level/chunk/ChunkSource.h" diff --git a/targets/minecraft/network/packet/ServerSettingsChangedPacket.cpp b/targets/minecraft/network/packet/ServerSettingsChangedPacket.cpp index 80bc466de..bedb6c72a 100644 --- a/targets/minecraft/network/packet/ServerSettingsChangedPacket.cpp +++ b/targets/minecraft/network/packet/ServerSettingsChangedPacket.cpp @@ -1,9 +1,9 @@ -#include "minecraft/util/Log.h" #include "ServerSettingsChangedPacket.h" #include "PacketListener.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" +#include "minecraft/util/Log.h" const int ServerSettingsChangedPacket::HOST_DIFFICULTY = 0; const int ServerSettingsChangedPacket::HOST_OPTIONS = 1; diff --git a/targets/minecraft/network/packet/SetPlayerTeamPacket.cpp b/targets/minecraft/network/packet/SetPlayerTeamPacket.cpp index 8befc915a..ba2a003da 100644 --- a/targets/minecraft/network/packet/SetPlayerTeamPacket.cpp +++ b/targets/minecraft/network/packet/SetPlayerTeamPacket.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "SetPlayerTeamPacket.h" #include @@ -6,6 +5,7 @@ #include "PacketListener.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/scores/Objective.h" #include "minecraft/world/scores/PlayerTeam.h" diff --git a/targets/minecraft/network/packet/TextureAndGeometryChangePacket.cpp b/targets/minecraft/network/packet/TextureAndGeometryChangePacket.cpp index 8b0834ed3..1f91ecde2 100644 --- a/targets/minecraft/network/packet/TextureAndGeometryChangePacket.cpp +++ b/targets/minecraft/network/packet/TextureAndGeometryChangePacket.cpp @@ -2,10 +2,10 @@ #include -#include "minecraft/Minecraft_Macros.h" #include "PacketListener.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" +#include "minecraft/Minecraft_Macros.h" #include "minecraft/world/entity/Entity.h" TextureAndGeometryChangePacket::TextureAndGeometryChangePacket() { diff --git a/targets/minecraft/network/packet/TextureAndGeometryPacket.cpp b/targets/minecraft/network/packet/TextureAndGeometryPacket.cpp index 3fe50e8b3..9f845a138 100644 --- a/targets/minecraft/network/packet/TextureAndGeometryPacket.cpp +++ b/targets/minecraft/network/packet/TextureAndGeometryPacket.cpp @@ -3,11 +3,11 @@ #include #include -#include "minecraft/Minecraft_Macros.h" -#include "app/common/DLC/DLCSkinFile.h" #include "PacketListener.h" +#include "app/common/DLC/DLCSkinFile.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" +#include "minecraft/Minecraft_Macros.h" TextureAndGeometryPacket::TextureAndGeometryPacket() { this->textureName = ""; diff --git a/targets/minecraft/network/packet/TextureAndGeometryPacket.h b/targets/minecraft/network/packet/TextureAndGeometryPacket.h index 9f8735587..8b7548c9f 100644 --- a/targets/minecraft/network/packet/TextureAndGeometryPacket.h +++ b/targets/minecraft/network/packet/TextureAndGeometryPacket.h @@ -5,8 +5,8 @@ #include #include -#include "minecraft/client/model/SkinBox.h" #include "Packet.h" +#include "minecraft/client/model/SkinBox.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/network/packet/Packet.h" diff --git a/targets/minecraft/network/packet/UpdateGameRuleProgressPacket.h b/targets/minecraft/network/packet/UpdateGameRuleProgressPacket.h index 754aa4877..971e7bdf5 100644 --- a/targets/minecraft/network/packet/UpdateGameRuleProgressPacket.h +++ b/targets/minecraft/network/packet/UpdateGameRuleProgressPacket.h @@ -6,9 +6,9 @@ #include #include -#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "Packet.h" #include "minecraft/network/packet/Packet.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" class UpdateGameRuleProgressPacket : public Packet, diff --git a/targets/minecraft/server/ConsoleInput.cpp b/targets/minecraft/server/ConsoleInput.cpp index b638904df..970ed5405 100644 --- a/targets/minecraft/server/ConsoleInput.cpp +++ b/targets/minecraft/server/ConsoleInput.cpp @@ -2,8 +2,7 @@ class ConsoleInputSource; -ConsoleInput::ConsoleInput(const std::string& msg, - ConsoleInputSource* source) { +ConsoleInput::ConsoleInput(const std::string& msg, ConsoleInputSource* source) { this->msg = msg; this->source = source; } \ No newline at end of file diff --git a/targets/minecraft/server/MinecraftServer.cpp b/targets/minecraft/server/MinecraftServer.cpp index 68cb66bf9..3092f8a9f 100644 --- a/targets/minecraft/server/MinecraftServer.cpp +++ b/targets/minecraft/server/MinecraftServer.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "MinecraftServer.h" #include @@ -12,43 +10,41 @@ #include #include -#include "platform/PlatformTypes.h" -#include "platform/profile/profile.h" -#include "platform/storage/storage.h" #include "ConsoleInput.h" #include "DispenserBootstrap.h" -#include "minecraft/GameEnums.h" -#include "app/common/GameRules/GameRuleManager.h" -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" -#include "minecraft/network/INetworkService.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "PlayerList.h" #include "Settings.h" -#include "util/Timer.h" +#include "app/common/GameRules/GameRuleManager.h" #include "java/Class.h" #include "java/File.h" #include "java/InputOutputStream/DataOutputStream.h" #include "java/InputOutputStream/FileOutputStream.h" #include "java/Random.h" #include "java/System.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/Pos.h" #include "minecraft/client/Options.h" #include "minecraft/commands/Command.h" +#include "minecraft/network/INetworkService.h" #include "minecraft/network/packet/GameEventPacket.h" #include "minecraft/network/packet/ServerSettingsChangedPacket.h" #include "minecraft/network/packet/SetTimePacket.h" #include "minecraft/network/packet/UpdateProgressPacket.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "minecraft/server/level/DerivedServerLevel.h" #include "minecraft/server/level/EntityTracker.h" #include "minecraft/server/level/ServerChunkCache.h" #include "minecraft/server/level/ServerLevel.h" #include "minecraft/server/network/ServerConnection.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/EntityIO.h" #include "minecraft/world/entity/Mob.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/level/GameRules.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/LevelSettings.h" #include "minecraft/world/level/LevelType.h" #include "minecraft/world/level/chunk/ChunkSource.h" @@ -61,17 +57,18 @@ #include "minecraft/world/level/storage/McRegionLevelStorage.h" #include "minecraft/world/level/storage/McRegionLevelStorageSource.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/PlatformTypes.h" +#include "platform/profile/profile.h" +#include "platform/storage/storage.h" #include "strings.h" +#include "util/Timer.h" #if defined(SPLIT_SAVES) #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.h" #endif -#include "platform/input/input.h" -#include "platform/ShutdownManager.h" -#include "minecraft/Console_Debug_enum.h" #include "app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h" #include "app/common/Network/Socket.h" #include "app/common/UI/All Platforms/UIStructs.h" -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" +#include "minecraft/Console_Debug_enum.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/ProgressRenderer.h" #include "minecraft/client/renderer/GameRenderer.h" @@ -83,6 +80,9 @@ #include "minecraft/world/level/chunk/SparseDataStorage.h" #include "minecraft/world/level/chunk/SparseLightStorage.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" +#include "platform/ShutdownManager.h" +#include "platform/input/input.h" class ConsoleInputSource; @@ -151,22 +151,26 @@ bool MinecraftServer::initServer(int64_t seed, NetworkGameInitData* initData, Log::info("\n*** SERVER SETTINGS ***\n"); Log::info( "ServerSettings: host-friends-only is %s\n", - (gameServices().getGameHostOption(eGameHostOption_FriendsOfFriends) > 0) ? "on" - : "off"); + (gameServices().getGameHostOption(eGameHostOption_FriendsOfFriends) > 0) + ? "on" + : "off"); Log::info("ServerSettings: game-type is %s\n", - (gameServices().getGameHostOption(eGameHostOption_GameType) == 0) - ? "Survival Mode" - : "Creative Mode"); + (gameServices().getGameHostOption(eGameHostOption_GameType) == 0) + ? "Survival Mode" + : "Creative Mode"); + Log::info("ServerSettings: pvp is %s\n", + (gameServices().getGameHostOption(eGameHostOption_PvP) > 0) + ? "on" + : "off"); Log::info( - "ServerSettings: pvp is %s\n", - (gameServices().getGameHostOption(eGameHostOption_PvP) > 0) ? "on" : "off"); - Log::info("ServerSettings: fire spreads is %s\n", - (gameServices().getGameHostOption(eGameHostOption_FireSpreads) > 0) - ? "on" - : "off"); - Log::info( - "ServerSettings: tnt explodes is %s\n", - (gameServices().getGameHostOption(eGameHostOption_TNT) > 0) ? "on" : "off"); + "ServerSettings: fire spreads is %s\n", + (gameServices().getGameHostOption(eGameHostOption_FireSpreads) > 0) + ? "on" + : "off"); + Log::info("ServerSettings: tnt explodes is %s\n", + (gameServices().getGameHostOption(eGameHostOption_TNT) > 0) + ? "on" + : "off"); Log::info("\n"); // TODO 4J Stu - Init a load of settings based on data passed as params @@ -384,7 +388,9 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, LevelSettings* levelSettings = new LevelSettings( levelSeed, gameType, - gameServices().getGameHostOption(eGameHostOption_Structures) > 0 ? true : false, + gameServices().getGameHostOption(eGameHostOption_Structures) > 0 + ? true + : false, isHardcore(), true, pLevelType, initData->xzSize, initData->hellScale); if (gameServices().getGameHostOption(eGameHostOption_BonusChest)) levelSettings->enableStartingBonusItems(); @@ -419,7 +425,8 @@ 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); @@ -485,7 +492,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, levels[i]->difficulty = gameServices().getGameHostOption( eGameHostOption_Difficulty); // pMinecraft->options->difficulty; Log::info("MinecraftServer::loadLevel - Difficulty = %d\n", - levels[i]->difficulty); + levels[i]->difficulty); #if DEBUG_SERVER_DONT_SPAWN_MOBS levels[i]->setSpawnSettings(false, false); @@ -514,7 +521,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, eGameHostOption_HasBeenInCreative, gameType == GameType::CREATIVE || levels[0]->getHasBeenInCreative()); gameServices().setGameHostOption(eGameHostOption_Structures, - levels[0]->isGenerateMapFeatures()); + levels[0]->isGenerateMapFeatures()); if (s_bServerHalted || !NetworkService.IsInSession()) return false; @@ -559,10 +566,12 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, int64_t lastTime = System::currentTimeMillis(); #if defined(_LARGE_WORLDS) - if (gameServices().getGameNewWorldSize() > levels[0]->getLevelData()->getXZSizeOld()) { - if (!gameServices().getGameNewWorldSizeUseMoat()) // check the moat settings to - // see if we should be - // overwriting the edge tiles + if (gameServices().getGameNewWorldSize() > + levels[0]->getLevelData()->getXZSizeOld()) { + if (!gameServices() + .getGameNewWorldSizeUseMoat()) // check the moat settings to + // see if we should be + // overwriting the edge tiles { overwriteBordersForNewWorldSize(levels[0]); } @@ -651,14 +660,13 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, if (!levels[0]->getLevelData()->getHasStronghold()) { int x, z; - if (gameServices().getTerrainFeaturePosition(eTerrainFeature_Stronghold, &x, - &z)) { + if (gameServices().getTerrainFeaturePosition( + eTerrainFeature_Stronghold, &x, &z)) { levels[0]->getLevelData()->setXStronghold(x); levels[0]->getLevelData()->setZStronghold(z); levels[0]->getLevelData()->setHasStronghold(); - Log::info( - "=== FOUND stronghold in terrain features list\n"); + Log::info("=== FOUND stronghold in terrain features list\n"); } else { // can't find the stronghold position in the terrain feature @@ -880,7 +888,7 @@ void MinecraftServer::Suspend() { m_suspending = false; Log::info("Suspend server: Elapsed time %f\n", - static_cast(timer.elapsed_seconds())); + static_cast(timer.elapsed_seconds())); } bool MinecraftServer::IsSuspending() { return m_suspending; } @@ -888,9 +896,7 @@ bool MinecraftServer::IsSuspending() { return m_suspending; } void MinecraftServer::stopServer(bool didInit) { // 4J-PB - need to halt the rendering of the data, since we're about to // remove it - { - Minecraft::GetInstance()->gameRenderer->DisableUpdateThread(); - } + { Minecraft::GetInstance()->gameRenderer->DisableUpdateThread(); } connection->stop(); @@ -1078,8 +1084,8 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) { if (pLevelData && pLevelData->getHasStronghold() == false) { int x, z; - if (gameServices().getTerrainFeaturePosition(eTerrainFeature_Stronghold, &x, - &z)) { + if (gameServices().getTerrainFeaturePosition( + eTerrainFeature_Stronghold, &x, &z)) { pLevelData->setXStronghold(x); pLevelData->setZStronghold(z); pLevelData->setHasStronghold(); @@ -1238,8 +1244,7 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) { if (!id) break; std::shared_ptr player = players->players.at(0); - eINSTANCEOF factory = - static_cast(*id); + eINSTANCEOF factory = static_cast(*id); std::shared_ptr mob = std::dynamic_pointer_cast( EntityIO::newByEnumType(factory, @@ -1314,14 +1319,15 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) { // UpdateProgressPacket(20) ) ); if (!s_bServerHalted) { - auto* owned = std::get_if< - std::unique_ptr>( - ¶m); + auto* owned = std::get_if>(¶m); ConsoleSchematicFile::XboxSchematicInitParam* - initData = owned ? dynamic_cast< - ConsoleSchematicFile::XboxSchematicInitParam*>( - owned->get()) - : nullptr; + initData = + owned ? dynamic_cast< + ConsoleSchematicFile:: + XboxSchematicInitParam*>( + owned->get()) + : nullptr; if (initData) { File targetFileDir("Schematics"); if (!targetFileDir.exists()) @@ -1338,7 +1344,8 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) { File dataFile = File(targetFileDir, std::string(filename)); if (dataFile.exists()) dataFile._delete(); - FileOutputStream fos = FileOutputStream(dataFile); + FileOutputStream fos = + FileOutputStream(dataFile); DataOutputStream dos = DataOutputStream(&fos); ConsoleSchematicFile::generateSchematicFile( &dos, levels[0], initData->startX, @@ -1348,7 +1355,8 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) { initData->compressionType); dos.close(); // owned unique_ptr is destroyed when the - // payload is overwritten on the next setXuiServerAction + // payload is overwritten on the next + // setXuiServerAction } } gameServices().unlockSaveNotification(); @@ -1618,11 +1626,11 @@ void MinecraftServer::chunkPacketManagement_PreTick() { s_tickStartTime = System::currentTimeMillis(); s_sentTo.clear(); - std::vector >* players = + std::vector>* players = connection->getPlayers(); if (players->size()) { - std::vector > playersOrig = *players; + std::vector> playersOrig = *players; players->clear(); do { @@ -1655,7 +1663,8 @@ bool MinecraftServer::chunkPacketManagement_CanSendTo(INetworkPlayer* player) { auto now = time_util::clock::now(); if (player->GetSessionIndex() == s_slowQueuePlayerIndex && - (now - s_slowQueueLastTime) > std::chrono::milliseconds(MINECRAFT_SERVER_SLOW_QUEUE_DELAY)) { + (now - s_slowQueueLastTime) > + std::chrono::milliseconds(MINECRAFT_SERVER_SLOW_QUEUE_DELAY)) { // Log::info("Slow queue OK for player #%d\n", // player->GetSessionIndex()); return true; @@ -1674,8 +1683,9 @@ void MinecraftServer::chunkPacketManagement_PostTick() { // 4J Ensure that the slow queue owner keeps cycling if it's not been used // in a while auto now = time_util::clock::now(); - if ((s_slowQueuePacketSent) || ((now - s_slowQueueLastTime) > - std::chrono::milliseconds(2 * MINECRAFT_SERVER_SLOW_QUEUE_DELAY))) { + if ((s_slowQueuePacketSent) || + ((now - s_slowQueueLastTime) > + std::chrono::milliseconds(2 * MINECRAFT_SERVER_SLOW_QUEUE_DELAY))) { // Log::info("Considering cycling: (%d) %d - %d -> %d //> %d\n",s_slowQueuePacketSent, time, s_slowQueueLastTime, (time - // s_slowQueueLastTime), (2*MINECRAFT_SERVER_SLOW_QUEUE_DELAY)); diff --git a/targets/minecraft/server/MinecraftServer.h b/targets/minecraft/server/MinecraftServer.h index de67ec84e..f7c9a746c 100644 --- a/targets/minecraft/server/MinecraftServer.h +++ b/targets/minecraft/server/MinecraftServer.h @@ -7,11 +7,11 @@ #include #include "ConsoleInputSource.h" -#include "platform/C4JThread.h" -#include "util/Timer.h" #include "minecraft/SharedConstants.h" #include "minecraft/world/level/chunk/ChunkSource.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h" +#include "platform/C4JThread.h" +#include "util/Timer.h" class ServerConnection; class Settings; @@ -204,8 +204,7 @@ private: void tick(); public: - void handleConsoleInput(const std::string& msg, - ConsoleInputSource* source); + void handleConsoleInput(const std::string& msg, ConsoleInputSource* source); void handleConsoleInputs(); // void addTickable(Tickable tickable); // 4J removed static void main(int64_t seed, void* lpParameter); diff --git a/targets/minecraft/server/PlayerList.cpp b/targets/minecraft/server/PlayerList.cpp index 3e0718f14..2cd52e4fb 100644 --- a/targets/minecraft/server/PlayerList.cpp +++ b/targets/minecraft/server/PlayerList.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "PlayerList.h" #include @@ -10,26 +8,21 @@ #include #include -#include "platform/profile/profile.h" -#include "minecraft/GameEnums.h" -#include "minecraft/world/level/GameRules/GameRuleDefinition.h" +#include "MinecraftServer.h" +#include "Settings.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h" -#include "minecraft/world/level/GameRules/GameRulesInstance.h" -#include "minecraft/network/INetworkService.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "app/common/Network/Socket.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialEnum.h" -#include "platform/NetTypes.h" -#include "MinecraftServer.h" -#include "Settings.h" -#include "minecraft/world/entity/player/SkinTypes.h" #include "java/Class.h" #include "java/JavaMath.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/Pos.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" #include "minecraft/network/Connection.h" +#include "minecraft/network/INetworkService.h" #include "minecraft/network/packet/ChatPacket.h" #include "minecraft/network/packet/DisconnectPacket.h" #include "minecraft/network/packet/GameEventPacket.h" @@ -45,6 +38,7 @@ #include "minecraft/network/packet/TexturePacket.h" #include "minecraft/network/packet/UpdateMobEffectPacket.h" #include "minecraft/network/packet/XZPacket.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "minecraft/server/level/EntityTracker.h" #include "minecraft/server/level/PlayerChunkMap.h" #include "minecraft/server/level/ServerChunkCache.h" @@ -54,6 +48,7 @@ #include "minecraft/server/network/PendingConnection.h" #include "minecraft/server/network/PlayerConnection.h" #include "minecraft/server/network/ServerConnection.h" +#include "minecraft/util/Log.h" #include "minecraft/util/ProgressListener.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/EntityIO.h" @@ -61,10 +56,13 @@ #include "minecraft/world/entity/SyncedEntityData.h" #include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/entity/player/Player.h" +#include "minecraft/world/entity/player/SkinTypes.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/level/ChunkPos.h" #include "minecraft/world/level/GameRules.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" +#include "minecraft/world/level/GameRules/GameRulesInstance.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelSettings.h" #include "minecraft/world/level/PortalForcer.h" @@ -74,6 +72,8 @@ #include "minecraft/world/level/storage/LevelStorage.h" #include "minecraft/world/level/storage/PlayerIO.h" #include "nbt/CompoundTag.h" +#include "platform/NetTypes.h" +#include "platform/profile/profile.h" #include "strings.h" class MobEffectInstance; @@ -206,9 +206,11 @@ 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() && @@ -226,9 +228,11 @@ 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); @@ -417,7 +421,7 @@ void PlayerList::validatePlayerSpawnPosition( // correct Make sure that the player is on the ground, and in the centre x/z // of the current column Log::info("Original pos is %f, %f, %f in dimension %d\n", player->x, - player->y, player->z, player->dimension); + player->y, player->z, player->dimension); bool spawnForced = player->isRespawnForced(); @@ -437,15 +441,15 @@ void PlayerList::validatePlayerSpawnPosition( player->setPos(targetX, targetY, targetZ); - Log::info("New pos is %f, %f, %f in dimension %d\n", player->x, - player->y, player->z, player->dimension); + Log::info("New pos is %f, %f, %f in dimension %d\n", player->x, player->y, + player->z, player->dimension); ServerLevel* level = server->getLevel(player->dimension); while (level->getCubes(player, &player->bb)->size() != 0) { player->setPos(player->x, player->y + 1, player->z); } - Log::info("Final pos is %f, %f, %f in dimension %d\n", player->x, - player->y, player->z, player->dimension); + Log::info("Final pos is %f, %f, %f in dimension %d\n", player->x, player->y, + player->z, player->dimension); // 4J Stu - If we are in the nether and the above while loop has put us // above the nether then we have a problem Finding a valid, safe spawn point @@ -485,8 +489,8 @@ void PlayerList::validatePlayerSpawnPosition( player->setPos(player->x, player->y + 1, player->z); } - Log::info("Updated pos is %f, %f, %f in dimension %d\n", - player->x, player->y, player->z, player->dimension); + Log::info("Updated pos is %f, %f, %f in dimension %d\n", player->x, + player->y, player->z, player->dimension); } } @@ -1165,7 +1169,8 @@ bool PlayerList::isWhiteListed(const std::string& name) { return true; } bool PlayerList::isOp(const std::string& name) { return false; } bool PlayerList::isOp(std::shared_ptr player) { - bool cheatsEnabled = gameServices().getGameHostOption(eGameHostOption_CheatsEnabled); + bool cheatsEnabled = + gameServices().getGameHostOption(eGameHostOption_CheatsEnabled); #if defined(_DEBUG_MENUS_ENABLED) cheatsEnabled = cheatsEnabled || gameServices().getUseDPadForDebug(); #endif @@ -1231,8 +1236,7 @@ std::vector* PlayerList::getPlayers( Pos* position, int rangeMin, int rangeMax, int count, int mode, int levelMin, int levelMax, std::unordered_map* scoreRequirements, - const std::string& playerName, const std::string& teamName, - Level* level) { + const std::string& playerName, const std::string& teamName, Level* level) { Log::info("getPlayers NOT IMPLEMENTED!"); return nullptr; @@ -1523,7 +1527,7 @@ void PlayerList::removePlayerFromReceiving(std::shared_ptr player, #if !defined(_CONTENT_PACKAGE) Log::info("Requesting remove player %s as primary in dimension %d\n", - player->name.c_str(), dimIndex); + player->name.c_str(), dimIndex); #endif bool playerRemoved = false; @@ -1531,9 +1535,8 @@ void PlayerList::removePlayerFromReceiving(std::shared_ptr player, receiveAllPlayers[dimIndex].end(), player); if (it != receiveAllPlayers[dimIndex].end()) { #if !defined(_CONTENT_PACKAGE) - Log::info( - "Remove: Removing player %s as primary in dimension %d\n", - player->name.c_str(), dimIndex); + Log::info("Remove: Removing player %s as primary in dimension %d\n", + player->name.c_str(), dimIndex); #endif receiveAllPlayers[dimIndex].erase(it); playerRemoved = true; @@ -1615,7 +1618,7 @@ void PlayerList::addPlayerToReceiving(std::shared_ptr player) { #if !defined(_CONTENT_PACKAGE) Log::info("Requesting add player %s as primary in dimension %d\n", - player->name.c_str(), playerDim); + player->name.c_str(), playerDim); #endif bool shouldAddPlayer = true; @@ -1646,7 +1649,7 @@ void PlayerList::addPlayerToReceiving(std::shared_ptr player) { if (shouldAddPlayer) { #if !defined(_CONTENT_PACKAGE) Log::info("Add: Adding player %s as primary in dimension %d\n", - player->name.c_str(), playerDim); + player->name.c_str(), playerDim); #endif receiveAllPlayers[playerDim].push_back(player); } diff --git a/targets/minecraft/server/PlayerList.h b/targets/minecraft/server/PlayerList.h index 401c89ba1..3493c4087 100644 --- a/targets/minecraft/server/PlayerList.h +++ b/targets/minecraft/server/PlayerList.h @@ -8,8 +8,8 @@ #include #include -#include "platform/PlatformTypes.h" #include "nbt/CompoundTag.h" +#include "platform/PlatformTypes.h" class ServerPlayer; class PlayerChunkMap; diff --git a/targets/minecraft/server/ServerInterface.h b/targets/minecraft/server/ServerInterface.h index 29c42ae7b..d23f8a250 100644 --- a/targets/minecraft/server/ServerInterface.h +++ b/targets/minecraft/server/ServerInterface.h @@ -3,7 +3,7 @@ class ServerInterface { virtual int getConfigInt(const std::string& name, int defaultValue) = 0; virtual std::string getConfigString(const std::string& name, - const std::string& defaultValue) = 0; + const std::string& defaultValue) = 0; virtual bool getConfigBoolean(const std::string& name, bool defaultValue) = 0; virtual void setProperty(std::string& propertyName, void* value) = 0; diff --git a/targets/minecraft/server/Settings.cpp b/targets/minecraft/server/Settings.cpp index 39ac1c996..107746d92 100644 --- a/targets/minecraft/server/Settings.cpp +++ b/targets/minecraft/server/Settings.cpp @@ -10,7 +10,7 @@ void Settings::generateNewProperties() {} void Settings::saveProperties() {} std::string Settings::getString(const std::string& key, - const std::string& defaultValue) { + const std::string& defaultValue) { if (properties.find(key) == properties.end()) { properties[key] = defaultValue; saveProperties(); diff --git a/targets/minecraft/server/Settings.h b/targets/minecraft/server/Settings.h index b74af9621..9a184dbbc 100644 --- a/targets/minecraft/server/Settings.h +++ b/targets/minecraft/server/Settings.h @@ -18,7 +18,7 @@ public: void generateNewProperties(); void saveProperties(); std::string getString(const std::string& key, - const std::string& defaultValue); + const std::string& defaultValue); int getInt(const std::string& key, int defaultValue); bool getBoolean(const std::string& key, bool defaultValue); void setBooleanAndSave(const std::string& key, bool value); diff --git a/targets/minecraft/server/commands/TeleportCommand.h b/targets/minecraft/server/commands/TeleportCommand.h index 7eb654cd6..2d3c7c150 100644 --- a/targets/minecraft/server/commands/TeleportCommand.h +++ b/targets/minecraft/server/commands/TeleportCommand.h @@ -4,10 +4,10 @@ #include -#include "platform/PlatformTypes.h" #include "minecraft/commands/Command.h" #include "minecraft/commands/CommandsEnum.h" #include "minecraft/network/packet/GameCommandPacket.h" +#include "platform/PlatformTypes.h" class TeleportCommand : public Command { public: diff --git a/targets/minecraft/server/level/CreativeMode.cpp b/targets/minecraft/server/level/CreativeMode.cpp index 200ddf34b..3d4929eea 100644 --- a/targets/minecraft/server/level/CreativeMode.cpp +++ b/targets/minecraft/server/level/CreativeMode.cpp @@ -4,11 +4,6 @@ #include "minecraft/client/User.h" #include "minecraft/client/player/LocalPlayer.h" - - - - - CreativeMode::CreativeMode(Minecraft* minecraft) : GameMode(minecraft) { destroyDelay = 0; instaBuild = true; diff --git a/targets/minecraft/server/level/DemoMode.cpp b/targets/minecraft/server/level/DemoMode.cpp index 5caa2ed0f..43939df2c 100644 --- a/targets/minecraft/server/level/DemoMode.cpp +++ b/targets/minecraft/server/level/DemoMode.cpp @@ -1,8 +1,6 @@ #include "DemoMode.h" - - DemoMode::DemoMode(Minecraft* minecraft) : SurvivalMode(minecraft) { demoHasEnded = false; demoEndedReminder = 0; diff --git a/targets/minecraft/server/level/EntityTracker.cpp b/targets/minecraft/server/level/EntityTracker.cpp index 2a47cf946..6a3f3e1bd 100644 --- a/targets/minecraft/server/level/EntityTracker.cpp +++ b/targets/minecraft/server/level/EntityTracker.cpp @@ -7,11 +7,11 @@ #include #include -#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "ServerLevel.h" #include "ServerPlayer.h" #include "TrackedEntity.h" #include "java/Class.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/PlayerList.h" #include "minecraft/server/network/PlayerConnection.h" @@ -26,7 +26,7 @@ EntityTracker::EntityTracker(ServerLevel* level) { } void EntityTracker::addEntity(std::shared_ptr e) { - if (e->instanceof(eTYPE_SERVERPLAYER)) { + if (e->instanceof (eTYPE_SERVERPLAYER)) { addEntity(e, 32 * 16, 2); std::shared_ptr player = std::dynamic_pointer_cast(e); @@ -35,57 +35,57 @@ void EntityTracker::addEntity(std::shared_ptr e) { (*it)->updatePlayer(this, player); } } - } else if (e->instanceof(eTYPE_FISHINGHOOK)) + } else if (e->instanceof (eTYPE_FISHINGHOOK)) addEntity(e, 16 * 4, 5, true); - else if (e->instanceof(eTYPE_SMALL_FIREBALL)) + else if (e->instanceof (eTYPE_SMALL_FIREBALL)) addEntity(e, 16 * 4, 10, false); - else if (e->instanceof(eTYPE_DRAGON_FIREBALL)) + else if (e->instanceof (eTYPE_DRAGON_FIREBALL)) addEntity(e, 16 * 4, 10, false); // 4J Added TU9 - else if (e->instanceof(eTYPE_ARROW)) + else if (e->instanceof (eTYPE_ARROW)) addEntity(e, 16 * 4, 20, false); - else if (e->instanceof(eTYPE_FIREBALL)) + else if (e->instanceof (eTYPE_FIREBALL)) addEntity(e, 16 * 4, 10, false); - else if (e->instanceof(eTYPE_SNOWBALL)) + else if (e->instanceof (eTYPE_SNOWBALL)) addEntity(e, 16 * 4, 10, true); - else if (e->instanceof(eTYPE_THROWNENDERPEARL)) + else if (e->instanceof (eTYPE_THROWNENDERPEARL)) addEntity(e, 16 * 4, 10, true); - else if (e->instanceof(eTYPE_EYEOFENDERSIGNAL)) + else if (e->instanceof (eTYPE_EYEOFENDERSIGNAL)) addEntity(e, 16 * 4, 4, true); - else if (e->instanceof(eTYPE_THROWNEGG)) + else if (e->instanceof (eTYPE_THROWNEGG)) addEntity(e, 16 * 4, 10, true); - else if (e->instanceof(eTYPE_THROWNPOTION)) + else if (e->instanceof (eTYPE_THROWNPOTION)) addEntity(e, 16 * 4, 10, true); - else if (e->instanceof(eTYPE_THROWNEXPBOTTLE)) + else if (e->instanceof (eTYPE_THROWNEXPBOTTLE)) addEntity(e, 16 * 4, 10, true); - else if (e->instanceof(eTYPE_FIREWORKS_ROCKET)) + else if (e->instanceof (eTYPE_FIREWORKS_ROCKET)) addEntity(e, 16 * 4, 10, true); - else if (e->instanceof(eTYPE_ITEMENTITY)) + else if (e->instanceof (eTYPE_ITEMENTITY)) addEntity(e, 16 * 4, 20, true); - else if (e->instanceof(eTYPE_MINECART)) + else if (e->instanceof (eTYPE_MINECART)) addEntity(e, 16 * 5, 3, true); - else if (e->instanceof(eTYPE_BOAT)) + else if (e->instanceof (eTYPE_BOAT)) addEntity(e, 16 * 5, 3, true); - else if (e->instanceof(eTYPE_SQUID)) + else if (e->instanceof (eTYPE_SQUID)) addEntity(e, 16 * 4, 3, true); - else if (e->instanceof(eTYPE_WITHERBOSS)) + else if (e->instanceof (eTYPE_WITHERBOSS)) addEntity(e, 16 * 5, 3, false); - else if (e->instanceof(eTYPE_BAT)) + else if (e->instanceof (eTYPE_BAT)) addEntity(e, 16 * 5, 3, false); else if (std::dynamic_pointer_cast(e) != nullptr) addEntity(e, 16 * 5, 3, true); - else if (e->instanceof(eTYPE_ENDERDRAGON)) + else if (e->instanceof (eTYPE_ENDERDRAGON)) addEntity(e, 16 * 10, 3, true); - else if (e->instanceof(eTYPE_PRIMEDTNT)) + else if (e->instanceof (eTYPE_PRIMEDTNT)) addEntity(e, 16 * 10, 10, true); - else if (e->instanceof(eTYPE_FALLINGTILE)) + else if (e->instanceof (eTYPE_FALLINGTILE)) addEntity(e, 16 * 10, 20, true); - else if (e->instanceof(eTYPE_HANGING_ENTITY)) + else if (e->instanceof (eTYPE_HANGING_ENTITY)) addEntity(e, 16 * 10, INT_MAX, false); - else if (e->instanceof(eTYPE_EXPERIENCEORB)) + else if (e->instanceof (eTYPE_EXPERIENCEORB)) addEntity(e, 16 * 10, 20, true); - else if (e->instanceof(eTYPE_ENDER_CRYSTAL)) + else if (e->instanceof (eTYPE_ENDER_CRYSTAL)) addEntity(e, 16 * 16, INT_MAX, false); - else if (e->instanceof(eTYPE_ITEM_FRAME)) + else if (e->instanceof (eTYPE_ITEM_FRAME)) addEntity(e, 16 * 10, INT_MAX, false); } diff --git a/targets/minecraft/server/level/GameMode.cpp b/targets/minecraft/server/level/GameMode.cpp index 23eb4c5d6..18d881a84 100644 --- a/targets/minecraft/server/level/GameMode.cpp +++ b/targets/minecraft/server/level/GameMode.cpp @@ -4,13 +4,6 @@ #include "minecraft/client/player/LocalPlayer.h" #include "minecraft/client/renderer/LevelRenderer.h" - - - - - - - GameMode::GameMode(Minecraft* minecraft) { instaBuild = false; // 4J - added this->minecraft = minecraft; diff --git a/targets/minecraft/server/level/PlayerChunkMap.cpp b/targets/minecraft/server/level/PlayerChunkMap.cpp index 2505f2251..e5f96814e 100644 --- a/targets/minecraft/server/level/PlayerChunkMap.cpp +++ b/targets/minecraft/server/level/PlayerChunkMap.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "PlayerChunkMap.h" #include @@ -10,20 +9,21 @@ #include #include -#include "minecraft/network/INetworkService.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "ServerChunkCache.h" #include "ServerLevel.h" #include "ServerPlayer.h" +#include "minecraft/network/INetworkService.h" #include "minecraft/network/packet/BlockRegionUpdatePacket.h" #include "minecraft/network/packet/ChunkTilesUpdatePacket.h" #include "minecraft/network/packet/ChunkVisibilityAreaPacket.h" #include "minecraft/network/packet/ChunkVisibilityPacket.h" #include "minecraft/network/packet/Packet.h" #include "minecraft/network/packet/TileUpdatePacket.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/PlayerList.h" #include "minecraft/server/network/PlayerConnection.h" +#include "minecraft/util/Log.h" #include "minecraft/world/level/ChunkPos.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/chunk/LevelChunk.h" diff --git a/targets/minecraft/server/level/ServerChunkCache.cpp b/targets/minecraft/server/level/ServerChunkCache.cpp index 6ba4cefbe..c7e35790a 100644 --- a/targets/minecraft/server/level/ServerChunkCache.cpp +++ b/targets/minecraft/server/level/ServerChunkCache.cpp @@ -1,5 +1,3 @@ -#include "minecraft/util/Log.h" -#include #include "ServerChunkCache.h" #include @@ -7,11 +5,12 @@ #include #include +#include -#include "minecraft/IGameServices.h" #include "ServerLevel.h" -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" +#include "minecraft/IGameServices.h" #include "minecraft/server/MinecraftServer.h" +#include "minecraft/util/Log.h" #include "minecraft/util/ProgressListener.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/biome/Biome.h" @@ -21,6 +20,7 @@ #include "minecraft/world/level/chunk/storage/ChunkStorage.h" #include "minecraft/world/level/chunk/storage/OldChunkStorage.h" #include "minecraft/world/level/dimension/Dimension.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "minecraft/world/level/tile/Tile.h" ServerChunkCache::ServerChunkCache(ServerLevel* level, ChunkStorage* storage, @@ -104,9 +104,7 @@ void ServerChunkCache::drop(int x, int z) { //} // } // else - { - canDrop = true; - } + { canDrop = true; } if (canDrop) { int ix = x + XZOFFSET; int iz = z + XZOFFSET; @@ -817,7 +815,7 @@ bool ServerChunkCache::shouldSave() { return !level->noSave; } std::string ServerChunkCache::gatherStats() { return "ServerChunkCache: "; // + toWString(loadedChunks.size()) + " - // Drop: " + toWString(toDrop.size()); + // Drop: " + toWString(toDrop.size()); } std::vector* ServerChunkCache::getMobsAt( @@ -825,8 +823,9 @@ std::vector* ServerChunkCache::getMobsAt( return source->getMobsAt(mobCategory, x, y, z); } -TilePos* ServerChunkCache::findNearestMapFeature( - Level* level, const std::string& featureName, int x, int y, int z) { +TilePos* ServerChunkCache::findNearestMapFeature(Level* level, + const std::string& featureName, + int x, int y, int z) { return source->findNearestMapFeature(level, featureName, x, y, z); } diff --git a/targets/minecraft/server/level/ServerChunkCache.h b/targets/minecraft/server/level/ServerChunkCache.h index 86cb3a6eb..12554b626 100644 --- a/targets/minecraft/server/level/ServerChunkCache.h +++ b/targets/minecraft/server/level/ServerChunkCache.h @@ -5,14 +5,12 @@ #include #include -#include "platform/C4JThread.h" #include "java/File.h" #include "java/JavaIntHash.h" #include "minecraft/world/level/biome/Biome.h" #include "minecraft/world/level/chunk/ChunkSource.h" #include "minecraft/world/level/levelgen/RandomLevelSource.h" - - +#include "platform/C4JThread.h" class ServerLevel; class ChunkStorage; diff --git a/targets/minecraft/server/level/ServerLevel.cpp b/targets/minecraft/server/level/ServerLevel.cpp index f0a1cc5a0..ce522df1b 100644 --- a/targets/minecraft/server/level/ServerLevel.cpp +++ b/targets/minecraft/server/level/ServerLevel.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "ServerLevel.h" #include @@ -7,21 +5,18 @@ #include #include -#include "platform/input/input.h" -#include "platform/storage/storage.h" #include "EntityTracker.h" -#include "platform/ShutdownManager.h" -#include "minecraft/Console_Debug_enum.h" -#include "app/common/DLC/DLCManager.h" -#include "app/common/DLC/DLCPack.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "PlayerChunkMap.h" #include "Pos.h" #include "ServerChunkCache.h" #include "ServerLevelListener.h" #include "ServerPlayer.h" +#include "app/common/DLC/DLCManager.h" +#include "app/common/DLC/DLCPack.h" #include "java/Class.h" #include "java/Random.h" +#include "minecraft/Console_Debug_enum.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/skins/DLCTexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" @@ -31,10 +26,12 @@ #include "minecraft/network/packet/GameEventPacket.h" #include "minecraft/network/packet/LevelParticlesPacket.h" #include "minecraft/network/packet/TileEventPacket.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/PlayerList.h" #include "minecraft/server/ServerScoreboard.h" #include "minecraft/server/network/PlayerConnection.h" +#include "minecraft/util/Log.h" #include "minecraft/util/ProgressListener.h" #include "minecraft/util/WeighedRandom.h" #include "minecraft/util/WeighedTreasure.h" @@ -65,6 +62,9 @@ #include "minecraft/world/level/tile/entity/ChestTileEntity.h" #include "minecraft/world/level/tile/entity/TileEntity.h" #include "minecraft/world/phys/Vec3.h" +#include "platform/ShutdownManager.h" +#include "platform/input/input.h" +#include "platform/storage/storage.h" #include "strings.h" class ChunkStorage; @@ -227,15 +227,9 @@ ServerLevel::~ServerLevel() { } // Make sure that the update thread isn't actually doing any updating - { - std::lock_guard lock(m_updateCS[0]); - } - { - std::lock_guard lock(m_updateCS[1]); - } - { - std::lock_guard lock(m_updateCS[2]); - } + { std::lock_guard lock(m_updateCS[0]); } + { std::lock_guard lock(m_updateCS[1]); } + { std::lock_guard lock(m_updateCS[2]); } m_updateTrigger->clearAll(); } @@ -762,7 +756,7 @@ std::vector* ServerLevel::fetchTicksInChunk(LevelChunk* chunk, void ServerLevel::tick(std::shared_ptr e, bool actual) { if (!server->isAnimals() && - (e->instanceof(eTYPE_ANIMAL) || e->instanceof(eTYPE_WATERANIMAL))) { + (e->instanceof (eTYPE_ANIMAL) || e->instanceof (eTYPE_WATERANIMAL))) { e->remove(); } if (!server->isNpcsEnabled() && @@ -850,8 +844,7 @@ void ServerLevel::setInitialSpawn(LevelSettings* levelSettings) { zSpawn = findBiome->z; delete findBiome; } else { - Log::info( - "Level::setInitialSpawn - Unable to find spawn biome\n"); + Log::info("Level::setInitialSpawn - Unable to find spawn biome\n"); } int tries = 0; @@ -1248,7 +1241,7 @@ void ServerLevel::runQueuedSendTileUpdates() { // removed and added so we can limit the number of itementities created bool ServerLevel::addEntity(std::shared_ptr e) { // If its an item entity, and we've got to our capacity, delete the oldest - if (e->instanceof(eTYPE_ITEMENTITY)) { + if (e->instanceof (eTYPE_ITEMENTITY)) { // printf("Adding item entity count //%d\n",m_itemEntities.size()); std::lock_guard lock(m_limiterCS); @@ -1259,7 +1252,7 @@ bool ServerLevel::addEntity(std::shared_ptr e) { } // If its an hanging entity, and we've got to our capacity, delete the // oldest - else if (e->instanceof(eTYPE_HANGING_ENTITY)) { + else if (e->instanceof (eTYPE_HANGING_ENTITY)) { // printf("Adding item entity count //%d\n",m_itemEntities.size()); std::lock_guard lock(m_limiterCS); @@ -1274,7 +1267,7 @@ bool ServerLevel::addEntity(std::shared_ptr e) { } } // If its an arrow entity, and we've got to our capacity, delete the oldest - else if (e->instanceof(eTYPE_ARROW)) { + else if (e->instanceof (eTYPE_ARROW)) { // printf("Adding arrow entity count //%d\n",m_arrowEntities.size()); std::lock_guard lock(m_limiterCS); @@ -1285,7 +1278,7 @@ bool ServerLevel::addEntity(std::shared_ptr e) { } // If its an experience orb entity, and we've got to our capacity, delete // the oldest - else if (e->instanceof(eTYPE_EXPERIENCEORB)) { + else if (e->instanceof (eTYPE_EXPERIENCEORB)) { // printf("Adding arrow entity count //%d\n",m_arrowEntities.size()); std::lock_guard lock(m_limiterCS); @@ -1304,16 +1297,16 @@ bool ServerLevel::atEntityLimit(std::shared_ptr e) { bool atLimit = false; - if (e->instanceof(eTYPE_ITEMENTITY)) { + if (e->instanceof (eTYPE_ITEMENTITY)) { std::lock_guard lock(m_limiterCS); atLimit = m_itemEntities.size() >= MAX_ITEM_ENTITIES; - } else if (e->instanceof(eTYPE_HANGING_ENTITY)) { + } else if (e->instanceof (eTYPE_HANGING_ENTITY)) { std::lock_guard lock(m_limiterCS); atLimit = m_hangingEntities.size() >= MAX_HANGING_ENTITIES; - } else if (e->instanceof(eTYPE_ARROW)) { + } else if (e->instanceof (eTYPE_ARROW)) { std::lock_guard lock(m_limiterCS); atLimit = m_arrowEntities.size() >= MAX_ARROW_ENTITIES; - } else if (e->instanceof(eTYPE_EXPERIENCEORB)) { + } else if (e->instanceof (eTYPE_EXPERIENCEORB)) { std::lock_guard lock(m_limiterCS); atLimit = m_experienceOrbEntities.size() >= MAX_EXPERIENCEORB_ENTITIES; } @@ -1323,30 +1316,30 @@ bool ServerLevel::atEntityLimit(std::shared_ptr e) { // Maintain a cound of primed tnt & falling tiles in this level void ServerLevel::entityAddedExtra(std::shared_ptr e) { - if (e->instanceof(eTYPE_ITEMENTITY)) { + if (e->instanceof (eTYPE_ITEMENTITY)) { std::lock_guard lock(m_limiterCS); m_itemEntities.push_back(e); // printf("entity added: item entity count now //%d\n",m_itemEntities.size()); - } else if (e->instanceof(eTYPE_HANGING_ENTITY)) { + } else if (e->instanceof (eTYPE_HANGING_ENTITY)) { std::lock_guard lock(m_limiterCS); m_hangingEntities.push_back(e); // printf("entity added: item entity count now //%d\n",m_itemEntities.size()); - } else if (e->instanceof(eTYPE_ARROW)) { + } else if (e->instanceof (eTYPE_ARROW)) { std::lock_guard lock(m_limiterCS); m_arrowEntities.push_back(e); // printf("entity added: arrow entity count now //%d\n",m_arrowEntities.size()); - } else if (e->instanceof(eTYPE_EXPERIENCEORB)) { + } else if (e->instanceof (eTYPE_EXPERIENCEORB)) { std::lock_guard lock(m_limiterCS); m_experienceOrbEntities.push_back(e); // printf("entity added: experience orb entity count now //%d\n",m_arrowEntities.size()); - } else if (e->instanceof(eTYPE_PRIMEDTNT)) { + } else if (e->instanceof (eTYPE_PRIMEDTNT)) { std::lock_guard lock(m_limiterCS); m_primedTntCount++; - } else if (e->instanceof(eTYPE_FALLINGTILE)) { + } else if (e->instanceof (eTYPE_FALLINGTILE)) { std::lock_guard lock(m_limiterCS); m_fallingTileCount++; } @@ -1355,7 +1348,7 @@ void ServerLevel::entityAddedExtra(std::shared_ptr e) { // Maintain a cound of primed tnt & falling tiles in this level, and remove any // item entities from our list void ServerLevel::entityRemovedExtra(std::shared_ptr e) { - if (e->instanceof(eTYPE_ITEMENTITY)) { + if (e->instanceof (eTYPE_ITEMENTITY)) { std::lock_guard lock(m_limiterCS); // printf("entity removed: item entity count //%d\n",m_itemEntities.size()); @@ -1366,7 +1359,7 @@ void ServerLevel::entityRemovedExtra(std::shared_ptr e) { } // printf("entity removed: item entity count now //%d\n",m_itemEntities.size()); - } else if (e->instanceof(eTYPE_HANGING_ENTITY)) { + } else if (e->instanceof (eTYPE_HANGING_ENTITY)) { std::lock_guard lock(m_limiterCS); // printf("entity removed: item entity count //%d\n",m_itemEntities.size()); @@ -1377,7 +1370,7 @@ void ServerLevel::entityRemovedExtra(std::shared_ptr e) { } // printf("entity removed: item entity count now //%d\n",m_itemEntities.size()); - } else if (e->instanceof(eTYPE_ARROW)) { + } else if (e->instanceof (eTYPE_ARROW)) { std::lock_guard lock(m_limiterCS); // printf("entity removed: arrow entity count //%d\n",m_arrowEntities.size()); @@ -1388,7 +1381,7 @@ void ServerLevel::entityRemovedExtra(std::shared_ptr e) { } // printf("entity removed: arrow entity count now //%d\n",m_arrowEntities.size()); - } else if (e->instanceof(eTYPE_EXPERIENCEORB)) { + } else if (e->instanceof (eTYPE_EXPERIENCEORB)) { std::lock_guard lock(m_limiterCS); // printf("entity removed: experience orb entity count //%d\n",m_arrowEntities.size()); @@ -1400,10 +1393,10 @@ void ServerLevel::entityRemovedExtra(std::shared_ptr e) { } // printf("entity removed: experience orb entity count now //%d\n",m_arrowEntities.size()); - } else if (e->instanceof(eTYPE_PRIMEDTNT)) { + } else if (e->instanceof (eTYPE_PRIMEDTNT)) { std::lock_guard lock(m_limiterCS); m_primedTntCount--; - } else if (e->instanceof(eTYPE_FALLINGTILE)) { + } else if (e->instanceof (eTYPE_FALLINGTILE)) { std::lock_guard lock(m_limiterCS); m_fallingTileCount--; } diff --git a/targets/minecraft/server/level/ServerLevel.h b/targets/minecraft/server/level/ServerLevel.h index 8407324b6..8490d3910 100644 --- a/targets/minecraft/server/level/ServerLevel.h +++ b/targets/minecraft/server/level/ServerLevel.h @@ -12,14 +12,13 @@ #include #include "SharedConstants.h" -#include "platform/C4JThread.h" #include "java/JavaIntHash.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/TickNextTickData.h" #include "minecraft/world/level/TileEventData.h" #include "minecraft/world/level/biome/Biome.h" - +#include "platform/C4JThread.h" class ServerChunkCache; class MinecraftServer; diff --git a/targets/minecraft/server/level/ServerLevelListener.cpp b/targets/minecraft/server/level/ServerLevelListener.cpp index 23bec4f7a..5c342e89f 100644 --- a/targets/minecraft/server/level/ServerLevelListener.cpp +++ b/targets/minecraft/server/level/ServerLevelListener.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "ServerLevelListener.h" #include @@ -15,6 +14,7 @@ #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/PlayerList.h" #include "minecraft/server/network/PlayerConnection.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/level/dimension/Dimension.h" diff --git a/targets/minecraft/server/level/ServerPlayer.cpp b/targets/minecraft/server/level/ServerPlayer.cpp index 8bd0d39e5..da588f35a 100644 --- a/targets/minecraft/server/level/ServerPlayer.cpp +++ b/targets/minecraft/server/level/ServerPlayer.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "ServerPlayer.h" #include @@ -10,12 +8,7 @@ #include #include -#include "platform/input/input.h" #include "EntityTracker.h" -#include "minecraft/Console_Debug_enum.h" -#include "minecraft/world/level/GameRules/GameRulesInstance.h" -#include "minecraft/network/INetworkService.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "ServerLevel.h" #include "ServerPlayerGameMode.h" #include "java/InputOutputStream/ByteArrayInputStream.h" @@ -24,10 +17,13 @@ #include "java/InputOutputStream/DataOutputStream.h" #include "java/Random.h" #include "java/System.h" +#include "minecraft/Console_Debug_enum.h" +#include "minecraft/IGameServices.h" #include "minecraft/Pos.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLevel.h" #include "minecraft/client/renderer/LevelRenderer.h" +#include "minecraft/network/INetworkService.h" #include "minecraft/network/packet/AnimatePacket.h" #include "minecraft/network/packet/AwardStatPacket.h" #include "minecraft/network/packet/BlockRegionUpdatePacket.h" @@ -49,11 +45,13 @@ #include "minecraft/network/packet/SetHealthPacket.h" #include "minecraft/network/packet/TileEditorOpenPacket.h" #include "minecraft/network/packet/UpdateMobEffectPacket.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/PlayerList.h" #include "minecraft/server/network/PlayerConnection.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/stats/Stat.h" +#include "minecraft/util/Log.h" #include "minecraft/world/Container.h" #include "minecraft/world/damageSource/CombatTracker.h" #include "minecraft/world/damageSource/DamageSource.h" @@ -90,6 +88,7 @@ #include "minecraft/world/item/trading/MerchantRecipeList.h" #include "minecraft/world/level/ChunkPos.h" #include "minecraft/world/level/GameRules.h" +#include "minecraft/world/level/GameRules/GameRulesInstance.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelSettings.h" #include "minecraft/world/level/biome/Biome.h" @@ -108,6 +107,7 @@ #include "minecraft/world/scores/Scoreboard.h" #include "minecraft/world/scores/criteria/ObjectiveCriteria.h" #include "nbt/CompoundTag.h" +#include "platform/input/input.h" #include "strings.h" class Objective; @@ -450,8 +450,8 @@ void ServerPlayer::doChunkSendingTick(bool dontDelayChunks) { if (dontDelayChunks || (canSendToPlayer && (connection->countDelayedPackets() < 4) && - (NetworkService.GetHostPlayer() - ->GetSendQueueSizeMessages(nullptr, true) < 4) && + (NetworkService.GetHostPlayer()->GetSendQueueSizeMessages( + nullptr, true) < 4) && //(tickCount - lastBrupSendTickCount) > //(connection->getNetworkPlayer()->GetCurrentRtt()>>4) && !connection->done)) { @@ -716,19 +716,20 @@ bool ServerPlayer::hurt(DamageSource* dmgSource, float dmg) { // sometimes nullptr. std::shared_ptr source = dmgSource->getDirectEntity(); - if (source->instanceof(eTYPE_PLAYER) && - !std::dynamic_pointer_cast(source)->canHarmPlayer( - std::dynamic_pointer_cast(shared_from_this()))) { + if (source->instanceof + (eTYPE_PLAYER) && + !std::dynamic_pointer_cast(source)->canHarmPlayer( + std::dynamic_pointer_cast(shared_from_this()))) { return false; } - if ((source != nullptr) && source->instanceof(eTYPE_ARROW)) { + if ((source != nullptr) && source->instanceof (eTYPE_ARROW)) { std::shared_ptr arrow = std::dynamic_pointer_cast(source); - if ((arrow->owner != nullptr) && - arrow->owner->instanceof(eTYPE_PLAYER) && - !canHarmPlayer( - std::dynamic_pointer_cast(arrow->owner))) { + if ((arrow->owner != nullptr) && arrow->owner->instanceof + (eTYPE_PLAYER) && + !canHarmPlayer( + std::dynamic_pointer_cast(arrow->owner))) { return false; } } @@ -780,8 +781,7 @@ void ServerPlayer::changeDimension(int i) { true; // We only flag this for the player in the portal connection->send(std::make_shared( GameEventPacket::WIN_GAME, thisPlayer->GetUserIndex())); - Log::info("Sending packet to %d\n", - thisPlayer->GetUserIndex()); + Log::info("Sending packet to %d\n", thisPlayer->GetUserIndex()); } if (thisPlayer != nullptr) { for (auto it = MinecraftServer::getInstance() @@ -802,7 +802,7 @@ void ServerPlayer::changeDimension(int i) { new GameEventPacket(GameEventPacket::WIN_GAME, thisPlayer->GetUserIndex()))); Log::info("Sending packet to %d\n", - thisPlayer->GetUserIndex()); + thisPlayer->GetUserIndex()); } } } @@ -978,8 +978,7 @@ bool ServerPlayer::startRepairing(int x, int y, int z) { if (containerMenu == inventoryMenu) { nextContainerCounter(); connection->send(std::make_shared( - containerCounter, ContainerOpenPacket::REPAIR_TABLE, "", 9, - false)); + containerCounter, ContainerOpenPacket::REPAIR_TABLE, "", 9, false)); containerMenu = new AnvilMenu( inventory, level, x, y, z, std::dynamic_pointer_cast(shared_from_this())); diff --git a/targets/minecraft/server/level/ServerPlayer.h b/targets/minecraft/server/level/ServerPlayer.h index aea142f5d..86948418c 100644 --- a/targets/minecraft/server/level/ServerPlayer.h +++ b/targets/minecraft/server/level/ServerPlayer.h @@ -13,8 +13,6 @@ #include "minecraft/network/packet/ChatPacket.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/inventory/net.minecraft.world.inventory.ContainerListener.h" - - #include "minecraft/world/level/ChunkPos.h" class PlayerConnection; @@ -64,8 +62,8 @@ private: int lastBrupSendTickCount; // 4J Added public: - ServerPlayer(MinecraftServer* server, Level* level, - const std::string& name, ServerPlayerGameMode* gameMode); + ServerPlayer(MinecraftServer* server, Level* level, const std::string& name, + ServerPlayerGameMode* gameMode); ~ServerPlayer(); void flagEntitiesToBeRemoved(unsigned int* flags, bool* removedFound); // 4J added @@ -131,7 +129,7 @@ public: virtual bool openFireworks(int x, int y, int z); // 4J added virtual bool startEnchanting( int x, int y, int z, const std::string& name); // 4J added bool return - virtual bool startRepairing(int x, int y, int z); // 4J added bool return + virtual bool startRepairing(int x, int y, int z); // 4J added bool return virtual bool openContainer( std::shared_ptr container); // 4J added bool return virtual bool openHopper(std::shared_ptr container); diff --git a/targets/minecraft/server/level/ServerPlayerGameMode.cpp b/targets/minecraft/server/level/ServerPlayerGameMode.cpp index c1dcad91c..bad2c2790 100644 --- a/targets/minecraft/server/level/ServerPlayerGameMode.cpp +++ b/targets/minecraft/server/level/ServerPlayerGameMode.cpp @@ -1,11 +1,10 @@ -#include "minecraft/IGameServices.h" #include "ServerPlayerGameMode.h" #include -#include "minecraft/world/level/GameRules/GameRulesInstance.h" #include "ServerLevel.h" #include "ServerPlayer.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLevel.h" #include "minecraft/client/renderer/LevelRenderer.h" @@ -16,6 +15,7 @@ #include "minecraft/world/item/Item.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/item/WeaponItem.h" +#include "minecraft/world/level/GameRules/GameRulesInstance.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelSettings.h" #include "minecraft/world/level/chunk/LevelChunk.h" diff --git a/targets/minecraft/server/level/SurvivalMode.cpp b/targets/minecraft/server/level/SurvivalMode.cpp index 9105d2259..0edcd73b4 100644 --- a/targets/minecraft/server/level/SurvivalMode.cpp +++ b/targets/minecraft/server/level/SurvivalMode.cpp @@ -6,10 +6,6 @@ #include "minecraft/client/player/LocalPlayer.h" #include "minecraft/client/renderer/LevelRenderer.h" - - - - SurvivalMode::SurvivalMode(Minecraft* minecraft) : GameMode(minecraft) { // 4J - added initialisers xDestroyBlock = -1; diff --git a/targets/minecraft/server/level/TrackedEntity.cpp b/targets/minecraft/server/level/TrackedEntity.cpp index 2f8162e82..47bfb3a04 100644 --- a/targets/minecraft/server/level/TrackedEntity.cpp +++ b/targets/minecraft/server/level/TrackedEntity.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "TrackedEntity.h" #include @@ -9,9 +8,7 @@ #include #include -#include "platform/PlatformTypes.h" #include "EntityTracker.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "ServerPlayer.h" #include "java/Class.h" #include "minecraft/SharedConstants.h" @@ -32,9 +29,11 @@ #include "minecraft/network/packet/TeleportEntityPacket.h" #include "minecraft/network/packet/UpdateAttributesPacket.h" #include "minecraft/network/packet/UpdateMobEffectPacket.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/PlayerList.h" #include "minecraft/server/network/PlayerConnection.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/Creature.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/ExperienceOrb.h" @@ -56,6 +55,7 @@ #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/item/MapItem.h" #include "minecraft/world/level/saveddata/MapItemSavedData.h" +#include "platform/PlatformTypes.h" class AttributeInstance; class MobEffectInstance; @@ -191,8 +191,8 @@ void TrackedEntity::tick(EntityTracker* tracker, // FallingTile depends on this because it removes its source block // in the first tick() - if (tickCount > 0 || e->instanceof(eTYPE_ARROW) || - e->instanceof(eTYPE_PLAYER)) // 4J: Modifed, see above + if (tickCount > 0 || e->instanceof (eTYPE_ARROW) || e->instanceof + (eTYPE_PLAYER)) // 4J: Modifed, see above { if (xa < -128 || xa >= 128 || ya < -128 || ya >= 128 || za < -128 || za >= 128 || @@ -385,7 +385,7 @@ void TrackedEntity::sendDirtyEntityData() { new SetEntityDataPacket(e->entityId, entityData, false))); } - if (e->instanceof(eTYPE_LIVINGENTITY)) { + if (e->instanceof (eTYPE_LIVINGENTITY)) { std::shared_ptr living = std::dynamic_pointer_cast(e); ServersideAttributeMap* attributeMap = @@ -470,10 +470,9 @@ void TrackedEntity::broadcast(std::shared_ptr packet) { void TrackedEntity::broadcastAndSend(std::shared_ptr packet) { std::vector > sentTo; broadcast(packet); - std::shared_ptr sp = - e->instanceof(eTYPE_SERVERPLAYER) - ? std::dynamic_pointer_cast(e) - : nullptr; + std::shared_ptr sp = e->instanceof + (eTYPE_SERVERPLAYER) ? std::dynamic_pointer_cast(e) + : nullptr; if (sp != nullptr && sp->connection) { sp->connection->send(packet); } @@ -595,7 +594,7 @@ void TrackedEntity::updatePlayer(EntityTracker* tracker, yap = e->yd; zap = e->zd; - if (e->instanceof(eTYPE_PLAYER)) { + if (e->instanceof (eTYPE_PLAYER)) { std::shared_ptr plr = std::dynamic_pointer_cast(e); Log::info( "TrackedEntity:: Player '%s' is now visible to player '%s', " @@ -613,7 +612,7 @@ void TrackedEntity::updatePlayer(EntityTracker* tracker, e->entityId, e->getEntityData(), true)); } - if (e->instanceof(eTYPE_LIVINGENTITY)) { + if (e->instanceof (eTYPE_LIVINGENTITY)) { std::shared_ptr living = std::dynamic_pointer_cast(e); ServersideAttributeMap* attributeMap = @@ -637,14 +636,16 @@ void TrackedEntity::updatePlayer(EntityTracker* tracker, sp->connection->send(std::make_shared( SetEntityLinkPacket::RIDING, e, e->riding)); } - if (e->instanceof(eTYPE_MOB) && - std::dynamic_pointer_cast(e)->getLeashHolder() != nullptr) { + if (e->instanceof + (eTYPE_MOB) && + std::dynamic_pointer_cast(e)->getLeashHolder() != + nullptr) { sp->connection->send(std::make_shared( SetEntityLinkPacket::LEASH, e, std::dynamic_pointer_cast(e)->getLeashHolder())); } - if (e->instanceof(eTYPE_LIVINGENTITY)) { + if (e->instanceof (eTYPE_LIVINGENTITY)) { for (int i = 0; i < 5; i++) { std::shared_ptr item = std::dynamic_pointer_cast(e)->getCarried(i); @@ -654,7 +655,7 @@ void TrackedEntity::updatePlayer(EntityTracker* tracker, } } - if (e->instanceof(eTYPE_PLAYER)) { + if (e->instanceof (eTYPE_PLAYER)) { std::shared_ptr spe = std::dynamic_pointer_cast(e); if (spe->isSleeping()) { sp->connection->send( @@ -666,7 +667,7 @@ void TrackedEntity::updatePlayer(EntityTracker* tracker, } } - if (e->instanceof(eTYPE_LIVINGENTITY)) { + if (e->instanceof (eTYPE_LIVINGENTITY)) { std::shared_ptr mob = std::dynamic_pointer_cast(e); std::vector* activeEffects = @@ -712,7 +713,7 @@ void TrackedEntity::updatePlayers( std::shared_ptr TrackedEntity::getAddEntityPacket() { if (e->removed) { Log::info("Fetching addPacket for removed entity - %s\n", - e->getAName().c_str()); + e->getAName().c_str()); } // 4J-PB - replacing with a switch, rather than tons of ifs @@ -723,12 +724,12 @@ std::shared_ptr TrackedEntity::getAddEntityPacket() { xp, yp, zp, yHeadRotp)); } - if (e->instanceof(eTYPE_ITEMENTITY)) { + if (e->instanceof (eTYPE_ITEMENTITY)) { std::shared_ptr packet = std::make_shared(e, AddEntityPacket::ITEM, 1, yRotp, xRotp, xp, yp, zp); return packet; - } else if (e->instanceof(eTYPE_SERVERPLAYER)) { + } else if (e->instanceof (eTYPE_SERVERPLAYER)) { std::shared_ptr player = std::dynamic_pointer_cast(e); @@ -743,55 +744,55 @@ std::shared_ptr TrackedEntity::getAddEntityPacket() { // degrees. return std::make_shared( player, xuid, OnlineXuid, xp, yp, zp, yRotp, xRotp, yHeadRotp); - } else if (e->instanceof(eTYPE_MINECART)) { + } else if (e->instanceof (eTYPE_MINECART)) { std::shared_ptr minecart = std::dynamic_pointer_cast(e); return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::MINECART, minecart->getType(), yRotp, xRotp, xp, yp, zp)); - } else if (e->instanceof(eTYPE_BOAT)) { + } else if (e->instanceof (eTYPE_BOAT)) { return std::make_shared(e, AddEntityPacket::BOAT, yRotp, xRotp, xp, yp, zp); - } else if (e->instanceof(eTYPE_ENDERDRAGON)) { + } else if (e->instanceof (eTYPE_ENDERDRAGON)) { yHeadRotp = std::floor(e->getYHeadRot() * 256 / 360); return std::shared_ptr( new AddMobPacket(std::dynamic_pointer_cast(e), yRotp, xRotp, xp, yp, zp, yHeadRotp)); - } else if (e->instanceof(eTYPE_FISHINGHOOK)) { + } else if (e->instanceof (eTYPE_FISHINGHOOK)) { std::shared_ptr owner = std::dynamic_pointer_cast(e)->owner; return std::make_shared( e, AddEntityPacket::FISH_HOOK, owner != nullptr ? owner->entityId : e->entityId, yRotp, xRotp, xp, yp, zp); - } else if (e->instanceof(eTYPE_ARROW)) { + } else if (e->instanceof (eTYPE_ARROW)) { std::shared_ptr owner = (std::dynamic_pointer_cast(e))->owner; return std::make_shared( e, AddEntityPacket::ARROW, owner != nullptr ? owner->entityId : e->entityId, yRotp, xRotp, xp, yp, zp); - } else if (e->instanceof(eTYPE_SNOWBALL)) { + } else if (e->instanceof (eTYPE_SNOWBALL)) { return std::make_shared(e, AddEntityPacket::SNOWBALL, yRotp, xRotp, xp, yp, zp); - } else if (e->instanceof(eTYPE_THROWNPOTION)) { + } else if (e->instanceof (eTYPE_THROWNPOTION)) { return std::make_shared( e, AddEntityPacket::THROWN_POTION, ((std::dynamic_pointer_cast(e))->getPotionValue()), yRotp, xRotp, xp, yp, zp); - } else if (e->instanceof(eTYPE_THROWNEXPBOTTLE)) { + } else if (e->instanceof (eTYPE_THROWNEXPBOTTLE)) { return std::make_shared( e, AddEntityPacket::THROWN_EXPBOTTLE, yRotp, xRotp, xp, yp, zp); - } else if (e->instanceof(eTYPE_THROWNENDERPEARL)) { + } else if (e->instanceof (eTYPE_THROWNENDERPEARL)) { return std::make_shared( e, AddEntityPacket::THROWN_ENDERPEARL, yRotp, xRotp, xp, yp, zp); - } else if (e->instanceof(eTYPE_EYEOFENDERSIGNAL)) { + } else if (e->instanceof (eTYPE_EYEOFENDERSIGNAL)) { return std::make_shared( e, AddEntityPacket::EYEOFENDERSIGNAL, yRotp, xRotp, xp, yp, zp); - } else if (e->instanceof(eTYPE_FIREWORKS_ROCKET)) { + } else if (e->instanceof (eTYPE_FIREWORKS_ROCKET)) { return std::make_shared(e, AddEntityPacket::FIREWORKS, yRotp, xRotp, xp, yp, zp); - } else if (e->instanceof(eTYPE_FIREBALL)) { + } else if (e->instanceof (eTYPE_FIREBALL)) { eINSTANCEOF classType = e->GetType(); int type = AddEntityPacket::FIREBALL; if (classType == eTYPE_SMALL_FIREBALL) { @@ -815,25 +816,25 @@ std::shared_ptr TrackedEntity::getAddEntityPacket() { aep->ya = (int)(fb->yPower * 8000); aep->za = (int)(fb->zPower * 8000); return aep; - } else if (e->instanceof(eTYPE_THROWNEGG)) { + } else if (e->instanceof (eTYPE_THROWNEGG)) { return std::make_shared(e, AddEntityPacket::EGG, yRotp, xRotp, xp, yp, zp); - } else if (e->instanceof(eTYPE_PRIMEDTNT)) { + } else if (e->instanceof (eTYPE_PRIMEDTNT)) { return std::make_shared(e, AddEntityPacket::PRIMED_TNT, yRotp, xRotp, xp, yp, zp); - } else if (e->instanceof(eTYPE_ENDER_CRYSTAL)) { + } else if (e->instanceof (eTYPE_ENDER_CRYSTAL)) { return std::make_shared( e, AddEntityPacket::ENDER_CRYSTAL, yRotp, xRotp, xp, yp, zp); - } else if (e->instanceof(eTYPE_FALLINGTILE)) { + } else if (e->instanceof (eTYPE_FALLINGTILE)) { std::shared_ptr ft = std::dynamic_pointer_cast(e); return std::make_shared(e, AddEntityPacket::FALLING, ft->tile | (ft->data << 16), yRotp, xRotp, xp, yp, zp); - } else if (e->instanceof(eTYPE_PAINTING)) { + } else if (e->instanceof (eTYPE_PAINTING)) { return std::shared_ptr( new AddPaintingPacket(std::dynamic_pointer_cast(e))); - } else if (e->instanceof(eTYPE_ITEM_FRAME)) { + } else if (e->instanceof (eTYPE_ITEM_FRAME)) { std::shared_ptr frame = std::dynamic_pointer_cast(e); @@ -852,7 +853,7 @@ std::shared_ptr TrackedEntity::getAddEntityPacket() { packet->y = std::floor(frame->yTile * 32.0f); packet->z = std::floor(frame->zTile * 32.0f); return packet; - } else if (e->instanceof(eTYPE_LEASHFENCEKNOT)) { + } else if (e->instanceof (eTYPE_LEASHFENCEKNOT)) { std::shared_ptr knot = std::dynamic_pointer_cast(e); std::shared_ptr packet = @@ -862,7 +863,7 @@ std::shared_ptr TrackedEntity::getAddEntityPacket() { packet->y = std::floor((float)knot->yTile * 32); packet->z = std::floor((float)knot->zTile * 32); return packet; - } else if (e->instanceof(eTYPE_EXPERIENCEORB)) { + } else if (e->instanceof (eTYPE_EXPERIENCEORB)) { return std::shared_ptr( new AddExperienceOrbPacket( std::dynamic_pointer_cast(e))); diff --git a/targets/minecraft/server/network/PendingConnection.cpp b/targets/minecraft/server/network/PendingConnection.cpp index 0a27fa3a1..7c1c257c3 100644 --- a/targets/minecraft/server/network/PendingConnection.cpp +++ b/targets/minecraft/server/network/PendingConnection.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "PendingConnection.h" #include @@ -7,23 +5,25 @@ #include #include -#include "platform/PlatformTypes.h" -#include "platform/storage/storage.h" -#include "minecraft/GameEnums.h" -#include "minecraft/BuildVer.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" -#include "platform/NetTypes.h" #include "PlayerConnection.h" #include "ServerConnection.h" #include "java/Random.h" +#include "minecraft/BuildVer.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/SharedConstants.h" #include "minecraft/network/Connection.h" #include "minecraft/network/packet/DisconnectPacket.h" #include "minecraft/network/packet/LoginPacket.h" #include "minecraft/network/packet/PreLoginPacket.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/PlayerList.h" #include "minecraft/server/level/ServerPlayer.h" +#include "minecraft/util/Log.h" +#include "platform/NetTypes.h" +#include "platform/PlatformTypes.h" +#include "platform/storage/storage.h" class Packet; // #if 0 @@ -77,7 +77,7 @@ void PendingConnection::disconnect(DisconnectPacket::eDisconnectReason reason) { void PendingConnection::handlePreLogin(std::shared_ptr packet) { if (packet->m_netcodeVersion != MINECRAFT_NET_VERSION) { Log::info("Netcode version is %d not equal to %d\n", - packet->m_netcodeVersion, MINECRAFT_NET_VERSION); + packet->m_netcodeVersion, MINECRAFT_NET_VERSION); if (packet->m_netcodeVersion > MINECRAFT_NET_VERSION) { disconnect(DisconnectPacket::eDisconnect_OutdatedServer); } else { @@ -133,11 +133,11 @@ void PendingConnection::sendPreLoginResponse() { } { - connection->send(std::shared_ptr( - new PreLoginPacket("-", ugcXuids, ugcXuidCount, ugcFriendsOnlyBits, - server->m_ugcPlayersVersion, szUniqueMapName, - gameServices().getGameHostOption(eGameHostOption_All), - hostIndex, server->m_texturePackId))); + connection->send(std::shared_ptr(new PreLoginPacket( + "-", ugcXuids, ugcXuidCount, ugcFriendsOnlyBits, + server->m_ugcPlayersVersion, szUniqueMapName, + gameServices().getGameHostOption(eGameHostOption_All), hostIndex, + server->m_texturePackId))); } } @@ -147,8 +147,8 @@ void PendingConnection::handleLogin(std::shared_ptr packet) { // name = packet->userName; if (packet->clientVersion != SharedConstants::NETWORK_PROTOCOL_VERSION) { Log::info("Client version is %d not equal to %d\n", - packet->clientVersion, - SharedConstants::NETWORK_PROTOCOL_VERSION); + packet->clientVersion, + SharedConstants::NETWORK_PROTOCOL_VERSION); if (packet->clientVersion > SharedConstants::NETWORK_PROTOCOL_VERSION) { disconnect(DisconnectPacket::eDisconnect_OutdatedServer); } else { diff --git a/targets/minecraft/server/network/PlayerConnection.cpp b/targets/minecraft/server/network/PlayerConnection.cpp index e149367cf..4c80c8c36 100644 --- a/targets/minecraft/server/network/PlayerConnection.cpp +++ b/targets/minecraft/server/network/PlayerConnection.cpp @@ -1,6 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/GameHostOptions.h" -#include "minecraft/util/Log.h" #include "PlayerConnection.h" #include @@ -11,26 +8,26 @@ #include #include -#include "minecraft/GameEnums.h" -#include "minecraft/Console_Debug_enum.h" -#include "minecraft/world/level/dlc/DLCConstants.h" -#include "app/common/DLC/DLCSkinFile.h" -#include "minecraft/network/INetworkService.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" -#include "app/common/Network/Socket.h" -#include "minecraft/client/model/SkinBox.h" #include "ServerConnection.h" +#include "app/common/DLC/DLCSkinFile.h" +#include "app/common/Network/Socket.h" #include "java/Class.h" #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/JavaMath.h" #include "java/Random.h" #include "java/System.h" +#include "minecraft/Console_Debug_enum.h" #include "minecraft/Facing.h" +#include "minecraft/GameEnums.h" +#include "minecraft/GameHostOptions.h" +#include "minecraft/IGameServices.h" #include "minecraft/SharedConstants.h" +#include "minecraft/client/model/SkinBox.h" #include "minecraft/commands/CommandDispatcher.h" #include "minecraft/commands/CommandsEnum.h" #include "minecraft/network/Connection.h" +#include "minecraft/network/INetworkService.h" #include "minecraft/network/packet/AnimatePacket.h" #include "minecraft/network/packet/ChatPacket.h" #include "minecraft/network/packet/ClientCommandPacket.h" @@ -65,12 +62,14 @@ #include "minecraft/network/packet/TileUpdatePacket.h" #include "minecraft/network/packet/TradeItemPacket.h" #include "minecraft/network/packet/UseItemPacket.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/PlayerList.h" #include "minecraft/server/level/ServerLevel.h" #include "minecraft/server/level/ServerPlayer.h" #include "minecraft/server/level/ServerPlayerGameMode.h" #include "minecraft/stats/GenericStats.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/animal/EntityHorse.h" #include "minecraft/world/entity/item/ItemEntity.h" @@ -96,6 +95,7 @@ #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelSettings.h" #include "minecraft/world/level/dimension/Dimension.h" +#include "minecraft/world/level/dlc/DLCConstants.h" #include "minecraft/world/level/saveddata/MapItemSavedData.h" #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/level/tile/entity/BeaconTileEntity.h" @@ -138,8 +138,10 @@ PlayerConnection::PlayerConnection(MinecraftServer* server, m_onlineXUID = INVALID_XUID; m_bHasClientTickedOnce = false; - setShowOnMaps( - gameServices().getGameHostOption(eGameHostOption_Gamertags) != 0 ? true : false); + setShowOnMaps(gameServices().getGameHostOption(eGameHostOption_Gamertags) != + 0 + ? true + : false); } PlayerConnection::~PlayerConnection() { delete connection; } @@ -383,8 +385,7 @@ void PlayerConnection::handleMovePlayer( #if !defined(_CONTENT_PACKAGE) printf("%s moved wrongly!\n", player->name.c_str()); Log::info("Got position %f, %f, %f\n", xt, yt, zt); - Log::info("Expected %f, %f, %f\n", player->x, player->y, - player->z); + Log::info("Expected %f, %f, %f\n", player->x, player->y, player->z); #endif } player->absMoveTo(xt, yt, zt, yRotT, xRotT); @@ -407,7 +408,7 @@ void PlayerConnection::handleMovePlayer( // kicked for floating too long!"); #if !defined(_CONTENT_PACKAGE) printf("%s was kicked for floating too long!\n", - player->name.c_str()); + player->name.c_str()); #endif disconnect(DisconnectPacket::eDisconnect_NoFlying); return; @@ -720,8 +721,8 @@ void PlayerConnection::handlePlayerCommand( } } else if (packet->action == PlayerCommandPacket::OPEN_INVENTORY) { // also only supported by horses... - if ((player->riding != nullptr) && - player->riding->instanceof(eTYPE_HORSE)) { + if ((player->riding != nullptr) && player->riding->instanceof + (eTYPE_HORSE)) { std::dynamic_pointer_cast(player->riding) ->openInventory(player); } @@ -809,11 +810,12 @@ void PlayerConnection::handleTexture(std::shared_ptr packet) { // Request for texture #if !defined(_CONTENT_PACKAGE) printf("Server received request for custom texture %s\n", - packet->textureName.c_str()); + packet->textureName.c_str()); #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( @@ -825,10 +827,10 @@ void PlayerConnection::handleTexture(std::shared_ptr packet) { // Response with texture data #if !defined(_CONTENT_PACKAGE) printf("Server received custom texture %s\n", - packet->textureName.c_str()); + packet->textureName.c_str()); #endif gameServices().addMemoryTextureFile(packet->textureName, packet->pbData, - packet->dataBytes); + packet->dataBytes); server->connection->handleTextureReceived(packet->textureName); } } @@ -842,11 +844,12 @@ void PlayerConnection::handleTextureAndGeometry( // Request for texture and geometry #if !defined(_CONTENT_PACKAGE) printf("Server received request for custom texture %s\n", - packet->textureName.c_str()); + packet->textureName.c_str()); #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().getDLCSkinFile(packet->textureName); @@ -882,23 +885,23 @@ void PlayerConnection::handleTextureAndGeometry( // Response with texture and geometry data #if !defined(_CONTENT_PACKAGE) printf("Server received custom texture %s and geometry\n", - packet->textureName.c_str()); + packet->textureName.c_str()); #endif gameServices().addMemoryTextureFile(packet->textureName, packet->pbData, - packet->dwTextureBytes); + packet->dwTextureBytes); // add the geometry to the app list if (packet->dwBoxC != 0) { #if !defined(_CONTENT_PACKAGE) printf("Adding skin boxes for skin id %X, box count %d\n", - packet->dwSkinID, packet->dwBoxC); + packet->dwSkinID, packet->dwBoxC); #endif - gameServices().setAdditionalSkinBoxes(packet->dwSkinID, packet->BoxDataA, - packet->dwBoxC); + gameServices().setAdditionalSkinBoxes( + packet->dwSkinID, packet->BoxDataA, packet->dwBoxC); } // Add the anim override gameServices().setAnimOverrideBitmask(packet->dwSkinID, - packet->uiAnimOverrideBitmask); + packet->uiAnimOverrideBitmask); player->setCustomSkin(packet->dwSkinID); @@ -945,7 +948,8 @@ 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); unsigned int uiAnimOverrideBitmask = @@ -965,11 +969,12 @@ 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) printf("Skin for server player %s has changed to %s (%d)\n", - player->name.c_str(), player->customTextureUrl.c_str(), - static_cast(player->getPlayerDefaultSkin())); + player->name.c_str(), player->customTextureUrl.c_str(), + static_cast(player->getPlayerDefaultSkin())); #endif break; case TextureChangePacket::e_TextureChange_Cape: @@ -977,7 +982,7 @@ void PlayerConnection::handleTextureChange( // player->customTextureUrl2 = packet->path; #if !defined(_CONTENT_PACKAGE) printf("Cape for server player %s has changed to %s\n", - player->name.c_str(), player->customTextureUrl2.c_str()); + player->name.c_str(), player->customTextureUrl2.c_str()); #endif break; } @@ -1059,43 +1064,44 @@ void PlayerConnection::handleServerSettingsChanged( gameServices().setGameHostOption( eGameHostOption_FireSpreads, GameHostOptions::get(packet->data, - eGameHostOption_FireSpreads)); + eGameHostOption_FireSpreads)); gameServices().setGameHostOption( eGameHostOption_TNT, GameHostOptions::get(packet->data, eGameHostOption_TNT)); gameServices().setGameHostOption( eGameHostOption_MobGriefing, GameHostOptions::get(packet->data, - eGameHostOption_MobGriefing)); + eGameHostOption_MobGriefing)); gameServices().setGameHostOption( eGameHostOption_KeepInventory, GameHostOptions::get(packet->data, - eGameHostOption_KeepInventory)); + eGameHostOption_KeepInventory)); gameServices().setGameHostOption( eGameHostOption_DoMobSpawning, GameHostOptions::get(packet->data, - eGameHostOption_DoMobSpawning)); + eGameHostOption_DoMobSpawning)); gameServices().setGameHostOption( eGameHostOption_DoMobLoot, GameHostOptions::get(packet->data, eGameHostOption_DoMobLoot)); gameServices().setGameHostOption( eGameHostOption_DoTileDrops, GameHostOptions::get(packet->data, - eGameHostOption_DoTileDrops)); + eGameHostOption_DoTileDrops)); gameServices().setGameHostOption( eGameHostOption_DoDaylightCycle, GameHostOptions::get(packet->data, - eGameHostOption_DoDaylightCycle)); + eGameHostOption_DoDaylightCycle)); gameServices().setGameHostOption( eGameHostOption_NaturalRegeneration, GameHostOptions::get(packet->data, - eGameHostOption_NaturalRegeneration)); + eGameHostOption_NaturalRegeneration)); server->getPlayers()->broadcastAll( std::shared_ptr( new ServerSettingsChangedPacket( ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS, - gameServices().getGameHostOption(eGameHostOption_All)))); + gameServices().getGameHostOption( + eGameHostOption_All)))); // Update the QoS data NetworkService.UpdateAndSetGameSessionData(); @@ -1407,10 +1413,10 @@ void PlayerConnection::handlePlayerInfo( if (serverPlayer != nullptr) { unsigned int origPrivs = serverPlayer->getAllPlayerGamePrivileges(); - bool trustPlayers = - gameServices().getGameHostOption(eGameHostOption_TrustPlayers) != 0; - bool cheats = - gameServices().getGameHostOption(eGameHostOption_CheatsEnabled) != 0; + bool trustPlayers = gameServices().getGameHostOption( + eGameHostOption_TrustPlayers) != 0; + bool cheats = gameServices().getGameHostOption( + eGameHostOption_CheatsEnabled) != 0; if (serverPlayer == player) { GameType* gameType = Player::getPlayerGamePrivilege( @@ -1423,7 +1429,7 @@ void PlayerConnection::handlePlayerInfo( gameType) { #if !defined(_CONTENT_PACKAGE) printf("Setting %s to game mode %d\n", - serverPlayer->name.c_str(), gameType->getId()); + serverPlayer->name.c_str(), gameType->getId()); #endif serverPlayer->setPlayerGamePrivilege( Player::ePlayerGamePrivilege_CreativeMode, @@ -1438,7 +1444,7 @@ void PlayerConnection::handlePlayerInfo( } else { #if !defined(_CONTENT_PACKAGE) printf("%s already has game mode %d\n", - serverPlayer->name.c_str(), gameType->getId()); + serverPlayer->name.c_str(), gameType->getId()); #endif } if (cheats) { diff --git a/targets/minecraft/server/network/PlayerConnection.h b/targets/minecraft/server/network/PlayerConnection.h index 054b7c0e0..71808f575 100644 --- a/targets/minecraft/server/network/PlayerConnection.h +++ b/targets/minecraft/server/network/PlayerConnection.h @@ -7,11 +7,11 @@ #include #include -#include "platform/PlatformTypes.h" #include "java/JavaIntHash.h" #include "minecraft/network/packet/DisconnectPacket.h" #include "minecraft/network/packet/PacketListener.h" #include "minecraft/server/ConsoleInputSource.h" +#include "platform/PlatformTypes.h" class MinecraftServer; class Connection; diff --git a/targets/minecraft/server/network/ServerConnection.cpp b/targets/minecraft/server/network/ServerConnection.cpp index 7a62aac35..89430951b 100644 --- a/targets/minecraft/server/network/ServerConnection.cpp +++ b/targets/minecraft/server/network/ServerConnection.cpp @@ -1,18 +1,18 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "ServerConnection.h" #include #include "PendingConnection.h" #include "PlayerConnection.h" -#include "util/StringHelpers.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLevel.h" #include "minecraft/network/Connection.h" #include "minecraft/network/packet/DisconnectPacket.h" #include "minecraft/network/packet/ServerSettingsChangedPacket.h" #include "minecraft/server/level/ServerPlayer.h" +#include "minecraft/util/Log.h" +#include "util/StringHelpers.h" ServerConnection::ServerConnection(MinecraftServer* server) { // 4J - added initialiser diff --git a/targets/minecraft/stats/Achievement.cpp b/targets/minecraft/stats/Achievement.cpp index 774b02595..3e134bd40 100644 --- a/targets/minecraft/stats/Achievement.cpp +++ b/targets/minecraft/stats/Achievement.cpp @@ -52,8 +52,7 @@ Achievement::Achievement(int id, const std::string& name, int x, int y, Item* icon, Achievement* prerequisite) : Stat(Achievements::ACHIEVEMENT_OFFSET + id, I18n::get(std::string("achievement.").append(name))), - desc(I18n::get( - std::string("achievement.").append(name).append(".desc"))), + desc(I18n::get(std::string("achievement.").append(name).append(".desc"))), icon(new ItemInstance(icon)), x(x), y(y), @@ -63,8 +62,7 @@ Achievement::Achievement(int id, const std::string& name, int x, int y, Tile* icon, Achievement* prerequisite) : Stat(Achievements::ACHIEVEMENT_OFFSET + id, I18n::get(std::string("achievement.").append(name))), - desc(I18n::get( - std::string("achievement.").append(name).append(".desc"))), + desc(I18n::get(std::string("achievement.").append(name).append(".desc"))), icon(new ItemInstance(icon)), x(x), y(y), @@ -75,8 +73,7 @@ Achievement::Achievement(int id, const std::string& name, int x, int y, Achievement* prerequisite) : Stat(Achievements::ACHIEVEMENT_OFFSET + id, I18n::get(std::string("achievement.").append(name))), - desc(I18n::get( - std::string("achievement.").append(name).append(".desc"))), + desc(I18n::get(std::string("achievement.").append(name).append(".desc"))), icon(icon), x(x), y(y), diff --git a/targets/minecraft/stats/Achievements.cpp b/targets/minecraft/stats/Achievements.cpp index 121912f1e..839f3d685 100644 --- a/targets/minecraft/stats/Achievements.cpp +++ b/targets/minecraft/stats/Achievements.cpp @@ -220,8 +220,8 @@ void Achievements::staticCtor() { Tile::treeTrunk, (Achievement*)buildSword)) ->postConstruct(); Achievements::socialPost = - (new Achievement(eAward_socialPost, "socialPost", 0, 0, - Tile::treeTrunk, (Achievement*)buildSword)) + (new Achievement(eAward_socialPost, "socialPost", 0, 0, Tile::treeTrunk, + (Achievement*)buildSword)) ->postConstruct(); // WARNING: NO NEW ACHIEVMENTS CAN BE ADDED HERE @@ -235,8 +235,8 @@ void Achievements::staticCtor() { // 4J Stu - This achievment added in 1.8.2, but does not map to any Xbox // achievements Achievements::snipeSkeleton = - (new Achievement(eAward_snipeSkeleton, "snipeSkeleton", 7, 0, - Item::bow, (Achievement*)killEnemy)) + (new Achievement(eAward_snipeSkeleton, "snipeSkeleton", 7, 0, Item::bow, + (Achievement*)killEnemy)) ->setGolden() ->postConstruct(); @@ -317,13 +317,13 @@ void Achievements::staticCtor() { // 0,0, Tile::bookshelf, (Achievement*) nullptr) // )->postConstruct(); Achievements::theHaggler = - (new Achievement(eAward_theHaggler, "theHaggler", 0, 0, - Tile::bookshelf, (Achievement*)nullptr)) + (new Achievement(eAward_theHaggler, "theHaggler", 0, 0, Tile::bookshelf, + (Achievement*)nullptr)) ->setAwardLocallyOnly() ->postConstruct(); Achievements::potPlanter = - (new Achievement(eAward_potPlanter, "potPlanter", 0, 0, - Tile::bookshelf, (Achievement*)nullptr)) + (new Achievement(eAward_potPlanter, "potPlanter", 0, 0, Tile::bookshelf, + (Achievement*)nullptr)) ->setAwardLocallyOnly() ->postConstruct(); Achievements::itsASign = diff --git a/targets/minecraft/stats/CommonStats.h b/targets/minecraft/stats/CommonStats.h index 41b2f053b..2ce7232ce 100644 --- a/targets/minecraft/stats/CommonStats.h +++ b/targets/minecraft/stats/CommonStats.h @@ -6,8 +6,8 @@ #include #include "GenericStats.h" -#include "minecraft/stats/Console_Awards_enum.h" #include "java/Class.h" +#include "minecraft/stats/Console_Awards_enum.h" class CommonStats : public GenericStats { protected: diff --git a/targets/minecraft/stats/GenericStats.h b/targets/minecraft/stats/GenericStats.h index 9e45171bc..374915e5c 100644 --- a/targets/minecraft/stats/GenericStats.h +++ b/targets/minecraft/stats/GenericStats.h @@ -6,10 +6,10 @@ #include #include -#include "minecraft/stats/Console_Awards_enum.h" #include "Stat.h" #include "Stats.h" #include "java/Class.h" +#include "minecraft/stats/Console_Awards_enum.h" class DamageSource; class ItemInstance; diff --git a/targets/minecraft/stats/NumberFormatters.h b/targets/minecraft/stats/NumberFormatters.h index 3547dd13b..691bb1105 100644 --- a/targets/minecraft/stats/NumberFormatters.h +++ b/targets/minecraft/stats/NumberFormatters.h @@ -30,5 +30,5 @@ public: // 4J Stu - The java code took a string format, we take a printf format // string - DecimalFormat(std::string x) : formatString(x) {}; + DecimalFormat(std::string x) : formatString(x){}; }; \ No newline at end of file diff --git a/targets/minecraft/stats/Stat.h b/targets/minecraft/stats/Stat.h index f6e953515..744bd2b2b 100644 --- a/targets/minecraft/stats/Stat.h +++ b/targets/minecraft/stats/Stat.h @@ -8,8 +8,8 @@ #include #include "GenericStats.h" -#include "minecraft/IGameServices.h" #include "StatFormatter.h" +#include "minecraft/IGameServices.h" class DecimalFormat; class LocalPlayer; diff --git a/targets/minecraft/stats/Stats.cpp b/targets/minecraft/stats/Stats.cpp index 804d6a6b2..3636bd8f4 100644 --- a/targets/minecraft/stats/Stats.cpp +++ b/targets/minecraft/stats/Stats.cpp @@ -6,7 +6,6 @@ #include "Achievements.h" #include "GeneralStat.h" #include "ItemStat.h" -#include "util/StringHelpers.h" #include "minecraft/stats/Stat.h" #include "minecraft/stats/StatsCounter.h" #include "minecraft/world/item/FishingRodItem.h" @@ -14,6 +13,7 @@ #include "minecraft/world/item/MapItem.h" #include "minecraft/world/level/tile/GrassTile.h" #include "minecraft/world/level/tile/Tile.h" +#include "util/StringHelpers.h" class StatFormatter; @@ -171,8 +171,8 @@ bool Stats::blockStatsLoaded = false; void Stats::buildBlockStats() { blocksMined = std::vector(32000); - ItemStat* newStat = new ItemStat(BLOCKS_MINED_OFFSET + 0, "mineBlock.dirt", - Tile::dirt->id); + ItemStat* newStat = + new ItemStat(BLOCKS_MINED_OFFSET + 0, "mineBlock.dirt", Tile::dirt->id); blocksMinedStats->push_back(newStat); blocksMined[Tile::dirt->id] = newStat; blocksMined[Tile::grass->id] = newStat; @@ -185,8 +185,8 @@ void Stats::buildBlockStats() { blocksMined[Tile::cobblestone->id] = newStat; newStat->postConstruct(); - newStat = new ItemStat(BLOCKS_MINED_OFFSET + 2, "mineBlock.sand", - Tile::sand->id); + newStat = + new ItemStat(BLOCKS_MINED_OFFSET + 2, "mineBlock.sand", Tile::sand->id); blocksMinedStats->push_back(newStat); blocksMined[Tile::sand->id] = newStat; newStat->postConstruct(); @@ -203,8 +203,8 @@ void Stats::buildBlockStats() { blocksMined[Tile::gravel->id] = newStat; newStat->postConstruct(); - newStat = new ItemStat(BLOCKS_MINED_OFFSET + 5, "mineBlock.clay", - Tile::clay->id); + newStat = + new ItemStat(BLOCKS_MINED_OFFSET + 5, "mineBlock.clay", Tile::clay->id); blocksMinedStats->push_back(newStat); blocksMined[Tile::clay->id] = newStat; newStat->postConstruct(); @@ -390,9 +390,8 @@ void Stats::buildCraftableStats() { itemsCrafted[Item::pickAxe_iron->id] = newStat; newStat->postConstruct(); - newStat = - new ItemStat(ITEMS_CRAFTED_OFFSET + 7, "craftItem.diamondPickAxe", - Item::pickAxe_diamond->id); + newStat = new ItemStat(ITEMS_CRAFTED_OFFSET + 7, "craftItem.diamondPickAxe", + Item::pickAxe_diamond->id); itemsCraftedStats->push_back(newStat); itemsCrafted[Item::pickAxe_diamond->id] = newStat; newStat->postConstruct(); @@ -415,9 +414,8 @@ void Stats::buildCraftableStats() { itemsCrafted[Item::shovel_iron->id] = newStat; newStat->postConstruct(); - newStat = - new ItemStat(ITEMS_CRAFTED_OFFSET + 11, "craftItem.diamondShovel", - Item::shovel_diamond->id); + newStat = new ItemStat(ITEMS_CRAFTED_OFFSET + 11, "craftItem.diamondShovel", + Item::shovel_diamond->id); itemsCraftedStats->push_back(newStat); itemsCrafted[Item::shovel_diamond->id] = newStat; newStat->postConstruct(); @@ -512,8 +510,8 @@ void Stats::buildCraftableStats() { itemsCrafted[Item::bucket_empty->id] = newStat; newStat->postConstruct(); - newStat = new ItemStat(ITEMS_CRAFTED_OFFSET + 27, - "craftItem.flintAndSteel", Item::flintAndSteel->id); + newStat = new ItemStat(ITEMS_CRAFTED_OFFSET + 27, "craftItem.flintAndSteel", + Item::flintAndSteel->id); itemsCraftedStats->push_back(newStat); itemsCrafted[Item::flintAndSteel->id] = newStat; newStat->postConstruct(); @@ -536,8 +534,8 @@ void Stats::buildCraftableStats() { itemsCrafted[Item::compass->id] = newStat; newStat->postConstruct(); - newStat = new ItemStat(ITEMS_CRAFTED_OFFSET + 31, "craftItem.map", - Item::map->id); + newStat = + new ItemStat(ITEMS_CRAFTED_OFFSET + 31, "craftItem.map", Item::map->id); itemsCraftedStats->push_back(newStat); itemsCrafted[Item::map->id] = newStat; newStat->postConstruct(); @@ -602,8 +600,8 @@ void Stats::buildAdditionalStats() { // we don't need those record items (and we only need 2). blocksPlaced = std::vector(1000); - itemStat = new ItemStat(offset++, "blockPlaced.flowerPot", - Tile::flowerPot_Id); + itemStat = + new ItemStat(offset++, "blockPlaced.flowerPot", Tile::flowerPot_Id); blocksPlacedStats->push_back(itemStat); blocksPlaced[itemStat->getItemId()] = itemStat; itemStat->postConstruct(); diff --git a/targets/minecraft/stats/StatsCounter.cpp b/targets/minecraft/stats/StatsCounter.cpp index 6f3e77bd2..c8f496e84 100644 --- a/targets/minecraft/stats/StatsCounter.cpp +++ b/targets/minecraft/stats/StatsCounter.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "StatsCounter.h" #include @@ -10,7 +9,6 @@ #include #include -#include "platform/profile/profile.h" #include "app/common/App_structs.h" #include "app/common/Leaderboards/LeaderboardManager.h" #include "app/linux/LinuxGame.h" @@ -19,8 +17,10 @@ #include "minecraft/stats/GenericStats.h" #include "minecraft/stats/Stat.h" #include "minecraft/stats/Stats.h" +#include "minecraft/util/Log.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/profile/profile.h" Stat** StatsCounter::LARGE_STATS[] = {&Stats::walkOneM, &Stats::swimOneM, &Stats::fallOneM, &Stats::climbOneM, @@ -69,7 +69,7 @@ void StatsCounter::award(Stat* stat, unsigned int difficulty, statBoards.find(stat); if (leaderboardEntry != statBoards.end()) { Log::info("[StatsCounter] award(): %X\n", - leaderboardEntry->second << difficulty); + leaderboardEntry->second << difficulty); modifiedBoards |= (leaderboardEntry->second << difficulty); if (flushCounter == 0) flushCounter = FLUSH_DELAY; } @@ -186,8 +186,7 @@ void StatsCounter::save(int player, bool force) { (LARGE_STATS_COUNT * 4 * (sizeof(unsigned int) - sizeof(unsigned short))); assert(uiTotalStatsSize <= - (Game::GAME_DEFINED_PROFILE_DATA_BYTES - - sizeof(GAME_SETTINGS))); + (Game::GAME_DEFINED_PROFILE_DATA_BYTES - sizeof(GAME_SETTINGS))); // Retrieve the data pointer from the profile std::uint8_t* pbData = reinterpret_cast( @@ -199,8 +198,7 @@ void StatsCounter::save(int player, bool force) { // Reset all the data to 0 (we're going to replace it with the map data) memset(statData, 0, - Game::GAME_DEFINED_PROFILE_DATA_BYTES - - sizeof(GAME_SETTINGS)); + Game::GAME_DEFINED_PROFILE_DATA_BYTES - sizeof(GAME_SETTINGS)); // For each stat StatsMap::iterator val; @@ -357,8 +355,8 @@ void StatsCounter::dumpStatsToTTY() { for (std::vector::iterator statsIter = Stats::all->begin(); statsIter != statsEnd; ++statsIter) { Log::info("%s\t\t%u\t%u\t%u\t%u\n", (*statsIter)->name.c_str(), - getValue(*statsIter, 0), getValue(*statsIter, 1), - getValue(*statsIter, 2), getValue(*statsIter, 3)); + getValue(*statsIter, 0), getValue(*statsIter, 1), + getValue(*statsIter, 2), getValue(*statsIter, 3)); } } diff --git a/targets/minecraft/util/HtmlString.h b/targets/minecraft/util/HtmlString.h index c8c73bbb0..a01d366c9 100644 --- a/targets/minecraft/util/HtmlString.h +++ b/targets/minecraft/util/HtmlString.h @@ -9,7 +9,7 @@ // 4J: Simple std::string wrapper that includes basic formatting information class HtmlString { public: - std::string text; // Text content of std::string + std::string text; // Text content of std::string eMinecraftColour color; // Hex color bool italics; // Show text in italics bool indent; // Indent text diff --git a/targets/minecraft/util/WeighedRandom.cpp b/targets/minecraft/util/WeighedRandom.cpp index 60c1a9bed..55705a30d 100644 --- a/targets/minecraft/util/WeighedRandom.cpp +++ b/targets/minecraft/util/WeighedRandom.cpp @@ -1,8 +1,8 @@ #include "minecraft/util/WeighedRandom.h" -#include #include +#include #include "java/Random.h" diff --git a/targets/minecraft/world/CompoundContainer.cpp b/targets/minecraft/world/CompoundContainer.cpp index 568ff54cd..71d187fe6 100644 --- a/targets/minecraft/world/CompoundContainer.cpp +++ b/targets/minecraft/world/CompoundContainer.cpp @@ -1,6 +1,6 @@ -#include "minecraft/IGameServices.h" #include "CompoundContainer.h" +#include "minecraft/IGameServices.h" #include "minecraft/network/packet/ContainerOpenPacket.h" #include "minecraft/world/Container.h" diff --git a/targets/minecraft/world/SimpleContainer.cpp b/targets/minecraft/world/SimpleContainer.cpp index 469fbe7db..9eaafc93a 100644 --- a/targets/minecraft/world/SimpleContainer.cpp +++ b/targets/minecraft/world/SimpleContainer.cpp @@ -1,8 +1,8 @@ -#include "minecraft/IGameServices.h" #include "SimpleContainer.h" #include +#include "minecraft/IGameServices.h" #include "minecraft/world/Container.h" #include "minecraft/world/item/ItemInstance.h" #include "net.minecraft.world.ContainerListener.h" diff --git a/targets/minecraft/world/damageSource/CombatEntry.cpp b/targets/minecraft/world/damageSource/CombatEntry.cpp index ecc3f1f8e..68f163edb 100644 --- a/targets/minecraft/world/damageSource/CombatEntry.cpp +++ b/targets/minecraft/world/damageSource/CombatEntry.cpp @@ -36,8 +36,8 @@ float CombatEntry::getHealthBeforeDamage() { return health; } float CombatEntry::getHealthAfterDamage() { return health - damage; } bool CombatEntry::isCombatRelated() { - return source->getEntity() && - source->getEntity()->instanceof(eTYPE_LIVINGENTITY); + return source->getEntity() && source->getEntity()->instanceof + (eTYPE_LIVINGENTITY); } CombatTracker::eLOCATION CombatEntry::getLocation() { return location; } diff --git a/targets/minecraft/world/damageSource/CombatTracker.cpp b/targets/minecraft/world/damageSource/CombatTracker.cpp index 9970b7c3b..33cdbdb3e 100644 --- a/targets/minecraft/world/damageSource/CombatTracker.cpp +++ b/targets/minecraft/world/damageSource/CombatTracker.cpp @@ -100,7 +100,8 @@ std::shared_ptr CombatTracker::getDeathMessagePacket() { (killingEntity == nullptr || attackerEntity != killingEntity)) { std::shared_ptr attackerItem = - attackerEntity->instanceof(eTYPE_LIVINGENTITY) + attackerEntity->instanceof + (eTYPE_LIVINGENTITY) ? std::dynamic_pointer_cast(attackerEntity) ->getCarriedItem() : nullptr; @@ -118,8 +119,8 @@ std::shared_ptr CombatTracker::getDeathMessagePacket() { attackerEntity->getNetworkName()); } } else if (killingEntity != nullptr) { - std::shared_ptr killerItem = - killingEntity->instanceof(eTYPE_LIVINGENTITY) + std::shared_ptr killerItem = killingEntity->instanceof + (eTYPE_LIVINGENTITY) ? std::dynamic_pointer_cast(killingEntity) ->getCarriedItem() : nullptr; @@ -155,18 +156,20 @@ std::shared_ptr CombatTracker::getKiller() { for (auto it = entries.begin(); it != entries.end(); ++it) { CombatEntry* entry = *it; if (entry->getSource() != nullptr && - entry->getSource()->getEntity() != nullptr && - entry->getSource()->getEntity()->instanceof(eTYPE_PLAYER) && - (bestPlayer == nullptr || entry->getDamage() > bestPlayerDamage)) { + entry->getSource()->getEntity() != nullptr && + entry->getSource()->getEntity()->instanceof + (eTYPE_PLAYER) && (bestPlayer == nullptr || + entry->getDamage() > bestPlayerDamage)) { bestPlayerDamage = entry->getDamage(); bestPlayer = std::dynamic_pointer_cast( entry->getSource()->getEntity()); } if (entry->getSource() != nullptr && - entry->getSource()->getEntity() != nullptr && - entry->getSource()->getEntity()->instanceof(eTYPE_LIVINGENTITY) && - (bestMob == nullptr || entry->getDamage() > bestMobDamage)) { + entry->getSource()->getEntity() != nullptr && + entry->getSource()->getEntity()->instanceof + (eTYPE_LIVINGENTITY) && + (bestMob == nullptr || entry->getDamage() > bestMobDamage)) { bestMobDamage = entry->getDamage(); bestMob = std::dynamic_pointer_cast( entry->getSource()->getEntity()); diff --git a/targets/minecraft/world/damageSource/EntityDamageSource.cpp b/targets/minecraft/world/damageSource/EntityDamageSource.cpp index 3c5aab7a5..8bffcdd24 100644 --- a/targets/minecraft/world/damageSource/EntityDamageSource.cpp +++ b/targets/minecraft/world/damageSource/EntityDamageSource.cpp @@ -35,14 +35,15 @@ std::shared_ptr EntityDamageSource::getEntity() { return entity; } std::shared_ptr EntityDamageSource::getDeathMessagePacket( std::shared_ptr player) { std::shared_ptr held = - (entity != nullptr) && entity->instanceof(eTYPE_LIVINGENTITY) + (entity != nullptr) && entity->instanceof + (eTYPE_LIVINGENTITY) ? std::dynamic_pointer_cast(entity)->getCarriedItem() : nullptr; std::string additional = ""; - if (entity->instanceof(eTYPE_SERVERPLAYER)) { + if (entity->instanceof (eTYPE_SERVERPLAYER)) { additional = std::dynamic_pointer_cast(entity)->name; - } else if (entity->instanceof(eTYPE_MOB)) { + } else if (entity->instanceof (eTYPE_MOB)) { std::shared_ptr mob = std::dynamic_pointer_cast(entity); if (mob->hasCustomName()) { additional = mob->getCustomName(); @@ -60,8 +61,8 @@ std::shared_ptr EntityDamageSource::getDeathMessagePacket( } bool EntityDamageSource::scalesWithDifficulty() { - return (entity != nullptr) && entity->instanceof(eTYPE_LIVINGENTITY) && - !entity->instanceof(eTYPE_PLAYER); + return (entity != nullptr) && entity->instanceof + (eTYPE_LIVINGENTITY) && !entity->instanceof (eTYPE_PLAYER); } // 4J: Copy function diff --git a/targets/minecraft/world/damageSource/IndirectEntityDamageSource.cpp b/targets/minecraft/world/damageSource/IndirectEntityDamageSource.cpp index fc5040d68..32875f28d 100644 --- a/targets/minecraft/world/damageSource/IndirectEntityDamageSource.cpp +++ b/targets/minecraft/world/damageSource/IndirectEntityDamageSource.cpp @@ -42,8 +42,8 @@ std::shared_ptr IndirectEntityDamageSource::getEntity() { std::shared_ptr IndirectEntityDamageSource::getDeathMessagePacket( std::shared_ptr player) { - std::shared_ptr held = - entity->instanceof(eTYPE_LIVINGENTITY) + std::shared_ptr held = entity->instanceof + (eTYPE_LIVINGENTITY) ? std::dynamic_pointer_cast(entity)->getCarriedItem() : nullptr; std::string additional = ""; diff --git a/targets/minecraft/world/effect/AbsoptionMobEffect.h b/targets/minecraft/world/effect/AbsoptionMobEffect.h index 6796292a3..048ae000d 100644 --- a/targets/minecraft/world/effect/AbsoptionMobEffect.h +++ b/targets/minecraft/world/effect/AbsoptionMobEffect.h @@ -1,7 +1,7 @@ #pragma once -#include "minecraft/GameEnums.h" #include "MobEffect.h" +#include "minecraft/GameEnums.h" class LivingEntity; diff --git a/targets/minecraft/world/effect/AttackDamageMobEffect.h b/targets/minecraft/world/effect/AttackDamageMobEffect.h index fdf709fe0..649b3dbd8 100644 --- a/targets/minecraft/world/effect/AttackDamageMobEffect.h +++ b/targets/minecraft/world/effect/AttackDamageMobEffect.h @@ -1,7 +1,7 @@ #pragma once -#include "minecraft/GameEnums.h" #include "MobEffect.h" +#include "minecraft/GameEnums.h" class AttributeModifier; diff --git a/targets/minecraft/world/effect/HealthBoostMobEffect.h b/targets/minecraft/world/effect/HealthBoostMobEffect.h index a84c6d0f4..a4be079df 100644 --- a/targets/minecraft/world/effect/HealthBoostMobEffect.h +++ b/targets/minecraft/world/effect/HealthBoostMobEffect.h @@ -1,7 +1,7 @@ #pragma once -#include "minecraft/GameEnums.h" #include "MobEffect.h" +#include "minecraft/GameEnums.h" class LivingEntity; class BaseAttributeMap; diff --git a/targets/minecraft/world/effect/InstantaneousMobEffect.h b/targets/minecraft/world/effect/InstantaneousMobEffect.h index da911bb52..871c355dd 100644 --- a/targets/minecraft/world/effect/InstantaneousMobEffect.h +++ b/targets/minecraft/world/effect/InstantaneousMobEffect.h @@ -1,7 +1,7 @@ #pragma once -#include "minecraft/GameEnums.h" #include "MobEffect.h" +#include "minecraft/GameEnums.h" class InstantenousMobEffect : public MobEffect { public: diff --git a/targets/minecraft/world/effect/MobEffect.cpp b/targets/minecraft/world/effect/MobEffect.cpp index f282e7fc7..9037716fd 100644 --- a/targets/minecraft/world/effect/MobEffect.cpp +++ b/targets/minecraft/world/effect/MobEffect.cpp @@ -9,8 +9,8 @@ #include #include -#include "minecraft/GameEnums.h" #include "java/Class.h" +#include "minecraft/GameEnums.h" #include "minecraft/SharedConstants.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/effect/AbsoptionMobEffect.h" @@ -274,12 +274,12 @@ void MobEffect::applyEffectTick(std::shared_ptr mob, } } else if (id == wither->id) { mob->hurt(DamageSource::wither, 1); - } else if ((id == hunger->id) && mob->instanceof(eTYPE_PLAYER)) { + } else if ((id == hunger->id) && mob->instanceof (eTYPE_PLAYER)) { // every tick, cause the same amount of exhaustion as when removing // a block, times amplification std::dynamic_pointer_cast(mob)->causeFoodExhaustion( FoodConstants::EXHAUSTION_MINE * (amplification + 1)); - } else if ((id == saturation->id) && mob->instanceof(eTYPE_PLAYER)) { + } else if ((id == saturation->id) && mob->instanceof (eTYPE_PLAYER)) { if (!mob->level->isClientSide) { std::dynamic_pointer_cast(mob)->getFoodData()->eat( amplification + 1, FoodConstants::FOOD_SATURATION_MAX); diff --git a/targets/minecraft/world/effect/MobEffectInstance.cpp b/targets/minecraft/world/effect/MobEffectInstance.cpp index 29a5aca77..c58290bde 100644 --- a/targets/minecraft/world/effect/MobEffectInstance.cpp +++ b/targets/minecraft/world/effect/MobEffectInstance.cpp @@ -1,5 +1,3 @@ -#include "minecraft/util/Log.h" - #include "minecraft/world/effect/MobEffectInstance.h" #include @@ -7,6 +5,7 @@ #include #include +#include "minecraft/util/Log.h" #include "minecraft/world/effect/MobEffect.h" #include "nbt/CompoundTag.h" @@ -49,8 +48,7 @@ MobEffectInstance::MobEffectInstance(MobEffectInstance* copy) { void MobEffectInstance::update(MobEffectInstance* takeOver) { if (id != takeOver->id) { - Log::info( - "This method should only be called for matching effects!"); + Log::info("This method should only be called for matching effects!"); } if (takeOver->amplifier > amplifier) { amplifier = takeOver->amplifier; diff --git a/targets/minecraft/world/entity/Entity.cpp b/targets/minecraft/world/entity/Entity.cpp index 42c04844b..f17dc2ec4 100644 --- a/targets/minecraft/world/entity/Entity.cpp +++ b/targets/minecraft/world/entity/Entity.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "Entity.h" #include @@ -17,10 +15,11 @@ #include "EntityIO.h" #include "EntityPos.h" #include "SyncedEntityData.h" -#include "minecraft/GameEnums.h" #include "java/Class.h" #include "java/Random.h" #include "minecraft/Direction.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/Pos.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/model/HumanoidModel.h" @@ -29,6 +28,7 @@ #include "minecraft/server/PlayerList.h" #include "minecraft/server/level/ServerLevel.h" #include "minecraft/sounds/SoundTypes.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/entity/item/ItemEntity.h" @@ -681,8 +681,8 @@ void Entity::move(double xa, double ya, double za, AABB bbOrg = bb; - bool isPlayerSneaking = - onGround && isSneaking() && instanceof(eTYPE_PLAYER); + bool isPlayerSneaking = onGround && isSneaking() && instanceof + (eTYPE_PLAYER); if (isPlayerSneaking) { double d = 0.05; @@ -1784,7 +1784,7 @@ void Entity::changeDimension(int i) { // 4J: Restrictions on what can go through { // 4J: Some things should just be destroyed when they hit a portal - if (instanceof(eTYPE_FALLINGTILE)) { + if (instanceof (eTYPE_FALLINGTILE)) { removed = true; return; } @@ -1794,8 +1794,9 @@ void Entity::changeDimension(int i) { if (newLevel->atEntityLimit(shared_from_this())) return; // 4J: Check level limit on living entities, minecarts and boats - if (!instanceof(eTYPE_PLAYER) && - !newLevel->canCreateMore(GetType(), Level::eSpawnType_Portal)) + if (! instanceof + (eTYPE_PLAYER) && + !newLevel->canCreateMore(GetType(), Level::eSpawnType_Portal)) return; } diff --git a/targets/minecraft/world/entity/Entity.h b/targets/minecraft/world/entity/Entity.h index 726691e50..0eeb8d12b 100644 --- a/targets/minecraft/world/entity/Entity.h +++ b/targets/minecraft/world/entity/Entity.h @@ -53,10 +53,10 @@ public: // 4J-PB - added to replace (e instanceof Type), avoiding dynamic casts virtual eINSTANCEOF GetType() = 0; - inline bool instanceof(eINSTANCEOF super) { + inline bool instanceof (eINSTANCEOF super) { return eTYPE_DERIVED_FROM(super, GetType()); } - inline static bool instanceof(eINSTANCEOF type, eINSTANCEOF super) { + inline static bool instanceof (eINSTANCEOF type, eINSTANCEOF super) { return eTYPE_DERIVED_FROM(super, type); } diff --git a/targets/minecraft/world/entity/EntityIO.cpp b/targets/minecraft/world/entity/EntityIO.cpp index 598f676cf..04be0a7b3 100644 --- a/targets/minecraft/world/entity/EntityIO.cpp +++ b/targets/minecraft/world/entity/EntityIO.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "EntityIO.h" #include @@ -7,6 +6,7 @@ #include "Painting.h" #include "java/Class.h" #include "java/JavaIntHash.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/ExperienceOrb.h" #include "minecraft/world/entity/ItemFrame.h" #include "minecraft/world/entity/LeashFenceKnotEntity.h" @@ -90,7 +90,7 @@ void EntityIO::setId(entityCreateFn createFn, eINSTANCEOF clas, const std::string& id, int idNum) { idCreateMap->insert( std::unordered_map::value_type(id, - createFn)); + createFn)); classIdMap->insert( std::unordered_map::value_type(clas, id)); @@ -142,8 +142,8 @@ void EntityIO::staticCtor() { "FireworksRocketEntity", 22); setId(Boat::create, eTYPE_BOAT, "Boat", 41); - setId(MinecartRideable::create, eTYPE_MINECART_RIDEABLE, - "MinecartRideable", 42); + setId(MinecartRideable::create, eTYPE_MINECART_RIDEABLE, "MinecartRideable", + 42); setId(MinecartChest::create, eTYPE_MINECART_CHEST, "MinecartChest", 43); setId(MinecartFurnace::create, eTYPE_MINECART_FURNACE, "MinecartFurnace", 44); @@ -330,8 +330,7 @@ std::shared_ptr EntityIO::loadStatic(CompoundTag* tag, Level* level) { entity->load(tag); } else { #ifdef _DEBUG - Log::info("Skipping Entity with id %s\n", - tag->getString("id").c_str()); + Log::info("Skipping Entity with id %s\n", tag->getString("id").c_str()); #endif } return entity; diff --git a/targets/minecraft/world/entity/EntityIO.h b/targets/minecraft/world/entity/EntityIO.h index e309b6876..b214b6a50 100644 --- a/targets/minecraft/world/entity/EntityIO.h +++ b/targets/minecraft/world/entity/EntityIO.h @@ -5,10 +5,10 @@ #include #include "Entity.h" -#include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/Class.h" #include "java/JavaIntHash.h" +#include "minecraft/GameEnums.h" +#include "minecraft/client/resources/Colours/ColourTable.h" class Level; class CompoundTag; @@ -51,9 +51,8 @@ private: static void setId(entityCreateFn createFn, eINSTANCEOF clas, const std::string& id, int idNum); static void setId(entityCreateFn createFn, eINSTANCEOF clas, - const std::string& id, int idNum, - eMinecraftColour color1, eMinecraftColour color2, - int nameId); + const std::string& id, int idNum, eMinecraftColour color1, + eMinecraftColour color2, int nameId); public: static void staticCtor(); diff --git a/targets/minecraft/world/entity/EntitySelector.cpp b/targets/minecraft/world/entity/EntitySelector.cpp index c25227ad5..66ce2c890 100644 --- a/targets/minecraft/world/entity/EntitySelector.cpp +++ b/targets/minecraft/world/entity/EntitySelector.cpp @@ -30,7 +30,7 @@ MobCanWearArmourEntitySelector::MobCanWearArmourEntitySelector( bool MobCanWearArmourEntitySelector::matches( std::shared_ptr entity) const { if (!entity->isAlive()) return false; - if (!entity->instanceof(eTYPE_LIVINGENTITY)) return false; + if (!entity->instanceof (eTYPE_LIVINGENTITY)) return false; std::shared_ptr mob = std::dynamic_pointer_cast(entity); @@ -38,9 +38,9 @@ bool MobCanWearArmourEntitySelector::matches( if (mob->getCarried(Mob::getEquipmentSlotForItem(item)) != nullptr) return false; - if (mob->instanceof(eTYPE_MOB)) { + if (mob->instanceof (eTYPE_MOB)) { return std::dynamic_pointer_cast(mob)->canPickUpLoot(); - } else if (mob->instanceof(eTYPE_PLAYER)) { + } else if (mob->instanceof (eTYPE_PLAYER)) { return true; } diff --git a/targets/minecraft/world/entity/HangingEntity.cpp b/targets/minecraft/world/entity/HangingEntity.cpp index 23a7f5545..7acc18a15 100644 --- a/targets/minecraft/world/entity/HangingEntity.cpp +++ b/targets/minecraft/world/entity/HangingEntity.cpp @@ -145,7 +145,7 @@ bool HangingEntity::survives() { auto itEnd = entities->end(); for (auto it = entities->begin(); it != itEnd; it++) { std::shared_ptr e = (*it); - if (e->instanceof(eTYPE_HANGING_ENTITY)) { + if (e->instanceof (eTYPE_HANGING_ENTITY)) { return false; } } @@ -172,10 +172,10 @@ bool HangingEntity::hurt(DamageSource* source, float damage) { if (dynamic_cast(source) != nullptr) { std::shared_ptr sourceEntity = source->getDirectEntity(); - if ((sourceEntity != nullptr) && - sourceEntity->instanceof(eTYPE_PLAYER) && - !std::dynamic_pointer_cast(sourceEntity) - ->isAllowedToHurtEntity(shared_from_this())) { + if ((sourceEntity != nullptr) && sourceEntity->instanceof + (eTYPE_PLAYER) && + !std::dynamic_pointer_cast(sourceEntity) + ->isAllowedToHurtEntity(shared_from_this())) { return false; } } @@ -185,9 +185,8 @@ bool HangingEntity::hurt(DamageSource* source, float damage) { std::shared_ptr player = nullptr; std::shared_ptr e = source->getEntity(); - if ((e != nullptr) && - e->instanceof( - eTYPE_PLAYER)) // check if it's serverplayer or player + if ((e != nullptr) && e->instanceof + (eTYPE_PLAYER)) // check if it's serverplayer or player { player = std::dynamic_pointer_cast(e); } diff --git a/targets/minecraft/world/entity/ItemFrame.cpp b/targets/minecraft/world/entity/ItemFrame.cpp index 3fe0086d3..2d7ca7222 100644 --- a/targets/minecraft/world/entity/ItemFrame.cpp +++ b/targets/minecraft/world/entity/ItemFrame.cpp @@ -49,7 +49,7 @@ bool ItemFrame::shouldRenderAtSqrDistance(double distance) { void ItemFrame::dropItem(std::shared_ptr causedBy) { std::shared_ptr item = getItem(); - if (causedBy != nullptr && causedBy->instanceof(eTYPE_PLAYER)) { + if (causedBy != nullptr && causedBy->instanceof (eTYPE_PLAYER)) { if (std::dynamic_pointer_cast(causedBy)->abilities.instabuild) { removeFramedMap(item); return; diff --git a/targets/minecraft/world/entity/LivingEntity.cpp b/targets/minecraft/world/entity/LivingEntity.cpp index 54fed9788..6e924f52c 100644 --- a/targets/minecraft/world/entity/LivingEntity.cpp +++ b/targets/minecraft/world/entity/LivingEntity.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "LivingEntity.h" #include @@ -26,6 +25,7 @@ #include "minecraft/server/level/ServerLevel.h" #include "minecraft/sounds/SoundTypes.h" #include "minecraft/stats/GenericStats.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/CombatTracker.h" #include "minecraft/world/damageSource/DamageSource.h" @@ -244,8 +244,8 @@ void LivingEntity::baseTick() { } clearFire(); - if (!level->isClientSide && isRiding() && - riding->instanceof(eTYPE_LIVINGENTITY)) { + if (!level->isClientSide && isRiding() && riding->instanceof + (eTYPE_LIVINGENTITY)) { ride(nullptr); } } else { @@ -335,10 +335,9 @@ int LivingEntity::decreaseAirSupply(int currentSupply) { return currentSupply; } } - if (instanceof(eTYPE_PLAYER)) { + if (instanceof (eTYPE_PLAYER)) { Log::info("++++++++++ %s: Player decreasing air supply to %d\n", - level->isClientSide ? "CLIENT" : "SERVER", - currentSupply - 1); + level->isClientSide ? "CLIENT" : "SERVER", currentSupply - 1); } return currentSupply - 1; } @@ -369,7 +368,7 @@ std::shared_ptr LivingEntity::getLastHurtMob() { int LivingEntity::getLastHurtMobTimestamp() { return lastHurtMobTimestamp; } void LivingEntity::setLastHurtMob(std::shared_ptr target) { - if (target->instanceof(eTYPE_LIVINGENTITY)) { + if (target->instanceof (eTYPE_LIVINGENTITY)) { lastHurtMob = std::dynamic_pointer_cast(target); } else { lastHurtMob = nullptr; @@ -422,8 +421,7 @@ void LivingEntity::readAdditionalSaveData(CompoundTag* tag) { if (tag->contains("Attributes") && level != nullptr && !level->isClientSide) { SharedMonsterAttributes::loadAttributes( - getAttributes(), - (ListTag*)tag->getList("Attributes")); + getAttributes(), (ListTag*)tag->getList("Attributes")); } if (tag->contains("ActiveEffects")) { @@ -725,9 +723,10 @@ bool LivingEntity::hurt(DamageSource* source, float dmg) { if (source->isFire() && hasEffect(MobEffect::fireResistance)) { // 4J-JEV, for new achievement Stayin'Frosty, TODO merge with Java // version. - if (this->instanceof(eTYPE_PLAYER) && - (source == - DamageSource::lava)) // Only award when in lava (not any fire). + if (this->instanceof + (eTYPE_PLAYER) && + (source == DamageSource::lava)) // Only award when in lava (not + // any fire). { std::shared_ptr plr = std::dynamic_pointer_cast(shared_from_this()); @@ -766,15 +765,15 @@ bool LivingEntity::hurt(DamageSource* source, float dmg) { std::shared_ptr sourceEntity = source->getEntity(); if (sourceEntity != nullptr) { - if (sourceEntity->instanceof(eTYPE_LIVINGENTITY)) { + if (sourceEntity->instanceof (eTYPE_LIVINGENTITY)) { setLastHurtByMob( std::dynamic_pointer_cast(sourceEntity)); } - if (sourceEntity->instanceof(eTYPE_PLAYER)) { + if (sourceEntity->instanceof (eTYPE_PLAYER)) { lastHurtByPlayerTime = PLAYER_HURT_EXPERIENCE_TIME; lastHurtByPlayer = std::dynamic_pointer_cast(sourceEntity); - } else if (sourceEntity->instanceof(eTYPE_WOLF)) { + } else if (sourceEntity->instanceof (eTYPE_WOLF)) { std::shared_ptr w = std::dynamic_pointer_cast(sourceEntity); if (w->isTame()) { @@ -853,8 +852,8 @@ void LivingEntity::die(DamageSource* source) { int playerBonus = 0; std::shared_ptr player = nullptr; - if ((sourceEntity != nullptr) && - sourceEntity->instanceof(eTYPE_PLAYER)) { + if ((sourceEntity != nullptr) && sourceEntity->instanceof + (eTYPE_PLAYER)) { player = std::dynamic_pointer_cast(sourceEntity); playerBonus = EnchantmentHelper::getKillingLootBonus( std::dynamic_pointer_cast(player)); @@ -1005,7 +1004,7 @@ float LivingEntity::getDamageAfterArmorAbsorb(DamageSource* damageSource, float LivingEntity::getDamageAfterMagicAbsorb(DamageSource* damageSource, float damage) { // [EB]: Stupid hack :( - if (this->instanceof(eTYPE_ZOMBIE)) { + if (this->instanceof (eTYPE_ZOMBIE)) { damage = damage; } if (hasEffect(MobEffect::damageResistance) && @@ -1313,8 +1312,8 @@ void LivingEntity::travel(float xa, float ya) { if (zd > max) zd = max; fallDistance = 0; if (yd < -0.15) yd = -0.15; - bool playerSneaking = - isSneaking() && this->instanceof(eTYPE_PLAYER); + bool playerSneaking = isSneaking() && this->instanceof + (eTYPE_PLAYER); if (playerSneaking && yd < 0) yd = 0; } @@ -1644,15 +1643,15 @@ void LivingEntity::setJumping(bool jump) { jumping = jump; } void LivingEntity::take(std::shared_ptr e, int orgCount) { if (!e->removed && !level->isClientSide) { EntityTracker* entityTracker = ((ServerLevel*)level)->getTracker(); - if (e->instanceof(eTYPE_ITEMENTITY)) { + if (e->instanceof (eTYPE_ITEMENTITY)) { entityTracker->broadcast( e, std::shared_ptr( new TakeItemEntityPacket(e->entityId, entityId))); - } else if (e->instanceof(eTYPE_ARROW)) { + } else if (e->instanceof (eTYPE_ARROW)) { entityTracker->broadcast( e, std::shared_ptr( new TakeItemEntityPacket(e->entityId, entityId))); - } else if (e->instanceof(eTYPE_EXPERIENCEORB)) { + } else if (e->instanceof (eTYPE_EXPERIENCEORB)) { entityTracker->broadcast( e, std::shared_ptr( new TakeItemEntityPacket(e->entityId, entityId))); diff --git a/targets/minecraft/world/entity/Mob.cpp b/targets/minecraft/world/entity/Mob.cpp index 80fda456d..88565b033 100644 --- a/targets/minecraft/world/entity/Mob.cpp +++ b/targets/minecraft/world/entity/Mob.cpp @@ -9,7 +9,6 @@ #include #include -#include "util/StringHelpers.h" #include "java/Class.h" #include "java/Random.h" #include "minecraft/core/particles/ParticleTypes.h" @@ -50,6 +49,7 @@ #include "nbt/CompoundTag.h" #include "nbt/FloatTag.h" #include "nbt/ListTag.h" +#include "util/StringHelpers.h" const float Mob::MAX_WEARING_ARMOR_CHANCE = 0.15f; const float Mob::MAX_PICKUP_LOOT_CHANCE = 0.55f; @@ -254,10 +254,10 @@ void Mob::addAdditonalSaveData(CompoundTag* entityTag) { entityTag->putBoolean("Leashed", _isLeashed); if (leashHolder != nullptr) { CompoundTag* leashTag = new CompoundTag("Leash"); - if (leashHolder->instanceof(eTYPE_LIVINGENTITY)) { + if (leashHolder->instanceof (eTYPE_LIVINGENTITY)) { // a walking, talking, leash holder leashTag->putString("UUID", leashHolder->getUUID()); - } else if (leashHolder->instanceof(eTYPE_HANGING_ENTITY)) { + } else if (leashHolder->instanceof (eTYPE_HANGING_ENTITY)) { // a fixed holder (that doesn't save itself) std::shared_ptr hangInThere = std::dynamic_pointer_cast(leashHolder); @@ -493,7 +493,7 @@ void Mob::lookAt(std::shared_ptr e, float yMax, float xMax) { double yd; double zd = e->z - z; - if (e->instanceof(eTYPE_LIVINGENTITY)) { + if (e->instanceof (eTYPE_LIVINGENTITY)) { std::shared_ptr mob = std::dynamic_pointer_cast(e); yd = (mob->y + mob->getHeadHeight()) - (y + getHeadHeight()); @@ -760,12 +760,14 @@ bool Mob::interact(std::shared_ptr player) { if (itemstack->id == Item::lead_Id) { if (canBeLeashed()) { std::shared_ptr tamableAnimal = nullptr; - if (shared_from_this()->instanceof(eTYPE_TAMABLE_ANIMAL) && - (tamableAnimal = std::dynamic_pointer_cast( - shared_from_this())) - ->isTame()) // 4J-JEV: excuse the assignment operator - // in here, don't want to dyn-cast if it's - // avoidable. + if (shared_from_this()->instanceof + (eTYPE_TAMABLE_ANIMAL) && + (tamableAnimal = + std::dynamic_pointer_cast( + shared_from_this())) + ->isTame()) // 4J-JEV: excuse the assignment + // operator in here, don't want to + // dyn-cast if it's avoidable. { if (player->getUUID().compare( tamableAnimal->getOwnerUUID()) == 0) { @@ -824,7 +826,7 @@ void Mob::dropLeash(bool synch, bool createItemDrop) { } bool Mob::canBeLeashed() { - return !isLeashed() && !shared_from_this()->instanceof(eTYPE_ENEMY); + return !isLeashed() && !shared_from_this()->instanceof (eTYPE_ENEMY); } bool Mob::isLeashed() { return _isLeashed; } @@ -862,8 +864,7 @@ void Mob::restoreLeashFromSave() { } } delete livingEnts; - } else if (leashInfoTag->contains("X") && - leashInfoTag->contains("Y") && + } else if (leashInfoTag->contains("X") && leashInfoTag->contains("Y") && leashInfoTag->contains("Z")) { int x = leashInfoTag->getInt("X"); int y = leashInfoTag->getInt("Y"); diff --git a/targets/minecraft/world/entity/Painting.cpp b/targets/minecraft/world/entity/Painting.cpp index 1f70f23c1..651db9d30 100644 --- a/targets/minecraft/world/entity/Painting.cpp +++ b/targets/minecraft/world/entity/Painting.cpp @@ -1,10 +1,10 @@ -#include "minecraft/IGameServices.h" #include "Painting.h" #include #include #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/HangingEntity.h" #include "minecraft/world/entity/player/Abilities.h" @@ -138,7 +138,7 @@ int Painting::getWidth() { return motive->w; } int Painting::getHeight() { return motive->h; } void Painting::dropItem(std::shared_ptr causedBy) { - if ((causedBy != nullptr) && causedBy->instanceof(eTYPE_PLAYER)) { + if ((causedBy != nullptr) && causedBy->instanceof (eTYPE_PLAYER)) { std::shared_ptr player = std::dynamic_pointer_cast(causedBy); if (player->abilities.instabuild) { diff --git a/targets/minecraft/world/entity/Painting.h b/targets/minecraft/world/entity/Painting.h index 1f94ce25e..ba201f3b1 100644 --- a/targets/minecraft/world/entity/Painting.h +++ b/targets/minecraft/world/entity/Painting.h @@ -69,7 +69,7 @@ public: // private: Motive(std::string name, int w, int h, int uo, int vo) - : name(name), w(w), h(h), uo(uo), vo(vo) {}; + : name(name), w(w), h(h), uo(uo), vo(vo){}; }; public: diff --git a/targets/minecraft/world/entity/PathfinderMob.cpp b/targets/minecraft/world/entity/PathfinderMob.cpp index bb907cab2..7abfbe7ca 100644 --- a/targets/minecraft/world/entity/PathfinderMob.cpp +++ b/targets/minecraft/world/entity/PathfinderMob.cpp @@ -293,7 +293,8 @@ void PathfinderMob::tickLeash() { float _distanceTo = distanceTo(leashHolder); std::shared_ptr tamabaleAnimal = - shared_from_this()->instanceof(eTYPE_TAMABLE_ANIMAL) + shared_from_this()->instanceof + (eTYPE_TAMABLE_ANIMAL) ? std::dynamic_pointer_cast(shared_from_this()) : nullptr; if ((tamabaleAnimal != nullptr) && tamabaleAnimal->isSitting()) { diff --git a/targets/minecraft/world/entity/SyncedEntityData.cpp b/targets/minecraft/world/entity/SyncedEntityData.cpp index e688c554a..bbcae4ac0 100644 --- a/targets/minecraft/world/entity/SyncedEntityData.cpp +++ b/targets/minecraft/world/entity/SyncedEntityData.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "SyncedEntityData.h" #include @@ -8,6 +7,7 @@ #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/network/packet/Packet.h" +#include "minecraft/util/Log.h" class ItemInstance; diff --git a/targets/minecraft/world/entity/ai/attributes/AttributeModifier.cpp b/targets/minecraft/world/entity/ai/attributes/AttributeModifier.cpp index b8f844b97..763b83372 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/IGameServices.h" #include "AttributeModifier.h" #include #include #include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/HtmlString.h" #include "minecraft/world/entity/ai/attributes/Attribute.h" diff --git a/targets/minecraft/world/entity/ai/control/LookControl.cpp b/targets/minecraft/world/entity/ai/control/LookControl.cpp index cd79a000c..f25c65280 100644 --- a/targets/minecraft/world/entity/ai/control/LookControl.cpp +++ b/targets/minecraft/world/entity/ai/control/LookControl.cpp @@ -23,7 +23,7 @@ LookControl::LookControl(Mob* mob) { void LookControl::setLookAt(std::shared_ptr target, float yMax, float xMax) { wantedX = target->x; - if (target->instanceof(eTYPE_LIVINGENTITY)) + if (target->instanceof (eTYPE_LIVINGENTITY)) wantedY = target->y + std::dynamic_pointer_cast(target)->getHeadHeight(); diff --git a/targets/minecraft/world/entity/ai/goal/ControlledByPlayerGoal.cpp b/targets/minecraft/world/entity/ai/goal/ControlledByPlayerGoal.cpp index 14bbec987..690890dc6 100644 --- a/targets/minecraft/world/entity/ai/goal/ControlledByPlayerGoal.cpp +++ b/targets/minecraft/world/entity/ai/goal/ControlledByPlayerGoal.cpp @@ -56,8 +56,8 @@ void ControlledByPlayerGoal::stop() { bool ControlledByPlayerGoal::canUse() { return mob->isAlive() && mob->rider.lock() != nullptr && - mob->rider.lock()->instanceof(eTYPE_PLAYER) && - (boosting || mob->canBeControlledByRider()); + mob->rider.lock()->instanceof + (eTYPE_PLAYER) && (boosting || mob->canBeControlledByRider()); } void ControlledByPlayerGoal::tick() { diff --git a/targets/minecraft/world/entity/ai/goal/MeleeAttackGoal.cpp b/targets/minecraft/world/entity/ai/goal/MeleeAttackGoal.cpp index 983edc1fe..210b60fc7 100644 --- a/targets/minecraft/world/entity/ai/goal/MeleeAttackGoal.cpp +++ b/targets/minecraft/world/entity/ai/goal/MeleeAttackGoal.cpp @@ -45,7 +45,7 @@ bool MeleeAttackGoal::canUse() { std::shared_ptr target = mob->getTarget(); if (target == nullptr) return false; if (!target->isAlive()) return false; - if (attackType != eTYPE_NOTSET && !target->instanceof(attackType)) + if (attackType != eTYPE_NOTSET && !target->instanceof (attackType)) return false; path.reset(mob->getNavigation()->createPath(target)); return path != nullptr; diff --git a/targets/minecraft/world/entity/ai/goal/RunAroundLikeCrazyGoal.cpp b/targets/minecraft/world/entity/ai/goal/RunAroundLikeCrazyGoal.cpp index 17ec10374..3546061ba 100644 --- a/targets/minecraft/world/entity/ai/goal/RunAroundLikeCrazyGoal.cpp +++ b/targets/minecraft/world/entity/ai/goal/RunAroundLikeCrazyGoal.cpp @@ -46,7 +46,7 @@ bool RunAroundLikeCrazyGoal::canContinueToUse() { void RunAroundLikeCrazyGoal::tick() { if (horse->getRandom()->nextInt(50) == 0) { - if (horse->rider.lock()->instanceof(eTYPE_PLAYER)) { + if (horse->rider.lock()->instanceof (eTYPE_PLAYER)) { int temper = horse->getTemper(); int maxTemper = horse->getMaxTemper(); if (maxTemper > 0 && diff --git a/targets/minecraft/world/entity/ai/goal/target/NearestAttackableTargetGoal.cpp b/targets/minecraft/world/entity/ai/goal/target/NearestAttackableTargetGoal.cpp index a608824b8..f99285bdf 100644 --- a/targets/minecraft/world/entity/ai/goal/target/NearestAttackableTargetGoal.cpp +++ b/targets/minecraft/world/entity/ai/goal/target/NearestAttackableTargetGoal.cpp @@ -22,7 +22,7 @@ SubselectEntitySelector::SubselectEntitySelector( SubselectEntitySelector::~SubselectEntitySelector() { delete m_subselector; } bool SubselectEntitySelector::matches(std::shared_ptr entity) const { - if (!entity->instanceof(eTYPE_LIVINGENTITY)) return false; + if (!entity->instanceof (eTYPE_LIVINGENTITY)) return false; if (m_subselector != nullptr && !m_subselector->matches(entity)) return false; return m_parent->canAttack(std::dynamic_pointer_cast(entity), diff --git a/targets/minecraft/world/entity/ai/goal/target/TargetGoal.cpp b/targets/minecraft/world/entity/ai/goal/target/TargetGoal.cpp index 006d06428..4327a9759 100644 --- a/targets/minecraft/world/entity/ai/goal/target/TargetGoal.cpp +++ b/targets/minecraft/world/entity/ai/goal/target/TargetGoal.cpp @@ -88,7 +88,7 @@ bool TargetGoal::canAttack(std::shared_ptr target, // We're attacking our owner return false; } - } else if (target->instanceof(eTYPE_PLAYER)) { + } else if (target->instanceof (eTYPE_PLAYER)) { if (!allowInvulnerable && (std::dynamic_pointer_cast(target))->abilities.invulnerable) return false; diff --git a/targets/minecraft/world/entity/animal/Animal.cpp b/targets/minecraft/world/entity/animal/Animal.cpp index 8b2626a11..646bde3f8 100644 --- a/targets/minecraft/world/entity/animal/Animal.cpp +++ b/targets/minecraft/world/entity/animal/Animal.cpp @@ -77,7 +77,7 @@ void Animal::aiStep() { void Animal::checkHurtTarget(std::shared_ptr target, float d) { // 4J-JEV: Changed from dynamic cast to use eINSTANCEOF - if (target->instanceof(eTYPE_PLAYER)) { + if (target->instanceof (eTYPE_PLAYER)) { if (d < 3) { double xd = target->x - x; double zd = target->z - z; @@ -93,7 +93,7 @@ void Animal::checkHurtTarget(std::shared_ptr target, float d) { } // 4J-JEV: Changed from dynamic cast to use eINSTANCEOF - else if (target->instanceof(eTYPE_ANIMAL)) { + else if (target->instanceof (eTYPE_ANIMAL)) { std::shared_ptr a = std::dynamic_pointer_cast(target); if (getAge() > 0 && a->getAge() < 0) { if (d < 2.5) { @@ -179,22 +179,22 @@ bool Animal::hurt(DamageSource* dmgSource, float dmg) { std::shared_ptr source = dmgSource->getDirectEntity(); // 4J-JEV: Changed from dynamic cast to use eINSTANCEOF - if (source->instanceof(eTYPE_PLAYER) && - !std::dynamic_pointer_cast(source) - ->isAllowedToAttackAnimals()) { + if (source->instanceof + (eTYPE_PLAYER) && !std::dynamic_pointer_cast(source) + ->isAllowedToAttackAnimals()) { return false; } - if ((source != nullptr) && source->instanceof(eTYPE_ARROW)) { + if ((source != nullptr) && source->instanceof (eTYPE_ARROW)) { std::shared_ptr arrow = std::dynamic_pointer_cast(source); // 4J: Check that the arrow's owner can attack animals (dispenser // arrows are not owned) - if (arrow->owner != nullptr && - arrow->owner->instanceof(eTYPE_PLAYER) && - !std::dynamic_pointer_cast(arrow->owner) - ->isAllowedToAttackAnimals()) { + if (arrow->owner != nullptr && arrow->owner->instanceof + (eTYPE_PLAYER) && + !std::dynamic_pointer_cast(arrow->owner) + ->isAllowedToAttackAnimals()) { return false; } } @@ -352,7 +352,7 @@ bool Animal::mobInteract(std::shared_ptr player) { return false; } - } else if (instanceof(eTYPE_MONSTER)) { + } else if (instanceof (eTYPE_MONSTER)) { } break; } diff --git a/targets/minecraft/world/entity/animal/EntityHorse.cpp b/targets/minecraft/world/entity/animal/EntityHorse.cpp index e85b371c1..25a164de7 100644 --- a/targets/minecraft/world/entity/animal/EntityHorse.cpp +++ b/targets/minecraft/world/entity/animal/EntityHorse.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "EntityHorse.h" #include @@ -7,11 +6,11 @@ #include #include -#include "util/StringHelpers.h" #include "java/Random.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/sounds/SoundTypes.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/effect/MobEffect.h" @@ -51,6 +50,7 @@ #include "minecraft/world/phys/AABB.h" #include "nbt/CompoundTag.h" #include "nbt/ListTag.h" +#include "util/StringHelpers.h" class EntitySelector; class Path; @@ -70,8 +70,8 @@ std::string EntityHorse::ARMOR_TEXTURES[EntityHorse::ARMORS] = { int EntityHorse::ARMOR_TEXTURES_ID[EntityHorse::ARMORS] = { -1, TN_MOB_HORSE_ARMOR_IRON, TN_MOB_HORSE_ARMOR_GOLD, TN_MOB_HORSE_ARMOR_DIAMOND}; -std::string EntityHorse::ARMOR_HASHES[EntityHorse::ARMORS] = {"", "meo", - "goo", "dio"}; +std::string EntityHorse::ARMOR_HASHES[EntityHorse::ARMORS] = {"", "meo", "goo", + "dio"}; int EntityHorse::ARMOR_PROTECTION[EntityHorse::ARMORS] = {0, 5, 7, 11}; std::string EntityHorse::VARIANT_TEXTURES[EntityHorse::VARIANTS] = { @@ -96,8 +96,9 @@ std::string EntityHorse::MARKING_HASHES[EntityHorse::MARKINGS] = { "", "wo_", "wmo", "wdo", "bdo"}; bool HorseEntitySelector::matches(std::shared_ptr entity) const { - return entity->instanceof(eTYPE_HORSE) && - std::dynamic_pointer_cast(entity)->isBred(); + return entity->instanceof + (eTYPE_HORSE) && + std::dynamic_pointer_cast(entity)->isBred(); } EntityHorse::EntityHorse(Level* level) : Animal(level) { @@ -311,7 +312,7 @@ bool EntityHorse::hurt(DamageSource* damagesource, float dmg) { // 4J: Protect owned horses from untrusted players if (isTamed()) { std::shared_ptr entity = damagesource->getDirectEntity(); - if (entity != nullptr && entity->instanceof(eTYPE_PLAYER)) { + if (entity != nullptr && entity->instanceof (eTYPE_PLAYER)) { std::shared_ptr attacker = std::dynamic_pointer_cast(entity); attacker->canHarmPlayer(getOwnerName()); @@ -840,10 +841,9 @@ bool EntityHorse::mobInteract(std::shared_ptr player) { } doPlayerRide(player); - Log::info( - " Horse speed: %f\n", - (float)(getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED) - ->getValue())); + Log::info(" Horse speed: %f\n", + (float)(getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED) + ->getValue())); return true; } else { @@ -1224,11 +1224,11 @@ void EntityHorse::addAdditonalSaveData(CompoundTag* tag) { if (inventory->getItem(INV_SLOT_ARMOR) != nullptr) { tag->put("ArmorItem", inventory->getItem(INV_SLOT_ARMOR) - ->save(new CompoundTag("ArmorItem"))); + ->save(new CompoundTag("ArmorItem"))); } if (inventory->getItem(INV_SLOT_SADDLE) != nullptr) { tag->put("SaddleItem", inventory->getItem(INV_SLOT_SADDLE) - ->save(new CompoundTag("SaddleItem"))); + ->save(new CompoundTag("SaddleItem"))); } } @@ -1508,7 +1508,7 @@ void EntityHorse::positionRider() { y + getRideHeight() + rider.lock()->getRidingHeight() + height, z - dist * cos); - if (rider.lock()->instanceof(eTYPE_LIVINGENTITY)) { + if (rider.lock()->instanceof (eTYPE_LIVINGENTITY)) { std::shared_ptr livingRider = std::dynamic_pointer_cast(rider.lock()); livingRider->yBodyRot = yBodyRot; diff --git a/targets/minecraft/world/entity/animal/Ocelot.cpp b/targets/minecraft/world/entity/animal/Ocelot.cpp index 235866317..61fdd4298 100644 --- a/targets/minecraft/world/entity/animal/Ocelot.cpp +++ b/targets/minecraft/world/entity/animal/Ocelot.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "Ocelot.h" #include @@ -6,9 +5,8 @@ #include #include -#include "platform/input/input.h" -#include "util/StringHelpers.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" @@ -49,6 +47,8 @@ #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/phys/AABB.h" #include "nbt/CompoundTag.h" +#include "platform/input/input.h" +#include "util/StringHelpers.h" const double Ocelot::SNEAK_SPEED_MOD = 0.6; const double Ocelot::WALK_SPEED_MOD = 0.8; diff --git a/targets/minecraft/world/entity/animal/Pig.cpp b/targets/minecraft/world/entity/animal/Pig.cpp index e432cbdaa..475152b3a 100644 --- a/targets/minecraft/world/entity/animal/Pig.cpp +++ b/targets/minecraft/world/entity/animal/Pig.cpp @@ -150,8 +150,8 @@ void Pig::thunderHit(const LightningBolt* lightningBolt) { void Pig::causeFallDamage(float distance) { Animal::causeFallDamage(distance); - if ((distance > 5) && rider.lock() != nullptr && - rider.lock()->instanceof(eTYPE_PLAYER)) { + if ((distance > 5) && rider.lock() != nullptr && rider.lock()->instanceof + (eTYPE_PLAYER)) { (std::dynamic_pointer_cast(rider.lock())) ->awardStat(GenericStats::flyPig(), GenericStats::param_flyPig()); } diff --git a/targets/minecraft/world/entity/animal/VillagerGolem.cpp b/targets/minecraft/world/entity/animal/VillagerGolem.cpp index bc1ee2630..51f18ca7c 100644 --- a/targets/minecraft/world/entity/animal/VillagerGolem.cpp +++ b/targets/minecraft/world/entity/animal/VillagerGolem.cpp @@ -110,7 +110,7 @@ int VillagerGolem::decreaseAirSupply(int currentSupply) { } void VillagerGolem::doPush(std::shared_ptr e) { - if (e->instanceof(eTYPE_ENEMY)) { + if (e->instanceof (eTYPE_ENEMY)) { if (getRandom()->nextInt(20) == 0) { setTarget(std::dynamic_pointer_cast(e)); } @@ -239,7 +239,7 @@ bool VillagerGolem::hurt(DamageSource* source, float dmg) { // 4J: Protect owned golem from untrusted players if (isPlayerCreated()) { std::shared_ptr entity = source->getDirectEntity(); - if (entity != nullptr && entity->instanceof(eTYPE_PLAYER)) { + if (entity != nullptr && entity->instanceof (eTYPE_PLAYER)) { std::shared_ptr player = std::dynamic_pointer_cast(entity); if (!player->isAllowedToAttackPlayers()) return false; diff --git a/targets/minecraft/world/entity/animal/Wolf.cpp b/targets/minecraft/world/entity/animal/Wolf.cpp index fb0ce2c3c..293adc7ad 100644 --- a/targets/minecraft/world/entity/animal/Wolf.cpp +++ b/targets/minecraft/world/entity/animal/Wolf.cpp @@ -6,7 +6,6 @@ #include #include "Sheep.h" -#include "util/StringHelpers.h" #include "java/Random.h" #include "minecraft/SharedConstants.h" #include "minecraft/core/particles/ParticleTypes.h" @@ -50,6 +49,7 @@ #include "minecraft/world/level/tile/ColoredTile.h" #include "minecraft/world/phys/AABB.h" #include "nbt/CompoundTag.h" +#include "util/StringHelpers.h" Wolf::Wolf(Level* level) : TamableAnimal(level) { // 4J Stu - This function call had to be moved here from the Entity ctor to @@ -262,7 +262,7 @@ bool Wolf::hurt(DamageSource* source, float dmg) { // 4J: Protect owned wolves from untrusted players if (isTame()) { std::shared_ptr entity = source->getDirectEntity(); - if (entity != nullptr && entity->instanceof(eTYPE_PLAYER)) { + if (entity != nullptr && entity->instanceof (eTYPE_PLAYER)) { std::shared_ptr attacker = std::dynamic_pointer_cast(entity); attacker->canHarmPlayer(getOwnerUUID()); @@ -272,8 +272,9 @@ bool Wolf::hurt(DamageSource* source, float dmg) { if (isInvulnerable()) return false; std::shared_ptr sourceEntity = source->getEntity(); sitGoal->wantToSit(false); - if (sourceEntity != nullptr && !(sourceEntity->instanceof(eTYPE_PLAYER) || - sourceEntity->instanceof(eTYPE_ARROW))) { + if (sourceEntity != nullptr && + !(sourceEntity->instanceof (eTYPE_PLAYER) || sourceEntity->instanceof + (eTYPE_ARROW))) { // Take half damage from non-players and arrows dmg = (dmg + 1) / 2; } @@ -487,7 +488,7 @@ bool Wolf::canMate(std::shared_ptr animal) { if (animal == shared_from_this()) return false; if (!isTame()) return false; - if (!animal->instanceof(eTYPE_WOLF)) return false; + if (!animal->instanceof (eTYPE_WOLF)) return false; std::shared_ptr partner = std::dynamic_pointer_cast(animal); if (partner == nullptr) return false; @@ -520,9 +521,10 @@ bool Wolf::wantsToAttack(std::shared_ptr target, return false; } } - if (target->instanceof(eTYPE_PLAYER) && owner->instanceof(eTYPE_PLAYER) && - !std::dynamic_pointer_cast(owner)->canHarmPlayer( - std::dynamic_pointer_cast(target))) { + if (target->instanceof (eTYPE_PLAYER) && owner->instanceof + (eTYPE_PLAYER) && + !std::dynamic_pointer_cast(owner)->canHarmPlayer( + std::dynamic_pointer_cast(target))) { // pvp is off return false; } diff --git a/targets/minecraft/world/entity/boss/enderdragon/EnderCrystal.cpp b/targets/minecraft/world/entity/boss/enderdragon/EnderCrystal.cpp index 5fb271662..9b8b9874f 100644 --- a/targets/minecraft/world/entity/boss/enderdragon/EnderCrystal.cpp +++ b/targets/minecraft/world/entity/boss/enderdragon/EnderCrystal.cpp @@ -74,8 +74,8 @@ bool EnderCrystal::hurt(DamageSource* source, float damage) { // 4J-PB - if the owner of the source is the enderdragon, then ignore it // (where the dragon's fireball hits an endercrystal) - if (source->getEntity() != nullptr && - source->getEntity()->instanceof(eTYPE_ENDERDRAGON)) { + if (source->getEntity() != nullptr && source->getEntity()->instanceof + (eTYPE_ENDERDRAGON)) { return false; } diff --git a/targets/minecraft/world/entity/boss/enderdragon/EnderDragon.cpp b/targets/minecraft/world/entity/boss/enderdragon/EnderDragon.cpp index 046b974e4..9c29013d4 100644 --- a/targets/minecraft/world/entity/boss/enderdragon/EnderDragon.cpp +++ b/targets/minecraft/world/entity/boss/enderdragon/EnderDragon.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "EnderDragon.h" #include @@ -10,6 +9,7 @@ #include "minecraft/SharedConstants.h" #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/sounds/SoundTypes.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/entity/Entity.h" @@ -482,7 +482,7 @@ void EnderDragon::aiStep() { level->getEntities(shared_from_this(), &m_acidArea); for (auto it = targets->begin(); it != targets->end(); ++it) { - if ((*it)->instanceof(eTYPE_LIVINGENTITY)) { + if ((*it)->instanceof (eTYPE_LIVINGENTITY)) { // Log::info("Attacking entity with acid\n"); std::shared_ptr e = std::dynamic_pointer_cast(*it); @@ -878,7 +878,7 @@ void EnderDragon::knockBack(std::vector >* entities) { // for (Entity e : entities) for (auto it = entities->begin(); it != entities->end(); ++it) { - if ((*it)->instanceof(eTYPE_LIVINGENTITY)) //(e instanceof Mob) + if ((*it)->instanceof (eTYPE_LIVINGENTITY)) //(e instanceof Mob) { std::shared_ptr e = std::dynamic_pointer_cast(*it); @@ -893,7 +893,7 @@ void EnderDragon::knockBack(std::vector >* entities) { void EnderDragon::hurt(std::vector >* entities) { // for (int i = 0; i < entities->size(); i++) for (auto it = entities->begin(); it != entities->end(); ++it) { - if ((*it)->instanceof(eTYPE_LIVINGENTITY)) //(e instanceof Mob) + if ((*it)->instanceof (eTYPE_LIVINGENTITY)) //(e instanceof Mob) { std::shared_ptr e = std::dynamic_pointer_cast( @@ -1147,9 +1147,8 @@ bool EnderDragon::hurt(std::shared_ptr MultiEntityMobPart, // zTarget = z - cc1 * 5 + (random->nextFloat() - 0.5f) * 2; // attackTarget = nullptr; - if (source->getEntity() != nullptr && - source->getEntity()->instanceof(eTYPE_PLAYER) || - source->isExplosion()) { + if (source->getEntity() != nullptr && source->getEntity()->instanceof + (eTYPE_PLAYER) || source->isExplosion()) { int healthBefore = getHealth(); reallyHurt(source, damage); @@ -1433,7 +1432,7 @@ bool EnderDragon::setSynchedAction(EEnderdragonAction action, entityData->set(DATA_ID_SYNCHED_ACTION, action); } else { Log::info("EnderDragon: Invalid state transition from %d to %d\n", - getSynchedAction(), action); + getSynchedAction(), action); } return force || validTransition; @@ -1469,8 +1468,8 @@ void EnderDragon::handleCrystalDestroyed(DamageSource* source) { Log::info("Dragon action is now: LandingApproach\n"); #endif } - } else if (source->getEntity() != nullptr && - source->getEntity()->instanceof(eTYPE_PLAYER)) { + } else if (source->getEntity() != nullptr && source->getEntity()->instanceof + (eTYPE_PLAYER)) { if (setSynchedAction(e_EnderdragonAction_StrafePlayer)) { attackTarget = std::dynamic_pointer_cast(source->getEntity()); @@ -1529,10 +1528,9 @@ void EnderDragon::navigateToNextPathNode() { } while (yTarget < (curr.y)); } zTarget = curr.z; - Log::info("Path node pos is (%f,%f,%f)\n", curr.x, curr.y, - curr.z); + Log::info("Path node pos is (%f,%f,%f)\n", curr.x, curr.y, curr.z); Log::info("Setting new target to (%f,%f,%f)\n", xTarget, yTarget, - zTarget); + zTarget); } } @@ -1576,8 +1574,7 @@ int EnderDragon::findClosestNode() { std::max((level->seaLevel + 10), level->getTopSolidBlock(nodeX, nodeZ) + yAdjustment); - Log::info("Node %d is at (%d,%d,%d)\n", i, nodeX, nodeY, - nodeZ); + Log::info("Node %d is at (%d,%d,%d)\n", i, nodeX, nodeY, nodeZ); (*m_nodes)[i] = new Node(nodeX, nodeY, nodeZ); @@ -1726,8 +1723,7 @@ Path* EnderDragon::findPath(int startIndex, int endIndex, } if (closest == from) return nullptr; - Log::info("Failed to find path from %d to %d\n", startIndex, - endIndex); + Log::info("Failed to find path from %d to %d\n", startIndex, endIndex); if (finalNode != nullptr) { finalNode->cameFrom = closest; closest = finalNode; @@ -1875,9 +1871,7 @@ double EnderDragon::getHeadPartYRotDiff(int partIndex, // result = m_headYRot / (7 - partIndex); // } // else - { - result = partPos[0] - bodyPos[0]; - } + { result = partPos[0] - bodyPos[0]; } // Log::info("Part %d is at %f\n", partIndex, result); return result; } diff --git a/targets/minecraft/world/entity/boss/enderdragon/EnderDragon.h b/targets/minecraft/world/entity/boss/enderdragon/EnderDragon.h index 63b05728a..5331dc29c 100644 --- a/targets/minecraft/world/entity/boss/enderdragon/EnderDragon.h +++ b/targets/minecraft/world/entity/boss/enderdragon/EnderDragon.h @@ -5,8 +5,8 @@ #include #include -#include "minecraft/IGameServices.h" #include "java/Class.h" +#include "minecraft/IGameServices.h" #include "minecraft/stdafx.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/Mob.h" @@ -207,7 +207,9 @@ public: std::vector& partPos); Vec3 getHeadLookVector(float a); - virtual std::string getAName() { return gameServices().getString(IDS_ENDERDRAGON); }; + virtual std::string 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.cpp b/targets/minecraft/world/entity/boss/wither/WitherBoss.cpp index 8dce2a1c3..864d58001 100644 --- a/targets/minecraft/world/entity/boss/wither/WitherBoss.cpp +++ b/targets/minecraft/world/entity/boss/wither/WitherBoss.cpp @@ -43,7 +43,7 @@ #include "nbt/CompoundTag.h" bool LivingEntitySelector::matches(std::shared_ptr entity) const { - if (entity->instanceof(eTYPE_LIVINGENTITY)) { + if (entity->instanceof (eTYPE_LIVINGENTITY)) { return std::dynamic_pointer_cast(entity)->getMobType() != UNDEAD; } else { @@ -261,10 +261,9 @@ void WitherBoss::newServerAiStep() { // 4J: Added check for instance of living entity, had a problem // with IDs being recycled to other entities - if (current == nullptr || - !current->instanceof(eTYPE_LIVINGENTITY) || - !current->isAlive() || distanceToSqr(current) > 30 * 30 || - !canSee(current)) { + if (current == nullptr || !current->instanceof + (eTYPE_LIVINGENTITY) || !current->isAlive() || + distanceToSqr(current) > 30 * 30 || !canSee(current)) { setAlternativeTarget(i, 0); } else { performRangedAttack( @@ -290,16 +289,16 @@ void WitherBoss::newServerAiStep() { if (selected != shared_from_this() && selected->isAlive() && canSee(selected)) { - if (selected->instanceof(eTYPE_PLAYER)) { + if (selected->instanceof (eTYPE_PLAYER)) { if (!std::dynamic_pointer_cast(selected) ->abilities.invulnerable) { - assert( - selected->instanceof(eTYPE_LIVINGENTITY)); + assert(selected->instanceof + (eTYPE_LIVINGENTITY)); setAlternativeTarget(i, selected->entityId); } break; } else { - assert(selected->instanceof(eTYPE_LIVINGENTITY)); + assert(selected->instanceof (eTYPE_LIVINGENTITY)); setAlternativeTarget(i, selected->entityId); break; } @@ -312,7 +311,7 @@ void WitherBoss::newServerAiStep() { } } if (getTarget() != nullptr) { - assert(getTarget()->instanceof(eTYPE_LIVINGENTITY)); + assert(getTarget()->instanceof (eTYPE_LIVINGENTITY)); setAlternativeTarget(0, getTarget()->entityId); } else { setAlternativeTarget(0, 0); @@ -458,10 +457,11 @@ bool WitherBoss::hurt(DamageSource* source, float dmg) { std::shared_ptr sourceEntity = source->getEntity(); if (sourceEntity != nullptr) { - if (sourceEntity->instanceof(eTYPE_PLAYER)) { - } else if (sourceEntity->instanceof(eTYPE_LIVINGENTITY) && - std::dynamic_pointer_cast(sourceEntity) - ->getMobType() == getMobType()) { + if (sourceEntity->instanceof (eTYPE_PLAYER)) { + } else if (sourceEntity->instanceof + (eTYPE_LIVINGENTITY) && + std::dynamic_pointer_cast(sourceEntity) + ->getMobType() == getMobType()) { // can't be harmed by other undead return false; } diff --git a/targets/minecraft/world/entity/boss/wither/WitherBoss.h b/targets/minecraft/world/entity/boss/wither/WitherBoss.h index 77031b494..c821f0f8d 100644 --- a/targets/minecraft/world/entity/boss/wither/WitherBoss.h +++ b/targets/minecraft/world/entity/boss/wither/WitherBoss.h @@ -3,8 +3,8 @@ #include #include -#include "minecraft/IGameServices.h" #include "java/Class.h" +#include "minecraft/IGameServices.h" #include "minecraft/stdafx.h" #include "minecraft/world/entity/EntitySelector.h" #include "minecraft/world/entity/MobType.h" @@ -120,5 +120,7 @@ public: // 4J Stu - These are required for the BossMob interface virtual float getMaxHealth() { return Monster::getMaxHealth(); }; virtual float getHealth() { return Monster::getHealth(); }; - virtual std::string getAName() { return gameServices().getString(IDS_WITHER); }; + virtual std::string getAName() { + return gameServices().getString(IDS_WITHER); + }; }; \ No newline at end of file diff --git a/targets/minecraft/world/entity/global/GlobalEntity.h b/targets/minecraft/world/entity/global/GlobalEntity.h index 2247ce7f6..b7c5ae576 100644 --- a/targets/minecraft/world/entity/global/GlobalEntity.h +++ b/targets/minecraft/world/entity/global/GlobalEntity.h @@ -6,5 +6,5 @@ class Level; // class GlobalEntity : public Entity class GlobalEntity : public Entity { public: - GlobalEntity(Level* level) : Entity(level) {}; + GlobalEntity(Level* level) : Entity(level){}; }; \ No newline at end of file diff --git a/targets/minecraft/world/entity/global/LightningBolt.h b/targets/minecraft/world/entity/global/LightningBolt.h index b9a24565f..06da70736 100644 --- a/targets/minecraft/world/entity/global/LightningBolt.h +++ b/targets/minecraft/world/entity/global/LightningBolt.h @@ -5,7 +5,6 @@ #include "GlobalEntity.h" #include "java/Class.h" - class Level; // class LightningBolt : public GlobalEntity diff --git a/targets/minecraft/world/entity/item/Boat.cpp b/targets/minecraft/world/entity/item/Boat.cpp index 9c438d17d..afa2118f6 100644 --- a/targets/minecraft/world/entity/item/Boat.cpp +++ b/targets/minecraft/world/entity/item/Boat.cpp @@ -87,9 +87,10 @@ bool Boat::hurt(DamageSource* source, float hurtDamage) { if (dynamic_cast(source) != nullptr) { std::shared_ptr attacker = source->getDirectEntity(); - if (attacker->instanceof(eTYPE_PLAYER) && - !std::dynamic_pointer_cast(attacker)->isAllowedToHurtEntity( - shared_from_this())) { + if (attacker->instanceof + (eTYPE_PLAYER) && + !std::dynamic_pointer_cast(attacker) + ->isAllowedToHurtEntity(shared_from_this())) { return false; } } @@ -111,9 +112,9 @@ bool Boat::hurt(DamageSource* source, float hurtDamage) { // Minecarts and boat requires more hits than one to be destroyed in // creative mode 4J-PB - Fix for XB1 #175735 - [CRASH] [Multi-Plat]: Code: // Gameplay: Placing a boat on harmful surfaces causes the game to crash - bool creativePlayer = (source->getEntity() != nullptr) && - source->getEntity()->instanceof(eTYPE_PLAYER) && - std::dynamic_pointer_cast(source->getEntity()) + bool creativePlayer = + (source->getEntity() != nullptr) && source->getEntity()->instanceof + (eTYPE_PLAYER) && std::dynamic_pointer_cast(source->getEntity()) ->abilities.instabuild; if (creativePlayer || getDamage() > 20 * 2) { @@ -253,8 +254,8 @@ void Boat::tick() { yd += 0.007f; } - if (rider.lock() != nullptr && - rider.lock()->instanceof(eTYPE_LIVINGENTITY)) { + if (rider.lock() != nullptr && rider.lock()->instanceof + (eTYPE_LIVINGENTITY)) { std::shared_ptr livingRider = std::dynamic_pointer_cast(rider.lock()); double forward = livingRider->yya; @@ -379,8 +380,8 @@ float Boat::getShadowHeightOffs() { return 0; } std::string Boat::getName() { return "Boat"; } bool Boat::interact(std::shared_ptr player) { - if ((rider.lock() != nullptr) && rider.lock()->instanceof(eTYPE_PLAYER) && - (rider.lock() != player)) + if ((rider.lock() != nullptr) && rider.lock()->instanceof + (eTYPE_PLAYER) && (rider.lock() != player)) return true; if (!level->isClientSide) { // 4J HEG - Fixed issue with player not being able to dismount boat diff --git a/targets/minecraft/world/entity/item/ItemEntity.cpp b/targets/minecraft/world/entity/item/ItemEntity.cpp index 98935d20c..6efb5e5a2 100644 --- a/targets/minecraft/world/entity/item/ItemEntity.cpp +++ b/targets/minecraft/world/entity/item/ItemEntity.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "ItemEntity.h" #include @@ -12,6 +11,7 @@ #include "java/Random.h" #include "minecraft/sounds/SoundTypes.h" #include "minecraft/stats/GenericStats.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/entity/Entity.h" diff --git a/targets/minecraft/world/entity/item/Minecart.cpp b/targets/minecraft/world/entity/item/Minecart.cpp index 6a732674a..db3694254 100644 --- a/targets/minecraft/world/entity/item/Minecart.cpp +++ b/targets/minecraft/world/entity/item/Minecart.cpp @@ -153,9 +153,10 @@ bool Minecart::hurt(DamageSource* source, float hurtDamage) { if (dynamic_cast(source) != nullptr) { std::shared_ptr attacker = source->getDirectEntity(); - if (attacker->instanceof(eTYPE_PLAYER) && - !std::dynamic_pointer_cast(attacker)->isAllowedToHurtEntity( - shared_from_this())) { + if (attacker->instanceof + (eTYPE_PLAYER) && + !std::dynamic_pointer_cast(attacker) + ->isAllowedToHurtEntity(shared_from_this())) { return false; } } @@ -172,9 +173,9 @@ bool Minecart::hurt(DamageSource* source, float hurtDamage) { if (rider.lock() != nullptr && rider.lock() == source->getEntity()) hurtDamage += 1; - bool creativePlayer = source->getEntity() != nullptr && - source->getEntity()->instanceof(eTYPE_PLAYER) && - std::dynamic_pointer_cast(source->getEntity()) + bool creativePlayer = + source->getEntity() != nullptr && source->getEntity()->instanceof + (eTYPE_PLAYER) && std::dynamic_pointer_cast(source->getEntity()) ->abilities.instabuild; if (creativePlayer || getDamage() > 20 * 2) { @@ -335,8 +336,8 @@ void Minecart::tick() { auto itEnd = entities->end(); for (auto it = entities->begin(); it != itEnd; it++) { std::shared_ptr e = (*it); // entities->at(i); - if (e != rider.lock() && e->isPushable() && - e->instanceof(eTYPE_MINECART)) { + if (e != rider.lock() && e->isPushable() && e->instanceof + (eTYPE_MINECART)) { std::shared_ptr cart = std::dynamic_pointer_cast(e); cart->m_bHasPushedCartThisTick = false; @@ -430,8 +431,8 @@ void Minecart::moveAlongTrack(int xt, int yt, int zt, double maxSpeed, xd = pow * xD / dd; zd = pow * zD / dd; - if (rider.lock() != nullptr && - rider.lock()->instanceof(eTYPE_LIVINGENTITY)) { + if (rider.lock() != nullptr && rider.lock()->instanceof + (eTYPE_LIVINGENTITY)) { std::shared_ptr living = std::dynamic_pointer_cast(rider.lock()); @@ -718,9 +719,10 @@ void Minecart::push(std::shared_ptr e) { if (level->isClientSide) return; if (e == rider.lock()) return; - if (e->instanceof(eTYPE_LIVINGENTITY) && !e->instanceof(eTYPE_PLAYER) && - !e->instanceof(eTYPE_VILLAGERGOLEM) && (getType() == TYPE_RIDEABLE) && - (xd * xd + zd * zd > 0.01)) { + if (e->instanceof (eTYPE_LIVINGENTITY) && !e->instanceof + (eTYPE_PLAYER) && !e->instanceof + (eTYPE_VILLAGERGOLEM) && (getType() == TYPE_RIDEABLE) && + (xd * xd + zd * zd > 0.01)) { if ((rider.lock() == nullptr) && (e->riding == nullptr)) { e->ride(shared_from_this()); } @@ -746,7 +748,7 @@ void Minecart::push(std::shared_ptr e) { xa *= 0.5; za *= 0.5; - if (e->instanceof(eTYPE_MINECART)) { + if (e->instanceof (eTYPE_MINECART)) { double xo = e->x - x; double zo = e->z - z; diff --git a/targets/minecraft/world/entity/item/MinecartContainer.cpp b/targets/minecraft/world/entity/item/MinecartContainer.cpp index 08294dbd2..1a2113c35 100644 --- a/targets/minecraft/world/entity/item/MinecartContainer.cpp +++ b/targets/minecraft/world/entity/item/MinecartContainer.cpp @@ -1,9 +1,9 @@ -#include "minecraft/IGameServices.h" #include "MinecartContainer.h" #include #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/world/Container.h" #include "minecraft/world/entity/item/ItemEntity.h" #include "minecraft/world/entity/item/Minecart.h" diff --git a/targets/minecraft/world/entity/item/MinecartRideable.cpp b/targets/minecraft/world/entity/item/MinecartRideable.cpp index e094947a2..69e58982f 100644 --- a/targets/minecraft/world/entity/item/MinecartRideable.cpp +++ b/targets/minecraft/world/entity/item/MinecartRideable.cpp @@ -21,8 +21,8 @@ MinecartRideable::MinecartRideable(Level* level, double x, double y, double z) } bool MinecartRideable::interact(std::shared_ptr player) { - if (rider.lock() != nullptr && rider.lock()->instanceof(eTYPE_PLAYER) && - rider.lock() != player) + if (rider.lock() != nullptr && rider.lock()->instanceof + (eTYPE_PLAYER) && rider.lock() != player) return true; if (rider.lock() != nullptr && rider.lock() != player) return false; if (!level->isClientSide) { diff --git a/targets/minecraft/world/entity/monster/CaveSpider.cpp b/targets/minecraft/world/entity/monster/CaveSpider.cpp index 7ac2661e6..6e8cf0c2f 100644 --- a/targets/minecraft/world/entity/monster/CaveSpider.cpp +++ b/targets/minecraft/world/entity/monster/CaveSpider.cpp @@ -29,7 +29,7 @@ void CaveSpider::registerAttributes() { bool CaveSpider::doHurtTarget(std::shared_ptr target) { if (Spider::doHurtTarget(target)) { - if (target->instanceof(eTYPE_LIVINGENTITY)) { + if (target->instanceof (eTYPE_LIVINGENTITY)) { int poisonTime = 0; if (level->difficulty <= Difficulty::EASY) { // No poison! diff --git a/targets/minecraft/world/entity/monster/Creeper.cpp b/targets/minecraft/world/entity/monster/Creeper.cpp index a2efbdadf..0e379afd2 100644 --- a/targets/minecraft/world/entity/monster/Creeper.cpp +++ b/targets/minecraft/world/entity/monster/Creeper.cpp @@ -140,8 +140,8 @@ int Creeper::getDeathSound() { return eSoundType_MOB_CREEPER_DEATH; } void Creeper::die(DamageSource* source) { Monster::die(source); - if (source->getEntity() != nullptr && - source->getEntity()->instanceof(eTYPE_SKELETON)) { + if (source->getEntity() != nullptr && source->getEntity()->instanceof + (eTYPE_SKELETON)) { int recordId = Item::record_01_Id + random->nextInt(Item::record_12_Id - Item::record_01_Id + 1); @@ -149,9 +149,10 @@ void Creeper::die(DamageSource* source) { } if (source->getDirectEntity() != nullptr && - source->getDirectEntity()->instanceof(eTYPE_ARROW) && - source->getEntity() != nullptr && - source->getEntity()->instanceof(eTYPE_PLAYER)) { + source->getDirectEntity()->instanceof + (eTYPE_ARROW) && source->getEntity() != nullptr && + source->getEntity()->instanceof + (eTYPE_PLAYER)) { std::shared_ptr player = std::dynamic_pointer_cast(source->getEntity()); player->awardStat(GenericStats::archer(), GenericStats::param_archer()); diff --git a/targets/minecraft/world/entity/monster/EnderMan.cpp b/targets/minecraft/world/entity/monster/EnderMan.cpp index 0f7362210..e7f56423f 100644 --- a/targets/minecraft/world/entity/monster/EnderMan.cpp +++ b/targets/minecraft/world/entity/monster/EnderMan.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "EnderMan.h" #include @@ -9,6 +8,7 @@ #include #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/sounds/SoundTypes.h" #include "minecraft/util/Mth.h" @@ -239,9 +239,10 @@ void EnderMan::aiStep() { if (!level->isClientSide && isAlive()) { if (attackTarget != nullptr) { - if (attackTarget->instanceof(eTYPE_PLAYER) && - isLookingAtMe( - std::dynamic_pointer_cast(attackTarget))) { + if (attackTarget->instanceof + (eTYPE_PLAYER) && + isLookingAtMe( + std::dynamic_pointer_cast(attackTarget))) { if (attackTarget->distanceToSqr(shared_from_this()) < 4 * 4) { teleport(); } @@ -380,7 +381,8 @@ bool EnderMan::hurt(DamageSource* source, float damage) { setCreepy(true); if (dynamic_cast(source) != nullptr && - source->getEntity()->instanceof(eTYPE_PLAYER)) { + source->getEntity()->instanceof + (eTYPE_PLAYER)) { aggroedByPlayer = true; } diff --git a/targets/minecraft/world/entity/monster/Enemy.cpp b/targets/minecraft/world/entity/monster/Enemy.cpp index 2287f73d3..919b72fb1 100644 --- a/targets/minecraft/world/entity/monster/Enemy.cpp +++ b/targets/minecraft/world/entity/monster/Enemy.cpp @@ -10,5 +10,5 @@ class EntitySelector; EntitySelector* Enemy::ENEMY_SELECTOR = new Enemy::EnemyEntitySelector(); bool Enemy::EnemyEntitySelector::matches(std::shared_ptr entity) const { - return (entity != nullptr) && entity->instanceof(eTYPE_ENEMY); + return (entity != nullptr) && entity->instanceof (eTYPE_ENEMY); } \ No newline at end of file diff --git a/targets/minecraft/world/entity/monster/Ghast.cpp b/targets/minecraft/world/entity/monster/Ghast.cpp index 50d675a27..08480e32e 100644 --- a/targets/minecraft/world/entity/monster/Ghast.cpp +++ b/targets/minecraft/world/entity/monster/Ghast.cpp @@ -61,8 +61,8 @@ bool Ghast::isCharging() { return entityData->getByte(DATA_IS_CHARGING) != 0; } bool Ghast::hurt(DamageSource* source, float dmg) { if (isInvulnerable()) return false; if (source->getMsgId() == ChatPacket::e_ChatDeathFireball) { - if ((source->getEntity() != nullptr) && - source->getEntity()->instanceof(eTYPE_PLAYER)) { + if ((source->getEntity() != nullptr) && source->getEntity()->instanceof + (eTYPE_PLAYER)) { // reflected fireball, kill the ghast FlyingMob::hurt(source, 1000); std::dynamic_pointer_cast(source->getEntity()) diff --git a/targets/minecraft/world/entity/monster/Monster.cpp b/targets/minecraft/world/entity/monster/Monster.cpp index f67789c4d..a474b9934 100644 --- a/targets/minecraft/world/entity/monster/Monster.cpp +++ b/targets/minecraft/world/entity/monster/Monster.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "Monster.h" #include @@ -7,6 +6,7 @@ #include #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" #include "minecraft/util/Mth.h" #include "minecraft/world/Difficulty.h" @@ -84,7 +84,7 @@ bool Monster::doHurtTarget(std::shared_ptr target) { (float)getAttribute(SharedMonsterAttributes::ATTACK_DAMAGE)->getValue(); int knockback = 0; - if (target->instanceof(eTYPE_LIVINGENTITY)) { + if (target->instanceof (eTYPE_LIVINGENTITY)) { std::shared_ptr livingTarget = std::dynamic_pointer_cast(target); dmg += EnchantmentHelper::getDamageBonus( @@ -115,7 +115,7 @@ bool Monster::doHurtTarget(std::shared_ptr target) { target->setOnFire(fireAspect * 4); } - if (target->instanceof(eTYPE_LIVINGENTITY)) { + if (target->instanceof (eTYPE_LIVINGENTITY)) { std::shared_ptr livingTarget = std::dynamic_pointer_cast(target); ThornsEnchantment::doThornsAfterAttack(shared_from_this(), diff --git a/targets/minecraft/world/entity/monster/PigZombie.cpp b/targets/minecraft/world/entity/monster/PigZombie.cpp index 33181d774..69ab1e76a 100644 --- a/targets/minecraft/world/entity/monster/PigZombie.cpp +++ b/targets/minecraft/world/entity/monster/PigZombie.cpp @@ -1,10 +1,10 @@ -#include "minecraft/IGameServices.h" #include "PigZombie.h" #include #include #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/sounds/SoundTypes.h" #include "minecraft/world/Difficulty.h" #include "minecraft/world/damageSource/DamageSource.h" @@ -105,14 +105,14 @@ std::shared_ptr PigZombie::findAttackTarget() { bool PigZombie::hurt(DamageSource* source, float dmg) { std::shared_ptr sourceEntity = source->getEntity(); - if (sourceEntity != nullptr && sourceEntity->instanceof(eTYPE_PLAYER)) { + if (sourceEntity != nullptr && sourceEntity->instanceof (eTYPE_PLAYER)) { AABB grown = bb.grow(32, 32, 32); std::vector >* nearby = level->getEntities(shared_from_this(), &grown); auto itEnd = nearby->end(); for (auto it = nearby->begin(); it != itEnd; it++) { std::shared_ptr e = *it; // nearby->at(i); - if (e->instanceof(eTYPE_PIGZOMBIE)) { + if (e->instanceof (eTYPE_PIGZOMBIE)) { std::shared_ptr pigZombie = std::dynamic_pointer_cast(e); pigZombie->alert(sourceEntity); diff --git a/targets/minecraft/world/entity/monster/SharedMonsterAttributes.cpp b/targets/minecraft/world/entity/monster/SharedMonsterAttributes.cpp index 22e54d356..6f1fcc531 100644 --- a/targets/minecraft/world/entity/monster/SharedMonsterAttributes.cpp +++ b/targets/minecraft/world/entity/monster/SharedMonsterAttributes.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "SharedMonsterAttributes.h" #include @@ -6,6 +5,7 @@ #include #include +#include "minecraft/util/Log.h" #include "minecraft/world/entity/ai/attributes/Attribute.h" #include "minecraft/world/entity/ai/attributes/AttributeInstance.h" #include "minecraft/world/entity/ai/attributes/AttributeModifier.h" @@ -93,8 +93,7 @@ void SharedMonsterAttributes::loadAttributes(BaseAttributeMap* attributes, if (instance != nullptr) { loadAttribute(instance, tag); } else { - Log::info("Ignoring unknown attribute '%d'", - tag->getInt("ID")); + Log::info("Ignoring unknown attribute '%d'", tag->getInt("ID")); } } } diff --git a/targets/minecraft/world/entity/monster/Silverfish.cpp b/targets/minecraft/world/entity/monster/Silverfish.cpp index deb93e43b..b0d4fe7d8 100644 --- a/targets/minecraft/world/entity/monster/Silverfish.cpp +++ b/targets/minecraft/world/entity/monster/Silverfish.cpp @@ -1,10 +1,10 @@ -#include "minecraft/IGameServices.h" #include "Silverfish.h" #include #include "java/Random.h" #include "minecraft/Facing.h" +#include "minecraft/IGameServices.h" #include "minecraft/sounds/SoundTypes.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" diff --git a/targets/minecraft/world/entity/monster/Skeleton.cpp b/targets/minecraft/world/entity/monster/Skeleton.cpp index da25e0d57..2d7d21662 100644 --- a/targets/minecraft/world/entity/monster/Skeleton.cpp +++ b/targets/minecraft/world/entity/monster/Skeleton.cpp @@ -106,8 +106,8 @@ void Skeleton::playStepSound(int xt, int yt, int zt, int t) { bool Skeleton::doHurtTarget(std::shared_ptr target) { if (Monster::doHurtTarget(target)) { - if ((getSkeletonType() == TYPE_WITHER) && - target->instanceof(eTYPE_LIVINGENTITY)) { + if ((getSkeletonType() == TYPE_WITHER) && target->instanceof + (eTYPE_LIVINGENTITY)) { std::dynamic_pointer_cast(target)->addEffect( new MobEffectInstance(MobEffect::wither->id, SharedConstants::TICKS_PER_SECOND * 10)); @@ -158,7 +158,7 @@ void Skeleton::aiStep() { void Skeleton::rideTick() { Monster::rideTick(); - if (riding != nullptr && riding->instanceof(eTYPE_PATHFINDER_MOB)) { + if (riding != nullptr && riding->instanceof (eTYPE_PATHFINDER_MOB)) { yBodyRot = std::dynamic_pointer_cast(riding)->yBodyRot; } } @@ -167,9 +167,10 @@ void Skeleton::die(DamageSource* source) { Monster::die(source); if (source->getDirectEntity() != nullptr && - source->getDirectEntity()->instanceof(eTYPE_ARROW) && - source->getEntity() != nullptr && - source->getEntity()->instanceof(eTYPE_PLAYER)) { + source->getDirectEntity()->instanceof + (eTYPE_ARROW) && source->getEntity() != nullptr && + source->getEntity()->instanceof + (eTYPE_PLAYER)) { std::shared_ptr player = std::dynamic_pointer_cast(source->getEntity()); diff --git a/targets/minecraft/world/entity/monster/Spider.cpp b/targets/minecraft/world/entity/monster/Spider.cpp index ba3ef339d..c2652b171 100644 --- a/targets/minecraft/world/entity/monster/Spider.cpp +++ b/targets/minecraft/world/entity/monster/Spider.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "Spider.h" #include @@ -8,6 +7,7 @@ #include #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/sounds/SoundTypes.h" #include "minecraft/world/Difficulty.h" #include "minecraft/world/effect/MobEffect.h" diff --git a/targets/minecraft/world/entity/monster/Zombie.cpp b/targets/minecraft/world/entity/monster/Zombie.cpp index 77df90fa1..a12b3ee7b 100644 --- a/targets/minecraft/world/entity/monster/Zombie.cpp +++ b/targets/minecraft/world/entity/monster/Zombie.cpp @@ -179,10 +179,12 @@ bool Zombie::hurt(DamageSource* source, float dmg) { if (Monster::hurt(source, dmg)) { std::shared_ptr target = getTarget(); if ((target == nullptr) && getAttackTarget() != nullptr && - getAttackTarget()->instanceof(eTYPE_LIVINGENTITY)) + getAttackTarget()->instanceof + (eTYPE_LIVINGENTITY)) target = std::dynamic_pointer_cast(getAttackTarget()); if ((target == nullptr) && source->getEntity() != nullptr && - source->getEntity()->instanceof(eTYPE_LIVINGENTITY)) + source->getEntity()->instanceof + (eTYPE_LIVINGENTITY)) target = std::dynamic_pointer_cast(source->getEntity()); @@ -314,8 +316,7 @@ void Zombie::addAdditonalSaveData(CompoundTag* tag) { if (isBaby()) tag->putBoolean("IsBaby", true); if (isVillager()) tag->putBoolean("IsVillager", true); - tag->putInt("ConversionTime", - isConverting() ? villagerConversionTime : -1); + tag->putInt("ConversionTime", isConverting() ? villagerConversionTime : -1); } void Zombie::readAdditionalSaveData(CompoundTag* tag) { diff --git a/targets/minecraft/world/entity/npc/ClientSideMerchant.h b/targets/minecraft/world/entity/npc/ClientSideMerchant.h index 6a594faa8..c613594d4 100644 --- a/targets/minecraft/world/entity/npc/ClientSideMerchant.h +++ b/targets/minecraft/world/entity/npc/ClientSideMerchant.h @@ -21,8 +21,7 @@ private: std::string m_name; public: - ClientSideMerchant(std::shared_ptr source, - const std::string& name); + ClientSideMerchant(std::shared_ptr source, const std::string& name); ~ClientSideMerchant(); void createContainer(); // 4J Added diff --git a/targets/minecraft/world/entity/npc/Villager.cpp b/targets/minecraft/world/entity/npc/Villager.cpp index 2685626b2..783e82118 100644 --- a/targets/minecraft/world/entity/npc/Villager.cpp +++ b/targets/minecraft/world/entity/npc/Villager.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "Villager.h" #include @@ -8,6 +7,7 @@ #include "Pos.h" #include "SharedConstants.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/sounds/SoundTypes.h" #include "minecraft/util/Mth.h" @@ -272,7 +272,7 @@ void Villager::setLastHurtByMob(std::shared_ptr mob) { if (_village != nullptr && mob != nullptr) { _village->addAggressor(mob); - if (mob->instanceof(eTYPE_PLAYER)) { + if (mob->instanceof (eTYPE_PLAYER)) { int amount = -1; if (isBaby()) { amount = -3; @@ -292,11 +292,11 @@ void Villager::die(DamageSource* source) { if (_village != nullptr) { std::shared_ptr sourceEntity = source->getEntity(); if (sourceEntity != nullptr) { - if (sourceEntity->instanceof(eTYPE_PLAYER)) { + if (sourceEntity->instanceof (eTYPE_PLAYER)) { _village->modifyStanding( std::dynamic_pointer_cast(sourceEntity)->getName(), -2); - } else if (sourceEntity->instanceof(eTYPE_ENEMY)) { + } else if (sourceEntity->instanceof (eTYPE_ENEMY)) { _village->resetNoBreedTimer(); } } else if (sourceEntity == nullptr) { diff --git a/targets/minecraft/world/entity/player/Inventory.cpp b/targets/minecraft/world/entity/player/Inventory.cpp index 21a59b055..79c5d9cd3 100644 --- a/targets/minecraft/world/entity/player/Inventory.cpp +++ b/targets/minecraft/world/entity/player/Inventory.cpp @@ -1,12 +1,12 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "Inventory.h" #include #include +#include "minecraft/IGameServices.h" #include "minecraft/stats/GenericStats.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/player/Abilities.h" #include "minecraft/world/entity/player/Player.h" @@ -393,15 +393,14 @@ void Inventory::setItem(unsigned int slot, std::shared_ptr item) { if (item != nullptr) { std::string itemstring = item->toString(); Log::info("Inventory::setItem - slot = %d,\t item = %d ", slot, - item->id); + item->id); // OutputDebugStringW(itemstring.c_str()); Log::info("\n"); } #else if (item != nullptr) { - Log::info( - "Inventory::setItem - slot = %d,\t item = %d, aux = %d\n", slot, - item->id, item->getAuxValue()); + Log::info("Inventory::setItem - slot = %d,\t item = %d, aux = %d\n", + slot, item->id, item->getAuxValue()); } #endif // 4J Stu - Changed this a little from Java to be less funn @@ -489,7 +488,9 @@ std::shared_ptr Inventory::getItem(unsigned int slot) { */ } -std::string Inventory::getName() { return gameServices().getString(IDS_INVENTORY); } +std::string Inventory::getName() { + return gameServices().getString(IDS_INVENTORY); +} std::string Inventory::getCustomName() { return ""; } diff --git a/targets/minecraft/world/entity/player/Player.cpp b/targets/minecraft/world/entity/player/Player.cpp index 1baeb7927..ab6107849 100644 --- a/targets/minecraft/world/entity/player/Player.cpp +++ b/targets/minecraft/world/entity/player/Player.cpp @@ -9,8 +9,6 @@ // derives from, and not to find the derived class itself (which should own the // virtual GetType function) -#include "Player.h" - #include #include @@ -22,14 +20,14 @@ #include #include "Inventory.h" -#include "minecraft/GameEnums.h" +#include "Player.h" #include "app/common/App_structs.h" -#include "minecraft/Minecraft_Macros.h" -#include "minecraft/world/level/dlc/DLCConstants.h" #include "app/common/DLC/DLCSkinFile.h" #include "java/JavaMath.h" #include "java/Random.h" #include "minecraft/Direction.h" +#include "minecraft/GameEnums.h" +#include "minecraft/Minecraft_Macros.h" #include "minecraft/Pos.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/model/HumanoidModel.h" @@ -74,6 +72,7 @@ #include "minecraft/world/level/Level.h" #include "minecraft/world/level/chunk/ChunkSource.h" #include "minecraft/world/level/dimension/Dimension.h" +#include "minecraft/world/level/dlc/DLCConstants.h" #include "minecraft/world/level/material/Material.h" #include "minecraft/world/level/tile/BedTile.h" #include "minecraft/world/level/tile/Tile.h" @@ -182,8 +181,10 @@ Player::Player(Level* level, const std::string& name) : LivingEntity(level) { m_xuid = INVALID_XUID; m_OnlineXuid = INVALID_XUID; // m_bShownOnMaps = true; - setShowOnMaps( - gameServices().getGameHostOption(eGameHostOption_Gamertags) != 0 ? true : false); + setShowOnMaps(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 @@ -534,7 +535,8 @@ void Player::ride(std::shared_ptr e) { void Player::setPlayerDefaultSkin(EDefaultSkins skin) { #if !defined(_CONTENT_PACKAGE) - printf("Setting default skin to %d for player %s\n", std::to_underlying(skin), name.c_str()); + printf("Setting default skin to %d for player %s\n", + std::to_underlying(skin), name.c_str()); #endif m_skinIndex = skin; } @@ -542,7 +544,7 @@ void Player::setPlayerDefaultSkin(EDefaultSkins skin) { void Player::setCustomSkin(std::uint32_t skinId) { #if !defined(_CONTENT_PACKAGE) printf("Attempting to set skin to %08X for player %s\n", skinId, - name.c_str()); + name.c_str()); #endif EDefaultSkins playerSkin = EDefaultSkins::ServerSelected; @@ -573,7 +575,8 @@ void Player::setCustomSkin(std::uint32_t 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) { @@ -663,7 +666,7 @@ void Player::setXuid(PlayerUID xuid) { m_xuid = xuid; } void Player::setCustomCape(std::uint32_t capeId) { #if !defined(_CONTENT_PACKAGE) printf("Attempting to set cape to %08X for player %s\n", capeId, - name.c_str()); + name.c_str()); #endif m_dwCapeId = capeId; @@ -671,7 +674,8 @@ 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) { @@ -761,7 +765,8 @@ void Player::ChangePlayerSkin() { } void Player::prepareCustomTextures() { - MOJANG_DATA* pMojangData = gameServices().getMojangDataForXuid(getOnlineXuid()); + MOJANG_DATA* pMojangData = + gameServices().getMojangDataForXuid(getOnlineXuid()); if (pMojangData) { // Skin @@ -1204,7 +1209,7 @@ bool Player::hurt(DamageSource* source, float dmg) { if (dmg == 0) return false; std::shared_ptr attacker = source->getEntity(); - if (attacker != nullptr && attacker->instanceof(eTYPE_ARROW)) { + if (attacker != nullptr && attacker->instanceof (eTYPE_ARROW)) { std::shared_ptr arrow = std::dynamic_pointer_cast(attacker); if (arrow->owner != nullptr) { @@ -1315,7 +1320,7 @@ bool Player::interact(std::shared_ptr entity) { return true; } - if ((item != nullptr) && entity->instanceof(eTYPE_LIVINGENTITY)) { + if ((item != nullptr) && entity->instanceof (eTYPE_LIVINGENTITY)) { // 4J - PC Comments // Hack to prevent item stacks from decrementing if the player has // the ability to instabuild @@ -1359,7 +1364,7 @@ void Player::attack(std::shared_ptr entity) { int knockback = 0; float magicBoost = 0; - if (entity->instanceof(eTYPE_LIVINGENTITY)) { + if (entity->instanceof (eTYPE_LIVINGENTITY)) { std::shared_ptr thisPlayer = std::dynamic_pointer_cast(shared_from_this()); std::shared_ptr mob = @@ -1374,8 +1379,8 @@ void Player::attack(std::shared_ptr entity) { if (dmg > 0 || magicBoost > 0) { bool bCrit = fallDistance > 0 && !onGround && !onLadder() && !isInWater() && !hasEffect(MobEffect::blindness) && - (riding == nullptr) && - entity->instanceof(eTYPE_LIVINGENTITY); + (riding == nullptr) && entity->instanceof + (eTYPE_LIVINGENTITY); if (bCrit && dmg > 0) { dmg *= 1.5f; } @@ -1386,8 +1391,8 @@ void Player::attack(std::shared_ptr entity) { bool setOnFireTemporatily = false; int fireAspect = EnchantmentHelper::getFireAspect( std::dynamic_pointer_cast(shared_from_this())); - if (entity->instanceof(eTYPE_MOB) && fireAspect > 0 && - !entity->isOnFire()) { + if (entity->instanceof + (eTYPE_MOB) && fireAspect > 0 && !entity->isOnFire()) { setOnFireTemporatily = true; entity->setOnFire(1); } @@ -1419,7 +1424,7 @@ void Player::attack(std::shared_ptr entity) { } setLastHurtMob(entity); - if (entity->instanceof(eTYPE_LIVINGENTITY)) { + if (entity->instanceof (eTYPE_LIVINGENTITY)) { std::shared_ptr mob = std::dynamic_pointer_cast(entity); ThornsEnchantment::doThornsAfterAttack(shared_from_this(), mob, @@ -1429,17 +1434,17 @@ void Player::attack(std::shared_ptr entity) { std::shared_ptr item = getSelectedItem(); std::shared_ptr hurtTarget = entity; - if (entity->instanceof(eTYPE_MULTIENTITY_MOB_PART)) { + if (entity->instanceof (eTYPE_MULTIENTITY_MOB_PART)) { std::shared_ptr multiMob = std::dynamic_pointer_cast( (std::dynamic_pointer_cast(entity)) ->parentMob.lock()); - if ((multiMob != nullptr) && - multiMob->instanceof(eTYPE_LIVINGENTITY)) { + if ((multiMob != nullptr) && multiMob->instanceof + (eTYPE_LIVINGENTITY)) { hurtTarget = std::dynamic_pointer_cast(multiMob); } } - if ((item != nullptr) && hurtTarget->instanceof(eTYPE_LIVINGENTITY)) { + if ((item != nullptr) && hurtTarget->instanceof (eTYPE_LIVINGENTITY)) { item->hurtEnemy( std::dynamic_pointer_cast(hurtTarget), std::dynamic_pointer_cast(shared_from_this())); @@ -1447,7 +1452,7 @@ void Player::attack(std::shared_ptr entity) { removeSelectedItem(); } } - if (entity->instanceof(eTYPE_LIVINGENTITY)) { + if (entity->instanceof (eTYPE_LIVINGENTITY)) { // awardStat(Stats.damageDealt, (int) Math.round(dmg * 10)); if (fireAspect > 0 && wasHurt) { @@ -1864,7 +1869,7 @@ void Player::checkRidingStatistiscs(double dx, double dy, double dz) { int distance = (int)Math::round(sqrt(dx * dx + dy * dy + dz * dz) * 100.0f); if (distance > 0) { - if (riding->instanceof(eTYPE_MINECART)) { + if (riding->instanceof (eTYPE_MINECART)) { distanceMinecart += distance; if (distanceMinecart >= 100) { int newDistance = @@ -1893,7 +1898,7 @@ void Player::checkRidingStatistiscs(double dx, double dy, double dz) { } } - } else if (riding->instanceof(eTYPE_BOAT)) { + } else if (riding->instanceof (eTYPE_BOAT)) { distanceBoat += distance; if (distanceBoat >= 100) { int newDistance = distanceBoat - (distanceBoat % 100); @@ -1901,7 +1906,7 @@ void Player::checkRidingStatistiscs(double dx, double dy, double dz) { awardStat(GenericStats::boatOneM(), GenericStats::param_boat(newDistance / 100)); } - } else if (riding->instanceof(eTYPE_PIG)) { + } else if (riding->instanceof (eTYPE_PIG)) { distancePig += distance; if (distancePig >= 100) { int newDistance = distancePig - (distancePig % 100); @@ -1933,9 +1938,10 @@ void Player::killed(std::shared_ptr mob) { // 4J-PB - added the lavaslime enemy - fix for #64007 - TU7: Code: // Achievements: TCR#073: Killing Magma Cubes doesn't unlock "Monster // Hunter" Achievement. - if (mob->instanceof(eTYPE_ENEMY) || mob->GetType() == eTYPE_GHAST || - mob->GetType() == eTYPE_SLIME || mob->GetType() == eTYPE_LAVASLIME || - mob->GetType() == eTYPE_ENDERDRAGON) { + if (mob->instanceof (eTYPE_ENEMY) || mob->GetType() == eTYPE_GHAST || + mob->GetType() == eTYPE_SLIME || + mob->GetType() == eTYPE_LAVASLIME || + mob->GetType() == eTYPE_ENDERDRAGON) { awardStat(GenericStats::killEnemy(), GenericStats::param_noArgs()); switch (mob->GetType()) { @@ -2504,7 +2510,7 @@ bool Player::isAllowedToUse(std::shared_ptr item) { bool Player::isAllowedToInteract(std::shared_ptr target) { bool allowed = true; if (gameServices().getGameHostOption(eGameHostOption_TrustPlayers) == 0) { - if (target->instanceof(eTYPE_MINECART)) { + if (target->instanceof (eTYPE_MINECART)) { if (getPlayerGamePrivilege( Player::ePlayerGamePrivilege_CanUseContainers) == 0) { std::shared_ptr minecart = @@ -2543,7 +2549,8 @@ bool Player::isAllowedToMine() { bool Player::isAllowedToAttackPlayers() { bool allowed = true; if (hasInvisiblePrivilege() || - ((gameServices().getGameHostOption(eGameHostOption_TrustPlayers) == 0) && + ((gameServices().getGameHostOption(eGameHostOption_TrustPlayers) == + 0) && getPlayerGamePrivilege( Player::ePlayerGamePrivilege_CannotAttackPlayers))) { allowed = false; @@ -2596,7 +2603,8 @@ bool Player::isAllowedToFly() { bool Player::isAllowedToIgnoreExhaustion() { bool allowed = false; - if ((gameServices().getGameHostOption(eGameHostOption_HostCanChangeHunger) != 0 && + if ((gameServices().getGameHostOption( + eGameHostOption_HostCanChangeHunger) != 0 && getPlayerGamePrivilege(Player::ePlayerGamePrivilege_ClassicHunger) != 0) || (isAllowedToFly() && abilities.flying)) { @@ -2616,7 +2624,8 @@ bool Player::isAllowedToTeleport() { bool Player::hasInvisiblePrivilege() { bool enabled = false; - if (gameServices().getGameHostOption(eGameHostOption_HostCanBeInvisible) != 0 && + if (gameServices().getGameHostOption(eGameHostOption_HostCanBeInvisible) != + 0 && getPlayerGamePrivilege(Player::ePlayerGamePrivilege_Invisible) != 0) { enabled = true; } @@ -2625,7 +2634,8 @@ bool Player::hasInvisiblePrivilege() { bool Player::hasInvulnerablePrivilege() { bool enabled = false; - if (gameServices().getGameHostOption(eGameHostOption_HostCanBeInvisible) != 0 && + if (gameServices().getGameHostOption(eGameHostOption_HostCanBeInvisible) != + 0 && getPlayerGamePrivilege(Player::ePlayerGamePrivilege_Invulnerable) != 0) { enabled = true; @@ -2672,7 +2682,8 @@ std::vector* Player::GetAdditionalModelParts() { customTextureUrl.substr(0, 3).compare("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 @@ -2704,8 +2715,9 @@ std::vector* Player::GetAdditionalModelParts() { "m_bCheckedForModelParts Got model parts from DLCskin " "for skin %X\n", m_dwSkinId); - m_ppAdditionalModelParts = gameServices().setAdditionalSkinBoxesFromVec( - m_dwSkinId, pDLCSkinFile->getAdditionalBoxes()); + m_ppAdditionalModelParts = + gameServices().setAdditionalSkinBoxesFromVec( + m_dwSkinId, pDLCSkinFile->getAdditionalBoxes()); } gameServices().setAnimOverrideBitmask( diff --git a/targets/minecraft/world/entity/player/Player.h b/targets/minecraft/world/entity/player/Player.h index a529c1ca6..369b4778f 100644 --- a/targets/minecraft/world/entity/player/Player.h +++ b/targets/minecraft/world/entity/player/Player.h @@ -6,18 +6,18 @@ #include #include -#include "platform/PlatformTypes.h" #include "Abilities.h" -#include "minecraft/world/entity/player/SkinTypes.h" #include "java/Class.h" #include "minecraft/commands/CommandSender.h" #include "minecraft/network/packet/ChatPacket.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/LivingEntity.h" +#include "minecraft/world/entity/player/SkinTypes.h" #include "minecraft/world/food/FoodData.h" #include "minecraft/world/inventory/PlayerEnderChestContainer.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/scores/ScoreHolder.h" +#include "platform/PlatformTypes.h" class AbstractContainerMenu; class Stats; @@ -238,7 +238,7 @@ public: std::shared_ptr container); virtual bool startEnchanting( int x, int y, int z, - const std::string& name); // 4J - added bool return + const std::string& name); // 4J - added bool return virtual bool startRepairing(int x, int y, int z); // 4J - added bool return virtual bool startCrafting(int x, int y, int z); // 4J - added bool return virtual bool openFireworks(int x, int y, int z); // 4J - added @@ -259,7 +259,7 @@ public: virtual bool canHarmPlayer(std::shared_ptr target); virtual bool canHarmPlayer( std::string targetName); // 4J: Added for ServerPlayer when only - // player name is provided + // player name is provided protected: virtual void hurtArmor(float damage); diff --git a/targets/minecraft/world/entity/projectile/Arrow.cpp b/targets/minecraft/world/entity/projectile/Arrow.cpp index 2882947bd..e8a27a1bc 100644 --- a/targets/minecraft/world/entity/projectile/Arrow.cpp +++ b/targets/minecraft/world/entity/projectile/Arrow.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "Arrow.h" #include @@ -16,6 +15,7 @@ #include "minecraft/server/network/PlayerConnection.h" #include "minecraft/sounds/SoundTypes.h" #include "minecraft/stats/GenericStats.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/entity/Entity.h" @@ -75,7 +75,7 @@ Arrow::Arrow(Level* level, std::shared_ptr mob, viewScale = 10; owner = mob; - if (mob->instanceof(eTYPE_PLAYER)) pickup = PICKUP_ALLOWED; + if (mob->instanceof (eTYPE_PLAYER)) pickup = PICKUP_ALLOWED; y = mob->y + mob->getHeadHeight() - 0.1f; @@ -113,7 +113,7 @@ Arrow::Arrow(Level* level, std::shared_ptr mob, float power) viewScale = 10; owner = mob; - if (mob->instanceof(eTYPE_PLAYER)) pickup = PICKUP_ALLOWED; + if (mob->instanceof (eTYPE_PLAYER)) pickup = PICKUP_ALLOWED; setSize(0.5f, 0.5f); @@ -275,16 +275,17 @@ void Arrow::tick() { res = new HitResult(hitEntity); } - if ((res != nullptr) && (res->entity != nullptr) && - res->entity->instanceof(eTYPE_PLAYER)) { + if ((res != nullptr) && (res->entity != nullptr) && res->entity->instanceof + (eTYPE_PLAYER)) { std::shared_ptr player = std::dynamic_pointer_cast(res->entity); // 4J: Check for owner being null if (player->abilities.invulnerable || ((owner != nullptr) && - (owner->instanceof(eTYPE_PLAYER) && - !std::dynamic_pointer_cast(owner)->canHarmPlayer( - player)))) { + (owner->instanceof + (eTYPE_PLAYER) && + !std::dynamic_pointer_cast(owner)->canHarmPlayer( + player)))) { res = nullptr; } } @@ -318,7 +319,7 @@ void Arrow::tick() { res->entity->setOnFire(5); } - if (res->entity->instanceof(eTYPE_LIVINGENTITY)) { + if (res->entity->instanceof (eTYPE_LIVINGENTITY)) { std::shared_ptr mob = std::dynamic_pointer_cast(res->entity); @@ -350,11 +351,11 @@ void Arrow::tick() { // 4J : WESTY : For award, need to track if creeper was killed // by arrow from the player. - if (owner != nullptr && - owner->instanceof(eTYPE_PLAYER) // arrow owner is a player - && !res->entity->isAlive() // target is now dead - && (res->entity->GetType() == - eTYPE_CREEPER)) // target is a creeper + if (owner != nullptr && owner->instanceof + (eTYPE_PLAYER) // arrow owner is a player + && !res->entity->isAlive() // target is now dead + && (res->entity->GetType() == + eTYPE_CREEPER)) // target is a creeper { std::dynamic_pointer_cast(owner)->awardStat( @@ -480,8 +481,7 @@ void Arrow::readAdditionalSaveData(CompoundTag* tag) { if (tag->contains("pickup")) { pickup = tag->getByte("pickup"); } else if (tag->contains("player")) { - pickup = - tag->getBoolean("player") ? PICKUP_ALLOWED : PICKUP_DISALLOWED; + pickup = tag->getBoolean("player") ? PICKUP_ALLOWED : PICKUP_DISALLOWED; } } diff --git a/targets/minecraft/world/entity/projectile/Fireball.cpp b/targets/minecraft/world/entity/projectile/Fireball.cpp index ff55f7155..ed1c7e281 100644 --- a/targets/minecraft/world/entity/projectile/Fireball.cpp +++ b/targets/minecraft/world/entity/projectile/Fireball.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "Fireball.h" #include @@ -13,6 +12,7 @@ #include "java/Random.h" #include "minecraft/SharedConstants.h" #include "minecraft/core/particles/ParticleTypes.h" +#include "minecraft/util/Log.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/LivingEntity.h" @@ -324,7 +324,7 @@ bool Fireball::hurt(DamageSource* source, float damage) { zPower = zd * 0.1; } - if (source->getEntity()->instanceof(eTYPE_LIVINGENTITY)) { + if (source->getEntity()->instanceof (eTYPE_LIVINGENTITY)) { owner = std::dynamic_pointer_cast(source->getEntity()); } diff --git a/targets/minecraft/world/entity/projectile/Snowball.cpp b/targets/minecraft/world/entity/projectile/Snowball.cpp index 787846ef3..8d6489aba 100644 --- a/targets/minecraft/world/entity/projectile/Snowball.cpp +++ b/targets/minecraft/world/entity/projectile/Snowball.cpp @@ -30,7 +30,7 @@ Snowball::Snowball(Level* level, double x, double y, double z) void Snowball::onHit(HitResult* res) { if (res->entity != nullptr) { int damage = 0; - if (res->entity->instanceof(eTYPE_BLAZE)) { + if (res->entity->instanceof (eTYPE_BLAZE)) { damage = 3; } diff --git a/targets/minecraft/world/entity/projectile/Throwable.cpp b/targets/minecraft/world/entity/projectile/Throwable.cpp index 728b15944..7cb64e44b 100644 --- a/targets/minecraft/world/entity/projectile/Throwable.cpp +++ b/targets/minecraft/world/entity/projectile/Throwable.cpp @@ -249,8 +249,8 @@ void Throwable::addAdditonalSaveData(CompoundTag* tag) { tag->putByte("shake", (uint8_t)shakeTime); tag->putByte("inGround", (uint8_t)(inGround ? 1 : 0)); - if (ownerName.empty() && (owner != nullptr) && - owner->instanceof(eTYPE_PLAYER)) { + if (ownerName.empty() && (owner != nullptr) && owner->instanceof + (eTYPE_PLAYER)) { ownerName = owner->getAName(); } diff --git a/targets/minecraft/world/entity/projectile/ThrownEnderpearl.cpp b/targets/minecraft/world/entity/projectile/ThrownEnderpearl.cpp index 0ada74647..abf679bd5 100644 --- a/targets/minecraft/world/entity/projectile/ThrownEnderpearl.cpp +++ b/targets/minecraft/world/entity/projectile/ThrownEnderpearl.cpp @@ -52,8 +52,8 @@ void ThrownEnderpearl::onHit(HitResult* res) { // the ground. If the owner has been removed, then ignore // 4J-JEV: Cheap type check first. - if ((getOwner() != nullptr) && - getOwner()->instanceof(eTYPE_SERVERPLAYER)) { + if ((getOwner() != nullptr) && getOwner()->instanceof + (eTYPE_SERVERPLAYER)) { std::shared_ptr serverPlayer = std::dynamic_pointer_cast(getOwner()); if (!serverPlayer->removed) { diff --git a/targets/minecraft/world/entity/projectile/WitherSkull.cpp b/targets/minecraft/world/entity/projectile/WitherSkull.cpp index e1646e35e..b9b2b4f47 100644 --- a/targets/minecraft/world/entity/projectile/WitherSkull.cpp +++ b/targets/minecraft/world/entity/projectile/WitherSkull.cpp @@ -74,7 +74,7 @@ void WitherSkull::onHit(HitResult* res) { } else { res->entity->hurt(DamageSource::magic, 5); } - if (res->entity->instanceof(eTYPE_LIVINGENTITY)) { + if (res->entity->instanceof (eTYPE_LIVINGENTITY)) { int witherSeconds = 0; if (level->difficulty <= Difficulty::EASY) { // Nothing diff --git a/targets/minecraft/world/inventory/AnvilMenu.cpp b/targets/minecraft/world/inventory/AnvilMenu.cpp index 43852607f..3da3a17e6 100644 --- a/targets/minecraft/world/inventory/AnvilMenu.cpp +++ b/targets/minecraft/world/inventory/AnvilMenu.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "AnvilMenu.h" #include @@ -6,7 +5,7 @@ #include #include -#include "util/StringHelpers.h" +#include "minecraft/util/Log.h" #include "minecraft/world/Container.h" #include "minecraft/world/entity/player/Abilities.h" #include "minecraft/world/entity/player/Inventory.h" @@ -26,6 +25,7 @@ #include "minecraft/world/level/tile/Tile.h" #include "nbt/ListTag.h" #include "strings.h" +#include "util/StringHelpers.h" AnvilMenu::AnvilMenu(std::shared_ptr inventory, Level* level, int xt, int yt, int zt, std::shared_ptr player) { @@ -232,9 +232,8 @@ void AnvilMenu::createResult() { price += namingCost; if (DEBUG_COST) { - Log::info( - "Un-naming cost; price is now %d (went up by %d)", - price, namingCost); + Log::info("Un-naming cost; price is now %d (went up by %d)", + price, namingCost); } result->resetHoverName(); } @@ -245,8 +244,8 @@ void AnvilMenu::createResult() { price += namingCost; if (DEBUG_COST) { - Log::info("Naming cost; price is now %d (went up by %d)", - price, namingCost); + Log::info("Naming cost; price is now %d (went up by %d)", price, + namingCost); } if (input->hasCustomHoverName()) { @@ -290,9 +289,8 @@ void AnvilMenu::createResult() { tax += count + level * fee; if (DEBUG_COST) { - Log::info( - "Enchantment tax; tax is now %d (went up by %d)", tax, - (count + level * fee)); + Log::info("Enchantment tax; tax is now %d (went up by %d)", tax, + (count + level * fee)); } } @@ -334,11 +332,11 @@ void AnvilMenu::createResult() { if (DEBUG_COST) { if (level->isClientSide) { - Log::info("CLIENT Cost is %d (%d price, %d tax)\n", cost, - price, tax); + Log::info("CLIENT Cost is %d (%d price, %d tax)\n", cost, price, + tax); } else { - Log::info("SERVER Cost is %d (%d price, %d tax)\n", cost, - price, tax); + Log::info("SERVER Cost is %d (%d price, %d tax)\n", cost, price, + tax); } } } diff --git a/targets/minecraft/world/item/ArmorItem.cpp b/targets/minecraft/world/item/ArmorItem.cpp index 9600b2a98..ba9a78897 100644 --- a/targets/minecraft/world/item/ArmorItem.cpp +++ b/targets/minecraft/world/item/ArmorItem.cpp @@ -5,9 +5,9 @@ #include #include -#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/Class.h" #include "minecraft/client/Minecraft.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/core/BehaviorRegistry.h" #include "minecraft/core/BlockSource.h" #include "minecraft/core/DefaultDispenseItemBehavior.h" @@ -29,8 +29,8 @@ class Icon; const int ArmorItem::healthPerSlot[] = {11, 16, 15, 13}; const std::string ArmorItem::LEATHER_OVERLAYS[] = { - "helmetCloth_overlay", "chestplateCloth_overlay", - "leggingsCloth_overlay", "bootsCloth_overlay"}; + "helmetCloth_overlay", "chestplateCloth_overlay", "leggingsCloth_overlay", + "bootsCloth_overlay"}; const std::string ArmorItem::TEXTURE_EMPTY_SLOTS[] = { "slot_empty_helmet", "slot_empty_chestplate", "slot_empty_leggings", @@ -53,12 +53,12 @@ std::shared_ptr ArmorItem::ArmorDispenseItemBehavior::execute( if (entities->size() > 0) { std::shared_ptr target = std::dynamic_pointer_cast(entities->at(0)); - int offset = target->instanceof(eTYPE_PLAYER) ? 1 : 0; + int offset = target->instanceof (eTYPE_PLAYER) ? 1 : 0; int slot = Mob::getEquipmentSlotForItem(dispensed); std::shared_ptr equip = dispensed->copy(); equip->count = 1; target->setEquippedSlot(slot - offset, equip); - if (target->instanceof(eTYPE_MOB)) + if (target->instanceof (eTYPE_MOB)) std::dynamic_pointer_cast(target)->setDropChance(slot, 2); dispensed->count--; diff --git a/targets/minecraft/world/item/BowItem.cpp b/targets/minecraft/world/item/BowItem.cpp index ad63775d4..77dc67bba 100644 --- a/targets/minecraft/world/item/BowItem.cpp +++ b/targets/minecraft/world/item/BowItem.cpp @@ -18,7 +18,7 @@ class Icon; const std::string BowItem::TEXTURE_PULL[] = {"bow_pull_0", "bow_pull_1", - "bow_pull_2"}; + "bow_pull_2"}; BowItem::BowItem(int id) : Item(id) { maxStackSize = 1; diff --git a/targets/minecraft/world/item/BucketItem.cpp b/targets/minecraft/world/item/BucketItem.cpp index 2e22034d0..90806fb8c 100644 --- a/targets/minecraft/world/item/BucketItem.cpp +++ b/targets/minecraft/world/item/BucketItem.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "BucketItem.h" #include @@ -13,6 +12,7 @@ #include "minecraft/server/network/PlayerConnection.h" #include "minecraft/sounds/SoundTypes.h" #include "minecraft/stats/GenericStats.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/player/Abilities.h" #include "minecraft/world/entity/player/Inventory.h" diff --git a/targets/minecraft/world/item/ClockItem.h b/targets/minecraft/world/item/ClockItem.h index f5628cebb..fba8dab71 100644 --- a/targets/minecraft/world/item/ClockItem.h +++ b/targets/minecraft/world/item/ClockItem.h @@ -4,8 +4,8 @@ #include -#include "platform/PlatformTypes.h" #include "Item.h" +#include "platform/PlatformTypes.h" class Icon; diff --git a/targets/minecraft/world/item/CompassItem.h b/targets/minecraft/world/item/CompassItem.h index c61ae9c57..b151aadc3 100644 --- a/targets/minecraft/world/item/CompassItem.h +++ b/targets/minecraft/world/item/CompassItem.h @@ -4,8 +4,8 @@ #include -#include "platform/PlatformTypes.h" #include "Item.h" +#include "platform/PlatformTypes.h" class Icon; diff --git a/targets/minecraft/world/item/DyePowderItem.cpp b/targets/minecraft/world/item/DyePowderItem.cpp index dd8c87191..5d065d849 100644 --- a/targets/minecraft/world/item/DyePowderItem.cpp +++ b/targets/minecraft/world/item/DyePowderItem.cpp @@ -300,7 +300,7 @@ void DyePowderItem::registerIcons(IconRegister* iconRegister) { icons = new Icon*[DYE_POWDER_ITEM_TEXTURE_COUNT]; for (int i = 0; i < DYE_POWDER_ITEM_TEXTURE_COUNT; i++) { - icons[i] = iconRegister->registerIcon(getIconName() + "_" + - COLOR_TEXTURES[i]); + icons[i] = + iconRegister->registerIcon(getIconName() + "_" + COLOR_TEXTURES[i]); } } \ No newline at end of file diff --git a/targets/minecraft/world/item/EnchantedBookItem.cpp b/targets/minecraft/world/item/EnchantedBookItem.cpp index 0d33cd2e9..ecc40e283 100644 --- a/targets/minecraft/world/item/EnchantedBookItem.cpp +++ b/targets/minecraft/world/item/EnchantedBookItem.cpp @@ -58,8 +58,7 @@ void EnchantedBookItem::appendHoverText( if (list != nullptr) { std::string unformatted = ""; for (int i = 0; i < list->size(); i++) { - int type = - list->get(i)->getShort((char*)ItemInstance::TAG_ENCH_ID); + int type = list->get(i)->getShort((char*)ItemInstance::TAG_ENCH_ID); int level = list->get(i)->getShort((char*)ItemInstance::TAG_ENCH_LEVEL); @@ -104,8 +103,7 @@ void EnchantedBookItem::addEnchantment(std::shared_ptr item, } if (!item->hasTag()) item->setTag(new CompoundTag()); - item->getTag()->put((char*)TAG_STORED_ENCHANTMENTS.c_str(), - enchantments); + item->getTag()->put((char*)TAG_STORED_ENCHANTMENTS.c_str(), enchantments); } std::shared_ptr EnchantedBookItem::createForEnchantment( diff --git a/targets/minecraft/world/item/EnderEyeItem.cpp b/targets/minecraft/world/item/EnderEyeItem.cpp index a90cecd5f..b0335f1c1 100644 --- a/targets/minecraft/world/item/EnderEyeItem.cpp +++ b/targets/minecraft/world/item/EnderEyeItem.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "EnderEyeItem.h" #include @@ -7,6 +6,7 @@ #include "minecraft/Direction.h" #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/sounds/SoundTypes.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/player/Abilities.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/entity/projectile/EyeOfEnderSignal.h" diff --git a/targets/minecraft/world/item/FireworksChargeItem.cpp b/targets/minecraft/world/item/FireworksChargeItem.cpp index 8b55f3b6a..dc6ae7edb 100644 --- a/targets/minecraft/world/item/FireworksChargeItem.cpp +++ b/targets/minecraft/world/item/FireworksChargeItem.cpp @@ -1,8 +1,8 @@ -#include "minecraft/IGameServices.h" #include "FireworksChargeItem.h" #include +#include "minecraft/IGameServices.h" #include "minecraft/util/HtmlString.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/item/DyePowderItem.h" @@ -98,10 +98,11 @@ void FireworksChargeItem::appendHoverText(CompoundTag* expTag, // shape uint8_t type = expTag->getByte(FireworksItem::TAG_E_TYPE); if (type >= FireworksItem::TYPE_MIN && type <= FireworksItem::TYPE_MAX) { - lines->push_back( - HtmlString(gameServices().getString(FIREWORKS_CHARGE_TYPE_NAME[type]))); + lines->push_back(HtmlString( + gameServices().getString(FIREWORKS_CHARGE_TYPE_NAME[type]))); } else { - lines->push_back(HtmlString(gameServices().getString(IDS_FIREWORKS_CHARGE_TYPE))); + lines->push_back( + HtmlString(gameServices().getString(IDS_FIREWORKS_CHARGE_TYPE))); } // colors @@ -115,7 +116,7 @@ void FireworksChargeItem::appendHoverText(CompoundTag* expTag, if (!first) { output += ",\n"; // 4J-PB - without the newline, they tend to go - // offscreen in split-screen or localised languages + // offscreen in split-screen or localised languages } first = false; @@ -124,7 +125,8 @@ void FireworksChargeItem::appendHoverText(CompoundTag* expTag, for (int dc = 0; dc < 16; dc++) { if (c == DyePowderItem::COLOR_RGB[dc]) { found = true; - output += gameServices().getString(FIREWORKS_CHARGE_COLOUR_NAME[dc]); + output += gameServices().getString( + FIREWORKS_CHARGE_COLOUR_NAME[dc]); break; } } @@ -140,14 +142,15 @@ void FireworksChargeItem::appendHoverText(CompoundTag* expTag, expTag->getIntArray(FireworksItem::TAG_E_FADECOLORS); if (fadeList.size() > 0) { bool first = true; - std::string output = - std::string(gameServices().getString(IDS_FIREWORKS_CHARGE_FADE_TO)) + " "; + std::string output = std::string(gameServices().getString( + IDS_FIREWORKS_CHARGE_FADE_TO)) + + " "; for (unsigned int i = 0; i < fadeList.size(); ++i) { int c = fadeList[i]; if (!first) { output += ",\n"; // 4J-PB - without the newline, they tend to go - // offscreen in split-screen or localised languages + // offscreen in split-screen or localised languages } first = false; @@ -156,7 +159,8 @@ void FireworksChargeItem::appendHoverText(CompoundTag* expTag, for (int dc = 0; dc < 16; dc++) { if (c == DyePowderItem::COLOR_RGB[dc]) { found = true; - output += gameServices().getString(FIREWORKS_CHARGE_COLOUR_NAME[dc]); + output += gameServices().getString( + FIREWORKS_CHARGE_COLOUR_NAME[dc]); break; } } @@ -170,7 +174,8 @@ void FireworksChargeItem::appendHoverText(CompoundTag* expTag, // has trail bool trail = expTag->getBoolean(FireworksItem::TAG_E_TRAIL); if (trail) { - lines->push_back(HtmlString(gameServices().getString(IDS_FIREWORKS_CHARGE_TRAIL))); + lines->push_back( + HtmlString(gameServices().getString(IDS_FIREWORKS_CHARGE_TRAIL))); } // has flicker diff --git a/targets/minecraft/world/item/FireworksItem.cpp b/targets/minecraft/world/item/FireworksItem.cpp index 3f4041a50..c93b3cf3c 100644 --- a/targets/minecraft/world/item/FireworksItem.cpp +++ b/targets/minecraft/world/item/FireworksItem.cpp @@ -1,10 +1,9 @@ -#include "minecraft/IGameServices.h" #include "FireworksItem.h" #include #include -#include "util/StringHelpers.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/HtmlString.h" #include "minecraft/world/entity/player/Abilities.h" #include "minecraft/world/entity/player/Player.h" @@ -16,6 +15,7 @@ #include "nbt/CompoundTag.h" #include "nbt/ListTag.h" #include "strings.h" +#include "util/StringHelpers.h" const std::string FireworksItem::TAG_FIREWORKS = "Fireworks"; const std::string FireworksItem::TAG_EXPLOSION = "Explosion"; @@ -65,8 +65,8 @@ void FireworksItem::appendHoverText(std::shared_ptr itemInstance, } if (fireTag->contains(TAG_FLIGHT)) { lines->push_back( - std::string(gameServices().getString(IDS_ITEM_FIREWORKS_FLIGHT)) + " " + - toWString((fireTag->getByte(TAG_FLIGHT)))); + std::string(gameServices().getString(IDS_ITEM_FIREWORKS_FLIGHT)) + + " " + toWString((fireTag->getByte(TAG_FLIGHT)))); } ListTag* explosions = diff --git a/targets/minecraft/world/item/HangingEntityItem.cpp b/targets/minecraft/world/item/HangingEntityItem.cpp index ef2238b72..9bd00b20e 100644 --- a/targets/minecraft/world/item/HangingEntityItem.cpp +++ b/targets/minecraft/world/item/HangingEntityItem.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "HangingEntityItem.h" #include @@ -10,6 +9,7 @@ #include "Direction.h" #include "Facing.h" #include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/util/HtmlString.h" #include "minecraft/world/entity/HangingEntity.h" diff --git a/targets/minecraft/world/item/Item.cpp b/targets/minecraft/world/item/Item.cpp index 20f6dc92d..74e7200ce 100644 --- a/targets/minecraft/world/item/Item.cpp +++ b/targets/minecraft/world/item/Item.cpp @@ -1,6 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" - #include "Item.h" #include @@ -11,7 +8,9 @@ #include "MapItem.h" #include "java/Class.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/stats/Stats.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" #include "minecraft/world/Icon.h" #include "minecraft/world/IconRegister.h" diff --git a/targets/minecraft/world/item/ItemInstance.cpp b/targets/minecraft/world/item/ItemInstance.cpp index 1bd665d2d..fa3fb9774 100644 --- a/targets/minecraft/world/item/ItemInstance.cpp +++ b/targets/minecraft/world/item/ItemInstance.cpp @@ -11,7 +11,6 @@ #include #include "Item.h" -#include "util/StringHelpers.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/util/HtmlString.h" #include "minecraft/world/entity/LivingEntity.h" @@ -31,6 +30,7 @@ #include "nbt/CompoundTag.h" #include "nbt/IntTag.h" #include "nbt/ListTag.h" +#include "util/StringHelpers.h" class Tag; @@ -370,8 +370,8 @@ std::string ItemInstance::toString() { std::ostringstream oss; // 4J-PB - TODO - temp fix until ore recipe issue is fixed if (Item::items[id] == nullptr) { - oss << std::dec << count << "x" << " Item::items[id] is nullptr " - << "@" << auxValue; + oss << std::dec << count << "x" << " Item::items[id] is nullptr " << "@" + << auxValue; } else { oss << std::dec << count << "x" << Item::items[id]->getDescription(shared_from_this()) << "@" diff --git a/targets/minecraft/world/item/MapItem.cpp b/targets/minecraft/world/item/MapItem.cpp index a1fb0c5c1..7cd5c8cb4 100644 --- a/targets/minecraft/world/item/MapItem.cpp +++ b/targets/minecraft/world/item/MapItem.cpp @@ -7,7 +7,6 @@ #include #include -#include "util/StringHelpers.h" #include "java/Class.h" #include "java/JavaMath.h" #include "minecraft/network/packet/ComplexItemDataPacket.h" @@ -26,6 +25,7 @@ #include "minecraft/world/level/saveddata/MapItemSavedData.h" #include "minecraft/world/level/storage/LevelData.h" #include "minecraft/world/level/tile/Tile.h" +#include "util/StringHelpers.h" class SavedData; @@ -105,8 +105,8 @@ std::shared_ptr MapItem::getSavedData( void MapItem::update(Level* level, std::shared_ptr player, std::shared_ptr data) { - if ((level->dimension->id != data->dimension) || - !player->instanceof(eTYPE_PLAYER)) { + if ((level->dimension->id != data->dimension) || !player->instanceof + (eTYPE_PLAYER)) { // Wrong dimension, abort return; } @@ -267,7 +267,7 @@ void MapItem::inventoryTick(std::shared_ptr itemInstance, if (level->isClientSide) return; std::shared_ptr data = getSavedData(itemInstance, level); - if (owner->instanceof(eTYPE_PLAYER)) { + if (owner->instanceof (eTYPE_PLAYER)) { std::shared_ptr player = std::dynamic_pointer_cast(owner); diff --git a/targets/minecraft/world/item/NameTagItem.cpp b/targets/minecraft/world/item/NameTagItem.cpp index 07912462c..a1c7e6148 100644 --- a/targets/minecraft/world/item/NameTagItem.cpp +++ b/targets/minecraft/world/item/NameTagItem.cpp @@ -16,7 +16,7 @@ bool NameTagItem::interactEnemy(std::shared_ptr itemInstance, std::shared_ptr target) { if (!itemInstance->hasCustomHoverName()) return false; - if ((target != nullptr) && target->instanceof(eTYPE_MOB)) { + if ((target != nullptr) && target->instanceof (eTYPE_MOB)) { std::shared_ptr mob = std::dynamic_pointer_cast(target); mob->setCustomName(itemInstance->getHoverName()); mob->setPersistenceRequired(); diff --git a/targets/minecraft/world/item/PlanterTileItem.cpp b/targets/minecraft/world/item/PlanterTileItem.cpp index 82eed36fb..71812c91b 100644 --- a/targets/minecraft/world/item/PlanterTileItem.cpp +++ b/targets/minecraft/world/item/PlanterTileItem.cpp @@ -1,10 +1,10 @@ -#include "minecraft/IGameServices.h" #include "PlanterTileItem.h" #include #include "minecraft/Console_Debug_enum.h" #include "minecraft/Facing.h" +#include "minecraft/IGameServices.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/item/Item.h" diff --git a/targets/minecraft/world/item/PotionItem.cpp b/targets/minecraft/world/item/PotionItem.cpp index a89a80dce..276efda45 100644 --- a/targets/minecraft/world/item/PotionItem.cpp +++ b/targets/minecraft/world/item/PotionItem.cpp @@ -1,11 +1,10 @@ -#include "minecraft/IGameServices.h" #include "PotionItem.h" #include -#include "minecraft/GameEnums.h" -#include "util/StringHelpers.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/SharedConstants.h" #include "minecraft/sounds/SoundTypes.h" #include "minecraft/util/HtmlString.h" @@ -26,6 +25,7 @@ #include "nbt/CompoundTag.h" #include "nbt/ListTag.h" #include "strings.h" +#include "util/StringHelpers.h" class Icon; @@ -213,8 +213,9 @@ std::string PotionItem::getHoverName( if (isThrowable(itemInstance->getAuxValue())) { // elementName = I18n.get("potion.prefix.grenade").trim() + " " + // elementName; - elementName = replaceAll(elementName, "{*splash*}", - gameServices().getString(IDS_POTION_PREFIX_GRENADE)); + elementName = + replaceAll(elementName, "{*splash*}", + gameServices().getString(IDS_POTION_PREFIX_GRENADE)); } else { elementName = replaceAll(elementName, "{*splash*}", ""); } @@ -227,17 +228,19 @@ std::string PotionItem::getHoverName( // return elementName + " " + I18n.get(postfixString).trim(); elementName = replaceAll(elementName, "{*prefix*}", ""); - elementName = replaceAll( - elementName, "{*postfix*}", - gameServices().getString(effects->at(0)->getPostfixDescriptionId())); + elementName = + replaceAll(elementName, "{*postfix*}", + gameServices().getString( + effects->at(0)->getPostfixDescriptionId())); } else { // String appearanceName = // PotionBrewing.getAppearanceName(itemInstance.getAuxValue()); return // I18n.get(appearanceName).trim() + " " + elementName; - elementName = replaceAll(elementName, "{*prefix*}", - gameServices().getString(PotionBrewing::getAppearanceName( - itemInstance->getAuxValue()))); + elementName = replaceAll( + elementName, "{*prefix*}", + gameServices().getString( + PotionBrewing::getAppearanceName(itemInstance->getAuxValue()))); elementName = replaceAll(elementName, "{*postfix*}", ""); } return elementName; @@ -288,18 +291,22 @@ void PotionItem::appendHoverText(std::shared_ptr itemInstance, switch (effect->getAmplifier()) { case 1: potencyString = " "; - potencyString += gameServices().getString(IDS_POTION_POTENCY_1); + potencyString += + gameServices().getString(IDS_POTION_POTENCY_1); break; case 2: potencyString = " "; - potencyString += gameServices().getString(IDS_POTION_POTENCY_2); + potencyString += + gameServices().getString(IDS_POTION_POTENCY_2); break; case 3: potencyString = " "; - potencyString += gameServices().getString(IDS_POTION_POTENCY_3); + potencyString += + gameServices().getString(IDS_POTION_POTENCY_3); break; default: - potencyString = gameServices().getString(IDS_POTION_POTENCY_0); + potencyString = + gameServices().getString(IDS_POTION_POTENCY_0); break; } effectString += @@ -307,8 +314,7 @@ void PotionItem::appendHoverText(std::shared_ptr itemInstance, // effect.getAmplifier()).trim(); } if (effect->getDuration() > SharedConstants::TICKS_PER_SECOND) { - effectString += - " (" + MobEffect::formatDuration(effect) + ")"; + effectString += " (" + MobEffect::formatDuration(effect) + ")"; } eMinecraftColour color = eMinecraftColour_NOT_SET; @@ -331,8 +337,9 @@ void PotionItem::appendHoverText(std::shared_ptr itemInstance, if (!modifiers.empty()) { // Add new line lines->push_back(HtmlString("")); - lines->push_back(HtmlString(gameServices().getString(IDS_POTION_EFFECTS_WHENDRANK), - eHTMLColor_5)); + lines->push_back( + HtmlString(gameServices().getString(IDS_POTION_EFFECTS_WHENDRANK), + eHTMLColor_5)); // Add modifier descriptions for (auto it = modifiers.begin(); it != modifiers.end(); ++it) { diff --git a/targets/minecraft/world/item/SaddleItem.cpp b/targets/minecraft/world/item/SaddleItem.cpp index 3e91f56e2..b8bfecf95 100644 --- a/targets/minecraft/world/item/SaddleItem.cpp +++ b/targets/minecraft/world/item/SaddleItem.cpp @@ -13,7 +13,7 @@ SaddleItem::SaddleItem(int id) : Item(id) { maxStackSize = 1; } bool SaddleItem::interactEnemy(std::shared_ptr itemInstance, std::shared_ptr player, std::shared_ptr mob) { - if ((mob != nullptr) && mob->instanceof(eTYPE_PIG)) { + if ((mob != nullptr) && mob->instanceof (eTYPE_PIG)) { std::shared_ptr pig = std::dynamic_pointer_cast(mob); if (!pig->hasSaddle() && !pig->isBaby()) { pig->setSaddle(true); diff --git a/targets/minecraft/world/item/SkullItem.cpp b/targets/minecraft/world/item/SkullItem.cpp index cf294fe60..f61e3ebad 100644 --- a/targets/minecraft/world/item/SkullItem.cpp +++ b/targets/minecraft/world/item/SkullItem.cpp @@ -19,8 +19,8 @@ const unsigned int SkullItem::NAMES[SKULL_COUNT] = { IDS_ITEM_SKULL_SKELETON, IDS_ITEM_SKULL_WITHER, IDS_ITEM_SKULL_ZOMBIE, IDS_ITEM_SKULL_CHARACTER, IDS_ITEM_SKULL_CREEPER}; -std::string SkullItem::ICON_NAMES[SKULL_COUNT] = { - "skeleton", "wither", "zombie", "char", "creeper"}; +std::string SkullItem::ICON_NAMES[SKULL_COUNT] = {"skeleton", "wither", + "zombie", "char", "creeper"}; SkullItem::SkullItem(int id) : Item(id) { // setItemCategory(CreativeModeTab.TAB_DECORATIONS); @@ -125,9 +125,7 @@ unsigned int SkullItem::getDescriptionId( std::string SkullItem::getHoverName( std::shared_ptr itemInstance) { - { - return Item::getHoverName(itemInstance); - } + { return Item::getHoverName(itemInstance); } } void SkullItem::registerIcons(IconRegister* iconRegister) { diff --git a/targets/minecraft/world/item/SpawnEggItem.cpp b/targets/minecraft/world/item/SpawnEggItem.cpp index 2acc074fe..629a3d8bd 100644 --- a/targets/minecraft/world/item/SpawnEggItem.cpp +++ b/targets/minecraft/world/item/SpawnEggItem.cpp @@ -1,15 +1,14 @@ -#include "minecraft/IGameServices.h" #include "SpawnEggItem.h" #include #include #include "Facing.h" -#include "minecraft/client/resources/Colours/ColourTable.h" -#include "util/StringHelpers.h" #include "java/Class.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/util/Mth.h" #include "minecraft/world/Difficulty.h" #include "minecraft/world/IconRegister.h" @@ -25,6 +24,7 @@ #include "minecraft/world/level/tile/entity/MobSpawnerTileEntity.h" #include "minecraft/world/phys/HitResult.h" #include "strings.h" +#include "util/StringHelpers.h" SpawnEggItem::SpawnEggItem(int id) : Item(id) { setMaxStackSize(16); // 4J-PB brought forward. It is 64 on PC, but we'll @@ -39,8 +39,8 @@ std::string SpawnEggItem::getHoverName( int nameId = EntityIO::getNameId(itemInstance->getAuxValue()); if (nameId >= 0) { - elementName = - replaceAll(elementName, "{*CREATURE*}", gameServices().getString(nameId)); + elementName = replaceAll(elementName, "{*CREATURE*}", + gameServices().getString(nameId)); // elementName += " " + I18n.get("entity." + encodeId + ".name"); } else { elementName = replaceAll(elementName, "{*CREATURE*}", ""); @@ -140,7 +140,7 @@ std::shared_ptr SpawnEggItem::canSpawn(int iAuxVal, Level* level, } // 4J: Use eTYPE_ENEMY instead of monster (slimes and ghasts // aren't monsters) - else if (newEntity->instanceof(eTYPE_ENEMY)) { + else if (newEntity->instanceof (eTYPE_ENEMY)) { // 4J-PB - check if the player is trying to spawn an enemy // in peaceful mode if (level->difficulty == Difficulty::PEACEFUL) { @@ -218,8 +218,8 @@ bool SpawnEggItem::useOn(std::shared_ptr itemInstance, if (result != nullptr) { // 4J-JEV: SetCustomName is a method for Mob not LivingEntity; so change // instanceof to check for Mobs. - if (result->instanceof(eTYPE_MOB) && - itemInstance->hasCustomHoverName()) { + if (result->instanceof + (eTYPE_MOB) && itemInstance->hasCustomHoverName()) { std::dynamic_pointer_cast(result)->setCustomName( itemInstance->getHoverName()); } @@ -263,8 +263,8 @@ std::shared_ptr SpawnEggItem::use( if (result != nullptr) { // 4J-JEV: SetCustomName is a method for Mob not LivingEntity; // so change instanceof to check for Mobs. - if (result->instanceof(eTYPE_MOB) && - itemInstance->hasCustomHoverName()) { + if (result->instanceof + (eTYPE_MOB) && itemInstance->hasCustomHoverName()) { std::dynamic_pointer_cast(result)->setCustomName( itemInstance->getHoverName()); } @@ -301,7 +301,7 @@ std::shared_ptr SpawnEggItem::spawnMobAt(Level* level, int auxVal, // 4J-JEV: DynCasting to Mob not LivingEntity; so change instanceof to // check for Mobs. - if (newEntity != nullptr && newEntity->instanceof(eTYPE_MOB)) { + if (newEntity != nullptr && newEntity->instanceof (eTYPE_MOB)) { std::shared_ptr mob = std::dynamic_pointer_cast(newEntity); newEntity->moveTo( diff --git a/targets/minecraft/world/item/TileItem.cpp b/targets/minecraft/world/item/TileItem.cpp index 735064e40..791681074 100644 --- a/targets/minecraft/world/item/TileItem.cpp +++ b/targets/minecraft/world/item/TileItem.cpp @@ -1,15 +1,13 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" - - #include "TileItem.h" #include -#include "minecraft/Console_Debug_enum.h" #include "java/Class.h" +#include "minecraft/Console_Debug_enum.h" #include "minecraft/Facing.h" +#include "minecraft/IGameServices.h" #include "minecraft/stats/GenericStats.h" +#include "minecraft/util/Log.h" #include "minecraft/world/Icon.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/entity/player/Player.h" @@ -156,8 +154,8 @@ bool TileItem::useOn(std::shared_ptr instance, // Log::info("Place Sound - %s, Step Sound - // %s\n",szPlaceSoundName,szStepSoundName); - Log::info("Place Sound - %d, Step Sound - %d\n", - iPlaceSound, iStepSound); + Log::info("Place Sound - %d, Step Sound - %d\n", iPlaceSound, + iStepSound); #endif level->playSound(x + 0.5f, y + 0.5f, z + 0.5f, tile->soundType->getPlaceSound(), diff --git a/targets/minecraft/world/item/alchemy/PotionBrewing.cpp b/targets/minecraft/world/item/alchemy/PotionBrewing.cpp index acb0c336b..915818e8e 100644 --- a/targets/minecraft/world/item/alchemy/PotionBrewing.cpp +++ b/targets/minecraft/world/item/alchemy/PotionBrewing.cpp @@ -2,11 +2,11 @@ #include -#include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/JavaMath.h" +#include "minecraft/GameEnums.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/world/effect/MobEffect.h" #include "minecraft/world/effect/MobEffectInstance.h" #include "strings.h" @@ -75,7 +75,7 @@ const std::string PotionBrewing::MOD_GLOWSTONE = // with water bottle and gunpowder const std::string PotionBrewing::MOD_GUNPOWDER = "+14"; //&13-13"; // gunpowder makes them throwable! // gunpowder requires - // 13 and sets 14 + // 13 and sets 14 #else const std::string PotionBrewing::MOD_WATER = "-1-3-5-7-9-11-13"; const std::string PotionBrewing::MOD_SUGAR = "+0"; @@ -91,7 +91,7 @@ const std::string PotionBrewing::MOD_GLOWSTONE = ""; // glowstone increases amplification const std::string PotionBrewing::MOD_GUNPOWDER = ""; // gunpowder makes them throwable! // gunpowder requires 13 and sets - // 14 + // 14 #endif PotionBrewing::intStringMap PotionBrewing::potionEffectDuration; diff --git a/targets/minecraft/world/item/alchemy/PotionBrewing.h b/targets/minecraft/world/item/alchemy/PotionBrewing.h index 546e83747..59dfcec24 100644 --- a/targets/minecraft/world/item/alchemy/PotionBrewing.h +++ b/targets/minecraft/world/item/alchemy/PotionBrewing.h @@ -98,8 +98,8 @@ private: int countCompare, int valuePart, int multiplierPart, int brew); static int countOnes(int brew); - static int parseEffectFormulaValue(const std::string& definition, - int start, int end, int brew); + static int parseEffectFormulaValue(const std::string& definition, int start, + int end, int brew); public: static std::vector* getEffects( diff --git a/targets/minecraft/world/item/crafting/ArmorDyeRecipe.cpp b/targets/minecraft/world/item/crafting/ArmorDyeRecipe.cpp index 7f8fa3ad3..8be5a539c 100644 --- a/targets/minecraft/world/item/crafting/ArmorDyeRecipe.cpp +++ b/targets/minecraft/world/item/crafting/ArmorDyeRecipe.cpp @@ -5,7 +5,6 @@ #include #include -#include "platform/PlatformTypes.h" #include "minecraft/world/entity/animal/Sheep.h" #include "minecraft/world/inventory/CraftingContainer.h" #include "minecraft/world/item/ArmorItem.h" @@ -15,6 +14,7 @@ #include "minecraft/world/item/crafting/Recipy.h" #include "minecraft/world/item/crafting/ShapedRecipy.h" #include "minecraft/world/level/tile/ColoredTile.h" +#include "platform/PlatformTypes.h" bool ArmorDyeRecipe::matches(std::shared_ptr craftSlots, Level* level) { diff --git a/targets/minecraft/world/item/crafting/ArmorRecipes.cpp b/targets/minecraft/world/item/crafting/ArmorRecipes.cpp index 25488a652..04e01d33c 100644 --- a/targets/minecraft/world/item/crafting/ArmorRecipes.cpp +++ b/targets/minecraft/world/item/crafting/ArmorRecipes.cpp @@ -12,18 +12,18 @@ // 4J-PB - adding "" on the end of these so we can detect it std::string ArmorRecipes::shapes[][4] = { - {"XXX", // + {"XXX", // "X X", ""}, // - {"X X", // - "XXX", // + {"X X", // + "XXX", // "XXX", ""}, // - {"XXX", // - "X X", // + {"XXX", // + "X X", // "X X", ""}, // - {"X X", // + {"X X", // "X X", ""}, // }; diff --git a/targets/minecraft/world/item/crafting/ClothDyeRecipes.cpp b/targets/minecraft/world/item/crafting/ClothDyeRecipes.cpp index 45717de60..e1f81d734 100644 --- a/targets/minecraft/world/item/crafting/ClothDyeRecipes.cpp +++ b/targets/minecraft/world/item/crafting/ClothDyeRecipes.cpp @@ -104,7 +104,6 @@ void ClothDyeRecipes::addRecipes(Recipes* r) { for (int i = 0; i < 16; i++) { r->addShapedRecipy(new ItemInstance(Tile::woolCarpet, 3, i), "sczg", - "##", '#', new ItemInstance(Tile::wool, 1, i), - 'D'); + "##", '#', new ItemInstance(Tile::wool, 1, i), 'D'); } } diff --git a/targets/minecraft/world/item/crafting/Recipes.cpp b/targets/minecraft/world/item/crafting/Recipes.cpp index 68509e580..912f29d15 100644 --- a/targets/minecraft/world/item/crafting/Recipes.cpp +++ b/targets/minecraft/world/item/crafting/Recipes.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "minecraft/world/item/crafting/Recipes.h" #include @@ -9,6 +8,7 @@ #include #include +#include "minecraft/util/Log.h" #include "minecraft/world/inventory/CraftingContainer.h" #include "minecraft/world/item/CoalItem.h" #include "minecraft/world/item/Item.h" @@ -79,13 +79,12 @@ Recipes::Recipes() { '#', new ItemInstance(Tile::treeTrunk, 1, 0), 'S'); // TU9 - adding coloured wood - addShapedRecipy(new ItemInstance(Tile::wood, 4, TreeTile::BIRCH_TRUNK), // - "sczg", - "#", // + addShapedRecipy( + new ItemInstance(Tile::wood, 4, TreeTile::BIRCH_TRUNK), // + "sczg", + "#", // - '#', - new ItemInstance(Tile::treeTrunk, 1, TreeTile::BIRCH_TRUNK), - 'S'); + '#', new ItemInstance(Tile::treeTrunk, 1, TreeTile::BIRCH_TRUNK), 'S'); addShapedRecipy( new ItemInstance(Tile::wood, 4, TreeTile::DARK_TRUNK), // @@ -99,8 +98,7 @@ Recipes::Recipes() { "sczg", "#", // - '#', new ItemInstance(Tile::treeTrunk, 1, TreeTile::JUNGLE_TRUNK), - 'S'); + '#', new ItemInstance(Tile::treeTrunk, 1, TreeTile::JUNGLE_TRUNK), 'S'); addShapedRecipy(new ItemInstance(Item::stick, 4), // "ssctg", @@ -261,14 +259,14 @@ Recipes::Recipes() { '#', Tile::sandStone, 'S'); - addShapedRecipy( - new ItemInstance(Tile::woodStairsBirch, 4), // - "sssczg", - "# ", // - "## ", // - "###", // + addShapedRecipy(new ItemInstance(Tile::woodStairsBirch, 4), // + "sssczg", + "# ", // + "## ", // + "###", // - '#', new ItemInstance(Tile::wood, 1, TreeTile::BIRCH_TRUNK), 'S'); + '#', new ItemInstance(Tile::wood, 1, TreeTile::BIRCH_TRUNK), + 'S'); addShapedRecipy(new ItemInstance(Tile::woodStairsDark, 4), // "sssczg", @@ -669,8 +667,8 @@ Recipes::Recipes() { "#X#", // "III", // - '#', Tile::redstoneTorch_on, 'X', Item::netherQuartz, - 'I', Tile::stone, 'M'); + '#', Tile::redstoneTorch_on, 'X', Item::netherQuartz, 'I', + Tile::stone, 'M'); addShapedRecipy(new ItemInstance(Tile::daylightDetector), "sssctcictg", "GGG", "QQQ", "WWW", @@ -767,8 +765,8 @@ Recipes::Recipes() { "###", // "#X#", // "#R#", // - '#', Tile::cobblestone, 'X', Item::bow, 'R', - Item::redStone, 'M'); + '#', Tile::cobblestone, 'X', Item::bow, 'R', Item::redStone, + 'M'); addShapedRecipy(new ItemInstance(Tile::dropper, 1), // "sssctcig", diff --git a/targets/minecraft/world/item/crafting/Recipes.h b/targets/minecraft/world/item/crafting/Recipes.h index 33f9bc0bc..b119769ad 100644 --- a/targets/minecraft/world/item/crafting/Recipes.h +++ b/targets/minecraft/world/item/crafting/Recipes.h @@ -79,7 +79,7 @@ public: iteminstance = i; } - eINSTANCEOF instanceof() { return eType; } + eINSTANCEOF instanceof () { return eType; } eINSTANCEOF GetType() { return eType; }; private: diff --git a/targets/minecraft/world/item/crafting/Recipy.h b/targets/minecraft/world/item/crafting/Recipy.h index 9f0ff125c..a1460182e 100644 --- a/targets/minecraft/world/item/crafting/Recipy.h +++ b/targets/minecraft/world/item/crafting/Recipy.h @@ -5,8 +5,8 @@ #pragma once -#include "platform/PlatformTypes.h" #include "minecraft/world/inventory/CraftingContainer.h" +#include "platform/PlatformTypes.h" #define RECIPE_TYPE_2x2 0 #define RECIPE_TYPE_3x3 1 diff --git a/targets/minecraft/world/item/crafting/ShapedRecipy.cpp b/targets/minecraft/world/item/crafting/ShapedRecipy.cpp index c66fc3fe4..50ba3af68 100644 --- a/targets/minecraft/world/item/crafting/ShapedRecipy.cpp +++ b/targets/minecraft/world/item/crafting/ShapedRecipy.cpp @@ -4,16 +4,15 @@ // import net.minecraft.world.inventory.CraftingContainer; // import net.minecraft.world.item.ItemInstance; -#include "ShapedRecipy.h" - #include -#include "platform/PlatformTypes.h" #include "Recipes.h" +#include "ShapedRecipy.h" #include "minecraft/world/inventory/CraftingContainer.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/item/crafting/Recipy.h" #include "nbt/CompoundTag.h" +#include "platform/PlatformTypes.h" // 4J-PB - for new crafting - Adding group to define type of item that the // recipe produces diff --git a/targets/minecraft/world/item/crafting/ShapelessRecipy.cpp b/targets/minecraft/world/item/crafting/ShapelessRecipy.cpp index 5b8ba09ad..d4c304491 100644 --- a/targets/minecraft/world/item/crafting/ShapelessRecipy.cpp +++ b/targets/minecraft/world/item/crafting/ShapelessRecipy.cpp @@ -12,11 +12,11 @@ #include #include -#include "platform/PlatformTypes.h" #include "Recipes.h" #include "minecraft/world/inventory/CraftingContainer.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/item/crafting/Recipy.h" +#include "platform/PlatformTypes.h" ShapelessRecipy::ShapelessRecipy(ItemInstance* result, std::vector* ingredients, diff --git a/targets/minecraft/world/item/crafting/StructureRecipes.cpp b/targets/minecraft/world/item/crafting/StructureRecipes.cpp index 6d4a382d7..dc29a4400 100644 --- a/targets/minecraft/world/item/crafting/StructureRecipes.cpp +++ b/targets/minecraft/world/item/crafting/StructureRecipes.cpp @@ -34,8 +34,7 @@ void StructureRecipies::addRecipes(Recipes* r) { "#", // "#", // - '#', - new ItemInstance(Tile::stoneSlabHalf, 1, StoneSlabTile::SAND_SLAB), + '#', new ItemInstance(Tile::stoneSlabHalf, 1, StoneSlabTile::SAND_SLAB), 'S'); r->addShapedRecipy( diff --git a/targets/minecraft/world/item/crafting/WeaponRecipes.cpp b/targets/minecraft/world/item/crafting/WeaponRecipes.cpp index a3c14af3c..3ac71fa01 100644 --- a/targets/minecraft/world/item/crafting/WeaponRecipes.cpp +++ b/targets/minecraft/world/item/crafting/WeaponRecipes.cpp @@ -10,8 +10,8 @@ // 4J-PB - adding "" on the end of these so we can detect it std::string WeaponRecipies::shapes[][4] = { - {"X", // - "X", // + {"X", // + "X", // "#", ""}, // }; diff --git a/targets/minecraft/world/item/enchantment/Enchantment.cpp b/targets/minecraft/world/item/enchantment/Enchantment.cpp index f4e3afedd..6b0147ed5 100644 --- a/targets/minecraft/world/item/enchantment/Enchantment.cpp +++ b/targets/minecraft/world/item/enchantment/Enchantment.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "Enchantment.h" #include @@ -6,6 +5,7 @@ #include "minecraft/IGameServices.h" #include "minecraft/util/HtmlString.h" +#include "minecraft/util/Log.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/item/enchantment/ArrowDamageEnchantment.h" #include "minecraft/world/item/enchantment/ArrowFireEnchantment.h" @@ -162,7 +162,8 @@ int Enchantment::getDescriptionId() { return descriptionId; } // 4jcraft: re-added old TU18 overload for java gui std::string Enchantment::getFullname(int level, std::string& unformatted) { char formatted[256]; - snprintf(formatted, 256, "%s %s", gameServices().getString(getDescriptionId()), + snprintf(formatted, 256, "%s %s", + gameServices().getString(getDescriptionId()), getLevelString(level).c_str()); unformatted = formatted; snprintf(formatted, 256, "%s", @@ -172,7 +173,8 @@ std::string Enchantment::getFullname(int level, std::string& unformatted) { HtmlString Enchantment::getFullname(int level) { char formatted[256]; - snprintf(formatted, 256, "%s %s", gameServices().getString(getDescriptionId()), + snprintf(formatted, 256, "%s %s", + gameServices().getString(getDescriptionId()), getLevelString(level).c_str()); return HtmlString(formatted, eHTMLColor_f); @@ -214,5 +216,6 @@ std::string Enchantment::getLevelString(int level) { stringId = IDS_ENCHANTMENT_LEVEL_10; break; }; - return gameServices().getString(stringId); // I18n.get("enchantment.level." + level); + return gameServices().getString( + stringId); // I18n.get("enchantment.level." + level); } \ No newline at end of file diff --git a/targets/minecraft/world/item/enchantment/EnchantmentHelper.cpp b/targets/minecraft/world/item/enchantment/EnchantmentHelper.cpp index ec6a96030..b88a730e6 100644 --- a/targets/minecraft/world/item/enchantment/EnchantmentHelper.cpp +++ b/targets/minecraft/world/item/enchantment/EnchantmentHelper.cpp @@ -29,8 +29,8 @@ int EnchantmentHelper::getEnchantmentLevel( return 0; } for (int i = 0; i < enchantmentTags->size(); i++) { - int type = enchantmentTags->get(i)->getShort( - (char*)ItemInstance::TAG_ENCH_ID); + int type = + enchantmentTags->get(i)->getShort((char*)ItemInstance::TAG_ENCH_ID); int level = enchantmentTags->get(i)->getShort( (char*)ItemInstance::TAG_ENCH_LEVEL); @@ -51,8 +51,7 @@ std::unordered_map* EnchantmentHelper::getEnchantments( if (list != nullptr) { for (int i = 0; i < list->size(); i++) { - int type = - list->get(i)->getShort((char*)ItemInstance::TAG_ENCH_ID); + int type = list->get(i)->getShort((char*)ItemInstance::TAG_ENCH_ID); int level = list->get(i)->getShort((char*)ItemInstance::TAG_ENCH_LEVEL); @@ -119,8 +118,8 @@ void EnchantmentHelper::runIterationOnItem( return; } for (int i = 0; i < enchantmentTags->size(); i++) { - int type = enchantmentTags->get(i)->getShort( - (char*)ItemInstance::TAG_ENCH_ID); + int type = + enchantmentTags->get(i)->getShort((char*)ItemInstance::TAG_ENCH_ID); int level = enchantmentTags->get(i)->getShort( (char*)ItemInstance::TAG_ENCH_LEVEL); diff --git a/targets/minecraft/world/item/trading/MerchantRecipeList.cpp b/targets/minecraft/world/item/trading/MerchantRecipeList.cpp index 6a8864d1c..75c2b52b6 100644 --- a/targets/minecraft/world/item/trading/MerchantRecipeList.cpp +++ b/targets/minecraft/world/item/trading/MerchantRecipeList.cpp @@ -135,8 +135,7 @@ MerchantRecipeList* MerchantRecipeList::createFromStream( } void MerchantRecipeList::load(CompoundTag* tag) { - ListTag* list = - (ListTag*)tag->getList("Recipes"); + ListTag* list = (ListTag*)tag->getList("Recipes"); for (int i = 0; i < list->size(); i++) { CompoundTag* recipeTag = list->get(i); diff --git a/targets/minecraft/world/level/BaseMobSpawner.cpp b/targets/minecraft/world/level/BaseMobSpawner.cpp index 893085100..3356314c8 100644 --- a/targets/minecraft/world/level/BaseMobSpawner.cpp +++ b/targets/minecraft/world/level/BaseMobSpawner.cpp @@ -114,10 +114,8 @@ void BaseMobSpawner::tick() { double zp = getZ() + (getLevel()->random->nextDouble() - getLevel()->random->nextDouble()) * spawnRange; - std::shared_ptr mob = - entity->instanceof(eTYPE_MOB) - ? std::dynamic_pointer_cast(entity) - : nullptr; + std::shared_ptr mob = entity->instanceof + (eTYPE_MOB) ? std::dynamic_pointer_cast(entity) : nullptr; entity->moveTo(xp, yp, zp, getLevel()->random->nextFloat() * 360, 0); @@ -181,8 +179,8 @@ std::shared_ptr BaseMobSpawner::loadDataAndAddEntity( data = ridingTag; } - } else if (entity->instanceof(eTYPE_LIVINGENTITY) && - entity->level != nullptr) { + } else if (entity->instanceof + (eTYPE_LIVINGENTITY) && entity->level != nullptr) { std::dynamic_pointer_cast(entity)->finalizeMobSpawn(nullptr); getLevel()->addEntity(entity); } diff --git a/targets/minecraft/world/level/ChunkPos.cpp b/targets/minecraft/world/level/ChunkPos.cpp index 7bd788bf9..5e47710ec 100644 --- a/targets/minecraft/world/level/ChunkPos.cpp +++ b/targets/minecraft/world/level/ChunkPos.cpp @@ -4,9 +4,9 @@ #include #include -#include "util/StringHelpers.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/level/TilePos.h" +#include "util/StringHelpers.h" ChunkPos::ChunkPos(int x, int z) : x(x), z(z) {} diff --git a/targets/minecraft/world/level/Coord.h b/targets/minecraft/world/level/Coord.h index e1add5020..f2f94d092 100644 --- a/targets/minecraft/world/level/Coord.h +++ b/targets/minecraft/world/level/Coord.h @@ -5,5 +5,5 @@ public: const int x, y, z; public: - Coord(int x, int y, int z) : x(x), y(y), z(z) {}; + Coord(int x, int y, int z) : x(x), y(y), z(z){}; }; \ No newline at end of file diff --git a/targets/minecraft/world/level/Explosion.cpp b/targets/minecraft/world/level/Explosion.cpp index 16516e658..e942a9d4a 100644 --- a/targets/minecraft/world/level/Explosion.cpp +++ b/targets/minecraft/world/level/Explosion.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "Explosion.h" #include @@ -11,6 +10,7 @@ #include "java/Random.h" #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/sounds/SoundTypes.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/entity/Entity.h" @@ -170,7 +170,7 @@ void Explosion::explode() { e->yd += ya * kbPower; e->zd += za * kbPower; - if (e->instanceof(eTYPE_PLAYER)) { + if (e->instanceof (eTYPE_PLAYER)) { std::shared_ptr player = std::dynamic_pointer_cast(e); // Log::info("Adding player knockback (%f,%f,%f)\n", xa * @@ -300,9 +300,9 @@ Vec3 Explosion::getHitPlayerKnockback(std::shared_ptr player) { std::shared_ptr Explosion::getSourceMob() { if (source == nullptr) return nullptr; - if (source->instanceof(eTYPE_PRIMEDTNT)) + if (source->instanceof (eTYPE_PRIMEDTNT)) return std::dynamic_pointer_cast(source)->getOwner(); - if (source->instanceof(eTYPE_LIVINGENTITY)) + if (source->instanceof (eTYPE_LIVINGENTITY)) return std::dynamic_pointer_cast(source); return nullptr; } diff --git a/targets/minecraft/world/level/FoliageColor.cpp b/targets/minecraft/world/level/FoliageColor.cpp index 32b64bc16..77aae202e 100644 --- a/targets/minecraft/world/level/FoliageColor.cpp +++ b/targets/minecraft/world/level/FoliageColor.cpp @@ -1,8 +1,8 @@ #include "FoliageColor.h" #include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/client/Minecraft.h" +#include "minecraft/client/resources/Colours/ColourTable.h" // 4J Stu - Don't use this any more // std::vector FoliageColor::pixels; diff --git a/targets/minecraft/world/level/GameRules.cpp b/targets/minecraft/world/level/GameRules.cpp index b3682d251..d97eebf7b 100644 --- a/targets/minecraft/world/level/GameRules.cpp +++ b/targets/minecraft/world/level/GameRules.cpp @@ -1,9 +1,9 @@ -#include "minecraft/IGameServices.h" #include "GameRules.h" #include #include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" // 4J: GameRules isn't in use anymore, just routes any requests to app game host // options, kept things commented out for context @@ -40,21 +40,28 @@ GameRules::~GameRules() { bool GameRules::getBoolean(const int rule) { switch (rule) { case GameRules::RULE_DOFIRETICK: - return gameServices().getGameHostOption(eGameHostOption_FireSpreads); + return gameServices().getGameHostOption( + eGameHostOption_FireSpreads); case GameRules::RULE_MOBGRIEFING: - return gameServices().getGameHostOption(eGameHostOption_MobGriefing); + return gameServices().getGameHostOption( + eGameHostOption_MobGriefing); case GameRules::RULE_KEEPINVENTORY: - return gameServices().getGameHostOption(eGameHostOption_KeepInventory); + return gameServices().getGameHostOption( + eGameHostOption_KeepInventory); case GameRules::RULE_DOMOBSPAWNING: - return gameServices().getGameHostOption(eGameHostOption_DoMobSpawning); + return gameServices().getGameHostOption( + eGameHostOption_DoMobSpawning); case GameRules::RULE_DOMOBLOOT: return gameServices().getGameHostOption(eGameHostOption_DoMobLoot); case GameRules::RULE_DOTILEDROPS: - return gameServices().getGameHostOption(eGameHostOption_DoTileDrops); + return gameServices().getGameHostOption( + eGameHostOption_DoTileDrops); case GameRules::RULE_NATURAL_REGENERATION: - return gameServices().getGameHostOption(eGameHostOption_NaturalRegeneration); + return gameServices().getGameHostOption( + eGameHostOption_NaturalRegeneration); case GameRules::RULE_DAYLIGHT: - return gameServices().getGameHostOption(eGameHostOption_DoDaylightCycle); + return gameServices().getGameHostOption( + eGameHostOption_DoDaylightCycle); default: assert(0); return false; diff --git a/targets/minecraft/world/level/GameRules/GameRuleDefinition.h b/targets/minecraft/world/level/GameRules/GameRuleDefinition.h index 3f87bb51b..9117995a0 100644 --- a/targets/minecraft/world/level/GameRules/GameRuleDefinition.h +++ b/targets/minecraft/world/level/GameRules/GameRuleDefinition.h @@ -6,9 +6,9 @@ #include #include +#include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "minecraft/world/level/GameRules/GameRulesInstance.h" -#include "minecraft/world/item/ItemInstance.h" class GameRule; class LevelRuleset; @@ -81,7 +81,6 @@ public: GameRulesInstance::EGameRulesInstanceType type, LevelRuleset* rules, Connection* connection); static std::string generateDescriptionString( - ConsoleGameRules::EGameRuleType defType, - const std::string& description, void* data = nullptr, - int dataLength = 0); + ConsoleGameRules::EGameRuleType defType, const std::string& description, + void* data = nullptr, int dataLength = 0); }; diff --git a/targets/minecraft/world/level/GameRules/LevelGenerationOptions.h b/targets/minecraft/world/level/GameRules/LevelGenerationOptions.h index f39dc5794..c667076ab 100644 --- a/targets/minecraft/world/level/GameRules/LevelGenerationOptions.h +++ b/targets/minecraft/world/level/GameRules/LevelGenerationOptions.h @@ -8,9 +8,9 @@ #include #include +#include "minecraft/locale/StringTable.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "minecraft/world/level/GameRules/GameRuleDefinition.h" -#include "minecraft/locale/StringTable.h" #include "minecraft/world/level/levelgen/structure/StructureFeature.h" class ApplySchematicRuleDefinition; @@ -188,7 +188,8 @@ private: bool m_bHaveMinY; int m_minY; std::unordered_map m_schematics; - std::unordered_map + std::unordered_map m_chunkRuleCache; std::vector m_biomeOverrides; std::vector m_features; diff --git a/targets/minecraft/world/level/Level.cpp b/targets/minecraft/world/level/Level.cpp index ea7f6961d..1b984f1f9 100644 --- a/targets/minecraft/world/level/Level.cpp +++ b/targets/minecraft/world/level/Level.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "Level.h" #include @@ -15,23 +13,23 @@ #include #include "Explosion.h" -#include "platform/input/input.h" #include "LevelListener.h" -#include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" -#include "minecraft/Console_Debug_enum.h" -#include "minecraft/network/INetworkService.h" -#include "util/FrameProfiler.h" #include "java/Random.h" +#include "minecraft/Console_Debug_enum.h" #include "minecraft/Direction.h" #include "minecraft/Facing.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/Pos.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/renderer/LevelRenderer.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/core/particles/ParticleTypes.h" +#include "minecraft/network/INetworkService.h" #include "minecraft/sounds/SoundTypes.h" #include "minecraft/stats/GenericStats.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" #include "minecraft/world/Difficulty.h" #include "minecraft/world/entity/Entity.h" @@ -71,6 +69,8 @@ #include "minecraft/world/phys/HitResult.h" #include "minecraft/world/phys/Vec3.h" #include "minecraft/world/scores/Scoreboard.h" +#include "platform/input/input.h" +#include "util/FrameProfiler.h" class CompoundTag; class ItemInstance; @@ -1574,12 +1574,12 @@ bool Level::addEntity(std::shared_ptr e) { } bool forced = e->forcedLoading; - if (e->instanceof(eTYPE_PLAYER)) { + if (e->instanceof (eTYPE_PLAYER)) { forced = true; } if (forced || hasChunk(xc, zc)) { - if (e->instanceof(eTYPE_PLAYER)) { + if (e->instanceof (eTYPE_PLAYER)) { std::shared_ptr player = std::dynamic_pointer_cast(e); @@ -1634,7 +1634,7 @@ void Level::removeEntity(std::shared_ptr e) { e->ride(nullptr); } e->remove(); - if (e->instanceof(eTYPE_PLAYER)) { + if (e->instanceof (eTYPE_PLAYER)) { std::vector >::iterator it = players.begin(); std::vector >::iterator itEnd = players.end(); while (it != itEnd && *it != std::dynamic_pointer_cast(e)) it++; @@ -1653,7 +1653,7 @@ void Level::removeEntity(std::shared_ptr e) { void Level::removeEntityImmediately(std::shared_ptr e) { e->remove(); - if (e->instanceof(eTYPE_PLAYER)) { + if (e->instanceof (eTYPE_PLAYER)) { std::vector >::iterator it = players.begin(); std::vector >::iterator itEnd = players.end(); while (it != itEnd && *it != std::dynamic_pointer_cast(e)) it++; @@ -2112,8 +2112,9 @@ void Level::tickEntities() { if (!e->removed) { #if !defined(_FINAL_BUILD) - if (!(gameServices().debugSettingsOn() && gameServices().debugMobsDontTick() && - e->instanceof(eTYPE_MOB) && !e->instanceof(eTYPE_PLAYER))) + if (!(gameServices().debugSettingsOn() && + gameServices().debugMobsDontTick() && e->instanceof + (eTYPE_MOB) && !e->instanceof (eTYPE_PLAYER))) #endif { tick(e); @@ -3444,7 +3445,7 @@ unsigned int Level::countInstanceOf( count++; } } else { - if (e->instanceof(clas)) count++; + if (e->instanceof (clas)) count++; } } } @@ -3471,7 +3472,7 @@ unsigned int Level::countInstanceOfInRange(eINSTANCEOF clas, bool singleType, count++; } } else { - if (e->instanceof(clas)) count++; + if (e->instanceof (clas)) count++; } } } @@ -4223,7 +4224,7 @@ bool Level::canCreateMore(eINSTANCEOF type, ESPAWN_TYPE spawnType) { } // 4J: Use eTYPE_ENEMY instead of monster (slimes and ghasts // aren't monsters) - else if (Entity::instanceof(type, eTYPE_ENEMY)) { + else if (Entity:: instanceof (type, eTYPE_ENEMY)) { count = countInstanceOf(eTYPE_ENEMY, false); max = MobCategory::MAX_XBOX_MONSTERS_WITH_SPAWN_EGG; } else if ((type & eTYPE_AMBIENT) == eTYPE_AMBIENT) { @@ -4231,10 +4232,10 @@ bool Level::canCreateMore(eINSTANCEOF type, ESPAWN_TYPE spawnType) { max = MobCategory::MAX_AMBIENT_WITH_SPAWN_EGG; } // 4J: Added minecart and boats - else if (Entity::instanceof(type, eTYPE_MINECART)) { + else if (Entity:: instanceof (type, eTYPE_MINECART)) { count = countInstanceOf(eTYPE_MINECART, false); max = Level::MAX_CONSOLE_MINECARTS; - } else if (Entity::instanceof(type, eTYPE_BOAT)) { + } else if (Entity:: instanceof (type, eTYPE_BOAT)) { count = countInstanceOf(eTYPE_BOAT, true); max = Level::MAX_XBOX_BOATS; } diff --git a/targets/minecraft/world/level/Level.h b/targets/minecraft/world/level/Level.h index 64ff774f0..43fa76d0b 100644 --- a/targets/minecraft/world/level/Level.h +++ b/targets/minecraft/world/level/Level.h @@ -10,12 +10,10 @@ #include #include -#include "platform/PlatformTypes.h" #include "ChunkPos.h" #include "LevelSource.h" #include "LightLayer.h" #include "TickNextTickData.h" -#include "platform/C4JThread.h" #include "java/Class.h" #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/world/level/ChunkPos.h" @@ -24,6 +22,8 @@ #include "minecraft/world/level/biome/Biome.h" #include "minecraft/world/level/saveddata/SavedData.h" #include "minecraft/world/phys/AABB.h" +#include "platform/C4JThread.h" +#include "platform/PlatformTypes.h" class CompoundTag; class ItemInstance; @@ -635,8 +635,8 @@ public: int source); virtual float getDifficulty(double x, double y, double z); virtual float getDifficulty(int x, int y, int z); - TilePos* findNearestMapFeature(const std::string& featureName, int x, - int y, int z); + TilePos* findNearestMapFeature(const std::string& featureName, int x, int y, + int z); // 4J Added int getAuxValueForMap(PlayerUID xuid, int dimension, int centreXC, diff --git a/targets/minecraft/world/level/PortalForcer.cpp b/targets/minecraft/world/level/PortalForcer.cpp index 505b37645..8529fd156 100644 --- a/targets/minecraft/world/level/PortalForcer.cpp +++ b/targets/minecraft/world/level/PortalForcer.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "PortalForcer.h" #include @@ -8,6 +7,7 @@ #include "minecraft/Direction.h" #include "minecraft/SharedConstants.h" #include "minecraft/server/level/ServerLevel.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/level/ChunkPos.h" diff --git a/targets/minecraft/world/level/biome/Biome.cpp b/targets/minecraft/world/level/biome/Biome.cpp index 6dc0e967c..cdf85d28d 100644 --- a/targets/minecraft/world/level/biome/Biome.cpp +++ b/targets/minecraft/world/level/biome/Biome.cpp @@ -6,11 +6,11 @@ #include #include -#include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/Class.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/world/entity/MobCategory.h" #include "minecraft/world/level/biome/BeachBiome.h" #include "minecraft/world/level/biome/BiomeDecorator.h" diff --git a/targets/minecraft/world/level/biome/Biome.h b/targets/minecraft/world/level/biome/Biome.h index 57a1fe990..ad67a09a2 100644 --- a/targets/minecraft/world/level/biome/Biome.h +++ b/targets/minecraft/world/level/biome/Biome.h @@ -6,8 +6,8 @@ #include #include -#include "minecraft/GameEnums.h" #include "java/Class.h" +#include "minecraft/GameEnums.h" #include "minecraft/util/WeighedRandom.h" #include "minecraft/world/entity/Mob.h" #include "minecraft/world/level/LevelSource.h" diff --git a/targets/minecraft/world/level/biome/BiomeCache.cpp b/targets/minecraft/world/level/biome/BiomeCache.cpp index 65a8f3b3e..8912ac2b8 100644 --- a/targets/minecraft/world/level/biome/BiomeCache.cpp +++ b/targets/minecraft/world/level/biome/BiomeCache.cpp @@ -1,9 +1,9 @@ -#include "minecraft/IGameServices.h" #include "BiomeCache.h" #include #include "BiomeSource.h" +#include "minecraft/IGameServices.h" #include "minecraft/world/level/biome/Biome.h" BiomeCache::Block::Block(int x, int z, BiomeCache* parent) { diff --git a/targets/minecraft/world/level/biome/BiomeDecorator.cpp b/targets/minecraft/world/level/biome/BiomeDecorator.cpp index a02a9a159..76a256ba5 100644 --- a/targets/minecraft/world/level/biome/BiomeDecorator.cpp +++ b/targets/minecraft/world/level/biome/BiomeDecorator.cpp @@ -1,8 +1,7 @@ -#include "minecraft/util/Log.h" - #include "minecraft/world/level/biome/BiomeDecorator.h" #include "java/Random.h" +#include "minecraft/util/Log.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/biome/Biome.h" #include "minecraft/world/level/biome/WaterlilyFeature.h" diff --git a/targets/minecraft/world/level/biome/BiomeSource.cpp b/targets/minecraft/world/level/biome/BiomeSource.cpp index 3d5ac8dc3..bfbab599a 100644 --- a/targets/minecraft/world/level/biome/BiomeSource.cpp +++ b/targets/minecraft/world/level/biome/BiomeSource.cpp @@ -1,17 +1,16 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "BiomeSource.h" #include #include -#include "platform/input/input.h" -#include "minecraft/Console_Debug_enum.h" #include "java/Random.h" #include "java/System.h" +#include "minecraft/Console_Debug_enum.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/ProgressRenderer.h" +#include "minecraft/util/Log.h" #include "minecraft/world/level/ChunkPos.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/TilePos.h" @@ -19,6 +18,7 @@ #include "minecraft/world/level/biome/BiomeCache.h" #include "minecraft/world/level/newbiome/layer/Layer.h" #include "minecraft/world/level/storage/LevelData.h" +#include "platform/input/input.h" #include "strings.h" // 4J - removal of separate temperature & downfall layers brought forward @@ -425,8 +425,8 @@ int64_t BiomeSource::findSeed(LevelType* generator) { delete pr; #if defined(DEBUG_SEEDS) - Log::info("%d: %d tries taken, seed used is %lld\n", k, - tryCount, bestSeed); + Log::info("%d: %d tries taken, seed used is %lld\n", k, tryCount, + bestSeed); BiomeSource* biomeSource = new BiomeSource(bestSeed); std::vector biomes = biomeSource->getBiomeBlock( diff --git a/targets/minecraft/world/level/biome/BiomeSource.h b/targets/minecraft/world/level/biome/BiomeSource.h index c6b15c4bc..99796531c 100644 --- a/targets/minecraft/world/level/biome/BiomeSource.h +++ b/targets/minecraft/world/level/biome/BiomeSource.h @@ -10,7 +10,6 @@ #include "BiomeSource.h" #include "minecraft/world/level/biome/BiomeSource.h" - class ChunkPos; class Level; class Layer; diff --git a/targets/minecraft/world/level/biome/IceBiome.cpp b/targets/minecraft/world/level/biome/IceBiome.cpp index e9e076cb7..2354d4642 100644 --- a/targets/minecraft/world/level/biome/IceBiome.cpp +++ b/targets/minecraft/world/level/biome/IceBiome.cpp @@ -2,4 +2,4 @@ #include "minecraft/world/level/biome/Biome.h" -IceBiome::IceBiome(int id) : Biome(id) {}; \ No newline at end of file +IceBiome::IceBiome(int id) : Biome(id){}; \ No newline at end of file diff --git a/targets/minecraft/world/level/chunk/CompressedTileStorage.cpp b/targets/minecraft/world/level/chunk/CompressedTileStorage.cpp index a6aae31d4..1d0a72562 100644 --- a/targets/minecraft/world/level/chunk/CompressedTileStorage.cpp +++ b/targets/minecraft/world/level/chunk/CompressedTileStorage.cpp @@ -1,18 +1,18 @@ #include "CompressedTileStorage.h" #include -#include #include #include #include +#include #include -#include "platform/NetTypes.h" -#include "util/Definitions.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" #include "java/System.h" +#include "platform/NetTypes.h" +#include "util/Definitions.h" // Note: See header for an overview of this class diff --git a/targets/minecraft/world/level/chunk/LevelChunk.cpp b/targets/minecraft/world/level/chunk/LevelChunk.cpp index 14556ef88..40c9779cb 100644 --- a/targets/minecraft/world/level/chunk/LevelChunk.cpp +++ b/targets/minecraft/world/level/chunk/LevelChunk.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "LevelChunk.h" #include @@ -9,15 +8,16 @@ #include #include -#include "minecraft/network/INetworkService.h" #include "SparseLightStorage.h" #include "java/Class.h" #include "java/Random.h" #include "java/System.h" #include "minecraft/client/renderer/GameRenderer.h" +#include "minecraft/network/INetworkService.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/level/ServerChunkCache.h" #include "minecraft/server/level/ServerLevel.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/EntityIO.h" @@ -1332,7 +1332,7 @@ void LevelChunk::removeTileEntity(int x, int y, int z) { if (te != nullptr) { if (level->isClientSide) { Log::info("Removing tile entity of type %d\n", - te->GetType()); + te->GetType()); } te->setRemoved(); } @@ -1578,21 +1578,21 @@ void LevelChunk::getEntitiesOfClass(const std::type_info& ec, AABB* bb, // that our class may be derived from, otherwise do a direct // comparison of type_info if (ec == typeid(Player)) - isAssignableFrom = e->instanceof(eTYPE_PLAYER); + isAssignableFrom = e->instanceof (eTYPE_PLAYER); else if (ec == typeid(Entity)) - isAssignableFrom = e->instanceof(eTYPE_ENTITY); + isAssignableFrom = e->instanceof (eTYPE_ENTITY); else if (ec == typeid(Mob)) - isAssignableFrom = e->instanceof(eTYPE_MOB); + isAssignableFrom = e->instanceof (eTYPE_MOB); else if (ec == typeid(LivingEntity)) - isAssignableFrom = e->instanceof(eTYPE_LIVINGENTITY); + isAssignableFrom = e->instanceof (eTYPE_LIVINGENTITY); else if (ec == typeid(ItemEntity)) - isAssignableFrom = e->instanceof(eTYPE_ITEMENTITY); + isAssignableFrom = e->instanceof (eTYPE_ITEMENTITY); else if (ec == typeid(Minecart)) - isAssignableFrom = e->instanceof(eTYPE_MINECART); + isAssignableFrom = e->instanceof (eTYPE_MINECART); else if (ec == typeid(Monster)) - isAssignableFrom = e->instanceof(eTYPE_MONSTER); + isAssignableFrom = e->instanceof (eTYPE_MONSTER); else if (ec == typeid(Zombie)) - isAssignableFrom = e->instanceof(eTYPE_ZOMBIE); + isAssignableFrom = e->instanceof (eTYPE_ZOMBIE); else if (Entity* entity = e.get(); entity != nullptr && ec == typeid(*entity)) isAssignableFrom = true; diff --git a/targets/minecraft/world/level/chunk/SparseDataStorage.cpp b/targets/minecraft/world/level/chunk/SparseDataStorage.cpp index b3b56e24c..14cc70b8a 100644 --- a/targets/minecraft/world/level/chunk/SparseDataStorage.cpp +++ b/targets/minecraft/world/level/chunk/SparseDataStorage.cpp @@ -1,15 +1,15 @@ #include "SparseDataStorage.h" -#include #include #include #include +#include #include -#include "platform/NetTypes.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" +#include "platform/NetTypes.h" // Note: See header for an overview of this class @@ -90,9 +90,7 @@ SparseDataStorage::~SparseDataStorage() { // Determine correct means to free this data - could have been allocated // either with XPhysicalAlloc or malloc - { - free(indicesAndData); - } + { free(indicesAndData); } // printf("Free (in dtor) 0x%x\n", indicesAndData); } @@ -474,9 +472,7 @@ void SparseDataStorage::tick() { // if( toFree ) printf("Deleting 0x%x\n", toFree); // Determine correct means to free this data - could have been allocated // either with XPhysicalAlloc or malloc - { - free(toFree); - } + { free(toFree); } } while (toFree); deleteQueueIndex = (deleteQueueIndex + 1) % 3; diff --git a/targets/minecraft/world/level/chunk/SparseLightStorage.cpp b/targets/minecraft/world/level/chunk/SparseLightStorage.cpp index 5a29b0d52..3f9c8773d 100644 --- a/targets/minecraft/world/level/chunk/SparseLightStorage.cpp +++ b/targets/minecraft/world/level/chunk/SparseLightStorage.cpp @@ -1,15 +1,15 @@ #include "SparseLightStorage.h" -#include #include #include #include +#include #include -#include "platform/NetTypes.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" +#include "platform/NetTypes.h" // Note: See header for an overview of this class @@ -91,9 +91,7 @@ SparseLightStorage::~SparseLightStorage() { // Determine correct means to free this data - could have been allocated // either with XPhysicalAlloc or malloc - { - free(indicesAndData); - } + { free(indicesAndData); } // printf("Free (in dtor) 0x%x\n", indicesAndData); } @@ -478,9 +476,7 @@ void SparseLightStorage::tick() { // if( toFree ) printf("Deleting 0x%x\n", toFree); // Determine correct means to free this data - could have been allocated // either with XPhysicalAlloc or malloc - { - free(toFree); - } + { free(toFree); } } while (toFree); deleteQueueIndex = (deleteQueueIndex + 1) % 3; diff --git a/targets/minecraft/world/level/chunk/storage/ChunkStorageProfileDecorator.cpp b/targets/minecraft/world/level/chunk/storage/ChunkStorageProfileDecorator.cpp index 4fc2e4e70..782074473 100644 --- a/targets/minecraft/world/level/chunk/storage/ChunkStorageProfileDecorator.cpp +++ b/targets/minecraft/world/level/chunk/storage/ChunkStorageProfileDecorator.cpp @@ -1,9 +1,9 @@ -#include "minecraft/util/Log.h" #include "ChunkStorageProfileDecorator.h" #include #include "java/System.h" +#include "minecraft/util/Log.h" #include "minecraft/world/level/chunk/storage/ChunkStorage.h" ChunkStorageProfilerDecorator::ChunkStorageProfilerDecorator( diff --git a/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp b/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp index 6ec930a2e..f7dd05eda 100644 --- a/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp +++ b/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "McRegionChunkStorage.h" #include @@ -10,15 +8,14 @@ #include #include -#include "platform/input/input.h" -#include "minecraft/Console_Debug_enum.h" -#include "platform/C4JThread.h" -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "java/InputOutputStream/BufferedOutputStream.h" #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/ByteArrayOutputStream.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" +#include "minecraft/Console_Debug_enum.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/chunk/LevelChunk.h" #include "minecraft/world/level/chunk/storage/OldChunkStorage.h" @@ -28,9 +25,12 @@ #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOutputStream.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSavePath.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "minecraft/world/level/storage/LevelData.h" #include "nbt/CompoundTag.h" #include "nbt/NbtIo.h" +#include "platform/C4JThread.h" +#include "platform/input/input.h" class DataInput; @@ -206,15 +206,16 @@ void McRegionChunkStorage::save(Level* level, LevelChunk* levelChunk) { DataOutputStream* output = RegionFileCache::getChunkDataOutputStream( m_saveFile, m_prefix, levelChunk->x, levelChunk->z); - if (m_saveFile->getOriginalSaveVersion() >= SAVE_FILE_VERSION_COMPRESSED_CHUNK_STORAGE) { - OldChunkStorage::save(levelChunk, level, output); + if (m_saveFile->getOriginalSaveVersion() >= + SAVE_FILE_VERSION_COMPRESSED_CHUNK_STORAGE) { + OldChunkStorage::save(levelChunk, level, output); - { - std::lock_guard lock(cs_memory); - s_chunkDataQueue.push_back(output); - } - // 4jcraft: WAKE UP, WAKE THE FUCK.. UP - s_queueCondition.notify_one(); + { + std::lock_guard lock(cs_memory); + s_chunkDataQueue.push_back(output); + } + // 4jcraft: WAKE UP, WAKE THE FUCK.. UP + s_queueCondition.notify_one(); } else { CompoundTag* tag; @@ -349,11 +350,12 @@ int McRegionChunkStorage::runSaveThreadProc(void* lpParam) { while (running) { { std::unique_lock lock(cs_memory); - s_queueCondition.wait(lock, [] { return !s_chunkDataQueue.empty(); }); + s_queueCondition.wait(lock, + [] { return !s_chunkDataQueue.empty(); }); dos = s_chunkDataQueue.front(); s_chunkDataQueue.pop_front(); s_runningThreadCount++; - } // Unlock so the main thread can keep working + } // Unlock so the main thread can keep working if (dos) { dos->close(); @@ -394,12 +396,10 @@ void McRegionChunkStorage::WaitForSaves() { static const int MAX_QUEUE_SIZE = 12; static const int DESIRED_QUEUE_SIZE = 6; - std::unique_lock lock(cs_memory); if (s_chunkDataQueue.size() > MAX_QUEUE_SIZE) { // Pause until the queue drains down to the desired size - s_waitCondition.wait(lock, [] { - return s_chunkDataQueue.size() <= DESIRED_QUEUE_SIZE; - }); + s_waitCondition.wait( + lock, [] { return s_chunkDataQueue.size() <= DESIRED_QUEUE_SIZE; }); } } diff --git a/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.h b/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.h index 2938d9a37..644379c9b 100644 --- a/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.h +++ b/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.h @@ -2,6 +2,7 @@ #include +#include // 4jcraft: im pretty sure there's a better alternative to this. #include #include #include @@ -14,7 +15,6 @@ #include "RegionFileCache.h" #include "minecraft/world/level/chunk/LevelChunk.h" #include "nbt/NbtIo.h" -#include // 4jcraft: im pretty sure there's a better alternative to this. class ConsoleSaveFile; class C4JThread; diff --git a/targets/minecraft/world/level/chunk/storage/MemoryChunkStorage.cpp b/targets/minecraft/world/level/chunk/storage/MemoryChunkStorage.cpp index 3023cbf3b..8f5237b2d 100644 --- a/targets/minecraft/world/level/chunk/storage/MemoryChunkStorage.cpp +++ b/targets/minecraft/world/level/chunk/storage/MemoryChunkStorage.cpp @@ -1,8 +1,5 @@ #include "MemoryChunkStorage.h" - - - LevelChunk* MemoryChunkStorage::load(Level* level, int x, int z) // throws IOException { diff --git a/targets/minecraft/world/level/chunk/storage/NbtSlotFile.cpp b/targets/minecraft/world/level/chunk/storage/NbtSlotFile.cpp index 2e4fb78ee..325ba6ced 100644 --- a/targets/minecraft/world/level/chunk/storage/NbtSlotFile.cpp +++ b/targets/minecraft/world/level/chunk/storage/NbtSlotFile.cpp @@ -12,7 +12,8 @@ std::FILE* OpenBinaryFileForReadWrite(const File& file) { stream = _wfopen(file.getPath().c_str(), "w+b"); } #else - const std::string nativePath = std::filesystem::path(file.getPath()).string(); + const std::string nativePath = + std::filesystem::path(file.getPath()).string(); std::FILE* stream = std::fopen(nativePath.c_str(), "r+b"); if (stream == nullptr) { stream = std::fopen(nativePath.c_str(), "w+b"); diff --git a/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp b/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp index edab83d55..eff498ad8 100644 --- a/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp +++ b/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "OldChunkStorage.h" #include @@ -12,14 +10,14 @@ #include #include -#include "platform/input/input.h" -#include "minecraft/Console_Debug_enum.h" -#include "util/Definitions.h" #include "java/File.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" #include "java/InputOutputStream/FileInputStream.h" #include "java/InputOutputStream/FileOutputStream.h" +#include "minecraft/Console_Debug_enum.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/EntityIO.h" #include "minecraft/world/level/Level.h" @@ -32,6 +30,8 @@ #include "nbt/CompoundTag.h" #include "nbt/ListTag.h" #include "nbt/NbtIo.h" +#include "platform/input/input.h" +#include "util/Definitions.h" thread_local OldChunkStorage::ThreadStorage* OldChunkStorage::m_tlsStorage = nullptr; @@ -469,10 +469,9 @@ LevelChunk* OldChunkStorage::load(Level* level, DataInputStream* dis) { for (int i = 0; i < tileTicks->size(); i++) { CompoundTag* teTag = tileTicks->get(i); - level->forceAddTileTick( - teTag->getInt("x"), teTag->getInt("y"), - teTag->getInt("z"), teTag->getInt("i"), - teTag->getInt("t"), teTag->getInt("p")); + level->forceAddTileTick(teTag->getInt("x"), teTag->getInt("y"), + teTag->getInt("z"), teTag->getInt("i"), + teTag->getInt("t"), teTag->getInt("p")); } } } @@ -578,10 +577,9 @@ LevelChunk* OldChunkStorage::load(Level* level, CompoundTag* tag) { for (int i = 0; i < tileTicks->size(); i++) { CompoundTag* teTag = tileTicks->get(i); - level->forceAddTileTick( - teTag->getInt("x"), teTag->getInt("y"), - teTag->getInt("z"), teTag->getInt("i"), - teTag->getInt("t"), teTag->getInt("p")); + level->forceAddTileTick(teTag->getInt("x"), teTag->getInt("y"), + teTag->getInt("z"), teTag->getInt("i"), + teTag->getInt("t"), teTag->getInt("p")); } } } diff --git a/targets/minecraft/world/level/chunk/storage/RegionFile.cpp b/targets/minecraft/world/level/chunk/storage/RegionFile.cpp index 31f1d0b49..ae3a8db5a 100644 --- a/targets/minecraft/world/level/chunk/storage/RegionFile.cpp +++ b/targets/minecraft/world/level/chunk/storage/RegionFile.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "RegionFile.h" #include @@ -7,14 +6,15 @@ #include #include -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "java/File.h" #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" #include "java/System.h" +#include "minecraft/util/Log.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFile.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" std::vector RegionFile::emptySector(SECTOR_BYTES); diff --git a/targets/minecraft/world/level/chunk/storage/RegionFile.h b/targets/minecraft/world/level/chunk/storage/RegionFile.h index bca5b99d4..1d1475836 100644 --- a/targets/minecraft/world/level/chunk/storage/RegionFile.h +++ b/targets/minecraft/world/level/chunk/storage/RegionFile.h @@ -4,9 +4,9 @@ #include #include -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "java/InputOutputStream/ByteArrayOutputStream.h" #include "java/InputOutputStream/InputOutputStream.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" class FileEntry; class ConsoleSaveFile; diff --git a/targets/minecraft/world/level/chunk/storage/RegionFileCache.cpp b/targets/minecraft/world/level/chunk/storage/RegionFileCache.cpp index 273cf8266..2eda9aacf 100644 --- a/targets/minecraft/world/level/chunk/storage/RegionFileCache.cpp +++ b/targets/minecraft/world/level/chunk/storage/RegionFileCache.cpp @@ -2,11 +2,11 @@ #include -#include "util/StringHelpers.h" #include "java/File.h" #include "minecraft/world/level/chunk/storage/RegionFile.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFile.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h" +#include "util/StringHelpers.h" class DataInputStream; class DataOutputStream; @@ -37,11 +37,11 @@ RegionFile* RegionFileCache::_getRegionFile( // toWString(chunkZ>>5) + ".mcr" ); File file; if (useSplitSaves(saveFile->getSavePlatform())) { - file = File(prefix + std::string("r.") + toWString(chunkX >> 4) + - "." + toWString(chunkZ >> 4) + ".mcr"); + file = File(prefix + std::string("r.") + toWString(chunkX >> 4) + "." + + toWString(chunkZ >> 4) + ".mcr"); } else { - file = File(prefix + std::string("r.") + toWString(chunkX >> 5) + - "." + toWString(chunkZ >> 5) + ".mcr"); + file = File(prefix + std::string("r.") + toWString(chunkX >> 5) + "." + + toWString(chunkZ >> 5) + ".mcr"); } RegionFile* ref = nullptr; diff --git a/targets/minecraft/world/level/chunk/storage/RegionFileCache.h b/targets/minecraft/world/level/chunk/storage/RegionFileCache.h index 36dfe0547..e07bc8cba 100644 --- a/targets/minecraft/world/level/chunk/storage/RegionFileCache.h +++ b/targets/minecraft/world/level/chunk/storage/RegionFileCache.h @@ -49,8 +49,7 @@ public: } static void clear() { s_defaultCache._clear(); } static int getSizeDelta(ConsoleSaveFile* saveFile, - const std::string& prefix, int chunkX, - int chunkZ) { + const std::string& prefix, int chunkX, int chunkZ) { return s_defaultCache._getSizeDelta(saveFile, prefix, chunkX, chunkZ); } static DataInputStream* getChunkDataInputStream(ConsoleSaveFile* saveFile, @@ -59,9 +58,9 @@ public: return s_defaultCache._getChunkDataInputStream(saveFile, prefix, chunkX, chunkZ); } - static DataOutputStream* getChunkDataOutputStream( - ConsoleSaveFile* saveFile, const std::string& prefix, int chunkX, - int chunkZ) { + static DataOutputStream* getChunkDataOutputStream(ConsoleSaveFile* saveFile, + const std::string& prefix, + int chunkX, int chunkZ) { return s_defaultCache._getChunkDataOutputStream(saveFile, prefix, chunkX, chunkZ); } diff --git a/targets/minecraft/world/level/chunk/storage/ZoneFile.cpp b/targets/minecraft/world/level/chunk/storage/ZoneFile.cpp index 7babd8962..cbf5e30ed 100644 --- a/targets/minecraft/world/level/chunk/storage/ZoneFile.cpp +++ b/targets/minecraft/world/level/chunk/storage/ZoneFile.cpp @@ -13,7 +13,8 @@ std::FILE* OpenBinaryFileForReadWrite(const File& file) { stream = _wfopen(file.getPath().c_str(), "w+b"); } #else - const std::string nativePath = std::filesystem::path(file.getPath()).string(); + const std::string nativePath = + std::filesystem::path(file.getPath()).string(); std::FILE* stream = std::fopen(nativePath.c_str(), "r+b"); if (stream == nullptr) { stream = std::fopen(nativePath.c_str(), "w+b"); diff --git a/targets/minecraft/world/level/chunk/storage/ZonedChunkStorage.cpp b/targets/minecraft/world/level/chunk/storage/ZonedChunkStorage.cpp index 7dfd1135e..8574cb912 100644 --- a/targets/minecraft/world/level/chunk/storage/ZonedChunkStorage.cpp +++ b/targets/minecraft/world/level/chunk/storage/ZonedChunkStorage.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "ZonedChunkStorage.h" #include @@ -7,10 +6,7 @@ #include "ZoneFile.h" #include "java/ByteBuffer.h" #include "java/File.h" - - - - +#include "minecraft/util/Log.h" // 4J Stu - There are changes to this class for 1.8.2, but since we never use it // anyway lets not worry about it @@ -63,14 +59,15 @@ ZoneFile* ZonedChunkStorage::getZoneFile(int x, int z, bool create) { char zRadix36[64]; _itow(x, xRadix36, 36); _itow(z, zRadix36, 36); - File file = File(dir, std::string("zone_") + toString(xRadix36) + - "_" + toString(zRadix36) + ".dat"); + File file = File(dir, std::string("zone_") + toString(xRadix36) + "_" + + toString(zRadix36) + ".dat"); if (!file.exists()) { if (!create) return nullptr; - void* ch = CreateFile(std::filesystem::path(file.getPath()).string().c_str(), - GENERIC_READ | GENERIC_WRITE, 0, nullptr, - OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); + void* ch = CreateFile( + std::filesystem::path(file.getPath()).string().c_str(), + GENERIC_READ | GENERIC_WRITE, 0, nullptr, OPEN_ALWAYS, + FILE_ATTRIBUTE_NORMAL, nullptr); CloseHandle(ch); } diff --git a/targets/minecraft/world/level/dimension/Dimension.cpp b/targets/minecraft/world/level/dimension/Dimension.cpp index 7fba66a4f..838508367 100644 --- a/targets/minecraft/world/level/dimension/Dimension.cpp +++ b/targets/minecraft/world/level/dimension/Dimension.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "Dimension.h" #include @@ -6,13 +5,13 @@ #include #include "HellDimension.h" -#include "platform/input/input.h" -#include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" -#include "minecraft/Console_Debug_enum.h" #include "NormalDimension.h" #include "TheEndDimension.h" +#include "minecraft/Console_Debug_enum.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelType.h" #include "minecraft/world/level/biome/Biome.h" @@ -26,6 +25,7 @@ #include "minecraft/world/level/storage/LevelData.h" #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/phys/Vec3.h" +#include "platform/input/input.h" class Pos; diff --git a/targets/minecraft/world/level/dimension/HellDimension.cpp b/targets/minecraft/world/level/dimension/HellDimension.cpp index aeb72fc0d..36e78808e 100644 --- a/targets/minecraft/world/level/dimension/HellDimension.cpp +++ b/targets/minecraft/world/level/dimension/HellDimension.cpp @@ -1,13 +1,12 @@ -#include "minecraft/IGameServices.h" #include "HellDimension.h" #include -#include "platform/input/input.h" -#include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/Console_Debug_enum.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelType.h" #include "minecraft/world/level/biome/Biome.h" @@ -16,6 +15,7 @@ #include "minecraft/world/level/levelgen/HellRandomLevelSource.h" #include "minecraft/world/level/storage/LevelData.h" #include "minecraft/world/phys/Vec3.h" +#include "platform/input/input.h" void HellDimension::init() { biomeSource = new FixedBiomeSource(Biome::hell, 1, 0); diff --git a/targets/minecraft/world/level/dimension/TheEndDimension.cpp b/targets/minecraft/world/level/dimension/TheEndDimension.cpp index 5558b808d..3959cd442 100644 --- a/targets/minecraft/world/level/dimension/TheEndDimension.cpp +++ b/targets/minecraft/world/level/dimension/TheEndDimension.cpp @@ -5,9 +5,9 @@ #include #include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/Pos.h" #include "minecraft/client/Minecraft.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/biome/Biome.h" #include "minecraft/world/level/biome/FixedBiomeSource.h" diff --git a/targets/minecraft/world/level/levelgen/CanyonFeature.cpp b/targets/minecraft/world/level/levelgen/CanyonFeature.cpp index e3931d2e8..dec6f2565 100644 --- a/targets/minecraft/world/level/levelgen/CanyonFeature.cpp +++ b/targets/minecraft/world/level/levelgen/CanyonFeature.cpp @@ -1,11 +1,11 @@ -#include "minecraft/IGameServices.h" #include "CanyonFeature.h" #include #include -#include "minecraft/GameEnums.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Mth.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/biome/Biome.h" @@ -182,7 +182,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, - (int)(xCave / 16.0), (int)(yCave / 16.0)); + 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 45e17ba87..71f528ed3 100644 --- a/targets/minecraft/world/level/levelgen/CustomLevelSource.cpp +++ b/targets/minecraft/world/level/levelgen/CustomLevelSource.cpp @@ -1,15 +1,15 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "CustomLevelSource.h" #include #include #include +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "minecraft/world/level/GameRules/LevelGenerationOptions.h" -#include "platform/fs/fs.h" #include "minecraft/world/level/biome/Biome.h" #include "minecraft/world/level/chunk/ChunkSource.h" +#include "platform/fs/fs.h" #if defined(__linux__) #endif #include "java/Random.h" @@ -61,9 +61,9 @@ CustomLevelSource::CustomLevelSource(Level* level, int64_t seed, { const char* waterHeightPath = "GameRules/waterheight.bin"; - auto result = PlatformFilesystem.readFile( - waterHeightPath, m_waterheightOverride.data(), - m_waterheightOverride.size()); + auto result = PlatformFilesystem.readFile(waterHeightPath, + m_waterheightOverride.data(), + m_waterheightOverride.size()); if (result.status == IPlatformFilesystem::ReadStatus::NotFound) { memset(m_waterheightOverride.data(), level->seaLevel, m_waterheightOverride.size()); @@ -260,7 +260,8 @@ 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); } diff --git a/targets/minecraft/world/level/levelgen/FlatLevelSource.cpp b/targets/minecraft/world/level/levelgen/FlatLevelSource.cpp index 5c4db433b..199527881 100644 --- a/targets/minecraft/world/level/levelgen/FlatLevelSource.cpp +++ b/targets/minecraft/world/level/levelgen/FlatLevelSource.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "FlatLevelSource.h" #include @@ -7,6 +6,7 @@ #include #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/biome/Biome.h" #include "minecraft/world/level/chunk/ChunkSource.h" diff --git a/targets/minecraft/world/level/levelgen/HellFlatLevelSource.cpp b/targets/minecraft/world/level/levelgen/HellFlatLevelSource.cpp index b63f9a61f..1f692fd8c 100644 --- a/targets/minecraft/world/level/levelgen/HellFlatLevelSource.cpp +++ b/targets/minecraft/world/level/levelgen/HellFlatLevelSource.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "HellFlatLevelSource.h" #include @@ -8,6 +7,7 @@ #include #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/biome/Biome.h" #include "minecraft/world/level/chunk/ChunkSource.h" @@ -192,9 +192,7 @@ bool HellFlatLevelSource::tick() { return false; } bool HellFlatLevelSource::shouldSave() { return true; } -std::string HellFlatLevelSource::gatherStats() { - return "HellFlatLevelSource"; -} +std::string HellFlatLevelSource::gatherStats() { return "HellFlatLevelSource"; } std::vector* HellFlatLevelSource::getMobsAt( MobCategory* mobCategory, int x, int y, int z) { diff --git a/targets/minecraft/world/level/levelgen/HellRandomLevelSource.cpp b/targets/minecraft/world/level/levelgen/HellRandomLevelSource.cpp index 47c1ad8f0..f7e4f435f 100644 --- a/targets/minecraft/world/level/levelgen/HellRandomLevelSource.cpp +++ b/targets/minecraft/world/level/levelgen/HellRandomLevelSource.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "HellRandomLevelSource.h" #include @@ -9,6 +8,7 @@ #include #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/world/entity/MobCategory.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/biome/Biome.h" diff --git a/targets/minecraft/world/level/levelgen/RandomLevelSource.cpp b/targets/minecraft/world/level/levelgen/RandomLevelSource.cpp index f56d9c44f..78c68988b 100644 --- a/targets/minecraft/world/level/levelgen/RandomLevelSource.cpp +++ b/targets/minecraft/world/level/levelgen/RandomLevelSource.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "RandomLevelSource.h" #include @@ -6,11 +5,11 @@ #include -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" -#include "util/Timer.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Mth.h" #include "minecraft/world/entity/MobCategory.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/MobSpawner.h" #include "minecraft/world/level/biome/Biome.h" @@ -31,6 +30,7 @@ #include "minecraft/world/level/tile/HeavyTile.h" #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/phys/Vec3.h" +#include "util/Timer.h" const double RandomLevelSource::SNOW_SCALE = 0.3; const double RandomLevelSource::SNOW_CUTOFF = 0.5; @@ -408,7 +408,8 @@ 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); } diff --git a/targets/minecraft/world/level/levelgen/TheEndLevelRandomLevelSource.cpp b/targets/minecraft/world/level/levelgen/TheEndLevelRandomLevelSource.cpp index e7d49ab9e..945ba6fee 100644 --- a/targets/minecraft/world/level/levelgen/TheEndLevelRandomLevelSource.cpp +++ b/targets/minecraft/world/level/levelgen/TheEndLevelRandomLevelSource.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "TheEndLevelRandomLevelSource.h" #include @@ -7,6 +6,7 @@ #include #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/biome/Biome.h" #include "minecraft/world/level/biome/BiomeSource.h" diff --git a/targets/minecraft/world/level/levelgen/feature/BasicTreeFeature.cpp b/targets/minecraft/world/level/levelgen/feature/BasicTreeFeature.cpp index 1abccac72..9337440bf 100644 --- a/targets/minecraft/world/level/levelgen/feature/BasicTreeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/BasicTreeFeature.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "BasicTreeFeature.h" #include @@ -7,9 +5,11 @@ #include #include -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/levelgen/feature/Feature.h" #include "minecraft/world/level/tile/Tile.h" diff --git a/targets/minecraft/world/level/levelgen/feature/BirchFeature.cpp b/targets/minecraft/world/level/levelgen/feature/BirchFeature.cpp index d228f701c..69cb44d15 100644 --- a/targets/minecraft/world/level/levelgen/feature/BirchFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/BirchFeature.cpp @@ -1,11 +1,11 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "BirchFeature.h" #include -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/levelgen/feature/Feature.h" #include "minecraft/world/level/tile/LeafTile.h" diff --git a/targets/minecraft/world/level/levelgen/feature/CaveFeature.cpp b/targets/minecraft/world/level/levelgen/feature/CaveFeature.cpp index ddaef9032..9869f8c77 100644 --- a/targets/minecraft/world/level/levelgen/feature/CaveFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/CaveFeature.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "CaveFeature.h" #include @@ -7,9 +5,11 @@ #include #include -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/TilePos.h" #include "minecraft/world/level/material/Material.h" diff --git a/targets/minecraft/world/level/levelgen/feature/Feature.h b/targets/minecraft/world/level/levelgen/feature/Feature.h index bae9a41ce..298b13852 100644 --- a/targets/minecraft/world/level/levelgen/feature/Feature.h +++ b/targets/minecraft/world/level/levelgen/feature/Feature.h @@ -10,7 +10,7 @@ private: public: Feature(); Feature(bool doUpdate); - virtual ~Feature() {}; + virtual ~Feature(){}; virtual bool place(Level* level, Random* random, int x, int y, int z) = 0; virtual bool placeWithIndex(Level* level, Random* random, int x, int y, diff --git a/targets/minecraft/world/level/levelgen/feature/FlowerFeature.cpp b/targets/minecraft/world/level/levelgen/feature/FlowerFeature.cpp index d89fe6b1c..7a47479c6 100644 --- a/targets/minecraft/world/level/levelgen/feature/FlowerFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/FlowerFeature.cpp @@ -1,9 +1,9 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "FlowerFeature.h" -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/dimension/Dimension.h" #include "minecraft/world/level/tile/Tile.h" diff --git a/targets/minecraft/world/level/levelgen/feature/LakeFeature.cpp b/targets/minecraft/world/level/levelgen/feature/LakeFeature.cpp index c67658f41..044972f15 100644 --- a/targets/minecraft/world/level/levelgen/feature/LakeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/LakeFeature.cpp @@ -1,9 +1,9 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "LakeFeature.h" -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LightLayer.h" #include "minecraft/world/level/biome/Biome.h" diff --git a/targets/minecraft/world/level/levelgen/feature/MegaTreeFeature.cpp b/targets/minecraft/world/level/levelgen/feature/MegaTreeFeature.cpp index 214bde128..dfb384dcc 100644 --- a/targets/minecraft/world/level/levelgen/feature/MegaTreeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/MegaTreeFeature.cpp @@ -1,12 +1,12 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "MegaTreeFeature.h" #include -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/levelgen/feature/Feature.h" #include "minecraft/world/level/tile/Tile.h" diff --git a/targets/minecraft/world/level/levelgen/feature/OreFeature.cpp b/targets/minecraft/world/level/levelgen/feature/OreFeature.cpp index 37349752a..f813a49b2 100644 --- a/targets/minecraft/world/level/levelgen/feature/OreFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/OreFeature.cpp @@ -1,12 +1,12 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "OreFeature.h" #include -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/tile/Tile.h" diff --git a/targets/minecraft/world/level/levelgen/feature/PineFeature.cpp b/targets/minecraft/world/level/levelgen/feature/PineFeature.cpp index eb9d1fe87..f97635dce 100644 --- a/targets/minecraft/world/level/levelgen/feature/PineFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/PineFeature.cpp @@ -1,11 +1,11 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "PineFeature.h" #include -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/tile/LeafTile.h" #include "minecraft/world/level/tile/Tile.h" diff --git a/targets/minecraft/world/level/levelgen/feature/ReedsFeature.cpp b/targets/minecraft/world/level/levelgen/feature/ReedsFeature.cpp index 490da93af..98b5561e5 100644 --- a/targets/minecraft/world/level/levelgen/feature/ReedsFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/ReedsFeature.cpp @@ -1,9 +1,9 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "ReedsFeature.h" -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/material/Material.h" #include "minecraft/world/level/tile/Tile.h" diff --git a/targets/minecraft/world/level/levelgen/feature/SandFeature.cpp b/targets/minecraft/world/level/levelgen/feature/SandFeature.cpp index cb9d74b75..d1cb2e072 100644 --- a/targets/minecraft/world/level/levelgen/feature/SandFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/SandFeature.cpp @@ -1,9 +1,9 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "SandFeature.h" -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/material/Material.h" #include "minecraft/world/level/tile/Tile.h" diff --git a/targets/minecraft/world/level/levelgen/feature/SpikeFeature.cpp b/targets/minecraft/world/level/levelgen/feature/SpikeFeature.cpp index 78f0a89f4..e19d76c11 100644 --- a/targets/minecraft/world/level/levelgen/feature/SpikeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/SpikeFeature.cpp @@ -1,9 +1,9 @@ -#include "minecraft/util/Log.h" #include "SpikeFeature.h" #include #include "java/Random.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/boss/enderdragon/EnderCrystal.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/tile/Tile.h" diff --git a/targets/minecraft/world/level/levelgen/feature/SpringFeature.cpp b/targets/minecraft/world/level/levelgen/feature/SpringFeature.cpp index 9ddb6aa2b..8c4e59c03 100644 --- a/targets/minecraft/world/level/levelgen/feature/SpringFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/SpringFeature.cpp @@ -1,7 +1,7 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "SpringFeature.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/tile/Tile.h" diff --git a/targets/minecraft/world/level/levelgen/feature/SpruceFeature.cpp b/targets/minecraft/world/level/levelgen/feature/SpruceFeature.cpp index 2bb1579fe..862259be1 100644 --- a/targets/minecraft/world/level/levelgen/feature/SpruceFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/SpruceFeature.cpp @@ -1,11 +1,11 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "SpruceFeature.h" #include -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/levelgen/feature/Feature.h" #include "minecraft/world/level/tile/LeafTile.h" diff --git a/targets/minecraft/world/level/levelgen/feature/SwampTreeFeature.cpp b/targets/minecraft/world/level/levelgen/feature/SwampTreeFeature.cpp index 72664fbc3..e87779b0c 100644 --- a/targets/minecraft/world/level/levelgen/feature/SwampTreeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/SwampTreeFeature.cpp @@ -1,11 +1,11 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "SwampTreeFeature.h" #include -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/material/Material.h" #include "minecraft/world/level/tile/Tile.h" diff --git a/targets/minecraft/world/level/levelgen/feature/TreeFeature.cpp b/targets/minecraft/world/level/levelgen/feature/TreeFeature.cpp index 50bd605dd..d89f5741f 100644 --- a/targets/minecraft/world/level/levelgen/feature/TreeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/TreeFeature.cpp @@ -1,12 +1,12 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "TreeFeature.h" #include -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "java/Random.h" #include "minecraft/Direction.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/levelgen/feature/Feature.h" #include "minecraft/world/level/tile/Tile.h" diff --git a/targets/minecraft/world/level/levelgen/flat/FlatGeneratorInfo.cpp b/targets/minecraft/world/level/levelgen/flat/FlatGeneratorInfo.cpp index b3e577f17..13e6f694b 100644 --- a/targets/minecraft/world/level/levelgen/flat/FlatGeneratorInfo.cpp +++ b/targets/minecraft/world/level/levelgen/flat/FlatGeneratorInfo.cpp @@ -1,16 +1,15 @@ #include "FlatGeneratorInfo.h" -#include "util/StringHelpers.h" #include "minecraft/world/level/biome/Biome.h" #include "minecraft/world/level/levelgen/flat/FlatLayerInfo.h" #include "minecraft/world/level/tile/Tile.h" +#include "util/StringHelpers.h" const std::string FlatGeneratorInfo::STRUCTURE_VILLAGE = "village"; const std::string FlatGeneratorInfo::STRUCTURE_BIOME_SPECIFIC = "biome_1"; const std::string FlatGeneratorInfo::STRUCTURE_STRONGHOLD = "stronghold"; const std::string FlatGeneratorInfo::STRUCTURE_MINESHAFT = "mineshaft"; -const std::string FlatGeneratorInfo::STRUCTURE_BIOME_DECORATION = - "decoration"; +const std::string FlatGeneratorInfo::STRUCTURE_BIOME_DECORATION = "decoration"; const std::string FlatGeneratorInfo::STRUCTURE_LAKE = "lake"; const std::string FlatGeneratorInfo::STRUCTURE_LAVA_LAKE = "lava_lake"; const std::string FlatGeneratorInfo::STRUCTURE_DUNGEON = "dungeon"; @@ -27,8 +26,7 @@ int FlatGeneratorInfo::getBiome() { return biome; } void FlatGeneratorInfo::setBiome(int biome) { this->biome = biome; } -std::unordered_map >* +std::unordered_map >* FlatGeneratorInfo::getStructures() { return &structures; } diff --git a/targets/minecraft/world/level/levelgen/structure/BoundingBox.cpp b/targets/minecraft/world/level/levelgen/structure/BoundingBox.cpp index aa7b4061d..ca634a00e 100644 --- a/targets/minecraft/world/level/levelgen/structure/BoundingBox.cpp +++ b/targets/minecraft/world/level/levelgen/structure/BoundingBox.cpp @@ -5,10 +5,10 @@ #include #include -#include "util/StringHelpers.h" #include "java/JavaMath.h" #include "minecraft/Direction.h" #include "nbt/IntArrayTag.h" +#include "util/StringHelpers.h" BoundingBox::BoundingBox() { // 4J added initialisers diff --git a/targets/minecraft/world/level/levelgen/structure/MineShaftFeature.cpp b/targets/minecraft/world/level/levelgen/structure/MineShaftFeature.cpp index ce2517043..30bbcb970 100644 --- a/targets/minecraft/world/level/levelgen/structure/MineShaftFeature.cpp +++ b/targets/minecraft/world/level/levelgen/structure/MineShaftFeature.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" - #include "minecraft/world/level/levelgen/structure/MineShaftFeature.h" #include @@ -9,10 +7,11 @@ #include #include -#include "minecraft/GameEnums.h" -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Mth.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/levelgen/structure/MineShaftStart.h" const std::string MineShaftFeature::OPTION_CHANCE = "chance"; @@ -34,7 +33,8 @@ 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); diff --git a/targets/minecraft/world/level/levelgen/structure/NetherBridgeFeature.cpp b/targets/minecraft/world/level/levelgen/structure/NetherBridgeFeature.cpp index 039adbf3a..9a9dc7151 100644 --- a/targets/minecraft/world/level/levelgen/structure/NetherBridgeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/structure/NetherBridgeFeature.cpp @@ -1,14 +1,14 @@ -#include "minecraft/IGameServices.h" #include "NetherBridgeFeature.h" #include #include -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "NetherBridgePieces.h" #include "java/Class.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/world/level/ChunkPos.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/biome/Biome.h" #include "minecraft/world/level/dimension/Dimension.h" @@ -59,7 +59,8 @@ 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 078f0eb2a..26f4c590b 100644 --- a/targets/minecraft/world/level/levelgen/structure/RandomScatteredLargeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/structure/RandomScatteredLargeFeature.cpp @@ -1,14 +1,14 @@ -#include "minecraft/IGameServices.h" #include "RandomScatteredLargeFeature.h" #include #include -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "ScatteredFeaturePieces.h" #include "java/Class.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Mth.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/biome/Biome.h" #include "minecraft/world/level/biome/BiomeSource.h" @@ -67,7 +67,8 @@ 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 1716d3a3b..71d300c68 100644 --- a/targets/minecraft/world/level/levelgen/structure/ScatteredFeaturePieces.cpp +++ b/targets/minecraft/world/level/levelgen/structure/ScatteredFeaturePieces.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "ScatteredFeaturePieces.h" #include @@ -6,15 +5,16 @@ #include #include -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "java/Random.h" #include "minecraft/Direction.h" #include "minecraft/Facing.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/WeighedTreasure.h" #include "minecraft/world/entity/monster/Witch.h" #include "minecraft/world/item/DyePowderItem.h" #include "minecraft/world/item/EnchantedBookItem.h" #include "minecraft/world/item/Item.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/dimension/Dimension.h" #include "minecraft/world/level/levelgen/structure/BoundingBox.h" @@ -60,7 +60,8 @@ 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/SkyIslandDimension.cpp b/targets/minecraft/world/level/levelgen/structure/SkyIslandDimension.cpp index a317fe9e6..be517ba77 100644 --- a/targets/minecraft/world/level/levelgen/structure/SkyIslandDimension.cpp +++ b/targets/minecraft/world/level/levelgen/structure/SkyIslandDimension.cpp @@ -1,10 +1,5 @@ #include "SkyIslandDimension.h" - - - - - void SkyIslandDimension::init() { biomeSource = new FixedBiomeSource(Biome::sky, 0.5f, 0); id = 1; diff --git a/targets/minecraft/world/level/levelgen/structure/StrongholdFeature.cpp b/targets/minecraft/world/level/levelgen/structure/StrongholdFeature.cpp index 7eccbe1ce..777392973 100644 --- a/targets/minecraft/world/level/levelgen/structure/StrongholdFeature.cpp +++ b/targets/minecraft/world/level/levelgen/structure/StrongholdFeature.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "StrongholdFeature.h" #include @@ -10,13 +8,15 @@ #include #include -#include "minecraft/GameEnums.h" -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "StrongholdPieces.h" #include "java/JavaMath.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" #include "minecraft/world/level/ChunkPos.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/TilePos.h" #include "minecraft/world/level/biome/Biome.h" @@ -166,8 +166,8 @@ bool StrongholdFeature::isFeatureChunk(int x, int z, bool bIsSuperflat) { "%d)\n", selectedX, selectedZ, position->x, position->z); // 4J added - gameServices().addTerrainFeaturePosition(eTerrainFeature_Stronghold, - selectedX, selectedZ); + gameServices().addTerrainFeaturePosition( + eTerrainFeature_Stronghold, selectedX, selectedZ); // 4J Added hasFoundValidPos = true; @@ -197,8 +197,8 @@ bool StrongholdFeature::isFeatureChunk(int x, int z, bool bIsSuperflat) { // for #81933 - GAMEPLAY: The Eye of Ender occasionally does not // appear when used to try and locate the End Portal. gameServices().addTerrainFeaturePosition(eTerrainFeature_Stronghold, - strongholdPos[0]->x, - strongholdPos[0]->z); + strongholdPos[0]->x, + strongholdPos[0]->z); } isSpotSelected = true; diff --git a/targets/minecraft/world/level/levelgen/structure/StrongholdPieces.cpp b/targets/minecraft/world/level/levelgen/structure/StrongholdPieces.cpp index 3b4f25cbd..9e5021c69 100644 --- a/targets/minecraft/world/level/levelgen/structure/StrongholdPieces.cpp +++ b/targets/minecraft/world/level/levelgen/structure/StrongholdPieces.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "StrongholdPieces.h" #include @@ -7,11 +6,11 @@ #include #include -#include "minecraft/GameEnums.h" -#include "util/StringHelpers.h" #include "java/Random.h" #include "minecraft/Direction.h" #include "minecraft/Facing.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/WeighedTreasure.h" #include "minecraft/world/item/CoalItem.h" #include "minecraft/world/item/EnchantedBookItem.h" @@ -30,6 +29,7 @@ #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/level/tile/entity/MobSpawnerTileEntity.h" #include "nbt/CompoundTag.h" +#include "util/StringHelpers.h" int StrongholdPieces::totalWeight = 0; std::list StrongholdPieces::currentPieces; @@ -1970,8 +1970,8 @@ 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, - x, z); + gameServices().addTerrainFeaturePosition( + eTerrainFeature_StrongholdEndPortal, x, z); level->getLevelData()->setXStrongholdEndPortal(x); level->getLevelData()->setZStrongholdEndPortal(z); level->getLevelData()->setHasStrongholdEndPortal(); diff --git a/targets/minecraft/world/level/levelgen/structure/StructureFeatureIO.cpp b/targets/minecraft/world/level/levelgen/structure/StructureFeatureIO.cpp index 17741eb9f..9516fa122 100644 --- a/targets/minecraft/world/level/levelgen/structure/StructureFeatureIO.cpp +++ b/targets/minecraft/world/level/levelgen/structure/StructureFeatureIO.cpp @@ -1,10 +1,10 @@ -#include "minecraft/util/Log.h" #include "StructureFeatureIO.h" #include #include #include +#include "minecraft/util/Log.h" #include "minecraft/world/level/levelgen/structure/MineShaftPieces.h" #include "minecraft/world/level/levelgen/structure/MineShaftStart.h" #include "minecraft/world/level/levelgen/structure/NetherBridgeFeature.h" @@ -96,7 +96,7 @@ StructureStart* StructureFeatureIO::loadStaticStart(CompoundTag* tag, start->load(level, tag); } else { Log::info("Skipping Structure with id %s", - tag->getString("id").c_str()); + tag->getString("id").c_str()); } return start; } @@ -113,8 +113,7 @@ StructurePiece* StructureFeatureIO::loadStaticPiece(CompoundTag* tag, if (piece != nullptr) { piece->load(level, tag); } else { - Log::info("Skipping Piece with id %s", - tag->getString("id").c_str()); + Log::info("Skipping Piece with id %s", tag->getString("id").c_str()); } return piece; } \ No newline at end of file diff --git a/targets/minecraft/world/level/levelgen/structure/StructureFeatureSavedData.cpp b/targets/minecraft/world/level/levelgen/structure/StructureFeatureSavedData.cpp index 3efefcfd8..21222c680 100644 --- a/targets/minecraft/world/level/levelgen/structure/StructureFeatureSavedData.cpp +++ b/targets/minecraft/world/level/levelgen/structure/StructureFeatureSavedData.cpp @@ -2,9 +2,9 @@ #include -#include "util/StringHelpers.h" #include "minecraft/world/level/saveddata/SavedData.h" #include "nbt/CompoundTag.h" +#include "util/StringHelpers.h" std::string StructureFeatureSavedData::TAG_FEATURES = "Features"; @@ -35,7 +35,7 @@ void StructureFeatureSavedData::putFeatureTag(CompoundTag* tag, int chunkX, } std::string StructureFeatureSavedData::createFeatureTagId(int chunkX, - int chunkZ) { + int chunkZ) { return "[" + toWString(chunkX) + "," + toWString(chunkZ) + "]"; } diff --git a/targets/minecraft/world/level/levelgen/structure/VillageFeature.cpp b/targets/minecraft/world/level/levelgen/structure/VillageFeature.cpp index 7809d2e75..818b189b1 100644 --- a/targets/minecraft/world/level/levelgen/structure/VillageFeature.cpp +++ b/targets/minecraft/world/level/levelgen/structure/VillageFeature.cpp @@ -1,16 +1,16 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "VillageFeature.h" #include #include #include -#include "minecraft/GameEnums.h" -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "VillagePieces.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/biome/Biome.h" #include "minecraft/world/level/biome/BiomeSource.h" @@ -85,7 +85,8 @@ 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); diff --git a/targets/minecraft/world/level/newbiome/layer/BiomeOverrideLayer.cpp b/targets/minecraft/world/level/newbiome/layer/BiomeOverrideLayer.cpp index ac5c7ba22..f11c6a6d7 100644 --- a/targets/minecraft/world/level/newbiome/layer/BiomeOverrideLayer.cpp +++ b/targets/minecraft/world/level/newbiome/layer/BiomeOverrideLayer.cpp @@ -1,11 +1,11 @@ -#include "minecraft/util/Log.h" #include "BiomeOverrideLayer.h" #include #include "minecraft/IGameServices.h" -#include "platform/fs/fs.h" +#include "minecraft/util/Log.h" #include "minecraft/world/level/newbiome/layer/Layer.h" +#include "platform/fs/fs.h" #if defined(__linux__) #endif #include "minecraft/world/level/biome/Biome.h" @@ -15,8 +15,8 @@ BiomeOverrideLayer::BiomeOverrideLayer(int seedMixup) : Layer(seedMixup) { { const char* path = "GameRules/biomemap.bin"; - auto result = PlatformFilesystem.readFile( - path, m_biomeOverride.data(), m_biomeOverride.size()); + auto result = PlatformFilesystem.readFile(path, m_biomeOverride.data(), + m_biomeOverride.size()); if (result.status == IPlatformFilesystem::ReadStatus::NotFound) { Log::info("Biome override not found, using plains as default\n"); memset(m_biomeOverride.data(), Biome::plains->id, diff --git a/targets/minecraft/world/level/newbiome/layer/Layer.cpp b/targets/minecraft/world/level/newbiome/layer/Layer.cpp index 2260891db..bacde1c54 100644 --- a/targets/minecraft/world/level/newbiome/layer/Layer.cpp +++ b/targets/minecraft/world/level/newbiome/layer/Layer.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "minecraft/world/level/newbiome/layer/Layer.h" #include @@ -7,8 +6,8 @@ #include #include "BiomeOverrideLayer.h" -#include "platform/input/input.h" #include "minecraft/Console_Debug_enum.h" +#include "minecraft/IGameServices.h" #include "minecraft/world/level/LevelType.h" #include "minecraft/world/level/newbiome/layer/AddIslandLayer.h" #include "minecraft/world/level/newbiome/layer/AddMushroomIslandLayer.h" @@ -26,6 +25,7 @@ #include "minecraft/world/level/newbiome/layer/SwampRiversLayer.h" #include "minecraft/world/level/newbiome/layer/VoronoiZoom.h" #include "minecraft/world/level/newbiome/layer/ZoomLayer.h" +#include "platform/input/input.h" std::vector> Layer::getDefaultLayers( int64_t seed, LevelType* levelType) { diff --git a/targets/minecraft/world/level/pathfinder/Node.cpp b/targets/minecraft/world/level/pathfinder/Node.cpp index e5fe4fb07..222df853f 100644 --- a/targets/minecraft/world/level/pathfinder/Node.cpp +++ b/targets/minecraft/world/level/pathfinder/Node.cpp @@ -7,8 +7,8 @@ #include -#include "util/StringHelpers.h" #include "minecraft/util/Mth.h" +#include "util/StringHelpers.h" void Node::_init() { heapIdx = -1; diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFile.h b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFile.h index b58a8dd20..1565a00c4 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFile.h +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFile.h @@ -10,7 +10,7 @@ enum class SaveFileSeekOrigin { Begin, Current, End }; class ConsoleSaveFile { public: - virtual ~ConsoleSaveFile() {}; + virtual ~ConsoleSaveFile(){}; virtual FileEntry* createFile(const ConsoleSavePath& fileName) = 0; virtual void deleteFile(FileEntry* file) = 0; diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileConverter.cpp b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileConverter.cpp index dc3b599ae..75290bc2d 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileConverter.cpp +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileConverter.cpp @@ -116,7 +116,7 @@ void ConsoleSaveFileConverter::ConvertSave(ConsoleSaveFile* sourceSave, FileEntry* targetFe = targetSave->createFile(targetPlayerDatPath); printf("Processing player dat file %s\n", - playerFiles->at(fileIdx)->data.filename); + playerFiles->at(fileIdx)->data.filename); ProcessSimpleFile(sourceSave, sourceFe, targetSave, targetFe); targetFe->data.lastModifiedTime = @@ -169,8 +169,8 @@ void ConsoleSaveFileConverter::ConvertSave(ConsoleSaveFile* sourceSave, if (dis) { int read = dis->read(); DataOutputStream* dos = - targetCache._getChunkDataOutputStream(targetSave, "", - x, z); + targetCache._getChunkDataOutputStream(targetSave, "", x, + z); BufferedOutputStream bos(dos, 1024 * 1024); while (read != -1) { bos.write(read & 0xff); @@ -303,7 +303,7 @@ void ConsoleSaveFileConverter::ConvertSave(ConsoleSaveFile* sourceSave, } else { #if !defined(_CONTENT_PACKAGE) printf("%s is not a region file, ignoring\n", - fe->data.filename); + fe->data.filename); #endif } } diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp index b1e4f1370..052bd2851 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.h" #include @@ -14,26 +12,27 @@ #include #include -#include "platform/PlatformTypes.h" -#include "minecraft/GameEnums.h" -#include "minecraft/BuildVer.h" -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "java/File.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" #include "java/System.h" +#include "minecraft/BuildVer.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/level/ServerLevel.h" +#include "minecraft/util/Log.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/chunk/storage/RegionFile.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFile.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSavePath.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "minecraft/world/level/storage/LevelData.h" -#include "platform/storage/storage.h" +#include "platform/PlatformTypes.h" #include "platform/fs/fs.h" - +#include "platform/storage/storage.h" ConsoleSaveFileOriginal::ConsoleSaveFileOriginal( const std::string& fileName, void* pvSaveData /*= nullptr*/, @@ -46,7 +45,8 @@ 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); @@ -68,7 +68,7 @@ ConsoleSaveFileOriginal::ConsoleSaveFileOriginal( unsigned int storageLength; PlatformStorage.GetSaveData(pvSaveMem, &storageLength); Log::info("Filesize - %d, Adjusted size - %d\n", fileSize, - storageLength); + storageLength); fileSize = storageLength; } void* pvSourceData = pvSaveMem; @@ -548,8 +548,7 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail) { memcpy(compData, &saveVer, sizeof(int)); memcpy(compData + 4, &fileSize, sizeof(int)); - Log::info("Save data compressed from %d to %d\n", fileSize, - compLength); + Log::info("Save data compressed from %d to %d\n", fileSize, compLength); std::uint8_t* pbThumbnailData = nullptr; unsigned int dwThumbnailDataSize = 0; @@ -559,7 +558,7 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail) { #ifdef _WINDOWS64 gameServices().getSaveThumbnail(&pbThumbnailData, &dwThumbnailDataSize, - &pbDataSaveImage, &dwDataSizeSaveImage); + &pbDataSaveImage, &dwDataSizeSaveImage); #endif std::uint8_t bTextMetadata[88] = {}; @@ -785,8 +784,7 @@ void ConsoleSaveFileOriginal::ConvertToLocalPlatform() { Log::info("Processing a region file: %s\n", fName.c_str()); ConvertRegionFile(File(fe->data.filename)); } else { - Log::info("%s is not a region file, ignoring\n", - fName.c_str()); + Log::info("%s is not a region file, ignoring\n", fName.c_str()); } } diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.h b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.h index 6e5be08ff..af1771527 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.h +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.h @@ -4,10 +4,10 @@ #include #include -#include "util/Definitions.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFile.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSavePath.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h" +#include "util/Definitions.h" class ConsoleSaveFileOriginal : public ConsoleSaveFile { private: diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp index b1bb7a155..40fcd3baf 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.h" #include @@ -15,32 +13,33 @@ #include #include -#include "platform/fs/fs.h" -#include "platform/PlatformTypes.h" -#include "minecraft/GameEnums.h" -#include "minecraft/BuildVer.h" -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" -#include "util/Timer.h" -#include "util/StringHelpers.h" -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "java/File.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" #include "java/System.h" +#include "minecraft/BuildVer.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/level/ServerLevel.h" +#include "minecraft/util/Log.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/chunk/storage/RegionFile.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFile.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileConverter.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSavePath.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "minecraft/world/level/storage/LevelData.h" +#include "platform/PlatformTypes.h" +#include "platform/fs/fs.h" #include "platform/storage/storage.h" +#include "util/StringHelpers.h" +#include "util/Timer.h" class ProgressListener; - ConsoleSaveFileSplit::RegionFileReference::RegionFileReference( int index, unsigned int regionIndex, unsigned int length /*=0*/, unsigned char* data /*=nullptr*/) { @@ -363,7 +362,8 @@ 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); @@ -450,7 +450,7 @@ void ConsoleSaveFileSplit::_init(const std::string& fileName, void* pvSaveData, unsigned int storageLength; PlatformStorage.GetSaveData(pvSaveMem, &storageLength); Log::info("Filesize - %d, Adjusted size - %d\n", fileSize, - storageLength); + storageLength); fileSize = storageLength; } @@ -932,9 +932,8 @@ void ConsoleSaveFileSplit::tick() { #endif if (writeRequired) { - PlatformStorage.SaveSubfiles([this](bool bRes) { - return SaveRegionFilesCallback(this, bRes); - }); + PlatformStorage.SaveSubfiles( + [this](bool bRes) { return SaveRegionFilesCallback(this, bRes); }); } ReleaseSaveAccess(); @@ -1151,7 +1150,7 @@ std::string ConsoleSaveFileSplit::GetNameFromNumericIdentifier( signed char regionX = (idIn >> 8) & 255; signed char regionZ = idIn & 255; std::string region = (prefix + std::string("r.") + toWString(regionX) + - "." + toWString(regionZ) + ".mcr"); + "." + toWString(regionZ) + ".mcr"); return region; } @@ -1236,7 +1235,7 @@ void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail) { fileSize); Log::info("Check buffer size: Elapsed time %f\n", - static_cast(timer.elapsed_seconds())); + static_cast(timer.elapsed_seconds())); // We add 4 bytes to the start so that we can signal compressed data // And another 4 bytes to store the decompressed data size @@ -1253,15 +1252,14 @@ void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail) { pvSaveMem, fileSize); Log::info("Compress: Elapsed time %f\n", - static_cast(timer.elapsed_seconds())); + static_cast(timer.elapsed_seconds())); memset(compData, 0, 8); int saveVer = 0; memcpy(compData, &saveVer, sizeof(int)); memcpy(compData + 4, &fileSize, sizeof(int)); - Log::info("Save data compressed from %d to %d\n", fileSize, - compLength); + Log::info("Save data compressed from %d to %d\n", fileSize, compLength); if (updateThumbnail) { std::uint8_t* pbThumbnailData = nullptr; @@ -1301,9 +1299,8 @@ void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail) { PlatformStorage.GetSaveUniqueNumber(&saveOrCheckpointId); // save the data - PlatformStorage.SaveSaveData([this](bool bRes) { - return SaveSaveDataCallback(this, bRes); - }); + PlatformStorage.SaveSaveData( + [this](bool bRes) { return SaveSaveDataCallback(this, bRes); }); #if !defined(_CONTENT_PACKAGE) if (gameServices().debugSettingsOn()) { if (gameServices().getWriteSavesToFolderEnabled()) { @@ -1517,8 +1514,7 @@ void ConsoleSaveFileSplit::ConvertToLocalPlatform() { Log::info("Processing a region file: %s\n", fName.c_str()); ConvertRegionFile(File(fe->data.filename)); } else { - Log::info("%s is not a region file, ignoring\n", - fName.c_str()); + Log::info("%s is not a region file, ignoring\n", fName.c_str()); } } diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.h b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.h index bfc05165f..a62d12407 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.h +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.h @@ -5,10 +5,10 @@ #include #include -#include "util/Definitions.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFile.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSavePath.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h" +#include "util/Definitions.h" class ProgressRenderer; class ProgressListener; diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.cpp b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.cpp index 991a8af5b..946f107c5 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.cpp +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.cpp @@ -2,8 +2,6 @@ // #define _DEBUG_FILE_HEADER -#include "minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h" - #include #include @@ -13,8 +11,9 @@ #include #include "app/linux/LinuxGame.h" -#include "util/Definitions.h" #include "java/System.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h" +#include "util/Definitions.h" extern LinuxGame app; @@ -114,8 +113,8 @@ void FileHeader::WriteHeader(void* saveMem) { char* headerPosition = (char*)saveMem + headerOffset; #if defined(_DEBUG_FILE_HEADER) - Log::info("\n\nWrite file Header: Offset = %d, Size = %d\n", - headerOffset, headerSize); + Log::info("\n\nWrite file Header: Offset = %d, Size = %d\n", headerOffset, + headerSize); #endif // Write the header @@ -181,8 +180,8 @@ void FileHeader::ReadHeader( Log::info( "Read save file with orignal version: %d, and current version %d\n", m_originalSaveVersion, m_saveVersion); - Log::info("\n\nRead file Header: Offset = %d, Size = %d\n", - headerOffset, headerSize); + Log::info("\n\nRead file Header: Offset = %d, Size = %d\n", headerOffset, + headerSize); #endif char* headerPosition = (char*)saveMem + headerOffset; @@ -268,11 +267,10 @@ void FileHeader::ReadHeader( lastFile = entry; fileTable.push_back(entry); #if defined(_DEBUG_FILE_HEADER) - Log::info( - "File: %s, Start = %d, Length = %d, End = %d\n", - entry->data.filename, entry->data.startOffset, - entry->data.length, - entry->data.startOffset + entry->data.length); + Log::info("File: %s, Start = %d, Length = %d, End = %d\n", + entry->data.filename, entry->data.startOffset, + entry->data.length, + entry->data.startOffset + entry->data.length); #endif i += sizeof(FileEntrySaveDataV1); @@ -281,8 +279,7 @@ void FileHeader::ReadHeader( } break; default: #if !defined(_CONTENT_PACKAGE) - Log::info("********** Invalid save version %d\n", - m_saveVersion); + Log::info("********** Invalid save version %d\n", m_saveVersion); assert(0); #endif break; diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h index c0955c660..fdc151b46 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h @@ -1,13 +1,12 @@ #pragma once +#include #include #include #include #include #include -#include - #define MAKE_FOURCC(ch0, ch1, ch2, ch3) \ (static_cast(static_cast(ch0)) | \ (static_cast(static_cast(ch1)) << 8) | \ @@ -81,8 +80,8 @@ enum ESavePlatform { struct FileEntrySaveDataV1 { public: - char filename[64]; // 64 * 2B - unsigned int length; // In bytes // 4B + char filename[64]; // 64 * 2B + unsigned int length; // In bytes // 4B // This is only valid once the save file has been written/loaded at least // once @@ -93,8 +92,8 @@ public: // updating 4J Stu - As of writing the tutorial level uses a V1 save file struct FileEntrySaveDataV2 { public: - char filename[64]; // 64 * 2B - unsigned int length; // In bytes // 4B + char filename[64]; // 64 * 2B + unsigned int length; // In bytes // 4B union { // This is only valid once the save file has been written/loaded at diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/compression.cpp b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/compression.cpp index 0397adb6d..26b8f0156 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/compression.cpp +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/compression.cpp @@ -2,12 +2,11 @@ #include #include +#include #include #include -#include - thread_local Compression::ThreadStorage* Compression::m_tlsCompression = nullptr; Compression::ThreadStorage* Compression::m_tlsCompressionDefault = nullptr; @@ -41,8 +40,7 @@ int32_t Compression::CompressLZXRLE(void* pDestination, unsigned int* pDestSize, void* pSource, unsigned int SrcSize) { std::lock_guard lock(rleCompressLock); - if (rleCompressBuf.size() < SrcSize * 2) - rleCompressBuf.resize(SrcSize * 2); + if (rleCompressBuf.size() < SrcSize * 2) rleCompressBuf.resize(SrcSize * 2); unsigned char* pucIn = (unsigned char*)pSource; unsigned char* pucEnd = pucIn + SrcSize; @@ -60,8 +58,7 @@ int32_t Compression::CompressLZXRLE(void* pDestination, unsigned int* pDestSize, *pucOut++ = 255; *pucOut++ = count - 1; } else { - for (unsigned int i = 0; i < count; i++) - *pucOut++ = thisOne; + for (unsigned int i = 0; i < count; i++) *pucOut++ = thisOne; } } else { *pucOut++ = 255; @@ -81,8 +78,7 @@ int32_t Compression::DecompressLZXRLE(void* pDestination, std::lock_guard lock(rleDecompressLock); unsigned int rleSize = *pDestSize; - if (rleDecompressBuf.size() < rleSize) - rleDecompressBuf.resize(rleSize); + if (rleDecompressBuf.size() < rleSize) rleDecompressBuf.resize(rleSize); Decompress(rleDecompressBuf.data(), &rleSize, pSource, SrcSize); @@ -96,13 +92,11 @@ int32_t Compression::DecompressLZXRLE(void* pDestination, unsigned int count = *pucIn++; if (count < 3) { count++; - for (unsigned int i = 0; i < count; i++) - *pucOut++ = 255; + for (unsigned int i = 0; i < count; i++) *pucOut++ = 255; } else { count++; unsigned char data = *pucIn++; - for (unsigned int i = 0; i < count; i++) - *pucOut++ = data; + for (unsigned int i = 0; i < count; i++) *pucOut++ = data; } } else { *pucOut++ = thisOne; @@ -172,13 +166,11 @@ int32_t Compression::DecompressRLE(void* pDestination, unsigned int* pDestSize, unsigned int count = *pucIn++; if (count < 3) { count++; - for (unsigned int i = 0; i < count; i++) - *pucOut++ = 255; + for (unsigned int i = 0; i < count; i++) *pucOut++ = 255; } else { count++; unsigned char data = *pucIn++; - for (unsigned int i = 0; i < count; i++) - *pucOut++ = data; + for (unsigned int i = 0; i < count; i++) *pucOut++ = data; } } else { *pucOut++ = thisOne; diff --git a/targets/minecraft/world/level/storage/DerivedLevelData.cpp b/targets/minecraft/world/level/storage/DerivedLevelData.cpp index 6a4da8059..a70321548 100644 --- a/targets/minecraft/world/level/storage/DerivedLevelData.cpp +++ b/targets/minecraft/world/level/storage/DerivedLevelData.cpp @@ -38,9 +38,7 @@ CompoundTag* DerivedLevelData::getLoadedPlayerTag() { return wrapped->getLoadedPlayerTag(); } -std::string DerivedLevelData::getLevelName() { - return wrapped->getLevelName(); -} +std::string DerivedLevelData::getLevelName() { return wrapped->getLevelName(); } int DerivedLevelData::getVersion() { return wrapped->getVersion(); } diff --git a/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp b/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp index 050851a20..c3881941d 100644 --- a/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp +++ b/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "DirectoryLevelStorage.h" #include @@ -12,11 +10,8 @@ #include #include -#include "platform/input/input.h" #include "LevelData.h" -#include "minecraft/Console_Debug_enum.h" #include "app/common/GameRules/GameRuleManager.h" -#include "util/StringHelpers.h" #include "java/File.h" #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/ByteArrayOutputStream.h" @@ -24,6 +19,9 @@ #include "java/InputOutputStream/DataOutputStream.h" #include "java/InputOutputStream/FileOutputStream.h" #include "java/System.h" +#include "minecraft/Console_Debug_enum.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/level/chunk/storage/OldChunkStorage.h" #include "minecraft/world/level/dimension/Dimension.h" @@ -40,7 +38,9 @@ #include "nbt/DoubleTag.h" #include "nbt/ListTag.h" #include "nbt/NbtIo.h" +#include "platform/input/input.h" #include "platform/storage/storage.h" +#include "util/StringHelpers.h" const std::string DirectoryLevelStorage::sc_szPlayerDir("players/"); @@ -165,7 +165,7 @@ void DirectoryLevelStorage::PlayerMappings::writeMappings( dos->writeInt(m_mappings.size()); for (auto it = m_mappings.begin(); it != m_mappings.end(); ++it) { Log::info(" -- %lld (0x%016llx) = %d\n", it->first, it->first, - it->second); + it->second); dos->writeLong(it->first); dos->writeInt(it->second); } @@ -401,9 +401,8 @@ void DirectoryLevelStorage::save(std::shared_ptr player) { delete it->second; } m_cachedSaveData[realFile.getName()] = bos; - Log::info( - "Cached saving of file %s due to saves being disabled\n", - realFile.getName().c_str()); + Log::info("Cached saving of file %s due to saves being disabled\n", + realFile.getName().c_str()); } else { ConsoleSaveFileOutputStream fos = ConsoleSaveFileOutputStream(m_saveFile, realFile); @@ -436,7 +435,7 @@ CompoundTag* DirectoryLevelStorage::loadPlayerDataTag(PlayerUID xuid) { CompoundTag* tag = NbtIo::readCompressed(&bis); bis.reset(); Log::info("Loaded player data from cached file %s\n", - realFile.getName().c_str()); + realFile.getName().c_str()); return tag; } else if (m_saveFile->doesFileExist(realFile)) { ConsoleSaveFileInputStream fis = @@ -755,8 +754,7 @@ void DirectoryLevelStorage::saveAllCachedData() { ConsoleSaveFileOutputStream fos = ConsoleSaveFileOutputStream(m_saveFile, realFile); - Log::info("Actually writing cached file %s\n", - it->first.c_str()); + Log::info("Actually writing cached file %s\n", it->first.c_str()); fos.write(bos->buf, 0, bos->size()); delete bos; } diff --git a/targets/minecraft/world/level/storage/DirectoryLevelStorage.h b/targets/minecraft/world/level/storage/DirectoryLevelStorage.h index 2c47e9d8a..43372bbfb 100644 --- a/targets/minecraft/world/level/storage/DirectoryLevelStorage.h +++ b/targets/minecraft/world/level/storage/DirectoryLevelStorage.h @@ -31,12 +31,12 @@ #include #include -#include "platform/PlatformTypes.h" #include "LevelStorage.h" #include "PlayerIO.h" #include "java/File.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSavePath.h" #include "nbt/CompoundTag.h" +#include "platform/PlatformTypes.h" class ConsoleSaveFile; class ByteArrayOutputStream; diff --git a/targets/minecraft/world/level/storage/DirectoryLevelStorageSource.cpp b/targets/minecraft/world/level/storage/DirectoryLevelStorageSource.cpp index 3b3a90340..826bd1651 100644 --- a/targets/minecraft/world/level/storage/DirectoryLevelStorageSource.cpp +++ b/targets/minecraft/world/level/storage/DirectoryLevelStorageSource.cpp @@ -47,8 +47,8 @@ LevelData* DirectoryLevelStorageSource::getDataTagFor( return nullptr; } -void DirectoryLevelStorageSource::renameLevel( - const std::string& levelId, const std::string& newLevelName) { +void DirectoryLevelStorageSource::renameLevel(const std::string& levelId, + const std::string& newLevelName) { ConsoleSaveFileOriginal tempSave(levelId); // File dataFile = File(dir, "level.dat"); diff --git a/targets/minecraft/world/level/storage/LevelData.cpp b/targets/minecraft/world/level/storage/LevelData.cpp index 6c2070685..f9c2f368a 100644 --- a/targets/minecraft/world/level/storage/LevelData.cpp +++ b/targets/minecraft/world/level/storage/LevelData.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "LevelData.h" #include @@ -6,9 +5,10 @@ #include #include +#include "java/System.h" #include "minecraft/GameEnums.h" #include "minecraft/GameHostOptions.h" -#include "java/System.h" +#include "minecraft/IGameServices.h" #include "minecraft/world/level/GameRules.h" #include "minecraft/world/level/LevelSettings.h" #include "minecraft/world/level/LevelType.h" @@ -85,11 +85,11 @@ LevelData::LevelData(CompoundTag* tag) { newSeaLevel = tag->getBoolean( "newSeaLevel"); // 4J added - only use new sea level for newly created - // maps. This read defaults to false. (sea level - // changes in 1.8.2) + // maps. This read defaults to false. (sea level + // changes in 1.8.2) hasBeenInCreative = tag->getBoolean( "hasBeenInCreative"); // 4J added so we can not award achievements to - // levels modified in creative + // levels modified in creative // 4J added - for stronghold position bStronghold = tag->getBoolean("hasStronghold"); @@ -182,7 +182,8 @@ LevelData::LevelData(CompoundTag* tag) { assert(0); break; } - gameServices().setGameHostOption(eGameHostOption_WorldSize, hostOptionworldSize); + gameServices().setGameHostOption(eGameHostOption_WorldSize, + hostOptionworldSize); #endif /* 4J - we don't store this anymore diff --git a/targets/minecraft/world/level/storage/LevelStorage.h b/targets/minecraft/world/level/storage/LevelStorage.h index 84aecf363..ff4e53793 100644 --- a/targets/minecraft/world/level/storage/LevelStorage.h +++ b/targets/minecraft/world/level/storage/LevelStorage.h @@ -4,8 +4,8 @@ #include #include -#include "platform/PlatformTypes.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSavePath.h" +#include "platform/PlatformTypes.h" class PlayerIO; class Dimension; diff --git a/targets/minecraft/world/level/storage/McRegionLevelStorage.cpp b/targets/minecraft/world/level/storage/McRegionLevelStorage.cpp index 1d23e0831..d7345ba6b 100644 --- a/targets/minecraft/world/level/storage/McRegionLevelStorage.cpp +++ b/targets/minecraft/world/level/storage/McRegionLevelStorage.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "McRegionLevelStorage.h" #include @@ -9,6 +7,8 @@ #include "LevelData.h" #include "java/File.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "minecraft/world/level/chunk/storage/McRegionChunkStorage.h" #include "minecraft/world/level/chunk/storage/RegionFileCache.h" #include "minecraft/world/level/dimension/Dimension.h" diff --git a/targets/minecraft/world/level/storage/MemoryLevelStorage.cpp b/targets/minecraft/world/level/storage/MemoryLevelStorage.cpp index f233a29b9..1361fa7f3 100644 --- a/targets/minecraft/world/level/storage/MemoryLevelStorage.cpp +++ b/targets/minecraft/world/level/storage/MemoryLevelStorage.cpp @@ -1,9 +1,5 @@ #include "MemoryLevelStorage.h" - - - - #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileIO.h" #include "nbt/NbtIo.h" diff --git a/targets/minecraft/world/level/storage/MemoryLevelStorage.h b/targets/minecraft/world/level/storage/MemoryLevelStorage.h index 5a00c45b6..6bc1d34fb 100644 --- a/targets/minecraft/world/level/storage/MemoryLevelStorage.h +++ b/targets/minecraft/world/level/storage/MemoryLevelStorage.h @@ -2,10 +2,6 @@ #include "LevelStorage.h" #include "PlayerIO.h" - - - - #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFile.h" #include "nbt/NbtIo.h" diff --git a/targets/minecraft/world/level/storage/MemoryLevelStorageSource.cpp b/targets/minecraft/world/level/storage/MemoryLevelStorageSource.cpp index 2ff75f643..e2ee62feb 100644 --- a/targets/minecraft/world/level/storage/MemoryLevelStorageSource.cpp +++ b/targets/minecraft/world/level/storage/MemoryLevelStorageSource.cpp @@ -3,7 +3,6 @@ #include "LevelSummary.h" #include "MemoryLevelStorage.h" - MemoryLevelStorageSource::MemoryLevelStorageSource() {} std::string MemoryLevelStorageSource::getName() { return "Memory Storage"; } @@ -19,8 +18,7 @@ std::vector* MemoryLevelStorageSource::getLevelList() { void MemoryLevelStorageSource::clearAll() {} -LevelData* MemoryLevelStorageSource::getDataTagFor( - const std::string& levelId) { +LevelData* MemoryLevelStorageSource::getDataTagFor(const std::string& levelId) { return nullptr; } diff --git a/targets/minecraft/world/level/storage/SavedDataStorage.h b/targets/minecraft/world/level/storage/SavedDataStorage.h index 707e967c6..eaa1df0e4 100644 --- a/targets/minecraft/world/level/storage/SavedDataStorage.h +++ b/targets/minecraft/world/level/storage/SavedDataStorage.h @@ -6,8 +6,8 @@ #include #include -#include "platform/PlatformTypes.h" #include "minecraft/world/level/saveddata/SavedData.h" +#include "platform/PlatformTypes.h" class ConsoleSaveFile; class LevelStorage; diff --git a/targets/minecraft/world/level/tile/CarrotTile.cpp b/targets/minecraft/world/level/tile/CarrotTile.cpp index 1ad45648a..7e362b287 100644 --- a/targets/minecraft/world/level/tile/CarrotTile.cpp +++ b/targets/minecraft/world/level/tile/CarrotTile.cpp @@ -2,10 +2,10 @@ #include -#include "util/StringHelpers.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/level/tile/CropTile.h" +#include "util/StringHelpers.h" CarrotTile::CarrotTile(int id) : CropTile(id) {} diff --git a/targets/minecraft/world/level/tile/CauldronTile.cpp b/targets/minecraft/world/level/tile/CauldronTile.cpp index 923512936..b0285c05f 100644 --- a/targets/minecraft/world/level/tile/CauldronTile.cpp +++ b/targets/minecraft/world/level/tile/CauldronTile.cpp @@ -122,7 +122,7 @@ bool CauldronTile::use(Level* level, int x, int y, int z, } // 4J Stu - Brought forward change to update inventory when filling // bottles with water - else if (player->instanceof(eTYPE_SERVERPLAYER)) { + else if (player->instanceof (eTYPE_SERVERPLAYER)) { std::dynamic_pointer_cast(player) ->refreshContainer(player->inventoryMenu); } diff --git a/targets/minecraft/world/level/tile/CocoaTile.cpp b/targets/minecraft/world/level/tile/CocoaTile.cpp index a318de664..034da2453 100644 --- a/targets/minecraft/world/level/tile/CocoaTile.cpp +++ b/targets/minecraft/world/level/tile/CocoaTile.cpp @@ -20,8 +20,7 @@ class Icon; -const std::string CocoaTile::TEXTURE_AGES[] = {"cocoa_0", "cocoa_1", - "cocoa_2"}; +const std::string CocoaTile::TEXTURE_AGES[] = {"cocoa_0", "cocoa_1", "cocoa_2"}; CocoaTile::CocoaTile(int id) : DirectionalTile(id, Material::plant, false) { setTicking(true); diff --git a/targets/minecraft/world/level/tile/CropTile.cpp b/targets/minecraft/world/level/tile/CropTile.cpp index 301bdc6d6..39446245f 100644 --- a/targets/minecraft/world/level/tile/CropTile.cpp +++ b/targets/minecraft/world/level/tile/CropTile.cpp @@ -3,7 +3,6 @@ #include #include -#include "util/StringHelpers.h" #include "java/Random.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/item/Item.h" @@ -11,6 +10,7 @@ #include "minecraft/world/level/Level.h" #include "minecraft/world/level/tile/PlantTile.h" #include "minecraft/world/level/tile/Tile.h" +#include "util/StringHelpers.h" class Icon; diff --git a/targets/minecraft/world/level/tile/DispenserTile.h b/targets/minecraft/world/level/tile/DispenserTile.h index 03583f27f..9e1fa4c09 100644 --- a/targets/minecraft/world/level/tile/DispenserTile.h +++ b/targets/minecraft/world/level/tile/DispenserTile.h @@ -3,7 +3,6 @@ #include "BaseEntityTile.h" - class Player; class Mob; class ChunkRebuildData; diff --git a/targets/minecraft/world/level/tile/DoorTile.cpp b/targets/minecraft/world/level/tile/DoorTile.cpp index c1d90edb0..3f46a894e 100644 --- a/targets/minecraft/world/level/tile/DoorTile.cpp +++ b/targets/minecraft/world/level/tile/DoorTile.cpp @@ -15,8 +15,8 @@ #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/phys/AABB.h" -const std::string DoorTile::TEXTURES[] = { - "doorWood_lower", "doorWood_upper", "doorIron_lower", "doorIron_upper"}; +const std::string DoorTile::TEXTURES[] = {"doorWood_lower", "doorWood_upper", + "doorIron_lower", "doorIron_upper"}; DoorTile::DoorTile(int id, Material* material) : Tile(id, material, false) { if (material == Material::metal) { diff --git a/targets/minecraft/world/level/tile/DropperTile.cpp b/targets/minecraft/world/level/tile/DropperTile.cpp index 2fba41574..d6d562edd 100644 --- a/targets/minecraft/world/level/tile/DropperTile.cpp +++ b/targets/minecraft/world/level/tile/DropperTile.cpp @@ -25,8 +25,7 @@ DropperTile::DropperTile(int id) : DispenserTile(id) { void DropperTile::registerIcons(IconRegister* iconRegister) { icon = iconRegister->registerIcon("furnace_side"); iconTop = iconRegister->registerIcon("furnace_top"); - iconFront = - iconRegister->registerIcon(getIconName() + "_front_horizontal"); + iconFront = iconRegister->registerIcon(getIconName() + "_front_horizontal"); iconFrontVertical = iconRegister->registerIcon(getIconName() + "_front_vertical"); } diff --git a/targets/minecraft/world/level/tile/FarmTile.cpp b/targets/minecraft/world/level/tile/FarmTile.cpp index 5aefb4056..1e8801522 100644 --- a/targets/minecraft/world/level/tile/FarmTile.cpp +++ b/targets/minecraft/world/level/tile/FarmTile.cpp @@ -69,7 +69,7 @@ void FarmTile::fallOn(Level* level, int x, int y, int z, // the client based on random values! if (!level->isClientSide && level->random->nextFloat() < (fallDistance - .5f)) { - if (entity->instanceof(eTYPE_PLAYER)) { + if (entity->instanceof (eTYPE_PLAYER)) { std::shared_ptr player = std::dynamic_pointer_cast(entity); if (!player->isAllowedToMine()) { diff --git a/targets/minecraft/world/level/tile/FireTile.cpp b/targets/minecraft/world/level/tile/FireTile.cpp index 75552e023..c12bf63b0 100644 --- a/targets/minecraft/world/level/tile/FireTile.cpp +++ b/targets/minecraft/world/level/tile/FireTile.cpp @@ -1,12 +1,12 @@ -#include "minecraft/IGameServices.h" #include "FireTile.h" #include #include -#include "minecraft/GameEnums.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/PlayerList.h" diff --git a/targets/minecraft/world/level/tile/FurnaceTile.cpp b/targets/minecraft/world/level/tile/FurnaceTile.cpp index 07c8535cc..c5cde70b1 100644 --- a/targets/minecraft/world/level/tile/FurnaceTile.cpp +++ b/targets/minecraft/world/level/tile/FurnaceTile.cpp @@ -72,8 +72,8 @@ Icon* FurnaceTile::getTexture(int face, int data) { void FurnaceTile::registerIcons(IconRegister* iconRegister) { icon = iconRegister->registerIcon("furnace_side"); - iconFront = iconRegister->registerIcon(lit ? "furnace_front_lit" - : "furnace_front"); + iconFront = + iconRegister->registerIcon(lit ? "furnace_front_lit" : "furnace_front"); iconTop = iconRegister->registerIcon("furnace_top"); } diff --git a/targets/minecraft/world/level/tile/GrassTile.cpp b/targets/minecraft/world/level/tile/GrassTile.cpp index ffba0293c..f59aa04e4 100644 --- a/targets/minecraft/world/level/tile/GrassTile.cpp +++ b/targets/minecraft/world/level/tile/GrassTile.cpp @@ -2,11 +2,11 @@ #include -#include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/Random.h" #include "minecraft/Facing.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelSource.h" diff --git a/targets/minecraft/world/level/tile/HugeMushroomTile.cpp b/targets/minecraft/world/level/tile/HugeMushroomTile.cpp index cf9f036ef..b07cc2197 100644 --- a/targets/minecraft/world/level/tile/HugeMushroomTile.cpp +++ b/targets/minecraft/world/level/tile/HugeMushroomTile.cpp @@ -9,8 +9,7 @@ class Material; const std::string HugeMushroomTile::TEXTURE_STEM = "skin_stem"; const std::string HugeMushroomTile::TEXTURE_INSIDE = "inside"; -const std::string HugeMushroomTile::TEXTURE_TYPE[] = {"skin_brown", - "skin_red"}; +const std::string HugeMushroomTile::TEXTURE_TYPE[] = {"skin_brown", "skin_red"}; HugeMushroomTile::HugeMushroomTile(int id, Material* material, int type) : Tile(id, material) { diff --git a/targets/minecraft/world/level/tile/LeafTile.cpp b/targets/minecraft/world/level/tile/LeafTile.cpp index e37d26e44..008b68c5b 100644 --- a/targets/minecraft/world/level/tile/LeafTile.cpp +++ b/targets/minecraft/world/level/tile/LeafTile.cpp @@ -2,10 +2,10 @@ #include -#include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/world/IconRegister.h" diff --git a/targets/minecraft/world/level/tile/NetherWartTile.cpp b/targets/minecraft/world/level/tile/NetherWartTile.cpp index 976f203ef..8459091c7 100644 --- a/targets/minecraft/world/level/tile/NetherWartTile.cpp +++ b/targets/minecraft/world/level/tile/NetherWartTile.cpp @@ -3,7 +3,6 @@ #include #include -#include "util/StringHelpers.h" #include "java/Random.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/item/Item.h" @@ -11,6 +10,7 @@ #include "minecraft/world/level/Level.h" #include "minecraft/world/level/tile/PlantTile.h" #include "minecraft/world/level/tile/Tile.h" +#include "util/StringHelpers.h" NetherWartTile::NetherWartTile(int id) : Bush(id) { setTicking(true); diff --git a/targets/minecraft/world/level/tile/NotGateTile.cpp b/targets/minecraft/world/level/tile/NotGateTile.cpp index 8185e35a1..45481e685 100644 --- a/targets/minecraft/world/level/tile/NotGateTile.cpp +++ b/targets/minecraft/world/level/tile/NotGateTile.cpp @@ -1,9 +1,9 @@ -#include "minecraft/util/Log.h" #include "NotGateTile.h" #include "java/Random.h" #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/sounds/SoundTypes.h" +#include "minecraft/util/Log.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelSource.h" #include "minecraft/world/level/redstone/Redstone.h" @@ -122,9 +122,8 @@ void NotGateTile::tick(Level* level, int x, int y, int z, Random* random) { level->getData(x, y, z), Tile::UPDATE_ALL); if (isToggledTooFrequently(level, x, y, z, true)) { - Log::info( - "Torch at (%d,%d,%d) has toggled too many times\n", x, y, - z); + Log::info("Torch at (%d,%d,%d) has toggled too many times\n", x, + y, z); level->playSound(x + 0.5f, y + 0.5f, z + 0.5f, eSoundType_RANDOM_FIZZ, 0.5f, @@ -148,9 +147,8 @@ void NotGateTile::tick(Level* level, int x, int y, int z, Random* random) { level->getData(x, y, z), Tile::UPDATE_ALL); } else { - Log::info( - "Torch at (%d,%d,%d) has toggled too many times\n", x, y, - z); + Log::info("Torch at (%d,%d,%d) has toggled too many times\n", x, + y, z); } } } diff --git a/targets/minecraft/world/level/tile/NoteBlockTile.cpp b/targets/minecraft/world/level/tile/NoteBlockTile.cpp index 81fa73386..a77f8fd60 100644 --- a/targets/minecraft/world/level/tile/NoteBlockTile.cpp +++ b/targets/minecraft/world/level/tile/NoteBlockTile.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "NoteBlockTile.h" #include @@ -6,6 +5,7 @@ #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/sounds/SoundTypes.h" +#include "minecraft/util/Log.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/material/Material.h" #include "minecraft/world/level/tile/BaseEntityTile.h" @@ -21,7 +21,7 @@ void NoteBlockTile::neighborChanged(Level* level, int x, int y, int z, std::dynamic_pointer_cast( level->getTileEntity(x, y, z)); Log::info("-------- Signal is %s, tile is currently %s\n", - signal ? "true" : "false", mte->on ? "ON" : "OFF"); + signal ? "true" : "false", mte->on ? "ON" : "OFF"); if (mte != nullptr && mte->on != signal) { if (signal) { mte->playNote(level, x, y, z); @@ -85,8 +85,7 @@ bool NoteBlockTile::triggerEvent(Level* level, int x, int y, int z, int i, iSound = eSoundType_NOTE_HARP; break; } - Log::info("NoteBlockTile::triggerEvent - playSound - pitch = %f\n", - pitch); + Log::info("NoteBlockTile::triggerEvent - playSound - pitch = %f\n", pitch); level->playSound(x + 0.5, y + 0.5, z + 0.5, iSound, 3, pitch); level->addParticle(eParticleType_note, x + 0.5, y + 1.2, z + 0.5, note / 24.0, 0, 0); diff --git a/targets/minecraft/world/level/tile/PotatoTile.cpp b/targets/minecraft/world/level/tile/PotatoTile.cpp index 79519081f..f4f39dd2b 100644 --- a/targets/minecraft/world/level/tile/PotatoTile.cpp +++ b/targets/minecraft/world/level/tile/PotatoTile.cpp @@ -3,13 +3,13 @@ #include #include -#include "util/StringHelpers.h" #include "java/Random.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/tile/CropTile.h" +#include "util/StringHelpers.h" PotatoTile::PotatoTile(int id) : CropTile(id) {} diff --git a/targets/minecraft/world/level/tile/PressurePlateTile.cpp b/targets/minecraft/world/level/tile/PressurePlateTile.cpp index f231bd67d..7ce79210c 100644 --- a/targets/minecraft/world/level/tile/PressurePlateTile.cpp +++ b/targets/minecraft/world/level/tile/PressurePlateTile.cpp @@ -43,7 +43,7 @@ int PressurePlateTile::getSignalStrength(Level* level, int x, int y, int z) { entities = level->getEntitiesOfClass(typeid(Player), &at_bb); else assert(0); // 4J-JEV: We're going to delete something at a random - // location. + // location. if (entities != nullptr && !entities->empty()) { for (auto it = entities->begin(); it != entities->end(); ++it) { diff --git a/targets/minecraft/world/level/tile/RedStoneDustTile.cpp b/targets/minecraft/world/level/tile/RedStoneDustTile.cpp index 49a593141..3496834f7 100644 --- a/targets/minecraft/world/level/tile/RedStoneDustTile.cpp +++ b/targets/minecraft/world/level/tile/RedStoneDustTile.cpp @@ -6,12 +6,12 @@ #include #include "DiodeTile.h" -#include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/Random.h" #include "minecraft/Direction.h" #include "minecraft/Facing.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/item/Item.h" diff --git a/targets/minecraft/world/level/tile/SmoothStoneBrickTile.cpp b/targets/minecraft/world/level/tile/SmoothStoneBrickTile.cpp index 6339f1add..bbb966ce7 100644 --- a/targets/minecraft/world/level/tile/SmoothStoneBrickTile.cpp +++ b/targets/minecraft/world/level/tile/SmoothStoneBrickTile.cpp @@ -7,8 +7,8 @@ class Icon; -const std::string SmoothStoneBrickTile::TEXTURE_NAMES[] = { - "", "mossy", "cracked", "carved"}; +const std::string SmoothStoneBrickTile::TEXTURE_NAMES[] = {"", "mossy", + "cracked", "carved"}; const unsigned int SmoothStoneBrickTile::SMOOTH_STONE_BRICK_NAMES [SMOOTH_STONE_BRICK_NAMES_LENGTH] = {IDS_TILE_STONE_BRICK_SMOOTH, diff --git a/targets/minecraft/world/level/tile/StemTile.cpp b/targets/minecraft/world/level/tile/StemTile.cpp index e46db21c9..e1c08b849 100644 --- a/targets/minecraft/world/level/tile/StemTile.cpp +++ b/targets/minecraft/world/level/tile/StemTile.cpp @@ -2,10 +2,10 @@ #include -#include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/item/ItemInstance.h" diff --git a/targets/minecraft/world/level/tile/StoneMonsterTile.cpp b/targets/minecraft/world/level/tile/StoneMonsterTile.cpp index 8f5f79554..b3d5cb22f 100644 --- a/targets/minecraft/world/level/tile/StoneMonsterTile.cpp +++ b/targets/minecraft/world/level/tile/StoneMonsterTile.cpp @@ -1,9 +1,9 @@ -#include "minecraft/IGameServices.h" #include "StoneMonsterTile.h" #include #include "java/Class.h" +#include "minecraft/IGameServices.h" #include "minecraft/world/entity/monster/Silverfish.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/level/Level.h" diff --git a/targets/minecraft/world/level/tile/TallGrassPlantTile.cpp b/targets/minecraft/world/level/tile/TallGrassPlantTile.cpp index 5925a7066..adae70e40 100644 --- a/targets/minecraft/world/level/tile/TallGrassPlantTile.cpp +++ b/targets/minecraft/world/level/tile/TallGrassPlantTile.cpp @@ -2,10 +2,10 @@ #include -#include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/entity/player/Player.h" @@ -31,7 +31,7 @@ const unsigned int }; const std::string TallGrass::TEXTURE_NAMES[] = {"deadbush", "tallgrass", - "fern"}; + "fern"}; TallGrass::TallGrass(int id) : Bush(id, Material::replaceable_plant) { this->updateDefaultShape(); diff --git a/targets/minecraft/world/level/tile/Tile.cpp b/targets/minecraft/world/level/tile/Tile.cpp index cc772c83a..6e80029c5 100644 --- a/targets/minecraft/world/level/tile/Tile.cpp +++ b/targets/minecraft/world/level/tile/Tile.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "Tile.h" #include @@ -6,12 +5,12 @@ #include #include "Facing.h" -#include "util/StringHelpers.h" #include "java/Class.h" #include "java/Random.h" #include "minecraft/sounds/SoundTypes.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/stats/Stats.h" +#include "minecraft/util/Log.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/entity/ExperienceOrb.h" #include "minecraft/world/entity/item/ItemEntity.h" @@ -152,6 +151,7 @@ #include "minecraft/world/phys/HitResult.h" #include "minecraft/world/phys/Vec3.h" #include "strings.h" +#include "util/StringHelpers.h" std::string Tile::TILE_DESCRIPTION_PREFIX = "Tile."; @@ -2623,8 +2623,8 @@ Tile* Tile::setIconName(const std::string& iconName) { } std::string Tile::getIconName() { - return iconName.empty() ? "MISSING_ICON_TILE_" + toWString(id) + - "_" + toWString(descriptionId) + return iconName.empty() ? "MISSING_ICON_TILE_" + toWString(id) + "_" + + toWString(descriptionId) : iconName; } diff --git a/targets/minecraft/world/level/tile/TntTile.cpp b/targets/minecraft/world/level/tile/TntTile.cpp index 164b88a44..5e0992e57 100644 --- a/targets/minecraft/world/level/tile/TntTile.cpp +++ b/targets/minecraft/world/level/tile/TntTile.cpp @@ -1,12 +1,12 @@ -#include "minecraft/IGameServices.h" #include "TntTile.h" #include -#include "minecraft/GameEnums.h" #include "java/Class.h" #include "java/Random.h" #include "minecraft/Facing.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/sounds/SoundTypes.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/entity/Entity.h" @@ -116,8 +116,8 @@ void TntTile::entityInside(Level* level, int x, int y, int z, if (entity->isOnFire()) { std::shared_ptr arrow = std::dynamic_pointer_cast(entity); - destroy(level, x, y, z, EXPLODE_BIT, - arrow->owner->instanceof(eTYPE_LIVINGENTITY) + destroy(level, x, y, z, EXPLODE_BIT, arrow->owner->instanceof + (eTYPE_LIVINGENTITY) ? std::dynamic_pointer_cast(arrow->owner) : nullptr); level->removeTile(x, y, z); diff --git a/targets/minecraft/world/level/tile/TreeTile.cpp b/targets/minecraft/world/level/tile/TreeTile.cpp index 97c6acd97..7eeed779f 100644 --- a/targets/minecraft/world/level/tile/TreeTile.cpp +++ b/targets/minecraft/world/level/tile/TreeTile.cpp @@ -19,7 +19,7 @@ const std::string TreeTile::TREE_STRING_NAMES[TreeTile::TREE_NAMES_LENGTH] = { "oak", "spruce", "birch", "jungle"}; const std::string TreeTile::TREE_TEXTURES[] = {"tree_side", "tree_spruce", - "tree_birch", "tree_jungle"}; + "tree_birch", "tree_jungle"}; TreeTile::TreeTile(int id) : RotatedPillarTile(id, Material::wood) {} diff --git a/targets/minecraft/world/level/tile/WaterLilyTile.cpp b/targets/minecraft/world/level/tile/WaterLilyTile.cpp index 0b5093458..e096ba19f 100644 --- a/targets/minecraft/world/level/tile/WaterLilyTile.cpp +++ b/targets/minecraft/world/level/tile/WaterLilyTile.cpp @@ -3,10 +3,10 @@ #include #include -#include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/Class.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/material/Material.h" @@ -30,7 +30,7 @@ int WaterlilyTile::getRenderShape() { return Tile::SHAPE_LILYPAD; } void WaterlilyTile::addAABBs(Level* level, int x, int y, int z, AABB* box, std::vector* boxes, std::shared_ptr source) { - if (source == nullptr || !source->instanceof(eTYPE_BOAT)) { + if (source == nullptr || !source->instanceof (eTYPE_BOAT)) { Bush::addAABBs(level, x, y, z, box, boxes, source); } } diff --git a/targets/minecraft/world/level/tile/WoodTile.cpp b/targets/minecraft/world/level/tile/WoodTile.cpp index 68743203a..0a71cf229 100644 --- a/targets/minecraft/world/level/tile/WoodTile.cpp +++ b/targets/minecraft/world/level/tile/WoodTile.cpp @@ -15,7 +15,7 @@ const unsigned int WoodTile::WOOD_NAMES[WOOD_NAMES_LENGTH] = { }; const std::string WoodTile::TEXTURE_NAMES[] = {"oak", "spruce", "birch", - "jungle"}; + "jungle"}; // public static final String[] WOOD_NAMES = { // "oak", "spruce", "birch", "jungle" diff --git a/targets/minecraft/world/level/tile/entity/BeaconTileEntity.cpp b/targets/minecraft/world/level/tile/entity/BeaconTileEntity.cpp index b48dc9fe2..7c1726a50 100644 --- a/targets/minecraft/world/level/tile/entity/BeaconTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/BeaconTileEntity.cpp @@ -1,10 +1,10 @@ -#include "minecraft/IGameServices.h" #include "BeaconTileEntity.h" #include #include #include "SharedConstants.h" +#include "minecraft/IGameServices.h" #include "minecraft/network/packet/TileEntityDataPacket.h" #include "minecraft/world/effect/MobEffect.h" #include "minecraft/world/effect/MobEffectInstance.h" @@ -281,7 +281,8 @@ void BeaconTileEntity::setItem(unsigned int slot, } std::string BeaconTileEntity::getName() { - return hasCustomName() ? name : gameServices().getString(IDS_CONTAINER_BEACON); + return hasCustomName() ? name + : gameServices().getString(IDS_CONTAINER_BEACON); } std::string BeaconTileEntity::getCustomName() { diff --git a/targets/minecraft/world/level/tile/entity/BrewingStandTileEntity.cpp b/targets/minecraft/world/level/tile/entity/BrewingStandTileEntity.cpp index 37e4b5077..bed079723 100644 --- a/targets/minecraft/world/level/tile/entity/BrewingStandTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/BrewingStandTileEntity.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "BrewingStandTileEntity.h" #include @@ -7,6 +6,7 @@ #include #include "Facing.h" +#include "minecraft/IGameServices.h" #include "minecraft/SharedConstants.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/item/Item.h" @@ -40,7 +40,8 @@ BrewingStandTileEntity::BrewingStandTileEntity() { BrewingStandTileEntity::~BrewingStandTileEntity() {} std::string BrewingStandTileEntity::getName() { - return hasCustomName() ? name : gameServices().getString(IDS_TILE_BREWINGSTAND); + return hasCustomName() ? name + : gameServices().getString(IDS_TILE_BREWINGSTAND); } std::string BrewingStandTileEntity::getCustomName() { diff --git a/targets/minecraft/world/level/tile/entity/ChestTileEntity.cpp b/targets/minecraft/world/level/tile/entity/ChestTileEntity.cpp index 0c25656e0..a54db394b 100644 --- a/targets/minecraft/world/level/tile/entity/ChestTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/ChestTileEntity.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "ChestTileEntity.h" #include @@ -9,6 +8,7 @@ #include "SharedConstants.h" #include "TileEntity.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/network/packet/ContainerOpenPacket.h" #include "minecraft/sounds/SoundTypes.h" #include "minecraft/world/CompoundContainer.h" diff --git a/targets/minecraft/world/level/tile/entity/CommandBlockEntity.cpp b/targets/minecraft/world/level/tile/entity/CommandBlockEntity.cpp index 654309fa7..6ce14da25 100644 --- a/targets/minecraft/world/level/tile/entity/CommandBlockEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/CommandBlockEntity.cpp @@ -34,9 +34,7 @@ int CommandBlockEntity::performCommand(Level* level) { std::string CommandBlockEntity::getName() { return name; } -void CommandBlockEntity::setName(const std::string& name) { - this->name = name; -} +void CommandBlockEntity::setName(const std::string& name) { this->name = name; } void CommandBlockEntity::sendMessage(const std::string& message, ChatPacket::EChatPacketMessage type, diff --git a/targets/minecraft/world/level/tile/entity/DispenserTileEntity.cpp b/targets/minecraft/world/level/tile/entity/DispenserTileEntity.cpp index b8a62f988..e62efb43a 100644 --- a/targets/minecraft/world/level/tile/entity/DispenserTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/DispenserTileEntity.cpp @@ -1,10 +1,10 @@ -#include "minecraft/IGameServices.h" #include "DispenserTileEntity.h" #include #include "TileEntity.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/world/Container.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/item/ItemInstance.h" @@ -124,7 +124,8 @@ int DispenserTileEntity::addItem(std::shared_ptr item) { } std::string DispenserTileEntity::getName() { - return hasCustomName() ? name : gameServices().getString(IDS_TILE_DISPENSER); + return hasCustomName() ? name + : gameServices().getString(IDS_TILE_DISPENSER); } std::string DispenserTileEntity::getCustomName() { diff --git a/targets/minecraft/world/level/tile/entity/DropperTileEntity.cpp b/targets/minecraft/world/level/tile/entity/DropperTileEntity.cpp index 5fce7b32d..9c9df6cf5 100644 --- a/targets/minecraft/world/level/tile/entity/DropperTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/DropperTileEntity.cpp @@ -1,14 +1,15 @@ -#include "minecraft/IGameServices.h" #include "DropperTileEntity.h" #include #include +#include "minecraft/IGameServices.h" #include "minecraft/world/level/tile/entity/TileEntity.h" #include "strings.h" std::string DropperTileEntity::getName() { - return hasCustomName() ? name : gameServices().getString(IDS_CONTAINER_DROPPER); + return hasCustomName() ? name + : gameServices().getString(IDS_CONTAINER_DROPPER); } // 4J Added diff --git a/targets/minecraft/world/level/tile/entity/EnchantmentTableTileEntity.cpp b/targets/minecraft/world/level/tile/entity/EnchantmentTableTileEntity.cpp index 61ad6a322..b59b521b0 100644 --- a/targets/minecraft/world/level/tile/entity/EnchantmentTableTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/EnchantmentTableTileEntity.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "EnchantmentTableTileEntity.h" #include @@ -6,6 +5,7 @@ #include #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/tile/entity/TileEntity.h" diff --git a/targets/minecraft/world/level/tile/entity/FurnaceTileEntity.cpp b/targets/minecraft/world/level/tile/entity/FurnaceTileEntity.cpp index 0e4afcf8e..6fa2f5c61 100644 --- a/targets/minecraft/world/level/tile/entity/FurnaceTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/FurnaceTileEntity.cpp @@ -1,9 +1,9 @@ -#include "minecraft/IGameServices.h" #include "FurnaceTileEntity.h" #include #include "Facing.h" +#include "minecraft/IGameServices.h" #include "minecraft/world/Container.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/item/CoalItem.h" diff --git a/targets/minecraft/world/level/tile/entity/HopperTileEntity.cpp b/targets/minecraft/world/level/tile/entity/HopperTileEntity.cpp index a2aaeb1c2..3f28f6666 100644 --- a/targets/minecraft/world/level/tile/entity/HopperTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/HopperTileEntity.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "HopperTileEntity.h" #include @@ -8,6 +7,7 @@ #include "Facing.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Mth.h" #include "minecraft/world/WorldlyContainer.h" #include "minecraft/world/entity/EntitySelector.h" @@ -109,7 +109,8 @@ void HopperTileEntity::setItem(unsigned int slot, } std::string HopperTileEntity::getName() { - return hasCustomName() ? name : gameServices().getString(IDS_CONTAINER_HOPPER); + return hasCustomName() ? name + : gameServices().getString(IDS_CONTAINER_HOPPER); } std::string HopperTileEntity::getCustomName() { diff --git a/targets/minecraft/world/level/tile/entity/SignTileEntity.cpp b/targets/minecraft/world/level/tile/entity/SignTileEntity.cpp index e117afd61..3ed30663b 100644 --- a/targets/minecraft/world/level/tile/entity/SignTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/SignTileEntity.cpp @@ -32,7 +32,8 @@ SignTileEntity::SignTileEntity() : TileEntity() { SignTileEntity::~SignTileEntity() { // TODO ORBIS_STUBBED; // 4J-PB - we don't need to verify strings anymore - - // PlatformInput.CancelQueuedVerifyStrings([this](STRING_VERIFY_RESPONSE* r) { return handleStringVerify(r); }); + // PlatformInput.CancelQueuedVerifyStrings([this](STRING_VERIFY_RESPONSE* r) + // { return handleStringVerify(r); }); } void SignTileEntity::save(CompoundTag* tag) { @@ -121,7 +122,8 @@ sizeof(char)*(MAX_LINE_LENGTH+1)); if(m_wsmessages[i].length()>0) // at this point, we can ask the online string verifier if our sign text is ok #if 0 m_bVerified=true; #else - if(!PlatformInput.VerifyStrings((char**)&wcMessages,MAX_SIGN_LINES,[this](STRING_VERIFY_RESPONSE* r) { return handleStringVerify(r); })) + if(!PlatformInput.VerifyStrings((char**)&wcMessages,MAX_SIGN_LINES,[this](STRING_VERIFY_RESPONSE* +r) { return handleStringVerify(r); })) { // Nothing to verify m_bVerified=true; diff --git a/targets/minecraft/world/level/tile/entity/TheEndPortalTile.cpp b/targets/minecraft/world/level/tile/entity/TheEndPortalTile.cpp index 183cd131d..5b34815b5 100644 --- a/targets/minecraft/world/level/tile/entity/TheEndPortalTile.cpp +++ b/targets/minecraft/world/level/tile/entity/TheEndPortalTile.cpp @@ -2,10 +2,10 @@ #include -#include "minecraft/IGameServices.h" #include "TheEndPortalTileEntity.h" #include "java/Class.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/entity/Entity.h" @@ -64,7 +64,7 @@ void TheEndPortal::entityInside(Level* level, int x, int y, int z, if (entity->riding == nullptr && entity->rider.lock() == nullptr) { if (!level->isClientSide) { - if (entity->instanceof(eTYPE_PLAYER)) { + if (entity->instanceof (eTYPE_PLAYER)) { // 4J Stu - Update the level data position so that the // stronghold portal can be shown on the maps int x, z; diff --git a/targets/minecraft/world/level/tile/entity/TileEntity.cpp b/targets/minecraft/world/level/tile/entity/TileEntity.cpp index 1f13b4f89..47dcaa866 100644 --- a/targets/minecraft/world/level/tile/entity/TileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/TileEntity.cpp @@ -1,9 +1,9 @@ -#include "minecraft/util/Log.h" #include "TileEntity.h" #include #include "PistonPieceTileEntity.h" +#include "minecraft/util/Log.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/tile/JukeboxTile.h" #include "minecraft/world/level/tile/Tile.h" @@ -137,7 +137,7 @@ std::shared_ptr TileEntity::loadStatic(CompoundTag* tag) { } else { #ifdef _DEBUG Log::info("Skipping TileEntity with id %s.\n", - tag->getString("id").c_str()); + tag->getString("id").c_str()); #endif } diff --git a/targets/minecraft/world/scores/PlayerTeam.cpp b/targets/minecraft/world/scores/PlayerTeam.cpp index c23229712..4270cb479 100644 --- a/targets/minecraft/world/scores/PlayerTeam.cpp +++ b/targets/minecraft/world/scores/PlayerTeam.cpp @@ -55,8 +55,7 @@ std::string PlayerTeam::formatNameForTeam(PlayerTeam* team) { return formatNameForTeam(team, team->getDisplayName()); } -std::string PlayerTeam::formatNameForTeam(Team* team, - const std::string& name) { +std::string PlayerTeam::formatNameForTeam(Team* team, const std::string& name) { if (team == nullptr) return name; return team->getFormattedName(name); } diff --git a/targets/minecraft/world/scores/Team.h b/targets/minecraft/world/scores/Team.h index e29ac65c4..7d92bf2bf 100644 --- a/targets/minecraft/world/scores/Team.h +++ b/targets/minecraft/world/scores/Team.h @@ -7,8 +7,7 @@ public: virtual bool isAlliedTo(Team* other); virtual std::string getName() = 0; - virtual std::string getFormattedName( - const std::string& teamMemberName) = 0; + virtual std::string getFormattedName(const std::string& teamMemberName) = 0; virtual bool canSeeFriendlyInvisibles() = 0; virtual bool isAllowFriendlyFire() = 0; }; \ No newline at end of file diff --git a/targets/minecraft/world/scores/criteria/ObjectiveCriteria.h b/targets/minecraft/world/scores/criteria/ObjectiveCriteria.h index 828fbc243..651524d63 100644 --- a/targets/minecraft/world/scores/criteria/ObjectiveCriteria.h +++ b/targets/minecraft/world/scores/criteria/ObjectiveCriteria.h @@ -9,8 +9,7 @@ class Player; class ObjectiveCriteria { public: - static std::unordered_map - CRITERIA_BY_NAME; + static std::unordered_map CRITERIA_BY_NAME; static ObjectiveCriteria* DUMMY; static ObjectiveCriteria* DEATH_COUNT; diff --git a/targets/nbt/include/nbt/IntTag.h b/targets/nbt/include/nbt/IntTag.h index e7aaa2610..5e48fb44e 100644 --- a/targets/nbt/include/nbt/IntTag.h +++ b/targets/nbt/include/nbt/IntTag.h @@ -5,9 +5,7 @@ class IntTag : public Tag { public: int data; IntTag(const std::string& name) : Tag(name) {} - IntTag(const std::string& name, int data) : Tag(name) { - this->data = data; - } + IntTag(const std::string& name, int data) : Tag(name) { this->data = data; } void write(DataOutput* dos) { dos->writeInt(data); } void load(DataInput* dis, int tagDepth) { data = dis->readInt(); } diff --git a/targets/platform/C4JThread.cpp b/targets/platform/C4JThread.cpp index fc793bc93..a0838a2fe 100644 --- a/targets/platform/C4JThread.cpp +++ b/targets/platform/C4JThread.cpp @@ -26,8 +26,8 @@ #include #endif -#include "platform/ShutdownManager.h" #include "platform/C4JThread.h" +#include "platform/ShutdownManager.h" class Level; @@ -563,4 +563,3 @@ void C4JThread::EventQueue::threadPoll() { ShutdownManager::HasFinished(ShutdownManager::eEventQueueThreads); } - diff --git a/targets/platform/PlatformTypes.h b/targets/platform/PlatformTypes.h index 4e78dfc2a..9eda7366a 100644 --- a/targets/platform/PlatformTypes.h +++ b/targets/platform/PlatformTypes.h @@ -23,7 +23,9 @@ struct ImageFileBuffer { ImageFileBuffer& operator=(const ImageFileBuffer&) = delete; [[nodiscard]] EImageType GetType() const { return m_type; } - [[nodiscard]] std::byte* GetBufferPointer() const { return m_pBuffer.get(); } + [[nodiscard]] std::byte* GetBufferPointer() const { + return m_pBuffer.get(); + } [[nodiscard]] std::size_t GetBufferSize() const { return m_bufferSize; } [[nodiscard]] bool Allocated() const { return m_pBuffer != nullptr; } void Release() { @@ -125,11 +127,15 @@ struct XMARKETPLACE_CONTENTOFFER_INFO { using PXMARKETPLACE_CONTENTOFFER_INFO = XMARKETPLACE_CONTENTOFFER_INFO*; inline constexpr std::uint32_t XMARKETPLACE_OFFERING_TYPE_CONTENT = 0x00000002; -inline constexpr std::uint32_t XMARKETPLACE_OFFERING_TYPE_GAME_DEMO = 0x00000020; -inline constexpr std::uint32_t XMARKETPLACE_OFFERING_TYPE_GAME_TRAILER = 0x00000040; +inline constexpr std::uint32_t XMARKETPLACE_OFFERING_TYPE_GAME_DEMO = + 0x00000020; +inline constexpr std::uint32_t XMARKETPLACE_OFFERING_TYPE_GAME_TRAILER = + 0x00000040; inline constexpr std::uint32_t XMARKETPLACE_OFFERING_TYPE_THEME = 0x00000080; inline constexpr std::uint32_t XMARKETPLACE_OFFERING_TYPE_TILE = 0x00000800; inline constexpr std::uint32_t XMARKETPLACE_OFFERING_TYPE_ARCADE = 0x00002000; inline constexpr std::uint32_t XMARKETPLACE_OFFERING_TYPE_VIDEO = 0x00004000; -inline constexpr std::uint32_t XMARKETPLACE_OFFERING_TYPE_CONSUMABLE = 0x00010000; -inline constexpr std::uint32_t XMARKETPLACE_OFFERING_TYPE_AVATARITEM = 0x00100000; +inline constexpr std::uint32_t XMARKETPLACE_OFFERING_TYPE_CONSUMABLE = + 0x00010000; +inline constexpr std::uint32_t XMARKETPLACE_OFFERING_TYPE_AVATARITEM = + 0x00100000; diff --git a/targets/platform/ShutdownManager.cpp b/targets/platform/ShutdownManager.cpp index cd3b82678..ae78d1847 100644 --- a/targets/platform/ShutdownManager.cpp +++ b/targets/platform/ShutdownManager.cpp @@ -1,6 +1,7 @@ // Linux stub implementations for ShutdownManager // The PS3/PSVita versions have full implementations; on Linux these are no-ops. #include "platform/ShutdownManager.h" + #include "platform/C4JThread.h" void ShutdownManager::Initialise() {} diff --git a/targets/platform/fs/IPlatformFilesystem.h b/targets/platform/fs/IPlatformFilesystem.h index 0e0ca3b7d..493af1bc0 100644 --- a/targets/platform/fs/IPlatformFilesystem.h +++ b/targets/platform/fs/IPlatformFilesystem.h @@ -24,9 +24,9 @@ public: virtual ~IPlatformFilesystem() = default; // Read an entire file into a caller-provided buffer. - [[nodiscard]] virtual ReadResult readFile( - const std::filesystem::path& path, void* buffer, - std::size_t capacity) = 0; + [[nodiscard]] virtual ReadResult readFile(const std::filesystem::path& path, + void* buffer, + std::size_t capacity) = 0; // Read a segment of a file. [[nodiscard]] virtual ReadResult readFileSegment( diff --git a/targets/platform/fs/fs.h b/targets/platform/fs/fs.h index cd2640925..65de540ee 100644 --- a/targets/platform/fs/fs.h +++ b/targets/platform/fs/fs.h @@ -4,13 +4,13 @@ // Function accessor backed by a function-local static (Meyers singleton). // Avoids the static-initialization-order fiasco that the previous -// `extern IPlatformFilesystem& PlatformFilesystem;` form had: anything reading PlatformFilesystem -// during another translation unit's static init was UB. +// `extern IPlatformFilesystem& PlatformFilesystem;` form had: anything reading +// PlatformFilesystem during another translation unit's static init was UB. // -// The macro lets the existing call sites keep writing `PlatformFilesystem.foo()` -// without each call site having to add the `()`. The expansion is just -// a call to a function returning a reference, so codegen is unchanged -// once inlined. +// The macro lets the existing call sites keep writing +// `PlatformFilesystem.foo()` without each call site having to add the `()`. The +// expansion is just a call to a function returning a reference, so codegen is +// unchanged once inlined. namespace platform_internal { IPlatformFilesystem& PlatformFilesystem_get(); } diff --git a/targets/platform/fs/std/StdFilesystem.cpp b/targets/platform/fs/std/StdFilesystem.cpp index e813b28d3..84421efde 100644 --- a/targets/platform/fs/std/StdFilesystem.cpp +++ b/targets/platform/fs/std/StdFilesystem.cpp @@ -11,10 +11,10 @@ IPlatformFilesystem& PlatformFilesystem_get() { static StdFilesystem instance; return instance; } -} +} // namespace platform_internal -IPlatformFilesystem::ReadResult StdFilesystem::readFile(const std::filesystem::path& path, - void* buffer, std::size_t capacity) { +IPlatformFilesystem::ReadResult StdFilesystem::readFile( + const std::filesystem::path& path, void* buffer, std::size_t capacity) { std::error_code ec; auto size = std::filesystem::file_size(path, ec); if (ec) return {ReadStatus::NotFound, 0, 0}; @@ -29,9 +29,9 @@ IPlatformFilesystem::ReadResult StdFilesystem::readFile(const std::filesystem::p static_cast(size)}; } -IPlatformFilesystem::ReadResult StdFilesystem::readFileSegment(const std::filesystem::path& path, - std::size_t offset, void* buffer, - std::size_t bytesToRead) { +IPlatformFilesystem::ReadResult StdFilesystem::readFileSegment( + const std::filesystem::path& path, std::size_t offset, void* buffer, + std::size_t bytesToRead) { std::error_code ec; auto size = std::filesystem::file_size(path, ec); if (ec) return {ReadStatus::NotFound, 0, 0}; diff --git a/targets/platform/fs/std/StdFilesystem.h b/targets/platform/fs/std/StdFilesystem.h index 6e494e5e1..bb56ecb20 100644 --- a/targets/platform/fs/std/StdFilesystem.h +++ b/targets/platform/fs/std/StdFilesystem.h @@ -1,10 +1,10 @@ #pragma once -#include "../IPlatformFilesystem.h" - +#include #include #include -#include + +#include "../IPlatformFilesystem.h" // Standard filesystem implementation for desktop platforms. class StdFilesystem : public IPlatformFilesystem { diff --git a/targets/platform/input/IPlatformInput.h b/targets/platform/input/IPlatformInput.h index 506839170..f988975c5 100644 --- a/targets/platform/input/IPlatformInput.h +++ b/targets/platform/input/IPlatformInput.h @@ -2,8 +2,8 @@ #include -#include "PlatformTypes.h" #include "InputConstants.h" +#include "PlatformTypes.h" class IPlatformInput { public: @@ -80,9 +80,8 @@ public: [[nodiscard]] virtual int GetScrollDelta() = 0; // Keyboard - virtual EKeyboardResult RequestKeyboard(const char* Title, - const char* Text, int iPad, - unsigned int uiMaxChars, + virtual EKeyboardResult RequestKeyboard(const char* Title, const char* Text, + int iPad, unsigned int uiMaxChars, std::function callback, EKeyboardMode eMode) = 0; [[nodiscard]] virtual const char* GetText() = 0; diff --git a/targets/platform/input/input.h b/targets/platform/input/input.h index d3f5ec9c8..fbc78a5c8 100644 --- a/targets/platform/input/input.h +++ b/targets/platform/input/input.h @@ -4,8 +4,8 @@ // Function accessor backed by a function-local static (Meyers singleton). // Avoids the static-initialization-order fiasco that the previous -// `extern IPlatformInput& PlatformInput;` form had: anything reading PlatformInput -// during another translation unit's static init was UB. +// `extern IPlatformInput& PlatformInput;` form had: anything reading +// PlatformInput during another translation unit's static init was UB. // // The macro lets the existing call sites keep writing `PlatformInput.foo()` // without each call site having to add the `()`. The expansion is just diff --git a/targets/platform/input/sdl2/SDL2Input.cpp b/targets/platform/input/sdl2/SDL2Input.cpp index 1f56f76bf..ba377ec00 100644 --- a/targets/platform/input/sdl2/SDL2Input.cpp +++ b/targets/platform/input/sdl2/SDL2Input.cpp @@ -17,15 +17,15 @@ #include #include -#include "../InputConstants.h" #include "../../PlatformTypes.h" +#include "../InputConstants.h" namespace platform_internal { IPlatformInput& PlatformInput_get() { static SDL2Input instance; return instance; } -} +} // namespace platform_internal static const int KEY_COUNT = SDL_NUM_SCANCODES; static const int BTN_COUNT = SDL_CONTROLLER_BUTTON_MAX; diff --git a/targets/platform/profile/IPlatformProfile.h b/targets/platform/profile/IPlatformProfile.h index 64ab8591c..fbde8d1fa 100644 --- a/targets/platform/profile/IPlatformProfile.h +++ b/targets/platform/profile/IPlatformProfile.h @@ -35,11 +35,11 @@ public: [[nodiscard]] virtual bool IsSignedIn(int iQuadrant) = 0; [[nodiscard]] virtual bool IsSignedInLive(int iProf) = 0; [[nodiscard]] virtual bool IsGuest(int iQuadrant) = 0; - virtual unsigned int RequestSignInUI( - bool bFromInvite, bool bLocalGame, bool bNoGuestsAllowed, - bool bMultiplayerSignIn, bool bAddUser, - std::function callback, - int iQuadrant = XUSER_INDEX_ANY) = 0; + virtual unsigned int RequestSignInUI(bool bFromInvite, bool bLocalGame, + bool bNoGuestsAllowed, + bool bMultiplayerSignIn, bool bAddUser, + std::function callback, + int iQuadrant = XUSER_INDEX_ANY) = 0; virtual unsigned int DisplayOfflineProfile( std::function callback, int iQuadrant = XUSER_INDEX_ANY) = 0; @@ -96,8 +96,7 @@ public: unsigned int xuidCount) = 0; virtual void ShowProfileCard(int iPad, PlayerUID targetUid) = 0; [[nodiscard]] virtual bool GetProfileAvatar( - int iPad, - std::function callback) = 0; + int iPad, std::function callback) = 0; virtual void CancelProfileAvatarRequest() = 0; // Achievements diff --git a/targets/platform/profile/ProfileConstants.h b/targets/platform/profile/ProfileConstants.h index 4c90ceab1..db1ab2dbf 100644 --- a/targets/platform/profile/ProfileConstants.h +++ b/targets/platform/profile/ProfileConstants.h @@ -65,7 +65,6 @@ #define MINECRAFT_LANGUAGE_LATINAMERICANSPANISH 0x13 #define MINECRAFT_LANGUAGE_GREEK 0x14 - #define CONTEXT_GAME_STATE 0 #define CONTEXT_GAME_STATE_BLANK 0 #define CONTEXT_GAME_STATE_RIDING_PIG 1 diff --git a/targets/platform/profile/profile.h b/targets/platform/profile/profile.h index d98421bfc..4097e056b 100644 --- a/targets/platform/profile/profile.h +++ b/targets/platform/profile/profile.h @@ -4,8 +4,8 @@ // Function accessor backed by a function-local static (Meyers singleton). // Avoids the static-initialization-order fiasco that the previous -// `extern IPlatformProfile& PlatformProfile;` form had: anything reading PlatformProfile -// during another translation unit's static init was UB. +// `extern IPlatformProfile& PlatformProfile;` form had: anything reading +// PlatformProfile during another translation unit's static init was UB. // // The macro lets the existing call sites keep writing `PlatformProfile.foo()` // without each call site having to add the `()`. The expansion is just diff --git a/targets/platform/profile/stub/StubProfile.cpp b/targets/platform/profile/stub/StubProfile.cpp index c30617f3b..24b660aa2 100644 --- a/targets/platform/profile/stub/StubProfile.cpp +++ b/targets/platform/profile/stub/StubProfile.cpp @@ -12,7 +12,7 @@ IPlatformProfile& PlatformProfile_get() { static StubProfile instance; return instance; } -} +} // namespace platform_internal namespace { constexpr PlayerUID kFakeXuidBase = 0xe000d45248242f2eULL; @@ -194,9 +194,5 @@ bool StubProfile::CanViewPlayerCreatedContent(int, bool, PlayerUID*, // GetPrimaryPad/SetPrimaryPad — delegates to PlatformPlatft. // Kept here temporarily for call sites that still use PlatformPlatfore. // These forward to the canonical copies in SDL2Input. -int StubProfile::GetPrimaryPad() { - return PlatformInput.GetPrimaryPad(); -} -void StubProfile::SetPrimaryPad(int iPad) { - PlatformInput.SetPrimaryPad(iPad); -} +int StubProfile::GetPrimaryPad() { return PlatformInput.GetPrimaryPad(); } +void StubProfile::SetPrimaryPad(int iPad) { PlatformInput.SetPrimaryPad(iPad); } diff --git a/targets/platform/profile/stub/StubProfile.h b/targets/platform/profile/stub/StubProfile.h index ba04e8a5f..72d5a865f 100644 --- a/targets/platform/profile/stub/StubProfile.h +++ b/targets/platform/profile/stub/StubProfile.h @@ -4,9 +4,8 @@ #include #include -#include "PlatformTypes.h" - #include "../IPlatformProfile.h" +#include "PlatformTypes.h" class StubProfile : public IPlatformProfile { public: @@ -61,7 +60,8 @@ public: } void SetPrimaryPlayerChanged(bool) {} void ShowProfileCard(int, PlayerUID) {} - bool GetProfileAvatar(int, std::function) { + bool GetProfileAvatar(int, + std::function) { return false; } void CancelProfileAvatarRequest() {} diff --git a/targets/platform/renderer/gl/GLRenderer.cpp b/targets/platform/renderer/gl/GLRenderer.cpp index 96b5474da..13e97877a 100644 --- a/targets/platform/renderer/gl/GLRenderer.cpp +++ b/targets/platform/renderer/gl/GLRenderer.cpp @@ -1,16 +1,15 @@ #include "GLRenderer.h" -#include "renderer/renderer.h" #include "PlatformTypes.h" #include "SDL.h" #include "SDL_error.h" #include "SDL_events.h" #include "SDL_stdinc.h" #include "SDL_video.h" - #include "java/ByteBuffer.h" #include "java/FloatBuffer.h" #include "java/IntBuffer.h" +#include "renderer/renderer.h" // undefine macros from header to avoid argument mismatch #undef glGenTextures @@ -60,7 +59,7 @@ IPlatformRenderer& PlatformRenderer_get() { static GLRenderer instance; return instance; } -} +} // namespace platform_internal // MARK: Shaders @@ -389,8 +388,8 @@ static void glShadowSetDepthTest(bool e) { } static void glShadowSetBlendFunc(GLint s, GLint d) { - if (!(s_gl_shadow_mask & SHADOW_BLEND_FUNC) || - s_gl_state.blendSrc != s || s_gl_state.blendDst != d) { + if (!(s_gl_shadow_mask & SHADOW_BLEND_FUNC) || s_gl_state.blendSrc != s || + s_gl_state.blendDst != d) { ::glBlendFunc(s, d); s_gl_state.blendSrc = s; s_gl_state.blendDst = d; @@ -399,8 +398,7 @@ static void glShadowSetBlendFunc(GLint s, GLint d) { } static void glShadowSetDepthMask(GLboolean e) { - if (!(s_gl_shadow_mask & SHADOW_DEPTH_MASK) || - s_gl_state.depthMask != e) { + if (!(s_gl_shadow_mask & SHADOW_DEPTH_MASK) || s_gl_state.depthMask != e) { ::glDepthMask(e); s_gl_state.depthMask = e; s_gl_shadow_mask |= SHADOW_DEPTH_MASK; @@ -511,8 +509,7 @@ static void pushRenderState() { glUniform1f(s_shader.uFogStart, s_rs.fogStart); glUniform1f(s_shader.uFogEnd, s_rs.fogEnd); glUniform1f(s_shader.uFogDensity, s_rs.fogDensity); - glUniform4fv(s_shader.uFogColor, 1, - glm::value_ptr(s_rs.fogColor)); + glUniform4fv(s_shader.uFogColor, 1, glm::value_ptr(s_rs.fogColor)); glUniform1i(s_shader.uFogEnable, s_rs.fogEnable ? 1 : 0); } if (s_rs_dirty_mask & DIRTY_TEXTURE) { @@ -524,11 +521,9 @@ static void pushRenderState() { if (s_rs_dirty_mask & DIRTY_GAMMA) glUniform1f(s_shader.uInvGamma, 1.0f / s_rs.gamma); if (s_rs_dirty_mask & DIRTY_LMT) - glUniform4fv(s_shader.uLMTransform, 1, - glm::value_ptr(s_rs.lmt)); + glUniform4fv(s_shader.uLMTransform, 1, glm::value_ptr(s_rs.lmt)); if (s_rs_dirty_mask & DIRTY_GLOBAL_LM) - glUniform2fv(s_shader.uGlobalLM, 1, - glm::value_ptr(s_rs.globalLM)); + glUniform2fv(s_shader.uGlobalLM, 1, glm::value_ptr(s_rs.globalLM)); s_rs_dirty_mask = 0; } flushMatrices(); @@ -817,7 +812,7 @@ void GLRenderer::Shutdown() { } void GLRenderer::DrawVertices(ePrimitiveType ptype, int count, void* dataIn, - eVertexType vType, ePixelShaderType) { + eVertexType vType, ePixelShaderType) { if (count <= 0 || !dataIn) return; bool wasQuad = isQuadPrim((int)ptype); @@ -1081,7 +1076,7 @@ void GLRenderer::MatrixPerspective(float fovy, float asp, float zn, float zf) { markMatrixDirty(); } void GLRenderer::MatrixOrthogonal(float l, float r, float b, float t, float zn, - float zf) { + float zf) { s_proj.cur() = glm::ortho(l, r, b, t, zn, zf); markMatrixDirty(); } @@ -1104,7 +1099,7 @@ void GLRenderer::Set_matrixDirty() { s_boundProgram = 0; s_rs_dirty_mask = 0xFFFFFFFF; s_gl_shadow_mask = 0; - s_normalMatDirty = true; // normal matrix dirt after iggy reset + s_normalMatDirty = true; // normal matrix dirt after iggy reset s_matDirty = true; s_chunkOffsetValid = false; if (s_shader.prog) { @@ -1141,9 +1136,7 @@ void GLRenderer::StateSetDepthMask(bool e) { glShadowSetDepthMask(e ? GL_TRUE : GL_FALSE); } void GLRenderer::StateSetBlendEnable(bool e) { glShadowSetBlend(e); } -void GLRenderer::StateSetBlendFunc(int s, int d) { - glShadowSetBlendFunc(s, d); -} +void GLRenderer::StateSetBlendFunc(int s, int d) { glShadowSetBlendFunc(s, d); } void GLRenderer::StateSetDepthFunc(int f) { ::glDepthFunc(f); } void GLRenderer::StateSetFaceCull(bool e) { glShadowSetCull(e); } void GLRenderer::StateSetFaceCullCW(bool e) { @@ -1190,7 +1183,10 @@ void GLRenderer::StateSetFogEnable(bool e) { } } void GLRenderer::StateSetFogMode(int mode) { - int v = (mode == GL_LINEAR) ? 1 : (mode == GL_EXP) ? 2 : (mode == 0x0801) ? 3 : 0; + int v = (mode == GL_LINEAR) ? 1 + : (mode == GL_EXP) ? 2 + : (mode == 0x0801) ? 3 + : 0; if (s_rs.fogMode != v) { s_rs.fogMode = v; markDirty(DIRTY_FOG); @@ -1266,7 +1262,7 @@ void GLRenderer::StateSetVertexTextureUV(float u, float v) { } } void GLRenderer::StateSetStencil(int fn, uint8_t ref, uint8_t fmask, - uint8_t wmask) { + uint8_t wmask) { glShadowSetStencil(fn, ref, fmask, wmask); } void GLRenderer::StateSetTextureEnable(bool e) { @@ -1312,9 +1308,9 @@ void GLRenderer::TextureBindVertex(int idx, bool scaleLight) { s_rs.useLightmap = true; markDirty(DIRTY_TEXTURE); } - glm::vec4 newLmt = - scaleLight ? glm::vec4{1.f, 1.f, 8.f / 256.f, 8.f / 256.f} - : glm::vec4{1.f, 1.f, 0.f, 0.f}; + glm::vec4 newLmt = scaleLight + ? glm::vec4{1.f, 1.f, 8.f / 256.f, 8.f / 256.f} + : glm::vec4{1.f, 1.f, 0.f, 0.f}; if (s_rs.lmt != newLmt) { s_rs.lmt = newLmt; markDirty(DIRTY_LMT); @@ -1341,7 +1337,7 @@ void GLRenderer::TextureData(int w, int h, void* d, int lvl, eTextureFormat) { } } void GLRenderer::TextureDataUpdate(int xo, int yo, int w, int h, void* d, - int lvl) { + int lvl) { glTexSubImage2D(GL_TEXTURE_2D, lvl, xo, yo, w, h, GL_RGBA, GL_UNSIGNED_BYTE, d); } @@ -1373,7 +1369,7 @@ int GLRenderer::LoadTextureData(const char* fn, D3DXIMAGE_INFO* i, int** o) { return hr; } int GLRenderer::LoadTextureData(uint8_t* pb, uint32_t nb, D3DXIMAGE_INFO* i, - int** o) { + int** o) { int w, h, c; unsigned char* d = stbi_load_from_memory(pb, (int)nb, &w, &h, &c, 4); if (!d) return -1; // Failure @@ -1462,19 +1458,19 @@ void glFogfv(GLenum pname, const GLfloat* params) { } void glLightfv(GLenum light, GLenum pname, const GLfloat* params) { if (pname == 0x1203) - PlatformRenderer.StateSetLightDirection(light == 0x4000 ? 0 : 1, params[0], - params[1], params[2]); + PlatformRenderer.StateSetLightDirection( + light == 0x4000 ? 0 : 1, params[0], params[1], params[2]); else if (pname == 0x1200) PlatformRenderer.StateSetLightAmbientColour(params[0], params[1], - params[2]); + params[2]); else if (pname == 0x1201) PlatformRenderer.StateSetLightColour(light == 0x4000 ? 0 : 1, params[0], - params[1], params[2]); + params[1], params[2]); } void glLightModelfv(GLenum pname, const GLfloat* params) { if (pname == 0x0B53) PlatformRenderer.StateSetLightAmbientColour(params[0], params[1], - params[2]); + params[2]); } void glShadeModel(GLenum) {} void glColorMaterial(GLenum, GLenum) {} @@ -1528,7 +1524,7 @@ void glTexImage2D_4J(int target, int level, int internalformat, int width, (void)format; (void)type; PlatformRenderer.TextureData(width, height, getBytePtr(pixels), level, - IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw); + IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw); } void glLight_4J(int light, int pname, FloatBuffer* params) { diff --git a/targets/platform/renderer/gl/GLRenderer.h b/targets/platform/renderer/gl/GLRenderer.h index e4d3f7b86..98f395eeb 100644 --- a/targets/platform/renderer/gl/GLRenderer.h +++ b/targets/platform/renderer/gl/GLRenderer.h @@ -152,4 +152,3 @@ public: void Close(); void Shutdown(); }; - diff --git a/targets/platform/renderer/gl/gl_compat.h b/targets/platform/renderer/gl/gl_compat.h index f7c84e535..280fef444 100644 --- a/targets/platform/renderer/gl/gl_compat.h +++ b/targets/platform/renderer/gl/gl_compat.h @@ -284,75 +284,75 @@ #endif #undef glTranslatef -#define glTranslatef(x, y, z) \ - do { \ +#define glTranslatef(x, y, z) \ + do { \ PlatformRenderer.MatrixTranslate(x, y, z); \ } while (0) #undef glRotatef -#define glRotatef(a, x, y, z) \ - do { \ +#define glRotatef(a, x, y, z) \ + do { \ PlatformRenderer.MatrixRotate((a) * (3.14159265358979f / 180.f), x, y, \ - z); \ + z); \ } while (0) #undef glScalef -#define glScalef(x, y, z) \ - do { \ +#define glScalef(x, y, z) \ + do { \ PlatformRenderer.MatrixScale(x, y, z); \ } while (0) #undef glScaled -#define glScaled(x, y, z) \ - do { \ +#define glScaled(x, y, z) \ + do { \ PlatformRenderer.MatrixScale((float)(x), (float)(y), (float)(z)); \ } while (0) #undef glPushMatrix -#define glPushMatrix() \ - do { \ +#define glPushMatrix() \ + do { \ PlatformRenderer.MatrixPush(); \ } while (0) #undef glPopMatrix -#define glPopMatrix() \ - do { \ +#define glPopMatrix() \ + do { \ PlatformRenderer.MatrixPop(); \ } while (0) #undef glLoadIdentity -#define glLoadIdentity() \ - do { \ +#define glLoadIdentity() \ + do { \ PlatformRenderer.MatrixSetIdentity(); \ } while (0) #undef glMatrixMode -#define glMatrixMode(mode) \ - do { \ +#define glMatrixMode(mode) \ + do { \ PlatformRenderer.MatrixMode(mode); \ } while (0) #undef glMultMatrixf -#define glMultMatrixf(m) \ - do { \ +#define glMultMatrixf(m) \ + do { \ PlatformRenderer.MatrixMult(m); \ } while (0) #undef glColor4f -#define glColor4f(r, g, b, a) \ - do { \ +#define glColor4f(r, g, b, a) \ + do { \ PlatformRenderer.StateSetColour(r, g, b, a); \ } while (0) #undef glColor3f -#define glColor3f(r, g, b) \ - do { \ +#define glColor3f(r, g, b) \ + do { \ PlatformRenderer.StateSetColour(r, g, b, 1.0f); \ } while (0) #undef glAlphaFunc -#define glAlphaFunc(func, ref) \ - do { \ +#define glAlphaFunc(func, ref) \ + do { \ PlatformRenderer.StateSetAlphaFunc(func, ref); \ } while (0) @@ -360,23 +360,23 @@ #define glEnable(cap) \ do { \ if ((cap) == 0x0B60 /*GL_FOG*/) \ - PlatformRenderer.StateSetFogEnable(true); \ + PlatformRenderer.StateSetFogEnable(true); \ else if ((cap) == 0x0B50 /*GL_LIGHTING*/) \ - PlatformRenderer.StateSetLightingEnable(true); \ + PlatformRenderer.StateSetLightingEnable(true); \ else if ((cap) == 0x0BC0 /*GL_ALPHA_TEST*/) \ - PlatformRenderer.StateSetAlphaTestEnable(true); \ + PlatformRenderer.StateSetAlphaTestEnable(true); \ else if ((cap) == 0x0DE1 /*GL_TEXTURE_2D*/) \ - PlatformRenderer.StateSetTextureEnable(true); \ + PlatformRenderer.StateSetTextureEnable(true); \ else if ((cap) == 0x0BE2 /*GL_BLEND*/) \ - PlatformRenderer.StateSetBlendEnable(true); \ + PlatformRenderer.StateSetBlendEnable(true); \ else if ((cap) == 0x0B44 /*GL_CULL_FACE*/) \ - PlatformRenderer.StateSetFaceCull(true); \ + PlatformRenderer.StateSetFaceCull(true); \ else if ((cap) == 0x0B71 /*GL_DEPTH_TEST*/) \ - PlatformRenderer.StateSetDepthTestEnable(true); \ + PlatformRenderer.StateSetDepthTestEnable(true); \ else if ((cap) == 0x4000 /*GL_LIGHT0*/) \ - PlatformRenderer.StateSetLightEnable(0, true); \ + PlatformRenderer.StateSetLightEnable(0, true); \ else if ((cap) == 0x4001 /*GL_LIGHT1*/) \ - PlatformRenderer.StateSetLightEnable(1, true); \ + PlatformRenderer.StateSetLightEnable(1, true); \ else if ((cap) == 0x0B57 /*GL_COLOR_MATERIAL*/ \ || (cap) == 0x0BA1 /*GL_NORMALIZE*/ \ || (cap) == 0x803A /*GL_RESCALE_NORMAL*/ \ @@ -392,23 +392,23 @@ #define glDisable(cap) \ do { \ if ((cap) == 0x0B60 /*GL_FOG*/) \ - PlatformRenderer.StateSetFogEnable(false); \ + PlatformRenderer.StateSetFogEnable(false); \ else if ((cap) == 0x0B50 /*GL_LIGHTING*/) \ - PlatformRenderer.StateSetLightingEnable(false); \ + PlatformRenderer.StateSetLightingEnable(false); \ else if ((cap) == 0x0BC0 /*GL_ALPHA_TEST*/) \ - PlatformRenderer.StateSetAlphaTestEnable(false); \ + PlatformRenderer.StateSetAlphaTestEnable(false); \ else if ((cap) == 0x0DE1 /*GL_TEXTURE_2D*/) \ - PlatformRenderer.StateSetTextureEnable(false); \ + PlatformRenderer.StateSetTextureEnable(false); \ else if ((cap) == 0x0BE2 /*GL_BLEND*/) \ - PlatformRenderer.StateSetBlendEnable(false); \ + PlatformRenderer.StateSetBlendEnable(false); \ else if ((cap) == 0x0B44 /*GL_CULL_FACE*/) \ - PlatformRenderer.StateSetFaceCull(false); \ + PlatformRenderer.StateSetFaceCull(false); \ else if ((cap) == 0x0B71 /*GL_DEPTH_TEST*/) \ - PlatformRenderer.StateSetDepthTestEnable(false); \ + PlatformRenderer.StateSetDepthTestEnable(false); \ else if ((cap) == 0x4000 /*GL_LIGHT0*/) \ - PlatformRenderer.StateSetLightEnable(0, false); \ + PlatformRenderer.StateSetLightEnable(0, false); \ else if ((cap) == 0x4001 /*GL_LIGHT1*/) \ - PlatformRenderer.StateSetLightEnable(1, false); \ + PlatformRenderer.StateSetLightEnable(1, false); \ else if ((cap) == 0x0B57 /*GL_COLOR_MATERIAL*/ \ || (cap) == 0x0BA1 /*GL_NORMALIZE*/ \ || (cap) == 0x803A /*GL_RESCALE_NORMAL*/ \ @@ -421,46 +421,47 @@ } while (0) #undef glFogi -#define glFogi(pname, param) \ - do { \ - if ((pname) == 0x0B65 /*GL_FOG_MODE*/) \ +#define glFogi(pname, param) \ + do { \ + if ((pname) == 0x0B65 /*GL_FOG_MODE*/) \ PlatformRenderer.StateSetFogMode(param); \ } while (0) #undef glFogf -#define glFogf(pname, param) \ - do { \ - if ((pname) == 0x0B63 /*GL_FOG_START*/) \ +#define glFogf(pname, param) \ + do { \ + if ((pname) == 0x0B63 /*GL_FOG_START*/) \ PlatformRenderer.StateSetFogNearDistance(param); \ - else if ((pname) == 0x0B64 /*GL_FOG_END*/) \ + else if ((pname) == 0x0B64 /*GL_FOG_END*/) \ PlatformRenderer.StateSetFogFarDistance(param); \ - else if ((pname) == 0x0B62 /*GL_FOG_DENSITY*/) \ + else if ((pname) == 0x0B62 /*GL_FOG_DENSITY*/) \ PlatformRenderer.StateSetFogDensity(param); \ } while (0) #undef glOrtho -#define glOrtho(left, right, bottom, top, zNear, zFar) \ - do { \ - PlatformRenderer.MatrixOrthogonal(left, right, bottom, top, zNear, zFar); \ +#define glOrtho(left, right, bottom, top, zNear, zFar) \ + do { \ + PlatformRenderer.MatrixOrthogonal(left, right, bottom, top, zNear, \ + zFar); \ } while (0) #undef glMultiTexCoord2f -#define glMultiTexCoord2f(tex, u, v) \ - do { \ - if ((tex) == 0x84C1 /*GL_TEXTURE1*/) \ +#define glMultiTexCoord2f(tex, u, v) \ + do { \ + if ((tex) == 0x84C1 /*GL_TEXTURE1*/) \ PlatformRenderer.StateSetVertexTextureUV(u, v); \ } while (0) #undef glActiveTexture -#define glActiveTexture(tex) \ - do { \ +#define glActiveTexture(tex) \ + do { \ PlatformRenderer.StateSetActiveTexture(tex); \ - ::glActiveTexture(tex); \ + ::glActiveTexture(tex); \ } while (0) #undef glClientActiveTexture -#define glClientActiveTexture(tex) \ - do { \ +#define glClientActiveTexture(tex) \ + do { \ PlatformRenderer.StateSetActiveTexture(tex); \ } while (0) @@ -542,12 +543,12 @@ inline void glLight_4J(int light, int pname, T* params) { float* p = params->_getDataPointer(); if (pname == 0x1203 /* GL_POSITION */) PlatformRenderer.StateSetLightDirection(light == 0x4000 ? 0 : 1, p[0], - p[1], p[2]); + p[1], p[2]); else if (pname == 0x1200 /* GL_AMBIENT */) PlatformRenderer.StateSetLightAmbientColour(p[0], p[1], p[2]); else if (pname == 0x1201 /* GL_DIFFUSE */) - PlatformRenderer.StateSetLightColour(light == 0x4000 ? 0 : 1, p[0], p[1], - p[2]); + PlatformRenderer.StateSetLightColour(light == 0x4000 ? 0 : 1, p[0], + p[1], p[2]); } template inline void glLightModel_4J(int pname, T* params) { diff --git a/targets/platform/renderer/gl/render_stubs.cpp b/targets/platform/renderer/gl/render_stubs.cpp index b4dc08d4b..531ee9f05 100644 --- a/targets/platform/renderer/gl/render_stubs.cpp +++ b/targets/platform/renderer/gl/render_stubs.cpp @@ -19,7 +19,9 @@ void GLRenderer::TextureDynamicUpdateEnd() {} void GLRenderer::TextureGetStats() {} void* GLRenderer::TextureGetTexture(int) { return nullptr; } -int GLRenderer::SaveTextureData(const char*, D3DXIMAGE_INFO*, int*) { return 0; } +int GLRenderer::SaveTextureData(const char*, D3DXIMAGE_INFO*, int*) { + return 0; +} int GLRenderer::SaveTextureDataToMemory(void*, int, int*, int, int, int*) { return 0; } diff --git a/targets/platform/renderer/renderer.h b/targets/platform/renderer/renderer.h index aaf9dd4fc..d6588cfdb 100644 --- a/targets/platform/renderer/renderer.h +++ b/targets/platform/renderer/renderer.h @@ -4,8 +4,8 @@ // Function accessor backed by a function-local static (Meyers singleton). // Avoids the static-initialization-order fiasco that the previous -// `extern IPlatformRenderer& PlatformRenderer;` form had: anything reading PlatformRenderer -// during another translation unit's static init was UB. +// `extern IPlatformRenderer& PlatformRenderer;` form had: anything reading +// PlatformRenderer during another translation unit's static init was UB. // // The macro lets the existing call sites keep writing `PlatformRenderer.foo()` // without each call site having to add the `()`. The expansion is just diff --git a/targets/platform/sound/IPlatformSound.h b/targets/platform/sound/IPlatformSound.h index 7541dc967..5fb3ad171 100644 --- a/targets/platform/sound/IPlatformSound.h +++ b/targets/platform/sound/IPlatformSound.h @@ -24,10 +24,10 @@ struct PlaySoundParams { float z = 0.0f; float volume = 1.0f; float pitch = 1.0f; - bool spatial = true; // 3D sound positioned in the world + bool spatial = true; // 3D sound positioned in the world bool looping = false; - float minDistance = 1.0f; // distance below which the sound is full-volume - float maxDistance = 16.0f; // distance above which the sound is silent + float minDistance = 1.0f; // distance below which the sound is full-volume + float maxDistance = 16.0f; // distance above which the sound is silent }; struct PlayMusicParams { diff --git a/targets/platform/sound/miniaudio/MiniaudioSound.cpp b/targets/platform/sound/miniaudio/MiniaudioSound.cpp index 5aa8c3424..dd9c6ba41 100644 --- a/targets/platform/sound/miniaudio/MiniaudioSound.cpp +++ b/targets/platform/sound/miniaudio/MiniaudioSound.cpp @@ -4,7 +4,6 @@ #include #include "miniaudio.h" - #include "platform/sound/sound.h" namespace platform::sound::miniaudio { @@ -81,8 +80,7 @@ void MiniaudioSound::tick() { // game's music system. for (auto it = m_state->sounds.begin(); it != m_state->sounds.end();) { auto& voice = it->second; - if (voice && voice->inUse && - !ma_sound_is_playing(&voice->sound) && + if (voice && voice->inUse && !ma_sound_is_playing(&voice->sound) && !ma_sound_is_looping(&voice->sound)) { ma_sound_uninit(&voice->sound); voice->inUse = false; @@ -209,15 +207,13 @@ bool MiniaudioSound::isMusicPlaying(MusicHandle handle) const { void MiniaudioSound::setMusicVolume(MusicHandle handle, float volume) { auto it = m_state->music.find(handle.id); - if (it == m_state->music.end() || !it->second || !it->second->inUse) - return; + if (it == m_state->music.end() || !it->second || !it->second->inUse) return; ma_sound_set_volume(&it->second->sound, volume); } void MiniaudioSound::setMusicPitch(MusicHandle handle, float pitch) { auto it = m_state->music.find(handle.id); - if (it == m_state->music.end() || !it->second || !it->second->inUse) - return; + if (it == m_state->music.end() || !it->second || !it->second->inUse) return; ma_sound_set_pitch(&it->second->sound, pitch); } @@ -234,9 +230,8 @@ void MiniaudioSound::releaseMusic(MusicHandle handle) { void MiniaudioSound::setListenerPosition(int listenerIndex, float x, float y, float z) { if (!m_state->engineReady) return; - ma_engine_listener_set_position(&m_state->engine, - static_cast(listenerIndex), x, - y, z); + ma_engine_listener_set_position( + &m_state->engine, static_cast(listenerIndex), x, y, z); } void MiniaudioSound::setListenerOrientation(int listenerIndex, float forwardX, @@ -246,9 +241,8 @@ void MiniaudioSound::setListenerOrientation(int listenerIndex, float forwardX, ma_engine_listener_set_direction(&m_state->engine, static_cast(listenerIndex), forwardX, forwardY, forwardZ); - ma_engine_listener_set_world_up(&m_state->engine, - static_cast(listenerIndex), - upX, upY, upZ); + ma_engine_listener_set_world_up( + &m_state->engine, static_cast(listenerIndex), upX, upY, upZ); } } // namespace platform::sound::miniaudio diff --git a/targets/platform/storage/IPlatformStorage.h b/targets/platform/storage/IPlatformStorage.h index e65b86211..d7de03761 100644 --- a/targets/platform/storage/IPlatformStorage.h +++ b/targets/platform/storage/IPlatformStorage.h @@ -36,8 +36,6 @@ using PSAVE_DETAILS = SAVE_DETAILS*; class C4JStringTable; - - class IPlatformStorage { public: // Enums live here so both the interface consumer and the concrete @@ -198,9 +196,10 @@ public: unsigned int textDataBytes) = 0; virtual ESaveGameState SaveSaveData( std::function callback) = 0; - virtual void CopySaveDataToNewSave( - std::uint8_t* pbThumbnail, unsigned int cbThumbnail, - char* wchNewName, std::function callback) = 0; + virtual void CopySaveDataToNewSave(std::uint8_t* pbThumbnail, + unsigned int cbThumbnail, + char* wchNewName, + std::function callback) = 0; virtual ESaveGameState DoesSaveExist(bool* pbExists) = 0; virtual bool EnoughSpaceForAMinSaveGame() = 0; virtual void SetSaveMessageVPosition(float fY) = 0; @@ -211,10 +210,9 @@ public: virtual PSAVE_DETAILS ReturnSavesInfo() = 0; virtual void ClearSavesInfo() = 0; virtual ESaveGameState LoadSaveDataThumbnail( - PSAVE_INFO pSaveInfo, - std::function - callback) = 0; + PSAVE_INFO pSaveInfo, std::function + callback) = 0; virtual void GetSaveCacheFileInfo(unsigned int fileIndex, XCONTENT_DATA& xContentData) = 0; virtual void GetSaveCacheFileInfo(unsigned int fileIndex, @@ -224,16 +222,14 @@ public: PSAVE_INFO pSaveInfo, std::function callback) = 0; virtual ESaveGameState DeleteSaveData( - PSAVE_INFO pSaveInfo, - std::function callback) = 0; + PSAVE_INFO pSaveInfo, std::function callback) = 0; // DLC virtual void RegisterMarketplaceCountsCallback( std::function callback) = 0; virtual void SetDLCPackageRoot(char* pszDLCRoot) = 0; virtual EDLCStatus GetDLCOffers( - int iPad, - std::function callback, + int iPad, std::function callback, std::uint32_t dwOfferTypesBitmask = XMARKETPLACE_OFFERING_TYPE_CONTENT) = 0; virtual unsigned int CancelGetDLCOffers() = 0; @@ -260,8 +256,7 @@ public: // Title storage virtual ETMSStatus ReadTMSFile( int iQuadrant, eGlobalStorage eStorageFacility, eTMS_FileType eFileType, - char* pwchFilename, std::uint8_t** ppBuffer, - unsigned int* pBufferSize, + char* pwchFilename, std::uint8_t** ppBuffer, unsigned int* pBufferSize, std::function callback = nullptr, int iAction = 0) = 0; virtual bool WriteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility, diff --git a/targets/platform/storage/storage.h b/targets/platform/storage/storage.h index 177050af8..624af2ddb 100644 --- a/targets/platform/storage/storage.h +++ b/targets/platform/storage/storage.h @@ -4,8 +4,8 @@ // Function accessor backed by a function-local static (Meyers singleton). // Avoids the static-initialization-order fiasco that the previous -// `extern IPlatformStorage& PlatformStorage;` form had: anything reading PlatformStorage -// during another translation unit's static init was UB. +// `extern IPlatformStorage& PlatformStorage;` form had: anything reading +// PlatformStorage during another translation unit's static init was UB. // // The macro lets the existing call sites keep writing `PlatformStorage.foo()` // without each call site having to add the `()`. The expansion is just diff --git a/targets/platform/storage/stub/StubStorage.cpp b/targets/platform/storage/stub/StubStorage.cpp index 748b2e2b4..8d6518e5c 100644 --- a/targets/platform/storage/stub/StubStorage.cpp +++ b/targets/platform/storage/stub/StubStorage.cpp @@ -11,7 +11,7 @@ IPlatformStorage& PlatformStorage_get() { static StubStorage instance; return instance; } -} +} // namespace platform_internal static XMARKETPLACE_CONTENTOFFER_INFO s_dummyOffer = {}; static XCONTENT_DATA s_dummyContentData = {}; @@ -34,15 +34,15 @@ StubStorage::EMessageResult StubStorage::GetMessageBoxResult() { } bool StubStorage::SetSaveDevice(std::function callback, - bool bForceResetOfSaveDevice) { + bool bForceResetOfSaveDevice) { return true; } void StubStorage::Init(unsigned int uiSaveVersion, - const char* pwchDefaultSaveName, char* pszSavePackName, - int iMinimumSaveSize, - std::function callback, - const char* szGroupID) {} + const char* pwchDefaultSaveName, char* pszSavePackName, + int iMinimumSaveSize, + std::function callback, + const char* szGroupID) {} void StubStorage::ResetSaveData() {} void StubStorage::SetDefaultSaveNameForKeyboardDisplay( const char* pwchDefaultSaveName) {} @@ -57,7 +57,7 @@ bool StubStorage::GetSaveUniqueFilename(char* pszName) { } void StubStorage::SetSaveUniqueFilename(char* szFilename) {} void StubStorage::SetState(ESaveGameControlState eControlState, - std::function callback) {} + std::function callback) {} void StubStorage::SetSaveDisabled(bool bDisable) {} bool StubStorage::GetSaveDisabled(void) { return false; } unsigned int StubStorage::GetSaveSize() { return 0; } @@ -68,18 +68,18 @@ void* StubStorage::AllocateSaveData(unsigned int uiBytes) { return malloc(uiBytes); } void StubStorage::SetSaveImages(std::uint8_t* pbThumbnail, - unsigned int thumbnailBytes, - std::uint8_t* pbImage, unsigned int imageBytes, - std::uint8_t* pbTextData, - unsigned int textDataBytes) {} + unsigned int thumbnailBytes, + std::uint8_t* pbImage, unsigned int imageBytes, + std::uint8_t* pbTextData, + unsigned int textDataBytes) {} StubStorage::ESaveGameState StubStorage::SaveSaveData( std::function callback) { return ESaveGame_Idle; } void StubStorage::CopySaveDataToNewSave(std::uint8_t* pbThumbnail, - unsigned int cbThumbnail, - char* wchNewName, - std::function callback) {} + unsigned int cbThumbnail, + char* wchNewName, + std::function callback) {} void StubStorage::SetSaveDeviceSelected(unsigned int uiPad, bool bSelected) {} bool StubStorage::GetSaveDeviceSelected(unsigned int iPad) { return true; } StubStorage::ESaveGameState StubStorage::DoesSaveExist(bool* pbExists) { @@ -98,29 +98,26 @@ PSAVE_DETAILS StubStorage::ReturnSavesInfo() { return nullptr; } void StubStorage::ClearSavesInfo() {} StubStorage::ESaveGameState StubStorage::LoadSaveDataThumbnail( PSAVE_INFO pSaveInfo, - std::function + std::function callback) { return ESaveGame_Idle; } void StubStorage::GetSaveCacheFileInfo(unsigned int fileIndex, - XCONTENT_DATA& xContentData) { + XCONTENT_DATA& xContentData) { memset(&xContentData, 0, sizeof(xContentData)); } void StubStorage::GetSaveCacheFileInfo(unsigned int fileIndex, - std::uint8_t** ppbImageData, - unsigned int* pImageBytes) { + std::uint8_t** ppbImageData, + unsigned int* pImageBytes) { if (ppbImageData) *ppbImageData = nullptr; if (pImageBytes) *pImageBytes = 0; } StubStorage::ESaveGameState StubStorage::LoadSaveData( - PSAVE_INFO pSaveInfo, - std::function callback) { + PSAVE_INFO pSaveInfo, std::function callback) { return ESaveGame_Idle; } StubStorage::ESaveGameState StubStorage::DeleteSaveData( - PSAVE_INFO pSaveInfo, - std::function callback) { + PSAVE_INFO pSaveInfo, std::function callback) { return ESaveGame_Idle; } void StubStorage::RegisterMarketplaceCountsCallback( @@ -137,9 +134,10 @@ XMARKETPLACE_CONTENTOFFER_INFO& StubStorage::GetOffer(unsigned int dw) { return s_dummyOffer; } int StubStorage::GetOfferCount() { return 0; } -unsigned int StubStorage::InstallOffer(int iOfferIDC, std::uint64_t* ullOfferIDA, - std::function callback, - bool bTrial) { +unsigned int StubStorage::InstallOffer(int iOfferIDC, + std::uint64_t* ullOfferIDA, + std::function callback, + bool bTrial) { return 0; } unsigned int StubStorage::GetAvailableDLCCount(int iPad) { return 0; } @@ -163,7 +161,7 @@ unsigned int StubStorage::UnmountInstalledDLC(const char* szMountDrive) { return 0; } void StubStorage::GetMountedDLCFileList(const char* szMountDrive, - std::vector& fileList) { + std::vector& fileList) { fileList.clear(); } std::string StubStorage::GetMountedPath(std::string szMount) { return ""; } @@ -175,12 +173,12 @@ StubStorage::ETMSStatus StubStorage::ReadTMSFile( return ETMSStatus_Fail; } bool StubStorage::WriteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility, - char* pwchFilename, std::uint8_t* pBuffer, - unsigned int bufferSize) { + char* pwchFilename, std::uint8_t* pBuffer, + unsigned int bufferSize) { return false; } bool StubStorage::DeleteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility, - char* pwchFilename) { + char* pwchFilename) { return false; } void StubStorage::StoreTMSPathName(char* pwchName) {} @@ -208,7 +206,7 @@ int StubStorage::AddSubfile(int regionIndex) { } unsigned int StubStorage::GetSubfileCount() { return 0; } void StubStorage::GetSubfileDetails(unsigned int i, int* regionIndex, - void** data, unsigned int* size) { + void** data, unsigned int* size) { (void)i; if (regionIndex) *regionIndex = 0; if (data) *data = 0; @@ -223,5 +221,7 @@ void StubStorage::UpdateSubfile(int index, void* data, unsigned int size) { void StubStorage::SaveSubfiles(std::function callback) { if (callback) callback(true); } -StubStorage::ESaveGameState StubStorage::GetSaveState() { return ESaveGame_Idle; } +StubStorage::ESaveGameState StubStorage::GetSaveState() { + return ESaveGame_Idle; +} void StubStorage::ContinueIncompleteOperation() {} diff --git a/targets/platform/storage/stub/StubStorage.h b/targets/platform/storage/stub/StubStorage.h index ce0d57440..813a4d888 100644 --- a/targets/platform/storage/stub/StubStorage.h +++ b/targets/platform/storage/stub/StubStorage.h @@ -7,8 +7,8 @@ #include // #include -#include "PlatformTypes.h" #include "../IPlatformStorage.h" +#include "PlatformTypes.h" class C4JStringTable; @@ -87,8 +87,7 @@ public: const char* szGroupID); void ResetSaveData(); // Call before a new save to clear out stored save // file name - void SetDefaultSaveNameForKeyboardDisplay( - const char* pwchDefaultSaveName); + void SetDefaultSaveNameForKeyboardDisplay(const char* pwchDefaultSaveName); void SetSaveTitle(const char* pwchDefaultSaveName); bool GetSaveUniqueNumber(int* piVal); bool GetSaveUniqueFilename(char* pszName); @@ -145,8 +144,7 @@ public: PSAVE_INFO pSaveInfo, std::function callback); StubStorage::ESaveGameState DeleteSaveData( - PSAVE_INFO pSaveInfo, - std::function callback); + PSAVE_INFO pSaveInfo, std::function callback); // DLC void RegisterMarketplaceCountsCallback( @@ -194,8 +192,9 @@ public: #ifdef _XBOX StubStorage::ETMSStatus WriteTMSFile( int iPad, StubStorage::eGlobalStorage eStorageFacility, - StubStorage::eTMS_FileType eFileType, char* pchFilePath, char* pchBuffer, - unsigned int bufferSize, TMSCLIENT_CALLBACK Func, void* lpParam); + StubStorage::eTMS_FileType eFileType, char* pchFilePath, + char* pchBuffer, unsigned int bufferSize, TMSCLIENT_CALLBACK Func, + void* lpParam); int GetUserQuotaInfo(int iPad, TMSCLIENT_CALLBACK Func, void* lpParam); #endif diff --git a/targets/platform/stubs.h b/targets/platform/stubs.h index bcd243d02..5ef9a019f 100644 --- a/targets/platform/stubs.h +++ b/targets/platform/stubs.h @@ -3,10 +3,11 @@ #include #ifdef __linux__ -#include "renderer/gl/gl_compat.h" #include #include +#include "renderer/gl/gl_compat.h" + #undef GL_SMOOTH #undef GL_FLAT static const int GL_SMOOTH = 0x1D01; diff --git a/targets/util/StringHelpers.h b/targets/util/StringHelpers.h index d7de053ab..d672c630b 100644 --- a/targets/util/StringHelpers.h +++ b/targets/util/StringHelpers.h @@ -7,7 +7,7 @@ std::string toLower(const std::string& a); std::string trimString(const std::string& a); std::string replaceAll(const std::string& in, const std::string& replace, - const std::string& with); + const std::string& with); bool equalsIgnoreCase(const std::string& a, const std::string& b); @@ -41,7 +41,7 @@ std::string wstringtofilename(const std::wstring& name); std::wstring filenametowstring(const char* name); std::vector& stringSplit(const std::string& s, char delim, - std::vector& elems); + std::vector& elems); std::vector stringSplit(const std::string& s, char delim); void stripWhitespaceForHtml(std::string& string, bool bRemoveNewline = true); diff --git a/targets/util/Timer.h b/targets/util/Timer.h index 71ca5e398..5738d0a0c 100644 --- a/targets/util/Timer.h +++ b/targets/util/Timer.h @@ -13,7 +13,10 @@ using clock = std::chrono::steady_clock; using time_point = clock::time_point; template -concept Duration = requires { typename T::rep; typename T::period; }; +concept Duration = requires { + typename T::rep; + typename T::period; +}; namespace detail { @@ -62,16 +65,13 @@ public: line_(where.line()) {} template - ScopedTimer( - std::string_view name, - D min_duration_to_log, - std::source_location where = std::source_location::current()) + ScopedTimer(std::string_view name, D min_duration_to_log, + std::source_location where = std::source_location::current()) : name_(name), file_(detail::base_name(where.file_name())), line_(where.line()), - min_duration_to_log_( - std::chrono::duration_cast(min_duration_to_log)) { - } + min_duration_to_log_(std::chrono::duration_cast( + min_duration_to_log)) {} ~ScopedTimer() noexcept { const auto elapsed = timer_.elapsed(); @@ -82,10 +82,10 @@ public: try { name_.empty() - ? std::println(stderr, "[TIMER] {:.3f} ms ({}:{})", - ms, file_, line_) - : std::println(stderr, "[TIMER] {} - {:.3f} ms ({}:{})", - name_, ms, file_, line_); + ? std::println(stderr, "[TIMER] {:.3f} ms ({}:{})", ms, file_, + line_) + : std::println(stderr, "[TIMER] {} - {:.3f} ms ({}:{})", name_, + ms, file_, line_); } catch (...) { std::fprintf(stderr, "[TIMER] %.3f ms\n", ms); }